Merge branch 'fixes' into next
authorMichael Ellerman <mpe@ellerman.id.au>
Sun, 3 Jun 2018 10:32:02 +0000 (20:32 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Sun, 3 Jun 2018 10:32:02 +0000 (20:32 +1000)
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.

1  2 
Documentation/ABI/testing/sysfs-class-cxl
arch/powerpc/include/asm/ftrace.h
arch/powerpc/include/asm/paca.h
drivers/misc/cxl/pci.c
drivers/misc/cxl/sysfs.c

@@@ -69,9 -69,7 +69,9 @@@ Date:           September 201
  Contact:        linuxppc-dev@lists.ozlabs.org
  Description:    read/write
                  Set the mode for prefaulting in segments into the segment table
 -                when performing the START_WORK ioctl. Possible values:
 +                when performing the START_WORK ioctl. Only applicable when
 +                running under hashed page table mmu.
 +                Possible values:
                          none: No prefaulting (default)
                          work_element_descriptor: Treat the work element
                                   descriptor as an effective address and
@@@ -246,3 -244,11 +246,11 @@@ Description:    read onl
                  Returns 1 if the psl timebase register is synchronized
                  with the core timebase register, 0 otherwise.
  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
@@@ -48,6 -48,9 +48,6 @@@
  #else /* !__ASSEMBLY__ */
  extern void _mcount(void);
  
 -#ifdef CONFIG_DYNAMIC_FTRACE
 -# define FTRACE_ADDR ((unsigned long)ftrace_caller)
 -# define FTRACE_REGS_ADDR FTRACE_ADDR
  static inline unsigned long ftrace_call_adjust(unsigned long addr)
  {
         /* reloction of mcount call site is the same as the address */
  struct dyn_arch_ftrace {
        struct module *mod;
  };
 -#endif /*  CONFIG_DYNAMIC_FTRACE */
  #endif /* __ASSEMBLY__ */
  
  #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
  #define ARCH_SUPPORTS_FTRACE_OPS 1
  #endif
 -#endif
 +#endif /* CONFIG_FUNCTION_TRACER */
  
 -#if defined(CONFIG_FTRACE_SYSCALLS) && !defined(__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
+ #ifdef PPC64_ELF_ABI_v1
  static inline bool arch_syscall_match_sym_name(const char *sym, const char *name)
  {
-       /*
-        * Compare the symbol name with the system call name. Skip the .sys or .SyS
-        * prefix from the symbol name and the sys prefix from the system call name and
-        * just match the rest. This is only needed on ppc64 since symbol names on
-        * 32bit do not start with a period so the generic function will work.
-        */
-       return !strcmp(sym + 4, name + 3);
+       /* We need to skip past the initial dot, and the __se_sys alias */
+       return !strcmp(sym + 1, name) ||
+               (!strncmp(sym, ".__se_sys", 9) && !strcmp(sym + 6, name)) ||
+               (!strncmp(sym, ".ppc_", 5) && !strcmp(sym + 5, name + 4)) ||
+               (!strncmp(sym, ".ppc32_", 7) && !strcmp(sym + 7, name + 4)) ||
+               (!strncmp(sym, ".ppc64_", 7) && !strcmp(sym + 7, name + 4));
  }
- #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
 -#endif /* CONFIG_FTRACE_SYSCALLS && !__ASSEMBLY__ */
++#endif /* PPC64_ELF_ABI_v1 */
++#endif /* CONFIG_FTRACE_SYSCALLS */
 +
 +#ifdef CONFIG_PPC64
 +#include <asm/paca.h>
 +
 +static inline void this_cpu_disable_ftrace(void)
 +{
 +      get_paca()->ftrace_enabled = 0;
 +}
 +
 +static inline void this_cpu_enable_ftrace(void)
 +{
 +      get_paca()->ftrace_enabled = 1;
 +}
 +#else /* CONFIG_PPC64 */
 +static inline void this_cpu_disable_ftrace(void) { }
 +static inline void this_cpu_enable_ftrace(void) { }
 +#endif /* CONFIG_PPC64 */
 +#endif /* !__ASSEMBLY__ */
  
  #endif /* _ASM_POWERPC_FTRACE */
@@@ -165,7 -165,6 +165,6 @@@ struct paca_struct 
        u64 saved_msr;                  /* MSR saved here by enter_rtas */
        u16 trap_save;                  /* Used when bad stack is encountered */
        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 io_sync;                     /* writel() needs spin_unlock sync */
        u8 irq_work_pending;            /* IRQ_WORK interrupt while soft-disable */
        u8 hmi_event_available;         /* HMI event is available */
        u8 hmi_p9_special_emu;          /* HMI P9 special emulation */
  #endif
 +      u8 ftrace_enabled;              /* Hard disable ftrace */
  
        /* Stuff for accurate time accounting */
        struct cpu_accounting_data accounting;
diff --combined drivers/misc/cxl/pci.c
@@@ -514,9 -514,9 +514,9 @@@ static int init_implementation_adapter_
        cxl_p1_write(adapter, CXL_PSL9_FIR_CNTL, psl_fircntl);
  
        /* Setup the PSL to transmit packets on the PCIe before the
 -       * CAPP is enabled
 +       * CAPP is enabled. Make sure that CAPP virtual machines are disabled
         */
 -      cxl_p1_write(adapter, CXL_PSL9_DSNDCTL, 0x0001001000002A10ULL);
 +      cxl_p1_write(adapter, CXL_PSL9_DSNDCTL, 0x0001001000012A10ULL);
  
        /*
         * A response to an ASB_Notify request is returned by the
@@@ -1742,6 -1742,15 +1742,15 @@@ static int cxl_configure_adapter(struc
        /* Required for devices using CAPP DMA mode, harmless for others */
        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)))
                goto err;
  
