[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-arm] [RFC v5 20/22] hw/vfio/common: Set the IOMMUMemoryRegion supp
From: |
Eric Auger |
Subject: |
[Qemu-arm] [RFC v5 20/22] hw/vfio/common: Set the IOMMUMemoryRegion supported page sizes |
Date: |
Fri, 19 Jan 2018 14:49:13 +0000 |
We store the page_size_mask in the container and on
vfio_listener_region_add(), the information is conveyed
to the IOMMUMemoryRegion.
Signed-off-by: Eric Auger <address@hidden>
---
hw/vfio/common.c | 5 +++++
include/hw/vfio/vfio-common.h | 1 +
2 files changed, 6 insertions(+)
diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index b77be3a..35b83fe 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -480,6 +480,7 @@ static void vfio_listener_region_add(MemoryListener
*listener,
if (memory_region_is_iommu(section->mr)) {
VFIOGuestIOMMU *giommu;
IOMMUMemoryRegion *iommu_mr = IOMMU_MEMORY_REGION(section->mr);
+ IOMMUMemoryRegionClass *imrc = IOMMU_MEMORY_REGION_GET_CLASS(iommu_mr);
trace_vfio_listener_region_add_iommu(iova, end);
/*
@@ -500,6 +501,9 @@ static void vfio_listener_region_add(MemoryListener
*listener,
IOMMU_NOTIFIER_ALL,
section->offset_within_region,
int128_get64(llend));
+ if (imrc->set_page_size_mask) {
+ imrc->set_page_size_mask(iommu_mr, container->page_size_mask);
+ }
QLIST_INSERT_HEAD(&container->giommu_list, giommu, giommu_next);
memory_region_register_iommu_notifier(section->mr, &giommu->n);
@@ -1027,6 +1031,7 @@ static int vfio_connect_container(VFIOGroup *group,
AddressSpace *as,
/* Assume 4k IOVA page size */
info.iova_pgsizes = 4096;
}
+ container->page_size_mask = info.iova_pgsizes;
vfio_host_win_add(container, 0, (hwaddr)-1, info.iova_pgsizes);
} else if (ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_SPAPR_TCE_IOMMU) ||
ioctl(fd, VFIO_CHECK_EXTENSION, VFIO_SPAPR_TCE_v2_IOMMU)) {
diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h
index f3a2ac9..221cc30 100644
--- a/include/hw/vfio/vfio-common.h
+++ b/include/hw/vfio/vfio-common.h
@@ -79,6 +79,7 @@ typedef struct VFIOContainer {
int fd; /* /dev/vfio/vfio, empowered by the attached groups */
MemoryListener listener;
MemoryListener prereg_listener;
+ uint64_t page_size_mask; /* page sizes supported for this container */
unsigned iommu_type;
int error;
bool initialized;
--
1.9.1
- [Qemu-arm] [RFC v5 10/22] virtio-iommu: Implement attach/detach command, (continued)
- [Qemu-arm] [RFC v5 10/22] virtio-iommu: Implement attach/detach command, Eric Auger, 2018/01/19
- [Qemu-arm] [RFC v5 11/22] virtio-iommu: Implement map/unmap, Eric Auger, 2018/01/19
- [Qemu-arm] [RFC v5 12/22] virtio-iommu: Implement translate, Eric Auger, 2018/01/19
- [Qemu-arm] [RFC v5 13/22] virtio-iommu: Implement probe request, Eric Auger, 2018/01/19
- [Qemu-arm] [RFC v5 14/22] virtio-iommu: Add an msi_bypass property, Eric Auger, 2018/01/19
- [Qemu-arm] [RFC v5 15/22] virtio-iommu: Implement fault reporting, Eric Auger, 2018/01/19
- [Qemu-arm] [RFC v5 16/22] virtio_iommu: Handle reserved regions in translation process, Eric Auger, 2018/01/19
- [Qemu-arm] [RFC v5 17/22] hw/arm/virt: Add virtio-iommu to the virt board, Eric Auger, 2018/01/19
- [Qemu-arm] [RFC v5 18/22] hw/arm/virt-acpi-build: Add virtio-iommu node in IORT table, Eric Auger, 2018/01/19
- [Qemu-arm] [RFC v5 19/22] memory.h: Add set_page_size_mask IOMMUMemoryRegion callback, Eric Auger, 2018/01/19
- [Qemu-arm] [RFC v5 20/22] hw/vfio/common: Set the IOMMUMemoryRegion supported page sizes,
Eric Auger <=
- [Qemu-arm] [RFC v5 21/22] virtio-iommu: Implement set_page_size_mask, Eric Auger, 2018/01/19
- [Qemu-arm] [RFC v5 22/22] hw/vfio/common: Do not print error when viommu translates into an mmio region, Eric Auger, 2018/01/19