mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dinh Nguyen <dinguyen@kernel.org>
To: hang.suan.wang@altera.com,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org,
	"Michael S . Tsirkin" <mst@redhat.com>,
	Huacai Chen <chenhuacai@kernel.org>,
	Florian Fainelli <florian.fainelli@broadcom.com>,
	Chen-Yu Tsai <wenst@chromium.org>
Cc: muhammad.nazim.amirul.nazle.asmade@altera.com,
	tze.yee.ng@altera.com, chee.nouk.phoon@altera.com,
	genevieve.chan@altera.com, adrian.ho.yin.ng@altera.com
Subject: Re: [PATCH v5 2/3] firmware: stratix10-svc: add FCS crypto-service commands for Agilex 5
Date: Wed, 23 Sep 2026 11:56:06 -0500	[thread overview]
Message-ID: <8f2a6acf-05d3-4463-92ae-d79f331ff4be@kernel.org> (raw)
In-Reply-To: <7c566ebe4024ef5c827de37a26c950ce9c202769.1789448407.git.hang.suan.wang@altera.com>

Hi Hang Suan,

On 9/15/26 03:25, hang.suan.wang@altera.com wrote:
> From: Hang Suan Wang <hang.suan.wang@altera.com>
> 
> The Agilex 5 Secure Device Manager (SDM 1.5) exposes an FPGA Crypto
> Service (FCS) over the existing SIP SMC mailbox: a session-based
> interface for crypto primitives such as SDOS (Secure Data Object
> Service) encrypt/decrypt. The service layer has no command to drive it
> yet.
> 
> Configure stratix10-svc about this interface so an in-kernel FCS client
> can use it:
> 
>    - add the client command codes COMMAND_FCS_CRYPTO_OPEN_SESSION,
>      COMMAND_FCS_CRYPTO_CLOSE_SESSION and COMMAND_FCS_SDOS_DATA_EXT (all
>      asynchronous)
> 
>    - add the matching asynchronous SIP SMC function IDs
>      (INTEL_SIP_SMC_ASYNC_FCS_OPEN_CS_SESSION,
>      INTEL_SIP_SMC_ASYNC_FCS_CLOSE_CS_SESSION and
>      INTEL_SIP_SMC_ASYNC_FCS_CRYPTION_EXT) with their register-usage
>      documentation;
> 
>    - match "intel,agilex5-svc" and register a "stratix10-fcs" child
>      platform device, mirroring the existing RSU child, so an FCS client
>      driver can bind without a dedicated device-tree node;
> 
>    - dispatch the new commands in the asynchronous send and response
>      paths; for the SDOS data command, translate the source and
>      destination buffers (allocated from the service-layer gen_pool) to
>      physical addresses and pass them, together with the session/context
>      IDs and owner ID, to the SDM.
> 
> The transport is unchanged: Agilex 5 reuses the SIP SMC calling
> convention and async mailbox ABI the driver already implements, so no
> new transport mechanism is required.
> 
> The SDOS SMMU-remapped address slots currently carry the buffer
> physical addresses; SMMU remapping support is added in a follow-up
> series.
> 
> This is a prerequisite for the SoCFPGA FCS driver, the first in-tree
> consumer of these commands.
> 
> Signed-off-by: Hang Suan Wang <hang.suan.wang@altera.com>
> Reviewed-by: Dinh Nguyen <dinguyen@kernel.org>
> ---
>   drivers/firmware/stratix10-svc.c              | 59 +++++++++++++++--
>   include/linux/firmware/intel/stratix10-smc.h  | 64 +++++++++++++++++++
>   .../firmware/intel/stratix10-svc-client.h     | 16 +++++
>   3 files changed, 134 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/firmware/stratix10-svc.c b/drivers/firmware/stratix10-svc.c
> index 07345efeef0c..8ead4a3c4a1b 100644
> --- a/drivers/firmware/stratix10-svc.c
> +++ b/drivers/firmware/stratix10-svc.c
> @@ -46,6 +46,7 @@
>   
>   /* stratix10 service layer clients */
>   #define STRATIX10_RSU				"stratix10-rsu"
> +#define STRATIX10_FCS				"stratix10-fcs"
>   #define SOCFPGA_HWMON				"socfpga-hwmon"
>   
>   /* Maximum number of SDM client IDs. */
> @@ -106,10 +107,12 @@ struct stratix10_svc_chan;
>   /**
>    * struct stratix10_svc - svc private data
>    * @stratix10_svc_rsu: pointer to stratix10 RSU device
> + * @stratix10_svc_fcs: pointer to stratix10 FCS device
>    * @stratix10_svc_hwmon: pointer to stratix10 HWMON device
>    */
>   struct stratix10_svc {
>   	struct platform_device *stratix10_svc_rsu;
> +	struct platform_device *stratix10_svc_fcs;
>   	struct platform_device *stratix10_svc_hwmon;
>   };
>   
> @@ -1398,6 +1401,30 @@ int stratix10_svc_async_send(struct stratix10_svc_chan *chan, void *msg,
>   		STRATIX10_SIP_SMC_SET_TRANSACTIONID_X1(handle->transaction_id);
>   
>   	switch (p_msg->command) {
> +	case COMMAND_FCS_CRYPTO_OPEN_SESSION:
> +		args.a0 = INTEL_SIP_SMC_ASYNC_FCS_OPEN_CS_SESSION;
> +		break;
> +	case COMMAND_FCS_CRYPTO_CLOSE_SESSION:
> +		args.a0 = INTEL_SIP_SMC_ASYNC_FCS_CLOSE_CS_SESSION;
> +		args.a2 = p_msg->arg[0];
> +		break;
> +	case COMMAND_FCS_SDOS_DATA_EXT:
> +		args.a0 = INTEL_SIP_SMC_ASYNC_FCS_CRYPTION_EXT;
> +		args.a2 = p_msg->arg[0];
> +		args.a3 = p_msg->arg[1];
> +		args.a4 = p_msg->arg[2];
> +		/* payloads are allocated from the svc gen_pool; pass phys addr */
> +		args.a5 = gen_pool_virt_to_phys(ctrl->genpool,
> +						(unsigned long)p_msg->payload);
> +		args.a6 = p_msg->payload_length;
> +		args.a7 = gen_pool_virt_to_phys(ctrl->genpool,
> +						(unsigned long)p_msg->payload_output);

These calls to gen_pool_virt_to_phys() can fail.

<snip>

>    * Sync call to request temperature
> diff --git a/include/linux/firmware/intel/stratix10-svc-client.h b/include/linux/firmware/intel/stratix10-svc-client.h
> index 9bb46c3cb0f8..ffc1ac7c9785 100644
> --- a/include/linux/firmware/intel/stratix10-svc-client.h
> +++ b/include/linux/firmware/intel/stratix10-svc-client.h
> @@ -7,6 +7,8 @@
>   #ifndef __STRATIX10_SVC_CLIENT_H
>   #define __STRATIX10_SVC_CLIENT_H
>   
> +#include <linux/types.h>

I don't think you need the above include.


Dinh


  reply	other threads:[~2026-09-23 16:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-15  8:25 [PATCH v5 0/3] Add Altera SoCFPGA Crypto Service (FCS) driver hang.suan.wang
2026-09-15  8:25 ` [PATCH v5 1/3] firmware: stratix10-svc: increase args array hang.suan.wang
2026-09-15  8:25 ` [PATCH v5 2/3] firmware: stratix10-svc: add FCS crypto-service commands for Agilex 5 hang.suan.wang
2026-09-23 16:56   ` Dinh Nguyen [this message]
2026-09-15  8:25 ` [PATCH v5 3/3] firmware: socfpga-fcs: add Altera SoCFPGA FCS driver with SDOS hang.suan.wang

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=8f2a6acf-05d3-4463-92ae-d79f331ff4be@kernel.org \
    --to=dinguyen@kernel.org \
    --cc=adrian.ho.yin.ng@altera.com \
    --cc=chee.nouk.phoon@altera.com \
    --cc=chenhuacai@kernel.org \
    --cc=florian.fainelli@broadcom.com \
    --cc=genevieve.chan@altera.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hang.suan.wang@altera.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=muhammad.nazim.amirul.nazle.asmade@altera.com \
    --cc=tze.yee.ng@altera.com \
    --cc=wenst@chromium.org \
    /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®