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

Re: [PATCH v2 09/10] xen/arm: ffa: Remove per VM notif_enabled


  • To: Jens Wiklander <jens.wiklander@xxxxxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Thu, 24 Oct 2024 09:50:00 +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=TlRGwJT+rD7l7665ekGMvaU8C2r/qkHRox7JWDXLyHM=; b=Qr9S5x0+7SFl3IKXzZyLLCCxheOpQGk8Ql6R1fotUq1q59P0v7RxUI3HMwJDGKm1orJNE03AaT7F2nAFAUylp0CTjSGRDj2cGfmtiJywnHbX/Mhqope0uWwsGw+dzcgJZXtQt/xlZdkidRBfuiFKMD7lx4pZbe4KhERu0CiScrjz7IYc6EKH8Ma1Sp9llKjMCLq64VNtOhK/435MPfX/oYAaBWxcZABuF9I2ahy7/Jl94w2045xFCxvXUzsTP6sxJAwYztgxtnLTwa4S7HbcVSAegHBqYjY8q3y1YOT5Q0nido442KBfcEZXqy+T4hivx9UQqtYIQoJw2l9TXf+hsw==
  • 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=TlRGwJT+rD7l7665ekGMvaU8C2r/qkHRox7JWDXLyHM=; b=afuIkLnNrwjzRbxaibGcNWT1dlWUdSUTwm4nbuI1zgYJSjY7bDUGIrkap9dhBK2wZ7f3TovqNLV1UpFRdvt9sD3D89a2wb2HmgOR51WJ0RCW1mGrx6C9n5YKb/xnRkNKjqYjioqoL/Jyrk2pD/nFtcILFp9q1p60l0QXZhcAo6s+pgowmn/bp9WMltPWQc2eVOhJPv9RzrIJVvP8emrXqZ7tiXTB6fSFRR57qzcpq3LsxSB2ppBZqZ4xI4UVgWpDnMCnreLQa6r4Wtj63OkV10JQcZ/U2cw3c1t8t97Avo5rk5VYkpWIaN8Ss8FPWMpI4sqEuJGK6Ve92NHspogOUA==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=kdK8+CXUNd3aSnL1nWkkO5GP4JJKfuTu8zb+YnFrH5Ps7ziDA83ZTJL4egyfcy/tGty2Z6Fn+xNqS4nSZKcUoUboW7FQ6IdhSOTZCG6h6cUHroWhIg386LhC+oN6Yh/SA71K9uduRoqpJlihuCvbFviW9mRyAiyGfhDsL5RfNEasRvujcC6CZ47f2scW1NGIaHkFEjRuLXqE1K179PKAFKeWgRbwz/95nsxyiIFuPXT5eDCJqE+e4gR8rFHtNf7SnC9w/xYTizwJwR0xuqlJGmkzI9WeMIWdhedHYCtatqLRs4kDpTDTsgMID7i/JplV5LUK/nBcf3qtNCJPIxDLJw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sOOurbgPCGOcZY1w3iFXg0+/s+4k/4xWVO0fdyZLwCY2LupfAfWjJ2G+TWT+1DKSeY3dh3lQa+i+Q07pG6gjdZdpFlZkuqXAsHk7c1ITsnuF2SO/9g4usD7AG9BFJYHP0tCQGVSz4QT/81cYwghcS2S1tX7OyNIAchw50D7yRkm9OYTarvykYc0zaROACWquRq6aB2kygbwwpgHQOYOI61nqIhANdKFcX7oMBRkqMhqaeyaAqdk3qvxyKK7iRcjEE/HlZ6iQ1MSeRzd0RpFEM52YSbL+3vt7b8Glr3Vgtn5elVehpY6lcYz/ToNgZt2qdL6NyBpB4LKp5q0pBZ8UKw==
  • 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: Thu, 24 Oct 2024 09:50:22 +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: AQHbH6X8AtOvQ/RSPk6sVqh3nksYqrKVkNiAgAAj/YA=
  • Thread-topic: [PATCH v2 09/10] xen/arm: ffa: Remove per VM notif_enabled

Hi Jens,

