summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Gunthorpe <jgg@nvidia.com>2022-11-28 20:31:57 -0400
committerJason Gunthorpe <jgg@nvidia.com>2023-01-11 16:27:23 -0400
commitbf210f793937a634bae6eda6a6d699c00b2b53d9 (patch)
tree2f59938255601c234e229639f321d8b5f572ad5d
parentf188bdb5f1df5b35374482ea0568de85f1f468ea (diff)
downloadlinux-bf210f793937a634bae6eda6a6d699c00b2b53d9.tar.gz
linux-bf210f793937a634bae6eda6a6d699c00b2b53d9.tar.bz2
linux-bf210f793937a634bae6eda6a6d699c00b2b53d9.zip
irq/s390: Add arch_is_isolated_msi() for s390
s390 doesn't use irq_domains, so it has no place to set IRQ_DOMAIN_FLAG_ISOLATED_MSI. Instead of continuing to abuse the iommu subsystem to convey this information add a simple define which s390 can make statically true. The define will cause msi_device_has_isolated() to return true. Remove IOMMU_CAP_INTR_REMAP from the s390 iommu driver. Link: https://lore.kernel.org/r/8-v3-3313bb5dd3a3+10f11-secure_msi_jgg@nvidia.com Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com> Tested-by: Matthew Rosato <mjrosato@linux.ibm.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
-rw-r--r--arch/s390/include/asm/msi.h17
-rw-r--r--drivers/iommu/s390-iommu.c2
-rw-r--r--include/linux/msi.h10
-rw-r--r--kernel/irq/msi.c2
4 files changed, 25 insertions, 6 deletions
diff --git a/arch/s390/include/asm/msi.h b/arch/s390/include/asm/msi.h
new file mode 100644
index 000000000000..399343ed9ffb
--- /dev/null
+++ b/arch/s390/include/asm/msi.h
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_S390_MSI_H
+#define _ASM_S390_MSI_H
+#include <asm-generic/msi.h>
+
+/*
+ * Work around S390 not using irq_domain at all so we can't set
+ * IRQ_DOMAIN_FLAG_ISOLATED_MSI. See for an explanation how it works:
+ *
+ * https://lore.kernel.org/r/31af8174-35e9-ebeb-b9ef-74c90d4bfd93@linux.ibm.com/
+ *
+ * Note this is less isolated than the ARM/x86 versions as userspace can trigger
+ * MSI belonging to kernel devices within the same gisa.
+ */
+#define arch_is_isolated_msi() true
+
+#endif
diff --git a/drivers/iommu/s390-iommu.c b/drivers/iommu/s390-iommu.c
index ed33c6cce083..bb00580a30d8 100644
--- a/drivers/iommu/s390-iommu.c
+++ b/drivers/iommu/s390-iommu.c
@@ -34,8 +34,6 @@ static bool s390_iommu_capable(struct device *dev, enum iommu_cap cap)
switch (cap) {
case IOMMU_CAP_CACHE_COHERENCY:
return true;
- case IOMMU_CAP_INTR_REMAP:
- return true;
default:
return false;
}
diff --git a/include/linux/msi.h b/include/linux/msi.h
index e8a3f3a8a7f4..13c9b74a4575 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -48,6 +48,10 @@ typedef struct arch_msi_msg_data {
} __attribute__ ((packed)) arch_msi_msg_data_t;
#endif
+#ifndef arch_is_isolated_msi
+#define arch_is_isolated_msi() false
+#endif
+
/**
* msi_msg - Representation of a MSI message
* @address_lo: Low 32 bits of msi message address
@@ -657,10 +661,10 @@ static inline bool msi_device_has_isolated_msi(struct device *dev)
/*
* Arguably if the platform does not enable MSI support then it has
* "isolated MSI", as an interrupt controller that cannot receive MSIs
- * is inherently isolated by our definition. As nobody seems to needs
- * this be conservative and return false anyhow.
+ * is inherently isolated by our definition. The default definition for
+ * arch_is_isolated_msi() is conservative and returns false anyhow.
*/
- return false;
+ return arch_is_isolated_msi();
}
#endif /* CONFIG_GENERIC_MSI_IRQ */
diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c
index ac5e224a11b9..4dec57fc4ea6 100644
--- a/kernel/irq/msi.c
+++ b/kernel/irq/msi.c
@@ -1647,6 +1647,6 @@ bool msi_device_has_isolated_msi(struct device *dev)
for (; domain; domain = domain->parent)
if (domain->flags & IRQ_DOMAIN_FLAG_ISOLATED_MSI)
return true;
- return false;
+ return arch_is_isolated_msi();
}
EXPORT_SYMBOL_GPL(msi_device_has_isolated_msi);