[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9b655634-ecf6-6c87-dbba-e88df309700c@intel.com>
Date: Tue, 13 Jun 2023 11:38:00 -0700
From: Dave Jiang <dave.jiang@...el.com>
To: Vishal Verma <vishal.l.verma@...el.com>,
Alison Schofield <alison.schofield@...el.com>,
Ira Weiny <ira.weiny@...el.com>,
Ben Widawsky <bwidawsk@...nel.org>,
Dan Williams <dan.j.williams@...el.com>
CC: <linux-cxl@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
"Davidlohr Bueso" <dave@...olabs.net>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
Russ Weight <russell.h.weight@...el.com>
Subject: Re: [PATCH v3 3/4] tools/testing/cxl: Use named effects for the
Command Effect Log
On 6/11/23 23:55, Vishal Verma wrote:
> 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@...olabs.net>
> Cc: Jonathan Cameron <Jonathan.Cameron@...wei.com>
> Cc: Russ Weight <russell.h.weight@...el.com>
> Cc: Alison Schofield <alison.schofield@...el.com>
> Cc: Ira Weiny <ira.weiny@...el.com>
> Cc: Dave Jiang <dave.jiang@...el.com>
> Cc: Ben Widawsky <bwidawsk@...nel.org>
> Cc: Dan Williams <dan.j.williams@...el.com>
> Suggested-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
> Reviewed-by: Alison Schofield <alison.schofield@...el.com>
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
> Signed-off-by: Vishal Verma <vishal.l.verma@...el.com>
Reviewed-by: Dave Jiang <dave.jiang@...el.com>
> ---
> tools/testing/cxl/test/mem.c | 32 +++++++++++++++++++++++---------
> 1 file changed, 23 insertions(+), 9 deletions(-)
>
> diff --git a/tools/testing/cxl/test/mem.c b/tools/testing/cxl/test/mem.c
> index 403cd3608772..68668d8df1cd 100644
> --- a/tools/testing/cxl/test/mem.c
> +++ b/tools/testing/cxl/test/mem.c
> @@ -21,42 +21,56 @@
>
> static unsigned int poison_inject_dev_max = MOCK_INJECT_DEV_MAX;
>
> +enum cxl_command_effects {
> + CONF_CHANGE_COLD_RESET = 0,
> + CONF_CHANGE_IMMEDIATE,
> + DATA_CHANGE_IMMEDIATE,
> + POLICY_CHANGE_IMMEDIATE,
> + LOG_CHANGE_IMMEDIATE,
> + SECURITY_CHANGE_IMMEDIATE,
> + BACKGROUND_OP,
> + SECONDARY_MBOX_SUPPORTED,
> +};
> +
> +#define CXL_CMD_EFFECT_NONE cpu_to_le16(0)
> +
> static struct cxl_cel_entry mock_cel[] = {
> {
> .opcode = cpu_to_le16(CXL_MBOX_OP_GET_SUPPORTED_LOGS),
> - .effect = cpu_to_le16(0),
> + .effect = CXL_CMD_EFFECT_NONE,
> },
> {
> .opcode = cpu_to_le16(CXL_MBOX_OP_IDENTIFY),
> - .effect = cpu_to_le16(0),
> + .effect = CXL_CMD_EFFECT_NONE,
> },
> {
> .opcode = cpu_to_le16(CXL_MBOX_OP_GET_LSA),
> - .effect = cpu_to_le16(0),
> + .effect = CXL_CMD_EFFECT_NONE,
> },
> {
> .opcode = cpu_to_le16(CXL_MBOX_OP_GET_PARTITION_INFO),
> - .effect = cpu_to_le16(0),
> + .effect = CXL_CMD_EFFECT_NONE,
> },
> {
> .opcode = cpu_to_le16(CXL_MBOX_OP_SET_LSA),
> - .effect = cpu_to_le16(EFFECT(1) | EFFECT(2)),
> + .effect = cpu_to_le16(EFFECT(CONF_CHANGE_IMMEDIATE) |
> + EFFECT(DATA_CHANGE_IMMEDIATE)),
> },
> {
> .opcode = cpu_to_le16(CXL_MBOX_OP_GET_HEALTH_INFO),
> - .effect = cpu_to_le16(0),
> + .effect = CXL_CMD_EFFECT_NONE,
> },
> {
> .opcode = cpu_to_le16(CXL_MBOX_OP_GET_POISON),
> - .effect = cpu_to_le16(0),
> + .effect = CXL_CMD_EFFECT_NONE,
> },
> {
> .opcode = cpu_to_le16(CXL_MBOX_OP_INJECT_POISON),
> - .effect = cpu_to_le16(EFFECT(2)),
> + .effect = cpu_to_le16(EFFECT(DATA_CHANGE_IMMEDIATE)),
> },
> {
> .opcode = cpu_to_le16(CXL_MBOX_OP_CLEAR_POISON),
> - .effect = cpu_to_le16(EFFECT(2)),
> + .effect = cpu_to_le16(EFFECT(DATA_CHANGE_IMMEDIATE)),
> },
> };
>
>
Powered by blists - more mailing lists