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 <imunsie@au1.ibm.com> Cc: Gavin Shan <gwshan@linux.vnet.ibm.com> Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> Signed-off-by: Ian Munsie <imunsie@au1.ibm.com> Reviewed-by: Gavin Shan <gwshan@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
49 lines
1.1 KiB
Plaintext
49 lines
1.1 KiB
Plaintext
#
|
|
# IBM Coherent Accelerator (CXL) compatible devices
|
|
#
|
|
|
|
config CXL_BASE
|
|
bool
|
|
default n
|
|
select PPC_COPRO_BASE
|
|
|
|
config CXL_KERNEL_API
|
|
bool
|
|
default n
|
|
|
|
config CXL_EEH
|
|
bool
|
|
default n
|
|
|
|
config CXL_AFU_DRIVER_OPS
|
|
bool
|
|
default n
|
|
|
|
config CXL
|
|
tristate "Support for IBM Coherent Accelerators (CXL)"
|
|
depends on PPC_POWERNV && PCI_MSI && EEH
|
|
select CXL_BASE
|
|
select CXL_KERNEL_API
|
|
select CXL_EEH
|
|
select CXL_AFU_DRIVER_OPS
|
|
default m
|
|
help
|
|
Select this option to enable driver support for IBM Coherent
|
|
Accelerators (CXL). CXL is otherwise known as Coherent Accelerator
|
|
Processor Interface (CAPI). CAPI allows accelerators in FPGAs to be
|
|
coherently attached to a CPU via an MMU. This driver enables
|
|
userspace programs to access these accelerators via /dev/cxl/afuM.N
|
|
devices.
|
|
|
|
CAPI adapters are found in POWER8 based systems.
|
|
|
|
If unsure, say N.
|
|
|
|
config CXL_BIMODAL
|
|
bool "Support for bi-modal CAPI cards"
|
|
depends on HOTPLUG_PCI_POWERNV = y && CXL || HOTPLUG_PCI_POWERNV = m && CXL = m
|
|
default y
|
|
help
|
|
Select this option to enable support for bi-modal CAPI cards, such as
|
|
the Mellanox CX-4.
|