diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-24 11:57:38 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-24 11:57:38 -0400 |
commit | d4c2456a1888d7914502f4237b2ca4e262dd4c4d (patch) | |
tree | e1cdf52fa6e58ba682be563f21a5c7b8347b13c5 /arch | |
parent | eb3d33900aa953bcdfe132a71bb03ee592ebbb47 (diff) | |
parent | f1dd153121dcb872ae6cba8d52bec97519eb7d97 (diff) |
Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
Pull powerpc fixes from Benjamin Herrenschmidt:
"Some more P8 related bits, a bunch of fixes for our P7+/P8 HW crypto
drivers, some added workarounds for those radeons that don't do proper
64-bit MSIs and a couple of other trivialities by myself."
* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc:
powerpc/pseries: Make 32-bit MSI quirk work on systems lacking firmware support
powerpc/powernv: Build a zImage.epapr
powerpc: Make radeon 32-bit MSI quirk work on powernv
powerpc: Context switch more PMU related SPRs
powerpc/powernv: Fix condition for when to invalidate the TCE cache
powerpc/pci: Fix bogus message at boot about empty memory resources
powerpc: Fix TLB cleanup at boot on POWER8
drivers/crypto/nx: Fixes for multiple races and issues
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/include/asm/pci-bridge.h | 2 | ||||
-rw-r--r-- | arch/powerpc/include/asm/processor.h | 6 | ||||
-rw-r--r-- | arch/powerpc/kernel/asm-offsets.c | 6 | ||||
-rw-r--r-- | arch/powerpc/kernel/cpu_setup_power.S | 8 | ||||
-rw-r--r-- | arch/powerpc/kernel/entry_64.S | 28 | ||||
-rw-r--r-- | arch/powerpc/kernel/pci-common.c | 7 | ||||
-rw-r--r-- | arch/powerpc/kernel/pci_64.c | 10 | ||||
-rw-r--r-- | arch/powerpc/kernel/pci_dn.c | 8 | ||||
-rw-r--r-- | arch/powerpc/platforms/powernv/Kconfig | 1 | ||||
-rw-r--r-- | arch/powerpc/platforms/powernv/pci-ioda.c | 27 | ||||
-rw-r--r-- | arch/powerpc/platforms/powernv/pci.c | 6 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/msi.c | 75 |
12 files changed, 127 insertions, 57 deletions
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h index 8b11b5bd9938..2c1d8cb9b265 100644 --- a/arch/powerpc/include/asm/pci-bridge.h +++ b/arch/powerpc/include/asm/pci-bridge.h | |||
@@ -174,6 +174,8 @@ struct pci_dn { | |||
174 | /* Get the pointer to a device_node's pci_dn */ | 174 | /* Get the pointer to a device_node's pci_dn */ |
175 | #define PCI_DN(dn) ((struct pci_dn *) (dn)->data) | 175 | #define PCI_DN(dn) ((struct pci_dn *) (dn)->data) |
176 | 176 | ||
177 | extern struct pci_dn *pci_get_pdn(struct pci_dev *pdev); | ||
178 | |||
177 | extern void * update_dn_pci_info(struct device_node *dn, void *data); | 179 | extern void * update_dn_pci_info(struct device_node *dn, void *data); |
178 | 180 | ||
179 | static inline int pci_device_from_OF_node(struct device_node *np, | 181 | static inline int pci_device_from_OF_node(struct device_node *np, |
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h index d7e67ca8b4a6..594db6bc093c 100644 --- a/arch/powerpc/include/asm/processor.h +++ b/arch/powerpc/include/asm/processor.h | |||
@@ -284,6 +284,12 @@ struct thread_struct { | |||
284 | unsigned long ebbrr; | 284 | unsigned long ebbrr; |
285 | unsigned long ebbhr; | 285 | unsigned long ebbhr; |
286 | unsigned long bescr; | 286 | unsigned long bescr; |
287 | unsigned long siar; | ||
288 | unsigned long sdar; | ||
289 | unsigned long sier; | ||
290 | unsigned long mmcr0; | ||
291 | unsigned long mmcr2; | ||
292 | unsigned long mmcra; | ||
287 | #endif | 293 | #endif |
288 | }; | 294 | }; |
289 | 295 | ||
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c index b51a97cfedf8..6f16ffafa6f0 100644 --- a/arch/powerpc/kernel/asm-offsets.c +++ b/arch/powerpc/kernel/asm-offsets.c | |||
@@ -127,6 +127,12 @@ int main(void) | |||
127 | DEFINE(THREAD_BESCR, offsetof(struct thread_struct, bescr)); | 127 | DEFINE(THREAD_BESCR, offsetof(struct thread_struct, bescr)); |
128 | DEFINE(THREAD_EBBHR, offsetof(struct thread_struct, ebbhr)); | 128 | DEFINE(THREAD_EBBHR, offsetof(struct thread_struct, ebbhr)); |
129 | DEFINE(THREAD_EBBRR, offsetof(struct thread_struct, ebbrr)); | 129 | DEFINE(THREAD_EBBRR, offsetof(struct thread_struct, ebbrr)); |
130 | DEFINE(THREAD_SIAR, offsetof(struct thread_struct, siar)); | ||
131 | DEFINE(THREAD_SDAR, offsetof(struct thread_struct, sdar)); | ||
132 | DEFINE(THREAD_SIER, offsetof(struct thread_struct, sier)); | ||
133 | DEFINE(THREAD_MMCR0, offsetof(struct thread_struct, mmcr0)); | ||
134 | DEFINE(THREAD_MMCR2, offsetof(struct thread_struct, mmcr2)); | ||
135 | DEFINE(THREAD_MMCRA, offsetof(struct thread_struct, mmcra)); | ||
130 | #endif | 136 | #endif |
131 | #ifdef CONFIG_PPC_TRANSACTIONAL_MEM | 137 | #ifdef CONFIG_PPC_TRANSACTIONAL_MEM |
132 | DEFINE(PACATMSCRATCH, offsetof(struct paca_struct, tm_scratch)); | 138 | DEFINE(PACATMSCRATCH, offsetof(struct paca_struct, tm_scratch)); |
diff --git a/arch/powerpc/kernel/cpu_setup_power.S b/arch/powerpc/kernel/cpu_setup_power.S index a283b6442b26..18b5b9cf8e37 100644 --- a/arch/powerpc/kernel/cpu_setup_power.S +++ b/arch/powerpc/kernel/cpu_setup_power.S | |||
@@ -135,8 +135,12 @@ __init_HFSCR: | |||
135 | blr | 135 | blr |
136 | 136 | ||
137 | __init_TLB: | 137 | __init_TLB: |
138 | /* Clear the TLB */ | 138 | /* |
139 | li r6,128 | 139 | * Clear the TLB using the "IS 3" form of tlbiel instruction |
140 | * (invalidate by congruence class). P7 has 128 CCs, P8 has 512 | ||
141 | * so we just always do 512 | ||
142 | */ | ||
143 | li r6,512 | ||
140 | mtctr r6 | 144 | mtctr r6 |
141 | li r7,0xc00 /* IS field = 0b11 */ | 145 | li r7,0xc00 /* IS field = 0b11 */ |
142 | ptesync | 146 | ptesync |
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index 51cfb8fc301f..0e9095e47b5b 100644 --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S | |||
@@ -465,6 +465,20 @@ BEGIN_FTR_SECTION | |||
465 | std r0, THREAD_EBBHR(r3) | 465 | std r0, THREAD_EBBHR(r3) |
466 | mfspr r0, SPRN_EBBRR | 466 | mfspr r0, SPRN_EBBRR |
467 | std r0, THREAD_EBBRR(r3) | 467 | std r0, THREAD_EBBRR(r3) |
468 | |||
469 | /* PMU registers made user read/(write) by EBB */ | ||
470 | mfspr r0, SPRN_SIAR | ||
471 | std r0, THREAD_SIAR(r3) | ||
472 | mfspr r0, SPRN_SDAR | ||
473 | std r0, THREAD_SDAR(r3) | ||
474 | mfspr r0, SPRN_SIER | ||
475 | std r0, THREAD_SIER(r3) | ||
476 | mfspr r0, SPRN_MMCR0 | ||
477 | std r0, THREAD_MMCR0(r3) | ||
478 | mfspr r0, SPRN_MMCR2 | ||
479 | std r0, THREAD_MMCR2(r3) | ||
480 | mfspr r0, SPRN_MMCRA | ||
481 | std r0, THREAD_MMCRA(r3) | ||
468 | END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) | 482 | END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) |
469 | #endif | 483 | #endif |
470 | 484 | ||
@@ -560,6 +574,20 @@ BEGIN_FTR_SECTION | |||
560 | ld r0, THREAD_EBBRR(r4) | 574 | ld r0, THREAD_EBBRR(r4) |
561 | mtspr SPRN_EBBRR, r0 | 575 | mtspr SPRN_EBBRR, r0 |
562 | 576 | ||
577 | /* PMU registers made user read/(write) by EBB */ | ||
578 | ld r0, THREAD_SIAR(r4) | ||
579 | mtspr SPRN_SIAR, r0 | ||
580 | ld r0, THREAD_SDAR(r4) | ||
581 | mtspr SPRN_SDAR, r0 | ||
582 | ld r0, THREAD_SIER(r4) | ||
583 | mtspr SPRN_SIER, r0 | ||
584 | ld r0, THREAD_MMCR0(r4) | ||
585 | mtspr SPRN_MMCR0, r0 | ||
586 | ld r0, THREAD_MMCR2(r4) | ||
587 | mtspr SPRN_MMCR2, r0 | ||
588 | ld r0, THREAD_MMCRA(r4) | ||
589 | mtspr SPRN_MMCRA, r0 | ||
590 | |||
563 | ld r0,THREAD_TAR(r4) | 591 | ld r0,THREAD_TAR(r4) |
564 | mtspr SPRN_TAR,r0 | 592 | mtspr SPRN_TAR,r0 |
565 | END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) | 593 | END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) |
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index 6053f037ef0a..e9acf50dd5b2 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c | |||
@@ -1520,9 +1520,10 @@ static void pcibios_setup_phb_resources(struct pci_controller *hose, | |||
1520 | for (i = 0; i < 3; ++i) { | 1520 | for (i = 0; i < 3; ++i) { |
1521 | res = &hose->mem_resources[i]; | 1521 | res = &hose->mem_resources[i]; |
1522 | if (!res->flags) { | 1522 | if (!res->flags) { |
1523 | printk(KERN_ERR "PCI: Memory resource 0 not set for " | 1523 | if (i == 0) |
1524 | "host bridge %s (domain %d)\n", | 1524 | printk(KERN_ERR "PCI: Memory resource 0 not set for " |
1525 | hose->dn->full_name, hose->global_number); | 1525 | "host bridge %s (domain %d)\n", |
1526 | hose->dn->full_name, hose->global_number); | ||
1526 | continue; | 1527 | continue; |
1527 | } | 1528 | } |
1528 | offset = hose->mem_offset[i]; | 1529 | offset = hose->mem_offset[i]; |
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c index 873050d26840..2e8629654ca8 100644 --- a/arch/powerpc/kernel/pci_64.c +++ b/arch/powerpc/kernel/pci_64.c | |||
@@ -266,3 +266,13 @@ int pcibus_to_node(struct pci_bus *bus) | |||
266 | } | 266 | } |
267 | EXPORT_SYMBOL(pcibus_to_node); | 267 | EXPORT_SYMBOL(pcibus_to_node); |
268 | #endif | 268 | #endif |
269 | |||
270 | static void quirk_radeon_32bit_msi(struct pci_dev *dev) | ||
271 | { | ||
272 | struct pci_dn *pdn = pci_get_pdn(dev); | ||
273 | |||
274 | if (pdn) | ||
275 | pdn->force_32bit_msi = 1; | ||
276 | } | ||
277 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x68f2, quirk_radeon_32bit_msi); | ||
278 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0xaa68, quirk_radeon_32bit_msi); | ||
diff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c index e7af165f8b9d..df038442548a 100644 --- a/arch/powerpc/kernel/pci_dn.c +++ b/arch/powerpc/kernel/pci_dn.c | |||
@@ -32,6 +32,14 @@ | |||
32 | #include <asm/ppc-pci.h> | 32 | #include <asm/ppc-pci.h> |
33 | #include <asm/firmware.h> | 33 | #include <asm/firmware.h> |
34 | 34 | ||
35 | struct pci_dn *pci_get_pdn(struct pci_dev *pdev) | ||
36 | { | ||
37 | struct device_node *dn = pci_device_to_OF_node(pdev); | ||
38 | if (!dn) | ||
39 | return NULL; | ||
40 | return PCI_DN(dn); | ||
41 | } | ||
42 | |||
35 | /* | 43 | /* |
36 | * Traverse_func that inits the PCI fields of the device node. | 44 | * Traverse_func that inits the PCI fields of the device node. |
37 | * NOTE: this *must* be done before read/write config to the device. | 45 | * NOTE: this *must* be done before read/write config to the device. |
diff --git a/arch/powerpc/platforms/powernv/Kconfig b/arch/powerpc/platforms/powernv/Kconfig index d3e840d643af..c24684c818ab 100644 --- a/arch/powerpc/platforms/powernv/Kconfig +++ b/arch/powerpc/platforms/powernv/Kconfig | |||
@@ -6,6 +6,7 @@ config PPC_POWERNV | |||
6 | select PPC_ICP_NATIVE | 6 | select PPC_ICP_NATIVE |
7 | select PPC_P7_NAP | 7 | select PPC_P7_NAP |
8 | select PPC_PCI_CHOICE if EMBEDDED | 8 | select PPC_PCI_CHOICE if EMBEDDED |
9 | select EPAPR_BOOT | ||
9 | default y | 10 | default y |
10 | 11 | ||
11 | config POWERNV_MSI | 12 | config POWERNV_MSI |
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index 3937aaae5bc4..9c9d15e4cdf2 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c | |||
@@ -68,16 +68,6 @@ define_pe_printk_level(pe_err, KERN_ERR); | |||
68 | define_pe_printk_level(pe_warn, KERN_WARNING); | 68 | define_pe_printk_level(pe_warn, KERN_WARNING); |
69 | define_pe_printk_level(pe_info, KERN_INFO); | 69 | define_pe_printk_level(pe_info, KERN_INFO); |
70 | 70 | ||
71 | static struct pci_dn *pnv_ioda_get_pdn(struct pci_dev *dev) | ||
72 | { | ||
73 | struct device_node *np; | ||
74 | |||
75 | np = pci_device_to_OF_node(dev); | ||
76 | if (!np) | ||
77 | return NULL; | ||
78 | return PCI_DN(np); | ||
79 | } | ||
80 | |||
81 | static int pnv_ioda_alloc_pe(struct pnv_phb *phb) | 71 | static int pnv_ioda_alloc_pe(struct pnv_phb *phb) |
82 | { | 72 | { |
83 | unsigned long pe; | 73 | unsigned long pe; |
@@ -110,7 +100,7 @@ static struct pnv_ioda_pe *pnv_ioda_get_pe(struct pci_dev *dev) | |||
110 | { | 100 | { |
111 | struct pci_controller *hose = pci_bus_to_host(dev->bus); | 101 | struct pci_controller *hose = pci_bus_to_host(dev->bus); |
112 | struct pnv_phb *phb = hose->private_data; | 102 | struct pnv_phb *phb = hose->private_data; |
113 | struct pci_dn *pdn = pnv_ioda_get_pdn(dev); | 103 | struct pci_dn *pdn = pci_get_pdn(dev); |
114 | 104 | ||
115 | if (!pdn) | 105 | if (!pdn) |
116 | return NULL; | 106 | return NULL; |
@@ -173,7 +163,7 @@ static int pnv_ioda_configure_pe(struct pnv_phb *phb, struct pnv_ioda_pe *pe) | |||
173 | 163 | ||
174 | /* Add to all parents PELT-V */ | 164 | /* Add to all parents PELT-V */ |
175 | while (parent) { | 165 | while (parent) { |
176 | struct pci_dn *pdn = pnv_ioda_get_pdn(parent); | 166 | struct pci_dn *pdn = pci_get_pdn(parent); |
177 | if (pdn && pdn->pe_number != IODA_INVALID_PE) { | 167 | if (pdn && pdn->pe_number != IODA_INVALID_PE) { |
178 | rc = opal_pci_set_peltv(phb->opal_id, pdn->pe_number, | 168 | rc = opal_pci_set_peltv(phb->opal_id, pdn->pe_number, |
179 | pe->pe_number, OPAL_ADD_PE_TO_DOMAIN); | 169 | pe->pe_number, OPAL_ADD_PE_TO_DOMAIN); |
@@ -252,7 +242,7 @@ static struct pnv_ioda_pe *pnv_ioda_setup_dev_PE(struct pci_dev *dev) | |||
252 | { | 242 | { |
253 | struct pci_controller *hose = pci_bus_to_host(dev->bus); | 243 | struct pci_controller *hose = pci_bus_to_host(dev->bus); |
254 | struct pnv_phb *phb = hose->private_data; | 244 | struct pnv_phb *phb = hose->private_data; |
255 | struct pci_dn *pdn = pnv_ioda_get_pdn(dev); | 245 | struct pci_dn *pdn = pci_get_pdn(dev); |
256 | struct pnv_ioda_pe *pe; | 246 | struct pnv_ioda_pe *pe; |
257 | int pe_num; | 247 | int pe_num; |
258 | 248 | ||
@@ -323,7 +313,7 @@ static void pnv_ioda_setup_same_PE(struct pci_bus *bus, struct pnv_ioda_pe *pe) | |||
323 | struct pci_dev *dev; | 313 | struct pci_dev *dev; |
324 | 314 | ||
325 | list_for_each_entry(dev, &bus->devices, bus_list) { | 315 | list_for_each_entry(dev, &bus->devices, bus_list) { |
326 | struct pci_dn *pdn = pnv_ioda_get_pdn(dev); | 316 | struct pci_dn *pdn = pci_get_pdn(dev); |
327 | 317 | ||
328 | if (pdn == NULL) { | 318 | if (pdn == NULL) { |
329 | pr_warn("%s: No device node associated with device !\n", | 319 | pr_warn("%s: No device node associated with device !\n", |
@@ -436,7 +426,7 @@ static void pnv_pci_ioda_setup_PEs(void) | |||
436 | 426 | ||
437 | static void pnv_pci_ioda_dma_dev_setup(struct pnv_phb *phb, struct pci_dev *pdev) | 427 | static void pnv_pci_ioda_dma_dev_setup(struct pnv_phb *phb, struct pci_dev *pdev) |
438 | { | 428 | { |
439 | struct pci_dn *pdn = pnv_ioda_get_pdn(pdev); | 429 | struct pci_dn *pdn = pci_get_pdn(pdev); |
440 | struct pnv_ioda_pe *pe; | 430 | struct pnv_ioda_pe *pe; |
441 | 431 | ||
442 | /* | 432 | /* |
@@ -768,6 +758,7 @@ static int pnv_pci_ioda_msi_setup(struct pnv_phb *phb, struct pci_dev *dev, | |||
768 | unsigned int is_64, struct msi_msg *msg) | 758 | unsigned int is_64, struct msi_msg *msg) |
769 | { | 759 | { |
770 | struct pnv_ioda_pe *pe = pnv_ioda_get_pe(dev); | 760 | struct pnv_ioda_pe *pe = pnv_ioda_get_pe(dev); |
761 | struct pci_dn *pdn = pci_get_pdn(dev); | ||
771 | struct irq_data *idata; | 762 | struct irq_data *idata; |
772 | struct irq_chip *ichip; | 763 | struct irq_chip *ichip; |
773 | unsigned int xive_num = hwirq - phb->msi_base; | 764 | unsigned int xive_num = hwirq - phb->msi_base; |
@@ -783,6 +774,10 @@ static int pnv_pci_ioda_msi_setup(struct pnv_phb *phb, struct pci_dev *dev, | |||
783 | if (pe->mve_number < 0) | 774 | if (pe->mve_number < 0) |
784 | return -ENXIO; | 775 | return -ENXIO; |
785 | 776 | ||
777 | /* Force 32-bit MSI on some broken devices */ | ||
778 | if (pdn && pdn->force_32bit_msi) | ||
779 | is_64 = 0; | ||
780 | |||
786 | /* Assign XIVE to PE */ | 781 | /* Assign XIVE to PE */ |
787 | rc = opal_pci_set_xive_pe(phb->opal_id, pe->pe_number, xive_num); | 782 | rc = opal_pci_set_xive_pe(phb->opal_id, pe->pe_number, xive_num); |
788 | if (rc) { | 783 | if (rc) { |
@@ -1035,7 +1030,7 @@ static int pnv_pci_enable_device_hook(struct pci_dev *dev) | |||
1035 | if (!phb->initialized) | 1030 | if (!phb->initialized) |
1036 | return 0; | 1031 | return 0; |
1037 | 1032 | ||
1038 | pdn = pnv_ioda_get_pdn(dev); | 1033 | pdn = pci_get_pdn(dev); |
1039 | if (!pdn || pdn->pe_number == IODA_INVALID_PE) | 1034 | if (!pdn || pdn->pe_number == IODA_INVALID_PE) |
1040 | return -EINVAL; | 1035 | return -EINVAL; |
1041 | 1036 | ||
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c index 163bd7422f1c..277343cc6a3d 100644 --- a/arch/powerpc/platforms/powernv/pci.c +++ b/arch/powerpc/platforms/powernv/pci.c | |||
@@ -47,6 +47,10 @@ static int pnv_msi_check_device(struct pci_dev* pdev, int nvec, int type) | |||
47 | { | 47 | { |
48 | struct pci_controller *hose = pci_bus_to_host(pdev->bus); | 48 | struct pci_controller *hose = pci_bus_to_host(pdev->bus); |
49 | struct pnv_phb *phb = hose->private_data; | 49 | struct pnv_phb *phb = hose->private_data; |
50 | struct pci_dn *pdn = pci_get_pdn(pdev); | ||
51 | |||
52 | if (pdn && pdn->force_32bit_msi && !phb->msi32_support) | ||
53 | return -ENODEV; | ||
50 | 54 | ||
51 | return (phb && phb->msi_bmp.bitmap) ? 0 : -ENODEV; | 55 | return (phb && phb->msi_bmp.bitmap) ? 0 : -ENODEV; |
52 | } | 56 | } |
@@ -367,7 +371,7 @@ static void pnv_tce_free(struct iommu_table *tbl, long index, long npages) | |||
367 | while (npages--) | 371 | while (npages--) |
368 | *(tcep++) = 0; | 372 | *(tcep++) = 0; |
369 | 373 | ||
370 | if (tbl->it_type & TCE_PCI_SWINV_CREATE) | 374 | if (tbl->it_type & TCE_PCI_SWINV_FREE) |
371 | pnv_pci_ioda_tce_invalidate(tbl, tces, tcep - 1); | 375 | pnv_pci_ioda_tce_invalidate(tbl, tces, tcep - 1); |
372 | } | 376 | } |
373 | 377 | ||
diff --git a/arch/powerpc/platforms/pseries/msi.c b/arch/powerpc/platforms/pseries/msi.c index 420524e6f8c9..6d2f0abce6fa 100644 --- a/arch/powerpc/platforms/pseries/msi.c +++ b/arch/powerpc/platforms/pseries/msi.c | |||
@@ -26,26 +26,6 @@ static int query_token, change_token; | |||
26 | #define RTAS_CHANGE_MSIX_FN 4 | 26 | #define RTAS_CHANGE_MSIX_FN 4 |
27 | #define RTAS_CHANGE_32MSI_FN 5 | 27 | #define RTAS_CHANGE_32MSI_FN 5 |
28 | 28 | ||
29 | static struct pci_dn *get_pdn(struct pci_dev *pdev) | ||
30 | { | ||
31 | struct device_node *dn; | ||
32 | struct pci_dn *pdn; | ||
33 | |||
34 | dn = pci_device_to_OF_node(pdev); | ||
35 | if (!dn) { | ||
36 | dev_dbg(&pdev->dev, "rtas_msi: No OF device node\n"); | ||
37 | return NULL; | ||
38 | } | ||
39 | |||
40 | pdn = PCI_DN(dn); | ||
41 | if (!pdn) { | ||
42 | dev_dbg(&pdev->dev, "rtas_msi: No PCI DN\n"); | ||
43 | return NULL; | ||
44 | } | ||
45 | |||
46 | return pdn; | ||
47 | } | ||
48 | |||
49 | /* RTAS Helpers */ | 29 | /* RTAS Helpers */ |
50 | 30 | ||
51 | static int rtas_change_msi(struct pci_dn *pdn, u32 func, u32 num_irqs) | 31 | static int rtas_change_msi(struct pci_dn *pdn, u32 func, u32 num_irqs) |
@@ -91,7 +71,7 @@ static void rtas_disable_msi(struct pci_dev *pdev) | |||
91 | { | 71 | { |
92 | struct pci_dn *pdn; | 72 | struct pci_dn *pdn; |
93 | 73 | ||
94 | pdn = get_pdn(pdev); | 74 | pdn = pci_get_pdn(pdev); |
95 | if (!pdn) | 75 | if (!pdn) |
96 | return; | 76 | return; |
97 | 77 | ||
@@ -152,7 +132,7 @@ static int check_req(struct pci_dev *pdev, int nvec, char *prop_name) | |||
152 | struct pci_dn *pdn; | 132 | struct pci_dn *pdn; |
153 | const u32 *req_msi; | 133 | const u32 *req_msi; |
154 | 134 | ||
155 | pdn = get_pdn(pdev); | 135 | pdn = pci_get_pdn(pdev); |
156 | if (!pdn) | 136 | if (!pdn) |
157 | return -ENODEV; | 137 | return -ENODEV; |
158 | 138 | ||
@@ -394,6 +374,23 @@ static int check_msix_entries(struct pci_dev *pdev) | |||
394 | return 0; | 374 | return 0; |
395 | } | 375 | } |
396 | 376 | ||
377 | static void rtas_hack_32bit_msi_gen2(struct pci_dev *pdev) | ||
378 | { | ||
379 | u32 addr_hi, addr_lo; | ||
380 | |||
381 | /* | ||
382 | * We should only get in here for IODA1 configs. This is based on the | ||
383 | * fact that we using RTAS for MSIs, we don't have the 32 bit MSI RTAS | ||
384 | * support, and we are in a PCIe Gen2 slot. | ||
385 | */ | ||
386 | dev_info(&pdev->dev, | ||
387 | "rtas_msi: No 32 bit MSI firmware support, forcing 32 bit MSI\n"); | ||
388 | pci_read_config_dword(pdev, pdev->msi_cap + PCI_MSI_ADDRESS_HI, &addr_hi); | ||
389 | addr_lo = 0xffff0000 | ((addr_hi >> (48 - 32)) << 4); | ||
390 | pci_write_config_dword(pdev, pdev->msi_cap + PCI_MSI_ADDRESS_LO, addr_lo); | ||
391 | pci_write_config_dword(pdev, pdev->msi_cap + PCI_MSI_ADDRESS_HI, 0); | ||
392 | } | ||
393 | |||
397 | static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec_in, int type) | 394 | static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec_in, int type) |
398 | { | 395 | { |
399 | struct pci_dn *pdn; | 396 | struct pci_dn *pdn; |
@@ -401,8 +398,9 @@ static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec_in, int type) | |||
401 | struct msi_desc *entry; | 398 | struct msi_desc *entry; |
402 | struct msi_msg msg; | 399 | struct msi_msg msg; |
403 | int nvec = nvec_in; | 400 | int nvec = nvec_in; |
401 | int use_32bit_msi_hack = 0; | ||
404 | 402 | ||
405 | pdn = get_pdn(pdev); | 403 | pdn = pci_get_pdn(pdev); |
406 | if (!pdn) | 404 | if (!pdn) |
407 | return -ENODEV; | 405 | return -ENODEV; |
408 | 406 | ||
@@ -428,15 +426,31 @@ static int rtas_setup_msi_irqs(struct pci_dev *pdev, int nvec_in, int type) | |||
428 | */ | 426 | */ |
429 | again: | 427 | again: |
430 | if (type == PCI_CAP_ID_MSI) { | 428 | if (type == PCI_CAP_ID_MSI) { |
431 | if (pdn->force_32bit_msi) | 429 | if (pdn->force_32bit_msi) { |
432 | rc = rtas_change_msi(pdn, RTAS_CHANGE_32MSI_FN, nvec); | 430 | rc = rtas_change_msi(pdn, RTAS_CHANGE_32MSI_FN, nvec); |
433 | else | 431 | if (rc < 0) { |
432 | /* | ||
433 | * We only want to run the 32 bit MSI hack below if | ||
434 | * the max bus speed is Gen2 speed | ||
435 | */ | ||
436 | if (pdev->bus->max_bus_speed != PCIE_SPEED_5_0GT) | ||
437 | return rc; | ||
438 | |||
439 | use_32bit_msi_hack = 1; | ||
440 | } | ||
441 | } else | ||
442 | rc = -1; | ||
443 | |||
444 | if (rc < 0) | ||
434 | rc = rtas_change_msi(pdn, RTAS_CHANGE_MSI_FN, nvec); | 445 | rc = rtas_change_msi(pdn, RTAS_CHANGE_MSI_FN, nvec); |
435 | 446 | ||
436 | if (rc < 0 && !pdn->force_32bit_msi) { | 447 | if (rc < 0) { |
437 | pr_debug("rtas_msi: trying the old firmware call.\n"); | 448 | pr_debug("rtas_msi: trying the old firmware call.\n"); |
438 | rc = rtas_change_msi(pdn, RTAS_CHANGE_FN, nvec); | 449 | rc = rtas_change_msi(pdn, RTAS_CHANGE_FN, nvec); |
439 | } | 450 | } |
451 | |||
452 | if (use_32bit_msi_hack && rc > 0) | ||
453 | rtas_hack_32bit_msi_gen2(pdev); | ||
440 | } else | 454 | } else |
441 | rc = rtas_change_msi(pdn, RTAS_CHANGE_MSIX_FN, nvec); | 455 | rc = rtas_change_msi(pdn, RTAS_CHANGE_MSIX_FN, nvec); |
442 | 456 | ||
@@ -518,12 +532,3 @@ static int rtas_msi_init(void) | |||
518 | } | 532 | } |
519 | arch_initcall(rtas_msi_init); | 533 | arch_initcall(rtas_msi_init); |
520 | 534 | ||
521 | static void quirk_radeon(struct pci_dev *dev) | ||
522 | { | ||
523 | struct pci_dn *pdn = get_pdn(dev); | ||
524 | |||
525 | if (pdn) | ||
526 | pdn->force_32bit_msi = 1; | ||
527 | } | ||
528 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x68f2, quirk_radeon); | ||
529 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0xaa68, quirk_radeon); | ||