Linux CXL
 help / color / mirror / Atom feed
From: Dave Jiang <dave.jiang@intel.com>
To: Davidlohr Bueso <dave@stgolabs.net>, dan.j.williams@intel.com
Cc: jonathan.cameron@huawei.com, alison.schofield@intel.com,
	ira.weiny@intel.com, vishal.l.verma@intel.com,
	seven.yi.lee@gmail.com, a.manzanares@samsung.com,
	fan.ni@samsung.com, anisa.su@samsung.com,
	linux-cxl@vger.kernel.org
Subject: Re: [PATCH 2/2] tools/testing/cxl: Set Shutdown State support
Date: Mon, 10 Feb 2025 19:16:24 -0700	[thread overview]
Message-ID: <a689a2c9-1fff-4c26-842c-74293d2e4455@intel.com> (raw)
In-Reply-To: <20250205040842.1253616-3-dave@stgolabs.net>



On 2/4/25 9:08 PM, Davidlohr Bueso wrote:
> Add support to emulate the CXL Set Shutdown State operation.

Should the CXL_MBOX_OP_GET_SHUTDOWN_STATE support be added as well so the cxl_test can excercise the sysfs attrib and other parts of patch 1?

> 
> Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>

otherwise
Reviewed-by: Dave Jiang <dave.jiang@intel.com>

> ---
>  tools/testing/cxl/test/mem.c | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/tools/testing/cxl/test/mem.c b/tools/testing/cxl/test/mem.c
> index 495199238335..832680a87c73 100644
> --- a/tools/testing/cxl/test/mem.c
> +++ b/tools/testing/cxl/test/mem.c
> @@ -65,6 +65,10 @@ static struct cxl_cel_entry mock_cel[] = {
>  		.opcode = cpu_to_le16(CXL_MBOX_OP_GET_HEALTH_INFO),
>  		.effect = CXL_CMD_EFFECT_NONE,
>  	},
> +	{
> +		.opcode = cpu_to_le16(CXL_MBOX_OP_SET_SHUTDOWN_STATE),
> +		.effect = POLICY_CHANGE_IMMEDIATE,
> +	},
>  	{
>  		.opcode = cpu_to_le16(CXL_MBOX_OP_GET_POISON),
>  		.effect = CXL_CMD_EFFECT_NONE,
> @@ -161,6 +165,7 @@ struct cxl_mockmem_data {
>  	u8 event_buf[SZ_4K];
>  	u64 timestamp;
>  	unsigned long sanitize_timeout;
> +	int shutdown_state;
>  };
>  
>  static struct mock_event_log *event_find_log(struct device *dev, int log_type)
> @@ -1088,6 +1093,21 @@ static int mock_health_info(struct cxl_mbox_cmd *cmd)
>  	return 0;
>  }
>  
> +static int mock_set_shutdown_state(struct cxl_mockmem_data *mdata,
> +				   struct cxl_mbox_cmd *cmd)
> +{
> +	struct cxl_mbox_set_shutdown_state_in *ss = cmd->payload_in;
> +
> +	if (cmd->size_in != sizeof(*ss))
> +		return -EINVAL;
> +
> +	if (cmd->size_out != 0)
> +		return -EINVAL;
> +
> +	mdata->shutdown_state = ss->state;
> +	return 0;
> +}
> +
>  static struct mock_poison {
>  	struct cxl_dev_state *cxlds;
>  	u64 dpa;
> @@ -1421,6 +1441,9 @@ static int cxl_mock_mbox_send(struct cxl_mailbox *cxl_mbox,
>  	case CXL_MBOX_OP_PASSPHRASE_SECURE_ERASE:
>  		rc = mock_passphrase_secure_erase(mdata, cmd);
>  		break;
> +	case CXL_MBOX_OP_SET_SHUTDOWN_STATE:
> +		rc = mock_set_shutdown_state(mdata, cmd);
> +		break;
>  	case CXL_MBOX_OP_GET_POISON:
>  		rc = mock_get_poison(cxlds, cmd);
>  		break;


  reply	other threads:[~2025-02-11  2:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-05  4:08 [PATCH 0/2] cxl: Dirty shutdown followups Davidlohr Bueso
2025-02-05  4:08 ` [PATCH 1/2] cxl/pmem: Export dirty shutdown count via sysfs Davidlohr Bueso
2025-02-07 10:46   ` Yee Li
2025-02-11  2:09   ` Dave Jiang
2025-02-11  4:50     ` Davidlohr Bueso
2025-02-18 18:58       ` Dave Jiang
2025-02-05  4:08 ` [PATCH 2/2] tools/testing/cxl: Set Shutdown State support Davidlohr Bueso
2025-02-11  2:16   ` Dave Jiang [this message]
2025-02-11  4:13     ` Davidlohr Bueso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a689a2c9-1fff-4c26-842c-74293d2e4455@intel.com \
    --to=dave.jiang@intel.com \
    --cc=a.manzanares@samsung.com \
    --cc=alison.schofield@intel.com \
    --cc=anisa.su@samsung.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave@stgolabs.net \
    --cc=fan.ni@samsung.com \
    --cc=ira.weiny@intel.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=seven.yi.lee@gmail.com \
    --cc=vishal.l.verma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox