162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only
262306a36Sopenharmony_cimenuconfig CXL_BUS
362306a36Sopenharmony_ci	tristate "CXL (Compute Express Link) Devices Support"
462306a36Sopenharmony_ci	depends on PCI
562306a36Sopenharmony_ci	select FW_LOADER
662306a36Sopenharmony_ci	select FW_UPLOAD
762306a36Sopenharmony_ci	select PCI_DOE
862306a36Sopenharmony_ci	help
962306a36Sopenharmony_ci	  CXL is a bus that is electrically compatible with PCI Express, but
1062306a36Sopenharmony_ci	  layers three protocols on that signalling (CXL.io, CXL.cache, and
1162306a36Sopenharmony_ci	  CXL.mem). The CXL.cache protocol allows devices to hold cachelines
1262306a36Sopenharmony_ci	  locally, the CXL.mem protocol allows devices to be fully coherent
1362306a36Sopenharmony_ci	  memory targets, the CXL.io protocol is equivalent to PCI Express.
1462306a36Sopenharmony_ci	  Say 'y' to enable support for the configuration and management of
1562306a36Sopenharmony_ci	  devices supporting these protocols.
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ciif CXL_BUS
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ciconfig CXL_PCI
2062306a36Sopenharmony_ci	tristate "PCI manageability"
2162306a36Sopenharmony_ci	default CXL_BUS
2262306a36Sopenharmony_ci	help
2362306a36Sopenharmony_ci	  The CXL specification defines a "CXL memory device" sub-class in the
2462306a36Sopenharmony_ci	  PCI "memory controller" base class of devices. Device's identified by
2562306a36Sopenharmony_ci	  this class code provide support for volatile and / or persistent
2662306a36Sopenharmony_ci	  memory to be mapped into the system address map (Host-managed Device
2762306a36Sopenharmony_ci	  Memory (HDM)).
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci	  Say 'y/m' to enable a driver that will attach to CXL memory expander
3062306a36Sopenharmony_ci	  devices enumerated by the memory device class code for configuration
3162306a36Sopenharmony_ci	  and management primarily via the mailbox interface. See Chapter 2.3
3262306a36Sopenharmony_ci	  Type 3 CXL Device in the CXL 2.0 specification for more details.
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci	  If unsure say 'm'.
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ciconfig CXL_MEM_RAW_COMMANDS
3762306a36Sopenharmony_ci	bool "RAW Command Interface for Memory Devices"
3862306a36Sopenharmony_ci	depends on CXL_PCI
3962306a36Sopenharmony_ci	help
4062306a36Sopenharmony_ci	  Enable CXL RAW command interface.
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci	  The CXL driver ioctl interface may assign a kernel ioctl command
4362306a36Sopenharmony_ci	  number for each specification defined opcode. At any given point in
4462306a36Sopenharmony_ci	  time the number of opcodes that the specification defines and a device
4562306a36Sopenharmony_ci	  may implement may exceed the kernel's set of associated ioctl function
4662306a36Sopenharmony_ci	  numbers. The mismatch is either by omission, specification is too new,
4762306a36Sopenharmony_ci	  or by design. When prototyping new hardware, or developing / debugging
4862306a36Sopenharmony_ci	  the driver it is useful to be able to submit any possible command to
4962306a36Sopenharmony_ci	  the hardware, even commands that may crash the kernel due to their
5062306a36Sopenharmony_ci	  potential impact to memory currently in use by the kernel.
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci	  If developing CXL hardware or the driver say Y, otherwise say N.
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ciconfig CXL_ACPI
5562306a36Sopenharmony_ci	tristate "CXL ACPI: Platform Support"
5662306a36Sopenharmony_ci	depends on ACPI
5762306a36Sopenharmony_ci	default CXL_BUS
5862306a36Sopenharmony_ci	select ACPI_TABLE_LIB
5962306a36Sopenharmony_ci	help
6062306a36Sopenharmony_ci	  Enable support for host managed device memory (HDM) resources
6162306a36Sopenharmony_ci	  published by a platform's ACPI CXL memory layout description.  See
6262306a36Sopenharmony_ci	  Chapter 9.14.1 CXL Early Discovery Table (CEDT) in the CXL 2.0
6362306a36Sopenharmony_ci	  specification, and CXL Fixed Memory Window Structures (CEDT.CFMWS)
6462306a36Sopenharmony_ci	  (https://www.computeexpresslink.org/spec-landing). The CXL core
6562306a36Sopenharmony_ci	  consumes these resource to publish the root of a cxl_port decode
6662306a36Sopenharmony_ci	  hierarchy to map regions that represent System RAM, or Persistent
6762306a36Sopenharmony_ci	  Memory regions to be managed by LIBNVDIMM.
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_ci	  If unsure say 'm'.
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_ciconfig CXL_PMEM
7262306a36Sopenharmony_ci	tristate "CXL PMEM: Persistent Memory Support"
7362306a36Sopenharmony_ci	depends on LIBNVDIMM
7462306a36Sopenharmony_ci	default CXL_BUS
7562306a36Sopenharmony_ci	help
7662306a36Sopenharmony_ci	  In addition to typical memory resources a platform may also advertise
7762306a36Sopenharmony_ci	  support for persistent memory attached via CXL. This support is
7862306a36Sopenharmony_ci	  managed via a bridge driver from CXL to the LIBNVDIMM system
7962306a36Sopenharmony_ci	  subsystem. Say 'y/m' to enable support for enumerating and
8062306a36Sopenharmony_ci	  provisioning the persistent memory capacity of CXL memory expanders.
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_ci	  If unsure say 'm'.
8362306a36Sopenharmony_ci
8462306a36Sopenharmony_ciconfig CXL_MEM
8562306a36Sopenharmony_ci	tristate "CXL: Memory Expansion"
8662306a36Sopenharmony_ci	depends on CXL_PCI
8762306a36Sopenharmony_ci	default CXL_BUS
8862306a36Sopenharmony_ci	help
8962306a36Sopenharmony_ci	  The CXL.mem protocol allows a device to act as a provider of "System
9062306a36Sopenharmony_ci	  RAM" and/or "Persistent Memory" that is fully coherent as if the
9162306a36Sopenharmony_ci	  memory were attached to the typical CPU memory controller. This is
9262306a36Sopenharmony_ci	  known as HDM "Host-managed Device Memory".
9362306a36Sopenharmony_ci
9462306a36Sopenharmony_ci	  Say 'y/m' to enable a driver that will attach to CXL.mem devices for
9562306a36Sopenharmony_ci	  memory expansion and control of HDM. See Chapter 9.13 in the CXL 2.0
9662306a36Sopenharmony_ci	  specification for a detailed description of HDM.
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_ci	  If unsure say 'm'.
9962306a36Sopenharmony_ci
10062306a36Sopenharmony_ciconfig CXL_PORT
10162306a36Sopenharmony_ci	default CXL_BUS
10262306a36Sopenharmony_ci	tristate
10362306a36Sopenharmony_ci
10462306a36Sopenharmony_ciconfig CXL_SUSPEND
10562306a36Sopenharmony_ci	def_bool y
10662306a36Sopenharmony_ci	depends on SUSPEND && CXL_MEM
10762306a36Sopenharmony_ci
10862306a36Sopenharmony_ciconfig CXL_REGION
10962306a36Sopenharmony_ci	bool "CXL: Region Support"
11062306a36Sopenharmony_ci	default CXL_BUS
11162306a36Sopenharmony_ci	# For MAX_PHYSMEM_BITS
11262306a36Sopenharmony_ci	depends on SPARSEMEM
11362306a36Sopenharmony_ci	select MEMREGION
11462306a36Sopenharmony_ci	select GET_FREE_REGION
11562306a36Sopenharmony_ci	help
11662306a36Sopenharmony_ci	  Enable the CXL core to enumerate and provision CXL regions. A CXL
11762306a36Sopenharmony_ci	  region is defined by one or more CXL expanders that decode a given
11862306a36Sopenharmony_ci	  system-physical address range. For CXL regions established by
11962306a36Sopenharmony_ci	  platform-firmware this option enables memory error handling to
12062306a36Sopenharmony_ci	  identify the devices participating in a given interleaved memory
12162306a36Sopenharmony_ci	  range. Otherwise, platform-firmware managed CXL is enabled by being
12262306a36Sopenharmony_ci	  placed in the system address map and does not need a driver.
12362306a36Sopenharmony_ci
12462306a36Sopenharmony_ci	  If unsure say 'y'
12562306a36Sopenharmony_ci
12662306a36Sopenharmony_ciconfig CXL_REGION_INVALIDATION_TEST
12762306a36Sopenharmony_ci	bool "CXL: Region Cache Management Bypass (TEST)"
12862306a36Sopenharmony_ci	depends on CXL_REGION
12962306a36Sopenharmony_ci	help
13062306a36Sopenharmony_ci	  CXL Region management and security operations potentially invalidate
13162306a36Sopenharmony_ci	  the content of CPU caches without notifying those caches to
13262306a36Sopenharmony_ci	  invalidate the affected cachelines. The CXL Region driver attempts
13362306a36Sopenharmony_ci	  to invalidate caches when those events occur.  If that invalidation
13462306a36Sopenharmony_ci	  fails the region will fail to enable.  Reasons for cache
13562306a36Sopenharmony_ci	  invalidation failure are due to the CPU not providing a cache
13662306a36Sopenharmony_ci	  invalidation mechanism. For example usage of wbinvd is restricted to
13762306a36Sopenharmony_ci	  bare metal x86. However, for testing purposes toggling this option
13862306a36Sopenharmony_ci	  can disable that data integrity safety and proceed with enabling
13962306a36Sopenharmony_ci	  regions when there might be conflicting contents in the CPU cache.
14062306a36Sopenharmony_ci
14162306a36Sopenharmony_ci	  If unsure, or if this kernel is meant for production environments,
14262306a36Sopenharmony_ci	  say N.
14362306a36Sopenharmony_ci
14462306a36Sopenharmony_ciconfig CXL_PMU
14562306a36Sopenharmony_ci	tristate "CXL Performance Monitoring Unit"
14662306a36Sopenharmony_ci	default CXL_BUS
14762306a36Sopenharmony_ci	depends on PERF_EVENTS
14862306a36Sopenharmony_ci	help
14962306a36Sopenharmony_ci	  Support performance monitoring as defined in CXL rev 3.0
15062306a36Sopenharmony_ci	  section 13.2: Performance Monitoring. CXL components may have
15162306a36Sopenharmony_ci	  one or more CXL Performance Monitoring Units (CPMUs).
15262306a36Sopenharmony_ci
15362306a36Sopenharmony_ci	  Say 'y/m' to enable a driver that will attach to performance
15462306a36Sopenharmony_ci	  monitoring units and provide standard perf based interfaces.
15562306a36Sopenharmony_ci
15662306a36Sopenharmony_ci	  If unsure say 'm'.
15762306a36Sopenharmony_ciendif
158