Skip to content

Commit c818c77

Browse files
committed
Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
Pull powerpc updates from Benjamin Herrenschmidt: "Here are a few more powerpc bits that I would like in 3.10. Mostly remaining bolts & screw tightening of power8 support such as actually exposing the new features via the previously added AT_HWCAP2, and a few fixes, some of them for problems exposed recently like irqdomain warnings or sysfs access permission issues, some exposed by power8 hardware. The only change outside of arch/powerpc is a small one to irqdomain.c to allow silent failure to fix a problem on Cell where we get a dozen WARN_ON's tripping at boot for what is basically a normal case." * 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc: powerpc: Make hard_irq_disable() do the right thing vs. irq tracing powerpc/topology: Fix spurr attribute permission powerpc/pci: Support per-aperture memory offset powerpc/cell/iommu: Improve error message for missing node powerpc/cell/spufs: Fix status attribute permission irqdomain: Allow quiet failure mode powerpc/pnv: Fix "compatible" property for P8 PHB powerpc/pci: Don't add bogus empty resources to PHBs powerpc/powerpnv: Properly handle failure starting CPUs powerpc/cputable: Advertise support for ISEL/HTM/DSCR/TAR on POWER8 powerpc/cputable: Advertise ISEL support on appropriate embedded processors powerpc/cputable: Advertise DSCR support on P7/P7+ powerpc/cputable: Reserve bits in HWCAP2 for new features powerpc/pseries: Perform proper max_bus_speed detection powerpc/pseries: Force 32 bit MSIs for devices that require it powerpc/tm: Fix null pointer deference in flush_hash_page powerpc/powernv: Defer OPAL exception handler registration powerpc: Emulate non privileged DSCR read and write
2 parents c8de2fa + 5737789 commit c818c77

29 files changed

Lines changed: 236 additions & 128 deletions

File tree

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,10 @@ extern const char *powerpc_base_platform;
224224
/* We only set the TM feature if the kernel was compiled with TM supprt */
225225
#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
226226
#define CPU_FTR_TM_COMP CPU_FTR_TM
227+
#define PPC_FEATURE2_HTM_COMP PPC_FEATURE2_HTM
227228
#else
228229
#define CPU_FTR_TM_COMP 0
230+
#define PPC_FEATURE2_HTM_COMP 0
229231
#endif
230232

231233
/* We need to mark all pages as being coherent if we're SMP or we have a

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

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,13 @@ static inline bool arch_irqs_disabled(void)
9595
#define __hard_irq_disable() __mtmsrd(local_paca->kernel_msr, 1)
9696
#endif
9797

98-
static inline void hard_irq_disable(void)
99-
{
100-
__hard_irq_disable();
101-
get_paca()->soft_enabled = 0;
102-
get_paca()->irq_happened |= PACA_IRQ_HARD_DIS;
103-
}
104-
105-
/* include/linux/interrupt.h needs hard_irq_disable to be a macro */
106-
#define hard_irq_disable hard_irq_disable
98+
#define hard_irq_disable() do { \
99+
__hard_irq_disable(); \
100+
if (local_paca->soft_enabled) \
101+
trace_hardirqs_off(); \
102+
get_paca()->soft_enabled = 0; \
103+
get_paca()->irq_happened |= PACA_IRQ_HARD_DIS; \
104+
} while(0)
107105

