24 Aug, 2020

1 commit

  • Existing users of ocxl_link_irq_alloc() have been converted to obtain
    the trigger page of an interrupt through xive directly, we therefore
    have no need to return the trigger page when allocating an interrupt.

    It also allows ocxl to use the xive native interface to allocate
    interrupts, instead of its custom service.

    Signed-off-by: Frederic Barrat
    Reviewed-by: Cédric Le Goater
    Reviewed-by: Greg Kurz
    Acked-by: Andrew Donnellan
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20200403153838.29224-4-fbarrat@linux.ibm.com

    Frederic Barrat
     

29 Jul, 2020

2 commits

  • This patch addresses warnings and errors from the kernel doc scripts for
    the OpenCAPI driver.

    It also makes minor tweaks to make the docs more consistent.

    Signed-off-by: Alastair D'Silva
    Acked-by: Andrew Donnellan
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20200415012343.919255-3-alastair@d-silva.org

    Alastair D'Silva
     
  • Function declarations don't need externs, remove the existing ones
    so they are consistent with newer code

    Signed-off-by: Alastair D'Silva
    Acked-by: Andrew Donnellan
    Acked-by: Frederic Barrat
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20200415012343.919255-2-alastair@d-silva.org

    Alastair D'Silva
     

15 Jul, 2020

1 commit

  • Some opencapi FPGA images allow to control if the FPGA should be reloaded
    on the next adapter reset. If it is supported, the image specifies it
    through a Vendor Specific DVSEC in the config space of function 0.

    Signed-off-by: Philippe Bergheaud
    Signed-off-by: Frederic Barrat
    Reviewed-by: Andrew Donnellan
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20200619140439.153962-1-fbarrat@linux.ibm.com

    Philippe Bergheaud
     

09 Aug, 2019

1 commit


14 Jul, 2019

1 commit

  • Pull powerpc updates from Michael Ellerman:
    "Notable changes:

    - Removal of the NPU DMA code, used by the out-of-tree Nvidia driver,
    as well as some other functions only used by drivers that haven't
    (yet?) made it upstream.

    - A fix for a bug in our handling of hardware watchpoints (eg. perf
    record -e mem: ...) which could lead to register corruption and
    kernel crashes.

    - Enable HAVE_ARCH_HUGE_VMAP, which allows us to use large pages for
    vmalloc when using the Radix MMU.

    - A large but incremental rewrite of our exception handling code to
    use gas macros rather than multiple levels of nested CPP macros.

    And the usual small fixes, cleanups and improvements.

    Thanks to: Alastair D'Silva, Alexey Kardashevskiy, Andreas Schwab,
    Aneesh Kumar K.V, Anju T Sudhakar, Anton Blanchard, Arnd Bergmann,
    Athira Rajeev, Cédric Le Goater, Christian Lamparter, Christophe
    Leroy, Christophe Lombard, Christoph Hellwig, Daniel Axtens, Denis
    Efremov, Enrico Weigelt, Frederic Barrat, Gautham R. Shenoy, Geert
    Uytterhoeven, Geliang Tang, Gen Zhang, Greg Kroah-Hartman, Greg Kurz,
    Gustavo Romero, Krzysztof Kozlowski, Madhavan Srinivasan, Masahiro
    Yamada, Mathieu Malaterre, Michael Neuling, Nathan Lynch, Naveen N.
    Rao, Nicholas Piggin, Nishad Kamdar, Oliver O'Halloran, Qian Cai, Ravi
    Bangoria, Sachin Sant, Sam Bobroff, Satheesh Rajendran, Segher
    Boessenkool, Shaokun Zhang, Shawn Anastasio, Stewart Smith, Suraj
    Jitindar Singh, Thiago Jung Bauermann, YueHaibing"

    * tag 'powerpc-5.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (163 commits)
    powerpc/powernv/idle: Fix restore of SPRN_LDBAR for POWER9 stop state.
    powerpc/eeh: Handle hugepages in ioremap space
    ocxl: Update for AFU descriptor template version 1.1
    powerpc/boot: pass CONFIG options in a simpler and more robust way
    powerpc/boot: add {get, put}_unaligned_be32 to xz_config.h
    powerpc/irq: Don't WARN continuously in arch_local_irq_restore()
    powerpc/module64: Use symbolic instructions names.
    powerpc/module32: Use symbolic instructions names.
    powerpc: Move PPC_HA() PPC_HI() and PPC_LO() to ppc-opcode.h
    powerpc/module64: Fix comment in R_PPC64_ENTRY handling
    powerpc/boot: Add lzo support for uImage
    powerpc/boot: Add lzma support for uImage
    powerpc/boot: don't force gzipped uImage
    powerpc/8xx: Add microcode patch to move SMC parameter RAM.
    powerpc/8xx: Use IO accessors in microcode programming.
    powerpc/8xx: replace #ifdefs by IS_ENABLED() in microcode.c
    powerpc/8xx: refactor programming of microcode CPM params.
    powerpc/8xx: refactor printing of microcode patch name.
    powerpc/8xx: Refactor microcode write
    powerpc/8xx: refactor writing of CPM microcode arrays
    ...

    Linus Torvalds
     

