Commit ac8344c4 authored by DuanZhenzhong's avatar DuanZhenzhong Committed by Bjorn Helgaas

PCI: Drop "irq" param from *_restore_msi_irqs()

Change x86_msi.restore_msi_irqs(struct pci_dev *dev, int irq) to
x86_msi.restore_msi_irqs(struct pci_dev *dev).

restore_msi_irqs() restores multiple MSI-X IRQs, so param 'int irq' is
unneeded.  This makes code more consistent between vm and bare metal.

Dom0 MSI-X restore code can also be optimized as XEN only has a hypercall
to restore all MSI-X vectors at one time.
Tested-by: default avatarSucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Signed-off-by: default avatarZhenzhong Duan <zhenzhong.duan@oracle.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Acked-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
parent 6f825b73
...@@ -104,7 +104,7 @@ extern void pci_iommu_alloc(void); ...@@ -104,7 +104,7 @@ extern void pci_iommu_alloc(void);
struct msi_desc; struct msi_desc;
int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type); int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type);
void native_teardown_msi_irq(unsigned int irq); void native_teardown_msi_irq(unsigned int irq);
void native_restore_msi_irqs(struct pci_dev *dev, int irq); void native_restore_msi_irqs(struct pci_dev *dev);
int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc,
unsigned int irq_base, unsigned int irq_offset); unsigned int irq_base, unsigned int irq_offset);
#else #else
......
...@@ -181,7 +181,7 @@ struct x86_msi_ops { ...@@ -181,7 +181,7 @@ struct x86_msi_ops {
u8 hpet_id); u8 hpet_id);
void (*teardown_msi_irq)(unsigned int irq); void (*teardown_msi_irq)(unsigned int irq);
void (*teardown_msi_irqs)(struct pci_dev *dev); void (*teardown_msi_irqs)(struct pci_dev *dev);
void (*restore_msi_irqs)(struct pci_dev *dev, int irq); void (*restore_msi_irqs)(struct pci_dev *dev);
int (*setup_hpet_msi)(unsigned int irq, unsigned int id); int (*setup_hpet_msi)(unsigned int irq, unsigned int id);
u32 (*msi_mask_irq)(struct msi_desc *desc, u32 mask, u32 flag); u32 (*msi_mask_irq)(struct msi_desc *desc, u32 mask, u32 flag);
u32 (*msix_mask_irq)(struct msi_desc *desc, u32 flag); u32 (*msix_mask_irq)(struct msi_desc *desc, u32 flag);
......
...@@ -136,9 +136,9 @@ void arch_teardown_msi_irq(unsigned int irq) ...@@ -136,9 +136,9 @@ void arch_teardown_msi_irq(unsigned int irq)
x86_msi.teardown_msi_irq(irq); x86_msi.teardown_msi_irq(irq);
} }
void arch_restore_msi_irqs(struct pci_dev *dev, int irq) void arch_restore_msi_irqs(struct pci_dev *dev)
{ {
x86_msi.restore_msi_irqs(dev, irq); x86_msi.restore_msi_irqs(dev);
} }
u32 arch_msi_mask_irq(struct msi_desc *desc, u32 mask, u32 flag) u32 arch_msi_mask_irq(struct msi_desc *desc, u32 mask, u32 flag)
{ {
......
...@@ -337,7 +337,7 @@ static int xen_initdom_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) ...@@ -337,7 +337,7 @@ static int xen_initdom_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
return ret; return ret;
} }
static void xen_initdom_restore_msi_irqs(struct pci_dev *dev, int irq) static void xen_initdom_restore_msi_irqs(struct pci_dev *dev)
{ {
int ret = 0; int ret = 0;
......
...@@ -116,7 +116,7 @@ void __weak arch_teardown_msi_irqs(struct pci_dev *dev) ...@@ -116,7 +116,7 @@ void __weak arch_teardown_msi_irqs(struct pci_dev *dev)
return default_teardown_msi_irqs(dev); return default_teardown_msi_irqs(dev);
} }
void default_restore_msi_irqs(struct pci_dev *dev, int irq) static void default_restore_msi_irq(struct pci_dev *dev, int irq)
{ {
struct msi_desc *entry; struct msi_desc *entry;
...@@ -134,9 +134,9 @@ void default_restore_msi_irqs(struct pci_dev *dev, int irq) ...@@ -134,9 +134,9 @@ void default_restore_msi_irqs(struct pci_dev *dev, int irq)
write_msi_msg(irq, &entry->msg); write_msi_msg(irq, &entry->msg);
} }
void __weak arch_restore_msi_irqs(struct pci_dev *dev, int irq) void __weak arch_restore_msi_irqs(struct pci_dev *dev)
{ {
return default_restore_msi_irqs(dev, irq); return default_restore_msi_irqs(dev);
} }
static void msi_set_enable(struct pci_dev *dev, int enable) static void msi_set_enable(struct pci_dev *dev, int enable)
...@@ -262,6 +262,15 @@ void unmask_msi_irq(struct irq_data *data) ...@@ -262,6 +262,15 @@ void unmask_msi_irq(struct irq_data *data)
msi_set_mask_bit(data, 0); msi_set_mask_bit(data, 0);
} }
void default_restore_msi_irqs(struct pci_dev *dev)
{
struct msi_desc *entry;
list_for_each_entry(entry, &dev->msi_list, list) {
default_restore_msi_irq(dev, entry->irq);
}
}
void __read_msi_msg(struct msi_desc *entry, struct msi_msg *msg) void __read_msi_msg(struct msi_desc *entry, struct msi_msg *msg)
{ {
BUG_ON(entry->dev->current_state != PCI_D0); BUG_ON(entry->dev->current_state != PCI_D0);
...@@ -430,7 +439,7 @@ static void __pci_restore_msi_state(struct pci_dev *dev) ...@@ -430,7 +439,7 @@ static void __pci_restore_msi_state(struct pci_dev *dev)
pci_intx_for_msi(dev, 0); pci_intx_for_msi(dev, 0);
msi_set_enable(dev, 0); msi_set_enable(dev, 0);
arch_restore_msi_irqs(dev, dev->irq); arch_restore_msi_irqs(dev);
pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &control); pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &control);
msi_mask_irq(entry, msi_capable_mask(control), entry->masked); msi_mask_irq(entry, msi_capable_mask(control), entry->masked);
...@@ -455,8 +464,8 @@ static void __pci_restore_msix_state(struct pci_dev *dev) ...@@ -455,8 +464,8 @@ static void __pci_restore_msix_state(struct pci_dev *dev)
control |= PCI_MSIX_FLAGS_ENABLE | PCI_MSIX_FLAGS_MASKALL; control |= PCI_MSIX_FLAGS_ENABLE | PCI_MSIX_FLAGS_MASKALL;
pci_write_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, control); pci_write_config_word(dev, dev->msix_cap + PCI_MSIX_FLAGS, control);
arch_restore_msi_irqs(dev);
list_for_each_entry(entry, &dev->msi_list, list) { list_for_each_entry(entry, &dev->msi_list, list) {
arch_restore_msi_irqs(dev, entry->irq);
msix_mask_irq(entry, entry->masked); msix_mask_irq(entry, entry->masked);
} }
......
...@@ -60,10 +60,10 @@ void arch_teardown_msi_irq(unsigned int irq); ...@@ -60,10 +60,10 @@ void arch_teardown_msi_irq(unsigned int irq);
int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type); 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(struct pci_dev *dev);
int arch_msi_check_device(struct pci_dev* dev, int nvec, int type); int arch_msi_check_device(struct pci_dev* dev, int nvec, int type);
void arch_restore_msi_irqs(struct pci_dev *dev, int irq); void arch_restore_msi_irqs(struct pci_dev *dev);
void default_teardown_msi_irqs(struct pci_dev *dev); void default_teardown_msi_irqs(struct pci_dev *dev);
void default_restore_msi_irqs(struct pci_dev *dev, int irq); void default_restore_msi_irqs(struct pci_dev *dev);
u32 default_msi_mask_irq(struct msi_desc *desc, u32 mask, u32 flag); u32 default_msi_mask_irq(struct msi_desc *desc, u32 mask, u32 flag);
u32 default_msix_mask_irq(struct msi_desc *desc, u32 flag); u32 default_msix_mask_irq(struct msi_desc *desc, u32 flag);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment