Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) ====================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) Coherent Accelerator Interface (CXL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) ====================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) Introduction
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) ============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)     The coherent accelerator interface is designed to allow the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)     coherent connection of accelerators (FPGAs and other devices) to a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)     POWER system. These devices need to adhere to the Coherent
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)     Accelerator Interface Architecture (CAIA).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)     IBM refers to this as the Coherent Accelerator Processor Interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)     or CAPI. In the kernel it's referred to by the name CXL to avoid
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)     confusion with the ISDN CAPI subsystem.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)     Coherent in this context means that the accelerator and CPUs can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)     both access system memory directly and with the same effective
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)     addresses.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) Hardware overview
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) =================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)     ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)          POWER8/9             FPGA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)        +----------+        +---------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)        |          |        |         |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)        |   CPU    |        |   AFU   |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)        |          |        |         |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)        |          |        |         |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)        |          |        |         |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34)        +----------+        +---------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)        |   PHB    |        |         |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36)        |   +------+        |   PSL   |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37)        |   | CAPP |<------>|         |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38)        +---+------+  PCIE  +---------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)     The POWER8/9 chip has a Coherently Attached Processor Proxy (CAPP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41)     unit which is part of the PCIe Host Bridge (PHB). This is managed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42)     by Linux by calls into OPAL. Linux doesn't directly program the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43)     CAPP.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45)     The FPGA (or coherently attached device) consists of two parts.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46)     The POWER Service Layer (PSL) and the Accelerator Function Unit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47)     (AFU). The AFU is used to implement specific functionality behind
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48)     the PSL. The PSL, among other things, provides memory address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49)     translation services to allow each AFU direct access to userspace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50)     memory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52)     The AFU is the core part of the accelerator (eg. the compression,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53)     crypto etc function). The kernel has no knowledge of the function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54)     of the AFU. Only userspace interacts directly with the AFU.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56)     The PSL provides the translation and interrupt services that the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57)     AFU needs. This is what the kernel interacts with. For example, if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58)     the AFU needs to read a particular effective address, it sends
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59)     that address to the PSL, the PSL then translates it, fetches the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60)     data from memory and returns it to the AFU. If the PSL has a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61)     translation miss, it interrupts the kernel and the kernel services
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62)     the fault. The context to which this fault is serviced is based on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63)     who owns that acceleration function.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65)     - POWER8 and PSL Version 8 are compliant to the CAIA Version 1.0.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66)     - POWER9 and PSL Version 9 are compliant to the CAIA Version 2.0.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68)     This PSL Version 9 provides new features such as:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70)     * Interaction with the nest MMU on the P9 chip.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71)     * Native DMA support.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72)     * Supports sending ASB_Notify messages for host thread wakeup.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73)     * Supports Atomic operations.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74)     * etc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76)     Cards with a PSL9 won't work on a POWER8 system and cards with a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77)     PSL8 won't work on a POWER9 system.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) AFU Modes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) =========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82)     There are two programming modes supported by the AFU. Dedicated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83)     and AFU directed. AFU may support one or both modes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85)     When using dedicated mode only one MMU context is supported. In
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86)     this mode, only one userspace process can use the accelerator at
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87)     time.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89)     When using AFU directed mode, up to 16K simultaneous contexts can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90)     be supported. This means up to 16K simultaneous userspace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91)     applications may use the accelerator (although specific AFUs may
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92)     support fewer). In this mode, the AFU sends a 16 bit context ID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93)     with each of its requests. This tells the PSL which context is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94)     associated with each operation. If the PSL can't translate an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95)     operation, the ID can also be accessed by the kernel so it can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96)     determine the userspace context associated with an operation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) MMIO space
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) ==========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)     A portion of the accelerator MMIO space can be directly mapped
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)     from the AFU to userspace. Either the whole space can be mapped or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)     just a per context portion. The hardware is self describing, hence
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)     the kernel can determine the offset and size of the per context
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)     portion.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) Interrupts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) ==========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)     AFUs may generate interrupts that are destined for userspace. These
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)     are received by the kernel as hardware interrupts and passed onto
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)     userspace by a read syscall documented below.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)     Data storage faults and error interrupts are handled by the kernel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)     driver.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) Work Element Descriptor (WED)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) =============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)     The WED is a 64-bit parameter passed to the AFU when a context is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)     started. Its format is up to the AFU hence the kernel has no
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)     knowledge of what it represents. Typically it will be the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)     effective address of a work queue or status block where the AFU
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)     and userspace can share control and status information.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) User API
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) ========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 1. AFU character devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) ^^^^^^^^^^^^^^^^^^^^^^^^
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)     For AFUs operating in AFU directed mode, two character device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)     files will be created. /dev/cxl/afu0.0m will correspond to a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)     master context and /dev/cxl/afu0.0s will correspond to a slave
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)     context. Master contexts have access to the full MMIO space an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)     AFU provides. Slave contexts have access to only the per process
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143)     MMIO space an AFU provides.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)     For AFUs operating in dedicated process mode, the driver will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)     only create a single character device per AFU called
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)     /dev/cxl/afu0.0d. This will have access to the entire MMIO space
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)     that the AFU provides (like master contexts in AFU directed).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)     The types described below are defined in include/uapi/misc/cxl.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152)     The following file operations are supported on both slave and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153)     master devices.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155)     A userspace library libcxl is available here:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	https://github.com/ibm-capi/libcxl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)     This provides a C interface to this kernel API.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) open
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) ----
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)     Opens the device and allocates a file descriptor to be used with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)     the rest of the API.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)     A dedicated mode AFU only has one context and only allows the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)     device to be opened once.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)     An AFU directed mode AFU can have many contexts, the device can be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)     opened once for each context that is available.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)     When all available contexts are allocated the open call will fail
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)     and return -ENOSPC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)     Note:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	  IRQs need to be allocated for each context, which may limit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178)           the number of contexts that can be created, and therefore
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179)           how many times the device can be opened. The POWER8 CAPP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)           supports 2040 IRQs and 3 are used by the kernel, so 2037 are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)           left. If 1 IRQ is needed per context, then only 2037
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)           contexts can be allocated. If 4 IRQs are needed per context,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)           then only 2037/4 = 509 contexts can be allocated.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) ioctl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) -----
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)     CXL_IOCTL_START_WORK:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)         Starts the AFU context and associates it with the current
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191)         process. Once this ioctl is successfully executed, all memory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)         mapped into this process is accessible to this AFU context
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)         using the same effective addresses. No additional calls are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)         required to map/unmap memory. The AFU memory context will be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195)         updated as userspace allocates and frees memory. This ioctl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)         returns once the AFU context is started.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)         Takes a pointer to a struct cxl_ioctl_start_work
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)             ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)                 struct cxl_ioctl_start_work {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)                         __u64 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)                         __u64 work_element_descriptor;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)                         __u64 amr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)                         __s16 num_interrupts;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)                         __s16 reserved1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208)                         __s32 reserved2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)                         __u64 reserved3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)                         __u64 reserved4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)                         __u64 reserved5;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)                         __u64 reserved6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213)                 };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215)             flags:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)                 Indicates which optional fields in the structure are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)                 valid.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219)             work_element_descriptor:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220)                 The Work Element Descriptor (WED) is a 64-bit argument
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)                 defined by the AFU. Typically this is an effective
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222)                 address pointing to an AFU specific structure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223)                 describing what work to perform.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)             amr:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)                 Authority Mask Register (AMR), same as the powerpc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)                 AMR. This field is only used by the kernel when the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228)                 corresponding CXL_START_WORK_AMR value is specified in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229)                 flags. If not specified the kernel will use a default
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230)                 value of 0.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)             num_interrupts:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)                 Number of userspace interrupts to request. This field
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234)                 is only used by the kernel when the corresponding
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235)                 CXL_START_WORK_NUM_IRQS value is specified in flags.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236)                 If not specified the minimum number required by the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237)                 AFU will be allocated. The min and max number can be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238)                 obtained from sysfs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240)             reserved fields:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)                 For ABI padding and future extensions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)     CXL_IOCTL_GET_PROCESS_ELEMENT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244)         Get the current context id, also known as the process element.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245)         The value is returned from the kernel as a __u32.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) mmap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) ----
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251)     An AFU may have an MMIO space to facilitate communication with the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252)     AFU. If it does, the MMIO space can be accessed via mmap. The size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253)     and contents of this area are specific to the particular AFU. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254)     size can be discovered via sysfs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256)     In AFU directed mode, master contexts are allowed to map all of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257)     the MMIO space and slave contexts are allowed to only map the per
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258)     process MMIO space associated with the context. In dedicated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259)     process mode the entire MMIO space can always be mapped.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261)     This mmap call must be done after the START_WORK ioctl.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263)     Care should be taken when accessing MMIO space. Only 32 and 64-bit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264)     accesses are supported by POWER8. Also, the AFU will be designed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265)     with a specific endianness, so all MMIO accesses should consider
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266)     endianness (recommend endian(3) variants like: le64toh(),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267)     be64toh() etc). These endian issues equally apply to shared memory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268)     queues the WED may describe.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) read
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) ----
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274)     Reads events from the AFU. Blocks if no events are pending
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275)     (unless O_NONBLOCK is supplied). Returns -EIO in the case of an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276)     unrecoverable error or if the card is removed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278)     read() will always return an integral number of events.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280)     The buffer passed to read() must be at least 4K bytes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282)     The result of the read will be a buffer of one or more events,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283)     each event is of type struct cxl_event, of varying size::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285)             struct cxl_event {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286)                     struct cxl_event_header header;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287)                     union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288)                             struct cxl_event_afu_interrupt irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289)                             struct cxl_event_data_storage fault;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290)                             struct cxl_event_afu_error afu_error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291)                     };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292)             };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294)     The struct cxl_event_header is defined as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296)         ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298)             struct cxl_event_header {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299)                     __u16 type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300)                     __u16 size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301)                     __u16 process_element;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302)                     __u16 reserved1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303)             };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305)         type:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306)             This defines the type of event. The type determines how
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307)             the rest of the event is structured. These types are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308)             described below and defined by enum cxl_event_type.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310)         size:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311)             This is the size of the event in bytes including the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312)             struct cxl_event_header. The start of the next event can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313)             be found at this offset from the start of the current
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314)             event.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316)         process_element:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317)             Context ID of the event.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319)         reserved field:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320)             For future extensions and padding.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322)     If the event type is CXL_EVENT_AFU_INTERRUPT then the event
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323)     structure is defined as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325)         ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327)             struct cxl_event_afu_interrupt {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328)                     __u16 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329)                     __u16 irq; /* Raised AFU interrupt number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330)                     __u32 reserved1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331)             };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333)         flags:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334)             These flags indicate which optional fields are present
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335)             in this struct. Currently all fields are mandatory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337)         irq:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338)             The IRQ number sent by the AFU.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340)         reserved field:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341)             For future extensions and padding.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343)     If the event type is CXL_EVENT_DATA_STORAGE then the event
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344)     structure is defined as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346)         ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348)             struct cxl_event_data_storage {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349)                     __u16 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350)                     __u16 reserved1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351)                     __u32 reserved2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352)                     __u64 addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353)                     __u64 dsisr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354)                     __u64 reserved3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355)             };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357)         flags:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358)             These flags indicate which optional fields are present in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359)             this struct. Currently all fields are mandatory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361)         address:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362)             The address that the AFU unsuccessfully attempted to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363)             access. Valid accesses will be handled transparently by the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364)             kernel but invalid accesses will generate this event.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366)         dsisr:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367)             This field gives information on the type of fault. It is a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368)             copy of the DSISR from the PSL hardware when the address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369)             fault occurred. The form of the DSISR is as defined in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370)             CAIA.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372)         reserved fields:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373)             For future extensions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375)     If the event type is CXL_EVENT_AFU_ERROR then the event structure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376)     is defined as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378)         ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380)             struct cxl_event_afu_error {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381)                     __u16 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382)                     __u16 reserved1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383)                     __u32 reserved2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384)                     __u64 error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385)             };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387)         flags:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388)             These flags indicate which optional fields are present in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389)             this struct. Currently all fields are Mandatory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391)         error:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392)             Error status from the AFU. Defined by the AFU.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394)         reserved fields:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395)             For future extensions and padding
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) 2. Card character device (powerVM guest only)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401)     In a powerVM guest, an extra character device is created for the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402)     card. The device is only used to write (flash) a new image on the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403)     FPGA accelerator. Once the image is written and verified, the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404)     device tree is updated and the card is reset to reload the updated
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405)     image.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) open
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) ----
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410)     Opens the device and allocates a file descriptor to be used with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411)     the rest of the API. The device can only be opened once.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) ioctl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) -----
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) CXL_IOCTL_DOWNLOAD_IMAGE / CXL_IOCTL_VALIDATE_IMAGE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417)     Starts and controls flashing a new FPGA image. Partial
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418)     reconfiguration is not supported (yet), so the image must contain
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419)     a copy of the PSL and AFU(s). Since an image can be quite large,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420)     the caller may have to iterate, splitting the image in smaller
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421)     chunks.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423)     Takes a pointer to a struct cxl_adapter_image::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425)         struct cxl_adapter_image {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426)             __u64 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427)             __u64 data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428)             __u64 len_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429)             __u64 len_image;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430)             __u64 reserved1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431)             __u64 reserved2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432)             __u64 reserved3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433)             __u64 reserved4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434)         };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436)     flags:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437)         These flags indicate which optional fields are present in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438)         this struct. Currently all fields are mandatory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440)     data:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441)         Pointer to a buffer with part of the image to write to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442)         card.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444)     len_data:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445)         Size of the buffer pointed to by data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447)     len_image:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448)         Full size of the image.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) Sysfs Class
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) ===========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454)     A cxl sysfs class is added under /sys/class/cxl to facilitate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455)     enumeration and tuning of the accelerators. Its layout is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456)     described in Documentation/ABI/testing/sysfs-class-cxl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) Udev rules
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) ==========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462)     The following udev rules could be used to create a symlink to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463)     most logical chardev to use in any programming mode (afuX.Yd for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464)     dedicated, afuX.Ys for afu directed), since the API is virtually
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465)     identical for each::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) 	SUBSYSTEM=="cxl", ATTRS{mode}=="dedicated_process", SYMLINK="cxl/%b"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) 	SUBSYSTEM=="cxl", ATTRS{mode}=="afu_directed", \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) 	                  KERNEL=="afu[0-9]*.[0-9]*s", SYMLINK="cxl/%b"