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

Re: [PATCH v2 3/5] xen/arm: ffa: Add buffer full notification support


  • To: Jens Wiklander <jens.wiklander@xxxxxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Thu, 20 Mar 2025 15:48:06 +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=fVh7QtclDMmlrZy04OFVeLNWt8Cq4DMhVNyZawDDfjk=; b=QdGEYyl5be96yHrXkBwG7BGhC25L2LhMQatBcZgcETFNm7zauPHSPPnJO3a0iZqzyjwB7QivVoayTsLe3rUdK9FsqwRUag2TIhg6ZGLlHM45mZ9g+z58XdpOlZkH4ERQt7jUA0Api+V3l3s1Y19ATG7WuRPGwL/bysUmiEfjuxzKpuu18RbIEJ2a/xVeIMxMeTP7Qvg/ubtUmuMhxbOdtbcERDYWPD/NXBVSS0ljteO90XaR+6QoGdfNjbKtc8uc3KA0P8EY5wHrRice57oBVnB3dy7noRGsKj11MEzg0KOgpdfntuw+aN36T769rQ895rnMzUS3xbqTv3Ussd72WA==
  • 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=fVh7QtclDMmlrZy04OFVeLNWt8Cq4DMhVNyZawDDfjk=; b=JPNrJTC4+yEQBiNGGCS+IbfmC2HETUqqlycWZnnRgUOT01/aVCa9FlFrckLEEggggSlsSeXHxDNpCyQdsp66RKZIpgT20rI5iigmHrNUoWDtYSjPCzlc28kV/r5jxyDkOpI2DA7CUZ/M5MSrKKcpMD8CBhynH+mT8WsK6FSixEGhOjvwtRKRGHK0Ku60FUzO9OoQLdu/RUAlbeuectqIBgWEWZIrzVzob+cYhBPsFPIQENYIy4JbTM/EjiPsR8nDVjsCM/U60MNSrzje4oyNTFD0SwAvVCdTBIjZnt5pR3NB8rX0BTTIN70jbmCZicYIUdAh5F6o1ZOGtb8uWsQxIQ==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=W1xu0+8gwIH6ppH5gku78tzOnV+e4lAdt8r+gaVN3o5lwaqekXtO4sAm0BYOgC1VSy66x0ybZO0cHVsQOhkUtwsa8rcA64FdHALucV7j7U9+5YDbXj1XYBGnQNgCE/Uuc/l2I+yOK7XkQ7jfzERa92HivoVPcf1Q+eDKForx7R1r4S323qTfXHz5U6sF8f+rUdDUEds7rp88t60MQ5u9dKceXS/SmkeoUZOlV7h+Lh0LwXEMTWDPxGK71oP/exB0SdKjQ1EsjPhdKlPf83Nb6wYswtR+kQdC/6QV6d7FUH/ynePUtcToGLqviX4K/S9Xzl6doYz1POHiB366LZat8A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=awfj+6pVxrG4U4XWBUUDs0WY2jgperc1ddlCLFoGDMIozKd5XEwe6drxi2bgHB6KUaERWZXHvs/v/e5rhekgEUU8rPqSZ+P67WZFN+HBTrJGihG4nLY8gRFz0Osg0civLTkJGPLWtUi+p7t4MUgmbrj2D8lsI0cB6KeXcGyu5b310wP4n0N2WaLSHL2MRjK2kk1Wq2ZtdFgJwXiKo7PXca0EidBw835fSLi8vfc1Mxy2buzLIFThy5a1uSlBh31bMjI9ftv9y9ys+U0bWDOYLMBGUr4wT3wfb9MJp4Kmw/rNM1EcyjJewH0QpxCfgGOtbNiqkUQnn2LGz8uoztvnbg==
  • 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, 20 Mar 2025 15:53:25 +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: AQHbkcvmIfvaAChpR0q1sfiN2EYKc7N8K3MAgAAP2gA=
  • Thread-topic: [PATCH v2 3/5] xen/arm: ffa: Add buffer full notification support

Hi Jens,

