Skip to content

Commit 4c115c9

Browse files
weiny2djbw
authored andcommitted
cxl/events: Create common event UUID defines
Dan points out in review that the cxl_test code could be made better through the use of UUID's defines rather than being open coded.[1] Create UUID defines and use them rather than open coding them. Suggested-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Ira Weiny <ira.weiny@intel.com> Link: http://lore.kernel.org/r/65738d09e30e2_45e0129451@dwillia2-xfh.jf.intel.com.notmuch [1] Link: https://lore.kernel.org/r/20231220-cxl-cper-v5-3-1bb8a4ca2c7a@intel.com [djbw: clang-format uuid definitions] Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent 26a1a86 commit 4c115c9

3 files changed

Lines changed: 30 additions & 33 deletions

File tree

drivers/cxl/core/mbox.c

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -836,46 +836,22 @@ int cxl_enumerate_cmds(struct cxl_memdev_state *mds)
836836
}
837837
EXPORT_SYMBOL_NS_GPL(cxl_enumerate_cmds, CXL);
838838

839-
/*
840-
* General Media Event Record
841-
* CXL rev 3.0 Section 8.2.9.2.1.1; Table 8-43
842-
*/
843-
static const uuid_t gen_media_event_uuid =
844-
UUID_INIT(0xfbcd0a77, 0xc260, 0x417f,
845-
0x85, 0xa9, 0x08, 0x8b, 0x16, 0x21, 0xeb, 0xa6);
846-
847-
/*
848-
* DRAM Event Record
849-
* CXL rev 3.0 section 8.2.9.2.1.2; Table 8-44
850-
*/
851-
static const uuid_t dram_event_uuid =
852-
UUID_INIT(0x601dcbb3, 0x9c06, 0x4eab,
853-
0xb8, 0xaf, 0x4e, 0x9b, 0xfb, 0x5c, 0x96, 0x24);
854-
855-
/*
856-
* Memory Module Event Record
857-
* CXL rev 3.0 section 8.2.9.2.1.3; Table 8-45
858-
*/
859-
static const uuid_t mem_mod_event_uuid =
860-
UUID_INIT(0xfe927475, 0xdd59, 0x4339,
861-
0xa5, 0x86, 0x79, 0xba, 0xb1, 0x13, 0xb7, 0x74);
862-
863839
static void cxl_event_trace_record(const struct cxl_memdev *cxlmd,
864840
enum cxl_event_log_type type,
865841
struct cxl_event_record_raw *record)
866842
{
867843
uuid_t *id = &record->hdr.id;
868844

869-
if (uuid_equal(id, &gen_media_event_uuid)) {
845+
if (uuid_equal(id, &CXL_EVENT_GEN_MEDIA_UUID)) {
870846
struct cxl_event_gen_media *rec =
871847
(struct cxl_event_gen_media *)record;
872848

873849
trace_cxl_general_media(cxlmd, type, id, rec);
874-
} else if (uuid_equal(id, &dram_event_uuid)) {
850+
} else if (uuid_equal(id, &CXL_EVENT_DRAM_UUID)) {
875851
struct cxl_event_dram *rec = (struct cxl_event_dram *)record;
876852

877853
trace_cxl_dram(cxlmd, type, id, rec);
878-
} else if (uuid_equal(id, &mem_mod_event_uuid)) {
854+
} else if (uuid_equal(id, &CXL_EVENT_MEM_MODULE_UUID)) {
879855
struct cxl_event_mem_module *rec =
880856
(struct cxl_event_mem_module *)record;
881857

drivers/cxl/cxlmem.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,30 @@ struct cxl_mbox_identify {
580580
u8 qos_telemetry_caps;
581581
} __packed;
582582

583+
/*
584+
* General Media Event Record UUID
585+
* CXL rev 3.0 Section 8.2.9.2.1.1; Table 8-43
586+
*/
587+
#define CXL_EVENT_GEN_MEDIA_UUID \
588+
UUID_INIT(0xfbcd0a77, 0xc260, 0x417f, 0x85, 0xa9, 0x08, 0x8b, 0x16, \
589+
0x21, 0xeb, 0xa6)
590+
591+
/*
592+
* DRAM Event Record UUID
593+
* CXL rev 3.0 section 8.2.9.2.1.2; Table 8-44
594+
*/
595+
#define CXL_EVENT_DRAM_UUID \
596+
UUID_INIT(0x601dcbb3, 0x9c06, 0x4eab, 0xb8, 0xaf, 0x4e, 0x9b, 0xfb, \
597+
0x5c, 0x96, 0x24)
598+
599+
/*
600+
* Memory Module Event Record UUID
601+
* CXL rev 3.0 section 8.2.9.2.1.3; Table 8-45
602+
*/
603+
#define CXL_EVENT_MEM_MODULE_UUID \
604+
UUID_INIT(0xfe927475, 0xdd59, 0x4339, 0xa5, 0x86, 0x79, 0xba, 0xb1, \
605+
0x13, 0xb7, 0x74)
606+
583607
/*
584608
* Get Event Records output payload
585609
* CXL rev 3.0 section 8.2.9.2.2; Table 8-50

tools/testing/cxl/test/mem.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,7 @@ struct cxl_event_record_raw hardware_replace = {
362362

363363
struct cxl_event_gen_media gen_media = {
364364
.hdr = {
365-
.id = UUID_INIT(0xfbcd0a77, 0xc260, 0x417f,
366-
0x85, 0xa9, 0x08, 0x8b, 0x16, 0x21, 0xeb, 0xa6),
365+
.id = CXL_EVENT_GEN_MEDIA_UUID,
367366
.length = sizeof(struct cxl_event_gen_media),
368367
.flags[0] = CXL_EVENT_RECORD_FLAG_PERMANENT,
369368
/* .handle = Set dynamically */
@@ -380,8 +379,7 @@ struct cxl_event_gen_media gen_media = {
380379

381380
struct cxl_event_dram dram = {
382381
.hdr = {
383-
.id = UUID_INIT(0x601dcbb3, 0x9c06, 0x4eab,
384-
0xb8, 0xaf, 0x4e, 0x9b, 0xfb, 0x5c, 0x96, 0x24),
382+
.id = CXL_EVENT_DRAM_UUID,
385383
.length = sizeof(struct cxl_event_dram),
386384
.flags[0] = CXL_EVENT_RECORD_FLAG_PERF_DEGRADED,
387385
/* .handle = Set dynamically */
@@ -400,8 +398,7 @@ struct cxl_event_dram dram = {
400398

401399
struct cxl_event_mem_module mem_module = {
402400
.hdr = {
403-
.id = UUID_INIT(0xfe927475, 0xdd59, 0x4339,
404-
0xa5, 0x86, 0x79, 0xba, 0xb1, 0x13, 0xb7, 0x74),
401+
.id = CXL_EVENT_MEM_MODULE_UUID,
405402
.length = sizeof(struct cxl_event_mem_module),
406403
/* .handle = Set dynamically */
407404
.related_handle = cpu_to_le16(0),

0 commit comments

Comments
 (0)