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

Re: [XEN PATCH] xen/arm: ffa: return fpi size from FFA_PARTITION_INFO_GET


  • To: Jens Wiklander <jens.wiklander@xxxxxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Mon, 18 Dec 2023 14:33:29 +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=armh.onmicrosoft.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=arcselector9901; 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=x9pe6Hl54WbPgNk6+QV3VbAQCeGyfQ8IlUWB1oI+Ddg=; b=IYbDOLd4qyEiF8j2MFrQxds8TsOWcBYOiTNut0KtaqHkvmlcDksW3UjyqVGKPyhJajaGLIUVjxQ0GEYQBKo/BADeNEHupa+Uf0WxNIVvf/l614+YSHWK45KFl/q3XZp84IbPnQSeATMQB1wAARUXsmpR7FA1f49JW/820C9N5v78wpEzoZytqHG8/MUnqES+l5e03SWl9u/SFIClrR8jEYRVPvwGe/XY2HEl0Cg1Gwb0ABgB2kmIz3h1o72c3O22HPBAiwB3rDI5BMCYWDbKD4qacHOESm/l2A/D30FBKpGXNtsJCiSb/b5ud5vIB9LwWZgeuMJfCMYaiHQAfdO85w==
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=x9pe6Hl54WbPgNk6+QV3VbAQCeGyfQ8IlUWB1oI+Ddg=; b=J23TM9YDQ6ooHPGFfGXH4jo0vF7immXVYtMwtq1wHmj1Am0zX1OoqyQkdwIJ0uOD1PiSaDspBk4PF2bAmM3BQiUns0aJlO1quFONhdhb0pnZltBuinB+AUdDrygmgLa/SEXWeo8zWsmOJTwogJ82szqaoXvCaX+uLWiwN/QBVnT3Hz7zn5IkFPkYG+1fBGPL7BPKLaiy8Fzo8EoBo0KGFAYnX303VNjpWIoVDkDn5ViDtjuz+c+cYALi6LNqMXVkUBv08oCYh1plsmoQf6jTLhQzSpo+12dhJOClDnkwYgvXAwwnI1EWaliCXvmM/H4eR/Y5O2iGmrSLp1V51RM8vg==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=ocGb9pjBkyq27ruxjv3QfafkOHvlgsojD+8feGZKKxBU9pDgsAZQySTdZBz6EgPUPgZFYXIBXEx2tODNhXBbXfiOFiNIy0qSUKFlq+P3B6zlwQV2zhfM+UHUV7CrJbzDpqTlbuhlnVy9VffwXs3hNbiCWMBS/m4WgomCF14gxdB96AgeoKw3Yr+WwMv//zRUJya7a+oGZDsG+6dlSRlXc1TTyOMHpmpiStIWddNeLGmkOGYe8Lq+XkJdxW7F4vplRnIOium95bi0vAlb3kQj5gdM/TOcYN2uVOSrjmcmHpTKs8zU+5OLevyDlvjQUBzDgsC1t5Cj2j9v+oxNUF3zGg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fcb4gzLZQjMM3vXwVsp4PmX1vfm7wPjXEkEFMrY2Mxmw1/JIQbCg/LShmf97WBN/wcNXkgXuSlbopLafubeiQk6kjf2zQk7fwNHy2XR8f858dgOuYSHnfph+JmUKIdhDJ2IXHx8rF9FAruyPaDcv3JMy0m7G0GwBe2JqFPn8MUKevX91Raye/jfNKHxojlXsMgLXOV8nS+YKH0s5bdDWXwOAVMqc4jUdAlapNkBub5Me+QwYmEx8aomds7tb5L311GBcfnzzUdSbwUPbVq4nLytcofD/h+LIqbk614MjMsgNN8ndMWPiaqgiUJ4q39GAUY0TPRzWhUuI1LiISTKyow==
  • 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>, "patches@xxxxxxxxxx" <patches@xxxxxxxxxx>, Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>
  • Delivery-date: Mon, 18 Dec 2023 14:33:51 +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: AQHaLa+UlQwUyLuLjkSJPyDwSlt2/7CvIukA
  • Thread-topic: [XEN PATCH] xen/arm: ffa: return fpi size from FFA_PARTITION_INFO_GET

Hi Jens,

> On 13 Dec 2023, at 11:31, Jens Wiklander <jens.wiklander@xxxxxxxxxx> wrote:
> 
> Until now has FFA_PARTITION_INFO_GET always returned zero in w3, but
> FF-A v1.1 requires FFA_PARTITION_INFO_GET to return the size of each
> partition information descriptor returned if
> FFA_PARTITION_INFO_GET_COUNT_FLAG isn't set.
> 

Good finding.

> The SPMC queried with FFA_PARTITION_INFO_GET must also return the each
> partition information descriptor returned so fix this by passing along
> the same value.
> 
> Fixes: caf6491e95a9 ("xen/arm: ffa: support guest FFA_PARTITION_INFO_GET")
> Signed-off-by: Jens Wiklander <jens.wiklander@xxxxxxxxxx>

Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>

