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

Re: [XEN PATCH v1 5/5] xen/arm: ffa: support notification


  • To: Jens Wiklander <jens.wiklander@xxxxxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Wed, 10 Apr 2024 16:30:05 +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=jTx7pGz53t+jPfJUg35n+hHGsol3nmtxMgmVz3opd8A=; b=hXyvi41gurRInDTb190Qns0i0uuA6CsLePB6rwEMyrfFTx1ef5mzV2NvMjSlEKTYUxlGr6zjmMdXqhvnjEDH6/M2CHgGb3YpxrODSF+LXWFQBYX4rh5MRwYe5ctTxWcTcPC4rTu8nzOICn0Ld32kF2ayylduxWalEHo+n9AVmxPetIfGdm03OzHv/aXK2oWge21Gereup0qwxsxqlgBS98zUtAXE795fzhNCnkOyLqi8aotu2i+StJ8NmJSFwJGJewd4hdXjOgseVi1WCxjn7r/5orRsWZG6Ee1fxXcefPRO9N+wlzd6yCL7F27QYXGG6Az75Adcr25vpa9TB7cTXA==
  • 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=jTx7pGz53t+jPfJUg35n+hHGsol3nmtxMgmVz3opd8A=; b=G/KLcW1p2bjxjO4WG57a19wnrB24aHYlB28SqLJa6GcjUBZrxadAYwJI3NFpnVJkmW8cnH+iiUOugRMc8iBlH4VQ0NO21iuEeKL4Iu/e/GHeDtYdcKh2c3sPgvRbwPJ2gD4pADVJmnpxoyh6vZ6rN/BcBCWUi5pMyUogp+L0NXF9VAZMA1shVJDHHCBbK3zDZI1QMVOTgeR9EWil4xKWAZsWeMuUgqihC6nAMOz6SFH7jPklZ7fsxQoOP/aHZczjtuchUzw9k1DtI3sbVN6h6vByW8h71pp7BjOtgCXYLONcXrwNmBgb1J/9pl5fG8F8G2TxY4ZpjoiYkV8NLIa6gg==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=HhO3WjL5eLzLkRPE9a0uH7Ciod2HJzfcsC2moDBfCPZaYXotgIcouIRpJiNMULQa94LLbgqIAf76imRViYDiDTDegcdcwl51s9VV/0KyrybVVDYrlDrRamoG3es1FhTuN+1QToP9wEHQnl49dg/1L6fc+OBbrX6JmJe4TqffGQQPC/qSZGWXQyWcGRlckZ6Q0gq1ylNggOx1CUJXFTHx2OHHK2bERJXwfmbvG2hDtXptavIbU9pkKaA1DU3ZgKpUSJvZIto7I4iuGllNHqlTqnCbt4Qp3cY+lir+2ovLGGCw7OflhXkI5zEFRsI70kyWErLfBbpVean5YAzl1pp0Qw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g/RwzzH9cYJZ9fvB7ywUjrJqoIYCBKusfRR5QwFpA05dTAezEjt7arAOMfaoFuSq0QoOiPZy5U6ZYo9WhmXYqu5AfrjgmhmXByOEQiBidPsuOtFk02bQ7srdAkBosJtFA9WQLSQqmlZnAzTzPUdyky/3ml12t3PNp41SZ1r5wU9kHJW57PbpgFXbxdkE1n5CAI+5VgqZixm1c/q/jYfvzUGM0B6rgTnJNQ05qkOfZ1kn1MLYiNoVQ9KanmdvDTmYuOuL+2+PlSzjzbt5ZLGSYn1PP0N6AYWvb9/wLktiz72QPerHTFb8L8XdEt0H6B0WLNvvC1i6W91yiEq8cBBukw==
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "patches@xxxxxxxxxx" <patches@xxxxxxxxxx>, Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>
  • Delivery-date: Wed, 10 Apr 2024 16:30:28 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Thread-index: AQHaipO/QuGF8TXkikCEHPNBW62gObFhpwaAgAAMdQA=
  • Thread-topic: [XEN PATCH v1 5/5] xen/arm: ffa: support notification

Hi Jens,

