> -----Original Message----- > From: Yi Liu <yi.l....@intel.com> > Sent: Thursday, June 12, 2025 1:54 PM > To: Duan, Zhenzhong <zhenzhong.d...@intel.com>; Nicolin Chen > <nicol...@nvidia.com> > Cc: Peter Xu <pet...@redhat.com>; qemu-devel@nongnu.org; > alex.william...@redhat.com; c...@redhat.com; eric.au...@redhat.com; > m...@redhat.com; jasow...@redhat.com; ddut...@redhat.com; > j...@nvidia.com; Shameerali Kolothum Thodi > <shameerali.kolothum.th...@huawei.com>; joao.m.mart...@oracle.com; > clement.mathieu--d...@eviden.com; Tian, Kevin <kevin.t...@intel.com>; > Peng, Chao P <chao.p.p...@intel.com>; Yi Sun <yi.y....@linux.intel.com>; > Marcel Apfelbaum <marcel.apfelb...@gmail.com>; Paolo Bonzini > <pbonz...@redhat.com>; Richard Henderson > <richard.hender...@linaro.org>; Eduardo Habkost > <edua...@habkost.net> > Subject: Re: [PATCH rfcv3 15/21] intel_iommu: Bind/unbind guest page > table to host > >> The "switch" in vSMMU model is only needed by KVM for MSI doorbell > >> translation. By thinking it carefully, maybe it shouldn't switch AS > >> because VFIO might be confused if it somehow does get_address_space > >> again in the future.. > > @Nicolin, not quite get the detailed logic for the MSI stuff on SMMU. But I > agree with the last sentence. get_address_space should return a consistent > AS.
I think it is because, in ARM world the MSI doorbell address is translated by an IOMMU. Hence, if the Guest device is behind IOMMU, it needs to return the IOMMU AS in, kvm_irqchip_add_msi_route() kvm_arch_fixup_msi_route() pci_device_iommu_address_space() --> .get_address_space() -->At this point we now return IOMMU AS. If not the device will be configured with a wrong MSI doorbell address. Nicolin, you seems to suggest we could avoid this switching and always return System AS. Does that mean we handle this KVM/MSI case separately? Could you please detail out the idea? Thanks, Shameer