/** * struct cxl_memdev - CXL bus object representing a Type-3 Memory Device * @dev: driver core device object * @cdev: char dev core object for ioctl operations * @cxlds: The device state backing this device * @detach_work: active memdev lost a port in its ancestry * @cxl_nvb: coordinate removal of @cxl_nvd if present * @cxl_nvd: optional bridge to an nvdimm if the device supports pmem * @endpoint: connection to the CXL port topology for this memory device * @id: id number of this memdev instance. * @depth: endpoint port depth * @scrub_cycle: current scrub cycle set for this device * @scrub_region_id: id number of a backed region (if any) for which current scrub cycle set * @err_rec_array: List of xarrarys to store the memdev error records to * check attributes for a memory repair operation are from * current boot.
*/ struct cxl_memdev { struct device dev; struct cdev cdev; struct cxl_dev_state *cxlds; struct work_struct detach_work; struct cxl_nvdimm_bridge *cxl_nvb; struct cxl_nvdimm *cxl_nvd; struct cxl_port *endpoint; int id; int depth;
u8 scrub_cycle; int scrub_region_id; void *err_rec_array;
};
/* * Per CXL 3.0 Section 8.2.8.4.5.1
*/ #define CMD_CMD_RC_TABLE \
C(SUCCESS, 0, NULL), \
C(BACKGROUND, -ENXIO, "background cmd started successfully"), \
C(INPUT, -ENXIO, "cmd input was invalid"), \
C(UNSUPPORTED, -ENXIO, "cmd is not supported"), \
C(INTERNAL, -ENXIO, "internal device error"), \
C(RETRY, -ENXIO, "temporary error, retry once"), \
C(BUSY, -ENXIO, "ongoing background operation"), \
C(MEDIADISABLED, -ENXIO, "media access is disabled"), \
C(FWINPROGRESS, -ENXIO, "one FW package can be transferred at a time"), \
C(FWOOO, -ENXIO, "FW package content was transferred out of order"), \
C(FWAUTH, -ENXIO, "FW package authentication failed"), \
C(FWSLOT, -ENXIO, "FW slot is not supported for requested operation"), \
C(FWROLLBACK, -ENXIO, "rolled back to the previous active FW"), \
C(FWRESET, -ENXIO, "FW failed to activate, needs cold reset"), \
C(HANDLE, -ENXIO, "one or more Event Record Handles were invalid"), \
C(PADDR, -EFAULT, "physical address specified is invalid"), \
C(POISONLMT, -EBUSY, "poison injection limit has been reached"), \
C(MEDIAFAILURE, -ENXIO, "permanent issue with the media"), \
C(ABORT, -ENXIO, "background cmd was aborted by device"), \
C(SECURITY, -ENXIO, "not valid in the current security state"), \
C(PASSPHRASE, -ENXIO, "phrase doesn't match current set passphrase"), \
C(MBUNSUPPORTED, -ENXIO, "unsupported on the mailbox it was issued on"),\
C(PAYLOADLEN, -ENXIO, "invalid payload length"), \
C(LOG, -ENXIO, "invalid or unsupported log page"), \
C(INTERRUPTED, -ENXIO, "asynchronous event occured"), \
C(FEATUREVERSION, -ENXIO, "unsupported feature version"), \
C(FEATURESELVALUE, -ENXIO, "unsupported feature selection value"), \
C(FEATURETRANSFERIP, -ENXIO, "feature transfer in progress"), \
C(FEATURETRANSFEROOO, -ENXIO, "feature transfer out of order"), \
C(RESOURCEEXHAUSTED, -ENXIO, "resources are exhausted"), \
C(EXTLIST, -ENXIO, "invalid Extent List"), \
#undef C #define C(a, b, c) CXL_MBOX_CMD_RC_##a enum { CMD_CMD_RC_TABLE }; #undef C #define C(a, b, c) { b, c } struct cxl_mbox_cmd_rc { int err; constchar *desc;
};
staticconst struct cxl_mbox_cmd_rc cxl_mbox_cmd_rctable[] ={ CMD_CMD_RC_TABLE }; #undef C
/* * CXL 2.0 - Memory capacity multiplier * See Section 8.2.9.5 * * Volatile, Persistent, and Partition capacities are specified to be in * multiples of 256MB - define a multiplier to convert to/from bytes.
*/ #define CXL_CAPACITY_MULTIPLIER SZ_256M
/** * struct cxl_poison_state - Driver poison state info * * @max_errors: Maximum media error records held in device cache * @enabled_cmds: All poison commands enabled in the CEL * @list_out: The poison list payload returned by device * @mutex: Protect reads of the poison list * * Reads of the poison list are synchronized to ensure that a reader * does not get an incomplete list because their request overlapped * (was interrupted or preceded by) another read request of the same * DPA range. CXL Spec 3.0 Section 8.2.9.8.4.1
*/ struct cxl_poison_state {
u32 max_errors;
DECLARE_BITMAP(enabled_cmds, CXL_POISON_ENABLED_MAX); struct cxl_mbox_poison_out *list_out; struct mutex mutex; /* Protect reads of poison list */
};
/* * CXL rev 3.0 section 8.2.9.3.2 mandates 128-byte alignment for FW packages * and for each part transferred in a Transfer FW command.
*/ #define CXL_FW_TRANSFER_ALIGNMENT 128
/** * struct cxl_fw_state - Firmware upload / activation state * * @state: fw_uploader state bitmask * @oneshot: whether the fw upload fits in a single transfer * @num_slots: Number of FW slots available * @cur_slot: Slot number currently active * @next_slot: Slot number for the new firmware
*/ struct cxl_fw_state {
DECLARE_BITMAP(state, CXL_FW_STATE_BITS); bool oneshot; int num_slots; int cur_slot; int next_slot;
};
/** * struct cxl_security_state - Device security state * * @state: state of last security operation * @enabled_cmds: All security commands enabled in the CEL * @poll_tmo_secs: polling timeout * @sanitize_active: sanitize completion pending * @poll_dwork: polling work item * @sanitize_node: sanitation sysfs file to notify
*/ struct cxl_security_state { unsignedlong state;
DECLARE_BITMAP(enabled_cmds, CXL_SEC_ENABLED_MAX); int poll_tmo_secs; bool sanitize_active; struct delayed_work poll_dwork; struct kernfs_node *sanitize_node;
};
/* * enum cxl_devtype - delineate type-2 from a generic type-3 device * @CXL_DEVTYPE_DEVMEM - Vendor specific CXL Type-2 device implementing HDM-D or * HDM-DB, no requirement that this device implements a * mailbox, or other memory-device-standard manageability * flows. * @CXL_DEVTYPE_CLASSMEM - Common class definition of a CXL Type-3 device with * HDM-H and class-mandatory memory device registers
*/ enum cxl_devtype {
CXL_DEVTYPE_DEVMEM,
CXL_DEVTYPE_CLASSMEM,
};
/** * struct cxl_dpa_perf - DPA performance property entry * @dpa_range: range for DPA address * @coord: QoS performance data (i.e. latency, bandwidth) * @cdat_coord: raw QoS performance data from CDAT * @qos_class: QoS Class cookies
*/ struct cxl_dpa_perf { struct range dpa_range; struct access_coordinate coord[ACCESS_COORDINATE_MAX]; struct access_coordinate cdat_coord[ACCESS_COORDINATE_MAX]; int qos_class;
};
/** * struct cxl_dpa_partition - DPA partition descriptor * @res: shortcut to the partition in the DPA resource tree (cxlds->dpa_res) * @perf: performance attributes of the partition from CDAT * @mode: operation mode for the DPA capacity, e.g. ram, pmem, dynamic...
*/ struct cxl_dpa_partition { struct resource res; struct cxl_dpa_perf perf; enum cxl_partition_mode mode;
};
/** * struct cxl_dev_state - The driver device state * * cxl_dev_state represents the CXL driver/device state. It provides an * interface to mailbox commands as well as some cached data about the device. * Currently only memory devices are represented. * * @dev: The device associated with this CXL state * @cxlmd: The device representing the CXL.mem capabilities of @dev * @reg_map: component and ras register mapping parameters * @regs: Parsed register blocks * @cxl_dvsec: Offset to the PCIe device DVSEC * @rcd: operating in RCD mode (CXL 3.0 9.11.8 CXL Devices Attached to an RCH) * @media_ready: Indicate whether the device media is usable * @dpa_res: Overall DPA resource tree for the device * @part: DPA partition array * @nr_partitions: Number of DPA partitions * @serial: PCIe Device Serial Number * @type: Generic Memory Class device or Vendor Specific Memory device * @cxl_mbox: CXL mailbox context * @cxlfs: CXL features context
*/ struct cxl_dev_state { struct device *dev; struct cxl_memdev *cxlmd; struct cxl_register_map reg_map; struct cxl_regs regs; int cxl_dvsec; bool rcd; bool media_ready; struct resource dpa_res; struct cxl_dpa_partition part[CXL_NR_PARTITIONS_MAX]; unsignedint nr_partitions;
u64 serial; enum cxl_devtype type; struct cxl_mailbox cxl_mbox; #ifdef CONFIG_CXL_FEATURES struct cxl_features_state *cxlfs; #endif
};
staticinline resource_size_t cxl_pmem_size(struct cxl_dev_state *cxlds)
{ /* * Static PMEM may be at partition index 0 when there is no static RAM * capacity.
*/ for (int i = 0; i < cxlds->nr_partitions; i++) if (cxlds->part[i].mode == CXL_PARTMODE_PMEM) return resource_size(&cxlds->part[i].res); return 0;
}
/** * struct cxl_memdev_state - Generic Type-3 Memory Device Class driver data * * CXL 8.1.12.1 PCI Header - Class Code Register Memory Device defines * common memory device functionality like the presence of a mailbox and * the functionality related to that like Identify Memory Device and Get * Partition Info * @cxlds: Core driver state common across Type-2 and Type-3 devices * @lsa_size: Size of Label Storage Area * (CXL 2.0 8.2.9.5.1.1 Identify Memory Device) * @firmware_version: Firmware version for the memory device. * @total_bytes: sum of all possible capacities * @volatile_only_bytes: hard volatile capacity * @persistent_only_bytes: hard persistent capacity * @partition_align_bytes: alignment size for partition-able capacity * @active_volatile_bytes: sum of hard + soft volatile * @active_persistent_bytes: sum of hard + soft persistent * @event: event log driver state * @poison: poison driver state info * @security: security driver state info * @fw: firmware upload / activation state * @mce_notifier: MCE notifier * * See CXL 3.0 8.2.9.8.2 Capacity Configuration and Label Storage for * details on capacity parameters.
*/ struct cxl_memdev_state { struct cxl_dev_state cxlds;
size_t lsa_size; char firmware_version[0x10];
u64 total_bytes;
u64 volatile_only_bytes;
u64 persistent_only_bytes;
u64 partition_align_bytes;
u64 active_volatile_bytes;
u64 active_persistent_bytes;
/* * Get Poison List address field encodes the starting * address of poison, and the source of the poison.
*/ #define CXL_POISON_START_MASK GENMASK_ULL(63, 6) #define CXL_POISON_SOURCE_MASK GENMASK(2, 0)
/* Get Poison List record length is in units of 64 bytes */ #define CXL_POISON_LEN_MULT 64
/* Kernel defined maximum for a list of poison errors */ #define CXL_POISON_LIST_MAX 1024
/* Get Poison List: Payload out flags */ #define CXL_POISON_FLAG_MORE BIT(0) #define CXL_POISON_FLAG_OVERFLOW BIT(1) #define CXL_POISON_FLAG_SCANNING BIT(2)
/** * struct cxl_mem_command - Driver representation of a memory device command * @info: Command information as it exists for the UAPI * @opcode: The actual bits used for the mailbox protocol * @flags: Set of flags effecting driver behavior. * * * %CXL_CMD_FLAG_FORCE_ENABLE: In cases of error, commands with this flag * will be enabled by the driver regardless of what hardware may have * advertised. * * The cxl_mem_command is the driver's internal representation of commands that * are supported by the driver. Some of these commands may not be supported by * the hardware. The driver will use @info to validate the fields passed in by * the user then submit the @opcode to the hardware. * * See struct cxl_command_info.
*/ struct cxl_mem_command { struct cxl_command_info info; enum cxl_opcode opcode;
u32 flags; #define CXL_CMD_FLAG_FORCE_ENABLE BIT(0)
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.