These two patches will be included in the series that adds support for Arm CCA guests to QEMU, which isn't ready to be merged [1], but I'm sending them as RFC first to seek advice about the best way to implement this.
There is a breaking change to CCA guests, where DMA addresses now have the "shared" top bit set. The VMM needs to strip the address before accessing memory. See more details on patch 2 of this RFC and on the Linux change: https://lore.kernel.org/all/20250219220751.1276854-1-suzuki.poul...@arm.com/ Patch 2 inserts an IOMMUMemoryRegion on the DMA path, so all DMA accesses get the top bit stripped. It also adds RAM discard listeners (guest_memfd -> IOMMU notifiers) so that we can create VFIO mappings in the top half of the guest address space. Patch 1 is a hack to support GPA->VA translation during the discard_populate notification. I'm testing VFIO support using Chenyi Qiang's series for shared device assignment [2] [1] https://lore.kernel.org/qemu-devel/20241125195626.856992-2-jean-phili...@linaro.org/ [2] https://lore.kernel.org/qemu-devel/20250217081833.21568-1-chenyi.qi...@intel.com/ Jean-Philippe Brucker (2): system/memory: Allow creating IOMMU mappings from RAM discard populate notifiers target/arm/kvm-rme: Add DMA remapping for the shared memory region include/exec/memory.h | 5 + target/arm/kvm_arm.h | 15 +++ hw/arm/virt.c | 2 + system/memory.c | 3 +- target/arm/kvm-rme.c | 220 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 244 insertions(+), 1 deletion(-) -- 2.48.1