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

Re: [PATCH v2 01/10] xen/arm: ffa: Rework firmware discovery


  • To: Jens Wiklander <jens.wiklander@xxxxxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Wed, 23 Oct 2024 08:03:02 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.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=pEpm6YbZpc3RjaWIDZ83ATdNfsjNoI1zdoA2KN9Yzvo=; b=yc9zcj0jrWiPIcMGBnT+XeiMyrG2/hnat6mdkfNxc+F0GesqbOkUdw+IxMmsPIblpqRh6d5B31sLKixC3a7uBYw3GHYa3BY+tj0SnFiiW8+5MBqKSgkEszhsgqFPn3X8umfq9W8RF4YPFd61dyzyUMJPlcvdowk8aOxTAn5Qum0zzJK1ykD+FWVLwltQHF9upIPMObhmgW9HMOTt8bkvRV6B3WBBghwu72IBx4XtzSVd4/zVGDFtiJ2QG/ennxAZQ5X6a5mhyp0wcab5Pw5LGp6jqm3RTwjkpJo1SWYhe9ysuDF5Phe9g7JMzJG5kYwn0QJbv1CEFxO5laZcPp0IQQ==
  • 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=pEpm6YbZpc3RjaWIDZ83ATdNfsjNoI1zdoA2KN9Yzvo=; b=bWs3cLjR2vLBOVb/57I7uHD6AlPMia0g9CvnQWZHNYCc3PvEdHDQs4qmL6CTgs5dB4KQTcfoElnXrVNh4NOc7tH1Nx7V/oIxJYDEQfcGRj9eZ/PKi2vFzTVGOLzgbUJyQlKIHURDttQbm8MNF40nHnTa9tjQaxIiUCY3quhhG5SPYgYa2L+eciAhwUrjMHWihpsEpN0T+MpYW/jnyxNIx1HXuNHBrcbVyTSIz+3VE1zd0Kz8XWiIRPucHISL9yocqS8RQ3KBVryHQcMZXy6sw+KHgleB7GE7RuwBoY49nd2NVjzLGjs9xa3LwznI0OhFI+UVsNZLndKBLl4iwz2nXw==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=g9SNHBlJG6XaHc3B3ftsSWD/57YHmWWD2/4m91+A6LAm+5zuKbBXvH42bsZozPExGnEgfWw71142FSxSGx6SVmoGQft6OqfoB9aT5mYUdR14GfyLoJBfeKJmuPobmeEvmktrJpjWhBtQSJ4tko3hINOFIzrUaBKMROQgH4BEGhO3SJQZMM25eFLrc/aPlDJVU7GI0id7Qp2ImTMiYbR7ExesCDAfgzMuq1lPldQpP44eCJzzoe8I+xIdZdJgLJHz++676exHeoIk6wTtDwOnrUqx4u6ovJ2r4vsGhuUR8oTJ95VeWKRTVs9yltmneerPOhxDVDIZh3R3/ZQ4uRoLpg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=eDAFLVSrNBZHRGhpa35SveumG7oyHQjG2Dvrcgvb8bmKG/dypgx/WXqJHKVmczz+0ajiK9eE8+odjbBVTekb0iK/rlhxCVW1lK+7HvzQyW3WceAfl0dvDSUd1d6rKqxRhOPHzQWrdV+IDfh3RIbUaRvAiS8g2gT4crtO+SpheuC0ftNydCdJOENwZUpSJDE5CpD8dbxgMC0ZIsc2sT+2VjYrgiFKOXpSYBwbOkDzlBx+HsOQRtAr1t7Srq8zqS7genLC/lHSpFlhPWBziTBP2lGD3gq8z+pBadA9XoR8E4JOAPTN3qcDu7YSvB0I8jVQ6j67ZAm/QE9IvC1LVwdycw==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>
  • Delivery-date: Wed, 23 Oct 2024 08:03:29 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHbH6X1lwra/EHVREKaxzeIxsME2LKRdxGAgAKNjIA=
  • Thread-topic: [PATCH v2 01/10] xen/arm: ffa: Rework firmware discovery

Hi Jens,

