Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1977155rwe; Fri, 2 Sep 2022 06:53:51 -0700 (PDT) X-Google-Smtp-Source: AA6agR4NXw+YRQq4n9o5NzoAVlJ4iR/BoVY1eVZEtG5pbSrt6Ww+PnsumIWE/W+JnMFkSHe3Hd8P X-Received: by 2002:a17:90b:4a4e:b0:1fe:24b4:bf6a with SMTP id lb14-20020a17090b4a4e00b001fe24b4bf6amr4938211pjb.137.1662126831159; Fri, 02 Sep 2022 06:53:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662126831; cv=none; d=google.com; s=arc-20160816; b=LUbLU2JDfG/WgXDoP+7tsnZxCoT5bd3PGMnNxl3Qq+yStg8pcTtNO/xAX1WSoL69Qq XJYSGLEm8CMp/fF7aU8Z/R8Aok9dvN+3T3TcUfOTUoquPMMW4GF+G6Dn3yTPkAZL7iY0 7Jx8ApUJHJ1vdPKfkYJae4X/rx/9Ml+06ZYlujLEq+ndUY8Pe80eUY+SA7UY3rp8aMq9 SHPv3AzYNMohogQ4AhzX3pn0gu1P0NP7HaMjAYgkq/99xyQivar16KCgHgpxh/8+ASvo un+qLmV2kd/WeqtC5DuE3CKN59TW+GA39gobEgHDApays1Xn9m6IWoeXlsiUZk0UtFHP CSGg== 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=7lUNby0cKwjMln7lF99bBbg8UgnxwvTTp+mP2InKpGk=; b=gkg9xpy81sQTBr++TaBM9i/Fcd/4nivAz6KovavSJeYqXX692i6Zbp51A+IQah12a9 4gRkgj5dkELiV5/EIaywdw3niIBepVacYTzTXdq0NS/JeAPZo69vIfSyjuAGov258hUO ePpPaZiaDiAEwKb/UAdtCSAD4C+SGADhYH8OBrTL4OjSnFI1IEV7qGAs9WHtJH1oQPkh LlVop6AO6wUAvewkqxokinJgXdcVS9S3RSQqFKyhgzRLp7G1P7UpKu5CKBGkjnvsDjXE zyotHZQSoJ8YShpuETfB6oYpe+Izm0mAu12VLkr98NKvu2v4v86ZNLX8ok7bsYcxjqeQ LlYw== 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 u64-20020a638543000000b00430068269fasi2053126pgd.329.2022.09.02.06.53.39; Fri, 02 Sep 2022 06:53:51 -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 S238518AbiIBNOG (ORCPT + 99 others); Fri, 2 Sep 2022 09:14:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236278AbiIBNNV (ORCPT ); Fri, 2 Sep 2022 09:13:21 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7AE71A8CE8 for ; Fri, 2 Sep 2022 05:50:37 -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 9EF5A152B; Fri, 2 Sep 2022 05:40:54 -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 233353F766; Fri, 2 Sep 2022 05:40:47 -0700 (PDT) From: Sudeep Holla To: linux-arm-kernel@lists.infradead.org, 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 v2 04/10] firmware: arm_ffa: Add support for querying FF-A features Date: Fri, 2 Sep 2022 13:40:26 +0100 Message-Id: <20220902124032.788488-5-sudeep.holla@arm.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220902124032.788488-1-sudeep.holla@arm.com> References: <20220902124032.788488-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 Add support for FFA_FEATURES to discover properties supported at the FF-A interface. This interface can be used to query: - If an FF-A interface is implemented by the component at the higher EL, - If an implemented FF-A interface also implements any optional features described in its interface definition, and - Any implementation details exported by an implemented FF-A interface as described in its interface definition. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_ffa/driver.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c index 04e7cbb1b9aa..81b8d578b6ea 100644 --- a/drivers/firmware/arm_ffa/driver.c +++ b/drivers/firmware/arm_ffa/driver.c @@ -571,6 +571,32 @@ static int ffa_memory_reclaim(u64 g_handle, u32 flags) return 0; } +static int ffa_features(u32 func_feat_id, u32 input_props, + u32 *if_props_1, u32 *if_props_2) +{ + ffa_value_t id; + + if (!ARM_SMCCC_IS_FAST_CALL(func_feat_id) && input_props) { + pr_err("%s: Invalid Parameters: %x, %x", __func__, + func_feat_id, input_props); + return ffa_to_linux_errno(FFA_RET_INVALID_PARAMETERS); + } + + invoke_ffa_fn((ffa_value_t){ + .a0 = FFA_FEATURES, .a1 = func_feat_id, .a2 = input_props, + }, &id); + + if (id.a0 == FFA_ERROR) + return ffa_to_linux_errno((int)id.a2); + + if (if_props_1) + *if_props_1 = id.a2; + if (if_props_2) + *if_props_2 = id.a3; + + return 0; +} + static u32 ffa_api_version_get(void) { return drv_info->version; -- 2.37.3