All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@arm.com>
To: xen-devel@lists.xen.org
Cc: Julien Grall <julien.grall@arm.com>,
	sstabellini@kernel.org, andre.przywara@linaro.org
Subject: [PATCH 4/7] xen/arm: vsmc: Implement SMCCC 1.1
Date: Mon,  5 Feb 2018 13:20:06 +0000	[thread overview]
Message-ID: <20180205132011.27996-5-julien.grall@arm.com> (raw)
In-Reply-To: <20180205132011.27996-1-julien.grall@arm.com>

The new SMC Calling Convention (v1.1) allows for a reduced overhead when
calling into the firmware, and provides a new feature discovery
mechanism. See ARM DEN 00070A.

Signed-off-by: Julien Grall <julien.grall@arm.com>
---
 xen/arch/arm/vpsci.c        |  1 +
 xen/arch/arm/vsmc.c         | 23 +++++++++++++++++++++++
 xen/include/asm-arm/smccc.h | 15 +++++++++++++++
 3 files changed, 39 insertions(+)

diff --git a/xen/arch/arm/vpsci.c b/xen/arch/arm/vpsci.c
index 025250a119..e40ba5c5ad 100644
--- a/xen/arch/arm/vpsci.c
+++ b/xen/arch/arm/vpsci.c
@@ -215,6 +215,7 @@ static int32_t do_psci_1_0_features(uint32_t psci_func_id)
     case PSCI_0_2_FN32_AFFINITY_INFO:
     case PSCI_0_2_FN64_AFFINITY_INFO:
     case PSCI_1_0_FN32_PSCI_FEATURES:
+    case ARM_SMCCC_VERSION_FID:
         return 0;
     default:
         return PSCI_NOT_SUPPORTED;
diff --git a/xen/arch/arm/vsmc.c b/xen/arch/arm/vsmc.c
index 3d3bd95fee..a708aa5e81 100644
--- a/xen/arch/arm/vsmc.c
+++ b/xen/arch/arm/vsmc.c
@@ -81,6 +81,26 @@ static bool fill_function_call_count(struct cpu_user_regs *regs, uint32_t cnt)
     return true;
 }
 
+/* SMCCC interface for ARM Architecture */
+static bool handle_arch(struct cpu_user_regs *regs)
+{
+    uint32_t fid = (uint32_t)get_user_reg(regs, 0);
+
+    switch ( fid )
+    {
+    case ARM_SMCCC_VERSION_FID:
+        set_user_reg(regs, 0, ARM_SMCCC_VERSION_1_1);
+        return true;
+
+    case ARM_SMCCC_ARCH_FEATURES_FID:
+        /* Nothing supported yet */
+        set_user_reg(regs, 0, -1);
+        return true;
+    }
+
+    return false;
+}
+
 /* SMCCC interface for hypervisor. Tell about itself. */
 static bool handle_hypervisor(struct cpu_user_regs *regs)
 {
@@ -188,6 +208,9 @@ static bool vsmccc_handle_call(struct cpu_user_regs *regs)
     {
         switch ( smccc_get_owner(funcid) )
         {
+        case ARM_SMCCC_OWNER_ARCH:
+            handled = handle_arch(regs);
+            break;
         case ARM_SMCCC_OWNER_HYPERVISOR:
             handled = handle_hypervisor(regs);
             break;
diff --git a/xen/include/asm-arm/smccc.h b/xen/include/asm-arm/smccc.h
index 62b3a8cdf5..431389c118 100644
--- a/xen/include/asm-arm/smccc.h
+++ b/xen/include/asm-arm/smccc.h
@@ -16,6 +16,9 @@
 #ifndef __ASM_ARM_SMCCC_H__
 #define __ASM_ARM_SMCCC_H__
 
+#define ARM_SMCCC_VERSION_1_0   0x10000
+#define ARM_SMCCC_VERSION_1_1   0x10001
+
 /*
  * This file provides common defines for ARM SMC Calling Convention as
  * specified in
@@ -100,6 +103,18 @@ static inline uint32_t smccc_get_owner(register_t funcid)
                        ARM_SMCCC_OWNER_##owner,     \
                        0xFF03)
 
+#define ARM_SMCCC_VERSION_FID                       \
+    ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL,         \
+                       ARM_SMCCC_CONV_32,           \
+                       ARM_SMCCC_OWNER_ARCH,        \
+                       0x0)                         \
+
+#define ARM_SMCCC_ARCH_FEATURES_FID                 \
+    ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL,         \
+                       ARM_SMCCC_CONV_32,           \
+                       ARM_SMCCC_OWNER_ARCH,        \
+                       0x1)
+
 /* Only one error code defined in SMCCC */
 #define ARM_SMCCC_ERR_UNKNOWN_FUNCTION  (-1)
 
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2018-02-05 13:20 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-05 13:20 [PATCH 0/7] xen/arm: PSCI 1.1 and SMCCC-1.1 support and XSA-254 variant 2 update Julien Grall
2018-02-05 13:20 ` [PATCH 1/7] xen/arm: vpsci: Remove parameter 'ver' from do_common_cpu Julien Grall
2018-02-06 15:42   ` Volodymyr Babchuk
2018-02-08 18:12     ` Julien Grall
2018-02-09 12:36       ` Volodymyr Babchuk
2018-02-05 13:20 ` [PATCH 2/7] xen/arm: psci: Rework the PSCI definitions Julien Grall
2018-02-06 15:57   ` Volodymyr Babchuk
2018-02-05 13:20 ` [PATCH 3/7] xen/arm: vpsci: Add support for PSCI 1.1 Julien Grall
2018-02-06 16:07   ` Volodymyr Babchuk
2018-02-06 17:44     ` Julien Grall
2018-02-05 13:20 ` Julien Grall [this message]
2018-02-06 16:18   ` [PATCH 4/7] xen/arm: vsmc: Implement SMCCC 1.1 Volodymyr Babchuk
2018-02-06 18:04     ` Julien Grall
2018-02-07 13:39       ` Volodymyr Babchuk
2018-02-05 13:20 ` [PATCH 5/7] xen/arm: vsmc: Implement SMCCC_ARCH_WORKAROUND_1 BP hardening support Julien Grall
2018-02-06 16:23   ` Volodymyr Babchuk
2018-02-06 18:12     ` Julien Grall
2018-02-07 13:49       ` Volodymyr Babchuk
2018-02-05 13:20 ` [PATCH 6/7] xen/arm: Adapt smccc.h to be able to use it in assembly code Julien Grall
2018-02-06 16:25   ` Volodymyr Babchuk
2018-02-05 13:20 ` [PATCH 7/7] xen/arm64: Implement a fast path for handling SMCCC_ARCH_WORKAROUND_1 Julien Grall
2018-02-06 16:36   ` Volodymyr Babchuk
2018-02-06 18:33     ` Julien Grall
2018-02-07 13:42       ` Volodymyr Babchuk
2018-02-05 13:20 ` [PATCH 8/9] xen/arm: Park CPUs with a MIDR different from the boot CPU Julien Grall
2018-02-05 13:25   ` Julien Grall
2018-02-05 13:20 ` [PATCH 9/9] xen/arm: Help to know the hardening provided for a CPU Julien Grall
2018-02-05 13:25   ` Julien Grall
2018-02-08 16:26 ` [PATCH 0/7] xen/arm: PSCI 1.1 and SMCCC-1.1 support and XSA-254 variant 2 update Manish Jaggi
2018-02-08 16:28   ` Julien Grall

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=20180205132011.27996-5-julien.grall@arm.com \
    --to=julien.grall@arm.com \
    --cc=andre.przywara@linaro.org \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.