qemu-e2k/hw/core
Eric Auger 9dd5e808fc virtio-iommu: Change the default granule to the host page size
We used to set the default granule to 4KB but with VFIO assignment
it makes more sense to use the actual host page size.

Indeed when hotplugging a VFIO device protected by a virtio-iommu
on a 64kB/64kB host/guest config, we current get a qemu crash:

"vfio: DMA mapping failed, unable to continue"

This is due to the hot-attached VFIO device calling
memory_region_iommu_set_page_size_mask() with 64kB granule
whereas the virtio-iommu granule was already frozen to 4KB on
machine init done.

Set the granule property to "host" and introduce a new compat.
The page size mask used before 9.0 was qemu_target_page_mask().
Since the virtio-iommu currently only supports x86_64 and aarch64,
this matched a 4KB granule.

Note that the new default will prevent 4kB guest on 64kB host
because the granule will be set to 64kB which would be larger
than the guest page size. In that situation, the virtio-iommu
driver fails on viommu_domain_finalise() with
"granule 0x10000 larger than system page size 0x1000".

In that case the workaround is to request 4K granule.

The current limitation of global granule in the virtio-iommu
should be removed and turned into per domain granule. But
until we get this upgraded, this new default is probably
better because I don't think anyone is currently interested in
running a 4KB page size guest with virtio-iommu on a 64KB host.
However supporting 64kB guest on 64kB host with virtio-iommu and
VFIO looks a more important feature.

Signed-off-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Message-Id: <20240307134445.92296-4-eric.auger@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2024-03-12 17:58:26 -04:00
..
bus.c hw/core: Remove transitional infrastructure from BusClass 2024-02-02 13:51:57 +00:00
clock-vmstate.c hw/core: Constify VMState 2023-12-29 11:17:30 +11:00
clock.c
cpu-common.c plugins: create CPUPluginState and migrate plugin_mask 2024-02-28 09:11:42 +00:00
cpu-sysemu.c memory: follow Error API guidelines 2023-10-19 23:13:27 +02:00
fw-path-provider.c
generic-loader.c hw/other: spelling fixes 2023-09-21 11:31:16 +03:00
gpio.c
guest-loader.c
guest-loader.h
hotplug-stubs.c
hotplug.c
irq.c
Kconfig
loader-fit.c
loader.c accel/tcg: Move perf and debuginfo support to tcg/ 2024-01-29 21:04:10 +10:00
machine-hmp-cmds.c qapi: Add query-memory-devices support to hv-balloon 2023-11-06 14:08:10 +01:00
machine-qmp-cmds.c
machine-smp.c hw/core/machine-smp: Calculate total CPUs once in machine_parse_smp_config() 2024-03-09 19:17:01 +01:00
machine.c virtio-iommu: Change the default granule to the host page size 2024-03-12 17:58:26 -04:00
meson.build hw/core: Add ResetContainer which holds objects implementing Resettable 2024-02-27 13:01:42 +00:00
nmi.c
null-machine.c
numa.c hw/acpi: Implement the SRAT GI affinity structure 2024-03-12 17:56:55 -04:00
or-irq.c hw/core: Constify VMState 2023-12-29 11:17:30 +11:00
platform-bus.c
ptimer.c hw/core: Constify VMState 2023-12-29 11:17:30 +11:00
qdev-clock.c
qdev-fw.c
qdev-hotplug.c
qdev-prop-internal.h
qdev-properties-system.c pcie: Support PCIe Gen5/Gen6 link speeds 2024-03-12 17:56:55 -04:00
qdev-properties.c qdev-properties: alias all object class properties 2023-12-21 22:49:28 +01:00
qdev.c hw/core/qdev.c: add qdev_get_human_name() 2024-01-30 16:19:00 -05:00
register.c
reset.c hw/core/reset: Implement qemu_register_reset via qemu_register_resettable 2024-02-27 13:01:42 +00:00
resetcontainer.c hw/core: Add ResetContainer which holds objects implementing Resettable 2024-02-27 13:01:42 +00:00
resettable.c
split-irq.c
stream.c
sysbus-fdt.c
sysbus.c hw/sysbus: Remove now unused sysbus_address_space() 2024-02-26 18:40:21 +01:00
trace-events
trace.h
uboot_image.h
vm-change-state-handler.c
vmstate-if.c