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

Re: [PATCH v2 02/10] xen/arm: ffa: Rework feature discovery


  • To: Jens Wiklander <jens.wiklander@xxxxxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Wed, 23 Oct 2024 08:03:41 +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=1bAgEMeTfi8oPhogR0hpjNSHqI/H5dtGubT0r8NbpT8=; b=PCXz6j2K//IriLzdJ2E/wE2AC4wUterAKe8TS5pj00NlTRifmQqDrUiaJB4XH/dSWNZGGxULtcWJOPXyyNaUYOQfMNB+EjG4GoQB1P6Cy7eZbxoh/SxEDeHnyl9z1VDTIZZcalFpQthPyih+wzoXjy4cfl1mrEydqlkB5p3OxTIOcmnrOXvRiR00Mp2rb2x0PZM0XcEk2rPcY7hkF1HaTYe2ijrtTYyQRQSXaC2ijOqHQm8AFj4w9DsQdsLoZJpT0tv4oKjmy5aVnLRNw77YR4cP6+fy3Sa1IkNzQAAxVu/83NUJITtMfeFZReyHkyeXIQl8CVDQzj/OT+cek60Npg==
  • 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=1bAgEMeTfi8oPhogR0hpjNSHqI/H5dtGubT0r8NbpT8=; b=gwpOCMEb9B2ghKKOCSCQzsRCS0EMEnWDZXXJEYh5tgeOh7y/Ti5nma3o9VFMLBK21ABT8x6HOSVJ3ycjI6qVJ+pMtG+VegDKqSXsOcQR8vzHeHnT1LwiukSGyjXMYsiQdBueLE1RKRuhSixP+YbWZOZLNGivriTE5YpukgFrr39giun2KI0zSxH/vE1QoTAWhyIqQYcpR1GzyZCmb6HdCGEMM+zHBvBO1MZPeNaPMKLAEbAVomXyHaXUki9NMfDY2cESB1vRWeH+L3Tm82OuianDOz/hkosSnppl22ggvB9a5JzH9E/eBJLkuQNYfzolBpKwIfbjdSAzPXC1w/8TFA==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=KDgWp1i4PhciJVxPrMuth9U/dWL0Hnix7B3wspPG2pnxatfL/BsAKyErapUCfQnjWdLhLSjMNSQcWThfsD8v2x1cMquuQjlM/QkSh9n44AdqPnhkzihmmBmmsZUH17yWSNUce4ZcgQBifMCwRQneFpplZTU4HHWI0BgmBjvCQbxSZMk7XRAgBD56EGfQbrrgXf3mCJ29LrXy5tfIwipNleN9nSS3mezRUPeCw2gp748g8MOkbys/en7nWZPvozKY87ZI/MLRFZxjLoUYR3tXQvg7aW6KvX8WWylJj9Vl3pNKiFjKkKPBOjDwkAokBmYtlJ7koo8tNrQBY69vFvTYiw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gd54JUzHLqWnroeYxhiHPmWTu5ULJW+LC3NAi/SlR13/4CxDgn79LCLvcuRaDmtCQcSmg6ZW1m9V5xMEOWjzGGMLmw5YLm9/jRsZ1T8h/9EvA2uWo0hJOC5zdk5rwrYfbIIz+QJbbZAio31H9gVQwNvofV9dDETnSZgu86vfXh/+TAkqI1TrRb+03YhhHkF0ZVNnmToRChVDMZR/MzHKyueYC8SfMQqqtkyFkLOf8KLy6Wqk64MzHNgZy54ikaOjwij0EIpD3LIx3BPf6LdNJ2d3+VViMmzW6rG9hs/Thu5g1EYmAqx5Sd+1dgGkbqg0WE736duFqhxReIkf1ZhrEw==
  • 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:55 +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: AQHbH6X5MdxS7WyybUSgZAd64vdid7KSWI+AgAGsPoA=
  • Thread-topic: [PATCH v2 02/10] xen/arm: ffa: Rework feature discovery

Hi Jens,

