aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Ellerman <mpe@ellerman.id.au>2018-06-03 06:32:02 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2018-06-03 06:32:02 -0400
commitf1079d3a3d1f468f8faa3f506c163d44fac01912 (patch)
tree51932f197a50dde3d8623752cca73cdd82a4553e
parentb5240b14396dd9c781b5c759830560cdcf1b7a10 (diff)
parentfaf37c44a105f3608115785f17cbbf3500f8bc71 (diff)
Merge branch 'fixes' into next
We ended up with an ugly conflict between fixes and next in ftrace.h involving multiple nested ifdefs, and the automatic resolution is wrong. So merge fixes into next so we can fix it up.
-rw-r--r--Documentation/ABI/testing/sysfs-class-cxl8
-rw-r--r--arch/powerpc/include/asm/ftrace.h33
-rw-r--r--arch/powerpc/include/asm/paca.h1
-rw-r--r--arch/powerpc/include/asm/topology.h13
-rw-r--r--arch/powerpc/kernel/cpu_setup_power.S6
-rw-r--r--arch/powerpc/kernel/dt_cpu_ftrs.c1
-rw-r--r--arch/powerpc/platforms/powernv/opal-nvram.c14
-rw-r--r--drivers/misc/cxl/cxl.h1
-rw-r--r--drivers/misc/cxl/pci.c12
-rw-r--r--drivers/misc/cxl/sysfs.c10
10 files changed, 79 insertions, 20 deletions
diff --git a/Documentation/ABI/testing/sysfs-class-cxl b/Documentation/ABI/testing/sysfs-class-cxl
index 267920a1874b..bbbabffc682a 100644
--- a/Documentation/ABI/testing/sysfs-class-cxl
+++ b/Documentation/ABI/testing/sysfs-class-cxl
@@ -246,3 +246,11 @@ Description: read only
246 Returns 1 if the psl timebase register is synchronized 246 Returns 1 if the psl timebase register is synchronized
247 with the core timebase register, 0 otherwise. 247 with the core timebase register, 0 otherwise.
248Users: https://github.com/ibm-capi/libcxl 248Users: https://github.com/ibm-capi/libcxl
249
250What: /sys/class/cxl/<card>/tunneled_ops_supported
251Date: May 2018
252Contact: linuxppc-dev@lists.ozlabs.org
253Description: read only
254 Returns 1 if tunneled operations are supported in capi mode,
255 0 otherwise.
256Users: https://github.com/ibm-capi/libcxl
diff --git a/arch/powerpc/include/asm/ftrace.h b/arch/powerpc/include/asm/ftrace.h
index fc3a2203c566..3dfb80b86561 100644
--- a/arch/powerpc/include/asm/ftrace.h
+++ b/arch/powerpc/include/asm/ftrace.h
@@ -65,19 +65,34 @@ struct dyn_arch_ftrace {
65#endif /* CONFIG_FUNCTION_TRACER */ 65#endif /* CONFIG_FUNCTION_TRACER */
66 66
67#ifndef __ASSEMBLY__ 67#ifndef __ASSEMBLY__
68#if defined(CONFIG_FTRACE_SYSCALLS) && defined(PPC64_ELF_ABI_v1) 68#ifdef CONFIG_FTRACE_SYSCALLS
69/*
70 * Some syscall entry functions on powerpc start with "ppc_" (fork and clone,
71 * for instance) or ppc32_/ppc64_. We should also match the sys_ variant with
72 * those.
73 */
69#define ARCH_HAS_SYSCALL_MATCH_SYM_NAME 74#define ARCH_HAS_SYSCALL_MATCH_SYM_NAME
75#ifdef PPC64_ELF_ABI_v1
70static inline bool arch_syscall_match_sym_name(const char *sym, const char *name) 76static inline bool arch_syscall_match_sym_name(const char *sym, const char *name)
71{ 77{
72 /* 78 /* We need to skip past the initial dot, and the __se_sys alias */
73 * Compare the symbol name with the system call name. Skip the .sys or .SyS 79 return !strcmp(sym + 1, name) ||
74 * prefix from the symbol name and the sys prefix from the system call name and 80 (!strncmp(sym, ".__se_sys", 9) && !strcmp(sym + 6, name)) ||
75 * just match the rest. This is only needed on ppc64 since symbol names on 81 (!strncmp(sym, ".ppc_", 5) && !strcmp(sym + 5, name + 4)) ||
76 * 32bit do not start with a period so the generic function will work. 82 (!strncmp(sym, ".ppc32_", 7) && !strcmp(sym + 7, name + 4)) ||
77 */ 83 (!strncmp(sym, ".ppc64_", 7) && !strcmp(sym + 7, name + 4));
78 return !strcmp(sym + 4, name + 3);
79} 84}
80#endif /* CONFIG_FTRACE_SYSCALLS && PPC64_ELF_ABI_v1 */ 85#else
86static inline bool arch_syscall_match_sym_name(const char *sym, const char *name)
87{
88 return !strcmp(sym, name) ||
89 (!strncmp(sym, "__se_sys", 8) && !strcmp(sym + 5, name)) ||
90 (!strncmp(sym, "ppc_", 4) && !strcmp(sym + 4, name + 4)) ||
91 (!strncmp(sym, "ppc32_", 6) && !strcmp(sym + 6, name + 4)) ||
92 (!strncmp(sym, "ppc64_", 6) && !strcmp(sym + 6, name + 4));
93}
94#endif /* PPC64_ELF_ABI_v1 */
95#endif /* CONFIG_FTRACE_SYSCALLS */
81 96
82#ifdef CONFIG_PPC64 97#ifdef CONFIG_PPC64
83#include <asm/paca.h> 98#include <asm/paca.h>
diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
index 163f13f31255..81471bd08f66 100644
--- a/arch/powerpc/include/asm/paca.h
+++ b/arch/powerpc/include/asm/paca.h
@@ -165,7 +165,6 @@ struct paca_struct {
165 u64 saved_msr; /* MSR saved here by enter_rtas */ 165 u64 saved_msr; /* MSR saved here by enter_rtas */
166 u16 trap_save; /* Used when bad stack is encountered */ 166 u16 trap_save; /* Used when bad stack is encountered */
167 u8 irq_soft_mask; /* mask for irq soft masking */ 167 u8 irq_soft_mask; /* mask for irq soft masking */
168 u8 soft_enabled; /* irq soft-enable flag */
169 u8 irq_happened; /* irq happened while soft-disabled */ 168 u8 irq_happened; /* irq happened while soft-disabled */
170 u8 io_sync; /* writel() needs spin_unlock sync */ 169 u8 io_sync; /* writel() needs spin_unlock sync */
171 u8 irq_work_pending; /* IRQ_WORK interrupt while soft-disable */ 170 u8 irq_work_pending; /* IRQ_WORK interrupt while soft-disable */
diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h
index 9f421641a35c..16b077801a5f 100644
--- a/arch/powerpc/include/asm/topology.h
+++ b/arch/powerpc/include/asm/topology.h
@@ -91,6 +91,7 @@ extern int start_topology_update(void);
91extern int stop_topology_update(void); 91extern int stop_topology_update(void);
92extern int prrn_is_enabled(void); 92extern int prrn_is_enabled(void);
93extern int find_and_online_cpu_nid(int cpu); 93extern int find_and_online_cpu_nid(int cpu);
94extern int timed_topology_update(int nsecs);
94#else 95#else
95static inline int start_topology_update(void) 96static inline int start_topology_update(void)
96{ 97{
@@ -108,16 +109,12 @@ static inline int find_and_online_cpu_nid(int cpu)
108{ 109{
109 return 0; 110 return 0;
110} 111}
112static inline int timed_topology_update(int nsecs)
113{
114 return 0;
115}
111#endif /* CONFIG_NUMA && CONFIG_PPC_SPLPAR */ 116#endif /* CONFIG_NUMA && CONFIG_PPC_SPLPAR */
112 117
113#if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_NEED_MULTIPLE_NODES)
114#if defined(CONFIG_PPC_SPLPAR)
115extern int timed_topology_update(int nsecs);
116#else
117#define timed_topology_update(nsecs)
118#endif /* CONFIG_PPC_SPLPAR */
119#endif /* CONFIG_HOTPLUG_CPU || CONFIG_NEED_MULTIPLE_NODES */
120
121#include <asm-generic/topology.h> 118#include <asm-generic/topology.h>
122 119
123#ifdef CONFIG_SMP 120#ifdef CONFIG_SMP
diff --git a/arch/powerpc/kernel/cpu_setup_power.S b/arch/powerpc/kernel/cpu_setup_power.S
index 3f30c994e931..458b928dbd84 100644
--- a/arch/powerpc/kernel/cpu_setup_power.S
+++ b/arch/powerpc/kernel/cpu_setup_power.S
@@ -28,6 +28,7 @@ _GLOBAL(__setup_cpu_power7)
28 beqlr 28 beqlr
29 li r0,0 29 li r0,0
30 mtspr SPRN_LPID,r0 30 mtspr SPRN_LPID,r0
31 mtspr SPRN_PCR,r0
31 mfspr r3,SPRN_LPCR 32 mfspr r3,SPRN_LPCR
32 li r4,(LPCR_LPES1 >> LPCR_LPES_SH) 33 li r4,(LPCR_LPES1 >> LPCR_LPES_SH)
33 bl __init_LPCR_ISA206 34 bl __init_LPCR_ISA206
@@ -41,6 +42,7 @@ _GLOBAL(__restore_cpu_power7)
41 beqlr 42 beqlr
42 li r0,0 43 li r0,0
43 mtspr SPRN_LPID,r0 44 mtspr SPRN_LPID,r0
45 mtspr SPRN_PCR,r0
44 mfspr r3,SPRN_LPCR 46 mfspr r3,SPRN_LPCR
45 li r4,(LPCR_LPES1 >> LPCR_LPES_SH) 47 li r4,(LPCR_LPES1 >> LPCR_LPES_SH)
46 bl __init_LPCR_ISA206 48 bl __init_LPCR_ISA206
@@ -57,6 +59,7 @@ _GLOBAL(__setup_cpu_power8)
57 beqlr 59 beqlr
58 li r0,0 60 li r0,0
59 mtspr SPRN_LPID,r0 61 mtspr SPRN_LPID,r0
62 mtspr SPRN_PCR,r0
60 mfspr r3,SPRN_LPCR 63 mfspr r3,SPRN_LPCR
61 ori r3, r3, LPCR_PECEDH 64 ori r3, r3, LPCR_PECEDH
62 li r4,0 /* LPES = 0 */ 65 li r4,0 /* LPES = 0 */
@@ -78,6 +81,7 @@ _GLOBAL(__restore_cpu_power8)
78 beqlr 81 beqlr
79 li r0,0 82 li r0,0
80 mtspr SPRN_LPID,r0 83 mtspr SPRN_LPID,r0
84 mtspr SPRN_PCR,r0
81 mfspr r3,SPRN_LPCR 85 mfspr r3,SPRN_LPCR
82 ori r3, r3, LPCR_PECEDH 86 ori r3, r3, LPCR_PECEDH
83 li r4,0 /* LPES = 0 */ 87 li r4,0 /* LPES = 0 */
@@ -99,6 +103,7 @@ _GLOBAL(__setup_cpu_power9)
99 mtspr SPRN_PSSCR,r0 103 mtspr SPRN_PSSCR,r0
100 mtspr SPRN_LPID,r0 104 mtspr SPRN_LPID,r0
101 mtspr SPRN_PID,r0 105 mtspr SPRN_PID,r0
106 mtspr SPRN_PCR,r0
102 mfspr r3,SPRN_LPCR 107 mfspr r3,SPRN_LPCR
103 LOAD_REG_IMMEDIATE(r4, LPCR_PECEDH | LPCR_PECE_HVEE | LPCR_HVICE | LPCR_HEIC) 108 LOAD_REG_IMMEDIATE(r4, LPCR_PECEDH | LPCR_PECE_HVEE | LPCR_HVICE | LPCR_HEIC)
104 or r3, r3, r4 109 or r3, r3, r4
@@ -123,6 +128,7 @@ _GLOBAL(__restore_cpu_power9)
123 mtspr SPRN_PSSCR,r0 128 mtspr SPRN_PSSCR,r0
124 mtspr SPRN_LPID,r0 129 mtspr SPRN_LPID,r0
125 mtspr SPRN_PID,r0 130 mtspr SPRN_PID,r0
131 mtspr SPRN_PCR,r0
126 mfspr r3,SPRN_LPCR 132 mfspr r3,SPRN_LPCR
127 LOAD_REG_IMMEDIATE(r4, LPCR_PECEDH | LPCR_PECE_HVEE | LPCR_HVICE | LPCR_HEIC) 133 LOAD_REG_IMMEDIATE(r4, LPCR_PECEDH | LPCR_PECE_HVEE | LPCR_HVICE | LPCR_HEIC)
128 or r3, r3, r4 134 or r3, r3, r4
diff --git a/arch/powerpc/kernel/dt_cpu_ftrs.c b/arch/powerpc/kernel/dt_cpu_ftrs.c
index 8ab51f6ca03a..c904477abaf3 100644
--- a/arch/powerpc/kernel/dt_cpu_ftrs.c
+++ b/arch/powerpc/kernel/dt_cpu_ftrs.c
@@ -101,6 +101,7 @@ static void __restore_cpu_cpufeatures(void)
101 if (hv_mode) { 101 if (hv_mode) {
102 mtspr(SPRN_LPID, 0); 102 mtspr(SPRN_LPID, 0);
103 mtspr(SPRN_HFSCR, system_registers.hfscr); 103 mtspr(SPRN_HFSCR, system_registers.hfscr);
104 mtspr(SPRN_PCR, 0);
104 } 105 }
105 mtspr(SPRN_FSCR, system_registers.fscr); 106 mtspr(SPRN_FSCR, system_registers.fscr);
106 107
diff --git a/arch/powerpc/platforms/powernv/opal-nvram.c b/arch/powerpc/platforms/powernv/opal-nvram.c
index 1bceb95f422d..5584247f5029 100644
--- a/arch/powerpc/platforms/powernv/opal-nvram.c
+++ b/arch/powerpc/platforms/powernv/opal-nvram.c
@@ -44,6 +44,10 @@ static ssize_t opal_nvram_read(char *buf, size_t count, loff_t *index)
44 return count; 44 return count;
45} 45}
46 46
47/*
48 * This can be called in the panic path with interrupts off, so use
49 * mdelay in that case.
50 */
47static ssize_t opal_nvram_write(char *buf, size_t count, loff_t *index) 51static ssize_t opal_nvram_write(char *buf, size_t count, loff_t *index)
48{ 52{
49 s64 rc = OPAL_BUSY; 53 s64 rc = OPAL_BUSY;
@@ -58,10 +62,16 @@ static ssize_t opal_nvram_write(char *buf, size_t count, loff_t *index)
58 while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) { 62 while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) {
59 rc = opal_write_nvram(__pa(buf), count, off); 63 rc = opal_write_nvram(__pa(buf), count, off);
60 if (rc == OPAL_BUSY_EVENT) { 64 if (rc == OPAL_BUSY_EVENT) {
61 msleep(OPAL_BUSY_DELAY_MS); 65 if (in_interrupt() || irqs_disabled())
66 mdelay(OPAL_BUSY_DELAY_MS);
67 else
68 msleep(OPAL_BUSY_DELAY_MS);
62 opal_poll_events(NULL); 69 opal_poll_events(NULL);
63 } else if (rc == OPAL_BUSY) { 70 } else if (rc == OPAL_BUSY) {
64 msleep(OPAL_BUSY_DELAY_MS); 71 if (in_interrupt() || irqs_disabled())
72 mdelay(OPAL_BUSY_DELAY_MS);
73 else
74 msleep(OPAL_BUSY_DELAY_MS);
65 } 75 }
66 } 76 }
67 77
diff --git a/drivers/misc/cxl/cxl.h b/drivers/misc/cxl/cxl.h
index a4c9c8297a6d..918d4fb742d1 100644
--- a/drivers/misc/cxl/cxl.h
+++ b/drivers/misc/cxl/cxl.h
@@ -717,6 +717,7 @@ struct cxl {
717 bool perst_select_user; 717 bool perst_select_user;
718 bool perst_same_image; 718 bool perst_same_image;
719 bool psl_timebase_synced; 719 bool psl_timebase_synced;
720 bool tunneled_ops_supported;
720 721
721 /* 722 /*
722 * number of contexts mapped on to this card. Possible values are: 723 * number of contexts mapped on to this card. Possible values are:
diff --git a/drivers/misc/cxl/pci.c b/drivers/misc/cxl/pci.c
index 2e8b187956bc..429d6de1dde7 100644
--- a/drivers/misc/cxl/pci.c
+++ b/drivers/misc/cxl/pci.c
@@ -1742,6 +1742,15 @@ static int cxl_configure_adapter(struct cxl *adapter, struct pci_dev *dev)
1742 /* Required for devices using CAPP DMA mode, harmless for others */ 1742 /* Required for devices using CAPP DMA mode, harmless for others */
1743 pci_set_master(dev); 1743 pci_set_master(dev);
1744 1744
1745 adapter->tunneled_ops_supported = false;
1746
1747 if (cxl_is_power9()) {
1748 if (pnv_pci_set_tunnel_bar(dev, 0x00020000E0000000ull, 1))
1749 dev_info(&dev->dev, "Tunneled operations unsupported\n");
1750 else
1751 adapter->tunneled_ops_supported = true;
1752 }
1753
1745 if ((rc = pnv_phb_to_cxl_mode(dev, adapter->native->sl_ops->capi_mode))) 1754 if ((rc = pnv_phb_to_cxl_mode(dev, adapter->native->sl_ops->capi_mode)))
1746 goto err; 1755 goto err;
1747 1756
@@ -1768,6 +1777,9 @@ static void cxl_deconfigure_adapter(struct cxl *adapter)
1768{ 1777{
1769 struct pci_dev *pdev = to_pci_dev(adapter->dev.parent); 1778 struct pci_dev *pdev = to_pci_dev(adapter->dev.parent);
1770 1779
1780 if (cxl_is_power9())
1781 pnv_pci_set_tunnel_bar(pdev, 0x00020000E0000000ull, 0);
1782
1771 cxl_native_release_psl_err_irq(adapter); 1783 cxl_native_release_psl_err_irq(adapter);
1772 cxl_unmap_adapter_regs(adapter); 1784 cxl_unmap_adapter_regs(adapter);
1773 1785
diff --git a/drivers/misc/cxl/sysfs.c b/drivers/misc/cxl/sysfs.c
index 90aa4eee8ccd..629e2e156412 100644
--- a/drivers/misc/cxl/sysfs.c
+++ b/drivers/misc/cxl/sysfs.c
@@ -78,6 +78,15 @@ static ssize_t psl_timebase_synced_show(struct device *device,
78 return scnprintf(buf, PAGE_SIZE, "%i\n", adapter->psl_timebase_synced); 78 return scnprintf(buf, PAGE_SIZE, "%i\n", adapter->psl_timebase_synced);
79} 79}
80 80
81static ssize_t tunneled_ops_supported_show(struct device *device,
82 struct device_attribute *attr,
83 char *buf)
84{
85 struct cxl *adapter = to_cxl_adapter(device);
86
87 return scnprintf(buf, PAGE_SIZE, "%i\n", adapter->tunneled_ops_supported);
88}
89
81static ssize_t reset_adapter_store(struct device *device, 90static ssize_t reset_adapter_store(struct device *device,
82 struct device_attribute *attr, 91 struct device_attribute *attr,
83 const char *buf, size_t count) 92 const char *buf, size_t count)
@@ -183,6 +192,7 @@ static struct device_attribute adapter_attrs[] = {
183 __ATTR_RO(base_image), 192 __ATTR_RO(base_image),
184 __ATTR_RO(image_loaded), 193 __ATTR_RO(image_loaded),
185 __ATTR_RO(psl_timebase_synced), 194 __ATTR_RO(psl_timebase_synced),
195 __ATTR_RO(tunneled_ops_supported),
186 __ATTR_RW(load_image_on_perst), 196 __ATTR_RW(load_image_on_perst),
187 __ATTR_RW(perst_reloads_same_image), 197 __ATTR_RW(perst_reloads_same_image),
188 __ATTR(reset, S_IWUSR, NULL, reset_adapter_store), 198 __ATTR(reset, S_IWUSR, NULL, reset_adapter_store),