> On 20 Mar 2025, at 15:51, Jens Wiklander <jens.wiklander@xxxxxxxxxx> wrote:
> 
> Hi Bertrand,
> 
> On Mon, Mar 10, 2025 at 3:51 PM Bertrand Marquis
> <bertrand.marquis@xxxxxxx> wrote:
>> 
>> Add support to raise a Rx buffer full notification to a VM.
>> This function will be used for indirect message support between VM and
>> is only activated if CONFIG_FFA_VM_TO_VM is selected.
>> 
>> Even if there are 32 framework notifications possible, right now only
>> one is defined so the implementation is simplified to only handle the
>> buffer full notification using a boolean. If other framework
>> notifications have to be supported one day, the design will have to be
>> modified to handle it properly.
>> 
>> Signed-off-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>
>> ---
>> Changes in v2:
>> - Code style fix
>> ---
>> xen/arch/arm/tee/ffa_notif.c   | 26 +++++++++++++++++++++-----
>> xen/arch/arm/tee/ffa_private.h | 13 +++++++++++++
>> 2 files changed, 34 insertions(+), 5 deletions(-)
>> 
>> diff --git a/xen/arch/arm/tee/ffa_notif.c b/xen/arch/arm/tee/ffa_notif.c
>> index 00efaf8f7353..d19aa5c5bef6 100644
>> --- a/xen/arch/arm/tee/ffa_notif.c
>> +++ b/xen/arch/arm/tee/ffa_notif.c
>> @@ -93,6 +93,7 @@ void ffa_handle_notification_info_get(struct cpu_user_regs 
>> *regs)
>> void ffa_handle_notification_get(struct cpu_user_regs *regs)
>> {
>>     struct domain *d = current->domain;
>> +    struct ffa_ctx *ctx = d->arch.tee;
>>     uint32_t recv = get_user_reg(regs, 1);
>>     uint32_t flags = get_user_reg(regs, 2);
>>     uint32_t w2 = 0;
>> @@ -132,11 +133,7 @@ void ffa_handle_notification_get(struct cpu_user_regs 
>> *regs)
>>          */
>>         if ( ( flags  & FFA_NOTIF_FLAG_BITMAP_SP ) &&
>>              ( flags & FFA_NOTIF_FLAG_BITMAP_SPM ) )
>> -        {
>> -                struct ffa_ctx *ctx = d->arch.tee;
>> -
>> -                ACCESS_ONCE(ctx->notif.secure_pending) = false;
>> -        }
>> +            ACCESS_ONCE(ctx->notif.secure_pending) = false;
>> 
>>         arm_smccc_1_2_smc(&arg, &resp);
>>         e = ffa_get_ret_code(&resp);
>> @@ -156,6 +153,12 @@ void ffa_handle_notification_get(struct cpu_user_regs 
>> *regs)
>>             w6 = resp.a6;
>>     }
>> 
>> +#ifdef CONFIG_FFA_VM_TO_VM
>> +    if ( flags & FFA_NOTIF_FLAG_BITMAP_HYP &&
>> +          test_and_clear_bool(ctx->notif.buff_full_pending) )
>> +        w7 = FFA_NOTIF_RX_BUFFER_FULL;
>> +#endif
>> +
>>     ffa_set_regs(regs, FFA_SUCCESS_32, 0, w2, w3, w4, w5, w6, w7);
>> }
>> 
>> @@ -178,6 +181,19 @@ int ffa_handle_notification_set(struct cpu_user_regs 
>> *regs)
>>                            bitmap_hi);
>> }
>> 
>> +#ifdef CONFIG_FFA_VM_TO_VM
>> +void ffa_raise_rx_buffer_full(struct domain *d)
>> +{
>> +    struct ffa_ctx *ctx = d->arch.tee;
>> +
>> +    if ( !ctx )
>> +        return;
>> +
>> +    if ( !test_and_set_bool(ctx->notif.buff_full_pending) )
>> +        vgic_inject_irq(d, d->vcpu[0], notif_sri_irq, true);
>> +}
>> +#endif
>> +
>> /*
>>  * Extract a 16-bit ID (index n) from the successful return value from
>>  * FFA_NOTIFICATION_INFO_GET_64 or FFA_NOTIFICATION_INFO_GET_32. IDs are
>> diff --git a/xen/arch/arm/tee/ffa_private.h b/xen/arch/arm/tee/ffa_private.h
>> index bd6877d8c632..1f5067d5d0c9 100644
>> --- a/xen/arch/arm/tee/ffa_private.h
>> +++ b/xen/arch/arm/tee/ffa_private.h
>> @@ -210,6 +210,8 @@
>> #define FFA_NOTIF_INFO_GET_ID_COUNT_SHIFT   7
>> #define FFA_NOTIF_INFO_GET_ID_COUNT_MASK    0x1F
>> 
>> +#define FFA_NOTIF_RX_BUFFER_FULL        BIT(0, U)
>> +
>> /* Feature IDs used with FFA_FEATURES */
>> #define FFA_FEATURE_NOTIF_PEND_INTR     0x1U
>> #define FFA_FEATURE_SCHEDULE_RECV_INTR  0x2U
>> @@ -298,6 +300,13 @@ struct ffa_ctx_notif {
>>      * pending global notifications.
>>      */
>>     bool secure_pending;
>> +
>> +#ifdef CONFIG_FFA_VM_TO_VM
>> +    /*
>> +     * Pending Hypervisor framework notifications
>> +     */
>> +    bool buff_full_pending;
>> +#endif
> 
> It doesn't matter if there are one or two bools in this struct.
> However, the ifdef prevents using IS_ENABLED(CONFIG_FFA_VM_TO_VM)
> instead of an ifdef in the logic controlling access to this field.

Agree, I will make this field present all the time and switch to IS_ENABLED when
now possible.

Cheers
Bertrand

> 
> Cheers,
> Jens
> 
>> };
>> 
>> struct ffa_ctx {
>> @@ -369,6 +378,10 @@ void ffa_handle_notification_info_get(struct 
>> cpu_user_regs *regs);
>> void ffa_handle_notification_get(struct cpu_user_regs *regs);
>> int ffa_handle_notification_set(struct cpu_user_regs *regs);
>> 
>> +#ifdef CONFIG_FFA_VM_TO_VM
>> +void ffa_raise_rx_buffer_full(struct domain *d);
>> +#endif
>> +
>> void ffa_handle_msg_send_direct_req(struct cpu_user_regs *regs, uint32_t 
>> fid);
>> int32_t ffa_handle_msg_send2(struct cpu_user_regs *regs);
>> 
>> --
>> 2.47.1



 


Rackspace

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