Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1103445pxb; Fri, 1 Oct 2021 03:39:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBpUrV3V5yArSAjw0uKX2xDhfEqE3by9OPLjWAB0V/pn18ZuQYZbqTnEBT+bEueBeZSLfA X-Received: by 2002:a63:2acb:: with SMTP id q194mr9121305pgq.59.1633084780763; Fri, 01 Oct 2021 03:39:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633084780; cv=none; d=google.com; s=arc-20160816; b=sL3f3H8bB8VCfJn40BX5PKl686kEnnJ3crggCKtmtTu2W3cqqxSIITYvzP6YD9yY1w B3C3XBgayA+QWDNGQKl2P9Kph96eszCLyH+e8Gjq0vTXK22u/07LzfnCbjXErwlE1mz/ gAs3hSCslqqd/cZ+7tQwiyaBvqYKWkGWLaegD2SuiNeBQnGtlLm69y7KRZ2Plo7u2Qmp DX4F8T9LqcMj7gvC23aY68ekoiPkYX5JIuImojwMwgyZdLc4g3xLHZKRnNoqxdaO3F3T 0qq9HmhKyqT/spU+t42lnHkumFaI/AlyyAesiKODVrlB5y54BPJxT6ouFhsvXsuIqLr6 H/1w== 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=E/hZ0PU5drZm5xhLPAftz/KzUojz66HYRukgQezbVzM=; b=xyB4dmlHjDBe4JnJp6za7bNGTVcM2E04TYhJo11aP6gPb6CcYpbRCYbAR88fbQmRjb hLtV9qkPU09AuXHC2wYZJMzjReJfz76oE+kt5NPR3Y1qROswJoKdfzSuW31xUY6rfdm3 FMioxREcVUugrTsmWr4OAQ5a1IzyZ6CYrhR5X8kyI+0AFut6iBiihFB+UNPrr6WT6Kak Wp5wEwt3/mkHXBQjXOu4xb1l1prIbyYHWXPkD0RhGgCMJI9GasL9QZeBT2WmqNO5WSS3 SLI9w+SRs+KjToaLQ1f4QEYKYjA+RyWYl+fp0x/nXb9nw5myKorZTt0VsX33w18an82T 4UPw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y17si6872177plp.82.2021.10.01.03.39.26; Fri, 01 Oct 2021 03:39:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1352937AbhJAJgp (ORCPT + 99 others); Fri, 1 Oct 2021 05:36:45 -0400 Received: from foss.arm.com ([217.140.110.172]:38798 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229906AbhJAJgo (ORCPT ); Fri, 1 Oct 2021 05:36:44 -0400 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 B9491101E; Fri, 1 Oct 2021 02:35:00 -0700 (PDT) Received: from bogus (unknown [10.57.26.136]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4FFEC3F70D; Fri, 1 Oct 2021 02:34:58 -0700 (PDT) Date: Fri, 1 Oct 2021 10:34:24 +0100 From: Sudeep Holla To: Jens Wiklander Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, op-tee@lists.trustedfirmware.org, Sumit Garg , Marc Bonnici , Sudeep Holla , Jerome Forissier , sughosh.ganu@linaro.org Subject: Re: [PATCH v5 5/5] optee: add FF-A support Message-ID: <20211001093424.n4x34qp3ewbbijmc@bogus> References: <20210831072412.887565-1-jens.wiklander@linaro.org> <20210831072412.887565-6-jens.wiklander@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210831072412.887565-6-jens.wiklander@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 31, 2021 at 09:24:12AM +0200, Jens Wiklander wrote: > Adds support for using FF-A [1] as transport to the OP-TEE driver. > > Introduces struct optee_msg_param_fmem which carries all information > needed when OP-TEE is calling FFA_MEM_RETRIEVE_REQ to get the shared > memory reference mapped by the hypervisor in S-EL2. Register usage is > also updated to include the information needed. > > The FF-A part of this driver is enabled if CONFIG_ARM_FFA_TRANSPORT is > enabled. > > [1] https://developer.arm.com/documentation/den0077/latest > Acked-by: Sumit Garg > Signed-off-by: Jens Wiklander > --- > drivers/tee/optee/Makefile | 3 +- > drivers/tee/optee/call.c | 13 +- > drivers/tee/optee/core.c | 16 +- > drivers/tee/optee/ffa_abi.c | 907 ++++++++++++++++++++++++++++++ > drivers/tee/optee/optee_ffa.h | 153 +++++ > drivers/tee/optee/optee_msg.h | 27 +- > drivers/tee/optee/optee_private.h | 43 +- > 7 files changed, 1148 insertions(+), 14 deletions(-) > create mode 100644 drivers/tee/optee/ffa_abi.c > create mode 100644 drivers/tee/optee/optee_ffa.h > > diff --git a/drivers/tee/optee/Makefile b/drivers/tee/optee/Makefile > index d4e4776d2dec..dbfd83d3c4ae 100644 > --- a/drivers/tee/optee/Makefile > +++ b/drivers/tee/optee/Makefile > @@ -7,7 +7,8 @@ optee-objs += supp.o > optee-objs += device.o > > optee-smc-abi-y = smc_abi.o > -optee-objs += $(optee-smc-abi-y) > +optee-ffa-abi-$(CONFIG_ARM_FFA_TRANSPORT) = ffa_abi.o > +optee-objs += $(optee-smc-abi-y) $(optee-ffa-abi-y) > This may not work when CONFIG_ARM_FFA_TRANSPORT=m, I don't have cleaner solution apart from having if else. [...] > diff --git a/drivers/tee/optee/optee_private.h b/drivers/tee/optee/optee_private.h > index ca0213e330b5..2593742364da 100644 > --- a/drivers/tee/optee/optee_private.h > +++ b/drivers/tee/optee/optee_private.h [...] > @@ -116,11 +127,13 @@ struct optee_ops { > * world > * @teedev: client device > * @smc: specific to SMC ABI > + * @ffa: specific to FF-A ABI > * @call_queue: queue of threads waiting to call @invoke_fn > * @wait_queue: queue of threads from secure world waiting for a > * secure world sync object > * @supp: supplicant synchronization struct for RPC to supplicant > * @pool: shared memory pool > + * @rpc_arg_count: If > 0 number of RPC parameters to make room for > * @scan_bus_done flag if device registation was already done. > * @scan_bus_wq workqueue to scan optee bus and register optee drivers > * @scan_bus_work workq to scan optee bus and register optee drivers > @@ -129,11 +142,17 @@ struct optee { > struct tee_device *supp_teedev; > struct tee_device *teedev; > const struct optee_ops *ops; > - struct optee_smc smc; > + union { > + struct optee_smc smc; > +#ifdef CONFIG_ARM_FFA_TRANSPORT I don't see a point in saving this especially that the definition is available always. Also helps the case when FFA is module. > + struct optee_ffa ffa; > +#endif > + }; > struct optee_call_queue call_queue; > struct optee_wait_queue wait_queue; > struct optee_supp supp; > struct tee_shm_pool *pool; > + unsigned int rpc_arg_count; > bool scan_bus_done; > struct workqueue_struct *scan_bus_wq; > struct work_struct scan_bus_work; > @@ -266,4 +285,12 @@ static inline void reg_pair_from_64(u32 *reg0, u32 *reg1, u64 val) > int optee_smc_abi_register(void); > void optee_smc_abi_unregister(void); > > +#ifdef CONFIG_ARM_FFA_TRANSPORT To support CONFIG_ARM_FFA_TRANSPORT=m this must be, #if IS_REACHABLE(CONFIG_ARM_FFA_TRANSPORT) -- Regards, Sudeep