> On 21 Oct 2024, at 19:03, Jens Wiklander <jens.wiklander@xxxxxxxxxx> wrote:
> 
> Hi Bertrand,
> 
> On Wed, Oct 16, 2024 at 10:32 AM Bertrand Marquis
> <bertrand.marquis@xxxxxxx> wrote:
>> 
>> Rework firmware discovery during probe:
>> - move prints into the probe
>> - rename ffa_version to ffa_fw_version as the variable identifies the
>>  version of the firmware and not the one we support
>> - add error prints when allocation fail during probe
>> 
>> No functional changes.
>> 
>> Signed-off-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>
>> ---
>> Changes in v2:
>> - Fix error message when we fail to retrieve ffa_version
>> - Move back printing the firmware version before checking supported
>>  features
>> - Use Warning instead of Info to inform user that FF-A is not supported
>>  in firmware.
>> ---
>> xen/arch/arm/tee/ffa.c | 44 ++++++++++++++++++++++++++----------------
>> 1 file changed, 27 insertions(+), 17 deletions(-)
>> 
>> diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
>> index 022089278e1c..1cc4023135d5 100644
>> --- a/xen/arch/arm/tee/ffa.c
>> +++ b/xen/arch/arm/tee/ffa.c
>> @@ -71,8 +71,8 @@
>> 
>> #include "ffa_private.h"
>> 
>> -/* Negotiated FF-A version to use with the SPMC */
>> -static uint32_t __ro_after_init ffa_version;
>> +/* Negotiated FF-A version to use with the SPMC, 0 if not there or 
>> supported */
>> +static uint32_t __ro_after_init ffa_fw_version;
>> 
>> 
>> /*
>> @@ -105,10 +105,7 @@ static bool ffa_get_version(uint32_t *vers)
>> 
>>     arm_smccc_1_2_smc(&arg, &resp);
>>     if ( resp.a0 == FFA_RET_NOT_SUPPORTED )
>> -    {
>> -        gprintk(XENLOG_ERR, "ffa: FFA_VERSION returned not supported\n");
>>         return false;
>> -    }
>> 
>>     *vers = resp.a0;
>> 
>> @@ -372,7 +369,7 @@ static int ffa_domain_init(struct domain *d)
>>     struct ffa_ctx *ctx;
>>     int ret;
>> 
>> -    if ( !ffa_version )
>> +    if ( !ffa_fw_version )
>>         return -ENODEV;
>>      /*
>>       * We can't use that last possible domain ID or ffa_get_vm_id() would
>> @@ -505,6 +502,9 @@ static bool ffa_probe(void)
>>      */
>>     BUILD_BUG_ON(PAGE_SIZE != FFA_PAGE_SIZE);
>> 
>> +    printk(XENLOG_INFO "ARM FF-A Mediator version %u.%u\n",
>> +           FFA_MY_VERSION_MAJOR, FFA_MY_VERSION_MINOR);
>> +
>>     /*
>>      * psci_init_smccc() updates this value with what's reported by EL-3
>>      * or secure world.
>> @@ -514,22 +514,24 @@ static bool ffa_probe(void)
>>         printk(XENLOG_ERR
>>                "ffa: unsupported SMCCC version %#x (need at least %#x)\n",
>>                smccc_ver, ARM_SMCCC_VERSION_1_2);
>> -        return false;
>> +        goto err_no_fw;
>>     }
>> 
>>     if ( !ffa_get_version(&vers) )
>> -        return false;
>> +    {
>> +        gprintk(XENLOG_ERR, "Cannot retrieve the FFA version\n");
>> +        goto err_no_fw;
>> +    }
>> 
>>     if ( vers < FFA_MIN_SPMC_VERSION || vers > FFA_MY_VERSION )
>>     {
>>         printk(XENLOG_ERR "ffa: Incompatible version %#x found\n", vers);
>> -        return false;
>> +        goto err_no_fw;
>>     }
>> 
>> -    major_vers = (vers >> FFA_VERSION_MAJOR_SHIFT) & FFA_VERSION_MAJOR_MASK;
>> +    major_vers = (vers >> FFA_VERSION_MAJOR_SHIFT)
>> +                 & FFA_VERSION_MAJOR_MASK;
> 
> Spurious change?

Yes, I will fix that in next version.

> 
>>     minor_vers = vers & FFA_VERSION_MINOR_MASK;
>> -    printk(XENLOG_INFO "ARM FF-A Mediator version %u.%u\n",
>> -           FFA_MY_VERSION_MAJOR, FFA_MY_VERSION_MINOR);
> 
> It's not a big deal, but isn't it useful to know which version we're
> at? If it's too much with a separate line, how about adding "(our
> version %u.u%)" at the end of the line below?

This was moved up.

> 
>>     printk(XENLOG_INFO "ARM FF-A Firmware version %u.%u\n",
>>            major_vers, minor_vers);
>> 
>> @@ -546,12 +548,18 @@ static bool ffa_probe(void)
>>          !check_mandatory_feature(FFA_MEM_SHARE_32) ||
>>          !check_mandatory_feature(FFA_MEM_RECLAIM) ||
>>          !check_mandatory_feature(FFA_MSG_SEND_DIRECT_REQ_32) )
>> -        return false;
>> +    {
>> +        printk(XENLOG_ERR "ffa: Mandatory feature not supported by fw\n");
>> +        goto err_no_fw;
>> +    }
>> 
>> -    if ( !ffa_rxtx_init() )
>> -        return false;
>> +    ffa_fw_version = vers;
>> 
>> -    ffa_version = vers;
>> +    if ( !ffa_rxtx_init() )
>> +    {
>> +        printk(XENLOG_ERR "ffa: Error during RXTX buffer init\n");
> 
> With this added, wouldn't it make sense to remove the error print in
> ffa_rxtx_init()?

Definitely, I missed that.
Will fix in v3.

Cheers
Bertrand

> 
> Cheers,
> Jens
> 
>> +        goto err_no_fw;
>> +    }
>> 
>>     if ( !ffa_partinfo_init() )
>>         goto err_rxtx_destroy;
>> @@ -564,7 +572,9 @@ static bool ffa_probe(void)
>> 
>> err_rxtx_destroy:
>>     ffa_rxtx_destroy();
>> -    ffa_version = 0;
>> +err_no_fw:
>> +    ffa_fw_version = 0;
>> +    printk(XENLOG_WARNING "ARM FF-A No firmware support\n");
>> 
>>     return false;
>> }
>> --
>> 2.47.0



 


Rackspace

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