10 Jul, 2019

1 commit

  • The OpenCAPI discovery and configuration specification has been
    updated and introduces version 1.1 of the AFU descriptor template,
    with new fields to better define the memory layout of an OpenCAPI
    adapter.

    The ocxl driver doesn't do much yet to support LPC memory but as we
    start seeing (non-LPC) AFU images using the new template, this patch
    updates the config space parsing code to avoid spitting a warning.

    Signed-off-by: Alastair D'Silva
    Signed-off-by: Frederic Barrat
    Reviewed-by: Christophe Lombard
    Acked-by: Andrew Donnellan
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20190605111545.19762-1-fbarrat@linux.ibm.com

    Alastair D'Silva
     

31 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation either version 2 of the license or at
    your option any later version

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-or-later

    has been chosen to replace the boilerplate/reference in 3029 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190527070032.746973796@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

24 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation either version 2 of the license or at
    your option any later version this program is distributed in the
    hope that it will be useful but without any warranty without even
    the implied warranty of merchantability or fitness for a particular
    purpose see the gnu general public license for more details you
    should have received a copy of the gnu general public license along
    with this program if not write to the free software foundation inc
    675 mass ave cambridge ma 02139 usa

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-or-later

    has been chosen to replace the boilerplate/reference in 441 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Michael Ellerman (powerpc)
    Reviewed-by: Richard Fontana
    Reviewed-by: Allison Randal
    Reviewed-by: Kate Stewart
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190520071858.739733335@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

03 May, 2019

6 commits


17 Mar, 2019

1 commit


02 Jul, 2018

6 commits


03 Jun, 2018

1 commit


03 Feb, 2018

