[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <67e589815e91d_13cb29455@dwillia2-mobl3.amr.corp.intel.com.notmuch>
Date: Thu, 27 Mar 2025 13:23:13 -0400
From: Dan Williams <dan.j.williams@...el.com>
To: <shiju.jose@...wei.com>, <linux-cxl@...r.kernel.org>,
<dan.j.williams@...el.com>, <dave@...olabs.net>,
<jonathan.cameron@...wei.com>, <dave.jiang@...el.com>,
<alison.schofield@...el.com>, <vishal.l.verma@...el.com>,
<ira.weiny@...el.com>, <david@...hat.com>, <Vilas.Sridharan@....com>
CC: <linux-edac@...r.kernel.org>, <linux-acpi@...r.kernel.org>,
<linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>, <bp@...en8.de>,
<tony.luck@...el.com>, <rafael@...nel.org>, <lenb@...nel.org>,
<mchehab@...nel.org>, <leo.duran@....com>, <Yazen.Ghannam@....com>,
<rientjes@...gle.com>, <jiaqiyan@...gle.com>, <Jon.Grimm@....com>,
<dave.hansen@...ux.intel.com>, <naoya.horiguchi@....com>,
<james.morse@....com>, <jthoughton@...gle.com>, <somasundaram.a@....com>,
<erdemaktas@...gle.com>, <pgonda@...gle.com>, <duenwen@...gle.com>,
<gthelen@...gle.com>, <wschwartz@...erecomputing.com>,
<dferguson@...erecomputing.com>, <wbs@...amperecomputing.com>,
<nifan.cxl@...il.com>, <tanxiaofei@...wei.com>, <prime.zeng@...ilicon.com>,
<roberto.sassu@...wei.com>, <kangkang.shen@...urewei.com>,
<wanghuiqiang@...wei.com>, <linuxarm@...wei.com>, <shiju.jose@...wei.com>
Subject: Re: [PATCH v2 5/8] cxl/mbox: Add support for PERFORM_MAINTENANCE
mailbox command
shiju.jose@ wrote:
> From: Shiju Jose <shiju.jose@...wei.com>
>
> Add support for PERFORM_MAINTENANCE mailbox command.
>
> CXL spec 3.2 section 8.2.10.7.1 describes the Perform Maintenance command.
> This command requests the device to execute the maintenance operation
> specified by the maintenance operation class and the maintenance operation
> subclass.
>
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
> Reviewed-by: Dave Jiang <dave.jiang@...el.com>
> Signed-off-by: Shiju Jose <shiju.jose@...wei.com>
> ---
> drivers/cxl/core/mbox.c | 34 ++++++++++++++++++++++++++++++++++
> drivers/cxl/cxlmem.h | 17 +++++++++++++++++
> 2 files changed, 51 insertions(+)
>
> diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
> index d72764056ce6..19d46a284650 100644
> --- a/drivers/cxl/core/mbox.c
> +++ b/drivers/cxl/core/mbox.c
> @@ -824,6 +824,40 @@ static const uuid_t log_uuid[] = {
> [VENDOR_DEBUG_UUID] = DEFINE_CXL_VENDOR_DEBUG_UUID,
> };
>
> +int cxl_do_maintenance(struct cxl_mailbox *cxl_mbox,
> + u8 class, u8 subclass,
> + void *data_in, size_t data_in_size)
> +{
> + struct cxl_memdev_maintenance_pi {
> + struct cxl_mbox_do_maintenance_hdr hdr;
Please call this "perform_maintenance" because "do_" is usually a
Linux-ism for a core helper.
Also fold this patch into the caller that needs it.
> + u8 data[];
> + } __packed;
> + struct cxl_mbox_cmd mbox_cmd;
> + size_t hdr_size;
> +
> + struct cxl_memdev_maintenance_pi *pi __free(kfree) =
> + kmalloc(cxl_mbox->payload_size, GFP_KERNEL);
s/kmalloc/kvzalloc/
if (!pi)
return -ENOMEM;
> + pi->hdr.op_class = class;
> + pi->hdr.op_subclass = subclass;
> + hdr_size = sizeof(pi->hdr);
> + /*
> + * Check minimum mbox payload size is available for
> + * the maintenance data transfer.
> + */
> + if (hdr_size + data_in_size > cxl_mbox->payload_size)
> + return -ENOMEM;
-EINVAL
> +
> + memcpy(pi->data, data_in, data_in_size);
> + mbox_cmd = (struct cxl_mbox_cmd) {
> + .opcode = CXL_MBOX_OP_DO_MAINTENANCE,
> + .size_in = hdr_size + data_in_size,
> + .payload_in = pi,
> + };
> +
> + return cxl_internal_send_cmd(cxl_mbox, &mbox_cmd);
> +}
> +EXPORT_SYMBOL_NS_GPL(cxl_do_maintenance, "CXL");
Why? There is nothing in this function that needs the rest of mbox.c
beyond cxl_internal_send_cmd which is already exported. Just define this
in the only object that needs it.
Powered by blists - more mailing lists