From: Yazen Ghannam <yazen.ghannam@amd.com>
To: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>
Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
linux-edac@vger.kernel.org, git@amd.com,
Krzysztof Kozlowski <krzk@kernel.org>,
Rob Herring <robh@kernel.org>, Conor Dooley <conor+dt@kernel.org>,
Borislav Petkov <bp@alien8.de>, Tony Luck <tony.luck@intel.com>,
James Morse <james.morse@arm.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Robert Richter <rric@kernel.org>,
Nipun Gupta <nipun.gupta@amd.com>,
Nikhil Agarwal <nikhil.agarwal@amd.com>
Subject: Re: [PATCH v7 2/5] cdx: Export Symbols for MCDI RPC and Initialization
Date: Fri, 13 Jun 2025 16:10:34 -0400 [thread overview]
Message-ID: <20250613201034.GC171759@yaz-khff2.amd.com> (raw)
In-Reply-To: <20250529070017.7288-3-shubhrajyoti.datta@amd.com>
On Thu, May 29, 2025 at 12:30:14PM +0530, Shubhrajyoti Datta wrote:
> The cdx_mcdi_init, cdx_mcdi_process_cmd, and cdx_mcdi_rpc functions are
> needed by VersalNET EDAC modules that interact with the MCDI (Management
> Controller Direct Interface) framework. These functions facilitate
> communication between different hardware components by enabling command
> execution and status management.
>
> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>
> ---
>
> Changes in v7:
> - Add the kernel doc description
> - Add the prototype from first patch to here
>
> Changes in v6:
> - Update commit description
>
> Changes in v2:
> - Export the symbols for module compilation
>
> drivers/cdx/controller/mcdi.c | 29 +++++++++++++++++++++++++++++
> include/linux/cdx/mcdi.h | 6 ++++++
You've added the function prototypes to this new global header.
But you didn't remove them from the local header.
drivers/cdx/controller/mcdi.h
Also, you haven't included the new global header in the cdx/controller
code.
Even though this does compile, it doesn't seem proper.
I expect you would want to do the following:
1) Add the common code to the global header.
2) Remove the common code from the local header.
3) Include the global header everywhere the common code is needed.
Keeping the diff below for reference.
Thanks,
Yazen
> 2 files changed, 35 insertions(+)
>
> diff --git a/drivers/cdx/controller/mcdi.c b/drivers/cdx/controller/mcdi.c
> index e760f8d347cc..f3cca4c884ff 100644
> --- a/drivers/cdx/controller/mcdi.c
> +++ b/drivers/cdx/controller/mcdi.c
> @@ -99,6 +99,19 @@ static unsigned long cdx_mcdi_rpc_timeout(struct cdx_mcdi *cdx, unsigned int cmd
> return cdx->mcdi_ops->mcdi_rpc_timeout(cdx, cmd);
> }
>
> +/**
> + * cdx_mcdi_init - Initialize MCDI (Management Controller Driver Interface) state
> + * @cdx: NIC through which to issue the command
> + *
> + * This function allocates and initializes internal MCDI structures and resources
> + * for the CDX device, including the workqueue, locking primitives, and command
> + * tracking mechanisms. It sets the initial operating mode and prepares the device
> + * for MCDI operations.
> + *
> + * Return:
> + * * 0 - on success
> + * * -ENOMEM - if memory allocation or workqueue creation fails
> + */
> int cdx_mcdi_init(struct cdx_mcdi *cdx)
> {
> struct cdx_mcdi_iface *mcdi;
> @@ -128,6 +141,7 @@ int cdx_mcdi_init(struct cdx_mcdi *cdx)
> fail:
> return rc;
> }
> +EXPORT_SYMBOL_GPL(cdx_mcdi_init);
>
> void cdx_mcdi_finish(struct cdx_mcdi *cdx)
> {
> @@ -553,6 +567,19 @@ static void cdx_mcdi_start_or_queue(struct cdx_mcdi_iface *mcdi,
> cdx_mcdi_cmd_start_or_queue(mcdi, cmd);
> }
>
> +/**
> + * cdx_mcdi_process_cmd - Process an incoming MCDI response
> + * @cdx: NIC through which to issue the command
> + * @outbuf: Pointer to the response buffer received from the management controller
> + * @len: Length of the response buffer in bytes
> + *
> + * This function handles a response from the management controller. It locates the
> + * corresponding command using the sequence number embedded in the header,
> + * completes the command if it is still pending, and initiates any necessary cleanup.
> + *
> + * The function assumes that the response buffer is well-formed and at least one
> + * dword in size.
> + */
> void cdx_mcdi_process_cmd(struct cdx_mcdi *cdx, struct cdx_dword *outbuf, int len)
> {
> struct cdx_mcdi_iface *mcdi;
> @@ -590,6 +617,7 @@ void cdx_mcdi_process_cmd(struct cdx_mcdi *cdx, struct cdx_dword *outbuf, int le
>
> cdx_mcdi_process_cleanup_list(mcdi->cdx, &cleanup_list);
> }
> +EXPORT_SYMBOL_GPL(cdx_mcdi_process_cmd);
>
> static void cdx_mcdi_cmd_work(struct work_struct *context)
> {
> @@ -757,6 +785,7 @@ int cdx_mcdi_rpc(struct cdx_mcdi *cdx, unsigned int cmd,
> return cdx_mcdi_rpc_sync(cdx, cmd, inbuf, inlen, outbuf, outlen,
> outlen_actual, false);
> }
> +EXPORT_SYMBOL_GPL(cdx_mcdi_rpc);
>
> /**
> * cdx_mcdi_rpc_async - Schedule an MCDI command to run asynchronously
> diff --git a/include/linux/cdx/mcdi.h b/include/linux/cdx/mcdi.h
> index 46e3f63b062a..1344119e9a2c 100644
> --- a/include/linux/cdx/mcdi.h
> +++ b/include/linux/cdx/mcdi.h
> @@ -169,6 +169,12 @@ struct cdx_mcdi_data {
> u32 fn_flags;
> };
>
> +int cdx_mcdi_init(struct cdx_mcdi *cdx);
> +void cdx_mcdi_process_cmd(struct cdx_mcdi *cdx, struct cdx_dword *outbuf, int len);
> +int cdx_mcdi_rpc(struct cdx_mcdi *cdx, unsigned int cmd,
> + const struct cdx_dword *inbuf, size_t inlen,
> + struct cdx_dword *outbuf, size_t outlen, size_t *outlen_actual);
> +
> /*
> * We expect that 16- and 32-bit fields in MCDI requests and responses
> * are appropriately aligned, but 64-bit fields are only
> --
> 2.34.1
>
next prev parent reply other threads:[~2025-06-13 20:10 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-29 7:00 [PATCH v7 0/5] EDAC/Versal NET: Add support for error notification Shubhrajyoti Datta
2025-05-29 7:00 ` [PATCH v7 1/5] cdx: add the headers to include/linux Shubhrajyoti Datta
2025-06-13 19:59 ` Yazen Ghannam
2025-05-29 7:00 ` [PATCH v7 2/5] cdx: Export Symbols for MCDI RPC and Initialization Shubhrajyoti Datta
2025-06-13 20:10 ` Yazen Ghannam [this message]
2025-06-16 12:20 ` Datta, Shubhrajyoti
2025-06-20 11:03 ` Datta, Shubhrajyoti
2025-07-02 10:27 ` Borislav Petkov
2025-05-29 7:00 ` [PATCH v7 3/5] ras: Export log_non_standard_event for External Usage Shubhrajyoti Datta
2025-05-29 7:00 ` [PATCH v7 4/5] dt-bindings: memory-controllers: Add support for Versal NET EDAC Shubhrajyoti Datta
2025-05-29 7:00 ` [PATCH v7 5/5] EDAC/VersalNET: Add support for error notification Shubhrajyoti Datta
2025-07-03 17:31 ` Borislav Petkov
2025-07-21 4:08 ` Datta, Shubhrajyoti
2025-05-30 14:12 ` [PATCH v7 0/5] EDAC/Versal NET: " Michal Simek
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=20250613201034.GC171759@yaz-khff2.amd.com \
--to=yazen.ghannam@amd.com \
--cc=bp@alien8.de \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=git@amd.com \
--cc=james.morse@arm.com \
--cc=krzk@kernel.org \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=nikhil.agarwal@amd.com \
--cc=nipun.gupta@amd.com \
--cc=robh@kernel.org \
--cc=rric@kernel.org \
--cc=shubhrajyoti.datta@amd.com \
--cc=tony.luck@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