1. 14 Jul, 2016 23 commits
  2. 13 Jul, 2016 6 commits
  3. 11 Jul, 2016 3 commits
  4. 08 Jul, 2016 8 commits
    • Philippe Bergheaud's avatar
      cxl: Ignore CAPI adapters misplaced in switched slots · 3b3dcd61
      Philippe Bergheaud authored
      One should not attempt to switch a PHB into CAPI mode if there is
      a switch between the PHB and the adapter. This patch modifies the
      cxl driver to ignore CAPI adapters misplaced in switched slots.
      Signed-off-by: default avatarPhilippe Bergheaud <felix@linux.vnet.ibm.com>
      Reviewed-by: default avatarFrederic Barrat <fbarrat@linux.vnet.ibm.com>
      Acked-by: default avatarIan Munsie <imunsie@au1.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      3b3dcd61
    • Paul Gortmaker's avatar
      cxl: make base more explicitly non-modular · e00878be
      Paul Gortmaker authored
      The Kconfig/Makefile currently controlling compilation of this code is:
      
      drivers/misc/cxl/Kconfig:config CXL_BASE
      drivers/misc/cxl/Kconfig:       bool
      
      drivers/misc/cxl/Makefile:obj-$(CONFIG_CXL_BASE)          += base.o
      
      ...meaning that it currently is not being built as a module by anyone.
      
      Lets convert the one module_init into device_initcall so that
      when reading the driver it more clear that it is builtin-only.
      
      Since module_init translates to device_initcall in the non-modular
      case, the init ordering remains unchanged with this commit.
      
      We don't replace module.h with init.h since the file is doing
      other modular stuff (module_get/put) even though it is built-in.
      
      Cc: Ian Munsie <imunsie@au1.ibm.com>
      Cc: Michael Neuling <mikey@neuling.org>
      Cc: linuxppc-dev@lists.ozlabs.org
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      Acked-by: default avatarIan Munsie <imunsie@au1.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      e00878be
    • Philippe Bergheaud's avatar
      cxl: Refine slice error debug messages · 6e0c50f9
      Philippe Bergheaud authored
      The PSL Slice Error Register (PSL_SERR_An) reports implementation
      dependent AFU errors, in the form of a bitmap. The PSL_SERR_An
      register content is printed in the form of hex dump debug message.
      
      This patch decodes the PSL_ERR_An register contents, and prints a
      specific error message for each possible error bit. It also dumps
      the secondary registers AFU_ERR_An and PSL_DSISR_An, that may
      contain extra debug information.
      
      This patch also removes the large WARN message that used to report
      the cxl slice error interrupt, and replaces it by a short informative
      message, that draws attention to AFU implementation errors.
      Signed-off-by: default avatarPhilippe Bergheaud <felix@linux.vnet.ibm.com>
      Acked-by: default avatarIan Munsie <imunsie@au1.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      6e0c50f9
    • Ian Munsie's avatar
      cxl: Fix NULL pointer dereference on kernel contexts with no AFU interrupts · f5c9df9a
      Ian Munsie authored
      If a kernel context is initialised and does not have any AFU interrupts
      allocated it will cause a NULL pointer dereference when the context is
      detached since the irq_names list will not have been initialised.
      
      Move the initialisation of the irq_names list into the cxl_context_init
      routine so that it will be valid for the entire lifetime of the context
      and will not cause a NULL pointer dereference.
      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>
      f5c9df9a
    • Ian Munsie's avatar
      cxl: Workaround XSL bug that does not clear the RA bit after a reset · 2a4f667a
      Ian Munsie authored
      An issue was noted in our debug logs where the XSL would leave the RA
      bit asserted after an AFU reset operation, which would effectively
      prevent further AFU reset operations from working.
      
      Workaround the issue by clearing the RA bit with an MMIO write if it is
      still asserted after any AFU control operation.
      Signed-off-by: default avatarIan Munsie <imunsie@au1.ibm.com>
      Reviewed-by: default avatarFrederic Barrat <fbarrat@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      2a4f667a
    • Ian Munsie's avatar
      cxl: Fix bug where AFU disable operation had no effect · 5e7823c9
      Ian Munsie authored
      The AFU disable operation has a bug where it will not clear the enable
      bit and therefore will have no effect. To date this has likely been
      masked by fact that we perform an AFU reset before the disable, which
      also has the effect of clearing the enable bit, making the following
      disable operation effectively a noop on most hardware. This patch
      modifies the afu_control function to take a parameter to clear from the
      AFU control register so that the disable operation can clear the
      appropriate bit.
      
      This bug was uncovered on the Mellanox CX4, which uses an XSL rather
      than a PSL. On the XSL the reset operation will not complete while the
      AFU is enabled, meaning the enable bit was still set at the start of the
      disable and as a result this bug was hit and the disable also timed out.
      
      Because of this difference in behaviour between the PSL and XSL, this
      patch now makes the reset dependent on the card using a PSL to avoid
      waiting for a timeout on the XSL. It is entirely possible that we may be
      able to drop the reset altogether if it turns out we only ever needed it
      due to this bug - however I am not willing to drop it without further
      regression testing and have added comments to the code explaining the
      background.
      
      This also fixes a small issue where the AFU_Cntl register was read
      outside of the lock that protects it.
      Signed-off-by: default avatarIan Munsie <imunsie@au1.ibm.com>
      Reviewed-by: default avatarFrederic Barrat <fbarrat@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      5e7823c9
    • Ian Munsie's avatar
      cxl: Fix allocating a minimum of 2 pages for the SPA · 2224b671
      Ian Munsie authored
      The Scheduled Process Area is allocated dynamically with enough pages to
      fit at least as many processes as the AFU descriptor indicated. Since
      the calculation is non-trivial, it does this by calculating how many
      processes could fit in an allocation of a given order, and increasing
      that order until it can fit enough processes or hits the maximum
      supported size.
      
      Currently, it will start this search using a SPA of 2 pages instead of
      1. This can waste a page of memory if the AFU's maximum number of
      supported processes was small enough to fit in one page.
      
      Fix the algorithm to start the search at 1 page.
      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>
      2224b671
    • Ian Munsie's avatar
      cxl: Fix allowing bogus AFU descriptors with 0 maximum processes · 49e9c99f
      Ian Munsie authored
      If the AFU descriptor of an AFU directed AFU indicates that it supports
      0 maximum processes, we will accept that value and attempt to use it.
      The SPA will still be allocated (with 2 pages due to another minor bug
      and room for 958 processes), and when a context is allocated we will
      pass the value of 0 to idr_alloc as the maximum. However, idr_alloc will
      treat that as meaning no maximum and will allocate a context number and
      we return a valid context.
      
      Conceivably, this could lead to a buffer overflow of the SPA if more
      than 958 contexts were allocated, however this is mitigated by the fact
      that there are no known AFUs in the wild with a bogus AFU descriptor
      like this, and that only the root user is allowed to flash an AFU image
      to a card.
      
      Add a check when validating the AFU descriptor to reject any with 0
      maximum processes.
      
      We do still allow a dedicated process only AFU to indicate that it
      supports 0 contexts even though that is forbidden in the architecture,
      as in that case we ignore the value and use 1 instead. This is just on
      the off-chance that such a dedicated process AFU may exist (not that I
      am aware of any), since their developers are less likely to have cared
      about this value at all.
      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>
      49e9c99f