aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorEric Auger <eric.auger@redhat.com>2024-07-01 10:48:58 +0200
committerCédric Le Goater <clg@redhat.com>2024-07-09 11:50:37 +0200
commit2457343d05a168963b52ab6d5c2932dd29b93f46 (patch)
tree524267db84da4981140a4b7a57b9bd6e8bba368b /hw
parentd7c8c95fbca2e07d11b98fb1b191d7194d084c7e (diff)
downloadqemu-2457343d05a168963b52ab6d5c2932dd29b93f46.zip
qemu-2457343d05a168963b52ab6d5c2932dd29b93f46.tar.gz
qemu-2457343d05a168963b52ab6d5c2932dd29b93f46.tar.bz2
memory: remove IOMMU MR iommu_set_page_size_mask() callback
Everything is now in place to use the Host IOMMU Device callbacks to retrieve the page size mask usable with a given assigned device. This new method brings the advantage to pass the info much earlier to the virtual IOMMU and before the IOMMU MR gets enabled. So let's remove the call to memory_region_iommu_set_page_size_mask in vfio common.c and remove the single implementation of the IOMMU MR callback in the virtio-iommu.c Signed-off-by: Eric Auger <eric.auger@redhat.com> Reviewed-by: Cédric Le Goater <clg@redhat.com> Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/vfio/common.c8
-rw-r--r--hw/virtio/trace-events1
-rw-r--r--hw/virtio/virtio-iommu.c45
3 files changed, 0 insertions, 54 deletions
diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index 7cdb969..6d15b36 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -622,14 +622,6 @@ static void vfio_listener_region_add(MemoryListener *listener,
int128_get64(llend),
iommu_idx);
- ret = memory_region_iommu_set_page_size_mask(giommu->iommu_mr,
- bcontainer->pgsizes,
- &err);
- if (ret) {
- g_free(giommu);
- goto fail;
- }
-
ret = memory_region_register_iommu_notifier(section->mr, &giommu->n,
&err);
if (ret) {
diff --git a/hw/virtio/trace-events b/hw/virtio/trace-events
index 599d855..b7c04f0 100644
--- a/hw/virtio/trace-events
+++ b/hw/virtio/trace-events
@@ -131,7 +131,6 @@ virtio_iommu_fill_resv_property(uint32_t devid, uint8_t subtype, uint64_t start,
virtio_iommu_notify_map(const char *name, uint64_t virt_start, uint64_t virt_end, uint64_t phys_start, uint32_t flags) "mr=%s virt_start=0x%"PRIx64" virt_end=0x%"PRIx64" phys_start=0x%"PRIx64" flags=%d"
virtio_iommu_notify_unmap(const char *name, uint64_t virt_start, uint64_t virt_end) "mr=%s virt_start=0x%"PRIx64" virt_end=0x%"PRIx64
virtio_iommu_remap(const char *name, uint64_t virt_start, uint64_t virt_end, uint64_t phys_start) "mr=%s virt_start=0x%"PRIx64" virt_end=0x%"PRIx64" phys_start=0x%"PRIx64
-virtio_iommu_set_page_size_mask(const char *name, uint64_t old, uint64_t new) "mr=%s old_mask=0x%"PRIx64" new_mask=0x%"PRIx64
virtio_iommu_update_page_size_mask(const char *name, uint64_t old, uint64_t new) "host iommu device=%s old_mask=0x%"PRIx64" new_mask=0x%"PRIx64
virtio_iommu_notify_flag_add(const char *name) "add notifier to mr %s"
virtio_iommu_notify_flag_del(const char *name) "del notifier from mr %s"
diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c
index d665498..76f34ea 100644
--- a/hw/virtio/virtio-iommu.c
+++ b/hw/virtio/virtio-iommu.c
@@ -1408,50 +1408,6 @@ static int virtio_iommu_notify_flag_changed(IOMMUMemoryRegion *iommu_mr,
return 0;
}
-/*
- * The default mask depends on the "granule" property. For example, with
- * 4k granule, it is -(4 * KiB). When an assigned device has page size
- * restrictions due to the hardware IOMMU configuration, apply this restriction
- * to the mask.
- */
-static int virtio_iommu_set_page_size_mask(IOMMUMemoryRegion *mr,
- uint64_t new_mask,
- Error **errp)
-{
- IOMMUDevice *sdev = container_of(mr, IOMMUDevice, iommu_mr);
- VirtIOIOMMU *s = sdev->viommu;
- uint64_t cur_mask = s->config.page_size_mask;
-
- trace_virtio_iommu_set_page_size_mask(mr->parent_obj.name, cur_mask,
- new_mask);
-
- if ((cur_mask & new_mask) == 0) {
- error_setg(errp, "virtio-iommu %s reports a page size mask 0x%"PRIx64
- " incompatible with currently supported mask 0x%"PRIx64,
- mr->parent_obj.name, new_mask, cur_mask);
- return -1;
- }
-
- /*
- * Once the granule is frozen we can't change the mask anymore. If by
- * chance the hotplugged device supports the same granule, we can still
- * accept it.
- */
- if (s->granule_frozen) {
- int cur_granule = ctz64(cur_mask);
-
- if (!(BIT_ULL(cur_granule) & new_mask)) {
- error_setg(errp, "virtio-iommu %s does not support frozen granule 0x%llx",
- mr->parent_obj.name, BIT_ULL(cur_granule));
- return -1;
- }
- return 0;
- }
-
- s->config.page_size_mask &= new_mask;
- return 0;
-}
-
static void virtio_iommu_system_reset(void *opaque)
{
VirtIOIOMMU *s = opaque;
@@ -1776,7 +1732,6 @@ static void virtio_iommu_memory_region_class_init(ObjectClass *klass,
imrc->translate = virtio_iommu_translate;
imrc->replay = virtio_iommu_replay;
imrc->notify_flag_changed = virtio_iommu_notify_flag_changed;
- imrc->iommu_set_page_size_mask = virtio_iommu_set_page_size_mask;
}
static const TypeInfo virtio_iommu_info = {