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

Re: [PATCH v5 6/6] xen/arm: ffa: Enable VM to VM without firmware


  • To: Jens Wiklander <jens.wiklander@xxxxxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Thu, 22 May 2025 08:17:57 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 4.158.2.129) smtp.rcpttodomain=linaro.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=2; 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=n1XRav/QsWkRMbyiOydWxzIelX1zYefLFVrxxInw+rE=; b=h8GAUzS1PC9ROwmbp3m3s+xFRoDz9gd59hz1487OR/lJQEq998RZPOiySYMB/nSiEqPs+qP1KoDF4VVjz/8ufb2XNKndj/lFdXtP3sPZQL3JWPNnPoeyJTwrTrhI6w1uxlNfHXUs1eIr9OBreyu+wck71T+HG+0+rJI2fM/TkUNpMjkLM8S2yZpgY7xscRjKyE8ge8ohI1VBKaqxFrMBxGh09uHt9aw8vMvoY4oMI6LdMAAIztLhnKeXbPKBQL/t2ND3YvkCG/AICpBSws5up21h2aDgqQY3aE7HBTltSl2Z7mX/Gx/E1uibwvYkQ6jw7kutkHxQAGIJ8b4j8v5DPA==
  • 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=n1XRav/QsWkRMbyiOydWxzIelX1zYefLFVrxxInw+rE=; b=fN6H5/WktnXCTdwI0FckpS1/f6ywNhfuoWWFtcXv5oaf9ieYLEcugEAlJYNutBkl/HdE37+YSqB/nuYGzS0ge4RAoxexGu4LeAW7B0Et+4tjAGJD9G/U4x3zsG2rXaS0xDX3nqDU+kCXYj/VB0s906WBsXQatYs6mxS0fGj4F1KaVKrOFq/6Ya0M8eH4V0l0l7FXOjn0Ib7oBVhEel7PKCw47yML1zpDR0C4iqsU+EPg9TEQ1RnkaiWJ+YW4o0l/Nb9CzEp4nRutMlIQRHuTHjLkqLq9yovhN0dLbmpyMj09pvWg66T7pDp5cLYXyiYmOuM6HnQV0CvHzRiUh9GCyw==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=XiUQ+wxjWeixToppqnxffnbDdFQadeIZuOpSfCV/SQ+XvS4DoeT5VUOoff7h+afMHhRTZ/t+EujXzA4n7Ha719Ye+U1SXAW1/t2Jd5Ogdzppcg4nK4Fld2biO+LGe5bkkCR+SSIcvF/Qse2HRHzutfzACC1rfjSWgCdWJjkq3hA7+vQj9LQfdntvq4PeKPs6OU9pFsmMTTbzOcFBZ44aODaZwtFqBXz2m+RRygrIafAjGT6M7MayurwBOmvt72koj38JAQtk/5j4SstEM1OWChs4kK+u0Xj3XzkEsttdW8wmiFGz/jBKJXZ8mCP0V7DBq3vVMV1BldeNJbT0OOF1MQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=eUYIF6EWDqGdnc8VnsRYmEQjmauoyBCCiourvv2tWmlS1nhE5ecp1IYpJh8SAiofF2YNcq0DlAfsBRUUJk4NYsbcssOIRm1QKrwoJjqGsyYyLoyJXxiEPViAUHmLi/GSUziqW4UtAaBeDa729OZMv6MQeHmFzI2hgUQVVGthxUSqYc9qemPQrRYdRBvkT1DqsLEMjhfKyq7RmVySDTZWryWRyxK1uSu4bS/XHw4SjU2/0kDykhDEJNfqPPFNuetRlF8Hssy+c5yV/V1R4V4zu0eYGLuxtiAvaFy6EYm/Q4OuEoG524rvYfGnIAO2zk8qQAp1BdihB86R5rqXgSmPKA==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>
  • Delivery-date: Thu, 22 May 2025 08:18:45 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Thread-index: AQHbrqLcLBT6scPDY02nTshBGWfMDLPegcqAgAAE8IA=
  • Thread-topic: [PATCH v5 6/6] xen/arm: ffa: Enable VM to VM without firmware

Hi Jens,

