From: Dinh Nguyen <dinguyen@kernel.org>
To: kah.jing.lee@intel.com
Cc: linux-kernel@vger.kernel.org, radu.bacrau@intel.com,
tien.sung.ang@intel.com, Teh Wen Ping <wen.ping.teh@intel.com>
Subject: Re: [PATCH 1/2 RESEND] firmware: stratix10-svc: Generic Mailbox Command
Date: Fri, 7 Jul 2023 14:53:34 -0500 [thread overview]
Message-ID: <161c5a69-dd26-a7ae-7548-efa45418f5aa@kernel.org> (raw)
In-Reply-To: <20230707080305.1722983-1-kah.jing.lee@intel.com>
On 7/7/23 03:03, kah.jing.lee@intel.com wrote:
> From: Teh Wen Ping <wen.ping.teh@intel.com>
>
> Add generic mailbox command that can support SDM command. User can use this
> command to send SDM mailbox command. User have to specified an input file
> which contain the command data and an output file for SDM response to be
> copied over.
>
> Signed-off-by: Teh Wen Ping <wen.ping.teh@intel.com>
> Signed-off-by: Kah Jing Lee <kah.jing.lee@intel.com>
> ---
> drivers/firmware/stratix10-svc.c | 18 +++++++++++++
> include/linux/firmware/intel/stratix10-smc.h | 25 +++++++++++++++++++
> .../firmware/intel/stratix10-svc-client.h | 5 ++++
> 3 files changed, 48 insertions(+)
>
> diff --git a/drivers/firmware/stratix10-svc.c b/drivers/firmware/stratix10-svc.c
> index 2d674126160f..430e8bf0bca9 100644
> --- a/drivers/firmware/stratix10-svc.c
> +++ b/drivers/firmware/stratix10-svc.c
> @@ -37,6 +37,7 @@
> #define SVC_NUM_CHANNEL 3
> #define FPGA_CONFIG_DATA_CLAIM_TIMEOUT_MS 200
> #define FPGA_CONFIG_STATUS_TIMEOUT_SEC 30
> +#define BYTE_TO_WORD_SIZE 4
>
> /* stratix10 service layer clients */
> #define STRATIX10_RSU "stratix10-rsu"
> @@ -361,6 +362,13 @@ static void svc_thread_recv_status_ok(struct stratix10_svc_data *p_data,
> cb_data->kaddr2 = svc_pa_to_va(res.a2);
> cb_data->kaddr3 = &res.a3;
> break;
> + case COMMAND_MBOX_SEND_CMD:
> + cb_data->status = BIT(SVC_STATUS_OK);
> + cb_data->kaddr1 = &res.a1;
> + /* SDM return size in u32 word. Convert size to u8 */
Check this comment. I don't see how this is accurate.
> + res.a2 = res.a2 * BYTE_TO_WORD_SIZE;
> + cb_data->kaddr2 = &res.a2;
> + break;
> default:
> pr_warn("it shouldn't happen\n");
> break;
> @@ -534,6 +542,15 @@ static int svc_normal_to_secure_thread(void *data)
> a1 = 0;
> a2 = 0;
> break;
> + case COMMAND_MBOX_SEND_CMD:
> + a0 = INTEL_SIP_SMC_MBOX_SEND_CMD;
> + a1 = pdata->arg[0];
> + a2 = (unsigned long)pdata->paddr;
> + a3 = (unsigned long)pdata->size / BYTE_TO_WORD_SIZE;
> + a4 = pdata->arg[1];
> + a5 = (unsigned long)pdata->paddr_output;
> + a6 = (unsigned long)pdata->size_output / BYTE_TO_WORD_SIZE;
> + break;
> default:
> pr_warn("it shouldn't happen\n");
> break;
> @@ -597,6 +614,7 @@ static int svc_normal_to_secure_thread(void *data)
> case COMMAND_FCS_DATA_ENCRYPTION:
> case COMMAND_FCS_DATA_DECRYPTION:
> case COMMAND_FCS_RANDOM_NUMBER_GEN:
> + case COMMAND_MBOX_SEND_CMD:
> cbdata->status = BIT(SVC_STATUS_INVALID_PARAM);
> cbdata->kaddr1 = NULL;
> cbdata->kaddr2 = NULL;
> diff --git a/include/linux/firmware/intel/stratix10-smc.h b/include/linux/firmware/intel/stratix10-smc.h
> index a718f853d457..ee80ca4bb0d0 100644
> --- a/include/linux/firmware/intel/stratix10-smc.h
> +++ b/include/linux/firmware/intel/stratix10-smc.h
> @@ -466,6 +466,31 @@ INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FPGA_CONFIG_COMPLETED_WRITE)
> #define INTEL_SIP_SMC_FIRMWARE_VERSION \
> INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_FIRMWARE_VERSION)
>
> +/**
> + * SMC call protocol for Mailbox, starting FUNCID from 60
> + *
> + * Call register usage:
> + * a0 INTEL_SIP_SMC_MBOX_SEND_CMD
> + * a1 mailbox command code
> + * a2 physical address that contain mailbox command data (not include header)
> + * a3 mailbox command data size in word
> + * a4 set to 0 for CASUAL, set to 1 for URGENT
> + * a5 physical address for secure firmware to put response data
> + * (not include header)
> + * a6 maximum size in word of physical address to store response data
> + * a7 not used
> + *
> + * Return status
> + * a0 INTEL_SIP_SMC_STATUS_OK, INTEL_SIP_SMC_STATUS_REJECTED or
> + * INTEL_SIP_SMC_STATUS_ERROR
> + * a1 mailbox error code
> + * a2 response data length in word
> + * a3 not used
> + */
> +#define INTEL_SIP_SMC_FUNCID_MBOX_SEND_CMD 60
> + #define INTEL_SIP_SMC_MBOX_SEND_CMD \
> + INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_MBOX_SEND_CMD)
> +
> /**
> * Request INTEL_SIP_SMC_SVC_VERSION
> *
> diff --git a/include/linux/firmware/intel/stratix10-svc-client.h b/include/linux/firmware/intel/stratix10-svc-client.h
> index 0c16037fd08d..60ed82112680 100644
> --- a/include/linux/firmware/intel/stratix10-svc-client.h
> +++ b/include/linux/firmware/intel/stratix10-svc-client.h
> @@ -118,6 +118,9 @@ struct stratix10_svc_chan;
> * @COMMAND_SMC_SVC_VERSION: Non-mailbox SMC SVC API Version,
> * return status is SVC_STATUS_OK
> *
> + * @COMMAND_MBOX_SEND_CMD: send generic mailbox command, return status is
> + * SVC_STATUS_OK or SVC_STATUS_ERROR
> + *
> * @COMMAND_RSU_DCMF_STATUS: query firmware for the DCMF status
> * return status is SVC_STATUS_OK or SVC_STATUS_ERROR
> *
> @@ -164,6 +167,8 @@ enum stratix10_svc_command_code {
> COMMAND_FCS_RANDOM_NUMBER_GEN,
> /* for general status poll */
> COMMAND_POLL_SERVICE_STATUS = 40,
> + /* for generic mailbox send command */
> + COMMAND_MBOX_SEND_CMD = 100,
> /* Non-mailbox SMC Call */
> COMMAND_SMC_SVC_VERSION = 200,
> };
next prev parent reply other threads:[~2023-07-07 19:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-07 8:01 [PATCH 0/2] Query the RSU SPT table offset to determine RSU page size kah.jing.lee
2023-07-07 8:03 ` [PATCH 1/2 RESEND] firmware: stratix10-svc: Generic Mailbox Command kah.jing.lee
2023-07-07 19:53 ` Dinh Nguyen [this message]
2023-07-16 6:50 ` Lee, Kah Jing
2023-07-07 8:03 ` [PATCH 2/2 RESEND] firmware: stratix10-rsu: query spt addresses kah.jing.lee
2023-07-07 19:54 ` Dinh Nguyen
2023-07-16 6:43 ` Lee, Kah Jing
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=161c5a69-dd26-a7ae-7548-efa45418f5aa@kernel.org \
--to=dinguyen@kernel.org \
--cc=kah.jing.lee@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=radu.bacrau@intel.com \
--cc=tien.sung.ang@intel.com \
--cc=wen.ping.teh@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
all inboxes | Powered by JetHome®