15bd05b1aSSebastien Boeuf // Copyright © 2021 Intel Corporation 25bd05b1aSSebastien Boeuf // 35bd05b1aSSebastien Boeuf // SPDX-License-Identifier: Apache-2.0 OR BSD-3-Clause 45bd05b1aSSebastien Boeuf 5*60c8a72eSBo Chen /// Trait to trigger DMA mapping updates for devices managed by virtio-iommu 6*60c8a72eSBo Chen /// 75bd05b1aSSebastien Boeuf /// Trait meant for triggering the DMA mapping update related to an external 85bd05b1aSSebastien Boeuf /// device not managed fully through virtio. It is dedicated to virtio-iommu 95bd05b1aSSebastien Boeuf /// in order to trigger the map update anytime the mapping is updated from the 105bd05b1aSSebastien Boeuf /// guest. 115bd05b1aSSebastien Boeuf pub trait ExternalDmaMapping: Send + Sync { 125bd05b1aSSebastien Boeuf /// Map a memory range map(&self, iova: u64, gpa: u64, size: u64) -> std::result::Result<(), std::io::Error>135bd05b1aSSebastien Boeuf fn map(&self, iova: u64, gpa: u64, size: u64) -> std::result::Result<(), std::io::Error>; 145bd05b1aSSebastien Boeuf 155bd05b1aSSebastien Boeuf /// Unmap a memory range unmap(&self, iova: u64, size: u64) -> std::result::Result<(), std::io::Error>165bd05b1aSSebastien Boeuf fn unmap(&self, iova: u64, size: u64) -> std::result::Result<(), std::io::Error>; 175bd05b1aSSebastien Boeuf } 18