@@ -283,6 +283,7 @@ struct pci_dev;
struct x86_msi_ops {
int (*setup_msi_irqs)(struct pci_dev *dev, int nvec, int type);
void (*teardown_msi_irq)(unsigned int irq);
+ void (*teardown_msi_irqs_grp)(struct pci_dev *dev, int group_id);
void (*teardown_msi_irqs)(struct pci_dev *dev);
void (*restore_msi_irqs)(struct pci_dev *dev);
};
@@ -127,6 +127,7 @@ EXPORT_SYMBOL_GPL(x86_platform);
struct x86_msi_ops x86_msi __ro_after_init = {
.setup_msi_irqs = native_setup_msi_irqs,
.teardown_msi_irq = native_teardown_msi_irq,
+ .teardown_msi_irqs_grp = default_teardown_msi_irqs_grp,
.teardown_msi_irqs = default_teardown_msi_irqs,
.restore_msi_irqs = default_restore_msi_irqs,
};
@@ -142,6 +143,11 @@ void arch_teardown_msi_irqs(struct pci_dev *dev)
x86_msi.teardown_msi_irqs(dev);
}
+void arch_teardown_msi_irqs_grp(struct pci_dev *dev, int group_id)
+{
+ x86_msi.teardown_msi_irqs_grp(dev, group_id);
+}
+
void arch_teardown_msi_irq(unsigned int irq)
{
x86_msi.teardown_msi_irq(irq);
@@ -133,6 +133,24 @@ void __weak arch_teardown_msi_irqs(struct pci_dev *dev)
return default_teardown_msi_irqs(dev);
}
+void default_teardown_msi_irqs_grp(struct pci_dev *dev, int group_id)
+{
+ int i;
+ struct msi_desc *entry;
+
+ for_each_pci_msi_entry(entry, dev) {
+ if (entry->group_id == group_id && entry->irq) {
+ for (i = 0; i < entry->nvec_used; i++)
+ arch_teardown_msi_irq(entry->irq + i);
+ }
+ }
+}
+
+void __weak arch_teardown_msi_irqs_grp(struct pci_dev *dev, int group_id)
+{
+ return default_teardown_msi_irqs_grp(dev, group_id);
+}
+
static void default_restore_msi_irq(struct pci_dev *dev, int irq)
{
struct msi_desc *entry;
@@ -202,9 +202,11 @@ int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc);
void arch_teardown_msi_irq(unsigned int irq);
int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type);
void arch_teardown_msi_irqs(struct pci_dev *dev);
+void arch_teardown_msi_irqs_grp(struct pci_dev *dev, int group_id);
void arch_restore_msi_irqs(struct pci_dev *dev);
void default_teardown_msi_irqs(struct pci_dev *dev);
+void default_teardown_msi_irqs_grp(struct pci_dev *dev, int group_id);
void default_restore_msi_irqs(struct pci_dev *dev);
struct msi_controller {
This is a preparatory patch to introduce disabling of MSI-X vectors belonging to a particular group. In this patch, we introduce a x86 specific mechanism to teardown the IRQ vectors belonging to a particular group. Cc: Jacob Pan <jacob.jun.pan@linux.intel.com> Cc: Ashok Raj <ashok.raj@intel.com> Signed-off-by: Megha Dey <megha.dey@linux.intel.com> --- arch/x86/include/asm/x86_init.h | 1 + arch/x86/kernel/x86_init.c | 6 ++++++ drivers/pci/msi.c | 18 ++++++++++++++++++ include/linux/msi.h | 2 ++ 4 files changed, 27 insertions(+)