1 commit

  • Pull powerpc updates from Michael Ellerman:
    "Highlights:

    - Enable support for memory protection keys aka "pkeys" on Power7/8/9
    when using the hash table MMU.

    - Extend our interrupt soft masking to support masking PMU interrupts
    as well as "normal" interrupts, and then use that to implement
    local_t for a ~4x speedup vs the current atomics-based
    implementation.

    - A new driver "ocxl" for "Open Coherent Accelerator Processor
    Interface (OpenCAPI)" devices.

    - Support for new device tree properties on PowerVM to describe
    hotpluggable memory and devices.

    - Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE to the 64-bit
    VDSO.

    - Freescale updates from Scott: fixes for CPM GPIO and an FSL PCI
    erratum workaround, plus a minor cleanup patch.

    As well as quite a lot of other changes all over the place, and small
    fixes and cleanups as always.

    Thanks to: Alan Modra, Alastair D'Silva, Alexey Kardashevskiy,
    Alistair Popple, Andreas Schwab, Andrew Donnellan, Aneesh Kumar K.V,
    Anju T Sudhakar, Anshuman Khandual, Anton Blanchard, Arnd Bergmann,
    Balbir Singh, Benjamin Herrenschmidt, Bhaktipriya Shridhar, Bryant G.
    Ly, Cédric Le Goater, Christophe Leroy, Christophe Lombard, Cyril Bur,
    David Gibson, Desnes A. Nunes do Rosario, Dmitry Torokhov, Frederic
    Barrat, Geert Uytterhoeven, Guilherme G. Piccoli, Gustavo A. R. Silva,
    Gustavo Romero, Ivan Mikhaylov, Joakim Tjernlund, Joe Perches, Josh
    Poimboeuf, Juan J. Alvarez, Julia Cartwright, Kamalesh Babulal,
    Madhavan Srinivasan, Mahesh Salgaonkar, Mathieu Malaterre, Michael
    Bringmann, Michael Hanselmann, Michael Neuling, Nathan Fontenot,
    Naveen N. Rao, Nicholas Piggin, Paul Mackerras, Philippe Bergheaud,
    Ram Pai, Russell Currey, Santosh Sivaraj, Scott Wood, Seth Forshee,
    Simon Guo, Stewart Smith, Sukadev Bhattiprolu, Thiago Jung Bauermann,
    Vaibhav Jain, Vasyl Gomonovych"

    * tag 'powerpc-4.16-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (199 commits)
    powerpc/mm/radix: Fix build error when RADIX_MMU=n
    macintosh/ams-input: Use true and false for boolean values
    macintosh: change some data types from int to bool
    powerpc/watchdog: Print the NIP in soft_nmi_interrupt()
    powerpc/watchdog: regs can't be null in soft_nmi_interrupt()
    powerpc/watchdog: Tweak watchdog printks
    powerpc/cell: Remove axonram driver
    rtc-opal: Fix handling of firmware error codes, prevent busy loops
    powerpc/mpc52xx_gpt: make use of raw_spinlock variants
    macintosh/adb: Properly mark continued kernel messages
    powerpc/pseries: Fix cpu hotplug crash with memoryless nodes
    powerpc/numa: Ensure nodes initialized for hotplug
    powerpc/numa: Use ibm,max-associativity-domains to discover possible nodes
    powerpc/kernel: Block interrupts when updating TIDR
    powerpc/powernv/idoa: Remove unnecessary pcidev from pci_dn
    powerpc/mm/nohash: do not flush the entire mm when range is a single page
    powerpc/pseries: Add Initialization of VF Bars
    powerpc/pseries/pci: Associate PEs to VFs in configure SR-IOV
    powerpc/eeh: Add EEH notify resume sysfs
    powerpc/eeh: Add EEH operations to notify resume
    ...

    Linus Torvalds
     

24 Jan, 2018

2 commits

  • Some of the functions done by the generic driver should also be needed
    by other opencapi drivers: attaching a context to an adapter,
    translation fault handling, AFU interrupt allocation...

    So to avoid code duplication, the driver provides a kernel API that
    other drivers can use, similar to calling a in-kernel library.

    It is still a bit theoretical, for lack of real hardware, and will
    likely need adjustements down the road. But we used the cxlflash
    driver as a guinea pig.

    Signed-off-by: Frederic Barrat
    Signed-off-by: Michael Ellerman

    Frederic Barrat
     
  • In the opencapi protocol, host memory contexts are referenced by a
    'actag'. During setup, a driver must tell the device how many actags
    it can used, and what values are acceptable.

    On POWER9, the NPU can handle 64 actags per link, so they must be
    shared between all the PCI functions of the link. To get a global
    picture of how many actags are used by each AFU of every function, we
    capture some data at the end of PCI enumeration, so that actags can be
    shared fairly if needed.

    This is not powernv specific per say, but rather a consequence of the
    opencapi configuration specification being quite general. The number
    of available actags on POWER9 makes it more likely to be hit. This is
    somewhat mitigated by the fact that existing AFUs are coded by
    requesting a reasonable count of actags and existing devices carry
    only one AFU.

    Signed-off-by: Frederic Barrat
    Signed-off-by: Michael Ellerman

    Frederic Barrat
     

