On Wed, Feb 05, 2025 at 02:49:04PM -0800, Jacob Pan wrote:
There have been two approaches to solve this problem:
- Create an identity mapping in the stage-1. VMM could insert a few
RMRs (Reserved Memory Regions) in guest's IORT. Then the guest kernel would fetch these RMR entries from the IORT and create an IOMMU_RESV_DIRECT region per iommu group for a direct mapping. Eventually, the mappings would look like: IOVA (0x8000000) === IPA (0x8000000) ===> 0x20200000 This requires an IOMMUFD ioctl for kernel and VMM to agree on the IPA.
Should this RMR be in a separate range than MSI_IOVA_BASE? The guest will have MSI_IOVA_BASE in a reserved region already, no? e.g. # cat /sys/bus/pci/devices/0015:01:00.0/iommu_group/reserved_regions 0x0000000008000000 0x00000000080fffff msi
No. In Patch-9, the driver-defined MSI_IOVA_BASE will be ignored if userspace has assigned IOMMU_OPTION_SW_MSI_START/SIZE, even if they might have the same values as the MSI_IOVA_BASE window.
The idea of MSI_IOVA_BASE in this series is a kernel default that'd be only effective when user space doesn't care to set anything.
Thanks Nicolin