108106
static inline bool lazy_irq_pending(void)
109107
{

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ struct rtc_time;
2929
struct file;
3030
struct pci_controller;
3131
struct kimage;
32+
struct pci_host_bridge;
3233

3334
struct machdep_calls {
3435
char *name;
@@ -108,6 +109,8 @@ struct machdep_calls {
108109
void (*pcibios_fixup)(void);
109110
int (*pci_probe_mode)(struct pci_bus *);
110111
void (*pci_irq_fixup)(struct pci_dev *dev);
112+
int (*pcibios_root_bridge_prepare)(struct pci_host_bridge
113+
*bridge);
111114

112115
/* To setup PHBs when using automatic OF platform driver for PCI */
113116
int (*pci_setup_phb)(struct pci_controller *host);

‎arch/powerpc/include/asm/pci-bridge.h‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@ struct pci_controller {
3939
resource_size_t io_base_phys;
4040
resource_size_t pci_io_size;
4141

42-
/* Some machines (PReP) have a non 1:1 mapping of
43-
* the PCI memory space in the CPU bus space
44-
*/
45-
resource_size_t pci_mem_offset;
46-
4742
/* Some machines have a special region to forward the ISA
4843
* "memory" cycles such as VGA memory regions. Left to 0
4944
* if unsupported
@@ -86,6 +81,7 @@ struct pci_controller {
8681
*/
8782
struct resource io_resource;
8883
struct resource mem_resources[3];
84+
resource_size_t mem_offset[3];
8985
int global_number; /* PCI domain number */
9086

9187
resource_size_t dma_window_base_cur;
@@ -163,6 +159,8 @@ struct pci_dn {
163159

164160
int pci_ext_config_space; /* for pci devices */
165161

162+
int force_32bit_msi:1;
163+
166164
struct pci_dev *pcidev; /* back-pointer to the pci device */
167165
#ifdef CONFIG_EEH
168166
struct eeh_dev *edev; /* eeh device */

‎arch/powerpc/include/asm/ppc-opcode.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@
115115
#define PPC_INST_MFSPR_DSCR_MASK 0xfc1fffff
116116
#define PPC_INST_MTSPR_DSCR 0x7c1103a6
117117
#define PPC_INST_MTSPR_DSCR_MASK 0xfc1fffff
118+
#define PPC_INST_MFSPR_DSCR_USER 0x7c0302a6
119+
#define PPC_INST_MFSPR_DSCR_USER_MASK 0xfc1fffff
120+
#define PPC_INST_MTSPR_DSCR_USER 0x7c0303a6
121+
#define PPC_INST_MTSPR_DSCR_USER_MASK 0xfc1fffff
118122
#define PPC_INST_SLBFEE 0x7c0007a7
119123

120124
#define PPC_INST_STRING 0x7c00042a

‎arch/powerpc/include/uapi/asm/cputable.h‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#ifndef _UAPI__ASM_POWERPC_CPUTABLE_H
22
#define _UAPI__ASM_POWERPC_CPUTABLE_H
33

4+
/* in AT_HWCAP */
45
#define PPC_FEATURE_32 0x80000000
56
#define PPC_FEATURE_64 0x40000000
67
#define PPC_FEATURE_601_INSTR 0x20000000
@@ -33,4 +34,12 @@
3334
#define PPC_FEATURE_TRUE_LE 0x00000002
3435
#define PPC_FEATURE_PPC_LE 0x00000001
3536

37+
/* in AT_HWCAP2 */
38+
#define PPC_FEATURE2_ARCH_2_07 0x80000000
39+
#define PPC_FEATURE2_HTM 0x40000000
40+
#define PPC_FEATURE2_DSCR 0x20000000
41+
#define PPC_FEATURE2_EBB 0x10000000
42+
#define PPC_FEATURE2_ISEL 0x08000000
43+
#define PPC_FEATURE2_TAR 0x04000000
44+
3645
#endif /* _UAPI__ASM_POWERPC_CPUTABLE_H */

‎arch/powerpc/kernel/cputable.c‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,14 @@ extern void __restore_cpu_e6500(void);
9898
PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP | \
9999
PPC_FEATURE_TRUE_LE | \
100100
PPC_FEATURE_PSERIES_PERFMON_COMPAT)
101+
#define COMMON_USER2_POWER7 (PPC_FEATURE2_DSCR)
101102
#define COMMON_USER_POWER8 (COMMON_USER_PPC64 | PPC_FEATURE_ARCH_2_06 |\
102103
PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP | \
103104
PPC_FEATURE_TRUE_LE | \
104105
PPC_FEATURE_PSERIES_PERFMON_COMPAT)
106+
#define COMMON_USER2_POWER8 (PPC_FEATURE2_ARCH_2_07 | \
107+
PPC_FEATURE2_HTM_COMP | PPC_FEATURE2_DSCR | \
108+
PPC_FEATURE2_ISEL | PPC_FEATURE2_TAR)
105109
#define COMMON_USER_PA6T (COMMON_USER_PPC64 | PPC_FEATURE_PA6T |\
106110
PPC_FEATURE_TRUE_LE | \
107111
PPC_FEATURE_HAS_ALTIVEC_COMP)
@@ -428,6 +432,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
428432
.cpu_name = "POWER7 (architected)",
429433
.cpu_features = CPU_FTRS_POWER7,
430434
.cpu_user_features = COMMON_USER_POWER7,
435+
.cpu_user_features2 = COMMON_USER2_POWER7,
431436
.mmu_features = MMU_FTRS_POWER7,
432437
.icache_bsize = 128,
433438
.dcache_bsize = 128,
@@ -443,6 +448,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
443448
.cpu_name = "POWER8 (architected)",
444449
.cpu_features = CPU_FTRS_POWER8,
445450
.cpu_user_features = COMMON_USER_POWER8,
451+
.cpu_user_features2 = COMMON_USER2_POWER8,
446452
.mmu_features = MMU_FTRS_POWER8,
447453
.icache_bsize = 128,
448454
.dcache_bsize = 128,
@@ -458,6 +464,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
458464
.cpu_name = "POWER7 (raw)",
459465
.cpu_features = CPU_FTRS_POWER7,
460466
.cpu_user_features = COMMON_USER_POWER7,
467+
.cpu_user_features2 = COMMON_USER2_POWER7,
461468
.mmu_features = MMU_FTRS_POWER7,
462469
.icache_bsize = 128,
463470
.dcache_bsize = 128,
@@ -475,6 +482,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
475482
.cpu_name = "POWER7+ (raw)",
476483
.cpu_features = CPU_FTRS_POWER7,
477484
.cpu_user_features = COMMON_USER_POWER7,
485+
.cpu_user_features = COMMON_USER2_POWER7,
478486
.mmu_features = MMU_FTRS_POWER7,
479487
.icache_bsize = 128,
480488
.dcache_bsize = 128,
@@ -492,6 +500,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
492500
.cpu_name = "POWER8 (raw)",
493501
.cpu_features = CPU_FTRS_POWER8,
494502
.cpu_user_features = COMMON_USER_POWER8,
503+
.cpu_user_features2 = COMMON_USER2_POWER8,
495504
.mmu_features = MMU_FTRS_POWER8,
496505
.icache_bsize = 128,
497506
.dcache_bsize = 128,
@@ -1995,6 +2004,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
19952004
.cpu_user_features = COMMON_USER_BOOKE |
19962005
PPC_FEATURE_HAS_SPE_COMP |
19972006
PPC_FEATURE_HAS_EFP_SINGLE_COMP,
2007+
.cpu_user_features2 = PPC_FEATURE2_ISEL,
19982008
.mmu_features = MMU_FTR_TYPE_FSL_E,
19992009
.icache_bsize = 32,
20002010
.dcache_bsize = 32,
@@ -2014,6 +2024,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
20142024
PPC_FEATURE_HAS_SPE_COMP |
20152025
PPC_FEATURE_HAS_EFP_SINGLE_COMP |
20162026
PPC_FEATURE_HAS_EFP_DOUBLE_COMP,
2027+
.cpu_user_features2 = PPC_FEATURE2_ISEL,
20172028
.mmu_features = MMU_FTR_TYPE_FSL_E | MMU_FTR_BIG_PHYS,
20182029
.icache_bsize = 32,
20192030
.dcache_bsize = 32,
@@ -2030,6 +2041,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
20302041
.cpu_name = "e500mc",
20312042
.cpu_features = CPU_FTRS_E500MC,
20322043
.cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU,
2044+
.cpu_user_features2 = PPC_FEATURE2_ISEL,
20332045
.mmu_features = MMU_FTR_TYPE_FSL_E | MMU_FTR_BIG_PHYS |
20342046
MMU_FTR_USE_TLBILX,
20352047
.icache_bsize = 64,
@@ -2048,6 +2060,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
20482060
.cpu_name = "e5500",
20492061
.cpu_features = CPU_FTRS_E5500,
20502062
.cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU,
2063+
.cpu_user_features2 = PPC_FEATURE2_ISEL,
20512064
.mmu_features = MMU_FTR_TYPE_FSL_E | MMU_FTR_BIG_PHYS |
20522065
MMU_FTR_USE_TLBILX,
20532066
.icache_bsize = 64,
@@ -2069,6 +2082,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
20692082
.cpu_features = CPU_FTRS_E6500,
20702083
.cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU |
20712084
PPC_FEATURE_HAS_ALTIVEC_COMP,
2085+
.cpu_user_features2 = PPC_FEATURE2_ISEL,
20722086
.mmu_features = MMU_FTR_TYPE_FSL_E | MMU_FTR_BIG_PHYS |
20732087
MMU_FTR_USE_TLBILX,
20742088
.icache_bsize = 64,

‎arch/powerpc/kernel/pci-common.c‎

Lines changed: 35 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -786,22 +786,8 @@ void pci_process_bridge_OF_ranges(struct pci_controller *hose,
786786
hose->isa_mem_size = size;
787787
}
788788

789-
/* We get the PCI/Mem offset from the first range or
790-
* the, current one if the offset came from an ISA
791-
* hole. If they don't match, bugger.
792-
*/
793-
if (memno == 0 ||
794-
(isa_hole >= 0 && pci_addr != 0 &&
795-
hose->pci_mem_offset == isa_mb))
796-
hose->pci_mem_offset = cpu_addr - pci_addr;
797-
else if (pci_addr != 0 &&
798-
hose->pci_mem_offset != cpu_addr - pci_addr) {
799-
printk(KERN_INFO
800-
" \\--> Skipped (offset mismatch) !\n");
801-
continue;
802-
}
803-
804789
/* Build resource */
790+
hose->mem_offset[memno] = cpu_addr - pci_addr;
805791
res = &hose->mem_resources[memno++];
806792
res->flags = IORESOURCE_MEM;
807793
if (pci_space & 0x40000000)
@@ -817,20 +803,6 @@ void pci_process_bridge_OF_ranges(struct pci_controller *hose,
817803
res->child = NULL;
818804
}
819805
}
820-
821-
/* If there's an ISA hole and the pci_mem_offset is -not- matching
822-
* the ISA hole offset, then we need to remove the ISA hole from
823-
* the resource list for that brige
824-
*/
825-
if (isa_hole >= 0 && hose->pci_mem_offset != isa_mb) {
826-
unsigned int next = isa_hole + 1;
827-
printk(KERN_INFO " Removing ISA hole at 0x%016llx\n", isa_mb);
828-
if (next < memno)
829-
memmove(&hose->mem_resources[isa_hole],
830-
&hose->mem_resources[next],
831-
sizeof(struct resource) * (memno - next));
832-
hose->mem_resources[--memno].flags = 0;
833-
}
834806
}
835807

