From patchwork Tue Sep 19 17:40:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 13391628 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6AEF2CE79A8 for ; Tue, 19 Sep 2023 17:41:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:In-Reply-To:References:Message-Id: MIME-Version:Subject:Date:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LoZ15hJMzmeIKaVsfvRiaLHpqqXEU5RZy4bsLKg+WaQ=; b=BJUZh4u5eWjZHF KJXbFZ4OKd10yvNTguOyq2KCtODDZ31atyQhwZEGep0PjNuteasy7w6RNuqYadDQNuWG/yrVkX2Z1 Q2AmXUW9Yax0oeon0tRdH5oIot6CyNWLmA9Kxpl5IGA7fiy/Q7aq6rVa/att9TcMLTgI5IOhIvVk5 Ppwn8PSWDYXP/RSyL0CeVvZ5TZLnUorT6WWvqvmBLLx8664xlgPWLH8kczW2R+4ModqojH54+y8lM XaByQrhQQndCmPcXwEGBGygudNQucyBEKEXvcAJkNS9maTBSE8+V0plY39uuagPk6aMR7zOkVhGF0 O1Q/iZOGRCAonlEPjI/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiej0-000xCq-1f; Tue, 19 Sep 2023 17:41:26 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qieiw-000xAU-38 for linux-arm-kernel@lists.infradead.org; Tue, 19 Sep 2023 17:41:24 +0000 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 36282C15; Tue, 19 Sep 2023 10:41:57 -0700 (PDT) Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DE89D3F5A1; Tue, 19 Sep 2023 10:41:18 -0700 (PDT) From: Sudeep Holla Date: Tue, 19 Sep 2023 18:40:49 +0100 Subject: [PATCH RFT v2 01/18] firmware: arm_ffa: Update the FF-A command list with v1.1 additions MIME-Version: 1.0 Message-Id: <20230919-ffa_v1-1_notif-v2-1-6f3a3ca3923c@arm.com> References: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> In-Reply-To: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sudeep Holla , Jens Wiklander , Marc Bonnici , Coboy Chen , Lorenzo Pieralisi , Olivier Deprez X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=3496; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=GwWLoVhrulDY2bwfDeXIMqLT2lw7GQ+ueDJLTgf69i8=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBlCd06kGM6XsrPjDdXez3yDjtxP3Awzq6XK3WwH MpW+a9ZgUuJAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZQndOgAKCRAAQbq8MX7i mPVSD/9Kwk/e1SwDW41AbZA2sPkQu95RhBGG4kr4FbqWHyC9moXEzGTQkEfR+jiShfVye2JCRRe paeYSlN1XOhMaqaKA3yEhQE1Bj7HH3DVtn8HvCLScSFQ6UeZTSeJyQzi1+1SoesHJsvBsIQVX3+ pOvgzv9Ax8w1iuRvMlqFgMVjzGRREh+ncoY4Ak/JWRjZ1+NXMvPZMmfe2QvWdCRs0y+KI2r9DJ0 nB902wEifp5aiRzxYzheknJ37HlDQRrGWtWzcITRq7Ks2E81cB+0DAQOw/opeS+QNlBFPzO2iVX GZ0t62vPF2OWniN26mr+qwyb7NmcTmdPh2yqAekq/9VaRUTOBnzoGjUg/q0HqmPoBeMmjI9Rdfk 5QCSWYXcj8m7cfMRJnKg/CNbkETcPnX+onz5ybvnTyBV8tc9UURnNVrRL7dSSqvDdXy2Kk0TOfd zhhVH5kkVZjn/4Ozih97+cW6jdARSAWXG5pyaEDpa9MkhlYvBzdZ/SEEzCQWWUkSTMaHjMBOfhC PpIL03zlQthsw4N1/YKg8J4EQA+rfbP8thNJsnf48kc1+Np7kJEqg0Lu0d0FMkAQey+wivf6B84 zMbbmt5HlU7CIGz0H6DZmeL2+Q/4QBG7p8M+mYcZlDc3UIGYDgVb+34R1kDIp8j7864t2eyUjLk VLJq85EOIg4e8Zw== X-Developer-Key: i=sudeep.holla@arm.com; a=openpgp; fpr=7360A21742ADF5A11767C1C139CFD4755FE2D5B4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230919_104123_108974_86950E4D X-CRM114-Status: GOOD ( 13.66 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Arm Firmware Framework for A-profile(FFA) v1.1 introduces notifications and indirect messaging based upon notifications support and extends some of the memory interfaces. Let us add all the newly supported FF-A function IDs in the spec. Also update to the error values and associated handling. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_ffa/driver.c | 3 ++- include/linux/arm_ffa.h | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c index 2109cd178ff7..6fc83fa6b81c 100644 --- a/drivers/firmware/arm_ffa/driver.c +++ b/drivers/firmware/arm_ffa/driver.c @@ -64,6 +64,7 @@ static const int ffa_linux_errmap[] = { -EACCES, /* FFA_RET_DENIED */ -EAGAIN, /* FFA_RET_RETRY */ -ECANCELED, /* FFA_RET_ABORTED */ + -ENODATA, /* FFA_RET_NO_DATA */ }; static inline int ffa_to_linux_errno(int errno) @@ -336,7 +337,7 @@ static int ffa_mem_first_frag(u32 func_id, phys_addr_t buf, u32 buf_sz, if (ret.a0 == FFA_ERROR) return ffa_to_linux_errno((int)ret.a2); - if (ret.a0 == FFA_SUCCESS) { + if (ret.a0 == FFA_SUCCESS || ret.a0 == FFA_FN64_SUCCESS) { if (handle) *handle = PACK_HANDLE(ret.a2, ret.a3); } else if (ret.a0 == FFA_MEM_FRAG_RX) { diff --git a/include/linux/arm_ffa.h b/include/linux/arm_ffa.h index cc060da51bec..2ea1717a0825 100644 --- a/include/linux/arm_ffa.h +++ b/include/linux/arm_ffa.h @@ -20,6 +20,7 @@ #define FFA_ERROR FFA_SMC_32(0x60) #define FFA_SUCCESS FFA_SMC_32(0x61) +#define FFA_FN64_SUCCESS FFA_SMC_64(0x61) #define FFA_INTERRUPT FFA_SMC_32(0x62) #define FFA_VERSION FFA_SMC_32(0x63) #define FFA_FEATURES FFA_SMC_32(0x64) @@ -54,6 +55,23 @@ #define FFA_MEM_FRAG_RX FFA_SMC_32(0x7A) #define FFA_MEM_FRAG_TX FFA_SMC_32(0x7B) #define FFA_NORMAL_WORLD_RESUME FFA_SMC_32(0x7C) +#define FFA_NOTIFICATION_BITMAP_CREATE FFA_SMC_32(0x7D) +#define FFA_NOTIFICATION_BITMAP_DESTROY FFA_SMC_32(0x7E) +#define FFA_NOTIFICATION_BIND FFA_SMC_32(0x7F) +#define FFA_NOTIFICATION_UNBIND FFA_SMC_32(0x80) +#define FFA_NOTIFICATION_SET FFA_SMC_32(0x81) +#define FFA_NOTIFICATION_GET FFA_SMC_32(0x82) +#define FFA_NOTIFICATION_INFO_GET FFA_SMC_32(0x83) +#define FFA_FN64_NOTIFICATION_INFO_GET FFA_SMC_64(0x83) +#define FFA_RX_ACQUIRE FFA_SMC_32(0x84) +#define FFA_SPM_ID_GET FFA_SMC_32(0x85) +#define FFA_MSG_SEND2 FFA_SMC_32(0x86) +#define FFA_SECONDARY_EP_REGISTER FFA_SMC_32(0x87) +#define FFA_FN64_SECONDARY_EP_REGISTER FFA_SMC_64(0x87) +#define FFA_MEM_PERM_GET FFA_SMC_32(0x88) +#define FFA_FN64_MEM_PERM_GET FFA_SMC_64(0x88) +#define FFA_MEM_PERM_SET FFA_SMC_32(0x89) +#define FFA_FN64_MEM_PERM_SET FFA_SMC_64(0x89) /* * For some calls it is necessary to use SMC64 to pass or return 64-bit values. @@ -76,6 +94,7 @@ #define FFA_RET_DENIED (-6) #define FFA_RET_RETRY (-7) #define FFA_RET_ABORTED (-8) +#define FFA_RET_NO_DATA (-9) /* FFA version encoding */ #define FFA_MAJOR_VERSION_MASK GENMASK(30, 16) @@ -86,6 +105,7 @@ (FIELD_PREP(FFA_MAJOR_VERSION_MASK, (major)) | \ FIELD_PREP(FFA_MINOR_VERSION_MASK, (minor))) #define FFA_VERSION_1_0 FFA_PACK_VERSION_INFO(1, 0) +#define FFA_VERSION_1_1 FFA_PACK_VERSION_INFO(1, 1) /** * FF-A specification mentions explicitly about '4K pages'. This should From patchwork Tue Sep 19 17:40:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 13391631 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C867FCE79AA for ; Tue, 19 Sep 2023 17:42:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:In-Reply-To:References:Message-Id: MIME-Version:Subject:Date:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bHBFzH9VqaafdKw18yVY7HYyv7peSAHJ1JDunS6Ve2c=; b=gSy/lt0aEYiyE8 7r8ESdYtHNi66I3OwruKcLueQR+CUf/zwZRSBr7RtkPYn3LZQkHy/nKFUHyZbraVRkXVBw7SbBPBY 3DPKpeRXr+aMKoFG5OhbDtISoOA5+z9aASw3kMzLI7vVwqv07e14SyJcqcdkkqkxQLUFfUM2kGJDL eIkI0PgwWBROAdB5b+617fIEoeHfUfOMzaxuCa7WlHxHxTCYxXQ9nzF4fjN+6pzvSrb3goc2HwRj4 ZzoF8A2ulgiW7KbYiydqm8OMkqj3HLMzZwcWo83+gSvQs/6jBrmCwR+RGdPcFokKE/gsC3M2WcmbN VXuek3YmYHnHcaopPC2w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiej9-000xHq-38; Tue, 19 Sep 2023 17:41:35 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qieiy-000xAw-1E for linux-arm-kernel@lists.infradead.org; Tue, 19 Sep 2023 17:41:26 +0000 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 61AB0FEC; Tue, 19 Sep 2023 10:41:58 -0700 (PDT) Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 164A93F5A1; Tue, 19 Sep 2023 10:41:19 -0700 (PDT) From: Sudeep Holla Date: Tue, 19 Sep 2023 18:40:50 +0100 Subject: [PATCH RFT v2 02/18] firmware: arm_ffa: Implement notification bitmap create and destroy interfaces MIME-Version: 1.0 Message-Id: <20230919-ffa_v1-1_notif-v2-2-6f3a3ca3923c@arm.com> References: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> In-Reply-To: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sudeep Holla , Jens Wiklander , Marc Bonnici , Coboy Chen , Lorenzo Pieralisi , Olivier Deprez X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=3398; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=j7d2i8CVINs5jyS14TuFWaqZrPCGJMCk2srmUKJvdW8=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBlCd06QZn5C9izY1A/eynVtrklx/AVvq3+Tj6Gm lvxvS/Euo6JAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZQndOgAKCRAAQbq8MX7i mB8yD/9DKYH5p7gWrZcQ7Hfxovms8Cl+ggEC3d7QDvN9WXOOuMXb8RNZfw7KMOY1TuCuAoLBgUJ d0q7RmUwdXzN+/Ht6Xu8gxmqbzlLf9AzBvKVAXkdZBiJYQiXWqEmoiwpjrAEjYjgTsegD6hG5D6 a95TqZeuNg/E9tdDn0FujAq9vwj5p1gEfUwzqJXt1k1FJMisB/0pUP+FO7u3lm4LlraRlC7eHtp KpqfnemY3giLyouee15bgPT/6YRetTdy8TGNxc3jMqxvGs0B63/BZQjZ5jh9spnTR6/HSZGVe8V z3mJN70EKBW5xQ+oGhVCDV9hGfUQLm5cq5/gq/STBCw25kswPqCa2pRqaCsn0K0rMaJ1byoyCew 6bctIu0lIaPVCHhZqG0E0vF6wSopHiZeEvUEP8QOHb+gzk5VYgpIKogPxOubW0DfHhsREaS7Q9L w5tN9xknIwHf3FFSczYhIaprybxqYfpjsE3dcL2V3Ri2OFTEYLE0A6UyD7yXl4dpTZo4K/wIWap /9cRI9k6/Jq7XWqtAa0LuJeTTJOrXmZJG5eaboC5HVqlavS+46/2rVTiFgVtQtCKxRzz6KA9nNe KOjCY4Akufdh7B0hA1BBYJ5U5VEcjQzFoNrOLx9I5jjNfm7UuA2oFt4LBYuVUnRxSDv/uimbtU9 ZK/FHygpJePngQA== X-Developer-Key: i=sudeep.holla@arm.com; a=openpgp; fpr=7360A21742ADF5A11767C1C139CFD4755FE2D5B4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230919_104124_529545_A18A37F9 X-CRM114-Status: GOOD ( 15.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On systems without a hypervisor the responsibility of requesting the creation of the notification bitmaps in the SPM falls to the FF-A driver. We use FFA features to determine if the ABI is supported, if it is not we can assume there is a hypervisor present and will take care of ensure the relevant notifications bitmaps are created on this partitions behalf. An endpoint’s notification bitmaps needs to be setup before it configures its notifications and before other endpoints and partition managers can start signaling these notifications. Add interface to create and destroy the notification bitmaps and use the same to do the necessary setup during the initialisation and cleanup during the module exit. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_ffa/driver.c | 60 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c index 6fc83fa6b81c..5522523afefe 100644 --- a/drivers/firmware/arm_ffa/driver.c +++ b/drivers/firmware/arm_ffa/driver.c @@ -84,6 +84,7 @@ struct ffa_drv_info { void *rx_buffer; void *tx_buffer; bool mem_ops_native; + bool bitmap_created; }; static struct ffa_drv_info *drv_info; @@ -543,6 +544,37 @@ static int ffa_features(u32 func_feat_id, u32 input_props, return 0; } +static int ffa_notification_bitmap_create(void) +{ + ffa_value_t ret; + u16 vcpu_count = nr_cpu_ids; + + invoke_ffa_fn((ffa_value_t){ + .a0 = FFA_NOTIFICATION_BITMAP_CREATE, + .a1 = drv_info->vm_id, .a2 = vcpu_count, + }, &ret); + + if (ret.a0 == FFA_ERROR) + return ffa_to_linux_errno((int)ret.a2); + + return 0; +} + +static int ffa_notification_bitmap_destroy(void) +{ + ffa_value_t ret; + + invoke_ffa_fn((ffa_value_t){ + .a0 = FFA_NOTIFICATION_BITMAP_DESTROY, + .a1 = drv_info->vm_id, + }, &ret); + + if (ret.a0 == FFA_ERROR) + return ffa_to_linux_errno((int)ret.a2); + + return 0; +} + static void ffa_set_up_mem_ops_native_flag(void) { if (!ffa_features(FFA_FN_NATIVE(MEM_LEND), 0, NULL, NULL) || @@ -700,6 +732,31 @@ static void ffa_setup_partitions(void) kfree(pbuf); } +static int ffa_notifications_setup(void) +{ + int ret; + + ret = ffa_features(FFA_NOTIFICATION_BITMAP_CREATE, 0, NULL, NULL); + if (!ret) { + ret = ffa_notification_bitmap_create(); + if (ret) { + pr_err("notification_bitmap_create error %d\n", ret); + return ret; + } + } + drv_info->bitmap_created = true; + + return 0; +} + +static void ffa_notifications_cleanup(void) +{ + if (drv_info->bitmap_created) { + ffa_notification_bitmap_destroy(); + drv_info->bitmap_created = false; + } +} + static int __init ffa_init(void) { int ret; @@ -755,7 +812,7 @@ static int __init ffa_init(void) ffa_set_up_mem_ops_native_flag(); - return 0; + return ffa_notifications_setup(); free_pages: if (drv_info->tx_buffer) free_pages_exact(drv_info->tx_buffer, RXTX_BUFFER_SIZE); @@ -770,6 +827,7 @@ subsys_initcall(ffa_init); static void __exit ffa_exit(void) { + ffa_notifications_cleanup(); ffa_rxtx_unmap(drv_info->vm_id); free_pages_exact(drv_info->tx_buffer, RXTX_BUFFER_SIZE); free_pages_exact(drv_info->rx_buffer, RXTX_BUFFER_SIZE); From patchwork Tue Sep 19 17:40:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 13391635 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B27FFCE79A8 for ; Tue, 19 Sep 2023 17:42:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:In-Reply-To:References:Message-Id: MIME-Version:Subject:Date:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=M+iGzsUwCmn2REtbi8bC/ssCHFQC5Y0c+hQ9j91RnX8=; b=h1QTKssLxFXDOR jYKe7vflsIVFhqBqVkOIwhy+TcxA138AuRw54hRmU6ESWlAlZE+5DlNrXy5yBwKxfH6TebYmossSU 9BYHUIym5KDr92YXLYXQfNAu8U+LnJOrhiYQfQnjCfFQH1m2QimA3NW4KDui3BuBUqbgNGL869dmf LMYAVJCJ05Fg5i1BOFfB+rmcoWCqwrVJjnpV5kFjOrUyFUaBQsbvWJcSHQ8r1imgIRYNo5MnzCu54 cneIF4EluHqkPh0ENEfCI6MX1nfKsd1R5bTzkuXSl6hUww3yzDJ0q5mFf0XcKVKpZ5b1uzJSRC8m9 37IBLjTmCxLX399BVdjw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiej9-000xHF-1S; Tue, 19 Sep 2023 17:41:35 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qieiy-000xBe-1p for linux-arm-kernel@lists.infradead.org; Tue, 19 Sep 2023 17:41:26 +0000 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 8DA5E1042; Tue, 19 Sep 2023 10:41:59 -0700 (PDT) Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 422033F5A1; Tue, 19 Sep 2023 10:41:21 -0700 (PDT) From: Sudeep Holla Date: Tue, 19 Sep 2023 18:40:51 +0100 Subject: [PATCH RFT v2 03/18] firmware: arm_ffa: Implement the notification bind and unbind interface MIME-Version: 1.0 Message-Id: <20230919-ffa_v1-1_notif-v2-3-6f3a3ca3923c@arm.com> References: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> In-Reply-To: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sudeep Holla , Jens Wiklander , Marc Bonnici , Coboy Chen , Lorenzo Pieralisi , Olivier Deprez X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2207; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=ET5oJlM5G7gOdj/dFHjwPTU08+J7ULwiBffB/kiZbxY=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBlCd06hqwaMTYfPjR5qE4M4Yy7h0Ft1HHqLok5k 23GPg9+dH2JAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZQndOgAKCRAAQbq8MX7i mJ0qD/4tbaCgUPxoghPMR9Kw2eY8cOAR4cve4ySgZIvcsthhY8X+avKefW8wZg+UwbhviQeZ9zM DjuYLnO0t0lgr63EVwa+LENFZQYZDLXyJsZViehXTw2mKTbuN21pWx1FC0u0N2c7WuTziabTzvs To5DEmMTRwWf3HaV9JxL25jHTn11eS7F9kjxT0Fxx7Dv1kt1xdITlTqyHvDh8h3ydauuJSf4jRe EcAV7Ss0uQs1ppFOTCQNq1RN/OUg22duopQQ0cBi+x3Fq5Wj0vm7SAo7XyiIqS51W69JwJ9CnEC AfYX64FXl4SvPFZP8CEL7jJUFMxi+0KjOYn+4SNXgSmUAsSj1wxVPNa2swVpYuLzNJXbZVonVdt aknp6w3RqTCcK4MHQw/RrI5P7LeW4V43MUsAEuaMhxrwfVjwmI2dlXwuTfCMmltQWLzb8bP7N5h pQv5AJyxyEaThIawRKbCoK7N8NYkQiduVNK6BjT2GVWRKiM9JWjdTY7upzDArGfirGm10rJvDhh YecHn6F1XoC+CUzQBvTCDVcPkL6cKIdckCl/VTlUiD+lVds08VG1uZJ8+Bbd94RnqKDwxa9qDdA xUQ/9Vnka8EPOZdUPfEeCROP6zqvEUsNr3LPXn9UnC1dqW2yqkYr8jVID/tO7r+2UnHYD/gD40e UuECNfBYDi9XNbA== X-Developer-Key: i=sudeep.holla@arm.com; a=openpgp; fpr=7360A21742ADF5A11767C1C139CFD4755FE2D5B4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230919_104124_698081_B6C68E57 X-CRM114-Status: GOOD ( 13.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org A receiver endpoint must bind a notification to any sender endpoint before the latter can signal the notification to the former. The receiver assigns one or more doorbells to a specific sender. Only the sender can ring these doorbells. A receiver uses the FFA_NOTIFICATION_BIND interface to bind one or more notifications to the sender. A receiver un-binds a notification from a sender endpoint to stop the notification from being signaled. It uses the FFA_NOTIFICATION_UNBIND interface to do this. Allow the FF-A driver to be able to bind and unbind a given notification ID to a specific partition ID. This will be used to register and unregister notification callbacks from the FF-A client drivers. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_ffa/driver.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c index 5522523afefe..ab67cb22a206 100644 --- a/drivers/firmware/arm_ffa/driver.c +++ b/drivers/firmware/arm_ffa/driver.c @@ -575,6 +575,35 @@ static int ffa_notification_bitmap_destroy(void) return 0; } +#define NOTIFICATION_LOW_MASK GENMASK(31, 0) +#define NOTIFICATION_HIGH_MASK GENMASK(63, 32) +#define NOTIFICATION_BITMAP_HIGH(x) \ + ((u32)(FIELD_GET(NOTIFICATION_HIGH_MASK, (x)))) +#define NOTIFICATION_BITMAP_LOW(x) \ + ((u32)(FIELD_GET(NOTIFICATION_LOW_MASK, (x)))) + +static int ffa_notification_bind_common(u16 dst_id, u64 bitmap, + u32 flags, bool is_bind) +{ + ffa_value_t ret; + u32 func, src_dst_ids = PACK_TARGET_INFO(drv_info->vm_id, dst_id); + + func = is_bind ? FFA_NOTIFICATION_BIND : FFA_NOTIFICATION_UNBIND; + + invoke_ffa_fn((ffa_value_t){ + .a0 = func, .a1 = src_dst_ids, .a2 = flags, + .a3 = NOTIFICATION_BITMAP_LOW(bitmap), + .a4 = NOTIFICATION_BITMAP_HIGH(bitmap), + }, &ret); + + if (ret.a0 == FFA_ERROR) + return ffa_to_linux_errno((int)ret.a2); + else if (ret.a0 != FFA_SUCCESS) + return -EINVAL; + + return 0; +} + static void ffa_set_up_mem_ops_native_flag(void) { if (!ffa_features(FFA_FN_NATIVE(MEM_LEND), 0, NULL, NULL) || From patchwork Tue Sep 19 17:40:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 13391629 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D075FCE79AA for ; Tue, 19 Sep 2023 17:41:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:In-Reply-To:References:Message-Id: MIME-Version:Subject:Date:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GffqPb+I5vNrWgkU0r3Yw0I5tKdjUwH1wAeUaKRuD6Q=; b=JZ2PdTdPuC7z3e crmX2W52qstZw0wUW1ZhxD7ElxGtMW8b7LXCNVnXaLId1WJi5eaKdufelJ5O0vNwqAC5owKxMOivC G/ci2YOFg62mX+I99x24uDQITXEXSDpvcFpp2ysdtDZpmqfNBuzQV3qeoJtqJXS4vPzEqeb3rdmxM SGMgtF4iZvH2/Lu/CDpf0mcCxKzl6c6kR/3lP6q6XfD3XBQsPmAK3/kxihi7UOFJshKG8S9LVPHH8 +j4LIox+2akZjLXN6B0kXX7U01hitCP4QDZQppcGggV8Wahl9f9izPG0WU1o/qHKURRNTXRQ79q5Y YWM0Wn7K8y2cDc6bhbOA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiej8-000xH1-2r; Tue, 19 Sep 2023 17:41:34 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qieiy-000xC7-2w for linux-arm-kernel@lists.infradead.org; Tue, 19 Sep 2023 17:41:26 +0000 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 BC70A1474; Tue, 19 Sep 2023 10:42:00 -0700 (PDT) Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6E57A3F5A1; Tue, 19 Sep 2023 10:41:22 -0700 (PDT) From: Sudeep Holla Date: Tue, 19 Sep 2023 18:40:52 +0100 Subject: [PATCH RFT v2 04/18] firmware: arm_ffa: Implement the FFA_RUN interface MIME-Version: 1.0 Message-Id: <20230919-ffa_v1-1_notif-v2-4-6f3a3ca3923c@arm.com> References: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> In-Reply-To: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sudeep Holla , Jens Wiklander , Marc Bonnici , Coboy Chen , Lorenzo Pieralisi , Olivier Deprez X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2472; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=Ugwvwd8/JIC0seKTsKMUdQtcSkqVhmHWDulozxAowZA=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBlCd060uHK0tRWi3ytD1pZwYtn7oc6ElPw6Hm3x XilsdPeefCJAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZQndOgAKCRAAQbq8MX7i mEqBEADXfXTUOzW4/rKDAuRiJCaizNvA5FyQeEgI3XDejJaVgzISgtwM3Sbm4bQSl427o5f1UKJ zo8gojg4zEb3+frHxX+dmMdoOmbB2EeOTLymZVW06DWX7FIc/kmdkW7zGEdjejE+8+Z2SgwtB45 eXUJEswH5rzaqW4i4C3QPlBVOlnwQIzjRm9Ta3woHewEQccF6UJ+6e/zuKWJdzAV1PktE7YscPe JoBjjxF4e5m9daXWE3bYr+utk333psiCRd26pFhWelVnEHcKqdENA1XI/B2rDtoQZqEE589krPA 8UcjGktvfJtusxMeHyhSrM+o07MVqhWtoTLu8uzu0pCoRMFxClMOBxpgiwGsYgDjQpnuZSnYaAm SosWo7UNOngwkcx88cNFkbSpY/W0JQ7opvgCko/jAvI6QnkmhMwWzVqfk2A/KB45o/J50/eswyD KReynHDoaH6184X1/doxcFrdWs68IaW1f8b300i8Wk15fYIyEeTPGt/79rfWSbn4mCmN6MRwJS8 KObB0gjkgNv7+a7wyU9oegFcVRy33uAXtIcEDO1BpJ3b1qw7slWbJYnJyt4xXiIUtxns8eX6x9h MQAfjBPSkypkkwNjyC4/9Gr/CLehU927SulLy7flxUNvXT7ct3cSQ9yZUV/nr4+GrWFvajrjtmw t1hH9YNv4iLdD1w== X-Developer-Key: i=sudeep.holla@arm.com; a=openpgp; fpr=7360A21742ADF5A11767C1C139CFD4755FE2D5B4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230919_104125_089236_5B866999 X-CRM114-Status: GOOD ( 14.11 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org FFA_RUN is used by a scheduler to allocate CPU cycles to a target endpoint execution context specified in the target information parameter. If the endpoint execution context is in the waiting/blocked state, it transitions to the running state. Expose the ability to call FFA_RUN in order to give any partition in the system cpu cycles to perform IMPDEF functionality. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_ffa/driver.c | 22 ++++++++++++++++++++++ include/linux/arm_ffa.h | 5 +++++ 2 files changed, 27 insertions(+) diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c index ab67cb22a206..ebe1ecc57099 100644 --- a/drivers/firmware/arm_ffa/driver.c +++ b/drivers/firmware/arm_ffa/driver.c @@ -604,6 +604,23 @@ static int ffa_notification_bind_common(u16 dst_id, u64 bitmap, return 0; } +static int ffa_run(struct ffa_device *dev, u16 vcpu) +{ + ffa_value_t ret; + u32 target = dev->vm_id << 16 | vcpu; + + invoke_ffa_fn((ffa_value_t){ .a0 = FFA_RUN, .a1 = target, }, &ret); + + while (ret.a0 == FFA_INTERRUPT) + invoke_ffa_fn((ffa_value_t){ .a0 = FFA_RUN, .a1 = ret.a1, }, + &ret); + + if (ret.a0 == FFA_ERROR) + return ffa_to_linux_errno((int)ret.a2); + + return 0; +} + static void ffa_set_up_mem_ops_native_flag(void) { if (!ffa_features(FFA_FN_NATIVE(MEM_LEND), 0, NULL, NULL) || @@ -696,10 +713,15 @@ static const struct ffa_mem_ops ffa_drv_mem_ops = { .memory_lend = ffa_memory_lend, }; +static const struct ffa_cpu_ops ffa_drv_cpu_ops = { + .run = ffa_run, +}; + static const struct ffa_ops ffa_drv_ops = { .info_ops = &ffa_drv_info_ops, .msg_ops = &ffa_drv_msg_ops, .mem_ops = &ffa_drv_mem_ops, + .cpu_ops = &ffa_drv_cpu_ops, }; void ffa_device_match_uuid(struct ffa_device *ffa_dev, const uuid_t *uuid) diff --git a/include/linux/arm_ffa.h b/include/linux/arm_ffa.h index 2ea1717a0825..12fd134bf670 100644 --- a/include/linux/arm_ffa.h +++ b/include/linux/arm_ffa.h @@ -387,10 +387,15 @@ struct ffa_mem_ops { int (*memory_lend)(struct ffa_mem_ops_args *args); }; +struct ffa_cpu_ops { + int (*run)(struct ffa_device *dev, u16 vcpu); +}; + struct ffa_ops { const struct ffa_info_ops *info_ops; const struct ffa_msg_ops *msg_ops; const struct ffa_mem_ops *mem_ops; + const struct ffa_cpu_ops *cpu_ops; }; #endif /* _LINUX_ARM_FFA_H */ From patchwork Tue Sep 19 17:40:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 13391636 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 03496CE79AF for ; Tue, 19 Sep 2023 17:42:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:In-Reply-To:References:Message-Id: MIME-Version:Subject:Date:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=u7Iq/4Vu3+soLtSG79lQe4KsPAojS9f3FEa9yQcgwWM=; b=Fz/X9S7ix5tV8e zeDDLJFPVV05Zt4N1+HiVHVSTEuAxvNVL5HbZhgHrwAGkehORa/N06UgFAConfmhEdSqBM6bcCb4O kZlqwByybHU51v+aNoMlcl1kEluvL8V7bCeW9FbqA6Ve1cOv5JEBWLOVhm3+lHH9XJck2HL9M4bEF ILLMhRgdZH2dYa+cwqw7ZjLSXyseoU40ewlpO964lo3sYSDA2c6aE62dRdLZShs34d3YxJClOExqp CjbhmSgz13HsFfd1HE0HbJVe08Ekydybxkk0Iug/49ZjjVxFgdsn6HLPIJ7oebPejnX0sJ4HhWir9 Ns0h+zcBc4wSJ/7+dwWw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiejA-000xII-1r; Tue, 19 Sep 2023 17:41:36 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiej1-000xDE-29 for linux-arm-kernel@lists.infradead.org; Tue, 19 Sep 2023 17:41:29 +0000 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 E6D40143D; Tue, 19 Sep 2023 10:42:01 -0700 (PDT) Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9A08E3F5A1; Tue, 19 Sep 2023 10:41:23 -0700 (PDT) From: Sudeep Holla Date: Tue, 19 Sep 2023 18:40:53 +0100 Subject: [PATCH RFT v2 05/18] firmware: arm_ffa: Implement the FFA_NOTIFICATION_SET interface MIME-Version: 1.0 Message-Id: <20230919-ffa_v1-1_notif-v2-5-6f3a3ca3923c@arm.com> References: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> In-Reply-To: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sudeep Holla , Jens Wiklander , Marc Bonnici , Coboy Chen , Lorenzo Pieralisi , Olivier Deprez X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1504; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=PMF7W8gP08NmJpWmNAG8MEfkwerfmt6TtimmzyfxT6Q=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBlCd062+rtFD+44yL0Ekw5PGXXJ+O+CH2hxDgPl oo7XyQZC7+JAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZQndOgAKCRAAQbq8MX7i mMz3D/978oazRdsQBQ1CfVAgN3UMUwEFY2s+U2EOyTnNCCkLb08bn2TmY2Ul4Q8yulS8Z/d1yEF ryXH87x53jlhDFOUOoVxQWBx1ZGsYXbWr9SS4uc17T8VTQPZ/Yj2Zs7m5ErtJn7kJ3vgOvYJUY2 mko5cDfNqAzdB9dHEXdTaO3FcKFaYlTFU+W003LnYIh8Yo29I16e1YgasLGcuvalBfGOcdVedRM 66m2ZXyT+gYg0Hj4mjPR08uYczTQJgSQWVPvL818HDQP6VRABdd3SS2NqKK4B/dajuzs2Ox05yI l92A8zoQSSgjnmj8DJ84mDGx0GdX+cOaDDrUfBsYKo0E84BeCoJOctELSMOWEpwt03n07/nBW6L /h9ttmhBiv4Nq73pxfn6MhR9PswwrFy5N7VYXb4Kn2DhqcQdcAn2DHcWBgfWGVA5l16L0VzNOrF ncBqYr9daRg8RsR0RYjMju005j/a1mKUKWUEiA94M/KfwPvs7PMKu6/GL2I08ZbO+ptfevIEVC3 j4a7B6ZQBSL657Jsi3TuCDcqH5kEO9zMVI3KqciVFyfvoChioz64DaksuJWS8YTN1i4mzG2yyYq bq3dMS2llQLJnJsMyS6kB4t6bRwZHST1A/iI05lAn9t/kk8RNFkPVsCYjnvVnTTcjJ7mfR37Zx/ MKPBzzt1GqU5hqw== X-Developer-Key: i=sudeep.holla@arm.com; a=openpgp; fpr=7360A21742ADF5A11767C1C139CFD4755FE2D5B4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230919_104127_750204_1C448E0D X-CRM114-Status: GOOD ( 10.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The framework provides an interface to the sender to specify the notification to signal to the receiver. A sender signals a notification by requesting its partition manager to set the corresponding bit in the notifications bitmap of the receiver invoking FFA_NOTIFICATION_SET. Implement the FFA_NOTIFICATION_SET to enable the caller(sender) to send the notifications for any other partitions in the system. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_ffa/driver.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c index ebe1ecc57099..2aae838ba46a 100644 --- a/drivers/firmware/arm_ffa/driver.c +++ b/drivers/firmware/arm_ffa/driver.c @@ -604,6 +604,26 @@ static int ffa_notification_bind_common(u16 dst_id, u64 bitmap, return 0; } +static +int ffa_notification_set(u16 src_id, u16 dst_id, u32 flags, u64 bitmap) +{ + ffa_value_t ret; + u32 src_dst_ids = PACK_TARGET_INFO(src_id, dst_id); + + invoke_ffa_fn((ffa_value_t) { + .a0 = FFA_NOTIFICATION_SET, .a1 = src_dst_ids, .a2 = flags, + .a3 = NOTIFICATION_BITMAP_LOW(bitmap), + .a4 = NOTIFICATION_BITMAP_HIGH(bitmap), + }, &ret); + + if (ret.a0 == FFA_ERROR) + return ffa_to_linux_errno((int)ret.a2); + else if (ret.a0 != FFA_SUCCESS) + return -EINVAL; + + return 0; +} + static int ffa_run(struct ffa_device *dev, u16 vcpu) { ffa_value_t ret; From patchwork Tue Sep 19 17:40:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 13391630 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0F116CE79A8 for ; Tue, 19 Sep 2023 17:42:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:In-Reply-To:References:Message-Id: MIME-Version:Subject:Date:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/mvsFI+PAspA3oDbqATlkiYNZjDmRZayYUAfn17A5FA=; b=dDboFHYVOTvli8 PyrOGguZrobbj9BsMhMpsK2y6XQafuxUQPNitUQ6O+xudx37WRwnOFeVcq+ntkBxvkgrermSipDW5 VBBCr9yKog+5TRUVfbRFf4e43UqRuWEqpA7YWUki2SmKSPHXruPW1iw8dhwVJkIEme6Ke/a3a5lyp 8ShS4sYR239rowy+ndriyB702UppyZVZRETewwIqYYQ8III/YTDCps5noUeYw+49vttrP9D6ttcOd KLLZAZOmhK/KbNSKNTKDiTxtGA2geim8+c+Ks2398/99ztQ2Ykh8VcNioV9Ja8Hexjsfm5O6oUgBQ zUJxsqniyfiDubuakWBA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiejB-000xIo-0K; Tue, 19 Sep 2023 17:41:37 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiej1-000xDD-29 for linux-arm-kernel@lists.infradead.org; Tue, 19 Sep 2023 17:41:29 +0000 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 1CAC41FB; Tue, 19 Sep 2023 10:42:03 -0700 (PDT) Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C5A583F5A1; Tue, 19 Sep 2023 10:41:24 -0700 (PDT) From: Sudeep Holla Date: Tue, 19 Sep 2023 18:40:54 +0100 Subject: [PATCH RFT v2 06/18] firmware: arm_ffa: Implement the FFA_NOTIFICATION_GET interface MIME-Version: 1.0 Message-Id: <20230919-ffa_v1-1_notif-v2-6-6f3a3ca3923c@arm.com> References: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> In-Reply-To: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sudeep Holla , Jens Wiklander , Marc Bonnici , Coboy Chen , Lorenzo Pieralisi , Olivier Deprez X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2442; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=K2YvsILaFgpr4lZX+pTYFCZTBnlVK2W1JnRsJZazgIA=; b=owEBbAKT/ZANAwAIAQBBurwxfuKYAcsmYgBlCd06QXKkqx4Wz2xxAT7OvoEFG10hO4sIVYO1m jdo2RZiX+SJAjIEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZQndOgAKCRAAQbq8MX7i mIv9D/ibxw1xn1QD9eCMGeI6hx5YcyE9Rq6Jrrcn/9J+GfmOt1/ZLNNIzpcf4cICA7hwBGZCkdW td9eOsMYwiYiBR7lnJEKsPpPRMu38uTXQmOOBp5wUR7ap6NYOrV2L1Haik2ip2rjrDEZ1wiYKOf FS7P0661KKQJLrJyFnTqisEjL661m7cNVynYDxZBkjQychPMhfjrDu2dhbrSpgFN0BeiGQCepjL vYzRqwVeJacXpCeCLxe589xpQdV2+CNtJj/lLIkFHl9/XfqmPve7BBl+nNBonwcXaqaKU4FGt2q ETRf1UtD2lcsCfsGmixptpg55Jrkwysxl6zpFVBJwPfOd2vkmeHNwk6yvjeAExKYPQU1SBDFWK/ 1dv49RA/ryCZe7tNDF9ctSNTAWyO4tZ6N41TqUwsiyHsZVG8B+1YxV0FkO5V5Ic5ctrQ49dFWFL lpLTcjQtdT2F89djZsac2yU6fUrfZ1s+sUIUIJCdfGLzmhywVByVLkb31bUGuitj7YLFkQeNWTL Q25HUnvee5R28bkWi/miPN92q69Q8LR+YMW1z+8OT71Zdc9OAcbaKyAAN4YsdwpeW/P++opehLN nUJ42SioPPwCrxPQ7zYQYI4t4hTBsvSMSZzzuhOL3tCFFUhw/JE5mvD7FTg9TsuVw6Bv5PndhXw tkaTJzarr4Gd5 X-Developer-Key: i=sudeep.holla@arm.com; a=openpgp; fpr=7360A21742ADF5A11767C1C139CFD4755FE2D5B4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230919_104127_798287_10A53E37 X-CRM114-Status: GOOD ( 11.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The framework provides an interface to the receiver to determine the identity of the notification. A receiver endpoint must use the FFA_NOTIFICATION_GET interface to retrieve its pending notifications and handle them. Add the support for FFA_NOTIFICATION_GET to allow the caller(receiver) to fetch its pending notifications from other partitions in the system. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_ffa/driver.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c index 2aae838ba46a..acb58715687c 100644 --- a/drivers/firmware/arm_ffa/driver.c +++ b/drivers/firmware/arm_ffa/driver.c @@ -581,6 +581,14 @@ static int ffa_notification_bitmap_destroy(void) ((u32)(FIELD_GET(NOTIFICATION_HIGH_MASK, (x)))) #define NOTIFICATION_BITMAP_LOW(x) \ ((u32)(FIELD_GET(NOTIFICATION_LOW_MASK, (x)))) +#define PACK_NOTIFICATION_BITMAP(low, high) \ + (FIELD_PREP(NOTIFICATION_LOW_MASK, (low)) | \ + FIELD_PREP(NOTIFICATION_HIGH_MASK, (high))) + +#define RECEIVER_VCPU_MASK GENMASK(31, 16) +#define PACK_NOTIFICATION_GET_RECEIVER_INFO(vcpu_r, r) \ + (FIELD_PREP(RECEIVER_VCPU_MASK, (vcpu_r)) | \ + FIELD_PREP(RECEIVER_ID_MASK, (r))) static int ffa_notification_bind_common(u16 dst_id, u64 bitmap, u32 flags, bool is_bind) @@ -624,6 +632,35 @@ int ffa_notification_set(u16 src_id, u16 dst_id, u32 flags, u64 bitmap) return 0; } +struct ffa_notify_bitmaps { + u64 sp_map; + u64 vm_map; + u64 arch_map; +}; + +static int ffa_notification_get(u32 flags, struct ffa_notify_bitmaps *notify) +{ + ffa_value_t ret; + u16 src_id = drv_info->vm_id; + u16 cpu_id = smp_processor_id(); + u32 rec_vcpu_ids = PACK_NOTIFICATION_GET_RECEIVER_INFO(cpu_id, src_id); + + invoke_ffa_fn((ffa_value_t){ + .a0 = FFA_NOTIFICATION_GET, .a1 = rec_vcpu_ids, .a2 = flags, + }, &ret); + + if (ret.a0 == FFA_ERROR) + return ffa_to_linux_errno((int)ret.a2); + else if (ret.a0 != FFA_SUCCESS) + return -EINVAL; /* Something else went wrong. */ + + notify->sp_map = PACK_NOTIFICATION_BITMAP(ret.a2, ret.a3); + notify->vm_map = PACK_NOTIFICATION_BITMAP(ret.a4, ret.a5); + notify->arch_map = PACK_NOTIFICATION_BITMAP(ret.a6, ret.a7); + + return 0; +} + static int ffa_run(struct ffa_device *dev, u16 vcpu) { ffa_value_t ret; From patchwork Tue Sep 19 17:40:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 13391637 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 138C6CE79A8 for ; Tue, 19 Sep 2023 17:42:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:In-Reply-To:References:Message-Id: MIME-Version:Subject:Date:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XLzwYpq4hezXJKjF/8ZMepNxXrF6p/yZTEOhdJVAKg0=; b=G5tpZhAy4WWbI9 3nnJMOEtEcYt3mlZAOwzEQXa22a7diz9XqQ9phMdOIdBtxxQSvPcSIx7oW+RhSRTQ2S8254jrx1/+ Jsh6NxR7rbhUNPMAjTFGwukw8T4OnXcsEtlTHP3h3ECz3JNpQWNkOWjC0IkfjWvXF1wGD1rAxeElB W2Zb8LxDdI/p6cJQA4VF8PY09aJ9sjE3JXcNZTLp9dkEDqyJOV8FvkjrXgq6nE7XMbM5QUnRjGBf3 dYOVmnC3J0aIBkvv7JYuhQ2N2nZxyHI2Yekx76XcJeOTV2uKG1bXJWlZSnHvtUx09MPJGAIW7ptH1 xJyKsypeiiI4u/wGxLYQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiejB-000xJO-2B; Tue, 19 Sep 2023 17:41:37 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiej3-000xDs-0J for linux-arm-kernel@lists.infradead.org; Tue, 19 Sep 2023 17:41:31 +0000 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 4857FC15; Tue, 19 Sep 2023 10:42:04 -0700 (PDT) Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id F141F3F5A1; Tue, 19 Sep 2023 10:41:25 -0700 (PDT) From: Sudeep Holla Date: Tue, 19 Sep 2023 18:40:55 +0100 Subject: [PATCH RFT v2 07/18] firmware: arm_ffa: Implement the NOTIFICATION_INFO_GET interface MIME-Version: 1.0 Message-Id: <20230919-ffa_v1-1_notif-v2-7-6f3a3ca3923c@arm.com> References: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> In-Reply-To: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sudeep Holla , Jens Wiklander , Marc Bonnici , Coboy Chen , Lorenzo Pieralisi , Olivier Deprez X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=3494; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=M4lP+tc3FjAbYZf7s9A0uNcF+W8wy+ah17rMKCRmgS4=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBlCd07RVRasohWgmkneYDdBAwnm+z0VZdrL+/Lz k4lzOccqHGJAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZQndOwAKCRAAQbq8MX7i mHAMD/9WY6poq8i83+jU1+lc6BWslG93GKwWMvPwVYNEOCaBKgCPNauGeG6LwAqFvTB7WXZPQ5o eP1S18P5wshVJYGCmGxRaB1nYKXqt1ps858Kwp4bYcen7NkFgflWclHiTIGx2Nm1oAZ5Wd78HrU vA+GUt38o06lZQLizCe36Jaxx9EXB8kMTK6rn6OnAUZ/F37I5VDw5YTwELrnQY2qRmaPBzXAdXF kXPuZEmLv+/3eRqhyBMah4v2RlUmUsZdWbdEjJsOLgsS+cBRLEUXocpzOCekeu4T9uiZAXdrUL8 XC9IHQAxHSUVLkAulX3vT+tbgmFAJ74KqlbJXPtJzDdx981YiD0Lk5xDbb6emgz4kcjMHMj+dBh 04PPAgXfU1e2gTLy1+8Q90WnUJAQ5i9syPMLpGXDGeMNaeM+8G9XB2JVhvJvIe3/QgJeDktreE7 ZkaN6vAYBOl+2qZ6B4gpvKc5or5HIZ6j6dyK25nTcd6nUY9BtfIIvLKPt0A7kfF5iIUJTpnpkTI uqyIiCURilh3GkzQsuad8lMTBthHytCyapdUojxk4+NnlFoP4ipRC7YtTuluvUK8oQ2eAi20R0F LKw+KQHwzWWHzQZhObbT9snbeG/WeByPxkR0crPlBkQ4hPBwba7USNuoIV64wpgAunF2pZVZ22o 7gAvfKR1eo+dMig== X-Developer-Key: i=sudeep.holla@arm.com; a=openpgp; fpr=7360A21742ADF5A11767C1C139CFD4755FE2D5B4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230919_104129_226801_C494E214 X-CRM114-Status: GOOD ( 13.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The receiver’s scheduler uses the FFA_NOTIFICATION_INFO_GET interface to retrieve the list of endpoints that have pending notifications and must be run. A notification could be signaled by a sender in the secure world to a VM. The Hypervisor needs to determine which VM and vCPU (in case a per-vCPU notification is signaled) has a pending notification in this scenario. It must obtain this information through an invocation of the FFA_NOTIFICATION_INFO_GET. Add the implementation of the NOTIFICATION_INFO_GET interface and prepare to use this to handle the schedule receiver interrupt. Implementation of handling notifications will be added later. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_ffa/driver.c | 70 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c index acb58715687c..e097e894b433 100644 --- a/drivers/firmware/arm_ffa/driver.c +++ b/drivers/firmware/arm_ffa/driver.c @@ -590,6 +590,13 @@ static int ffa_notification_bitmap_destroy(void) (FIELD_PREP(RECEIVER_VCPU_MASK, (vcpu_r)) | \ FIELD_PREP(RECEIVER_ID_MASK, (r))) +#define NOTIFICATION_INFO_GET_MORE_PEND_MASK BIT(0) +#define NOTIFICATION_INFO_GET_ID_COUNT GENMASK(11, 7) +#define ID_LIST_MASK_64 GENMASK(51, 12) +#define ID_LIST_MASK_32 GENMASK(31, 12) +#define MAX_IDS_64 20 +#define MAX_IDS_32 10 + static int ffa_notification_bind_common(u16 dst_id, u64 bitmap, u32 flags, bool is_bind) { @@ -661,6 +668,69 @@ static int ffa_notification_get(u32 flags, struct ffa_notify_bitmaps *notify) return 0; } +static void __do_sched_recv_cb(u16 partition_id, u16 vcpu, bool is_per_vcpu) +{ + pr_err("Callback for partition 0x%x failed.\n", partition_id); +} + +static void ffa_notification_info_get(bool is_64b) +{ + int idx, list, max_ids, lists_cnt, ids_processed, ids_count[MAX_IDS_64]; + ffa_value_t ret; + u64 id_list; + + do { + invoke_ffa_fn((ffa_value_t){ + .a0 = FFA_FN_NATIVE(NOTIFICATION_INFO_GET), + }, &ret); + + if (ret.a0 != FFA_FN_NATIVE(SUCCESS)) { + if (ret.a2 != FFA_RET_NO_DATA) + pr_err("Notification Info fetch failed: 0x%lx (0x%lx)", + ret.a0, ret.a2); + return; + } + + ids_processed = 0; + lists_cnt = FIELD_GET(NOTIFICATION_INFO_GET_ID_COUNT, ret.a2); + if (is_64b) { + max_ids = MAX_IDS_64; + id_list = FIELD_GET(ID_LIST_MASK_64, ret.a2); + } else { + max_ids = MAX_IDS_32; + id_list = FIELD_GET(ID_LIST_MASK_32, ret.a2); + } + + for (idx = 0; idx < lists_cnt; idx++, id_list >>= 2) + ids_count[idx] = (id_list & 0x3) + 1; + + /* Process IDs */ + for (list = 0; list < lists_cnt; list++) { + u16 vcpu_id, part_id, *packed_id_list = (u16 *)&ret.a3; + + if (ids_processed >= max_ids - 1) + break; + + part_id = packed_id_list[++ids_processed]; + + if (!ids_count[list]) { /* Global Notification */ + __do_sched_recv_cb(part_id, 0, false); + continue; + } + + /* Per vCPU Notification */ + for (idx = 0; idx < ids_count[list]; idx++) { + if (ids_processed >= max_ids - 1) + break; + + vcpu_id = packed_id_list[++ids_processed]; + + __do_sched_recv_cb(part_id, vcpu_id, true); + } + } + } while (ret.a2 & NOTIFICATION_INFO_GET_MORE_PEND_MASK); +} + static int ffa_run(struct ffa_device *dev, u16 vcpu) { ffa_value_t ret; From patchwork Tue Sep 19 17:40:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 13391634 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 520FBCE79AD for ; Tue, 19 Sep 2023 17:42:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:In-Reply-To:References:Message-Id: MIME-Version:Subject:Date:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=moqjbkUlAiKQe3mHCxVqUtGReUcCf1nBefszbZJlxjA=; b=mq+/kGg8ex/5Sq LfwD/G8FC12eql4DOJeKOKHdsqjNiutUFWJ/eaX5V1IdqUllOZ5LCndL12rBUo8Z5mRPKfUrLcljE u/JT5FrcqWREdsH3PrkBcRPbIQlUAS5v5fN0BwZPRhBNaGG5KtfMd30mLP/eWhiGCVdeL8h+MAF0L /sf15uwNwgd2MxqBq9G5XCSslX4/AbrAN/xOphVLRIjWL1aTtiIwdUEHfPg3csgDQ4wxUS3nMUhJB RxYWdCNpK44DzkMP6sJib40tDdFgUV4heQjc4xstun2PLHXyDuyifal+fNHrTejSRyhEXepcrvIif loNXth/d0rLphSKzd+ow==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiejC-000xKA-1J; Tue, 19 Sep 2023 17:41:38 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiej3-000xDE-1u for linux-arm-kernel@lists.infradead.org; Tue, 19 Sep 2023 17:41:31 +0000 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 74240FEC; Tue, 19 Sep 2023 10:42:05 -0700 (PDT) Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 28F153F5A1; Tue, 19 Sep 2023 10:41:27 -0700 (PDT) From: Sudeep Holla Date: Tue, 19 Sep 2023 18:40:56 +0100 Subject: [PATCH RFT v2 08/18] firmware: arm_ffa: Initial support for scheduler receiver interrupt MIME-Version: 1.0 Message-Id: <20230919-ffa_v1-1_notif-v2-8-6f3a3ca3923c@arm.com> References: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> In-Reply-To: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sudeep Holla , Jens Wiklander , Marc Bonnici , Coboy Chen , Lorenzo Pieralisi , Olivier Deprez X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=7566; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=FrcEGevbFkIUMjTrfQy4wukuAwXYSEQfEEVHCn1ql00=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBlCd073Ts/IYXTdAVKgOOdvj18pP6Q6WlJFdiAn 0fkuiq9wLCJAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZQndOwAKCRAAQbq8MX7i mNsvEAC0s+0Rcc+2kwS3rekvuQLrKljT70t5TwjY3H4bxSlfmn+CDWLVvBRjxQ2UxnoU53pHjvT 7RJiOlBOiIZDsfj/wBloNnvvh/grsnvbwfIqp7SquKgEoIBzhTmzV3Ki/F2ZHMI2CjFbrfoTQmy +Ixa/mSL4hFv9gny6rySbln1Dy5xlRfMIlKOwtRKr/VRR164i3su6ePh2HuG0/3X3i4XemYH+jA fJJ72LMxc1LVE34lerS08SQHbSH7sh5TzXQkf94pd8OavFhDu8tesduNy3CrWkiti7FEskfQgjf cI0T5LXQZzZy/o58qFmNoVpdrzJMcsW/hXN39mSwD+HhzUktLeF6VpGfWF7Ct4oudayp3PM1Gls 8bvPqllNtNNkb8/TCX/lrTqdn6KtjtLEz1MpkvmfRHDBgxfimuXsxkqvNzNBzJvM/KnLMI+WUfK tZSSKcNp0TN+jKxoxSR/jabmMDgAfIaLr9A9XpgwGYdHtILon/pMrC1MPwvc4aeQUwrHDXj9vXl 6eyLkIVrZOMLyagL2/avf/iSz9DwnK6TAVdeQZNzONBedD0HvFBRpNGOHX1hkEXyjJKKBQcFgHf AfBVjdqQb6dwHmdMmg1JDBnbMZNEh4rtWFlbmXFkcRY3SWXzBv12PYbNt7yJ7XHpVJbJa5urCO2 asqvrubQltrRkjA== X-Developer-Key: i=sudeep.holla@arm.com; a=openpgp; fpr=7360A21742ADF5A11767C1C139CFD4755FE2D5B4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230919_104129_720909_1F8B67D5 X-CRM114-Status: GOOD ( 21.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The Framework uses the schedule receiver interrupt to inform the receiver’s scheduler that the receiver must be run to handle a pending notification. A receiver’s scheduler can obtain the description of the schedule receiver interrupt by invoking the FFA_FEATURES interface. The delivery of the physical schedule receiver interrupt from the secure state to the non-secure state depends upon the state of the interrupt controller as configured by the hypervisor. The schedule seceiver interrupt is assumed to be a SGI. The Arm GIC specification defines 16 SGIs. It recommends that they are equally divided between the non-secure and secure states. OS like Linux kernel in the non-secure state typically do not have SGIs to spare. The usage of SGIs in the secure state is however limited. It is more likely that software in the Secure world does not use all the SGIs allocated to it. It is recommended that the secure world software donates an unused SGI to the normal world for use as the schedule receiver interrupt. This implies that secure world software must configure the SGI in the GIC as a non-secure interrupt before presenting it to the normal world. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_ffa/driver.c | 192 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 182 insertions(+), 10 deletions(-) diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c index e097e894b433..3d8f1daea32d 100644 --- a/drivers/firmware/arm_ffa/driver.c +++ b/drivers/firmware/arm_ffa/driver.c @@ -22,15 +22,20 @@ #define DRIVER_NAME "ARM FF-A" #define pr_fmt(fmt) DRIVER_NAME ": " fmt +#include #include #include +#include #include +#include #include #include #include #include +#include #include #include +#include #include #include "common.h" @@ -76,6 +81,10 @@ static inline int ffa_to_linux_errno(int errno) return -EINVAL; } +struct ffa_pcpu_irq { + struct ffa_drv_info *info; +}; + struct ffa_drv_info { u32 version; u16 vm_id; @@ -85,6 +94,12 @@ struct ffa_drv_info { void *tx_buffer; bool mem_ops_native; bool bitmap_created; + unsigned int sched_recv_irq; + unsigned int cpuhp_state; + struct ffa_pcpu_irq __percpu *irq_pcpu; + struct workqueue_struct *notif_pcpu_wq; + struct work_struct irq_work; + bool info_get_64b; }; static struct ffa_drv_info *drv_info; @@ -910,9 +925,153 @@ static void ffa_setup_partitions(void) kfree(pbuf); } +/* FFA FEATURE IDs */ +#define FFA_FEAT_NOTIFICATION_PENDING_INT (1) +#define FFA_FEAT_SCHEDULE_RECEIVER_INT (2) +#define FFA_FEAT_MANAGED_EXIT_INT (3) + +static irqreturn_t irq_handler(int irq, void *irq_data) +{ + struct ffa_pcpu_irq *pcpu = irq_data; + struct ffa_drv_info *info = pcpu->info; + + queue_work(info->notif_pcpu_wq, &info->irq_work); + + return IRQ_HANDLED; +} + +static void ffa_sched_recv_irq_work_fn(struct work_struct *work) +{ + struct ffa_drv_info *info = container_of(work, struct ffa_drv_info, + irq_work); + + ffa_notification_info_get(info->info_get_64b); +} + +static int ffa_sched_recv_irq_map(void) +{ + int ret, irq, sr_intid; + + /* The returned sr_intid is assumed to be SGI donated to NS world */ + ret = ffa_features(FFA_FEAT_SCHEDULE_RECEIVER_INT, 0, &sr_intid, NULL); + if (ret < 0) { + if (ret != -EOPNOTSUPP) + pr_err("Failed to retrieve scheduler Rx interrupt\n"); + return ret; + } + + if (acpi_disabled) { + struct of_phandle_args oirq = {}; + struct device_node *gic; + + /* Only GICv3 supported currently with the device tree */ + gic = of_find_compatible_node(NULL, NULL, "arm,gic-v3"); + if (!gic) + return -ENXIO; + + oirq.np = gic; + oirq.args_count = 1; + oirq.args[0] = sr_intid; + irq = irq_create_of_mapping(&oirq); + of_node_put(gic); +#ifdef CONFIG_ACPI + } else { + irq = acpi_register_gsi(NULL, sr_intid, ACPI_EDGE_SENSITIVE, + ACPI_ACTIVE_HIGH); +#endif + } + + if (irq <= 0) { + pr_err("Failed to create IRQ mapping!\n"); + return -ENODATA; + } + + return irq; +} + +static void ffa_sched_recv_irq_unmap(void) +{ + if (drv_info->sched_recv_irq) + irq_dispose_mapping(drv_info->sched_recv_irq); +} + +static int ffa_cpuhp_pcpu_irq_enable(unsigned int cpu) +{ + enable_percpu_irq(drv_info->sched_recv_irq, IRQ_TYPE_NONE); + return 0; +} + +static int ffa_cpuhp_pcpu_irq_disable(unsigned int cpu) +{ + disable_percpu_irq(drv_info->sched_recv_irq); + return 0; +} + +static void ffa_uninit_pcpu_irq(void) +{ + if (drv_info->cpuhp_state) + cpuhp_remove_state(drv_info->cpuhp_state); + + if (drv_info->notif_pcpu_wq) + destroy_workqueue(drv_info->notif_pcpu_wq); + + if (drv_info->sched_recv_irq) + free_percpu_irq(drv_info->sched_recv_irq, drv_info->irq_pcpu); + + if (drv_info->irq_pcpu) + free_percpu(drv_info->irq_pcpu); +} + +static int ffa_init_pcpu_irq(unsigned int irq) +{ + struct ffa_pcpu_irq __percpu *irq_pcpu; + int ret, cpu; + + irq_pcpu = alloc_percpu(struct ffa_pcpu_irq); + if (!irq_pcpu) + return -ENOMEM; + + for_each_present_cpu(cpu) + per_cpu_ptr(irq_pcpu, cpu)->info = drv_info; + + drv_info->irq_pcpu = irq_pcpu; + + ret = request_percpu_irq(irq, irq_handler, "ARM-FFA", irq_pcpu); + if (ret) { + pr_err("Error registering notification IRQ %d: %d\n", irq, ret); + return ret; + } + + INIT_WORK(&drv_info->irq_work, ffa_sched_recv_irq_work_fn); + drv_info->notif_pcpu_wq = create_workqueue("ffa_pcpu_irq_notification"); + if (!drv_info->notif_pcpu_wq) + return -EINVAL; + + ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "ffa/pcpu-irq:starting", + ffa_cpuhp_pcpu_irq_enable, + ffa_cpuhp_pcpu_irq_disable); + + if (ret < 0) + return ret; + + drv_info->cpuhp_state = ret; + return 0; +} + +static void ffa_notifications_cleanup(void) +{ + ffa_uninit_pcpu_irq(); + ffa_sched_recv_irq_unmap(); + + if (drv_info->bitmap_created) { + ffa_notification_bitmap_destroy(); + drv_info->bitmap_created = false; + } +} + static int ffa_notifications_setup(void) { - int ret; + int ret, irq; ret = ffa_features(FFA_NOTIFICATION_BITMAP_CREATE, 0, NULL, NULL); if (!ret) { @@ -924,15 +1083,24 @@ static int ffa_notifications_setup(void) } drv_info->bitmap_created = true; - return 0; -} + irq = ffa_sched_recv_irq_map(); + if (irq <= 0) + goto cleanup; -static void ffa_notifications_cleanup(void) -{ - if (drv_info->bitmap_created) { - ffa_notification_bitmap_destroy(); - drv_info->bitmap_created = false; - } + if (FFA_FN_NATIVE(NOTIFICATION_INFO_GET) == + FFA_FN64_NOTIFICATION_INFO_GET) + drv_info->info_get_64b = true; + + drv_info->sched_recv_irq = irq; + + ret = ffa_init_pcpu_irq(irq); + if (ret) + goto cleanup; + + return 0; +cleanup: + ffa_notifications_cleanup(); + return ret; } static int __init ffa_init(void) @@ -990,7 +1158,11 @@ static int __init ffa_init(void) ffa_set_up_mem_ops_native_flag(); - return ffa_notifications_setup(); + ret = ffa_notifications_setup(); + if (ret) + goto free_pages; + + return 0; free_pages: if (drv_info->tx_buffer) free_pages_exact(drv_info->tx_buffer, RXTX_BUFFER_SIZE); From patchwork Tue Sep 19 17:40:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 13391638 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5686FCE79AB for ; Tue, 19 Sep 2023 17:42:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:In-Reply-To:References:Message-Id: MIME-Version:Subject:Date:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BCqNHwHOGu7lXIKfKkUiyMqdRTakw79Xc0aZgMabGHU=; b=uk5y60bshernY6 Q8D678fSHiyLz5/YN8F5zVPShbBZb64nHZKLUpQ+IAKn/7f4GBJ9AY7ZVqmVZLYZhh0AKoIkMBd3R CGtwDwAwT74JCO652SqQlGdTgnmje+piNOH4oml13ABNhPio/MWz6YCGxmsXgcJcQe42aN/KOjHJO 7UQfVbVO4fzGifwHjr5hBgs4E288uvyBXgQWKwYjJ9t/0rAEc0WYTFQVasfF/pofDmwrjYnKBXfXM gyreDWORaPUa8nXUcdPZ30bZXBlfyNzOv9j52Z59qAoZuG5GFtUnzISrttSBFCJo6cjmMC1QvqhQ/ 6A+8JvyzYlxVT0aVaMIw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiejD-000xKi-08; Tue, 19 Sep 2023 17:41:39 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiej3-000xDD-27 for linux-arm-kernel@lists.infradead.org; Tue, 19 Sep 2023 17:41:31 +0000 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 9FB941042; Tue, 19 Sep 2023 10:42:06 -0700 (PDT) Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 54C273F5A1; Tue, 19 Sep 2023 10:41:28 -0700 (PDT) From: Sudeep Holla Date: Tue, 19 Sep 2023 18:40:57 +0100 Subject: [PATCH RFT v2 09/18] firmware: arm_ffa: Add schedule receiver callback mechanism MIME-Version: 1.0 Message-Id: <20230919-ffa_v1-1_notif-v2-9-6f3a3ca3923c@arm.com> References: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> In-Reply-To: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sudeep Holla , Jens Wiklander , Marc Bonnici , Coboy Chen , Lorenzo Pieralisi , Olivier Deprez X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=6815; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=gYS42oNLb97618K6eF8BnwkjKIFCn4PCL82xYbXNih4=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBlCd07tHrELO+oIgBUWREr/ZgSLI4+2nBuv+za6 nTIc4vgU2KJAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZQndOwAKCRAAQbq8MX7i mPcLEADLJcUYB7TtnkpNeg9h4iUq+fY2vYmVDqZuSbOrkXKG34/yMD5I2zSnw4DDw1gAOZcXoyR WXJRKC6ltA3g/6Zr6I/O8y/0uk8zREjdQYyPjBG4ofkkMfsDtlwsXK48bQ5xAlc965H910n8ESD CXkpFy6WXrLn1gSSy7pHYLyTOSOyBSH9qvmj5u60Psoe75U+3HFRxsZGkrqzaAbnXNYN0dOZ9CD Nj5s+6YVNfY8+aib+oGLzeOyaTWerJJm6/O6Bb8fGCvT7ljMDTLaCkak/oltMFzxrQzUU+ju/I7 YJSCwCKptSKg721eBLePxpolA6MN5KonFjCd19f6ZwBbOVL3o7B945i8s2srNOVZ3Saov1Miviw lR8hN18d3wcKA1Z5wLkfwKmiuaVCq0GZtOWMqS9H147TSsfEK2VTcOO4/U3COciU5n+L4x9YGDU wjNs4Um9acrx+gswhNjYAKVCRFDcFEyCHi+3JiAmLyYvXKeml4ppD7GOD89XK3e2pK1TpNnPv/l y29HjiP1am3VI2vGBOwo+w5f88k7p/6enJewvsEl1OoVQRsdH4znJeyB1XLX0YybppBqC6KQ0dg XUOq3vuJdBHB3WpU2nyraTCEXtp+Z86FNFVWKyqUdubCbOAWG8sarYICNf5LPyziZr1sAC4AuNp 2SKo2aZa2cm+7tA== X-Developer-Key: i=sudeep.holla@arm.com; a=openpgp; fpr=7360A21742ADF5A11767C1C139CFD4755FE2D5B4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230919_104129_790233_D23C8970 X-CRM114-Status: GOOD ( 19.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Enable client drivers to register a callback function that will be called when one or more notifications are pending for a target partition as part of schedule receiver interrupt handling. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_ffa/driver.c | 103 ++++++++++++++++++++++++++++++++++++-- include/linux/arm_ffa.h | 8 +++ 2 files changed, 108 insertions(+), 3 deletions(-) diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c index 3d8f1daea32d..017724b40e0b 100644 --- a/drivers/firmware/arm_ffa/driver.c +++ b/drivers/firmware/arm_ffa/driver.c @@ -37,6 +37,7 @@ #include #include #include +#include #include "common.h" @@ -100,6 +101,8 @@ struct ffa_drv_info { struct workqueue_struct *notif_pcpu_wq; struct work_struct irq_work; bool info_get_64b; + struct xarray partition_info; + unsigned int partition_count; }; static struct ffa_drv_info *drv_info; @@ -683,9 +686,26 @@ static int ffa_notification_get(u32 flags, struct ffa_notify_bitmaps *notify) return 0; } -static void __do_sched_recv_cb(u16 partition_id, u16 vcpu, bool is_per_vcpu) +struct ffa_dev_part_info { + ffa_sched_recv_cb callback; + void *cb_data; + rwlock_t rw_lock; +}; + +static void __do_sched_recv_cb(u16 part_id, u16 vcpu, bool is_per_vcpu) { - pr_err("Callback for partition 0x%x failed.\n", partition_id); + struct ffa_dev_part_info *partition; + ffa_sched_recv_cb callback; + void *cb_data; + + partition = xa_load(&drv_info->partition_info, part_id); + read_lock(&partition->rw_lock); + callback = partition->callback; + cb_data = partition->cb_data; + read_unlock(&partition->rw_lock); + + if (callback) + callback(vcpu, is_per_vcpu, cb_data); } static void ffa_notification_info_get(bool is_64b) @@ -839,6 +859,39 @@ static int ffa_memory_lend(struct ffa_mem_ops_args *args) return ffa_memory_ops(FFA_MEM_LEND, args); } +static int ffa_sched_recv_cb_update(u16 part_id, ffa_sched_recv_cb callback, + void *cb_data, bool is_registration) +{ + struct ffa_dev_part_info *partition; + bool cb_valid; + + partition = xa_load(&drv_info->partition_info, part_id); + write_lock(&partition->rw_lock); + + cb_valid = !!partition->callback; + if (!(is_registration ^ cb_valid)) { + write_unlock(&partition->rw_lock); + return -EINVAL; + } + + partition->callback = callback; + partition->cb_data = cb_data; + + write_unlock(&partition->rw_lock); + return 0; +} + +static int ffa_sched_recv_cb_register(struct ffa_device *dev, + ffa_sched_recv_cb cb, void *cb_data) +{ + return ffa_sched_recv_cb_update(dev->vm_id, cb, cb_data, true); +} + +static int ffa_sched_recv_cb_unregister(struct ffa_device *dev) +{ + return ffa_sched_recv_cb_update(dev->vm_id, NULL, NULL, false); +} + static const struct ffa_info_ops ffa_drv_info_ops = { .api_version_get = ffa_api_version_get, .partition_info_get = ffa_partition_info_get, @@ -859,11 +912,17 @@ static const struct ffa_cpu_ops ffa_drv_cpu_ops = { .run = ffa_run, }; +static const struct ffa_notifier_ops ffa_drv_notifier_ops = { + .sched_recv_cb_register = ffa_sched_recv_cb_register, + .sched_recv_cb_unregister = ffa_sched_recv_cb_unregister, +}; + static const struct ffa_ops ffa_drv_ops = { .info_ops = &ffa_drv_info_ops, .msg_ops = &ffa_drv_msg_ops, .mem_ops = &ffa_drv_mem_ops, .cpu_ops = &ffa_drv_cpu_ops, + .notifier_ops = &ffa_drv_notifier_ops, }; void ffa_device_match_uuid(struct ffa_device *ffa_dev, const uuid_t *uuid) @@ -894,6 +953,7 @@ static void ffa_setup_partitions(void) int count, idx; uuid_t uuid; struct ffa_device *ffa_dev; + struct ffa_dev_part_info *info; struct ffa_partition_info *pbuf, *tpbuf; count = ffa_partition_probe(&uuid_null, &pbuf); @@ -902,6 +962,7 @@ static void ffa_setup_partitions(void) return; } + xa_init(&drv_info->partition_info); for (idx = 0, tpbuf = pbuf; idx < count; idx++, tpbuf++) { import_uuid(&uuid, (u8 *)tpbuf->uuid); @@ -921,10 +982,42 @@ static void ffa_setup_partitions(void) if (drv_info->version > FFA_VERSION_1_0 && !(tpbuf->properties & FFA_PARTITION_AARCH64_EXEC)) _ffa_mode_32bit_set(ffa_dev); + + info = kzalloc(sizeof(*info), GFP_KERNEL); + if (!info) { + ffa_device_unregister(ffa_dev); + continue; + } + xa_store(&drv_info->partition_info, tpbuf->id, info, GFP_KERNEL); } + drv_info->partition_count = count; + kfree(pbuf); } +static void ffa_partitions_cleanup(void) +{ + struct ffa_dev_part_info **info; + int idx, count = drv_info->partition_count; + + if (!count) + return; + + info = kcalloc(count, sizeof(**info), GFP_KERNEL); + if (!info) + return; + + xa_extract(&drv_info->partition_info, (void **)info, 0, VM_ID_MASK, + count, XA_PRESENT); + + for (idx = 0; idx < count; idx++) + kfree(info[idx]); + kfree(info); + + drv_info->partition_count = 0; + xa_destroy(&drv_info->partition_info); +} + /* FFA FEATURE IDs */ #define FFA_FEAT_NOTIFICATION_PENDING_INT (1) #define FFA_FEAT_SCHEDULE_RECEIVER_INT (2) @@ -1160,9 +1253,11 @@ static int __init ffa_init(void) ret = ffa_notifications_setup(); if (ret) - goto free_pages; + goto partitions_cleanup; return 0; +partitions_cleanup: + ffa_partitions_cleanup(); free_pages: if (drv_info->tx_buffer) free_pages_exact(drv_info->tx_buffer, RXTX_BUFFER_SIZE); @@ -1178,9 +1273,11 @@ subsys_initcall(ffa_init); static void __exit ffa_exit(void) { ffa_notifications_cleanup(); + ffa_partitions_cleanup(); ffa_rxtx_unmap(drv_info->vm_id); free_pages_exact(drv_info->tx_buffer, RXTX_BUFFER_SIZE); free_pages_exact(drv_info->rx_buffer, RXTX_BUFFER_SIZE); + xa_destroy(&drv_info->partition_info); kfree(drv_info); arm_ffa_bus_exit(); } diff --git a/include/linux/arm_ffa.h b/include/linux/arm_ffa.h index 12fd134bf670..f9cf6114ef82 100644 --- a/include/linux/arm_ffa.h +++ b/include/linux/arm_ffa.h @@ -391,11 +391,19 @@ struct ffa_cpu_ops { int (*run)(struct ffa_device *dev, u16 vcpu); }; +typedef void (*ffa_sched_recv_cb)(u16 vcpu, bool is_per_vcpu, void *cb_data); +struct ffa_notifier_ops { + int (*sched_recv_cb_register)(struct ffa_device *dev, + ffa_sched_recv_cb cb, void *cb_data); + int (*sched_recv_cb_unregister)(struct ffa_device *dev); +}; + struct ffa_ops { const struct ffa_info_ops *info_ops; const struct ffa_msg_ops *msg_ops; const struct ffa_mem_ops *mem_ops; const struct ffa_cpu_ops *cpu_ops; + const struct ffa_notifier_ops *notifier_ops; }; #endif /* _LINUX_ARM_FFA_H */ From patchwork Tue Sep 19 17:40:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 13391639 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BE624CE79AC for ; Tue, 19 Sep 2023 17:42:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:In-Reply-To:References:Message-Id: MIME-Version:Subject:Date:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Q8VxmK5+wDRZiitty1O5VJWRB/Dy4lZuybg60rz8ZyA=; b=Zaiu0oSa17hQfj vldt6hj5M1l7cLaA2Rl8q9pd5INcJO9cSsiqQ/Oxyr7qiwa9SCNkq1aGCyN1OlMM2lnKV5i3Z8oOB y+5TLb45Y37Q93KrOz1F6OJzvv6WhpRbrjN7wkWwgY9kbSztLuiPBdSiRuG4u9NhZr6PbE+kS08O/ vIhQ+wUPEcN8osjVJkA9D2Y6KinVcsGD4++6/G7JKd20otxLEbO/WigW40/9xTBbOjvZ8UC3JIK0H rEgrFCdGN3tFrxB4wPNeV4Qely/yNUVUKUWBRlZ5bFwhNIndGqlh/tmZe3DFsyBavG6JP4q7LBkSV zhioKCMh1GmaV82rGeLQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiejE-000xMJ-13; Tue, 19 Sep 2023 17:41:40 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiej5-000xFM-1b for linux-arm-kernel@lists.infradead.org; Tue, 19 Sep 2023 17:41:33 +0000 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 CBAB51FB; Tue, 19 Sep 2023 10:42:07 -0700 (PDT) Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 806EC3F5A1; Tue, 19 Sep 2023 10:41:29 -0700 (PDT) From: Sudeep Holla Date: Tue, 19 Sep 2023 18:40:58 +0100 Subject: [PATCH RFT v2 10/18] firmware: arm_ffa: Add interfaces to request notification callbacks MIME-Version: 1.0 Message-Id: <20230919-ffa_v1-1_notif-v2-10-6f3a3ca3923c@arm.com> References: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> In-Reply-To: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sudeep Holla , Jens Wiklander , Marc Bonnici , Coboy Chen , Lorenzo Pieralisi , Olivier Deprez X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=6981; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=72LF5V69jHHLAlFxDkCbmJCtna0X9v5HnGdWNK4WsiM=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBlCd07EzUm1uA88RfgnSHsBdsY6x2sSUTRThh/5 VuDJ6JcqPmJAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZQndOwAKCRAAQbq8MX7i mEWCEACAtRd1kXFWBOIGiTvWL76o/fzdF5pzpnwav6AiA5jhXFn4tOM/wZIue6Yo8/rF9peX164 4shKweJHFoGB9YB+qkBoXPIziTAIexf3tLMYRJ/BUw4njPyboWN2S/7wSC55brXjpS3aNYcmXFQ L2Ejwa7m3NTVDlmHchXqXtce+2vkXEDTfsqluhGylRWS9pEwiVOOPHXxtbINxVHI+KkMdRuK9b3 54LQM64Uxm+zsWkTwM4uJHPbrRAi/N/RWW3VXXt7fkm0BGV/OnLjDLgwGpW2eSbWf84KnrZ0iMa +YdPAcjyZhCsmHJoRY3nuqXYr5h02oRooXeWB0ZlKoO4az1kXPHkzZGXDI7txryQot9Rc/2q/SQ 7D6Ttoefu2wW0kfamXKEyVfucl7RonkUMahzksF0CV3FdZAWbKRjq7rAW2EflxIkxtOQIfg9NEb whfn/RGWyJfWKEGqmuVAYwwpguu6ClNZUYBBin/HtjEp2xaZqsw2vxOQ1W61kWlsl6HOAJqWi6U i6o8OA5uhsNExh6xgP9U83Dh+rEiRGl6e6TDXM4BMLebL0vihc6UiwQEe9ZBOVQEiJFp74nh0qA aR+yiyp8ArckcPjg+k8C+xyd0rfEeUs3jNQfojN2qz+02NEP/iUWKbCVSv/qnDW/o3f/XEQMmJh Z45Awc+O5z4eapA== X-Developer-Key: i=sudeep.holla@arm.com; a=openpgp; fpr=7360A21742ADF5A11767C1C139CFD4755FE2D5B4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230919_104131_634041_7CDD93A9 X-CRM114-Status: GOOD ( 18.59 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add interface to the FFA driver to allow for client drivers to request and relinquish a notification as well as provide a callback for the notification. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_ffa/driver.c | 146 ++++++++++++++++++++++++++++++++++++++ include/linux/arm_ffa.h | 5 ++ 2 files changed, 151 insertions(+) diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c index 017724b40e0b..1d61442ca4fa 100644 --- a/drivers/firmware/arm_ffa/driver.c +++ b/drivers/firmware/arm_ffa/driver.c @@ -27,11 +27,13 @@ #include #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -57,6 +59,8 @@ */ #define RXTX_BUFFER_SIZE SZ_4K +#define FFA_MAX_NOTIFICATIONS 64 + static ffa_fn *invoke_ffa_fn; static const int ffa_linux_errmap[] = { @@ -103,6 +107,8 @@ struct ffa_drv_info { bool info_get_64b; struct xarray partition_info; unsigned int partition_count; + DECLARE_HASHTABLE(notifier_hash, ilog2(FFA_MAX_NOTIFICATIONS)); + struct mutex notify_lock; /* lock to protect notifier hashtable */ }; static struct ffa_drv_info *drv_info; @@ -615,6 +621,9 @@ static int ffa_notification_bitmap_destroy(void) #define MAX_IDS_64 20 #define MAX_IDS_32 10 +#define PER_VCPU_NOTIFICATION_FLAG BIT(0) +#define ALL_NOTIFICATION_BITMAPS_FLAGS (0xF) + static int ffa_notification_bind_common(u16 dst_id, u64 bitmap, u32 flags, bool is_bind) { @@ -859,6 +868,21 @@ static int ffa_memory_lend(struct ffa_mem_ops_args *args) return ffa_memory_ops(FFA_MEM_LEND, args); } +#define FFA_SECURE_PARTITION_ID_FLAG BIT(15) + +enum notify_type { + NON_SECURE_VM, + SECURE_PARTITION, + FRAMEWORK, +}; + +struct notifier_cb_info { + struct hlist_node hnode; + ffa_notifier_cb cb; + void *cb_data; + enum notify_type type; +}; + static int ffa_sched_recv_cb_update(u16 part_id, ffa_sched_recv_cb callback, void *cb_data, bool is_registration) { @@ -892,6 +916,123 @@ static int ffa_sched_recv_cb_unregister(struct ffa_device *dev) return ffa_sched_recv_cb_update(dev->vm_id, NULL, NULL, false); } +static int ffa_notification_bind(u16 dst_id, u64 bitmap, u32 flags) +{ + return ffa_notification_bind_common(dst_id, bitmap, flags, true); +} + +static int ffa_notification_unbind(u16 dst_id, u64 bitmap) +{ + return ffa_notification_bind_common(dst_id, bitmap, 0, false); +} + +/* Should be called while the notify_lock is taken */ +static struct notifier_cb_info * +notifier_hash_node_get(u16 notify_id, enum notify_type type) +{ + struct notifier_cb_info *node; + + hash_for_each_possible(drv_info->notifier_hash, node, hnode, notify_id) + if (type == node->type) + return node; + + return NULL; +} + +static int +update_notifier_cb(int notify_id, enum notify_type type, ffa_notifier_cb cb, + void *cb_data, bool is_registration) +{ + struct notifier_cb_info *cb_info = NULL; + bool cb_found; + + cb_info = notifier_hash_node_get(notify_id, type); + cb_found = !!cb_info; + + if (!(is_registration ^ cb_found)) + return -EINVAL; + + if (is_registration) { + cb_info = kzalloc(sizeof(*cb_info), GFP_KERNEL); + if (!cb_info) + return -ENOMEM; + + cb_info->type = type; + cb_info->cb = cb; + cb_info->cb_data = cb_data; + + hash_add(drv_info->notifier_hash, &cb_info->hnode, notify_id); + } else { + hash_del(&cb_info->hnode); + } + + return 0; +} + +static enum notify_type ffa_notify_type_get(u16 vm_id) +{ + if (vm_id & FFA_SECURE_PARTITION_ID_FLAG) + return SECURE_PARTITION; + else + return NON_SECURE_VM; +} + +static int ffa_notify_relinquish(struct ffa_device *dev, int notify_id) +{ + int rc; + enum notify_type type = ffa_notify_type_get(dev->vm_id); + + if (notify_id >= FFA_MAX_NOTIFICATIONS) + return -EINVAL; + + mutex_lock(&drv_info->notify_lock); + + rc = update_notifier_cb(notify_id, type, NULL, NULL, false); + if (rc) { + pr_err("Could not unregister notifcation callback\n"); + mutex_unlock(&drv_info->notify_lock); + return rc; + } + + rc = ffa_notification_unbind(dev->vm_id, BIT(notify_id)); + + mutex_unlock(&drv_info->notify_lock); + + return rc; +} + +static int ffa_notify_request(struct ffa_device *dev, bool is_per_vcpu, + ffa_notifier_cb cb, void *cb_data, int notify_id) +{ + int rc; + u32 flags = 0; + enum notify_type type = ffa_notify_type_get(dev->vm_id); + + if (notify_id >= FFA_MAX_NOTIFICATIONS) + return -EINVAL; + + mutex_lock(&drv_info->notify_lock); + + if (is_per_vcpu) + flags = PER_VCPU_NOTIFICATION_FLAG; + + rc = ffa_notification_bind(dev->vm_id, BIT(notify_id), flags); + if (rc) { + mutex_unlock(&drv_info->notify_lock); + return rc; + } + + rc = update_notifier_cb(notify_id, type, cb, cb_data, true); + if (rc) { + pr_err("Failed to register callback for %d - %d\n", + notify_id, rc); + ffa_notification_unbind(dev->vm_id, BIT(notify_id)); + } + mutex_unlock(&drv_info->notify_lock); + + return rc; +} + static const struct ffa_info_ops ffa_drv_info_ops = { .api_version_get = ffa_api_version_get, .partition_info_get = ffa_partition_info_get, @@ -915,6 +1056,8 @@ static const struct ffa_cpu_ops ffa_drv_cpu_ops = { static const struct ffa_notifier_ops ffa_drv_notifier_ops = { .sched_recv_cb_register = ffa_sched_recv_cb_register, .sched_recv_cb_unregister = ffa_sched_recv_cb_unregister, + .notify_request = ffa_notify_request, + .notify_relinquish = ffa_notify_relinquish, }; static const struct ffa_ops ffa_drv_ops = { @@ -1190,6 +1333,9 @@ static int ffa_notifications_setup(void) if (ret) goto cleanup; + hash_init(drv_info->notifier_hash); + mutex_init(&drv_info->notify_lock); + return 0; cleanup: ffa_notifications_cleanup(); diff --git a/include/linux/arm_ffa.h b/include/linux/arm_ffa.h index f9cf6114ef82..fb6f388a3737 100644 --- a/include/linux/arm_ffa.h +++ b/include/linux/arm_ffa.h @@ -392,10 +392,15 @@ struct ffa_cpu_ops { }; typedef void (*ffa_sched_recv_cb)(u16 vcpu, bool is_per_vcpu, void *cb_data); +typedef void (*ffa_notifier_cb)(int notify_id, void *cb_data); + struct ffa_notifier_ops { int (*sched_recv_cb_register)(struct ffa_device *dev, ffa_sched_recv_cb cb, void *cb_data); int (*sched_recv_cb_unregister)(struct ffa_device *dev); + int (*notify_request)(struct ffa_device *dev, bool per_vcpu, + ffa_notifier_cb cb, void *cb_data, int notify_id); + int (*notify_relinquish)(struct ffa_device *dev, int notify_id); }; struct ffa_ops { From patchwork Tue Sep 19 17:40:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 13391632 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 663D8CE79A9 for ; Tue, 19 Sep 2023 17:42:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:In-Reply-To:References:Message-Id: MIME-Version:Subject:Date:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Gr53OPexXfcwbmRgb7iuVS6ulpAm9HDm4WeUfe7LlGM=; b=S64Cxtlv8v2Qc5 90SEsojsTJODJxVH2XJG22fWlGHFBsI0cohWjTBW4u6HKBqOIjJmg8k1vLQ7zbBRXUsLvkbP8/Jf4 0Pmhs1Q3oEzDWytFYne7HMofNb2LDCAZWpYWi/4M6hwxklYJeEShnztpgW/3Lk8GWI/TEmNASDzZK jJhn5YJp2MxH4AG25NcMbfn5cbMzADcV3kIZD33JSB9uH1l0gINfK5ptr3CqMk/clTmghU6wj1S8A uR7bszNHgihT+6jaJGubYl8v01hMyBaQjHrm1vSyQ0cERbwIoMepwB6HSqtjAYaAyR/6Ao0sOytv8 RZOxN4pQ4KlOuQ+RFiaw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiejD-000xLQ-1z; Tue, 19 Sep 2023 17:41:39 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiej6-000xDs-0F for linux-arm-kernel@lists.infradead.org; Tue, 19 Sep 2023 17:41:33 +0000 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 030D1C15; Tue, 19 Sep 2023 10:42:09 -0700 (PDT) Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AC2523F5A1; Tue, 19 Sep 2023 10:41:30 -0700 (PDT) From: Sudeep Holla Date: Tue, 19 Sep 2023 18:40:59 +0100 Subject: [PATCH RFT v2 11/18] firmware: arm_ffa: Add interface to send a notification to a given partition MIME-Version: 1.0 Message-Id: <20230919-ffa_v1-1_notif-v2-11-6f3a3ca3923c@arm.com> References: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> In-Reply-To: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sudeep Holla , Jens Wiklander , Marc Bonnici , Coboy Chen , Lorenzo Pieralisi , Olivier Deprez X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2181; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=mf13geoyRUVq+k7QY/1WTY0HvW1S38+M9VoghctS2VY=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBlCd074rORL91R/e9bjGTHEFnHip8ToRIvg1XiG TM8fH769IaJAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZQndOwAKCRAAQbq8MX7i mIVVD/96c5oId3hsFXU8Px9FTT8Ln6/vK7dSNd8JamLQye/U43K2AT6Cyu8q3dFqyeqQhTdMUZg H41PCfQuwkozpqsWOvX2rWgFCzcIRe6eneuvEgkvu695mNghv7K8cDMqaUhWdUPGvdnFVSgeet9 DmrXWoeId4ZDCFgWWmqnteZx1nEPJrUP7tPEzFswidMazhVrE+omjgPWqy1SVJ7THtP2K1ir83s 4/WgdyLQT+nUw9vE2qhghORJpJJ7VRFWOo+WjIbC5NYaWBV6z/51r5vhdRCAqopYGP5KZhhhPYu OqfTtn5i47sWAcMANVjH8oAcz6BGp0iqkfPeB8bN6F9U4wkt9EOA76/3jCvWqruOaPoFralx3AL J0XjIFfcMc9xW76BRWz2eM2ArSgMEnvLPz0NJ7h6F2hlM8kTuHqfbyoE5OzNA2fJXGcwlVC3WWP A0QqGaTcAXGg9UiW8qUIx7HA8S8ALIVrwD8Wkjvj/WNPhAyFAkedB8WFh+82yUX5Zovgi7xeH0V +O783nfHNcxwzHVLvZ42kXIiSJCSScpXiezYEmhH3MjazXYttFh2eQV2M9xz7Es7vRLfmpc9zcj JoSb2+QvEwmlwePjXu5XWRGP1T5Q7vSCaNxIvrMlY7qErop94tvZtfTUAnYkm5Eom7ouR7OiB75 1Gu+7e5PfgN2GsQ== X-Developer-Key: i=sudeep.holla@arm.com; a=openpgp; fpr=7360A21742ADF5A11767C1C139CFD4755FE2D5B4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230919_104132_203947_E2A1210A X-CRM114-Status: GOOD ( 12.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The framework provides an interface to the sender endpoint to specify the notification to signal to the receiver endpoint. A sender signals a notification by requesting its partition manager to set the corresponding bit in the notifications bitmap of the receiver. Expose the ability to send a notification to another partition. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_ffa/driver.c | 13 +++++++++++++ include/linux/arm_ffa.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c index 1d61442ca4fa..b95c7979da8d 100644 --- a/drivers/firmware/arm_ffa/driver.c +++ b/drivers/firmware/arm_ffa/driver.c @@ -1033,6 +1033,18 @@ static int ffa_notify_request(struct ffa_device *dev, bool is_per_vcpu, return rc; } +static int ffa_notify_send(struct ffa_device *dev, int notify_id, + bool is_per_vcpu, u16 vcpu) +{ + u32 flags = 0; + + if (is_per_vcpu) + flags |= (PER_VCPU_NOTIFICATION_FLAG | vcpu << 16); + + return ffa_notification_set(dev->vm_id, drv_info->vm_id, flags, + BIT(notify_id)); +} + static const struct ffa_info_ops ffa_drv_info_ops = { .api_version_get = ffa_api_version_get, .partition_info_get = ffa_partition_info_get, @@ -1058,6 +1070,7 @@ static const struct ffa_notifier_ops ffa_drv_notifier_ops = { .sched_recv_cb_unregister = ffa_sched_recv_cb_unregister, .notify_request = ffa_notify_request, .notify_relinquish = ffa_notify_relinquish, + .notify_send = ffa_notify_send, }; static const struct ffa_ops ffa_drv_ops = { diff --git a/include/linux/arm_ffa.h b/include/linux/arm_ffa.h index fb6f388a3737..f6df81f14b6d 100644 --- a/include/linux/arm_ffa.h +++ b/include/linux/arm_ffa.h @@ -401,6 +401,8 @@ struct ffa_notifier_ops { int (*notify_request)(struct ffa_device *dev, bool per_vcpu, ffa_notifier_cb cb, void *cb_data, int notify_id); int (*notify_relinquish)(struct ffa_device *dev, int notify_id); + int (*notify_send)(struct ffa_device *dev, int notify_id, bool per_vcpu, + u16 vcpu); }; struct ffa_ops { From patchwork Tue Sep 19 17:41:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 13391642 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2F67FCE79AA for ; Tue, 19 Sep 2023 17:42:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:In-Reply-To:References:Message-Id: MIME-Version:Subject:Date:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3fxx1su54BEPBKwmJVJxtipdleWbxgyhcdqHYBXQkQ8=; b=ujKwjrZaMAbHZD 2RkqFiKcK6ndmbxAPaLOsE0DaSCNcXzjO1LS2PBhGBF+a83yB+UDUqPpu+kkv+gFAB06yeNYfq8Ss ozzXJp1pjy9vTBS4Y8JFVOTfORO2JjD0IS0FGQmFrZRLfBU5hbt1fqtVJnO7l5rWEkeoNF5A4+JFp 0l4znkE8k8YRTTE2mebP9b+t63FO78A5vF18qePZaw0k+tqfzZGni/2+nBYL/Vv9uc6v0v21h/P9A Az7rrapYG2RHnY7nv/SKrktYs+WZiq7qtDEb122QRa47RAJ2EPtsAK2ep+DiO9amq/lzaMJVuqEcu 9+Ou9ho23BPfRjckIzrA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qieju-000xmx-2l; Tue, 19 Sep 2023 17:42:22 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiej8-000xDs-0x for linux-arm-kernel@lists.infradead.org; Tue, 19 Sep 2023 17:41:36 +0000 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 2E9A2FEC; Tue, 19 Sep 2023 10:42:10 -0700 (PDT) Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D7B6D3F5A1; Tue, 19 Sep 2023 10:41:31 -0700 (PDT) From: Sudeep Holla Date: Tue, 19 Sep 2023 18:41:00 +0100 Subject: [PATCH RFT v2 12/18] firmware: arm_ffa: Add notification handling mechanism MIME-Version: 1.0 Message-Id: <20230919-ffa_v1-1_notif-v2-12-6f3a3ca3923c@arm.com> References: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> In-Reply-To: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sudeep Holla , Jens Wiklander , Marc Bonnici , Coboy Chen , Lorenzo Pieralisi , Olivier Deprez X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=3653; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=O2oYfFgNyaZT+oxSu90NE22HRT7VXlpCfSjWMW7VjBc=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBlCd07bZhnpL9OoP0arA4+yGtA3Q/neollvQxIX 4uia80jWpWJAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZQndOwAKCRAAQbq8MX7i mK7BD/91rxn4y8+6ztrYeXUpXFt+f/hD/vur9TXBxo8cfX5kacB5JP5YT0oyeWLw7CVkrULwDyL 2IoWT0P0Kl+asv45U4oNS8gwLLPXaPE/yO3EPzJA2TRa/l0a2CKsvW079BqBfDSYqy7s9fSca35 jjBRcwtU8TLhOLbpCqQWjtcY6nifjSz9AmPxjdPjcIPr+zqTNWerTw1szspLP/sGtrSIkyia521 6tAi2spKFff0bsiY3OaLUXGZt9iW1bpOKXAtXaT8CViRAiVFUGqNan9TF+LyZaHLpgXmB7rVqr4 gmIL6lfF5KDMAHNq0YRcCL2kREFFgYddVLRPxPXs4qkvMlcGZixMfQ6mqlB2Cpgd3Tmpwh0MS4p AQAOlIfPoqMpCODO2XTD8k/G5bm9Axud6OcfUmpausa/TTfFxu6i+mXEkKgVcezgM1hWRWMXjtI mjsfVm6VFQZPMIPaTtLW9Z18jpCAvG9DV2dqXmsWWmrEBNnFpjipg43S0/eFdw7LpqWjWBqiGnR SZbhCxtVMChsRhaEZa7+wX87aUc5b5IEjvNUPO2SChJro12fWU8avMe6dzjGetyg4vOrtvpGRJl Qz0MD836q/7nvDgVEOF62a3LkoSXj21MeH9Jy3VK//4k+4nU1IZAP7+amdtW2T4LFf0UuYDvqHJ d0Uy4NTguEagQLQ== X-Developer-Key: i=sudeep.holla@arm.com; a=openpgp; fpr=7360A21742ADF5A11767C1C139CFD4755FE2D5B4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230919_104134_424028_AC36C7CE X-CRM114-Status: GOOD ( 16.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org With all the necessary plumbing in place, let us add handling the notifications as part of schedule receiver interrupt handler. In order to do so, we need to just register scheduling callback on behalf of the driver partition. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_ffa/driver.c | 62 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c index b95c7979da8d..8a5b5c274bb9 100644 --- a/drivers/firmware/arm_ffa/driver.c +++ b/drivers/firmware/arm_ffa/driver.c @@ -103,6 +103,7 @@ struct ffa_drv_info { unsigned int cpuhp_state; struct ffa_pcpu_irq __percpu *irq_pcpu; struct workqueue_struct *notif_pcpu_wq; + struct work_struct notif_pcpu_work; struct work_struct irq_work; bool info_get_64b; struct xarray partition_info; @@ -1045,6 +1046,55 @@ static int ffa_notify_send(struct ffa_device *dev, int notify_id, BIT(notify_id)); } +static void handle_notif_callbacks(u64 bitmap, u16 part_id) +{ + int notify_id; + struct notifier_cb_info *cb_info = NULL; + + for (notify_id = 0; notify_id <= FFA_MAX_NOTIFICATIONS && bitmap; + notify_id++, bitmap >>= 1) { + if (!(bitmap & 1)) + continue; + + mutex_lock(&drv_info->notify_lock); + cb_info = notifier_hash_node_get(part_id, notify_id); + mutex_unlock(&drv_info->notify_lock); + + if (cb_info && cb_info->cb) + cb_info->cb(notify_id, cb_info->cb_data); + } +} + +static void notif_pcpu_irq_work_fn(struct work_struct *work) +{ + int rc; + struct ffa_notify_bitmaps bitmaps; + struct ffa_drv_info *info = container_of(work, struct ffa_drv_info, + notif_pcpu_work); + + rc = ffa_notification_get(ALL_NOTIFICATION_BITMAPS_FLAGS, &bitmaps); + if (rc) { + pr_err("Failed to retrieve notifications with %d!\n", rc); + return; + } + + handle_notif_callbacks(bitmaps.vm_map, info->vm_id); + handle_notif_callbacks(bitmaps.sp_map, info->vm_id); + handle_notif_callbacks(bitmaps.arch_map, info->vm_id); +} + +static void +ffa_self_notif_handle(u16 vcpu, bool is_per_vcpu, void *cb_data) +{ + struct ffa_drv_info *info = cb_data; + + if (!is_per_vcpu) + notif_pcpu_irq_work_fn(&info->notif_pcpu_work); + else + queue_work_on(vcpu, info->notif_pcpu_wq, + &info->notif_pcpu_work); +} + static const struct ffa_info_ops ffa_drv_info_ops = { .api_version_get = ffa_api_version_get, .partition_info_get = ffa_partition_info_get, @@ -1149,6 +1199,13 @@ static void ffa_setup_partitions(void) drv_info->partition_count = count; kfree(pbuf); + + /* Allocate for the host */ + info = kzalloc(sizeof(*info), GFP_KERNEL); + if (!info) + return; + xa_store(&drv_info->partition_info, drv_info->vm_id, info, GFP_KERNEL); + drv_info->partition_count++; } static void ffa_partitions_cleanup(void) @@ -1292,6 +1349,7 @@ static int ffa_init_pcpu_irq(unsigned int irq) } INIT_WORK(&drv_info->irq_work, ffa_sched_recv_irq_work_fn); + INIT_WORK(&drv_info->notif_pcpu_work, notif_pcpu_irq_work_fn); drv_info->notif_pcpu_wq = create_workqueue("ffa_pcpu_irq_notification"); if (!drv_info->notif_pcpu_wq) return -EINVAL; @@ -1349,7 +1407,9 @@ static int ffa_notifications_setup(void) hash_init(drv_info->notifier_hash); mutex_init(&drv_info->notify_lock); - return 0; + /* Register internal scheduling callback */ + return ffa_sched_recv_cb_update(drv_info->vm_id, + ffa_self_notif_handle, drv_info, true); cleanup: ffa_notifications_cleanup(); return ret; From patchwork Tue Sep 19 17:41:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 13391640 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2CBBCCE79A9 for ; Tue, 19 Sep 2023 17:42:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=fKHgAqWEiRQO6U/CyURnpSV9Pwmoo37vRQC8IySKCDw=; b=QNBE0EiaCAjQQu jMDVG2fdbb9soXdrL8tbm5l4805GdhvxCuPXZdCiqOQlLi2fObEowX7n/qOFskxN+NKsSx8gImDor K9HbmschvoxahnlM+phJhyrH48GRpFMPO5Pqf4FtUm6R7V/A481YEfvyxLDdT1U50s0DCeSRwKRTp vevY1pzzOWHIHHd+LvSek9tT0G/DHwU6Van1r+S1nVriGFF7bAELISDVO3VS0p05rRUg65TDRCZXr 0ajs6yLKYHGhgWuHMluXtE7M53EgvwINuyBHJ59PTtkHiYLq5Irjr9eACfPmUEUhRxMqPaqYVIEJC pNfEH/B1dhqy3ZFzJPZw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qieju-000xmZ-0i; Tue, 19 Sep 2023 17:42:22 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiej8-000xFM-1h for linux-arm-kernel@lists.infradead.org; Tue, 19 Sep 2023 17:41:36 +0000 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 748B01FB; Tue, 19 Sep 2023 10:42:11 -0700 (PDT) Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0F3E53F5A1; Tue, 19 Sep 2023 10:41:32 -0700 (PDT) From: Sudeep Holla Date: Tue, 19 Sep 2023 18:41:01 +0100 Subject: [PATCH RFT v2 13/18] firmware: arm_ffa: Don't set the memory region attributes for MEM_LEND MIME-Version: 1.0 Message-Id: <20230919-ffa_v1-1_notif-v2-13-6f3a3ca3923c@arm.com> References: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> In-Reply-To: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sudeep Holla , Jens Wiklander , Marc Bonnici , Coboy Chen , Lorenzo Pieralisi , Olivier Deprez Cc: Joao Alves X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2038; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=ZvoeIZd0Pqo3Ya9dsPGQ9xQvguOm3+9Cq7nXLi0CZSc=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBlCd08kfIH+2N9tA2KqxNb8BJD9kXW6U1ibgai8 /fPN9BWhQeJAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZQndPAAKCRAAQbq8MX7i mHf8EADWH21kGXFn2PLOkKMHCj83izRmm0b2DUKYAsLKj4jJSST/rdIujthnRARnmB/nKDcZbdr Wvmh6N77r5wlkLC6FHpUZZp10ILr7UyOupPEYPGvIPAaqUgaV8QfNRThMi0Tpz8CwWHGuCbDcIv LbYtc2XNQZHZVxb6fc00xhL/PXm0AiZ9HsHDsee5/wpxgB0xeyuWaCQHU8iUz3kMhLcxscSNM0x UCTtORQyk1gSInclvs74EKXZGySvUFtvbBwFvTYtld1xa6AY3dj8K1wxwjT0au363Rm6r4edYmR v6iSod8M95u35u/ykWZm1ycnWP5roZLQsXmvHH9SJS1vAC22oS37WTbfck0TvqiX3XlQYtRyjLg ackRNeRo8TWQvnw0beQygG/E510kwtQnRMhFQ0GkZBhzXQ9PtVX7kf5yh2sRm5/0ooXTP0mHa6U GyrLpGDjQb3SNNvreg0VzJZHWMeApNWM4E///nBGkxRNvTRkHog3xN5oM9vCZOVj4sjCa6VvTd5 SXnUnRSLdyIY5aVXBVzA7butjib9HvzW9HWFWT7sMJ+93xCDba6VsH4oZE9dMRonI1ozI4Eie0z 02bX1a3yZBtvp0wRljViU9nfor4vaJIyTM43HBb/r+F/AuyfBs6bwlAmT/OVkgZ+Yt7aed2Nbao d/FO/NqGhE8GZHQ== X-Developer-Key: i=sudeep.holla@arm.com; a=openpgp; fpr=7360A21742ADF5A11767C1C139CFD4755FE2D5B4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230919_104134_656469_49190347 X-CRM114-Status: GOOD ( 11.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org As per the FF-A specification: section "Usage of other memory region attributes", in a transaction to donate memory or lend memory to a single borrower, if the receiver is a PE or Proxy endpoint, the owner must not specify the attributes and the relayer will return INVALID_PARAMETERS if the attributes are set. Let us not set the memory region attributes for MEM_LEND. Fixes: 82a8daaecfd9 ("firmware: arm_ffa: Add support for MEM_LEND") Reported-by: Joao Alves Reported-by: Olivier Deprez Signed-off-by: Sudeep Holla --- drivers/firmware/arm_ffa/driver.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c index 8a5b5c274bb9..6312a7807d37 100644 --- a/drivers/firmware/arm_ffa/driver.c +++ b/drivers/firmware/arm_ffa/driver.c @@ -424,6 +424,19 @@ static u32 ffa_get_num_pages_sg(struct scatterlist *sg) return num_pages; } +static u8 ffa_memory_attributes_get(u32 func_id) +{ + /* + * For the memory lend or donate operation, if the receiver is a PE or + * a proxy endpoint, the owner/sender must not specify the attributes + */ + if (func_id == FFA_FN_NATIVE(MEM_LEND) || + func_id == FFA_MEM_LEND) + return 0; + + return FFA_MEM_NORMAL | FFA_MEM_WRITE_BACK | FFA_MEM_INNER_SHAREABLE; +} + static int ffa_setup_and_transmit(u32 func_id, void *buffer, u32 max_fragsize, struct ffa_mem_ops_args *args) @@ -440,8 +453,7 @@ ffa_setup_and_transmit(u32 func_id, void *buffer, u32 max_fragsize, mem_region->tag = args->tag; mem_region->flags = args->flags; mem_region->sender_id = drv_info->vm_id; - mem_region->attributes = FFA_MEM_NORMAL | FFA_MEM_WRITE_BACK | - FFA_MEM_INNER_SHAREABLE; + mem_region->attributes = ffa_memory_attributes_get(func_id); ep_mem_access = &mem_region->ep_mem_access[0]; for (idx = 0; idx < args->nattrs; idx++, ep_mem_access++) { From patchwork Tue Sep 19 17:41:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 13391644 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6626FCE79A8 for ; Tue, 19 Sep 2023 17:42:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:In-Reply-To:References:Message-Id: MIME-Version:Subject:Date:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Jcw5I9WM7eY+uRMof/jn++LIm/0mFzqICMkUyVXnb0E=; b=CwiNiceTTb1+/5 4GFXmnss70LEEMVdqsOiLXv6BkDw5BfqlRpGIFM3ea0z50zOaaYvbfzmfI5d0nJCBkppjap9Z2Z+k fh+0nmtROS2xum65Inn8vUqpVXta8C8lqjV0D36jAsS/aM0SitOW28WWhEwazbmHY0KhWwh0zLbZU N0kcBCKsC13OFDhS7C2b5CMFtyS4+sG5cGW2pUW5Qc9uU4txX8/G+/P+k+K6iFUw+Uu//Ku9wQJDw x50XGAO+nBXylaRzOV0fHnvhxvPV5i0pALuWotjynsB01M44aKtoCJOdMexCuURrrW5Ipnx69P2BD bK1CLXsadTuKWsrPIaAw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiejv-000xna-1h; Tue, 19 Sep 2023 17:42:23 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiejA-000xFM-2p for linux-arm-kernel@lists.infradead.org; Tue, 19 Sep 2023 17:41:38 +0000 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 A0770C15; Tue, 19 Sep 2023 10:42:12 -0700 (PDT) Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 551533F5A1; Tue, 19 Sep 2023 10:41:34 -0700 (PDT) From: Sudeep Holla Date: Tue, 19 Sep 2023 18:41:02 +0100 Subject: [PATCH RFT v2 14/18] firmware: arm_ffa: Simplify the computation of transmit and fragment length MIME-Version: 1.0 Message-Id: <20230919-ffa_v1-1_notif-v2-14-6f3a3ca3923c@arm.com> References: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> In-Reply-To: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sudeep Holla , Jens Wiklander , Marc Bonnici , Coboy Chen , Lorenzo Pieralisi , Olivier Deprez X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=3428; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=PHZUUrZvOCnNHDI+i/Plgq+A2R5oHmSmqrncoEkZxGs=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBlCd0811YapzFopiMGNcOkCEDvNWtWDiwYdXrG3 kWMD0B7SwaJAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZQndPAAKCRAAQbq8MX7i mHA2D/9/hF3VaKABoZURL5PKUaLFVp4zmlY7MYesN4/HMnZgVyMesjmml5nF7p+NmU4bnmnlpeZ UwWEcZDjOrOsjw3HdtcCnYGUM/KfbefJ2BY5ZGCH+GSFDpARZUQc8mduZRjMi0AUdJCIMCzyEQo U65ki8FOQ3rx3LQdy+Z5hGX8QCnYp8moaUXIDEzlcQ2QWa5wJt01zOyPzzHG6ukiYth6jVU1uMN +fir+ORoT4ubFBBbMp1i5ZiIB4hmBx4FgziIeqNycD7x0z4wwA0lScBKVeolSwSpb1eFNMRXelZ Wn2gIDcMRL+iA2PLa6SsRbR0/HLVXiVQbYHAhAVqVJhgWLIglZF8sNlVVGlvydUXoNxpcZphc3b scodmQN0np1fqydWw3CqQKw7p5vvx3YlcqPa1mcc5hv0MoH5z9wCX0iF+vyUlg84LKEKupp9lI8 b9/nTJ+1VJvIfUDufNn1ZHBSKbv7t3kK0aFAVK8oQna3qtOB5XzPKIazmtxwmwGg33SeMFcSwcJ cA/uB6F9YxRy3h7bVeoglf9zZpncg2EJMh3dgBSzMG4NOQGbgLlw5PQspzg4Y2jA4Qpg4BPSFNP DrnnjTTKXSK9w5yq6tdmuJm434Fg43PhYgRbrXnYKwMRRuSktX/+PDLIVAhg4puIm5EAasb37OL nhMLLL13zDzsCbA== X-Developer-Key: i=sudeep.holla@arm.com; a=openpgp; fpr=7360A21742ADF5A11767C1C139CFD4755FE2D5B4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230919_104137_005123_F00D01D9 X-CRM114-Status: GOOD ( 12.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The computation of endpoint memory access descriptor's composite memory region descriptor offset is using COMPOSITE_CONSTITUENTS_OFFSET which is unnecessary complicated. Composite memory region descriptor always follow the endpoint memory access descriptor array and hence it is computed accordingly. COMPOSITE_CONSTITUENTS_OFFSET is useless and wrong for any input other than endpoint memory access descriptor count. Let us drop the usage of COMPOSITE_CONSTITUENTS_OFFSET to simplify the computation of total transmit and fragment length in the memory transactions. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_ffa/driver.c | 14 ++++++++------ include/linux/arm_ffa.h | 2 -- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c index 6312a7807d37..dadd56d17c20 100644 --- a/drivers/firmware/arm_ffa/driver.c +++ b/drivers/firmware/arm_ffa/driver.c @@ -443,23 +443,25 @@ ffa_setup_and_transmit(u32 func_id, void *buffer, u32 max_fragsize, { int rc = 0; bool first = true; + u32 composite_offset; phys_addr_t addr = 0; + struct ffa_mem_region *mem_region = buffer; struct ffa_composite_mem_region *composite; struct ffa_mem_region_addr_range *constituents; struct ffa_mem_region_attributes *ep_mem_access; - struct ffa_mem_region *mem_region = buffer; u32 idx, frag_len, length, buf_sz = 0, num_entries = sg_nents(args->sg); mem_region->tag = args->tag; mem_region->flags = args->flags; mem_region->sender_id = drv_info->vm_id; mem_region->attributes = ffa_memory_attributes_get(func_id); - ep_mem_access = &mem_region->ep_mem_access[0]; + ep_mem_access = buffer + COMPOSITE_OFFSET(0); + composite_offset = COMPOSITE_OFFSET(args->nattrs); for (idx = 0; idx < args->nattrs; idx++, ep_mem_access++) { ep_mem_access->receiver = args->attrs[idx].receiver; ep_mem_access->attrs = args->attrs[idx].attrs; - ep_mem_access->composite_off = COMPOSITE_OFFSET(args->nattrs); + ep_mem_access->composite_off = composite_offset; ep_mem_access->flag = 0; ep_mem_access->reserved = 0; } @@ -468,13 +470,13 @@ ffa_setup_and_transmit(u32 func_id, void *buffer, u32 max_fragsize, mem_region->reserved_1 = 0; mem_region->ep_count = args->nattrs; - composite = buffer + COMPOSITE_OFFSET(args->nattrs); + composite = buffer + composite_offset; composite->total_pg_cnt = ffa_get_num_pages_sg(args->sg); composite->addr_range_cnt = num_entries; composite->reserved = 0; - length = COMPOSITE_CONSTITUENTS_OFFSET(args->nattrs, num_entries); - frag_len = COMPOSITE_CONSTITUENTS_OFFSET(args->nattrs, 0); + length = composite_offset + CONSTITUENTS_OFFSET(num_entries); + frag_len = composite_offset + CONSTITUENTS_OFFSET(0); if (frag_len > max_fragsize) return -ENXIO; diff --git a/include/linux/arm_ffa.h b/include/linux/arm_ffa.h index f6df81f14b6d..748d0a83a4bc 100644 --- a/include/linux/arm_ffa.h +++ b/include/linux/arm_ffa.h @@ -356,8 +356,6 @@ struct ffa_mem_region { (offsetof(struct ffa_mem_region, ep_mem_access[x])) #define CONSTITUENTS_OFFSET(x) \ (offsetof(struct ffa_composite_mem_region, constituents[x])) -#define COMPOSITE_CONSTITUENTS_OFFSET(x, y) \ - (COMPOSITE_OFFSET(x) + CONSTITUENTS_OFFSET(y)) struct ffa_mem_ops_args { bool use_txbuf; From patchwork Tue Sep 19 17:41:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 13391641 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D8FB3CE79A8 for ; Tue, 19 Sep 2023 17:42:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gGCNzm+/hxIc2VmA5HLJy54XsFGJSlIwUGR2+ACWblg=; b=zv4x/J9EKRt0Bb jhELtqOGjsxcS0H2lcyOh+2wt/VeZ/o9MkRbHuDlO0yp09TkFPfcnqZ6vMvkip4AgRbVecO7W54ik gq3kbhe+A0o516ZflTKRaInD+QDlABZ19/0C3EA86QxiUhJYBvECIaxDRmkqOJi6dsmL4W15wAxbe 9UzVHtAVj+XB+svXroqEvqxXXnQQEKkw+IkQab8sc7JnXwBbXkz+I7wXDcVO7aKimbFwpaQz7WzG3 FXfVIoRmNaWHF30tZjisj/ygzTY03cMdSUJfk3zVaMerQV5kBf0TXH4vEoKN6/70wY0A8tiEGEczM al9GwcRV4jtdjGqCKzEA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiejw-000xoG-1u; Tue, 19 Sep 2023 17:42:24 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiejB-000xDs-0W for linux-arm-kernel@lists.infradead.org; Tue, 19 Sep 2023 17:41:38 +0000 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 40C031FB; Tue, 19 Sep 2023 10:42:14 -0700 (PDT) Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 80E443F5A1; Tue, 19 Sep 2023 10:41:35 -0700 (PDT) From: Sudeep Holla Date: Tue, 19 Sep 2023 18:41:03 +0100 Subject: [PATCH RFT v2 15/18] KVM: arm64: FFA: Remove access of endpoint memory access descriptor array MIME-Version: 1.0 Message-Id: <20230919-ffa_v1-1_notif-v2-15-6f3a3ca3923c@arm.com> References: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> In-Reply-To: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sudeep Holla , Jens Wiklander , Marc Bonnici , Coboy Chen , Lorenzo Pieralisi , Olivier Deprez Cc: Marc Zyngier , Oliver Upton , Will Deacon , Quentin Perret X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=3159; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=CTw1x/D0KwElSeI7bOG81XZhTChJRsMLSO0KjaEGR4U=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBlCd08ijrI42Lh58f8oTpL9xDXv7bsVLVErApak RQb2w+a4CaJAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZQndPAAKCRAAQbq8MX7i mL1wEADAELBqtAik9x4UepITZU0z/I+3vFWE2SosXnm8ecouzOr+jrbMGQc949mh2Q556M/3EY0 nyJC0znVU4KcMYBlxaKH6WNwXTvt0/qTORdvDe1VziFrQufZPO1lRJx2qlsXfd+MiUQ/k6rqVhk dkDdzQUdE0h8lRxGphdXm98bBCqFDbOprxsLGm8gYMoNsnhoPQ8Nb9iVnBpJEHXoKTy4bb24dzY Sf7ct40lcOFjTnV2aZ5LFlSNqwEq3QgV42J51d9eC0z5ZipZYA/ziB2WuApjUl+OnZQf5Mp0KSm MmIQprkLEFVumN8j2gj3NsuCK6+m8lPR2Cr49B5R+7IiLMNTLZ0fd7QnvnBbcukwzULMOgs+xT0 VKPCHmiuC1Ahz97LdqsCfg2k5kpvGqIBGxFqXOlUumE7byxhyAhW+7NHA5yeTpGXztdFNKgvEO3 LXlQngZb6n1JAtxCQVwSfQv3G/KC0N5xNFhJmL0G+lr+9280qC0z/gLYayEvzGsKebU71Awlsh9 7Cq/ofN+hzZkWtxlDP1ahjGSsBSshLzydMUvA4IqtxVzPoToN8iKpUyuwigcPoLpmLzsqCySWnH Sk7Aq2xQP6GJZm6BQ0egx2A/6miKmMkjo9LhbSyirdCtMVTRxuppJ2aKM1EzNTXIU60kLDpQWBh pSEs5oIIeE42WlQ== X-Developer-Key: i=sudeep.holla@arm.com; a=openpgp; fpr=7360A21742ADF5A11767C1C139CFD4755FE2D5B4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230919_104137_312202_935EB9FE X-CRM114-Status: GOOD ( 13.51 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org FF-A v1.1 removes the fixed location of endpoint memory access descriptor array within the memory transaction descriptor structure. In preparation to remove the ep_mem_access member from the ffa_mem_region structure, provide the accessor to fetch the offset and use the same in FF-A proxy implementation. The accessor take the boolean argument that indicates if the memory access descriptor versions is v1(old format) or not. Currently it is set true as FF-A proxy supports only v1.0 Cc: Marc Zyngier Cc: Oliver Upton Cc: Will Deacon Cc: Quentin Perret Signed-off-by: Sudeep Holla --- arch/arm64/kvm/hyp/nvhe/ffa.c | 8 ++++++-- include/linux/arm_ffa.h | 6 ++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kvm/hyp/nvhe/ffa.c b/arch/arm64/kvm/hyp/nvhe/ffa.c index ab4f5d160c58..45e78af76e25 100644 --- a/arch/arm64/kvm/hyp/nvhe/ffa.c +++ b/arch/arm64/kvm/hyp/nvhe/ffa.c @@ -423,6 +423,7 @@ static __always_inline void do_ffa_mem_xfer(const u64 func_id, DECLARE_REG(u32, fraglen, ctxt, 2); DECLARE_REG(u64, addr_mbz, ctxt, 3); DECLARE_REG(u32, npages_mbz, ctxt, 4); + struct ffa_mem_region_attributes *ep_mem_access; struct ffa_composite_mem_region *reg; struct ffa_mem_region *buf; u32 offset, nr_ranges; @@ -452,7 +453,8 @@ static __always_inline void do_ffa_mem_xfer(const u64 func_id, buf = hyp_buffers.tx; memcpy(buf, host_buffers.tx, fraglen); - offset = buf->ep_mem_access[0].composite_off; + ep_mem_access = (void *)buf + ffa_mem_desc_offset(buf, 0, true); + offset = ep_mem_access->composite_off; if (!offset || buf->ep_count != 1 || buf->sender_id != HOST_FFA_ID) { ret = FFA_RET_INVALID_PARAMETERS; goto out_unlock; @@ -504,6 +506,7 @@ static void do_ffa_mem_reclaim(struct arm_smccc_res *res, DECLARE_REG(u32, handle_lo, ctxt, 1); DECLARE_REG(u32, handle_hi, ctxt, 2); DECLARE_REG(u32, flags, ctxt, 3); + struct ffa_mem_region_attributes *ep_mem_access; struct ffa_composite_mem_region *reg; u32 offset, len, fraglen, fragoff; struct ffa_mem_region *buf; @@ -528,7 +531,8 @@ static void do_ffa_mem_reclaim(struct arm_smccc_res *res, len = res->a1; fraglen = res->a2; - offset = buf->ep_mem_access[0].composite_off; + ep_mem_access = (void *)buf + ffa_mem_desc_offset(buf, 0, true); + offset = ep_mem_access->composite_off; /* * We can trust the SPMD to get this right, but let's at least * check that we end up with something that doesn't look _completely_ diff --git a/include/linux/arm_ffa.h b/include/linux/arm_ffa.h index 748d0a83a4bc..7be240e37f36 100644 --- a/include/linux/arm_ffa.h +++ b/include/linux/arm_ffa.h @@ -357,6 +357,12 @@ struct ffa_mem_region { #define CONSTITUENTS_OFFSET(x) \ (offsetof(struct ffa_composite_mem_region, constituents[x])) +static inline u32 +ffa_mem_desc_offset(struct ffa_mem_region *buf, int count, bool mem_desc_v1) +{ + return COMPOSITE_OFFSET(0); +} + struct ffa_mem_ops_args { bool use_txbuf; u32 nattrs; From patchwork Tue Sep 19 17:41:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 13391645 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 18795CE79A8 for ; Tue, 19 Sep 2023 17:42:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:In-Reply-To:References:Message-Id: MIME-Version:Subject:Date:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=oxLWMz+mdkz7kSds90qdYexabkWOZN77KYApxVUmxyk=; b=faCYMRPM+HJkKU FW7ddxPh/lnXwn+feOQjG6IA5s/TBhS9O21SqQs7E7tfVKfkAmMlwa4CRzhqWl+N69IM+g1zTBVzD PIYggxVW+AihrxeOlaJ0aKLub1jIMA3vxqaUrYZX07GhgNp2JEmMh4UfzGKVFJiK9v1icM/UEczCT /KaBy1Qu8VDb9/txZkdZ9aASB3BSPF3JtwEa7RCNyRZoFWsl/uCDof9aPOMoJW6MOG29MWPXDME/U TuLs50DfE2m8vwo4yMm+hSGNmnyltoyH4c8UJe8+2xXJns1g+1nVH2psOx7DCcWDZ4GCxsHA8ioim Ae69z3KKR9L+duaPpBCA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiejx-000xpF-1L; Tue, 19 Sep 2023 17:42:25 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiejD-000xDs-1U for linux-arm-kernel@lists.infradead.org; Tue, 19 Sep 2023 17:41:41 +0000 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 6C695FEC; Tue, 19 Sep 2023 10:42:15 -0700 (PDT) Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 211EE3F5A1; Tue, 19 Sep 2023 10:41:37 -0700 (PDT) From: Sudeep Holla Date: Tue, 19 Sep 2023 18:41:04 +0100 Subject: [PATCH RFT v2 16/18] firmware: arm_ffa: Switch to using ffa_mem_desc_offset() accessor MIME-Version: 1.0 Message-Id: <20230919-ffa_v1-1_notif-v2-16-6f3a3ca3923c@arm.com> References: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> In-Reply-To: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sudeep Holla , Jens Wiklander , Marc Bonnici , Coboy Chen , Lorenzo Pieralisi , Olivier Deprez X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1661; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=/nzYxWrUxzHK+XjBQnZCak5Tu7ZPAtOKWE4ng7bZFvM=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBlCd08+RU27qx9u4qlmHu5SskWVsSlzbICaDn0o 3rd3FniYD2JAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZQndPAAKCRAAQbq8MX7i mA4yD/9hjEpdMqMosmD8LUJdH4SJxBtddl7+/7uL6RU2cGhDKblyXWch/1gW2B0EKSDdU7FjHTb PmKWu8dIhpdbB4nToZJCsHkiaqblO8MmKaP4ICLvRqPSbii3UVjZf+780Zb6/UAmEtYk3PqFzcF XTL4wKwnqtCfuixxzssUi2SujyWB2Nril8gwOp4HRaI6n/nPpBgbb5Ve5JTmyA2otiFLMyOM3E7 nBnfiuGQ92dAhfbpR/B77g2K8s9A/gNm9xaLKday0PFR1bJagGj3k3Apn8TkQ8Q41ei+eHs9QpZ MsvHi2mCLdI+LVxrHF6zj/2pwoc6aaxiKYLizCT+rP3CevVB2k9Einpw+g1tEdUxRchHnAunYeI rk1H9h+TsYWphTZdOy11JIn3HEwq/qDrUgaoBtwr+G5KoBWMxeVjmRyFQ3a0kIfUfUMoSqLfM8H bxAAK2yRt15MNn9fTRdtjcqPysD/c5Umyt2x6SP3zSg1Y+wHdwWWAi6yXzfan7t/+quoOQ4+UpL zFhOwZ5TyzEOSwrymIt6bkIKuIwtxQNJpkez/Yo0OIJ42v9m5KhlJ1dLnC6nxc0L8E9XD9XYgnU QMpmPqZeJ5KMcWJMMTmcO/L1k6cdVwOZtnv8rlHRyaI/Q++AGFnlLga9Te4/IzBfIBV5uywmXpf tTJNV2Ndw0vnNKg== X-Developer-Key: i=sudeep.holla@arm.com; a=openpgp; fpr=7360A21742ADF5A11767C1C139CFD4755FE2D5B4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230919_104139_545590_12845E7E X-CRM114-Status: GOOD ( 11.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In preparation to add support to the new memory transaction descriptor, the ep_mem_access member needs to be removed and hence even the macro COMPOSITE_OFFSET(). Let us switch to using the new ffa_mem_desc_offset() accessor in ffa_setup_and_transmit(). This will enable adding the support for new format transparently without any changes here again. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_ffa/driver.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c index dadd56d17c20..e0a0c7cedd90 100644 --- a/drivers/firmware/arm_ffa/driver.c +++ b/drivers/firmware/arm_ffa/driver.c @@ -449,14 +449,15 @@ ffa_setup_and_transmit(u32 func_id, void *buffer, u32 max_fragsize, struct ffa_composite_mem_region *composite; struct ffa_mem_region_addr_range *constituents; struct ffa_mem_region_attributes *ep_mem_access; + bool mdesc_v1 = drv_info->version <= FFA_VERSION_1_0; u32 idx, frag_len, length, buf_sz = 0, num_entries = sg_nents(args->sg); mem_region->tag = args->tag; mem_region->flags = args->flags; mem_region->sender_id = drv_info->vm_id; mem_region->attributes = ffa_memory_attributes_get(func_id); - ep_mem_access = buffer + COMPOSITE_OFFSET(0); - composite_offset = COMPOSITE_OFFSET(args->nattrs); + ep_mem_access = buffer + ffa_mem_desc_offset(buffer, 0, mdesc_v1); + composite_offset = ffa_mem_desc_offset(buffer, args->nattrs, mdesc_v1); for (idx = 0; idx < args->nattrs; idx++, ep_mem_access++) { ep_mem_access->receiver = args->attrs[idx].receiver; From patchwork Tue Sep 19 17:41:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 13391643 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D78F9CE79A9 for ; Tue, 19 Sep 2023 17:42:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:In-Reply-To:References:Message-Id: MIME-Version:Subject:Date:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tuyLlrezXDqEOIWP/cysU7X9nkDOaTVS6Y/Ltf6WDD0=; b=YSiBaQlaj9saRD jdDv3EsI4mcqZ/1YBOP22wZHq2VDI9eys+lznyudm7p8zhnL79eDur8GaSpGs3CfaHeRBRDBb0V9f 4NToD8uGv+00HTdUMEe04Aqdki+ASgMco8Ak1/9n7pd2Xy86KgMm/1U1+9R14+3OKlsOPoNmNVl+T 1VYqCYhTI19O/PEH0ZIqt1s4j4Bmm4+x1DP/xdZbyyTJZmTx1zFwIcXAj89QqwlgMFUMHf3Sw0eDu 4dxnwgWhNGUEOIWYmU+FUB3J7IdwNIMD1ZGDLEJ1SxGn+LcBcrLnHG9mFEeA6ysvN8Fw/tG1FE9R4 8LaLo7NMDdAm2CNhx1bQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiejy-000xq4-0z; Tue, 19 Sep 2023 17:42:26 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiejD-000xFM-2O for linux-arm-kernel@lists.infradead.org; Tue, 19 Sep 2023 17:41:41 +0000 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 982A0C15; Tue, 19 Sep 2023 10:42:16 -0700 (PDT) Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4D05A3F5A1; Tue, 19 Sep 2023 10:41:38 -0700 (PDT) From: Sudeep Holla Date: Tue, 19 Sep 2023 18:41:05 +0100 Subject: [PATCH RFT v2 17/18] firmware: arm_ffa: Update memory descriptor to support v1.1 format MIME-Version: 1.0 Message-Id: <20230919-ffa_v1-1_notif-v2-17-6f3a3ca3923c@arm.com> References: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> In-Reply-To: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sudeep Holla , Jens Wiklander , Marc Bonnici , Coboy Chen , Lorenzo Pieralisi , Olivier Deprez X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=4060; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=/Ov5NW0RpBVvf5EftQkzohgGykDRR0+VeA9B3BekVss=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBlCd08W0FeRpT843CWRqoq7omYR56V8rmCs6AGc Thxt80Vq66JAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZQndPAAKCRAAQbq8MX7i mEhZEACEzIZMM+k6Nv/xNDhe1gkAmJX9WABGLWCIiwyJHnvXpc2Y2B0jMPbdEnNSW3GezwrAv6V fOkEuMAZn8ED+GMSMkCIBFTyeWTBqEv4yLGlmjPJAeNxiw8OE/RGILNyhpT9LndMBn3OfpIVLPF r71/y4iQnPKoRnF0+fTyuvkZEwlXEPeqiIJNFAjrefwsctSE2OjPCmLwWJayWPNcvkSz/+nDrJJ FpzjCSgRRhs79jlnuiABgMBqHrZr4d2i1Ec1EkErVY5wPMtUsc8vg41HB/deoPb/aGvhEaBLUO6 X7IyBCPWsmMFRQPsRqqgKtB693LIHsWEI5PGqVG6rEqTo+Y2S7kYAV1mJQKBC3fd3SdD7o8l+2f 7ap6RcHPiKQnCXSLjy3LpUbuB1T4CGJ9o9IrHpdSAZjovoFDTwsXEZFHy/U4GoPujkGXzX8UDo1 TE4yt9pcHf4wXB6QvQMeX4PP0wkT5FZ2OoC30AN9Aj1Ech8JocyVp5GGRhAZBZFtakiVq+2MNHN 7I6YhRfmkqJd8CGct2KiyHulAkLUSiuYIsa1eMj9ftO89gF+rlsXfZEKTNPEraq6+9t8P0OlGr9 2N7zabEPQeCbzh7yv/l8QjzkNJ3Uh1Fz7evC0zjNJ88I0MxXk4iSLLBtgL6elP6PSTMpvjkXrhc bb+u0RexRjEUAog== X-Developer-Key: i=sudeep.holla@arm.com; a=openpgp; fpr=7360A21742ADF5A11767C1C139CFD4755FE2D5B4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230919_104139_877908_A48700E6 X-CRM114-Status: GOOD ( 18.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Update memory transaction descriptor structure to accommodate couple of new entries in v1.1 which were previously marked reserved and MBZ(must be zero). It also removes the flexible array member ep_mem_access in the memory transaction descriptor structure as it need not be at fixed offset. Also update ffa_mem_desc_offset() accessor to handle both old and new formats of memory transaction descriptors. The updates ffa_mem_region structure aligns with new format in v1.1 and hence the driver/user must take care not to use members beyond and including ep_mem_offset when using the old format. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_ffa/driver.c | 11 ++++++++--- include/linux/arm_ffa.h | 30 +++++++++++++++++++----------- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c index e0a0c7cedd90..e18f0b125d46 100644 --- a/drivers/firmware/arm_ffa/driver.c +++ b/drivers/firmware/arm_ffa/driver.c @@ -424,7 +424,7 @@ static u32 ffa_get_num_pages_sg(struct scatterlist *sg) return num_pages; } -static u8 ffa_memory_attributes_get(u32 func_id) +static u16 ffa_memory_attributes_get(u32 func_id) { /* * For the memory lend or donate operation, if the receiver is a PE or @@ -467,9 +467,14 @@ ffa_setup_and_transmit(u32 func_id, void *buffer, u32 max_fragsize, ep_mem_access->reserved = 0; } mem_region->handle = 0; - mem_region->reserved_0 = 0; - mem_region->reserved_1 = 0; mem_region->ep_count = args->nattrs; + if (mdesc_v1) { + mem_region->ep_mem_size = 0; + } else { + mem_region->ep_mem_size = sizeof(*ep_mem_access); + mem_region->ep_mem_offset = sizeof(*mem_region); + memset(mem_region->reserved, 0, 12); + } composite = buffer + composite_offset; composite->total_pg_cnt = ffa_get_num_pages_sg(args->sg); diff --git a/include/linux/arm_ffa.h b/include/linux/arm_ffa.h index 7be240e37f36..2a0d4b28245a 100644 --- a/include/linux/arm_ffa.h +++ b/include/linux/arm_ffa.h @@ -298,8 +298,8 @@ struct ffa_mem_region { #define FFA_MEM_NON_SHAREABLE (0) #define FFA_MEM_OUTER_SHAREABLE (2) #define FFA_MEM_INNER_SHAREABLE (3) - u8 attributes; - u8 reserved_0; + /* Memory region attributes, upper byte MBZ pre v1.1 */ + u16 attributes; /* * Clear memory region contents after unmapping it from the sender and * before mapping it for any receiver. @@ -337,30 +337,38 @@ struct ffa_mem_region { * memory region. */ u64 tag; - u32 reserved_1; + /* Size of each endpoint memory access descriptor, MBZ pre v1.1 */ + u32 ep_mem_size; /* * The number of `ffa_mem_region_attributes` entries included in this * transaction. */ u32 ep_count; /* - * An array of endpoint memory access descriptors. - * Each one specifies a memory region offset, an endpoint and the - * attributes with which this memory region should be mapped in that - * endpoint's page table. + * 16-byte aligned offset from the base address of this descriptor + * to the first element of the endpoint memory access descriptor array + * Valid only from v1.1 */ - struct ffa_mem_region_attributes ep_mem_access[]; + u32 ep_mem_offset; + /* MBZ, valid only from v1.1 */ + u32 reserved[3]; }; -#define COMPOSITE_OFFSET(x) \ - (offsetof(struct ffa_mem_region, ep_mem_access[x])) #define CONSTITUENTS_OFFSET(x) \ (offsetof(struct ffa_composite_mem_region, constituents[x])) static inline u32 ffa_mem_desc_offset(struct ffa_mem_region *buf, int count, bool mem_desc_v1) { - return COMPOSITE_OFFSET(0); + /* + * Earlier to v1.1, the endpoint memory descriptor array started at + * offset 32(i.e. offset of ep_mem_offset itself) + */ + if (mem_desc_v1) + return offsetof(struct ffa_mem_region, ep_mem_offset) + + (count * sizeof(struct ffa_mem_region_attributes)); + else + return buf->ep_mem_offset + count * buf->ep_mem_size; } struct ffa_mem_ops_args { From patchwork Tue Sep 19 17:41:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 13391646 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8AC0BCE79A9 for ; Tue, 19 Sep 2023 17:42:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:In-Reply-To:References:Message-Id: MIME-Version:Subject:Date:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=leNebYvDLy8pl5rM1wwuaj5Zxv0mdcNBTY8+F5ZSNmI=; b=PUOFas5obJJdLg 3RoOPkHwWDLRWJFSLAvHNoe/KvSgEmUTPEkXxt+GBfubPPs8hISfG3CCFDEPO7xguXBQdnwlp8vSt s7XG0QHdk4F/DEF/m8kwcp8aphQOM8Nj7bcBW72hhVdWFSmRhMHunhJzqKYX/hkMqpdEcHbsHbI2a ZeXZJjZe8r2I2H3AtUHmu7l5wzuzpyipWi3KKjKGUyicevuR853GFVpDVQBOkh7h/PTtHZPS+18Vv UZZNvOoHrTKO1cKG8AsH70PUSMXJSnhHkWO0oHq7D2or2gsVrxvfoz59imtZJKrSf3f3JId6a96V+ TWrFZMFaBlNoGh6YUbpQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiejz-000xqp-0K; Tue, 19 Sep 2023 17:42:27 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiejF-000xMe-1A for linux-arm-kernel@lists.infradead.org; Tue, 19 Sep 2023 17:41:43 +0000 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 C3E501042; Tue, 19 Sep 2023 10:42:17 -0700 (PDT) Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 78C5E3F5A1; Tue, 19 Sep 2023 10:41:39 -0700 (PDT) From: Sudeep Holla Date: Tue, 19 Sep 2023 18:41:06 +0100 Subject: [PATCH RFT v2 18/18] firmware: arm_ffa: Upgrade the driver version to v1.1 MIME-Version: 1.0 Message-Id: <20230919-ffa_v1-1_notif-v2-18-6f3a3ca3923c@arm.com> References: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> In-Reply-To: <20230919-ffa_v1-1_notif-v2-0-6f3a3ca3923c@arm.com> To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sudeep Holla , Jens Wiklander , Marc Bonnici , Coboy Chen , Lorenzo Pieralisi , Olivier Deprez X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=687; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=Pb+LVcZOIfL1PSSQwEckUhDsMu3bfFsfEmBra9hf4+U=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBlCd08IF2qhQuyqxuijENkrrjtStkrVgvoaWusI WOHSwYDYEOJAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZQndPAAKCRAAQbq8MX7i mL4FEADNcrAnBGdL6hdOb80LALhE7fZxdyukmr6zfD+nx5GhhI0201WI1L33C6r/eKIiuC6SrO7 eKaBV8Emmo5x75JZPcua5XS4el8plsHMvKjd6BzjzTZ2sS6yI5lqQYiIoSb1zykPO49kIPs7mIF yBWUgE4b714eusfZIbi+PtLN9af2KAObbGYXjnqcbAYl5k85DvbKAfyb08HMWel/9Lo6n9Y8nlA j0LVvv9u7IBoSQN5sRvkrNsoiAzgxXVKJrFEKzmgiNXGoo7oRdWzAk5nT6bO8z4jhYlDKk+sMdz 7WMIMzEAT56w3jXgRdZoHkvUxRpGKOUPdKaarMMQwuBS3pGuQyixDdK7z5NOtfoEVPhBllic84n g7y+eBusk4GWD78gcFVwrGmDnIpmKo7lxb8ZYXjJgfGmRWCE5UJOeR8grhcLt1SxaBtCaeazqSr 4pBugsB4+X18T5GVflIvgflju6vCC78P/ZNvuYlU3jX7BwJVFEz3ikqeqZFKEyq0dBVbUFDPZW0 /0DyTtTxch7LVj4zw2RB44EDI35VHNXLnX7QwxjP6dcRsVsY9Q8jx2eNUWps/sk2ljNbJwkJJIv lFsdPyIoBLpOwdqLmWqd+7jeyE0qR1wGdXEuyrqo+iPdkrOqnr1PaVdDboRJwc0IY3DGCRe7/HV unFwpBZ8VK3Virw== X-Developer-Key: i=sudeep.holla@arm.com; a=openpgp; fpr=7360A21742ADF5A11767C1C139CFD4755FE2D5B4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230919_104141_479900_B5C5A955 X-CRM114-Status: GOOD ( 10.11 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org With quite a few v1.1 features supported, we can bump the driver version to v1.1 now. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_ffa/driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c index e18f0b125d46..dfc694773ae2 100644 --- a/drivers/firmware/arm_ffa/driver.c +++ b/drivers/firmware/arm_ffa/driver.c @@ -43,7 +43,7 @@ #include "common.h" -#define FFA_DRIVER_VERSION FFA_VERSION_1_0 +#define FFA_DRIVER_VERSION FFA_VERSION_1_1 #define FFA_MIN_VERSION FFA_VERSION_1_0 #define SENDER_ID_MASK GENMASK(31, 16)