> On 22 Oct 2024, at 08:30, Jens Wiklander <jens.wiklander@xxxxxxxxxx> wrote:
> 
> Hi Bertrand,
> 
> On Wed, Oct 16, 2024 at 10:32 AM Bertrand Marquis
> <bertrand.marquis@xxxxxxx> wrote:
>> 
>> Store the list of ABI we need in a list and go through the list instead
>> of having a list of conditions inside the code.
>> 
>> No functional change.
>> 
>> Signed-off-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>
>> ---
>> Changes in v2:
>> - Store a string version of ABI needed from firmware and print the name
>>  of the ABI not supported instead of the id
>> - Restore comment with TODO which should not have been removed at this
>>  stage
>> - fix to unsigned int the index in the loop on the array
>> - use abi instead of feature in the names of the functions and variables
>>  as we are not checking features but abis
>> ---
>> xen/arch/arm/tee/ffa.c | 57 +++++++++++++++++++++++++-----------------
>> 1 file changed, 34 insertions(+), 23 deletions(-)
>> 
>> diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
>> index 1cc4023135d5..dde932422ecf 100644
>> --- a/xen/arch/arm/tee/ffa.c
>> +++ b/xen/arch/arm/tee/ffa.c
>> @@ -74,6 +74,31 @@
>> /* Negotiated FF-A version to use with the SPMC, 0 if not there or supported 
>> */
>> static uint32_t __ro_after_init ffa_fw_version;
>> 
>> +struct ffa_fw_abi {
>> +    const uint32_t id;
> 
> I prefer removing the const attribute for this struct member since it
> doesn't add anything when the struct itself is const.

Works for me.
Will fix in v3.

Cheers
Bertrand

> 
> Cheers,
> Jens
> 
>> +    const char *name;
>> +};
>> +
>> +#define FW_ABI(abi) {abi,#abi}
>> +
>> +/* List of ABI we use from the firmware */
>> +static const struct ffa_fw_abi ffa_fw_abi_needed[] = {
>> +    FW_ABI(FFA_VERSION),
>> +    FW_ABI(FFA_FEATURES),
>> +    FW_ABI(FFA_NOTIFICATION_BITMAP_CREATE),
>> +    FW_ABI(FFA_NOTIFICATION_BITMAP_DESTROY),
>> +    FW_ABI(FFA_PARTITION_INFO_GET),
>> +    FW_ABI(FFA_NOTIFICATION_INFO_GET_64),
>> +    FW_ABI(FFA_NOTIFICATION_GET),
>> +    FW_ABI(FFA_RX_RELEASE),
>> +    FW_ABI(FFA_RXTX_MAP_64),
>> +    FW_ABI(FFA_RXTX_UNMAP),
>> +    FW_ABI(FFA_MEM_SHARE_32),
>> +    FW_ABI(FFA_MEM_SHARE_64),
>> +    FW_ABI(FFA_MEM_RECLAIM),
>> +    FW_ABI(FFA_MSG_SEND_DIRECT_REQ_32),
>> +    FW_ABI(FFA_MSG_SEND_DIRECT_REQ_64),
>> +};
>> 
>> /*
>>  * Our rx/tx buffers shared with the SPMC. FFA_RXTX_PAGE_COUNT is the
>> @@ -112,20 +137,9 @@ static bool ffa_get_version(uint32_t *vers)
>>     return true;
>> }
>> 
>> -static int32_t ffa_features(uint32_t id)
>> -{
>> -    return ffa_simple_call(FFA_FEATURES, id, 0, 0, 0);
>> -}
>> -
>> -static bool check_mandatory_feature(uint32_t id)
>> +static bool ffa_abi_supported(uint32_t id)
>> {
>> -    int32_t ret = ffa_features(id);
>> -
>> -    if ( ret )
>> -        printk(XENLOG_ERR "ffa: mandatory feature id %#x missing: error 
>> %d\n",
>> -               id, ret);
>> -
>> -    return !ret;
>> +    return !ffa_simple_call(FFA_FEATURES, id, 0, 0, 0);
>> }
>> 
>> static void handle_version(struct cpu_user_regs *regs)
>> @@ -540,17 +554,14 @@ static bool ffa_probe(void)
>>      * TODO: Rework the code to allow domain to use a subset of the
>>      * features supported.
>>      */
>> -    if ( !check_mandatory_feature(FFA_PARTITION_INFO_GET) ||
>> -         !check_mandatory_feature(FFA_RX_RELEASE) ||
>> -         !check_mandatory_feature(FFA_RXTX_MAP_64) ||
>> -         !check_mandatory_feature(FFA_MEM_SHARE_64) ||
>> -         !check_mandatory_feature(FFA_RXTX_UNMAP) ||
>> -         !check_mandatory_feature(FFA_MEM_SHARE_32) ||
>> -         !check_mandatory_feature(FFA_MEM_RECLAIM) ||
>> -         !check_mandatory_feature(FFA_MSG_SEND_DIRECT_REQ_32) )
>> +    for ( unsigned int i = 0; i < ARRAY_SIZE(ffa_fw_abi_needed); i++ )
>>     {
>> -        printk(XENLOG_ERR "ffa: Mandatory feature not supported by fw\n");
>> -        goto err_no_fw;
>> +        if ( !ffa_abi_supported(ffa_fw_abi_needed[i].id) )
>> +        {
>> +            printk(XENLOG_INFO "ARM FF-A Firmware does not support %s\n",
>> +                   ffa_fw_abi_needed[i].name);
>> +            goto err_no_fw;
>> +        }
>>     }
>> 
>>     ffa_fw_version = vers;
>> --
>> 2.47.0



 


Rackspace

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