836808
/* Decide whether to display the domain number in /proc */
@@ -845,6 +817,14 @@ int pci_proc_domain(struct pci_bus *bus)
845817
return 1;
846818
}
847819

820+
int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
821+
{
822+
if (ppc_md.pcibios_root_bridge_prepare)
823+
return ppc_md.pcibios_root_bridge_prepare(bridge);
824+
825+
return 0;
826+
}
827+
848828
/* This header fixup will do the resource fixup for all devices as they are
849829
* probed, but not for bridge ranges
850830
*/
@@ -908,6 +888,7 @@ static int pcibios_uninitialized_bridge_resource(struct pci_bus *bus,
908888
struct pci_controller *hose = pci_bus_to_host(bus);
909889
struct pci_dev *dev = bus->self;
910890
resource_size_t offset;
891+
struct pci_bus_region region;
911892
u16 command;
912893
int i;
913894

@@ -917,10 +898,10 @@ static int pcibios_uninitialized_bridge_resource(struct pci_bus *bus,
917898

918899
/* Job is a bit different between memory and IO */
919900
if (res->flags & IORESOURCE_MEM) {
920-
/* If the BAR is non-0 (res != pci_mem_offset) then it's probably been
921-
* initialized by somebody
922-
*/
923-
if (res->start != hose->pci_mem_offset)
901+
pcibios_resource_to_bus(dev, &region, res);
902+
903+
/* If the BAR is non-0 then it's probably been initialized */
904+
if (region.start != 0)
924905
return 0;
925906

926907
/* The BAR is 0, let's check if memory decoding is enabled on
@@ -932,11 +913,11 @@ static int pcibios_uninitialized_bridge_resource(struct pci_bus *bus,
932913

933914
/* Memory decoding is enabled and the BAR is 0. If any of the bridge
934915
* resources covers that starting address (0 then it's good enough for
935-
* us for memory
916+
* us for memory space)
936917
*/
937918
for (i = 0; i < 3; i++) {
938919
if ((hose->mem_resources[i].flags & IORESOURCE_MEM) &&
939-
hose->mem_resources[i].start == hose->pci_mem_offset)
920+
hose->mem_resources[i].start == hose->mem_offset[i])
940921
return 0;
941922
}
942923

@@ -1373,10 +1354,9 @@ static void __init pcibios_reserve_legacy_regions(struct pci_bus *bus)
13731354

13741355
no_io:
13751356
/* Check for memory */
1376-
offset = hose->pci_mem_offset;
1377-
pr_debug("hose mem offset: %016llx\n", (unsigned long long)offset);
13781357
for (i = 0; i < 3; i++) {
13791358
pres = &hose->mem_resources[i];
1359+
offset = hose->mem_offset[i];
13801360
if (!(pres->flags & IORESOURCE_MEM))
13811361
continue;
13821362
pr_debug("hose mem res: %pR\n", pres);
@@ -1516,6 +1496,7 @@ static void pcibios_setup_phb_resources(struct pci_controller *hose,
15161496
struct list_head *resources)
15171497
{
15181498
struct resource *res;
1499+
resource_size_t offset;
15191500
int i;
15201501

15211502
/* Hookup PHB IO resource */
@@ -1525,49 +1506,37 @@ static void pcibios_setup_phb_resources(struct pci_controller *hose,
15251506
printk(KERN_WARNING "PCI: I/O resource not set for host"
15261507
" bridge %s (domain %d)\n",
15271508
hose->dn->full_name, hose->global_number);
1528-
#ifdef CONFIG_PPC32
1529-
/* Workaround for lack of IO resource only on 32-bit */
1530-
res->start = (unsigned long)hose->io_base_virt - isa_io_base;
1531-
res->end = res->start + IO_SPACE_LIMIT;
1532-
res->flags = IORESOURCE_IO;
1533-
#endif /* CONFIG_PPC32 */
1534-
}
1509+
} else {
1510+
offset = pcibios_io_space_offset(hose);
15351511

1536-
pr_debug("PCI: PHB IO resource = %016llx-%016llx [%lx]\n",
1537-
(unsigned long long)res->start,
1538-
(unsigned long long)res->end,
1539-
(unsigned long)res->flags);
1540-
pci_add_resource_offset(resources, res, pcibios_io_space_offset(hose));
1512+
pr_debug("PCI: PHB IO resource = %08llx-%08llx [%lx] off 0x%08llx\n",
1513+
(unsigned long long)res->start,
1514+
(unsigned long long)res->end,
1515+
(unsigned long)res->flags,
1516+
(unsigned long long)offset);
1517+
pci_add_resource_offset(resources, res, offset);
1518+
}
15411519

15421520
/* Hookup PHB Memory resources */
15431521
for (i = 0; i < 3; ++i) {
15441522
res = &hose->mem_resources[i];
15451523
if (!res->flags) {
1546-
if (i > 0)
1547-
continue;
15481524
printk(KERN_ERR "PCI: Memory resource 0 not set for "
15491525
"host bridge %s (domain %d)\n",
15501526
hose->dn->full_name, hose->global_number);
1551-
#ifdef CONFIG_PPC32
1552-
/* Workaround for lack of MEM resource only on 32-bit */
1553-
res->start = hose->pci_mem_offset;
1554-
res->end = (resource_size_t)-1LL;
1555-
res->flags = IORESOURCE_MEM;
1556-
#endif /* CONFIG_PPC32 */
1527+
continue;
15571528
}
1529+
offset = hose->mem_offset[i];
15581530

1559-
pr_debug("PCI: PHB MEM resource %d = %016llx-%016llx [%lx]\n", i,
1531+
1532+
pr_debug("PCI: PHB MEM resource %d = %08llx-%08llx [%lx] off 0x%08llx\n", i,
15601533
(unsigned long long)res->start,
15611534
(unsigned long long)res->end,
1562-
(unsigned long)res->flags);
1563-
pci_add_resource_offset(resources, res, hose->pci_mem_offset);
1564-
}
1565-
1566-
pr_debug("PCI: PHB MEM offset = %016llx\n",
1567-
(unsigned long long)hose->pci_mem_offset);
1568-
pr_debug("PCI: PHB IO offset = %08lx\n",
1569-
(unsigned long)hose->io_base_virt - _IO_BASE);
1535+
(unsigned long)res->flags,
1536+
(unsigned long long)offset);
15701537

1538+
pci_add_resource_offset(resources, res, offset);
1539+
}
15711540
}
15721541

15731542
/*

‎arch/powerpc/kernel/pci_32.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ long sys_pciconfig_iobase(long which, unsigned long bus, unsigned long devfn)
295295
case IOBASE_BRIDGE_NUMBER:
296296
return (long)hose->first_busno;
297297
case IOBASE_MEMORY:
298-
return (long)hose->pci_mem_offset;
298+
return (long)hose->mem_offset[0];
299299
case IOBASE_IO:
300300
return (long)hose->io_base_phys;
301301
case IOBASE_ISA_IO:

0 commit comments

Comments
 (0)