From: Jason Gunthorpe Date: Mon, 23 Jan 2023 18:24:04 +0000 (-0400) Subject: Merge branch 'isolated_msi' into iommufd.git for-next X-Git-Tag: v6.6.7~3431^2~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fc3873095a09ce969543fa4a17fee271c8ca3566;p=platform%2Fkernel%2Flinux-starfive.git Merge branch 'isolated_msi' into iommufd.git for-next Jason Gunthorpe says: ==================== Harmonize these into a single irq_domain based check under msi_device_has_isolated_msi(). In real HW "isolated MSI" is implemented in a few different ways: - x86 uses "interrupt remapping" which is a block that sits between the device and APIC, that can "remap" the MSI MemWr. AMD uses per-RID tables to implement isolation while Intel stores the authorized RID in each IRTE entry. Part of the remapping is discarding, HW will not forward MSIs that don't positively match the tables. - ARM GICv3 ITS integrates the concept of an out-of-band "device ID" directly into the interrupt controller logic. The tables the GIC checks that determine how to deliver the interrupt through the ITS device table and interrupt translation tables allow limiting which interrupts device IDs can trigger. - S390 has unconditionally claimed it has isolated MSI through the iommu driver. This is a weaker version of the other arches in that it only works between "gisa" domains. See zpci_set_airq() and https://lore.kernel.org/r/31af8174-35e9-ebeb-b9ef-74c90d4bfd93@linux.ibm.com/ After this series the "isolated MSI" is tagged based only on the irq_domains that the interrupt travels through. For x86 enabling interrupt remapping causes IR irq_domains to be installed in the path, and they can carry the IRQ_DOMAIN_FLAG_ISOLATED_MSI. For ARM the GICv3 ITS itself already sets the flag when it is running in a isolated mode, and S390 simply sets it always through an arch hook since it doesn't use irq_domains at all. This removes the intrusion of IRQ subsystem information into the iommu drivers. Linux's iommu_domains abstraction has no bearing at all on the security of MSI. Even if HW linked to the IOMMU may implement the security on x86 implementations, Linux models that HW through the irq_domain, not the iommu_domain. ==================== * branch 'isolated_msi': iommu: Remove IOMMU_CAP_INTR_REMAP irq/s390: Add arch_is_isolated_msi() for s390 iommu/x86: Replace IOMMU_CAP_INTR_REMAP with IRQ_DOMAIN_FLAG_ISOLATED_MSI genirq/msi: Rename IRQ_DOMAIN_MSI_REMAP to IRQ_DOMAIN_ISOLATED_MSI genirq/irqdomain: Remove unused irq_domain_check_msi_remap() code iommufd: Convert to msi_device_has_isolated_msi() vfio/type1: Convert to iommu_group_has_isolated_msi() iommu: Add iommu_group_has_isolated_msi() genirq/msi: Add msi_device_has_isolated_msi() Link: https://lore.kernel.org/r/0-v3-3313bb5dd3a3+10f11-secure_msi_jgg@nvidia.com Signed-off-by: Jason Gunthorpe --- fc3873095a09ce969543fa4a17fee271c8ca3566