mirror of
https://github.com/torvalds/linux.git
synced 2026-09-14 16:10:02 +02:00
Merge branch 'for-7.3/cxl-misc' into cxl-for-next
cxl/test: Assign one mock memdev a full-width serial number cxl/core: Format the memdev serial number as unsigned in TP_printk cxl/pmem: Format the nvdimm serial number as unsigned decimal
This commit is contained in:
commit
5d109da476
|
|
@ -48,7 +48,8 @@ What: /sys/bus/nd/devices/nmemX/cxl/id
|
|||
Date: November 2022
|
||||
KernelVersion: 6.2
|
||||
Contact: Dave Jiang <dave.jiang@intel.com>
|
||||
Description: (RO) Show the id (serial) of the device. This is CXL specific.
|
||||
Description: (RO) Show the id (serial) of the device, formatted as an
|
||||
unsigned 64-bit decimal value. This is CXL specific.
|
||||
|
||||
What: /sys/bus/nd/devices/nmemX/cxl/provider
|
||||
Date: November 2022
|
||||
|
|
|
|||
|
|
@ -219,12 +219,14 @@ static struct cxl_nvdimm *cxl_nvdimm_alloc(struct cxl_nvdimm_bridge *cxl_nvb,
|
|||
dev->bus = &cxl_bus_type;
|
||||
dev->type = &cxl_nvdimm_type;
|
||||
/*
|
||||
* A "%llx" string is 17-bytes vs dimm_id that is max
|
||||
* NVDIMM_KEY_DESC_LEN
|
||||
* dev_id is the nvdimm dimm_id used for security key lookup.
|
||||
* It must match id_show(), which emits the CXL serial as an
|
||||
* unsigned decimal. A u64 decimal string is at most 20 digits
|
||||
* plus NUL.
|
||||
*/
|
||||
BUILD_BUG_ON(sizeof(cxl_nvd->dev_id) < 17 ||
|
||||
BUILD_BUG_ON(sizeof(cxl_nvd->dev_id) < 21 ||
|
||||
sizeof(cxl_nvd->dev_id) > NVDIMM_KEY_DESC_LEN);
|
||||
sprintf(cxl_nvd->dev_id, "%llx", cxlmd->cxlds->serial);
|
||||
sprintf(cxl_nvd->dev_id, "%llu", cxlmd->cxlds->serial);
|
||||
|
||||
return cxl_nvd;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ TRACE_EVENT(cxl_aer_uncorrectable_error,
|
|||
memcpy(__entry->header_log, hl,
|
||||
CXL_HEADERLOG_TRACE_SIZE_U32 * sizeof(u32));
|
||||
),
|
||||
TP_printk("memdev=%s host=%s serial=%lld: status: '%s' first_error: '%s'",
|
||||
TP_printk("memdev=%s host=%s serial=%llu: status: '%s' first_error: '%s'",
|
||||
__get_str(memdev), __get_str(host), __entry->serial,
|
||||
show_uc_errs(__entry->status),
|
||||
show_uc_errs(__entry->first_error)
|
||||
|
|
@ -166,7 +166,7 @@ TRACE_EVENT(cxl_aer_correctable_error,
|
|||
__entry->serial = cxlmd->cxlds->serial;
|
||||
__entry->status = status;
|
||||
),
|
||||
TP_printk("memdev=%s host=%s serial=%lld: status: '%s'",
|
||||
TP_printk("memdev=%s host=%s serial=%llu: status: '%s'",
|
||||
__get_str(memdev), __get_str(host), __entry->serial,
|
||||
show_ce_errs(__entry->status)
|
||||
)
|
||||
|
|
@ -206,7 +206,7 @@ TRACE_EVENT(cxl_overflow,
|
|||
__entry->last_ts = le64_to_cpu(payload->last_overflow_timestamp);
|
||||
),
|
||||
|
||||
TP_printk("memdev=%s host=%s serial=%lld: log=%s : %u records from %llu to %llu",
|
||||
TP_printk("memdev=%s host=%s serial=%llu: log=%s : %u records from %llu to %llu",
|
||||
__get_str(memdev), __get_str(host), __entry->serial,
|
||||
cxl_event_log_type_str(__entry->log), __entry->count,
|
||||
__entry->first_ts, __entry->last_ts)
|
||||
|
|
@ -279,7 +279,7 @@ TRACE_EVENT(cxl_overflow,
|
|||
__entry->hdr_head_id = (hdr).head_id
|
||||
|
||||
#define CXL_EVT_TP_printk(fmt, ...) \
|
||||
TP_printk("memdev=%s host=%s serial=%lld log=%s : time=%llu uuid=%pUb " \
|
||||
TP_printk("memdev=%s host=%s serial=%llu log=%s : time=%llu uuid=%pUb " \
|
||||
"len=%d flags='%s' handle=%x related_handle=%x " \
|
||||
"maint_op_class=%u maint_op_sub_class=%u " \
|
||||
"ld_id=%x head_id=%x : " fmt, \
|
||||
|
|
@ -1088,7 +1088,7 @@ TRACE_EVENT(cxl_poison,
|
|||
}
|
||||
),
|
||||
|
||||
TP_printk("memdev=%s host=%s serial=%lld trace_type=%s region=%s " \
|
||||
TP_printk("memdev=%s host=%s serial=%llu trace_type=%s region=%s " \
|
||||
"region_uuid=%pU hpa=0x%llx hpa_alias0=0x%llx dpa=0x%llx " \
|
||||
"dpa_length=0x%x source=%s flags=%s overflow_time=%llu",
|
||||
__get_str(memdev),
|
||||
|
|
|
|||
|
|
@ -505,7 +505,8 @@ struct cxl_nvdimm_bridge {
|
|||
struct nvdimm_bus_descriptor nd_desc;
|
||||
};
|
||||
|
||||
#define CXL_DEV_ID_LEN 19
|
||||
/* Holds a u64 serial as a decimal string: up to 20 digits + NUL */
|
||||
#define CXL_DEV_ID_LEN 21
|
||||
|
||||
enum {
|
||||
CXL_NVD_F_INVALIDATED = 0,
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ static ssize_t id_show(struct device *dev, struct device_attribute *attr, char *
|
|||
struct cxl_nvdimm *cxl_nvd = nvdimm_provider_data(nvdimm);
|
||||
struct cxl_dev_state *cxlds = cxl_nvd->cxlmd->cxlds;
|
||||
|
||||
return sysfs_emit(buf, "%lld\n", cxlds->serial);
|
||||
return sysfs_emit(buf, "%llu\n", cxlds->serial);
|
||||
}
|
||||
static DEVICE_ATTR_RO(id);
|
||||
|
||||
|
|
|
|||
|
|
@ -1713,6 +1713,7 @@ static int cxl_mock_mem_probe(struct platform_device *pdev)
|
|||
struct cxl_mockmem_data *mdata;
|
||||
struct cxl_mailbox *cxl_mbox;
|
||||
struct cxl_dpa_info range_info = { 0 };
|
||||
u64 serial;
|
||||
int rc;
|
||||
|
||||
/* Increase async probe race window */
|
||||
|
|
@ -1739,7 +1740,19 @@ static int cxl_mock_mem_probe(struct platform_device *pdev)
|
|||
if (rc)
|
||||
return rc;
|
||||
|
||||
mds = cxl_memdev_state_create(dev, pdev->id + 1, 0);
|
||||
/*
|
||||
* Mock serials have historically been derived from pdev->id and stayed
|
||||
* single-digit, so they never exercised either decimal-vs-hex key
|
||||
* lookup or unsigned formatting. Give one mock device a full-width
|
||||
* serial with bit 63 set, matching real hardware such as Montage CXL
|
||||
* devices. pdev->id 7 is unused by the auto-region topology.
|
||||
*/
|
||||
if (pdev->id == 7)
|
||||
serial = 0x8a34567890abcdef;
|
||||
else
|
||||
serial = pdev->id + 1;
|
||||
|
||||
mds = cxl_memdev_state_create(dev, serial, 0);
|
||||
if (IS_ERR(mds))
|
||||
return PTR_ERR(mds);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user