1. 17 Jul, 2016 6 commits
  2. 15 Jul, 2016 20 commits
  3. 14 Jul, 2016 14 commits
    • Daniel Axtens's avatar
      powerpc: Make ppc_md.{halt, restart} __noreturn · 95ec77c0
      Daniel Axtens authored
      powernv marks it's halt and restart calls as __noreturn. However,
      ppc_md does not have this annotation. Add the annotation to ppc_md,
      and then to every halt/restart function that is missing it.
      
      Additionally, I have verified that all of these functions do not
      return. Occasionally I have added a spin loop to be sure.
      Signed-off-by: default avatarDaniel Axtens <dja@axtens.net>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      95ec77c0
    • Daniel Axtens's avatar
      powerpc/sparse: Pass endianness to sparse · 62c2c5cf
      Daniel Axtens authored
      Explicitly give sparse an endianness in the Makefile, so that it
      doesn't get confused.
      
      Normally we have #ifdef one and #else the other, so it doesn't usually
      matter, but we have been bitten by it before, and indeed this patch
      fixes a number of sparse errors.
      Suggested-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarDaniel Axtens <dja@axtens.net>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      62c2c5cf
    • Daniel Axtens's avatar
      powerpc/kvm: Clarify __user annotations · f8750513
      Daniel Axtens authored
      kvmppc_h_put_tce_indirect labels a u64 pointer as __user. It also
      labelled the u64 where get_user puts the result as __user. This isn't
      a pointer and so doesn't need to be labelled __user.
      
      Split the u64 value definition onto a new line to make it clear that
      it doesn't get the annotation.
      Signed-off-by: default avatarDaniel Axtens <dja@axtens.net>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      f8750513
    • Anna-Maria Gleixner's avatar
      powerpc/pmac/smp: Add missing FROZEN hotplug notifier transitions · c011926f
      Anna-Maria Gleixner authored
      The FROZEN transitions are used when a CPU suspends/resumes. In case
      of a suspend/resume, only the up prepare (CPU_UP_PREPARE_FROZEN) is
      handled. The error handling transition CPU_UP_CANCELED_FROZEN as well
      as the CPU_ONLINE_FROZEN transition are not handled.
      
      Masking the switch case action argument with ~CPU_TASKS_FROZEN, to
      handle all FROZEN tasks the same way than the corresponding non frozen
      tasks.
      
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: linuxppc-dev@lists.ozlabs.org
      Signed-off-by: default avatarAnna-Maria Gleixner <anna-maria@linutronix.de>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      c011926f
    • Andrew Donnellan's avatar
      cxl: Add cxl_check_and_switch_mode() API to switch bi-modal cards · b0b5e591
      Andrew Donnellan authored
      Add a new API, cxl_check_and_switch_mode() to allow for switching of
      bi-modal CAPI cards, such as the Mellanox CX-4 network card.
      
      When a driver requests to switch a card to CAPI mode, use PCI hotplug
      infrastructure to remove all PCI devices underneath the slot. We then write
      an updated mode control register to the CAPI VSEC, hot reset the card, and
      reprobe the card.
      
      As the card may present a different set of PCI devices after the mode
      switch, use the infrastructure provided by the pnv_php driver and the OPAL
      PCI slot management facilities to ensure that:
      
        * the old devices are removed from both the OPAL and Linux device trees
        * the new devices are probed by OPAL and added to the OPAL device tree
        * the new devices are added to the Linux device tree and probed through
          the regular PCI device probe path
      
      As such, introduce a new option, CONFIG_CXL_BIMODAL, with a dependency on
      the pnv_php driver.
      
      Refactor existing code that touches the mode control register in the
      regular single mode case into a new function, setup_cxl_protocol_area().
      Co-authored-by: default avatarIan Munsie <imunsie@au1.ibm.com>
      Cc: Gavin Shan <gwshan@linux.vnet.ibm.com>
      Signed-off-by: default avatarAndrew Donnellan <andrew.donnellan@au1.ibm.com>
      Signed-off-by: default avatarIan Munsie <imunsie@au1.ibm.com>
      Reviewed-by: default avatarGavin Shan <gwshan@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      b0b5e591
    • Andrew Donnellan's avatar
      PCI/hotplug: pnv_php: handle OPAL_PCI_SLOT_OFFLINE power state · 5473a6bf
      Andrew Donnellan authored
      When calling pnv_php_set_slot_power_state() with state ==
      OPAL_PCI_SLOT_OFFLINE, remove devices from the device tree as if we're
      dealing with OPAL_PCI_SLOT_POWER_OFF.
      
      Cc: Gavin Shan <gwshan@linux.vnet.ibm.com>
      Cc: linux-pci@vger.kernel.org
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: default avatarAndrew Donnellan <andrew.donnellan@au1.ibm.com>
      Signed-off-by: default avatarIan Munsie <imunsie@au1.ibm.com>
      Acked-by: default avatarGavin Shan <gwshan@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      5473a6bf
    • Andrew Donnellan's avatar
      PCI/hotplug: pnv_php: export symbols and move struct types needed by cxl · 89379f16
      Andrew Donnellan authored
      The cxl driver will use infrastructure from pnv_php to handle device tree
      updates when switching bi-modal CAPI cards into CAPI mode.
      
      To enable this, export pnv_php_find_slot() and
      pnv_php_set_slot_power_state(), and add corresponding declarations, as well
      as the definition of struct pnv_php_slot, to asm/pnv-pci.h.
      
      Cc: Gavin Shan <gwshan@linux.vnet.ibm.com>
      Cc: linux-pci@vger.kernel.org
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: default avatarAndrew Donnellan <andrew.donnellan@au1.ibm.com>
      Signed-off-by: default avatarIan Munsie <imunsie@au1.ibm.com>
      Acked-by: default avatarGavin Shan <gwshan@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      89379f16
    • Ian Munsie's avatar
      cxl: Workaround PE=0 hardware limitation in Mellanox CX4 · f67a6722
      Ian Munsie authored
      The CX4 card cannot cope with a context with PE=0 due to a hardware
      limitation, resulting in:
      
      [   34.166577] command failed, status limits exceeded(0x8), syndrome 0x5a7939
      [   34.166580] mlx5_core 0000:01:00.1: Failed allocating uar, aborting
      
      Since the kernel API allocates a default context very early during
      device init that will almost certainly get Process Element ID 0 there is
      no easy way for us to extend the API to allow the Mellanox to inform us
      of this limitation ahead of time.
      
      Instead, work around the issue by extending the XSL structure to include
      a minimum PE to allocate. Although the bug is not in the XSL, it is the
      easiest place to work around this limitation given that the CX4 is
      currently the only card that uses an XSL.
      Signed-off-by: default avatarIan Munsie <imunsie@au1.ibm.com>
      Reviewed-by: default avatarAndrew Donnellan <andrew.donnellan@au1.ibm.com>
      Reviewed-by: default avatarFrederic Barrat <fbarrat@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      f67a6722
    • Ian Munsie's avatar
      cxl: Add support for interrupts on the Mellanox CX4 · a2f67d5e
      Ian Munsie authored
      The Mellanox CX4 in cxl mode uses a hybrid interrupt model, where
      interrupts are routed from the networking hardware to the XSL using the
      MSIX table, and from there will be transformed back into an MSIX
      interrupt using the cxl style interrupts (i.e. using IVTE entries and
      ranges to map a PE and AFU interrupt number to an MSIX address).
      
      We want to hide the implementation details of cxl interrupts as much as
      possible. To this end, we use a special version of the MSI setup &
      teardown routines in the PHB while in cxl mode to allocate the cxl
      interrupts and configure the IVTE entries in the process element.
      
      This function does not configure the MSIX table - the CX4 card uses a
      custom format in that table and it would not be appropriate to fill that
      out in generic code. The rest of the functionality is similar to the
      "Full MSI-X mode" described in the CAIA, and this could be easily
      extended to support other adapters that use that mode in the future.
      
      The interrupts will be associated with the default context. If the
      maximum number of interrupts per context has been limited (e.g. by the
      mlx5 driver), it will automatically allocate additional kernel contexts
      to associate extra interrupts as required. These contexts will be
      started using the same WED that was used to start the default context.
      Signed-off-by: default avatarIan Munsie <imunsie@au1.ibm.com>
      Reviewed-by: default avatarAndrew Donnellan <andrew.donnellan@au1.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      a2f67d5e
    • Ian Munsie's avatar
      cxl: Add preliminary workaround for CX4 interrupt limitation · cbce0917
      Ian Munsie authored
      The Mellanox CX4 has a hardware limitation where only 4 bits of the
      AFU interrupt number can be passed to the XSL when sending an interrupt,
      limiting it to only 15 interrupts per context (AFU interrupt number 0 is
      invalid).
      
      In order to overcome this, we will allocate additional contexts linked
      to the default context as extra address space for the extra interrupts -
      this will be implemented in the next patch.
      
      This patch adds the preliminary support to allow this, by way of adding
      a linked list in the context structure that we use to keep track of the
      contexts dedicated to interrupts, and an API to simultaneously iterate
      over the related context structures, AFU interrupt numbers and hardware
      interrupt numbers. The point of using a single API to iterate these is
      to hide some of the details of the iteration from external code, and to
      reduce the number of APIs that need to be exported via base.c to allow
      built in code to call.
      Signed-off-by: default avatarIan Munsie <imunsie@au1.ibm.com>
      Reviewed-by: default avatarFrederic Barrat <fbarrat@linux.vnet.ibm.com>
      Reviewed-by: default avatarAndrew Donnellan <andrew.donnellan@au1.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      cbce0917
    • Ian Munsie's avatar
      cxl: Add kernel APIs to get & set the max irqs per context · 79384e4b
      Ian Munsie authored
      These APIs will be used by the Mellanox CX4 support. While they function
      standalone to configure existing behaviour, their primary purpose is to
      allow the Mellanox driver to inform the cxl driver of a hardware
      limitation, which will be used in a future patch.
      Signed-off-by: default avatarIan Munsie <imunsie@au1.ibm.com>
      Reviewed-by: default avatarFrederic Barrat <fbarrat@linux.vnet.ibm.com>
      Reviewed-by: default avatarAndrew Donnellan <andrew.donnellan@au1.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      79384e4b
    • Ian Munsie's avatar
      cxl: Add support for using the kernel API with a real PHB · 317f5ef1
      Ian Munsie authored
      This hooks up support for using the kernel API with a real PHB. After
      the AFU initialisation has completed it calls into the PHB code to pass
      it the AFU that will be used by other peer physical functions on the
      adapter.
      
      The cxl_pci_to_afu API is extended to work with peer PCI devices,
      retrieving the peer AFU from the PHB. This API may also now return an
      error if it is called on a PCI device that is not associated with either
      a cxl vPHB or a peer PCI device to an AFU, and this error is propagated
      down.
      Signed-off-by: default avatarIan Munsie <imunsie@au1.ibm.com>
      Reviewed-by: default avatarAndrew Donnellan <andrew.donnellan@au1.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      317f5ef1
    • Ian Munsie's avatar
      powerpc/powernv: Add support for the cxl kernel api on the real phb · 4361b034
      Ian Munsie authored
      This adds support for the peer model of the cxl kernel api to the
      PowerNV PHB, in which physical function 0 represents the cxl function on
      the card (an XSL in the case of the CX4), which other physical functions
      will use for memory access and interrupt services. It is referred to as
      the peer model as these functions are peers of one another, as opposed
      to the Virtual PHB model which forms a hierarchy.
      
      This patch exports APIs to enable the peer mode, check if a PCI device
      is attached to a PHB in this mode, and to set and get the peer AFU for
      this mode.
      
      The cxl driver will enable this mode for supported cards by calling
      pnv_cxl_enable_phb_kernel_api(). This will set a flag in the PHB to note
      that this mode is enabled, and switch out it's controller_ops for the
      cxl version.
      
      The cxl version of the controller_ops struct implements it's own
      versions of the enable_device_hook and release_device to handle
      refcounting on the peer AFU and to allocate a default context for the
      device.
      
      Once enabled, the cxl kernel API may not be disabled on a PHB. Currently
      there is no safe way to disable cxl mode short of a reboot, so until
      that changes there is no reason to support the disable path.
      Signed-off-by: default avatarIan Munsie <imunsie@au1.ibm.com>
      Reviewed-by: default avatarAndrew Donnellan <andrew.donnellan@au1.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      4361b034
    • Ian Munsie's avatar
      cxl: Do not create vPHB if there are no AFU configuration records · e4f5fc00
      Ian Munsie authored
      The vPHB model of the cxl kernel API is a hierarchy where the AFU is
      represented by the vPHB, and it's AFU configuration records are exposed
      as functions under that vPHB. If there are no AFU configuration records
      we will create a vPHB with nothing under it, which is a waste of
      resources and will opt us into EEH handling despite not having anything
      special to handle.
      
      This also does not make sense for cards using the peer model of the cxl
      kernel API, where the other functions of the device are exposed via
      additional peer physical functions rather than AFU configuration
      records. This model will also not work with the existing EEH handling in
      the cxl driver, as that is designed around the vPHB model.
      
      Skip creating the vPHB for AFUs without any AFU configuration records,
      and opt out of EEH handling for them.
      Signed-off-by: default avatarIan Munsie <imunsie@au1.ibm.com>
      Reviewed-by: default avatarAndrew Donnellan <andrew.donnellan@au1.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      e4f5fc00