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

[xen staging] xen/arm: ffa: support FFA_FEATURES



commit 538ab07badd6858207fb187b42103dbf820864bc
Author:     Jens Wiklander <jens.wiklander@xxxxxxxxxx>
AuthorDate: Mon Mar 25 10:39:04 2024 +0100
Commit:     Stefano Stabellini <stefano.stabellini@xxxxxxx>
CommitDate: Wed Apr 3 16:20:17 2024 -0700

    xen/arm: ffa: support FFA_FEATURES
    
    Add support for the mandatory FF-A ABI function FFA_FEATURES.
    
    Signed-off-by: Jens Wiklander <jens.wiklander@xxxxxxxxxx>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>
---
 xen/arch/arm/tee/ffa.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)

diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
index 4f7775b8c8..8665201e34 100644
--- a/xen/arch/arm/tee/ffa.c
+++ b/xen/arch/arm/tee/ffa.c
@@ -192,6 +192,60 @@ out:
                  resp.a7 & mask);
 }
 
+static void handle_features(struct cpu_user_regs *regs)
+{
+    uint32_t a1 = get_user_reg(regs, 1);
+    unsigned int n;
+
+    for ( n = 2; n <= 7; n++ )
+    {
+        if ( get_user_reg(regs, n) )
+        {
+            ffa_set_regs_error(regs, FFA_RET_NOT_SUPPORTED);
+            return;
+        }
+    }
+
+    switch ( a1 )
+    {
+    case FFA_ERROR:
+    case FFA_VERSION:
+    case FFA_SUCCESS_32:
+    case FFA_SUCCESS_64:
+    case FFA_FEATURES:
+    case FFA_ID_GET:
+    case FFA_RX_RELEASE:
+    case FFA_RXTX_UNMAP:
+    case FFA_MEM_RECLAIM:
+    case FFA_PARTITION_INFO_GET:
+    case FFA_MSG_SEND_DIRECT_REQ_32:
+    case FFA_MSG_SEND_DIRECT_REQ_64:
+        ffa_set_regs_success(regs, 0, 0);
+        break;
+    case FFA_MEM_SHARE_64:
+    case FFA_MEM_SHARE_32:
+        /*
+         * We currently don't support dynamically allocated buffers. Report
+         * that with 0 in bit[0] of w2.
+         */
+        ffa_set_regs_success(regs, 0, 0);
+        break;
+    case FFA_RXTX_MAP_64:
+    case FFA_RXTX_MAP_32:
+        /*
+         * We currently support 4k pages only, report that as 00 in
+         * bit[0:1] in w0. This needs to be revised if Xen page size
+         * differs from FFA_PAGE_SIZE (SZ_4K).
+         */
+        BUILD_BUG_ON(PAGE_SIZE != FFA_PAGE_SIZE);
+        ffa_set_regs_success(regs, 0, 0);
+        break;
+    default:
+        ffa_set_regs_error(regs, FFA_RET_NOT_SUPPORTED);
+        break;
+    }
+}
+
 static bool ffa_handle_call(struct cpu_user_regs *regs)
 {
     uint32_t fid = get_user_reg(regs, 0);
@@ -212,6 +266,9 @@ static bool ffa_handle_call(struct cpu_user_regs *regs)
     case FFA_ID_GET:
         ffa_set_regs_success(regs, ffa_get_vm_id(d), 0);
         return true;
+    case FFA_FEATURES:
+        handle_features(regs);
+        return true;
     case FFA_RXTX_MAP_32:
     case FFA_RXTX_MAP_64:
         e = ffa_handle_rxtx_map(fid, get_user_reg(regs, 1),
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

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