> On 22 May 2025, at 10:00, Jens Wiklander <jens.wiklander@xxxxxxxxxx> wrote:
> 
> Hi Bertrand,
> 
> On Wed, Apr 16, 2025 at 9:40 AM Bertrand Marquis
> <bertrand.marquis@xxxxxxx> wrote:
>> 
>> When VM to VM support is activated and there is no suitable FF-A support
>> in the firmware, enable FF-A support for VMs to allow using it for VM to
>> VM communications.
>> If there is OP-TEE running in the secure world and using the non FF-A
>> communication system, having CONFIG_FFA_VM_TO_VM could be non functional
>> (if optee is probed first) or OP-TEE could be non functional (if FF-A is
>> probed first) so it is not recommended to activate the configuration
>> option for such systems.
>> 
>> To make buffer full notification work between VMs when there is no
>> firmware, rework the notification handling and modify the global flag to
>> only be used as check for firmware notification support instead.
>> 
>> Signed-off-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>
>> ---
>> Changes in v5:
>> - init ctx list when there is no firmware
>> - rework init a bit to prevent duplicates
>> - Remove Jens R-b due to changes done
>> Changes in v4:
>> - Fix Optee to OP-TEE in commit message
>> - Add Jens R-b
>> Changes in v3:
>> - fix typos in commit message
>> - add spaces around <<
>> - move notification id fix back into buffer full patch
>> - fix | position in if
>> Changes in v2:
>> - replace ifdef with IS_ENABLED when possible
>> ---
>> xen/arch/arm/tee/ffa.c       |  24 ++++++--
>> xen/arch/arm/tee/ffa_notif.c | 104 ++++++++++++++++-------------------
>> 2 files changed, 67 insertions(+), 61 deletions(-)
>> 
>> diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
>> index c1c4c0957091..b86c88cefa8c 100644
>> --- a/xen/arch/arm/tee/ffa.c
>> +++ b/xen/arch/arm/tee/ffa.c
>> @@ -342,8 +342,9 @@ static int ffa_domain_init(struct domain *d)
>>     struct ffa_ctx *ctx;
>>     int ret;
>> 
>> -    if ( !ffa_fw_version )
>> +    if ( !IS_ENABLED(CONFIG_FFA_VM_TO_VM) && !ffa_fw_version )
>>         return -ENODEV;
>> +
>>     /*
>>      * We are using the domain_id + 1 as the FF-A ID for VMs as FF-A ID 0 is
>>      * reserved for the hypervisor and we only support secure endpoints using
>> @@ -579,11 +580,8 @@ static bool ffa_probe(void)
>>         goto err_rxtx_destroy;
>> 
>>     ffa_notif_init();
>> -    INIT_LIST_HEAD(&ffa_teardown_head);
>> -    INIT_LIST_HEAD(&ffa_ctx_head);
>> -    init_timer(&ffa_teardown_timer, ffa_teardown_timer_callback, NULL, 0);
>> 
>> -    return true;
>> +    goto exit;
>> 
>> err_rxtx_destroy:
>>     ffa_rxtx_destroy();
>> @@ -592,6 +590,22 @@ err_no_fw:
>>     bitmap_zero(ffa_fw_abi_supported, FFA_ABI_BITMAP_SIZE);
>>     printk(XENLOG_WARNING "ARM FF-A No firmware support\n");
>> 
>> +exit:
>> +    if ( IS_ENABLED(CONFIG_FFA_VM_TO_VM) || ffa_fw_version )
>> +    {
>> +        INIT_LIST_HEAD(&ffa_teardown_head);
>> +        INIT_LIST_HEAD(&ffa_ctx_head);
>> +        init_timer(&ffa_teardown_timer, ffa_teardown_timer_callback, NULL, 
>> 0);
>> +    }
>> +
>> +    if ( IS_ENABLED(CONFIG_FFA_VM_TO_VM) )
>> +    {
>> +        printk(XENLOG_INFO "ARM FF-A only available between VMs\n");
> 
> This should only be printed if ffa_fw_version == 0

Right i will fix but ...

> 
>> +        return true;
>> +    }
>> +    else if ( ffa_fw_version )
> 
> The else isn't needed.

the else is needed so that we return true and not false.

We have 3 cases:
- firmware is there: return true
- firmware not there but vm to vm enable: return true
- otherwise: return false

I will modify it like this to make it clearer:
diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
index 57b648a22840..768b4e9ec968 100644
--- a/xen/arch/arm/tee/ffa.c
+++ b/xen/arch/arm/tee/ffa.c
@@ -601,13 +601,13 @@ exit:
         init_timer(&ffa_teardown_timer, ffa_teardown_timer_callback, NULL, 0);
     }

-    if ( IS_ENABLED(CONFIG_FFA_VM_TO_VM) )
+    if ( ffa_fw_version )
+        return true;
+    else if ( IS_ENABLED(CONFIG_FFA_VM_TO_VM) )
     {
         printk(XENLOG_INFO "ARM FF-A only available between VMs\n");
         return true;
     }
-    else if ( ffa_fw_version )
-        return true;

     return false;
 }

Tell me if you agree.

Cheers
Bertrand


 


Rackspace

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