Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp4070830rwe; Tue, 30 Aug 2022 04:14:28 -0700 (PDT) X-Google-Smtp-Source: AA6agR7VWj9yGTnFwCWfMp8nrTMbDWTOmN7xaekHjHAC5HmTM9k9BNZ5W4JIyq+Ib9hjm3gzucWC X-Received: by 2002:a17:907:2701:b0:741:51eb:2338 with SMTP id w1-20020a170907270100b0074151eb2338mr9619610ejk.501.1661858068128; Tue, 30 Aug 2022 04:14:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661858068; cv=none; d=google.com; s=arc-20160816; b=NlAYrHEg5tjUoCzlc+Lfp/Lsc8IRZg3GUGh0J0eAf50Chn92DJu0jGldW27x/fQNzg UHycUCeZevaR5vCm95QgngzqMvP5VzbHWqjVfEYZaleAA5wiLDH/GlzVbcQwqiF+PVOp ftUQaw2nCRKIfhbwxPpoizTx7q38hH41qRly9A36Fvo2R4aq8OSMzJA7OrVbA0sFnUkD Qgct310X6ihWnTvTjOM+NJ704ijcy3bbjxypUKRQi31FBWeOBNGFuwjJJBhtOvktvLRa SZSY5hh8luzIyW97FEWDMhm5n8DoxE1val/N3jDJK0kUiEEjGPhwykEPQzK1tvYUhY3h OPzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=ViYtYqMSx+29710bmDps0A41/dpJrH1dEOEakq8F9L0=; b=zzB4BPhD/UYHvaTv3tNwOzdBk5c5oTj3570AFN4OZb8faqzyO1Fm+TLHLVtX5DLx8f HWCHjwIVRNs/ufY31DiMdSnkpEutLgMzXQJ8oyzIjVrViRUVvAVRE7C7DQdL4oUIlz/X z7AW+OmT/2kAKKCKDz6Py6bQabag1LbsbEq0xTVMKEpm6SCLHBzMugsJIzmLWQ4qL9oI Xtc0P63Pi6Xgsfg4VtTnRNt2Y8kJUXaif2BBQ1XHChK9MZhytjSm+KQLqw06gF6RbQih kjs7QsRey8pxXu8ciOH5cg4MYvMsaVTa94TXR5UTWTl509g/CBcOszrd2anY4UioZE6L EgUw== 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 hq30-20020a1709073f1e00b007308bd40223si8313316ejc.669.2022.08.30.04.14.02; Tue, 30 Aug 2022 04:14:28 -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 S230231AbiH3KMb (ORCPT + 99 others); Tue, 30 Aug 2022 06:12:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230145AbiH3KLx (ORCPT ); Tue, 30 Aug 2022 06:11:53 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EB9EEFB0CC for ; Tue, 30 Aug 2022 03:07:35 -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 CAF231474; Tue, 30 Aug 2022 03:07:41 -0700 (PDT) Received: from usa.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 6F8F93F766; Tue, 30 Aug 2022 03:07:34 -0700 (PDT) From: Sudeep Holla To: linux-kernel@vger.kernel.org, op-tee@lists.trustedfirmware.org Cc: Sudeep Holla , Marc Bonnici , Achin Gupta , Jens Wiklander , Valentin Laurent , Lukas Hanel , Coboy Chen Subject: [PATCH 6/9] firmware: arm_ffa: Make memory apis ffa_device independent Date: Tue, 30 Aug 2022 11:06:57 +0100 Message-Id: <20220830100700.344594-7-sudeep.holla@arm.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220830100700.344594-1-sudeep.holla@arm.com> References: <20220830100700.344594-1-sudeep.holla@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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 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); }; #endif /* _LINUX_ARM_FFA_H */ -- 2.37.2