Skip to content

Commit 359c660

Browse files
committed
Merge branch 'pci/msi' into next
* pci/msi: PCI/MSI: Remove unnecessary temporary variable PCI/MSI: Use __write_msi_msg() instead of write_msi_msg() MSI/powerpc: Use __read_msi_msg() instead of read_msi_msg() PCI/MSI: Use __get_cached_msi_msg() instead of get_cached_msi_msg() PCI/MSI: Add "msi_bus" sysfs MSI/MSI-X control for endpoints PCI/MSI: Remove "pos" from the struct msi_desc msi_attrib PCI/MSI: Remove unused kobject from struct msi_desc PCI/MSI: Rename pci_msi_check_device() to pci_msi_supported() PCI/MSI: Move D0 check into pci_msi_check_device() PCI/MSI: Remove arch_msi_check_device() irqchip: armada-370-xp: Remove arch_msi_check_device() PCI/MSI/PPC: Remove arch_msi_check_device() Conflicts: drivers/pci/host/pcie-designware.c
2 parents 07a7cbd + 5ec0940 commit 359c660

19 files changed

Lines changed: 109 additions & 226 deletions

File tree

‎Documentation/ABI/testing/sysfs-bus-pci‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,16 @@ Description:
6565
force a rescan of all PCI buses in the system, and
6666
re-discover previously removed devices.
6767

68+
What: /sys/bus/pci/devices/.../msi_bus
69+
Date: September 2014
70+
Contact: Linux PCI developers <linux-pci@vger.kernel.org>
71+
Description:
72+
Writing a zero value to this attribute disallows MSI and
73+
MSI-X for any future drivers of the device. If the device
74+
is a bridge, MSI and MSI-X will be disallowed for future
75+
drivers of all child devices under the bridge. Drivers
76+
must be reloaded for the new setting to take effect.
77+
6878
What: /sys/bus/pci/devices/.../msi_irqs/
6979
Date: September, 2011
7080
Contact: Neil Horman <nhorman@tuxdriver.com>

‎arch/ia64/kernel/msi_ia64.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ static int ia64_set_msi_irq_affinity(struct irq_data *idata,
2323
if (irq_prepare_move(irq, cpu))
2424
return -1;
2525

26-
get_cached_msi_msg(irq, &msg);
26+
__get_cached_msi_msg(idata->msi_desc, &msg);
2727

2828
addr = msg.address_lo;
2929
addr &= MSI_ADDR_DEST_ID_MASK;

‎arch/ia64/sn/kernel/msi_sn.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ static int sn_set_msi_irq_affinity(struct irq_data *data,
175175
* Release XIO resources for the old MSI PCI address
176176
*/
177177

178-
get_cached_msi_msg(irq, &msg);
179-
sn_pdev = (struct pcidev_info *)sn_irq_info->irq_pciioinfo;
178+
__get_cached_msi_msg(data->msi_desc, &msg);
179+
sn_pdev = (struct pcidev_info *)sn_irq_info->irq_pciioinfo;
180180
pdev = sn_pdev->pdi_linux_pcidev;
181181
provider = SN_PCIDEV_BUSPROVIDER(pdev);
182182

‎arch/mips/pci/msi-octeon.c‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc)
7373
* wants. Most devices only want 1, which will give
7474
* configured_private_bits and request_private_bits equal 0.
7575
*/
76-
pci_read_config_word(dev, desc->msi_attrib.pos + PCI_MSI_FLAGS,
77-
&control);
76+
pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &control);
7877

7978
/*
8079
* If the number of private bits has been configured then use
@@ -176,8 +175,7 @@ int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc)
176175
/* Update the number of IRQs the device has available to it */
177176
control &= ~PCI_MSI_FLAGS_QSIZE;
178177
control |= request_private_bits << 4;
179-
pci_write_config_word(dev, desc->msi_attrib.pos + PCI_MSI_FLAGS,
180-
control);
178+
pci_write_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, control);
181179

182180
irq_set_msi_desc(irq, desc);
183181
write_msi_msg(irq, &msg);