> On 10 Apr 2024, at 17:45, Jens Wiklander <jens.wiklander@xxxxxxxxxx> wrote:
> 
> On Tue, Apr 9, 2024 at 5:36 PM Jens Wiklander <jens.wiklander@xxxxxxxxxx> 
> wrote:
>> 
>> Add support for FF-A notifications, currently limited to an SP (Secure
>> Partition) sending an asynchronous notification to a guest.
>> 
>> Guests and Xen itself are made aware of pending notifications with an
>> interrupt. The interrupt handler retrieves the notifications using the
>> FF-A ABI and deliver them to their destinations.
>> 
>> Signed-off-by: Jens Wiklander <jens.wiklander@xxxxxxxxxx>
>> ---
>> xen/arch/arm/tee/Makefile      |   1 +
>> xen/arch/arm/tee/ffa.c         |  58 ++++++
>> xen/arch/arm/tee/ffa_notif.c   | 319 +++++++++++++++++++++++++++++++++
>> xen/arch/arm/tee/ffa_private.h |  71 ++++++++
>> 4 files changed, 449 insertions(+)
>> create mode 100644 xen/arch/arm/tee/ffa_notif.c
>> 
>> diff --git a/xen/arch/arm/tee/Makefile b/xen/arch/arm/tee/Makefile
>> index f0112a2f922d..7c0f46f7f446 100644
>> --- a/xen/arch/arm/tee/Makefile
>> +++ b/xen/arch/arm/tee/Makefile
>> @@ -2,5 +2,6 @@ obj-$(CONFIG_FFA) += ffa.o
>> obj-$(CONFIG_FFA) += ffa_shm.o
>> obj-$(CONFIG_FFA) += ffa_partinfo.o
>> obj-$(CONFIG_FFA) += ffa_rxtx.o
>> +obj-$(CONFIG_FFA) += ffa_notif.o
>> obj-y += tee.o
>> obj-$(CONFIG_OPTEE) += optee.o
>> diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
>> index 5209612963e1..ce9757bfeed1 100644
>> --- a/xen/arch/arm/tee/ffa.c
>> +++ b/xen/arch/arm/tee/ffa.c
>> @@ -39,6 +39,9 @@
>>  *   - at most 32 shared memory regions per guest
>>  * o FFA_MSG_SEND_DIRECT_REQ:
>>  *   - only supported from a VM to an SP
>> + * o FFA_NOTIFICATION_*:
>> + *   - only supports global notifications, that is, per vCPU notifications
>> + *     are not supported
>>  *
>>  * There are some large locked sections with ffa_tx_buffer_lock and
>>  * ffa_rx_buffer_lock. Especially the ffa_tx_buffer_lock spinlock used
>> @@ -194,6 +197,8 @@ out:
>> 
>> static void handle_features(struct cpu_user_regs *regs)
>> {
>> +    struct domain *d = current->domain;
>> +    struct ffa_ctx *ctx = d->arch.tee;
>>     uint32_t a1 = get_user_reg(regs, 1);
>>     unsigned int n;
>> 
>> @@ -240,6 +245,30 @@ static void handle_features(struct cpu_user_regs *regs)
>>         BUILD_BUG_ON(PAGE_SIZE != FFA_PAGE_SIZE);
>>         ffa_set_regs_success(regs, 0, 0);
>>         break;
>> +    case FFA_FEATURE_NOTIF_PEND_INTR:
>> +        if ( ctx->notif.enabled )
>> +            ffa_set_regs_success(regs, FFA_NOTIF_PEND_INTR_ID, 0);
>> +        else
>> +            ffa_set_regs_error(regs, FFA_RET_NOT_SUPPORTED);
>> +        break;
>> +    case FFA_FEATURE_SCHEDULE_RECV_INTR:
>> +        if ( ctx->notif.enabled )
>> +            ffa_set_regs_success(regs, FFA_NOTIF_PEND_INTR_ID, 0);
>> +        else
>> +            ffa_set_regs_error(regs, FFA_RET_NOT_SUPPORTED);
>> +        break;
> 
> With the recently posted kernel patch
> https://lore.kernel.org/all/20240410-ffa_npi_support-v1-3-1a5223391bd1@xxxxxxx/
> we need to decide which feature interrupt to return since the kernel
> will only install a handle for the first it finds. Right now I propose
> to to not report FFA_FEATURE_SCHEDULE_RECV_INTR. When the time comes
> to use a secondary scheduler we'll need to report the SRI instead.


We just had a meeting with Sudeep to discuss that matter and he agreed that
he would register the interrupt handler for all the interrupts available so that
we can keep a model where we will generate SRIs only to a secondary scheduler
and NPI for notification interrupts (so that the VM does not do a INFO_GET when
not required).

We will have to report both as any VM could act as secondary scheduler for SPs
in theory (we might need at some point a parameter for that) but for now those
should only be generated to Dom0 if there are pending notifications for SPs.

Cheers
Bertrand


 


Rackspace

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