[RFC PATCH v3 08/14] irqchip/riscv-imsic: Define IOMMU IRQ bypass protocol
Andrew Jones
andrew.jones at oss.qualcomm.com
Mon Sep 28 07:31:07 PDT 2026
Define the RISC-V IOMMU payload for irq_set_vcpu_affinity(), including
domain-wide target setup and individual target updates for IMSIC and
MRIF targets.
Signed-off-by: Andrew Jones <andrew.jones at oss.qualcomm.com>
---
include/linux/irqchip/riscv-imsic.h | 52 +++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
diff --git a/include/linux/irqchip/riscv-imsic.h b/include/linux/irqchip/riscv-imsic.h
index 662cb0442424..d024a6524baa 100644
--- a/include/linux/irqchip/riscv-imsic.h
+++ b/include/linux/irqchip/riscv-imsic.h
@@ -104,4 +104,56 @@ struct fwnode_handle *imsic_acpi_get_fwnode(struct device *dev);
static inline struct fwnode_handle *imsic_acpi_get_fwnode(struct device *dev) { return NULL; }
#endif
+enum riscv_iommu_ir_cmd {
+ RISCV_IOMMU_IR_INVALID_CMD,
+ RISCV_IOMMU_IR_FORWARD,
+ RISCV_IOMMU_IR_UPDATE_TARGET,
+};
+
+enum riscv_iommu_ir_target_type {
+ RISCV_IOMMU_IR_TARGET_INVALID,
+ RISCV_IOMMU_IR_TARGET_IMSIC,
+ RISCV_IOMMU_IR_TARGET_MRIF,
+};
+
+struct riscv_iommu_ir_target {
+ u64 gpa;
+ enum riscv_iommu_ir_target_type type;
+ union {
+ u64 hpa;
+ struct {
+ u64 mrif_hpa;
+ u64 notice_hpa;
+ u32 notice_id;
+ };
+ };
+};
+
+/*
+ * FORWARD enables forwarding for one IRQ and provides the complete target array
+ * so the first forwarded IRQ can initialize the domain MSI table. UPDATE_TARGET
+ * replaces one target without changing per-IRQ forwarding state. The caller
+ * must quiesce all MSI producers using the table when changing both words of a
+ * live MRIF PTE because the update temporarily invalidates the entry. A NULL
+ * vcpu_info disables forwarding for the IRQ.
+ *
+ * A well-formed request which is incompatible with the producer or current
+ * domain configuration returns -EOPNOTSUPP, allowing the caller to fall back
+ * to host delivery. Invalid payloads return -EINVAL and operational errors are
+ * propagated.
+ */
+struct riscv_iommu_ir_vcpu_info {
+ enum riscv_iommu_ir_cmd cmd;
+ const void *owner;
+ u64 msi_addr_mask;
+ u64 msi_addr_pattern;
+ union {
+ struct {
+ const struct riscv_iommu_ir_target *targets;
+ unsigned int nr_targets;
+ };
+ struct riscv_iommu_ir_target target;
+ };
+};
+
#endif
--
2.43.0
More information about the linux-riscv
mailing list