29 Nov, 2017

1 commit


03 Jul, 2017

1 commit

  • This patch exports a in-kernel 'library' API which can be called by
    other drivers to help interacting with an IBM XSL on a POWER9 system.

    The XSL (Translation Service Layer) is a stripped down version of the
    PSL (Power Service Layer) used in some cards such as the Mellanox CX5.
    Like the PSL, it implements the CAIA architecture, but has a number
    of differences, mostly in it's implementation dependent registers.

    The XSL also uses a special DMA cxl mode, which uses a slightly
    different init sequence for the CAPP and PHB.

    Signed-off-by: Andrew Donnellan
    Signed-off-by: Christophe Lombard
    Acked-by: Frederic Barrat
    Signed-off-by: Michael Ellerman

    Christophe Lombard
     

17 Mar, 2017

2 commits

  • In 4-bit mode, 8-bit commands and data are written using two raw writes
    to the data interface: high nibble first, low nibble last. This must be
    handled by the low-level driver.

    However, as we don't know in which mode (4-bit or 8-bit) nor 4-bit phase
    the LCD was left, initialization must always be handled using raw
    writes, and needs to configure the LCD for 8-bit mode first.

    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Greg Kroah-Hartman

    Geert Uytterhoeven
     
  • Extract the character LCD core from the Parallel port LCD/Keypad Panel
    driver in the misc subsystem, and convert it into a subdriver in the
    auxdisplay subsystem. This allows the character LCD core to be used by
    other drivers later.

    Compilation is controlled by its own Kconfig symbol CHARLCD, which is to
    be selected by its users, but can be enabled manually for
    compile-testing.

    All functions changed their prefix from "lcd_" to "charlcd_", and gained
    a "struct charlcd *" parameter to operate on a specific instance.
    While the driver API thus is ready to support multiple instances, the
    current limitation of a single display (/dev/lcd has a single misc minor
    assigned) is retained.

    No functional changes intended.

    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Greg Kroah-Hartman

    Geert Uytterhoeven
     

14 Jul, 2016

7 commits

  • 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: Ian Munsie
    Cc: Gavin Shan
    Signed-off-by: Andrew Donnellan
    Signed-off-by: Ian Munsie
    Reviewed-by: Gavin Shan
    Signed-off-by: Michael Ellerman

    Andrew Donnellan
     
  • 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: Ian Munsie
    Reviewed-by: Andrew Donnellan
    Signed-off-by: Michael Ellerman

    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: Ian Munsie
    Reviewed-by: Frederic Barrat
    Reviewed-by: Andrew Donnellan
    Signed-off-by: Michael Ellerman

    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: Ian Munsie
    Reviewed-by: Frederic Barrat
    Reviewed-by: Andrew Donnellan
    Signed-off-by: Michael Ellerman

    Ian Munsie
     
  • 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: Ian Munsie
    Reviewed-by: Frederic Barrat
    Reviewed-by: Andrew Donnellan
    Signed-off-by: Michael Ellerman

    Ian Munsie
     
  • 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: Ian Munsie
    Reviewed-by: Andrew Donnellan
    Reviewed-by: Frederic Barrat
    Signed-off-by: Michael Ellerman

    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
    Signed-off-by: Ian Munsie
    Reviewed-by: Andrew Donnellan
    Reviewed-by: Frederic Barrat
    Signed-off-by: Michael Ellerman

    Ian Munsie
     

28 Jun, 2016

2 commits

  • 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: Michael Neuling
    Signed-off-by: Ian Munsie
    Signed-off-by: Philippe Bergheaud
    Reviewed-by: Andrew Donnellan
    Signed-off-by: Michael Ellerman

    Michael Neuling
     
  • 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: Philippe Bergheaud
    Signed-off-by: Michael Ellerman

    Philippe Bergheaud
     

11 May, 2016

1 commit

  • 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: Ian Munsie
    Signed-off-by: Michael Ellerman

    Ian Munsie