@@@ -1768,6 -1777,9 +1777,9 @@@ static void cxl_deconfigure_adapter(str
  {
        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_unmap_adapter_regs(adapter);
  
diff --combined drivers/misc/cxl/sysfs.c
@@@ -78,6 -78,15 +78,15 @@@ static ssize_t psl_timebase_synced_show
        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,
                                   struct device_attribute *attr,
                                   const char *buf, size_t count)
@@@ -183,6 -192,7 +192,7 @@@ static struct device_attribute adapter_
        __ATTR_RO(base_image),
        __ATTR_RO(image_loaded),
        __ATTR_RO(psl_timebase_synced),
+       __ATTR_RO(tunneled_ops_supported),
        __ATTR_RW(load_image_on_perst),
        __ATTR_RW(perst_reloads_same_image),
        __ATTR(reset, S_IWUSR, NULL, reset_adapter_store),
@@@ -343,20 -353,12 +353,20 @@@ static ssize_t prefault_mode_store(stru
        struct cxl_afu *afu = to_cxl_afu(device);
        enum prefault_modes mode = -1;
  
 -      if (!strncmp(buf, "work_element_descriptor", 23))
 -              mode = CXL_PREFAULT_WED;
 -      if (!strncmp(buf, "all", 3))
 -              mode = CXL_PREFAULT_ALL;
        if (!strncmp(buf, "none", 4))
                mode = CXL_PREFAULT_NONE;
 +      else {
 +              if (!radix_enabled()) {
 +
 +                      /* only allowed when not in radix mode */
 +                      if (!strncmp(buf, "work_element_descriptor", 23))
 +                              mode = CXL_PREFAULT_WED;
 +                      if (!strncmp(buf, "all", 3))
 +                              mode = CXL_PREFAULT_ALL;
 +              } else {
 +                      dev_err(device, "Cannot prefault with radix enabled\n");
 +              }
 +      }
  
        if (mode == -1)
                return -EINVAL;