* [v10 01/10] iommu: Add new member capability to struct irq_remap_ops
[not found] ` <1433827237-3382-1-git-send-email-feng.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2015-06-09 5:20 ` Feng Wu
2015-06-09 5:20 ` [v10 03/10] iommu: dmar: Provide helper to copy shared irte fields Feng Wu
` (6 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Feng Wu @ 2015-06-09 5:20 UTC (permalink / raw)
To: joro-zLv9SwRftAIdnm+yROfE0A, dwmw2-wEGCiKHe2LqWVfeAwA7xHQ,
tglx-hfZtesqFncYOwBW4kG4KsQ
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
jiang.liu-VuQAYsv1563Yd54FQh9/CA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Add a new member 'capability' to struct irq_remap_ops for storing
information about available capabilities such as VT-d
Posted-Interrupts.
Signed-off-by: Feng Wu <feng.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Reviewed-by: Jiang Liu <jiang.liu-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Reviewed-by: Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
Acked-by: Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
---
arch/x86/include/asm/irq_remapping.h | 4 ++++
drivers/iommu/irq_remapping.h | 3 +++
2 files changed, 7 insertions(+)
diff --git a/arch/x86/include/asm/irq_remapping.h b/arch/x86/include/asm/irq_remapping.h
index 78974fb..8b432dd 100644
--- a/arch/x86/include/asm/irq_remapping.h
+++ b/arch/x86/include/asm/irq_remapping.h
@@ -29,6 +29,10 @@
struct msi_msg;
struct irq_alloc_info;
+enum irq_remap_cap {
+ IRQ_POSTING_CAP = 0,
+};
+
#ifdef CONFIG_IRQ_REMAP
extern void set_irq_remapping_broken(void);
diff --git a/drivers/iommu/irq_remapping.h b/drivers/iommu/irq_remapping.h
index 91d5a11..b6ca30d 100644
--- a/drivers/iommu/irq_remapping.h
+++ b/drivers/iommu/irq_remapping.h
@@ -35,6 +35,9 @@ extern int no_x2apic_optout;
extern int irq_remapping_enabled;
struct irq_remap_ops {
+ /* The supported capabilities */
+ int capability;
+
/* Initializes hardware and makes it ready for remapping interrupts */
int (*prepare)(void);
--
2.1.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* [v10 03/10] iommu: dmar: Provide helper to copy shared irte fields
[not found] ` <1433827237-3382-1-git-send-email-feng.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-06-09 5:20 ` [v10 01/10] iommu: Add new member capability to struct irq_remap_ops Feng Wu
@ 2015-06-09 5:20 ` Feng Wu
2015-06-09 5:20 ` [v10 05/10] iommu, x86: Save the mode (posted or remapped) of an IRTE Feng Wu
` (5 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Feng Wu @ 2015-06-09 5:20 UTC (permalink / raw)
To: joro-zLv9SwRftAIdnm+yROfE0A, dwmw2-wEGCiKHe2LqWVfeAwA7xHQ,
tglx-hfZtesqFncYOwBW4kG4KsQ
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
jiang.liu-VuQAYsv1563Yd54FQh9/CA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
From: Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
Instead of open coding, provide a helper function to copy the shared
irte fields.
Signed-off-by: Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
---
include/linux/dmar.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/include/linux/dmar.h b/include/linux/dmar.h
index 0dbcabc..e9bc929 100644
--- a/include/linux/dmar.h
+++ b/include/linux/dmar.h
@@ -249,6 +249,18 @@ struct irte {
};
};
+static inline void dmar_copy_shared_irte(struct irte *dst, struct irte *src)
+{
+ dst->present = src->present;
+ dst->fpd = src->fpd;
+ dst->avail = src->avail;
+ dst->pst = src->pst;
+ dst->vector = src->vector;
+ dst->sid = src->sid;
+ dst->sq = src->sq;
+ dst->svt = src->svt;
+}
+
#define PDA_LOW_BIT 26
#define PDA_HIGH_BIT 32
--
2.1.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* [v10 05/10] iommu, x86: Save the mode (posted or remapped) of an IRTE
[not found] ` <1433827237-3382-1-git-send-email-feng.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-06-09 5:20 ` [v10 01/10] iommu: Add new member capability to struct irq_remap_ops Feng Wu
2015-06-09 5:20 ` [v10 03/10] iommu: dmar: Provide helper to copy shared irte fields Feng Wu
@ 2015-06-09 5:20 ` Feng Wu
2015-06-09 5:20 ` [v10 06/10] iommu, x86: Avoid migrating VT-d posted interrupts Feng Wu
` (4 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Feng Wu @ 2015-06-09 5:20 UTC (permalink / raw)
To: joro-zLv9SwRftAIdnm+yROfE0A, dwmw2-wEGCiKHe2LqWVfeAwA7xHQ,
tglx-hfZtesqFncYOwBW4kG4KsQ
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
jiang.liu-VuQAYsv1563Yd54FQh9/CA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Add a new field to struct irq_2_iommu, which captures whether the
associated IRTE is in posted mode or remapped mode. We update this
field when the IRTE is written into the table.
Suggested-by: Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
Signed-off-by: Feng Wu <feng.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Reviewed-by: Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
Acked-by: Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
---
drivers/iommu/intel_irq_remapping.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_remapping.c
index a643eec..68bce0a 100644
--- a/drivers/iommu/intel_irq_remapping.c
+++ b/drivers/iommu/intel_irq_remapping.c
@@ -18,6 +18,11 @@
#include "irq_remapping.h"
+enum irq_mode {
+ IRQ_REMAPPING,
+ IRQ_POSTING,
+};
+
struct ioapic_scope {
struct intel_iommu *iommu;
unsigned int id;
@@ -37,6 +42,7 @@ struct irq_2_iommu {
u16 irte_index;
u16 sub_handle;
u8 irte_mask;
+ enum irq_mode mode;
};
struct intel_ir_data {
@@ -104,6 +110,7 @@ static int alloc_irte(struct intel_iommu *iommu, int irq,
irq_iommu->irte_index = index;
irq_iommu->sub_handle = 0;
irq_iommu->irte_mask = mask;
+ irq_iommu->mode = IRQ_REMAPPING;
}
raw_spin_unlock_irqrestore(&irq_2_ir_lock, flags);
@@ -144,6 +151,9 @@ static int modify_irte(struct irq_2_iommu *irq_iommu,
__iommu_flush_cache(iommu, irte, sizeof(*irte));
rc = qi_flush_iec(iommu, index, 0);
+
+ /* Update iommu mode according to the IRTE mode */
+ irq_iommu->mode = irte->pst ? IRQ_POSTING : IRQ_REMAPPING;
raw_spin_unlock_irqrestore(&irq_2_ir_lock, flags);
return rc;
--
2.1.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* [v10 06/10] iommu, x86: Avoid migrating VT-d posted interrupts
[not found] ` <1433827237-3382-1-git-send-email-feng.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
` (2 preceding siblings ...)
2015-06-09 5:20 ` [v10 05/10] iommu, x86: Save the mode (posted or remapped) of an IRTE Feng Wu
@ 2015-06-09 5:20 ` Feng Wu
2015-06-09 5:20 ` [v10 07/10] iommu, x86: Add cap_pi_support() to detect VT-d PI capability Feng Wu
` (3 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Feng Wu @ 2015-06-09 5:20 UTC (permalink / raw)
To: joro-zLv9SwRftAIdnm+yROfE0A, dwmw2-wEGCiKHe2LqWVfeAwA7xHQ,
tglx-hfZtesqFncYOwBW4kG4KsQ
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
jiang.liu-VuQAYsv1563Yd54FQh9/CA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
When the interrupt is configured in posted mode, the destination of
the interrupt is set in the Posted-Interrupts Descriptor and the
migration of these interrupts happens during vCPU scheduling.
We still update the cached irte, which will be used when changing back
to remapping mode, but we avoid writing the table entry.
Signed-off-by: Feng Wu <feng.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Reviewed-by: Jiang Liu <jiang.liu-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Acked-by: David Woodhouse <David.Woodhouse-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Reviewed-by: Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
Acked-by: Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
---
drivers/iommu/intel_irq_remapping.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_remapping.c
index 68bce0a..3bcb459 100644
--- a/drivers/iommu/intel_irq_remapping.c
+++ b/drivers/iommu/intel_irq_remapping.c
@@ -1003,7 +1003,10 @@ intel_ir_set_affinity(struct irq_data *data, const struct cpumask *mask,
*/
irte->vector = cfg->vector;
irte->dest_id = IRTE_DEST(cfg->dest_apicid);
- modify_irte(&ir_data->irq_2_iommu, irte);
+
+ /* Update the hardware only if the interrupt is in remapped mode. */
+ if (ir_data->irq_2_iommu.mode == IRQ_REMAPPING)
+ modify_irte(&ir_data->irq_2_iommu, irte);
/*
* After this point, all the interrupts will start arriving
--
2.1.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* [v10 07/10] iommu, x86: Add cap_pi_support() to detect VT-d PI capability
[not found] ` <1433827237-3382-1-git-send-email-feng.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
` (3 preceding siblings ...)
2015-06-09 5:20 ` [v10 06/10] iommu, x86: Avoid migrating VT-d posted interrupts Feng Wu
@ 2015-06-09 5:20 ` Feng Wu
2015-06-09 5:20 ` [v10 08/10] iommu, x86: Setup Posted-Interrupts capability for Intel iommu Feng Wu
` (2 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Feng Wu @ 2015-06-09 5:20 UTC (permalink / raw)
To: joro-zLv9SwRftAIdnm+yROfE0A, dwmw2-wEGCiKHe2LqWVfeAwA7xHQ,
tglx-hfZtesqFncYOwBW4kG4KsQ
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
jiang.liu-VuQAYsv1563Yd54FQh9/CA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Add helper function to detect VT-d Posted-Interrupts capability.
Signed-off-by: Feng Wu <feng.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Reviewed-by: Jiang Liu <jiang.liu-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Acked-by: David Woodhouse <David.Woodhouse-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Reviewed-by: Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
Acked-by: Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
---
include/linux/intel-iommu.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index 0af9b03..0c251be 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -87,6 +87,7 @@ static inline void dmar_writeq(void __iomem *addr, u64 val)
/*
* Decoding Capability Register
*/
+#define cap_pi_support(c) (((c) >> 59) & 1)
#define cap_read_drain(c) (((c) >> 55) & 1)
#define cap_write_drain(c) (((c) >> 54) & 1)
#define cap_max_amask_val(c) (((c) >> 48) & 0x3f)
--
2.1.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* [v10 08/10] iommu, x86: Setup Posted-Interrupts capability for Intel iommu
[not found] ` <1433827237-3382-1-git-send-email-feng.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
` (4 preceding siblings ...)
2015-06-09 5:20 ` [v10 07/10] iommu, x86: Add cap_pi_support() to detect VT-d PI capability Feng Wu
@ 2015-06-09 5:20 ` Feng Wu
2015-06-09 5:20 ` [v10 09/10] iommu, x86: Provide irq_remapping_cap() interface Feng Wu
2015-06-09 5:20 ` [v10 10/10] iommu, x86: Properly handle posted interrupts for IOMMU hotplug Feng Wu
7 siblings, 0 replies; 11+ messages in thread
From: Feng Wu @ 2015-06-09 5:20 UTC (permalink / raw)
To: joro-zLv9SwRftAIdnm+yROfE0A, dwmw2-wEGCiKHe2LqWVfeAwA7xHQ,
tglx-hfZtesqFncYOwBW4kG4KsQ
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
jiang.liu-VuQAYsv1563Yd54FQh9/CA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Set Posted-Interrupts capability for Intel iommu when Interrupt
Remapping is enabled, clear it when disabled.
Signed-off-by: Feng Wu <feng.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Reviewed-by: Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
Acked-by: Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
---
drivers/iommu/intel_irq_remapping.c | 30 ++++++++++++++++++++++++++++++
drivers/iommu/irq_remapping.c | 2 ++
drivers/iommu/irq_remapping.h | 3 +++
3 files changed, 35 insertions(+)
diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_remapping.c
index 3bcb459..0f57af7 100644
--- a/drivers/iommu/intel_irq_remapping.c
+++ b/drivers/iommu/intel_irq_remapping.c
@@ -581,6 +581,26 @@ error:
return -ENODEV;
}
+/*
+ * Set Posted-Interrupts capability.
+ */
+static inline void set_irq_posting_cap(void)
+{
+ struct dmar_drhd_unit *drhd;
+ struct intel_iommu *iommu;
+
+ if (!disable_irq_post) {
+ intel_irq_remap_ops.capability |= 1 << IRQ_POSTING_CAP;
+
+ for_each_iommu(iommu, drhd)
+ if (!cap_pi_support(iommu->cap)) {
+ intel_irq_remap_ops.capability &=
+ ~(1 << IRQ_POSTING_CAP);
+ break;
+ }
+ }
+}
+
static int __init intel_enable_irq_remapping(void)
{
struct dmar_drhd_unit *drhd;
@@ -656,6 +676,8 @@ static int __init intel_enable_irq_remapping(void)
irq_remapping_enabled = 1;
+ set_irq_posting_cap();
+
pr_info("Enabled IRQ remapping in %s mode\n", eim ? "x2apic" : "xapic");
return eim ? IRQ_REMAP_X2APIC_MODE : IRQ_REMAP_XAPIC_MODE;
@@ -856,6 +878,12 @@ static void disable_irq_remapping(void)
iommu_disable_irq_remapping(iommu);
}
+
+ /*
+ * Clear Posted-Interrupts capability.
+ */
+ if (!disable_irq_post)
+ intel_irq_remap_ops.capability &= ~(1 << IRQ_POSTING_CAP);
}
static int reenable_irq_remapping(int eim)
@@ -883,6 +911,8 @@ static int reenable_irq_remapping(int eim)
if (!setup)
goto error;
+ set_irq_posting_cap();
+
return 0;
error:
diff --git a/drivers/iommu/irq_remapping.c b/drivers/iommu/irq_remapping.c
index fc78b0d..ed605a9 100644
--- a/drivers/iommu/irq_remapping.c
+++ b/drivers/iommu/irq_remapping.c
@@ -22,6 +22,8 @@ int irq_remap_broken;
int disable_sourceid_checking;
int no_x2apic_optout;
+int disable_irq_post = 1;
+
static int disable_irq_remap;
static struct irq_remap_ops *remap_ops;
diff --git a/drivers/iommu/irq_remapping.h b/drivers/iommu/irq_remapping.h
index b6ca30d..039c7af 100644
--- a/drivers/iommu/irq_remapping.h
+++ b/drivers/iommu/irq_remapping.h
@@ -34,6 +34,8 @@ extern int disable_sourceid_checking;
extern int no_x2apic_optout;
extern int irq_remapping_enabled;
+extern int disable_irq_post;
+
struct irq_remap_ops {
/* The supported capabilities */
int capability;
@@ -69,6 +71,7 @@ extern void ir_ack_apic_edge(struct irq_data *data);
#define irq_remapping_enabled 0
#define irq_remap_broken 0
+#define disable_irq_post 1
#endif /* CONFIG_IRQ_REMAP */
--
2.1.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* [v10 09/10] iommu, x86: Provide irq_remapping_cap() interface
[not found] ` <1433827237-3382-1-git-send-email-feng.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
` (5 preceding siblings ...)
2015-06-09 5:20 ` [v10 08/10] iommu, x86: Setup Posted-Interrupts capability for Intel iommu Feng Wu
@ 2015-06-09 5:20 ` Feng Wu
2015-06-09 5:20 ` [v10 10/10] iommu, x86: Properly handle posted interrupts for IOMMU hotplug Feng Wu
7 siblings, 0 replies; 11+ messages in thread
From: Feng Wu @ 2015-06-09 5:20 UTC (permalink / raw)
To: joro-zLv9SwRftAIdnm+yROfE0A, dwmw2-wEGCiKHe2LqWVfeAwA7xHQ,
tglx-hfZtesqFncYOwBW4kG4KsQ
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
jiang.liu-VuQAYsv1563Yd54FQh9/CA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Add a new interface irq_remapping_cap() to detect whether irq
remapping supports new features, such as VT-d Posted-Interrupts.
Export the function, so that KVM code can check this and use this
mechanism properly.
Signed-off-by: Feng Wu <feng.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Reviewed-by: Jiang Liu <jiang.liu-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Reviewed-by: Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
Acked-by: Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
---
arch/x86/include/asm/irq_remapping.h | 2 ++
drivers/iommu/irq_remapping.c | 9 +++++++++
2 files changed, 11 insertions(+)
diff --git a/arch/x86/include/asm/irq_remapping.h b/arch/x86/include/asm/irq_remapping.h
index e479fbd..046c7fb 100644
--- a/arch/x86/include/asm/irq_remapping.h
+++ b/arch/x86/include/asm/irq_remapping.h
@@ -35,6 +35,7 @@ enum irq_remap_cap {
#ifdef CONFIG_IRQ_REMAP
+extern bool irq_remapping_cap(enum irq_remap_cap cap);
extern void set_irq_remapping_broken(void);
extern int irq_remapping_prepare(void);
extern int irq_remapping_enable(void);
@@ -64,6 +65,7 @@ struct vcpu_data {
#else /* CONFIG_IRQ_REMAP */
+static inline bool irq_remapping_cap(enum irq_remap_cap cap) { return 0; }
static inline void set_irq_remapping_broken(void) { }
static inline int irq_remapping_prepare(void) { return -ENODEV; }
static inline int irq_remapping_enable(void) { return -ENODEV; }
diff --git a/drivers/iommu/irq_remapping.c b/drivers/iommu/irq_remapping.c
index ed605a9..2d99930 100644
--- a/drivers/iommu/irq_remapping.c
+++ b/drivers/iommu/irq_remapping.c
@@ -81,6 +81,15 @@ void set_irq_remapping_broken(void)
irq_remap_broken = 1;
}
+bool irq_remapping_cap(enum irq_remap_cap cap)
+{
+ if (!remap_ops || disable_irq_post)
+ return 0;
+
+ return (remap_ops->capability & (1 << cap));
+}
+EXPORT_SYMBOL_GPL(irq_remapping_cap);
+
int __init irq_remapping_prepare(void)
{
if (disable_irq_remap)
--
2.1.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* [v10 10/10] iommu, x86: Properly handle posted interrupts for IOMMU hotplug
[not found] ` <1433827237-3382-1-git-send-email-feng.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
` (6 preceding siblings ...)
2015-06-09 5:20 ` [v10 09/10] iommu, x86: Provide irq_remapping_cap() interface Feng Wu
@ 2015-06-09 5:20 ` Feng Wu
7 siblings, 0 replies; 11+ messages in thread
From: Feng Wu @ 2015-06-09 5:20 UTC (permalink / raw)
To: joro-zLv9SwRftAIdnm+yROfE0A, dwmw2-wEGCiKHe2LqWVfeAwA7xHQ,
tglx-hfZtesqFncYOwBW4kG4KsQ
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
jiang.liu-VuQAYsv1563Yd54FQh9/CA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Return error when inserting a new IOMMU which doesn't support posted
interrupts if posted interrupts are already enabled.
Signed-off-by: Feng Wu <feng.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Reviewed-by: Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
Acked-by: Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
---
drivers/iommu/intel_irq_remapping.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_remapping.c
index 0f57af7..80f1d14 100644
--- a/drivers/iommu/intel_irq_remapping.c
+++ b/drivers/iommu/intel_irq_remapping.c
@@ -1355,6 +1355,9 @@ int dmar_ir_hotplug(struct dmar_drhd_unit *dmaru, bool insert)
return -EINVAL;
if (!ecap_ir_support(iommu->ecap))
return 0;
+ if (irq_remapping_cap(IRQ_POSTING_CAP) &&
+ !cap_pi_support(iommu->cap))
+ return -EBUSY;
if (insert) {
if (!iommu->ir_table)
--
2.1.0
^ permalink raw reply related [flat|nested] 11+ messages in thread