Cheers
Bertrand

> ---
> xen/arch/arm/tee/ffa.c | 21 +++++++++++++--------
> 1 file changed, 13 insertions(+), 8 deletions(-)
> 
> diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
> index 183528d13388..1d4e0a083006 100644
> --- a/xen/arch/arm/tee/ffa.c
> +++ b/xen/arch/arm/tee/ffa.c
> @@ -514,7 +514,7 @@ static int32_t ffa_rxtx_map(paddr_t tx_addr, paddr_t 
> rx_addr,
> 
> static int32_t ffa_partition_info_get(uint32_t w1, uint32_t w2, uint32_t w3,
>                                       uint32_t w4, uint32_t w5,
> -                                      uint32_t *count)
> +                                      uint32_t *count, uint32_t *fpi_size)
> {
>     const struct arm_smccc_1_2_regs arg = {
>         .a0 = FFA_PARTITION_INFO_GET,
> @@ -531,7 +531,10 @@ static int32_t ffa_partition_info_get(uint32_t w1, 
> uint32_t w2, uint32_t w3,
> 
>     ret = get_ffa_ret_code(&resp);
>     if ( !ret )
> +    {
>         *count = resp.a2;
> +        *fpi_size = resp.a3;
> +    }
> 
>     return ret;
> }
> @@ -784,7 +787,7 @@ static uint32_t handle_rxtx_unmap(void)
> 
> static int32_t handle_partition_info_get(uint32_t w1, uint32_t w2, uint32_t 
> w3,
>                                          uint32_t w4, uint32_t w5,
> -                                         uint32_t *count)
> +                                         uint32_t *count, uint32_t *fpi_size)
> {
>     int32_t ret = FFA_RET_DENIED;
>     struct domain *d = current->domain;
> @@ -799,7 +802,7 @@ static int32_t handle_partition_info_get(uint32_t w1, 
> uint32_t w2, uint32_t w3,
>      */
>     if ( w5 == FFA_PARTITION_INFO_GET_COUNT_FLAG &&
>          ctx->guest_vers == FFA_VERSION_1_1 )
> -        return ffa_partition_info_get(w1, w2, w3, w4, w5, count);
> +        return ffa_partition_info_get(w1, w2, w3, w4, w5, count, fpi_size);
>     if ( w5 )
>         return FFA_RET_INVALID_PARAMETERS;
> 
> @@ -812,7 +815,7 @@ static int32_t handle_partition_info_get(uint32_t w1, 
> uint32_t w2, uint32_t w3,
>     if ( !ctx->page_count || !ctx->rx_is_free )
>         goto out;
>     spin_lock(&ffa_rx_buffer_lock);
> -    ret = ffa_partition_info_get(w1, w2, w3, w4, w5, count);
> +    ret = ffa_partition_info_get(w1, w2, w3, w4, w5, count, fpi_size);
>     if ( ret )
>         goto out_rx_buf_unlock;
>     /*
> @@ -842,7 +845,7 @@ static int32_t handle_partition_info_get(uint32_t w1, 
> uint32_t w2, uint32_t w3,
>     }
>     else
>     {
> -        size_t sz = *count * sizeof(struct ffa_partition_info_1_1);
> +        size_t sz = *count * *fpi_size;
> 
>         if ( ctx->page_count * FFA_PAGE_SIZE < sz )
>         {
> @@ -1409,6 +1412,7 @@ static bool ffa_handle_call(struct cpu_user_regs *regs)
>     uint32_t fid = get_user_reg(regs, 0);
>     struct domain *d = current->domain;
>     struct ffa_ctx *ctx = d->arch.tee;
> +    uint32_t fpi_size;
>     uint32_t count;
>     int e;
> 
> @@ -1444,11 +1448,11 @@ static bool ffa_handle_call(struct cpu_user_regs 
> *regs)
>                                       get_user_reg(regs, 2),
>                                       get_user_reg(regs, 3),
>                                       get_user_reg(regs, 4),
> -                                      get_user_reg(regs, 5), &count);
> +                                      get_user_reg(regs, 5), &count, 
> &fpi_size);
>         if ( e )
>             set_regs_error(regs, e);
>         else
> -            set_regs_success(regs, count, 0);
> +            set_regs_success(regs, count, fpi_size);
>         return true;
>     case FFA_RX_RELEASE:
>         e = handle_rx_release();
> @@ -1629,10 +1633,11 @@ static bool init_subscribers(struct 
> ffa_partition_info_1_1 *fpi, uint16_t count)
> static bool init_sps(void)
> {
>     bool ret = false;
> +    uint32_t fpi_size;
>     uint32_t count;
>     int e;
> 
> -    e = ffa_partition_info_get(0, 0, 0, 0, 0, &count);
> +    e = ffa_partition_info_get(0, 0, 0, 0, 0, &count, &fpi_size);
>     if ( e )
>     {
>         printk(XENLOG_ERR "ffa: Failed to get list of SPs: %d\n", e);
> -- 
> 2.34.1
> 




 


Rackspace

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