> On 24 Oct 2024, at 09:41, Jens Wiklander <jens.wiklander@xxxxxxxxxx> wrote:
> 
> Hi Bertrand,
> 
> On Wed, Oct 16, 2024 at 10:32 AM Bertrand Marquis
> <bertrand.marquis@xxxxxxx> wrote:
>> 
>> Remove the per VM flag to store if notifications are enabled or not as
>> the only case where they are not, if notifications are enabled globally,
>> will make the VM creation fail.
>> Also use the opportunity to always give the notifications interrupts IDs
>> to VM. If the firmware does not support notifications, there won't be
>> any generated and setting one will give back a NOT_SUPPORTED.
>> 
>> Signed-off-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>
>> ---
>> Changes in v2:
>> - rebase
>> ---
>> xen/arch/arm/tee/ffa.c         | 17 +++--------------
>> xen/arch/arm/tee/ffa_notif.c   | 10 +---------
>> xen/arch/arm/tee/ffa_private.h |  2 --
>> 3 files changed, 4 insertions(+), 25 deletions(-)
>> 
>> diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c
>> index 72826b49d2aa..3a9525aa4598 100644
>> --- a/xen/arch/arm/tee/ffa.c
>> +++ b/xen/arch/arm/tee/ffa.c
>> @@ -169,8 +169,6 @@ static void handle_version(struct cpu_user_regs *regs)
>> 
>> 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;
>> 
>> @@ -218,16 +216,10 @@ static void handle_features(struct cpu_user_regs *regs)
>>         ffa_set_regs_success(regs, 0, 0);
>>         break;
>>     case FFA_FEATURE_NOTIF_PEND_INTR:
>> -        if ( ctx->notif.enabled )
>> -            ffa_set_regs_success(regs, GUEST_FFA_NOTIF_PEND_INTR_ID, 0);
>> -        else
>> -            ffa_set_regs_error(regs, FFA_RET_NOT_SUPPORTED);
>> +        ffa_set_regs_success(regs, GUEST_FFA_NOTIF_PEND_INTR_ID, 0);
>>         break;
>>     case FFA_FEATURE_SCHEDULE_RECV_INTR:
>> -        if ( ctx->notif.enabled )
>> -            ffa_set_regs_success(regs, GUEST_FFA_SCHEDULE_RECV_INTR_ID, 0);
>> -        else
>> -            ffa_set_regs_error(regs, FFA_RET_NOT_SUPPORTED);
>> +        ffa_set_regs_success(regs, GUEST_FFA_SCHEDULE_RECV_INTR_ID, 0);
>>         break;
>> 
>>     case FFA_NOTIFICATION_BIND:
>> @@ -236,10 +228,7 @@ static void handle_features(struct cpu_user_regs *regs)
>>     case FFA_NOTIFICATION_SET:
>>     case FFA_NOTIFICATION_INFO_GET_32:
>>     case FFA_NOTIFICATION_INFO_GET_64:
>> -        if ( ctx->notif.enabled )
>> -            ffa_set_regs_success(regs, 0, 0);
>> -        else
>> -            ffa_set_regs_error(regs, FFA_RET_NOT_SUPPORTED);
>> +        ffa_set_regs_success(regs, 0, 0);
>>         break;
>>     default:
>>         ffa_set_regs_error(regs, FFA_RET_NOT_SUPPORTED);
>> diff --git a/xen/arch/arm/tee/ffa_notif.c b/xen/arch/arm/tee/ffa_notif.c
>> index 4b3e46318f4b..3c6418e62e2b 100644
>> --- a/xen/arch/arm/tee/ffa_notif.c
>> +++ b/xen/arch/arm/tee/ffa_notif.c
>> @@ -405,7 +405,6 @@ void ffa_notif_init(void)
>> 
>> int ffa_notif_domain_init(struct domain *d)
>> {
>> -    struct ffa_ctx *ctx = d->arch.tee;
>>     int32_t res;
>> 
>>     if ( !notif_enabled )
>> @@ -415,18 +414,11 @@ int ffa_notif_domain_init(struct domain *d)
>>     if ( res )
>>         return -ENOMEM;
>> 
>> -    ctx->notif.enabled = true;
>> -
>>     return 0;
>> }
>> 
>> void ffa_notif_domain_destroy(struct domain *d)
>> {
>> -    struct ffa_ctx *ctx = d->arch.tee;
>> -
>> -    if ( ctx->notif.enabled )
>> -    {
>> +    if ( notif_enabled )
>>         ffa_notification_bitmap_destroy(ffa_get_vm_id(d));
> 
> This call may now be done even if there hasn't been a successful call
> to ffa_notification_bitmap_create().
> A comment mentioning this and that it's harmless (if we can be sure it
> is) would be nice.
> 

You mean in the case where it failed during domain_init ?

I can add the following comment:
 Call bitmap_destroy even if bitmap create failed as the SPMC should return an 
error that we will ignore

Would that be ok ?

Cheers
Bertrand


> Cheers,
> Jens
> 
>> -        ctx->notif.enabled = false;
>> -    }
>> }
>> diff --git a/xen/arch/arm/tee/ffa_private.h b/xen/arch/arm/tee/ffa_private.h
>> index 02162e0ee4c7..973ee55be09b 100644
>> --- a/xen/arch/arm/tee/ffa_private.h
>> +++ b/xen/arch/arm/tee/ffa_private.h
>> @@ -281,8 +281,6 @@ struct ffa_mem_region {
>> };
>> 
>> struct ffa_ctx_notif {
>> -    bool enabled;
>> -
>>     /*
>>      * True if domain is reported by FFA_NOTIFICATION_INFO_GET to have
>>      * pending global notifications.
>> --
>> 2.47.0



 


Rackspace

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