1. 02 7月, 2018 2 次提交
  2. 29 11月, 2017 1 次提交
  3. 14 7月, 2016 4 次提交
    • A
      cxl: Add cxl_check_and_switch_mode() API to switch bi-modal cards · b0b5e591
      Andrew Donnellan 提交于
      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: NIan Munsie <imunsie@au1.ibm.com>
      Cc: Gavin Shan <gwshan@linux.vnet.ibm.com>
      Signed-off-by: NAndrew Donnellan <andrew.donnellan@au1.ibm.com>
      Signed-off-by: NIan Munsie <imunsie@au1.ibm.com>
      Reviewed-by: NGavin Shan <gwshan@linux.vnet.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      b0b5e591
    • I
      cxl: Add preliminary workaround for CX4 interrupt limitation · cbce0917
      Ian Munsie 提交于
      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: NIan Munsie <imunsie@au1.ibm.com>
      Reviewed-by: NFrederic Barrat <fbarrat@linux.vnet.ibm.com>
      Reviewed-by: NAndrew Donnellan <andrew.donnellan@au1.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      cbce0917
    • I
      cxl: Add kernel APIs to get & set the max irqs per context · 79384e4b
      Ian Munsie 提交于
      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: NIan Munsie <imunsie@au1.ibm.com>
      Reviewed-by: NFrederic Barrat <fbarrat@linux.vnet.ibm.com>
      Reviewed-by: NAndrew Donnellan <andrew.donnellan@au1.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      79384e4b
    • I
      cxl: Add cxl_slot_is_supported API · 4e56f858
      Ian Munsie 提交于
      This extends the check that the adapter is in a CAPI capable slot so
      that it may be called by external users in the kernel API. This will be
      used by the upcoming Mellanox CX4 support, which needs to know ahead of
      time if the card can be switched to cxl mode so that it can leave it in
      PCI mode if it is not.
      
      This API takes a parameter to check if CAPP DMA mode is supported, which
      it currently only allows on P8NVL systems, since that mode currently has
      issues accessing memory < 4GB on P8, and we cannot realistically avoid
      that.
      
      This API does not currently check if a CAPP unit is available (i.e. not
      already assigned to another PHB) on P8. Doing so would be racy since it
      is assigned on a first come first serve basis, and so long as CAPP DMA
      mode is not supported on P8 we don't need this, since the only
      anticipated user of this API requires CAPP DMA mode.
      
      Cc: Philippe Bergheaud <felix@linux.vnet.ibm.com>
      Signed-off-by: NIan Munsie <imunsie@au1.ibm.com>
      Reviewed-by: NAndrew Donnellan <andrew.donnellan@au1.ibm.com>
      Reviewed-by: NFrederic Barrat <fbarrat@linux.vnet.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      4e56f858
  4. 28 6月, 2016 2 次提交
    • M
      cxl: Add set and get private data to context struct · ad42de85
      Michael Neuling 提交于
      This provides AFU drivers a means to associate private data with a cxl
      context. This is particularly intended for make the new callbacks for
      driver specific events easier for AFU drivers to use, as they can easily
      get back to any private data structures they may use.
      Signed-off-by: NMichael Neuling <mikey@neuling.org>
      Signed-off-by: NIan Munsie <imunsie@au1.ibm.com>
      Signed-off-by: Philippe Bergheaud <felix@linux.vnet.ibm.com
      Reviewed-by: NMatthew R. Ochs <mrochs@linux.vnet.ibm.com>
      Reviewed-by: NAndrew Donnellan <andrew.donnellan@au1.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      ad42de85
    • P
      cxl: Add mechanism for delivering AFU driver specific events · b810253b
      Philippe Bergheaud 提交于
      This adds an afu_driver_ops structure with fetch_event() and
      event_delivered() callbacks. An AFU driver such as cxlflash can fill
      this out and associate it with a context to enable passing custom AFU
      specific events to userspace.
      
      This also adds a new kernel API function cxl_context_pending_events(),
      that the AFU driver can use to notify the cxl driver that new specific
      events are ready to be delivered, and wake up anyone waiting on the
      context wait queue.
      
      The current count of AFU driver specific events is stored in the field
      afu_driver_events of the context structure.
      
      The cxl driver checks the afu_driver_events count during poll, select,
      read, etc. calls to check if an AFU driver specific event is pending,
      and calls fetch_event() to obtain and deliver that event. This way, the
      cxl driver takes care of all the usual locking semantics around these
      calls and handles all the generic cxl events, so that the AFU driver
      only needs to worry about it's own events.
      
      fetch_event() return a struct cxl_event_afu_driver_reserved, allocated
      by the AFU driver, and filled in with the specific event information and
      size. Total event size (header + data) should not be greater than
      CXL_READ_MIN_SIZE (4K).
      
      Th cxl driver prepends an appropriate cxl event header, copies the event
      to userspace, and finally calls event_delivered() to return the status of
      the operation to the AFU driver. The event is identified by the context
      and cxl_event_afu_driver_reserved pointers.
      
      Since AFU drivers provide their own means for userspace to obtain the
      AFU file descriptor (i.e. cxlflash uses an ioctl on their scsi file
      descriptor to obtain the AFU file descriptor) and the generic cxl driver
      will never use this event, the ABI of the event is up to each individual
      AFU driver.
      Signed-off-by: NPhilippe Bergheaud <felix@linux.vnet.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      b810253b
  5. 11 5月, 2016 1 次提交
    • I
      cxl: Add kernel API to allow a context to operate with relocate disabled · 7a0d85d3
      Ian Munsie 提交于
      cxl devices typically access memory using an MMU in much the same way as
      the CPU, and each context includes a state register much like the MSR in
      the CPU. Like the CPU, the state register includes a bit to enable
      relocation, which we currently always enable.
      
      In some cases, it may be desirable to allow a device to access memory
      using real addresses instead of effective addresses, so this adds a new
      API, cxl_set_translation_mode, that can be used to disable relocation
      on a given kernel context. This can allow for the creation of a special
      privileged context that the device can use if it needs relocation
      disabled, and can use regular contexts at times when it needs relocation
      enabled.
      
      This interface is only available to users of the kernel API for obvious
      reasons, and will never be supported in a virtualised environment.
      
      This will be used by the upcoming cxl support in the mlx5 driver.
      Signed-off-by: NIan Munsie <imunsie@au1.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      7a0d85d3
  6. 09 3月, 2016 2 次提交
  7. 14 8月, 2015 1 次提交
  8. 03 6月, 2015 2 次提交
    • M
      cxl: Add AFU virtual PHB and kernel API · 6f7f0b3d
      Michael Neuling 提交于
      This patch does two things.
      
      Firstly it presents the Accelerator Function Unit (AFUs) behind the POWER
      Service Layer (PSL) as PCI devices on a virtual PCI Host Bridge (vPHB).  This
      in in addition to the PSL being a PCI device itself.
      
      As part of the Coherent Accelerator Interface Architecture (CAIA) AFUs can
      provide an AFU configuration.  This AFU configuration recored is architected to
      be the same as a PCI config space.
      
      This patch sets discovers the AFU configuration records, provides AFU config
      space read/write functions to these configuration records.  It then enumerates
      the PCI bus.  It also hooks in PCI ops where appropriate.  It also destroys the
      vPHB when the physical card is removed.
      
      Secondly, it add an in kernel API for AFU to use CXL.  AFUs must present a
      driver that firstly binds as a PCI device.  This PCI device can then be using
      to do CXL specific operations (that can't sit in the PCI ops) using this API.
      Signed-off-by: NMichael Neuling <mikey@neuling.org>
      Acked-by: NIan Munsie <imunsie@au1.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      6f7f0b3d
    • M
      cxl: Move include file cxl.h -> cxl-base.h · ec249dd8
      Michael Neuling 提交于
      This moves the current include file from cxl.h -> cxl-base.h.  This current
      include file is used only to pass information between the base driver that
      needs to be built into the kernel and the cxl module.
      
      This is to make way for a new include/misc/cxl.h which will
      contain just the kernel API for other driver to use
      Signed-off-by: NMichael Neuling <mikey@neuling.org>
      Acked-by: NIan Munsie <imunsie@au1.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      ec249dd8
  9. 08 10月, 2014 1 次提交
    • I
      cxl: Add new header for call backs and structs · 1cd258d7
      Ian Munsie 提交于
      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: NIan Munsie <imunsie@au1.ibm.com>
      Signed-off-by: NMichael Neuling <mikey@neuling.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      1cd258d7