Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp465560rwe; Wed, 31 Aug 2022 06:01:14 -0700 (PDT) X-Google-Smtp-Source: AA6agR6jiLP8MjeDTy8jfpo9sA4hqzyDtUKrdUBHyFbHINf4vSJu4xzoEbxrwVukC3cUWAKKzdmC X-Received: by 2002:a17:906:9bf3:b0:741:6900:61a5 with SMTP id de51-20020a1709069bf300b00741690061a5mr11497200ejc.286.1661950874014; Wed, 31 Aug 2022 06:01:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661950874; cv=none; d=google.com; s=arc-20160816; b=URwpNoEFgYCX00gLGmQ7LmveLuj//EBca8bf0S7HYjauWTnW7+5LSACQNyJWICOebo DJI1cuxpYBM9yCapARxEek6Hotk/XfkJamYEeHkWtf1/q/OgCgkwBPyNCyXKOmzeAl52 mpDp9fNr81CV3Uondo5mmAdFHkcXbqfLeZ64GrRVZsPe98W1dw0wEPlgpucKNT63aMMU OTSEUFryp3e4qv9UvP+E6QlIc+VCq7QEe11IKyG2KQ51WuKsdN/ptDJQdYiB431QwxOx 2cB9V1U5g39SlznKrZwpqIRhEPbmO+ah+lJgVp9S/vTxTTd1V8s4MXKcig+q1yCTi2qJ qehQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=kjWODI08g5bPQnsArnStXODa1iE9aFItyMJAREXF3Do=; b=dnJ59WocpdEb+xTk+u1JkWp15LNJh7mqWu3RVIDdUMhIdWbFKhWzxHjB/JZXbOTsdC IUS0qd00XCCwF1cY6B+Qlvmu453nV62ON41rc2YF0Zw0DL8Ft8BjatpCZBhf7Gi6ImdO W5A1GPpGG6hK1s6G51Pn79f/L8u0EP4q1Iw0iNb+hpO7If1CUi7BTZHqCAwN/1xkoKTA q5dQPvQdlRIKUxbNt8aM2qtDxxscZ7zLEl6iswWsrZ7m9c+S2jv5m+WU4wZmB0Ho9Krb zofHwEroOoX1IB0qIzprNe/htGR0XOJ9b6zL26d/+5gkM6uFsqvcPSjjao0TeF0+fi9j yQVA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 7-20020a170906328700b007384c1db86fsi9556861ejw.60.2022.08.31.06.00.47; Wed, 31 Aug 2022 06:01:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230503AbiHaM10 (ORCPT + 99 others); Wed, 31 Aug 2022 08:27:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbiHaM1Z (ORCPT ); Wed, 31 Aug 2022 08:27:25 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C44A8D11EB for ; Wed, 31 Aug 2022 05:27:23 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 51F6EED1; Wed, 31 Aug 2022 05:27:29 -0700 (PDT) Received: from bogus (unknown [10.57.44.200]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4E4933F766; Wed, 31 Aug 2022 05:27:21 -0700 (PDT) Date: Wed, 31 Aug 2022 13:26:56 +0100 From: Sudeep Holla To: Sumit Garg Cc: linux-kernel@vger.kernel.org, op-tee@lists.trustedfirmware.org, Marc Bonnici , Valentin Laurent , Lukas Hanel , Coboy Chen Subject: Re: [PATCH 6/9] firmware: arm_ffa: Make memory apis ffa_device independent Message-ID: <20220831122656.255o7a7yio5uuik2@bogus> References: <20220830100700.344594-1-sudeep.holla@arm.com> <20220830100700.344594-7-sudeep.holla@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 31, 2022 at 04:16:09PM +0530, Sumit Garg wrote: > Hi Sudeep, > > On Tue, 30 Aug 2022 at 15:39, Sudeep Holla wrote: > > > > There is a requirement to make memory APIs independent of the ffa_device. > > One of the use-case is to have a common memory driver that manages the > > memory for all the ffa_devices. That commom memory driver won't be a > > s/commom/common/ > > > ffa_driver or won't have any ffa_device associated with it. So having > > these memory APIs accessible without a ffa_device is needed and should > > be possible as most of these are handled by the partition manager(SPM > > or hypervisor). > > > > Drop the ffa_device argument to the memory APIs and make them ffa_device > > independent. > > > > Signed-off-by: Sudeep Holla > > --- > > drivers/firmware/arm_ffa/driver.c | 6 ++---- > > drivers/tee/optee/ffa_abi.c | 2 +- > > include/linux/arm_ffa.h | 6 ++---- > > 3 files changed, 5 insertions(+), 9 deletions(-) > > > > diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c > > index 5f02b670e964..5c8484b05c50 100644 > > --- a/drivers/firmware/arm_ffa/driver.c > > +++ b/drivers/firmware/arm_ffa/driver.c > > @@ -640,8 +640,7 @@ static int ffa_sync_send_receive(struct ffa_device *dev, > > dev->mode_32bit, data); > > } > > > > -static int > > -ffa_memory_share(struct ffa_device *dev, struct ffa_mem_ops_args *args) > > +static int ffa_memory_share(struct ffa_mem_ops_args *args) > > { > > if (drv_info->mem_ops_native) > > return ffa_memory_ops(FFA_FN_NATIVE(MEM_SHARE), args); > > @@ -649,8 +648,7 @@ ffa_memory_share(struct ffa_device *dev, struct ffa_mem_ops_args *args) > > return ffa_memory_ops(FFA_MEM_SHARE, args); > > } > > > > -static int > > -ffa_memory_lend(struct ffa_device *dev, struct ffa_mem_ops_args *args) > > +static int ffa_memory_lend(struct ffa_mem_ops_args *args) > > { > > /* Note that upon a successful MEM_LEND request the caller > > * must ensure that the memory region specified is not accessed > > diff --git a/drivers/tee/optee/ffa_abi.c b/drivers/tee/optee/ffa_abi.c > > index 4c3b5d0008dd..7ec0a2f9a63b 100644 > > --- a/drivers/tee/optee/ffa_abi.c > > +++ b/drivers/tee/optee/ffa_abi.c > > @@ -294,7 +294,7 @@ static int optee_ffa_shm_register(struct tee_context *ctx, struct tee_shm *shm, > > if (rc) > > return rc; > > args.sg = sgt.sgl; > > - rc = ffa_ops->memory_share(ffa_dev, &args); > > + rc = ffa_ops->memory_share(&args); > > sg_free_table(&sgt); > > if (rc) > > return rc; > > diff --git a/include/linux/arm_ffa.h b/include/linux/arm_ffa.h > > index 556f50f27fb1..eafab07c9f58 100644 > > --- a/include/linux/arm_ffa.h > > +++ b/include/linux/arm_ffa.h > > @@ -262,10 +262,8 @@ struct ffa_dev_ops { > > int (*sync_send_receive)(struct ffa_device *dev, > > struct ffa_send_direct_data *data); > > int (*memory_reclaim)(u64 g_handle, u32 flags); > > - int (*memory_share)(struct ffa_device *dev, > > - struct ffa_mem_ops_args *args); > > - int (*memory_lend)(struct ffa_device *dev, > > - struct ffa_mem_ops_args *args); > > + int (*memory_share)(struct ffa_mem_ops_args *args); > > + int (*memory_lend)(struct ffa_mem_ops_args *args); > > }; > > > > Since these are included under "struct ffa_dev_ops", wouldn't it be > better to rename the struct (ffa_ops?) as well? > Makes sense, I just avoided churn. But now I think there is some churn anyways, so I am happy to rename. -- Regards, Sudeep