1. 14 Jul, 2016 3 commits
    • 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: 's avatarIan Munsie <imunsie@au1.ibm.com>
      Reviewed-by: 's avatarAndrew Donnellan <andrew.donnellan@au1.ibm.com>
      Signed-off-by: 's avatarMichael Ellerman <mpe@ellerman.id.au>
      a2f67d5e
    • Ian Munsie's avatar
      cxl: Allow a default context to be associated with an external pci_dev · a19bd79e
      Ian Munsie authored
      The cxl kernel API has a concept of a default context associated with
      each PCI device under the virtual PHB. The Mellanox CX4 will also use
      the cxl kernel API, but it does not use a virtual PHB - rather, the AFU
      appears as a physical function as a peer to the networking functions.
      
      In order to allow the kernel API to work with those networking
      functions, we will need to associate a default context with them as
      well. To this end, refactor the corresponding code to do this in vphb.c
      and export it so that it can be called from the PHB code.
      Signed-off-by: 's avatarIan Munsie <imunsie@au1.ibm.com>
      Reviewed-by: 's avatarFrederic Barrat <fbarrat@linux.vnet.ibm.com>
      Reviewed-by: 's avatarAndrew Donnellan <andrew.donnellan@au1.ibm.com>
      Signed-off-by: 's avatarMichael Ellerman <mpe@ellerman.id.au>
      a19bd79e
    • Ian Munsie's avatar
      cxl: Move cxl_afu_get / cxl_afu_put to base · 62ccf2d2
      Ian Munsie authored
      The Mellanox CX4 uses a model where the AFU is one physical function of
      the device, and is used by other peer physical functions of the same
      device. This will require those other devices to grab a reference on the
      AFU when they are initialised to make sure that it does not go away
      during their lifetime.
      
      Move the AFU refcount functions to base.c so they can be called from
      the PHB code.
      Signed-off-by: 's avatarIan Munsie <imunsie@au1.ibm.com>
      Reviewed-by: 's avatarAndrew Donnellan <andrew.donnellan@au1.ibm.com>
      Reviewed-by: 's avatarFrederic Barrat <fbarrat@linux.vnet.ibm.com>
      Signed-off-by: 's avatarMichael Ellerman <mpe@ellerman.id.au>
      62ccf2d2
  2. 02 Jun, 2015 1 commit
  3. 08 Oct, 2014 1 commit
    • Ian Munsie's avatar
      cxl: Add new header for call backs and structs · 1cd258d7
      Ian Munsie authored
      This new header adds callbacks and structs needed by the rest of the kernel to
      hook into the cxl infrastructure.
      
      This adds the cxl_ctx_in_use() function for use in the mm code to see if any
      cxl contexts are currently in use. This is used by the tlbie() to determine if
      it can do local TLB invalidations or not. This also adds get/put calls for the
      cxl driver module to refcount the active cxl contexts.
      
      cxl_ctx_get/put/in_use are static inlined here as they are called in tlbie
      which we want to be fast (mpe's suggestion).
      
      Empty functions are provided when CONFIG_CXL_BASE is not enabled.
      Signed-off-by: 's avatarIan Munsie <imunsie@au1.ibm.com>
      Signed-off-by: 's avatarMichael Neuling <mikey@neuling.org>
      Signed-off-by: 's avatarMichael Ellerman <mpe@ellerman.id.au>
      1cd258d7