Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp4070591rwe; Tue, 30 Aug 2022 04:14:12 -0700 (PDT) X-Google-Smtp-Source: AA6agR4g0zBG9QIzcHJMClarCu/pl63sUmxUrSEBbByCSqhZyyDUELLna0/M7/iI6z41m75vg07u X-Received: by 2002:a17:903:1c8:b0:173:c58:dc6d with SMTP id e8-20020a17090301c800b001730c58dc6dmr20761105plh.105.1661858051937; Tue, 30 Aug 2022 04:14:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661858051; cv=none; d=google.com; s=arc-20160816; b=BkUb+dNo/vPFGbrwWMZo+CecVpAwKkr95MUED4GH8Wxmq8AKy2ljcuWWqIrps+5PEP wXc5+Y+tdqQkEzsG8of3DOjVuXmeXWIfihtMB/TF/e8Je8co9B/cpn8LQW5At/ukQg14 +fmGLMBhzA+40oxxaQTERR+7NF2ewW8fOjaq9MGCRwLXHwykV+nMmBBi7rozj8BHcdGr g7FY81vtkLApZYkMHDx0Ris8XzoudCuycXcScihlQ6kpRR6e7kcXamD6Lo93kSNlAtP+ 1OFtS3WQER2TOluQI1CDhf0Q/lhyXDFmBZaH/yaNCfUJ3NvWhwOghOCYXfwSNiY8Vw5w Nj/Q== 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=SU9NfqhZjpxTYQVuMEJkb+k2G83vUeJOHApVE5FW9x8=; b=XIwHuaheDJFOpAA0kxXSpq+cfSc5is9QCNBIDUu3jWs2GepRRlzyTwknM2nvBfDu+2 Y3Fyrkmgr5Muve6EWe1zVdxclWCJslxWDxTsfFI7t9Jj3fmbmBvqWdDVswJVdpHCezLG wZ+Awm6uSMuRN6rM3xDLyojok+3sgOtgPPQ4BRqAPL85IoVXXp1c5hR+ur+j0VdqEl1M ailQH5UBdFBzwDOJyxwrjYQQdAfZd34HNAT9dq2c2Ihp2wI2Em5AT0QPW9fyVVC9Hdon HZ/KhI+EL9vou3snrAAjZN3oxNiL/AfHJ5IBpJxjdVjKphz0oLEg0Dn6ss97UwgFZU0D PFEA== 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 y10-20020a62b50a000000b0052d70adee62si11138723pfe.309.2022.08.30.04.14.01; Tue, 30 Aug 2022 04:14:11 -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 S230205AbiH3KMR (ORCPT + 99 others); Tue, 30 Aug 2022 06:12:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229827AbiH3KLu (ORCPT ); Tue, 30 Aug 2022 06:11:50 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 93CA6EA14F for ; Tue, 30 Aug 2022 03:07:33 -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 DBCE31474; Tue, 30 Aug 2022 03:07:38 -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 81EEF3F766; Tue, 30 Aug 2022 03:07:31 -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 4/9] firmware: arm_ffa: Add support for querying FF-A features Date: Tue, 30 Aug 2022 11:06:55 +0100 Message-Id: <20220830100700.344594-5-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 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 | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c index 04e7cbb1b9aa..de94073f4109 100644 --- a/drivers/firmware/arm_ffa/driver.c +++ b/drivers/firmware/arm_ffa/driver.c @@ -571,6 +571,29 @@ 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) +{ + 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) + *if_props = id.a2; + + return 0; +} + static u32 ffa_api_version_get(void) { return drv_info->version; -- 2.37.2