Skip to content

Commit 6e4ca04

Browse files
stellarhopperdjbw
authored andcommitted
tools/testing/cxl: Use named effects for the Command Effect Log
As more emulated mailbox commands are added to cxl_test, it is a pain point to look up command effect numbers for each effect. Replace the bare numbers in the mock driver with an enum that lists all possible effects. Cc: Davidlohr Bueso <dave@stgolabs.net> Cc: Jonathan Cameron <Jonathan.Cameron@Huawei.com> Cc: Russ Weight <russell.h.weight@intel.com> Cc: Alison Schofield <alison.schofield@intel.com> Cc: Ira Weiny <ira.weiny@intel.com> Cc: Dave Jiang <dave.jiang@intel.com> Cc: Ben Widawsky <bwidawsk@kernel.org> Cc: Dan Williams <dan.j.williams@intel.com> Suggested-by: Jonathan Cameron <Jonathan.Cameron@Huawei.com> Reviewed-by: Alison Schofield <alison.schofield@intel.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Vishal Verma <vishal.l.verma@intel.com> Link: https://lore.kernel.org/r/20230602-vv-fw_update-v4-3-c6265bd7343b@intel.com Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent b46c5fa commit 6e4ca04

1 file changed

Lines changed: 23 additions & 9 deletions

File tree

  • tools/testing/cxl/test

tools/testing/cxl/test/mem.c

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,42 +21,56 @@
2121

2222
static unsigned int poison_inject_dev_max = MOCK_INJECT_DEV_MAX;
2323

24+
enum cxl_command_effects {
25+
CONF_CHANGE_COLD_RESET = 0,
26+
CONF_CHANGE_IMMEDIATE,
27+
DATA_CHANGE_IMMEDIATE,
28+
POLICY_CHANGE_IMMEDIATE,
29+
LOG_CHANGE_IMMEDIATE,
30+
SECURITY_CHANGE_IMMEDIATE,
31+
BACKGROUND_OP,
32+
SECONDARY_MBOX_SUPPORTED,
33+
};
34+
35+
#define CXL_CMD_EFFECT_NONE cpu_to_le16(0)
36+
2437
static struct cxl_cel_entry mock_cel[] = {
2538
{
2639
.opcode = cpu_to_le16(CXL_MBOX_OP_GET_SUPPORTED_LOGS),
27-
.effect = cpu_to_le16(0),
40+
.effect = CXL_CMD_EFFECT_NONE,
2841
},
2942
{
3043
.opcode = cpu_to_le16(CXL_MBOX_OP_IDENTIFY),
31-
.effect = cpu_to_le16(0),
44+
.effect = CXL_CMD_EFFECT_NONE,
3245
},
3346
{
3447
.opcode = cpu_to_le16(CXL_MBOX_OP_GET_LSA),
35-
.effect = cpu_to_le16(0),
48+
.effect = CXL_CMD_EFFECT_NONE,
3649
},
3750
{
3851
.opcode = cpu_to_le16(CXL_MBOX_OP_GET_PARTITION_INFO),
39-
.effect = cpu_to_le16(0),
52+
.effect = CXL_CMD_EFFECT_NONE,
4053
},
4154
{
4255
.opcode = cpu_to_le16(CXL_MBOX_OP_SET_LSA),
43-
.effect = cpu_to_le16(EFFECT(1) | EFFECT(2)),
56+
.effect = cpu_to_le16(EFFECT(CONF_CHANGE_IMMEDIATE) |
57+
EFFECT(DATA_CHANGE_IMMEDIATE)),
4458
},
4559
{
4660
.opcode = cpu_to_le16(CXL_MBOX_OP_GET_HEALTH_INFO),
47-
.effect = cpu_to_le16(0),
61+
.effect = CXL_CMD_EFFECT_NONE,
4862
},
4963
{
5064
.opcode = cpu_to_le16(CXL_MBOX_OP_GET_POISON),
51-
.effect = cpu_to_le16(0),
65+
.effect = CXL_CMD_EFFECT_NONE,
5266
},
5367
{
5468
.opcode = cpu_to_le16(CXL_MBOX_OP_INJECT_POISON),
55-
.effect = cpu_to_le16(EFFECT(2)),
69+
.effect = cpu_to_le16(EFFECT(DATA_CHANGE_IMMEDIATE)),
5670
},
5771
{
5872
.opcode = cpu_to_le16(CXL_MBOX_OP_CLEAR_POISON),
59-
.effect = cpu_to_le16(EFFECT(2)),
73+
.effect = cpu_to_le16(EFFECT(DATA_CHANGE_IMMEDIATE)),
6074
},
6175
};
6276

0 commit comments

Comments
 (0)