‎arch/powerpc/include/asm/machdep.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,6 @@ struct machdep_calls {
136136
int (*pci_setup_phb)(struct pci_controller *host);
137137

138138
#ifdef CONFIG_PCI_MSI
139-
int (*msi_check_device)(struct pci_dev* dev,
140-
int nvec, int type);
141139
int (*setup_msi_irqs)(struct pci_dev *dev,
142140
int nvec, int type);
143141
void (*teardown_msi_irqs)(struct pci_dev *dev);

‎arch/powerpc/kernel/msi.c‎

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
#include <asm/machdep.h>
1515

16-
int arch_msi_check_device(struct pci_dev* dev, int nvec, int type)
16+
int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
1717
{
1818
if (!ppc_md.setup_msi_irqs || !ppc_md.teardown_msi_irqs) {
1919
pr_debug("msi: Platform doesn't provide MSI callbacks.\n");
@@ -24,16 +24,6 @@ int arch_msi_check_device(struct pci_dev* dev, int nvec, int type)
2424
if (type == PCI_CAP_ID_MSI && nvec > 1)
2525
return 1;
2626

27-
if (ppc_md.msi_check_device) {
28-
pr_debug("msi: Using platform check routine.\n");
29-
return ppc_md.msi_check_device(dev, nvec, type);
30-
}
31-
32-
return 0;
33-
}
34-
35-
int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
36-
{
3727
return ppc_md.setup_msi_irqs(dev, nvec, type);
3828
}
3929

‎arch/powerpc/platforms/cell/axon_msi.c‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,6 @@ static struct axon_msic *find_msi_translator(struct pci_dev *dev)
199199
return msic;
200200
}
201201

202-
static int axon_msi_check_device(struct pci_dev *dev, int nvec, int type)
203-
{
204-
if (!find_msi_translator(dev))
205-
return -ENODEV;
206-
207-
return 0;
208-
}
209-
210202
static int setup_msi_msg_address(struct pci_dev *dev, struct msi_msg *msg)
211203
{
212204
struct device_node *dn;
@@ -416,7 +408,6 @@ static int axon_msi_probe(struct platform_device *device)
416408

417409
ppc_md.setup_msi_irqs = axon_msi_setup_msi_irqs;
418410
ppc_md.teardown_msi_irqs = axon_msi_teardown_msi_irqs;
419-
ppc_md.msi_check_device = axon_msi_check_device;
420411

421412
axon_msi_debug_setup(dn, msic);
422413

‎arch/powerpc/platforms/powernv/pci.c‎

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,29 +46,21 @@
4646
//#define cfg_dbg(fmt...) printk(fmt)
4747

4848
#ifdef CONFIG_PCI_MSI
49-
static int pnv_msi_check_device(struct pci_dev* pdev, int nvec, int type)
50-
{
51-
struct pci_controller *hose = pci_bus_to_host(pdev->bus);
52-
struct pnv_phb *phb = hose->private_data;
53-
struct pci_dn *pdn = pci_get_pdn(pdev);
54-
55-
if (pdn && pdn->force_32bit_msi && !phb->msi32_support)
56-
return -ENODEV;
57-
58-
return (phb && phb->msi_bmp.bitmap) ? 0 : -ENODEV;
59-
}
60-
6149
static int pnv_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
6250
{
6351
struct pci_controller *hose = pci_bus_to_host(pdev->bus);
6452
struct pnv_phb *phb = hose->private_data;
53+
struct pci_dn *pdn = pci_get_pdn(pdev);
6554
struct msi_desc *entry;
6655
struct msi_msg msg;
6756
int hwirq;
6857
unsigned int virq;
6958
int rc;
7059

71-
if (WARN_ON(!phb))
60+
if (WARN_ON(!phb) || !phb->msi_bmp.bitmap)
61+
return -ENODEV;
62+
63+
if (pdn && pdn->force_32bit_msi && !phb->msi32_support)
7264
return -ENODEV;
7365

7466
list_for_each_entry(entry, &pdev->msi_list, list) {
@@ -860,7 +852,6 @@ void __init pnv_pci_init(void)
860852

861853
/* Configure MSIs */
862854
#ifdef CONFIG_PCI_MSI
863-
ppc_md.msi_check_device = pnv_msi_check_device;
864855
ppc_md.setup_msi_irqs = pnv_setup_msi_irqs;
865856
ppc_md.teardown_msi_irqs = pnv_teardown_msi_irqs;
866857
#endif

‎arch/powerpc/platforms/pseries/msi.c‎

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -336,26 +336,6 @@ static int msi_quota_for_device(struct pci_dev *dev, int request)
336336
return request;
337337
}
338338

339-
static int rtas_msi_check_device(struct pci_dev *pdev, int nvec, int type)
340-
{
341-
int quota, rc;
342-
343-
if (type == PCI_CAP_ID_MSIX)
344-
rc = check_req_msix(pdev, nvec);
345-
else
346-
rc = check_req_msi(pdev, nvec);
347-
348-
if (rc)
349-
return rc;
350-
351-
quota = msi_quota_for_device(pdev, nvec);
352-
353-
if (quota && quota < nvec)
354-
return quota;
355-
356-
return 0;
357-
}
358-
359339
static int check_msix_entries(struct pci_dev *pdev)
360340
{
361341
struct msi_desc *entry;
@@ -397,15 +377,24 @@ static void rtas_hack_32bit_msi_gen2(struct pci_dev *pdev)
397377
static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec_in, int type)
398378
{
399379
struct pci_dn *pdn;
400-
int hwirq, virq, i, rc;
380+
int hwirq, virq, i, quota, rc;
401381
struct msi_desc *entry;
402382
struct msi_msg msg;
403383
int nvec = nvec_in;
404384
int use_32bit_msi_hack = 0;
405385

406-
pdn = pci_get_pdn(pdev);
407-
if (!pdn)
408-
return -ENODEV;
386+
if (type == PCI_CAP_ID_MSIX)
387+
rc = check_req_msix(pdev, nvec);
388+
else
389+
rc = check_req_msi(pdev, nvec);
390+
391+
if (rc)
392+
return rc;
393+
394+
quota = msi_quota_for_device(pdev, nvec);
395+
396+
if (quota && quota < nvec)
397+
return quota;
409398

410399
if (type == PCI_CAP_ID_MSIX && check_msix_entries(pdev))
411400
return -EINVAL;
@@ -416,12 +405,14 @@ static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec_in, int type)
416405
*/
417406
if (type == PCI_CAP_ID_MSIX) {
418407
int m = roundup_pow_of_two(nvec);
419-
int quota = msi_quota_for_device(pdev, m);
408+
quota = msi_quota_for_device(pdev, m);
420409

421410
if (quota >= m)
422411
nvec = m;
423412
}
424413

414+
pdn = pci_get_pdn(pdev);
415+
425416
/*
426417
* Try the new more explicit firmware interface, if that fails fall
427418
* back to the old interface. The old interface is known to never
@@ -485,7 +476,7 @@ static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec_in, int type)
485476
irq_set_msi_desc(virq, entry);
486477

487478
/* Read config space back so we can restore after reset */
488-
read_msi_msg(virq, &msg);
479+
__read_msi_msg(entry, &msg);
489480
entry->msg = msg;
490481
}
491482

@@ -526,7 +517,6 @@ static int rtas_msi_init(void)
526517
WARN_ON(ppc_md.setup_msi_irqs);
527518
ppc_md.setup_msi_irqs = rtas_setup_msi_irqs;
528519
ppc_md.teardown_msi_irqs = rtas_teardown_msi_irqs;
529-
ppc_md.msi_check_device = rtas_msi_check_device;
530520

531521
WARN_ON(ppc_md.pci_irq_fixup);
532522
ppc_md.pci_irq_fixup = rtas_msi_pci_irq_fixup;

‎arch/powerpc/sysdev/fsl_msi.c‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,6 @@ static int fsl_msi_init_allocator(struct fsl_msi *msi_data)
109109
return 0;
110110
}
111111

112-
static int fsl_msi_check_device(struct pci_dev *pdev, int nvec, int type)
113-
{
114-
if (type == PCI_CAP_ID_MSIX)
115-
pr_debug("fslmsi: MSI-X untested, trying anyway.\n");
116-
117-
return 0;
118-
}
119-
120112
static void fsl_teardown_msi_irqs(struct pci_dev *pdev)
121113
{
122114
struct msi_desc *entry;
@@ -173,6 +165,9 @@ static int fsl_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
173165
struct msi_msg msg;
174166
struct fsl_msi *msi_data;
175167

168+
if (type == PCI_CAP_ID_MSIX)
169+
pr_debug("fslmsi: MSI-X untested, trying anyway.\n");
170+
176171
/*
177172
* If the PCI node has an fsl,msi property, then we need to use it
178173
* to find the specific MSI.
@@ -527,7 +522,6 @@ static int fsl_of_msi_probe(struct platform_device *dev)
527522
if (!ppc_md.setup_msi_irqs) {
528523
ppc_md.setup_msi_irqs = fsl_setup_msi_irqs;
529524
ppc_md.teardown_msi_irqs = fsl_teardown_msi_irqs;
530-
ppc_md.msi_check_device = fsl_msi_check_device;
531525
} else if (ppc_md.setup_msi_irqs != fsl_setup_msi_irqs) {
532526
dev_err(&dev->dev, "Different MSI driver already installed!\n");
533527
err = -ENODEV;

0 commit comments

Comments
 (0)