diff mbox series

[v4,1/3] vdpa: Skip protected ram IOMMU mappings

Message ID 20211014141236.923287-2-eperezma@redhat.com
State New
Headers show
Series vdpa: Check iova range on memory regions ops | expand

Commit Message

Eugenio Perez Martin Oct. 14, 2021, 2:12 p.m. UTC
Following the logic of commit 56918a126ae ("memory: Add RAM_PROTECTED
flag to skip IOMMU mappings") with VFIO, skip memory sections
inaccessible via normal mechanisms, including DMA.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
---
 hw/virtio/vhost-vdpa.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Stefano Garzarella Oct. 18, 2021, 9:15 a.m. UTC | #1
On Thu, Oct 14, 2021 at 04:12:34PM +0200, Eugenio Pérez wrote:
>Following the logic of commit 56918a126ae ("memory: Add RAM_PROTECTED
>flag to skip IOMMU mappings") with VFIO, skip memory sections
>inaccessible via normal mechanisms, including DMA.
>
>Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
>Acked-by: Jason Wang <jasowang@redhat.com>
>---
> hw/virtio/vhost-vdpa.c | 1 +
> 1 file changed, 1 insertion(+)

Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
diff mbox series

Patch

diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
index 47d7a5a23d..ea1aa71ad8 100644
--- a/hw/virtio/vhost-vdpa.c
+++ b/hw/virtio/vhost-vdpa.c
@@ -28,6 +28,7 @@  static bool vhost_vdpa_listener_skipped_section(MemoryRegionSection *section)
 {
     return (!memory_region_is_ram(section->mr) &&
             !memory_region_is_iommu(section->mr)) ||
+            memory_region_is_protected(section->mr) ||
            /* vhost-vDPA doesn't allow MMIO to be mapped  */
             memory_region_is_ram_device(section->mr) ||
            /*