Commit f1079d3a authored by Michael Ellerman's avatar Michael Ellerman

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.
parents b5240b14 faf37c44
...@@ -246,3 +246,11 @@ Description: read only ...@@ -246,3 +246,11 @@ Description: read only
Returns 1 if the psl timebase register is synchronized Returns 1 if the psl timebase register is synchronized
with the core timebase register, 0 otherwise. with the core timebase register, 0 otherwise.
Users: https://github.com/ibm-capi/libcxl Users: https://github.com/ibm-capi/libcxl
What: /sys/class/cxl/<card>/tunneled_ops_supported
Date: May 2018
Contact: linuxppc-dev@lists.ozlabs.org
Description: read only
Returns 1 if tunneled operations are supported in capi mode,
0 otherwise.
Users: https://github.com/ibm-capi/libcxl
...@@ -65,19 +65,34 @@ struct dyn_arch_ftrace { ...@@ -65,19 +65,34 @@ struct dyn_arch_ftrace {
#endif /* CONFIG_FUNCTION_TRACER */ #endif /* CONFIG_FUNCTION_TRACER */
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#if defined(CONFIG_FTRACE_SYSCALLS) && defined(PPC64_ELF_ABI_v1) #ifdef CONFIG_FTRACE_SYSCALLS
/*
* Some syscall entry functions on powerpc start with "ppc_" (fork and clone,
* for instance) or ppc32_/ppc64_. We should also match the sys_ variant with
* those.
*/
#define ARCH_HAS_SYSCALL_MATCH_SYM_NAME #define ARCH_HAS_SYSCALL_MATCH_SYM_NAME
#ifdef PPC64_ELF_ABI_v1
static inline bool arch_syscall_match_sym_name(const char *sym, const char *name) static inline bool arch_syscall_match_sym_name(const char *sym, const char *name)
{ {
/* /* We need to skip past the initial dot, and the __se_sys alias */
* Compare the symbol name with the system call name. Skip the .sys or .SyS return !strcmp(sym + 1, name) ||
* prefix from the symbol name and the sys prefix from the system call name and (!strncmp(sym, ".__se_sys", 9) && !strcmp(sym + 6, name)) ||
* just match the rest. This is only needed on ppc64 since symbol names on (!strncmp(sym, ".ppc_", 5) && !strcmp(sym + 5, name + 4)) ||
* 32bit do not start with a period so the generic function will work. (!strncmp(sym, ".ppc32_", 7) && !strcmp(sym + 7, name + 4)) ||
*/ (!strncmp(sym, ".ppc64_", 7) && !strcmp(sym + 7, name + 4));
return !strcmp(sym + 4, name + 3);
} }
#endif /* CONFIG_FTRACE_SYSCALLS && PPC64_ELF_ABI_v1 */ #else
static inline bool arch_syscall_match_sym_name(const char *sym, const char *name)
{
return !strcmp(sym, name) ||
(!strncmp(sym, "__se_sys", 8) && !strcmp(sym + 5, name)) ||
(!strncmp(sym, "ppc_", 4) && !strcmp(sym + 4, name + 4)) ||
(!strncmp(sym, "ppc32_", 6) && !strcmp(sym + 6, name + 4)) ||
(!strncmp(sym, "ppc64_", 6) && !strcmp(sym + 6, name + 4));
}
#endif /* PPC64_ELF_ABI_v1 */
#endif /* CONFIG_FTRACE_SYSCALLS */
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
#include <asm/paca.h> #include <asm/paca.h>
......
...@@ -165,7 +165,6 @@ struct paca_struct { ...@@ -165,7 +165,6 @@ struct paca_struct {
u64 saved_msr; /* MSR saved here by enter_rtas */ u64 saved_msr; /* MSR saved here by enter_rtas */
u16 trap_save; /* Used when bad stack is encountered */ u16 trap_save; /* Used when bad stack is encountered */
u8 irq_soft_mask; /* mask for irq soft masking */ u8 irq_soft_mask; /* mask for irq soft masking */
u8 soft_enabled; /* irq soft-enable flag */
u8 irq_happened; /* irq happened while soft-disabled */ u8 irq_happened; /* irq happened while soft-disabled */
u8 io_sync; /* writel() needs spin_unlock sync */ u8 io_sync; /* writel() needs spin_unlock sync */
u8 irq_work_pending; /* IRQ_WORK interrupt while soft-disable */ u8 irq_work_pending; /* IRQ_WORK interrupt while soft-disable */
......
...@@ -91,6 +91,7 @@ extern int start_topology_update(void); ...@@ -91,6 +91,7 @@ extern int start_topology_update(void);
extern int stop_topology_update(void); extern int stop_topology_update(void);
extern int prrn_is_enabled(void); extern int prrn_is_enabled(void);
extern int find_and_online_cpu_nid(int cpu); extern int find_and_online_cpu_nid(int cpu);
extern int timed_topology_update(int nsecs);
#else #else
static inline int start_topology_update(void) static inline int start_topology_update(void)
{ {
...@@ -108,16 +109,12 @@ static inline int find_and_online_cpu_nid(int cpu) ...@@ -108,16 +109,12 @@ static inline int find_and_online_cpu_nid(int cpu)
{ {
return 0; return 0;
} }
static inline int timed_topology_update(int nsecs)
{
return 0;
}
#endif /* CONFIG_NUMA && CONFIG_PPC_SPLPAR */ #endif /* CONFIG_NUMA && CONFIG_PPC_SPLPAR */
#if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_NEED_MULTIPLE_NODES)
#if defined(CONFIG_PPC_SPLPAR)
extern int timed_topology_update(int nsecs);
#else
#define timed_topology_update(nsecs)
#endif /* CONFIG_PPC_SPLPAR */
#endif /* CONFIG_HOTPLUG_CPU || CONFIG_NEED_MULTIPLE_NODES */
#include <asm-generic/topology.h> #include <asm-generic/topology.h>
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
......
...@@ -28,6 +28,7 @@ _GLOBAL(__setup_cpu_power7) ...@@ -28,6 +28,7 @@ _GLOBAL(__setup_cpu_power7)
beqlr beqlr
li r0,0 li r0,0
mtspr SPRN_LPID,r0 mtspr SPRN_LPID,r0
mtspr SPRN_PCR,r0
mfspr r3,SPRN_LPCR mfspr r3,SPRN_LPCR
li r4,(LPCR_LPES1 >> LPCR_LPES_SH) li r4,(LPCR_LPES1 >> LPCR_LPES_SH)
bl __init_LPCR_ISA206 bl __init_LPCR_ISA206
...@@ -41,6 +42,7 @@ _GLOBAL(__restore_cpu_power7) ...@@ -41,6 +42,7 @@ _GLOBAL(__restore_cpu_power7)
beqlr beqlr
li r0,0 li r0,0
mtspr SPRN_LPID,r0 mtspr SPRN_LPID,r0
mtspr SPRN_PCR,r0
mfspr r3,SPRN_LPCR mfspr r3,SPRN_LPCR
li r4,(LPCR_LPES1 >> LPCR_LPES_SH) li r4,(LPCR_LPES1 >> LPCR_LPES_SH)
bl __init_LPCR_ISA206 bl __init_LPCR_ISA206
...@@ -57,6 +59,7 @@ _GLOBAL(__setup_cpu_power8) ...@@ -57,6 +59,7 @@ _GLOBAL(__setup_cpu_power8)
beqlr beqlr
li r0,0 li r0,0
mtspr SPRN_LPID,r0 mtspr SPRN_LPID,r0
mtspr SPRN_PCR,r0
mfspr r3,SPRN_LPCR mfspr r3,SPRN_LPCR
ori r3, r3, LPCR_PECEDH ori r3, r3, LPCR_PECEDH
li r4,0 /* LPES = 0 */ li r4,0 /* LPES = 0 */
...@@ -78,6 +81,7 @@ _GLOBAL(__restore_cpu_power8) ...@@ -78,6 +81,7 @@ _GLOBAL(__restore_cpu_power8)
beqlr beqlr
li r0,0 li r0,0
mtspr SPRN_LPID,r0 mtspr SPRN_LPID,r0
mtspr SPRN_PCR,r0
mfspr r3,SPRN_LPCR mfspr r3,SPRN_LPCR
ori r3, r3, LPCR_PECEDH ori r3, r3, LPCR_PECEDH
li r4,0 /* LPES = 0 */ li r4,0 /* LPES = 0 */
...@@ -99,6 +103,7 @@ _GLOBAL(__setup_cpu_power9) ...@@ -99,6 +103,7 @@ _GLOBAL(__setup_cpu_power9)
mtspr SPRN_PSSCR,r0 mtspr SPRN_PSSCR,r0
mtspr SPRN_LPID,r0 mtspr SPRN_LPID,r0
mtspr SPRN_PID,r0 mtspr SPRN_PID,r0
mtspr SPRN_PCR,r0
mfspr r3,SPRN_LPCR mfspr r3,SPRN_LPCR
LOAD_REG_IMMEDIATE(r4, LPCR_PECEDH | LPCR_PECE_HVEE | LPCR_HVICE | LPCR_HEIC) LOAD_REG_IMMEDIATE(r4, LPCR_PECEDH | LPCR_PECE_HVEE | LPCR_HVICE | LPCR_HEIC)
or r3, r3, r4 or r3, r3, r4
...@@ -123,6 +128,7 @@ _GLOBAL(__restore_cpu_power9) ...@@ -123,6 +128,7 @@ _GLOBAL(__restore_cpu_power9)
mtspr SPRN_PSSCR,r0 mtspr SPRN_PSSCR,r0
mtspr SPRN_LPID,r0 mtspr SPRN_LPID,r0
mtspr SPRN_PID,r0 mtspr SPRN_PID,r0
mtspr SPRN_PCR,r0
mfspr r3,SPRN_LPCR mfspr r3,SPRN_LPCR
LOAD_REG_IMMEDIATE(r4, LPCR_PECEDH | LPCR_PECE_HVEE | LPCR_HVICE | LPCR_HEIC) LOAD_REG_IMMEDIATE(r4, LPCR_PECEDH | LPCR_PECE_HVEE | LPCR_HVICE | LPCR_HEIC)
or r3, r3, r4 or r3, r3, r4
......
...@@ -101,6 +101,7 @@ static void __restore_cpu_cpufeatures(void) ...@@ -101,6 +101,7 @@ static void __restore_cpu_cpufeatures(void)
if (hv_mode) { if (hv_mode) {
mtspr(SPRN_LPID, 0); mtspr(SPRN_LPID, 0);
mtspr(SPRN_HFSCR, system_registers.hfscr); mtspr(SPRN_HFSCR, system_registers.hfscr);
mtspr(SPRN_PCR, 0);
} }
mtspr(SPRN_FSCR, system_registers.fscr); mtspr(SPRN_FSCR, system_registers.fscr);
......
...@@ -44,6 +44,10 @@ static ssize_t opal_nvram_read(char *buf, size_t count, loff_t *index) ...@@ -44,6 +44,10 @@ static ssize_t opal_nvram_read(char *buf, size_t count, loff_t *index)
return count; return count;
} }
/*
* This can be called in the panic path with interrupts off, so use
* mdelay in that case.
*/
static ssize_t opal_nvram_write(char *buf, size_t count, loff_t *index) static ssize_t opal_nvram_write(char *buf, size_t count, loff_t *index)
{ {
s64 rc = OPAL_BUSY; s64 rc = OPAL_BUSY;
...@@ -58,10 +62,16 @@ static ssize_t opal_nvram_write(char *buf, size_t count, loff_t *index) ...@@ -58,10 +62,16 @@ static ssize_t opal_nvram_write(char *buf, size_t count, loff_t *index)
while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) { while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) {
rc = opal_write_nvram(__pa(buf), count, off); rc = opal_write_nvram(__pa(buf), count, off);
if (rc == OPAL_BUSY_EVENT) { if (rc == OPAL_BUSY_EVENT) {
msleep(OPAL_BUSY_DELAY_MS); if (in_interrupt() || irqs_disabled())
mdelay(OPAL_BUSY_DELAY_MS);
else
msleep(OPAL_BUSY_DELAY_MS);
opal_poll_events(NULL); opal_poll_events(NULL);
} else if (rc == OPAL_BUSY) { } else if (rc == OPAL_BUSY) {
msleep(OPAL_BUSY_DELAY_MS); if (in_interrupt() || irqs_disabled())
mdelay(OPAL_BUSY_DELAY_MS);
else
msleep(OPAL_BUSY_DELAY_MS);
} }
} }
......
...@@ -717,6 +717,7 @@ struct cxl { ...@@ -717,6 +717,7 @@ struct cxl {
bool perst_select_user; bool perst_select_user;
bool perst_same_image; bool perst_same_image;
bool psl_timebase_synced; bool psl_timebase_synced;
bool tunneled_ops_supported;
/* /*
* number of contexts mapped on to this card. Possible values are: * number of contexts mapped on to this card. Possible values are:
......
...@@ -1742,6 +1742,15 @@ static int cxl_configure_adapter(struct cxl *adapter, struct pci_dev *dev) ...@@ -1742,6 +1742,15 @@ static int cxl_configure_adapter(struct cxl *adapter, struct pci_dev *dev)
/* Required for devices using CAPP DMA mode, harmless for others */ /* Required for devices using CAPP DMA mode, harmless for others */
pci_set_master(dev); pci_set_master(dev);
adapter->tunneled_ops_supported = false;
if (cxl_is_power9()) {
if (pnv_pci_set_tunnel_bar(dev, 0x00020000E0000000ull, 1))
dev_info(&dev->dev, "Tunneled operations unsupported\n");
else
adapter->tunneled_ops_supported = true;
}
if ((rc = pnv_phb_to_cxl_mode(dev, adapter->native->sl_ops->capi_mode))) if ((rc = pnv_phb_to_cxl_mode(dev, adapter->native->sl_ops->capi_mode)))
goto err; goto err;
...@@ -1768,6 +1777,9 @@ static void cxl_deconfigure_adapter(struct cxl *adapter) ...@@ -1768,6 +1777,9 @@ static void cxl_deconfigure_adapter(struct cxl *adapter)
{ {
struct pci_dev *pdev = to_pci_dev(adapter->dev.parent); struct pci_dev *pdev = to_pci_dev(adapter->dev.parent);
if (cxl_is_power9())
pnv_pci_set_tunnel_bar(pdev, 0x00020000E0000000ull, 0);
cxl_native_release_psl_err_irq(adapter); cxl_native_release_psl_err_irq(adapter);
cxl_unmap_adapter_regs(adapter); cxl_unmap_adapter_regs(adapter);
......
...@@ -78,6 +78,15 @@ static ssize_t psl_timebase_synced_show(struct device *device, ...@@ -78,6 +78,15 @@ static ssize_t psl_timebase_synced_show(struct device *device,
return scnprintf(buf, PAGE_SIZE, "%i\n", adapter->psl_timebase_synced); return scnprintf(buf, PAGE_SIZE, "%i\n", adapter->psl_timebase_synced);
} }
static ssize_t tunneled_ops_supported_show(struct device *device,
struct device_attribute *attr,
char *buf)
{
struct cxl *adapter = to_cxl_adapter(device);
return scnprintf(buf, PAGE_SIZE, "%i\n", adapter->tunneled_ops_supported);
}
static ssize_t reset_adapter_store(struct device *device, static ssize_t reset_adapter_store(struct device *device,
struct device_attribute *attr, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
...@@ -183,6 +192,7 @@ static struct device_attribute adapter_attrs[] = { ...@@ -183,6 +192,7 @@ static struct device_attribute adapter_attrs[] = {
__ATTR_RO(base_image), __ATTR_RO(base_image),
__ATTR_RO(image_loaded), __ATTR_RO(image_loaded),
__ATTR_RO(psl_timebase_synced), __ATTR_RO(psl_timebase_synced),
__ATTR_RO(tunneled_ops_supported),
__ATTR_RW(load_image_on_perst), __ATTR_RW(load_image_on_perst),
__ATTR_RW(perst_reloads_same_image), __ATTR_RW(perst_reloads_same_image),
__ATTR(reset, S_IWUSR, NULL, reset_adapter_store), __ATTR(reset, S_IWUSR, NULL, reset_adapter_store),
......
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