[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 4/8] xen/arm: vsmc: Enable handling SiP-owned SCMI SMC calls


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: "Andrei Cherechesu (OSS)" <andrei.cherechesu@xxxxxxxxxxx>
  • Date: Mon, 30 Sep 2024 14:47:10 +0300
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=DoDhdTF0A/O26QnYxCxxYly+yAcFFjFRVafIQNru3ks=; b=qTj713nPY0q1JtOAEtohKEh3LtvoS1eauVmGxypPPFoLE/dxPTCA9ViMHqLN9QVKFwSu/6D128l6mWnESenoN0Y/mI9YSig7/XElcTWyoZeW9zM3M4UWCJVTSmknVDNQ4gTIyUYV4pEweJY+zX8COX7VldQHLjuP/U+uI1yct2FCh+CSGj+6alDHjTYF1q0WSK6tnpJbn7hg8yfOEjwQ/2niWO8hJanlTNRZb+w5y9oalSdvSqIF7rQP3Tg8A5w15b3upZ4w7tuz/8qo2I6A9M5N6LFuAo34VuTdy2RIsHG8jDayviC3iNHGQwd2C9Riv2v1LRQUROcKkvsYJY870Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=eswTL4dCWaUGm2FhyGxDJgZShHhEtcrCiidfky5fGZQRo5kU9YfB3F3Y550aoHZ59jqGm9L9SNc9HT+yHC3Ha74dZFoty/dXwvX2v7aysdBw4jzp0EHo+1SAq2yXLoLeXYzGW4kk2PQ0PDAVAmRf27Tn5aUq7oRMi8yhWDQ38On7SZEGUkh8iyCMtoeTUKr3RP6Pnne47jvg7/VhB4ONtFNgeldGIer+0WofFOIzuI8dC3T8V9mR+VdsPwdxz8ZujIibVN9zL6nkbe7EdoXEwrQVHU7y8WOSkitK36Brc3w2Zve4P5mBDZeTpGVsy5N8L0vAROhsiCDHKaLJYDK2Fg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com;
  • Cc: andrei.cherechesu@xxxxxxxxxxx, S32@xxxxxxx, Andrei Cherechesu <andrei.cherechesu@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Mon, 30 Sep 2024 11:47:45 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

From: Andrei Cherechesu <andrei.cherechesu@xxxxxxx>

Change the handling of SiP SMC calls to be more generic,
instead of directly relying on the `platform_smc()` callback
implementation.

Try to handle the SiP SMC first through the `platform_smc()`
callback (if implemented). If not handled, check if the
SCMI layer is available and that the SMC is a valid SCMI
message. Handle it then within the SCMI layer which forwards
it to EL3 FW, only if the SMC comes from Dom0.

Signed-off-by: Andrei Cherechesu <andrei.cherechesu@xxxxxxx>
---
 xen/arch/arm/vsmc.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/vsmc.c b/xen/arch/arm/vsmc.c
index 7f2f5eb9ce..0de194a132 100644
--- a/xen/arch/arm/vsmc.c
+++ b/xen/arch/arm/vsmc.c
@@ -14,6 +14,7 @@
 #include <asm/cpufeature.h>
 #include <asm/monitor.h>
 #include <asm/regs.h>
+#include <asm/scmi-smc.h>
 #include <asm/smccc.h>
 #include <asm/tee/ffa.h>
 #include <asm/tee/tee.h>
@@ -224,6 +225,22 @@ static bool handle_sssc(struct cpu_user_regs *regs)
     }
 }
 
+/* Secure Calls defined by the Silicon Provider (SiP) */
+static bool handle_sip(struct cpu_user_regs *regs)
+{
+    uint32_t fid = (uint32_t)get_user_reg(regs, 0);
+
+    /* Firstly, let each platform define custom handling for these SMCs */
+    if ( platform_smc(regs) )
+        return true;
+
+    /* Otherwise, if valid SCMI SMC, forward the call to EL3 */
+    if ( scmi_is_enabled() && scmi_is_valid_smc_id(fid) )
+        return scmi_handle_smc(regs);
+
+    return false;
+}
+
 /*
  * vsmccc_handle_call() - handle SMC/HVC call according to ARM SMCCC.
  * returns true if that was valid SMCCC call (even if function number
@@ -288,7 +305,7 @@ static bool vsmccc_handle_call(struct cpu_user_regs *regs)
             handled = handle_sssc(regs);
             break;
         case ARM_SMCCC_OWNER_SIP:
-            handled = platform_smc(regs);
+            handled = handle_sip(regs);
             break;
         case ARM_SMCCC_OWNER_TRUSTED_APP ... ARM_SMCCC_OWNER_TRUSTED_APP_END:
         case ARM_SMCCC_OWNER_TRUSTED_OS ... ARM_SMCCC_OWNER_TRUSTED_OS_END:
-- 
2.45.2




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.