From patchwork Mon Apr 15 16:05:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 13630255 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 B5EDEC4345F for ; Mon, 15 Apr 2024 16:06:12 +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=WVYndlcFWqUVAWXGL19NXo2jtGl+9bsSXC3EaNPYyls=; b=MlkfiCzUxAhIWu JCJfKFBQdJs33wxodJz7aIWLOk0fNUYR/C7zZxxCsb4sf+4wsmuCF3MJU7ABYkvSVRhRHBrDOFskb N/9Z/QmKvh12c3+oP1FsdBjEI2XrW7SY0QHWHgie1CgAk3xU0CdNn7cPIWWPSJqs6mmDpqy8/S481 +/vGCFINiEyRRnGWrzl4U/lEjS/zUznVyiKdzURccBOU37sstLDD6EUCqCFJziE9jTB2/kvlf51L6 s1BbKvrrieGrqgT/3x/rIIfmom4KFbjBN5RXBdkYAcrMVMmuKYkzluOHWKWVBn8z88iPmFFAfNhYh Tfug3PiEM/6loT5KBnpg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwOqA-00000008zRI-2X3A; Mon, 15 Apr 2024 16:05:54 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwOq0-00000008zOP-2gKC for linux-arm-kernel@lists.infradead.org; Mon, 15 Apr 2024 16:05:49 +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 284F7DA7; Mon, 15 Apr 2024 09:06: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 B2C503F64C; Mon, 15 Apr 2024 09:05:41 -0700 (PDT) From: Sudeep Holla Date: Mon, 15 Apr 2024 17:05:22 +0100 Subject: [PATCH 1/4] firmware: arm_ffa: Stash the partition properties for query purposes MIME-Version: 1.0 Message-Id: <20240415-ffa_msg2_support-v1-1-a28c964b1b3f@arm.com> References: <20240415-ffa_msg2_support-v1-0-a28c964b1b3f@arm.com> In-Reply-To: <20240415-ffa_msg2_support-v1-0-a28c964b1b3f@arm.com> To: linux-arm-kernel@lists.infradead.org Cc: Marc Bonnici , Olivier Deprez , Lorenzo Pieralisi , Bertrand Marquis , Jens Wiklander , Sudeep Holla X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1790; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=01ueOnMFKv1ELRCpb/gOgrd5/tzFwk+GbrYyJvUBkFk=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBmHVBT+70xDXBgpCIi8Bww3fUFpuh32H34398EM rodc2AgBIGJAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZh1QUwAKCRAAQbq8MX7i mG1kEADCAYGkX6V5ZDGzpm5Lh+N5LuuxSXF2oprKf1DRcQOpf4LAqXGpN8+iJCI903uskD/uFD9 AoUz+s48FiCPDhQm6idzbLlm6X4mqfHeUjryKGE388V7V19++nf17M7y7LMBd48asgT4J/sFB1q R2hHOdZZE4O2ki2h4kjunkQjNsfr3+dpU61QpHgto9vKLzBx04UWELc8oarcdKsG/FKSS2X/yyA U24g4RWB8l7rWmwqbeOP+iqDGdvTQEouf+Ftq3xrbo0Bd9rRUoxOVVBZD7iQEoAXpq7Nvj0/Hwj 7kKo1yCs2cm43zSNGudzwcmQWfJiwkoaMEBQPLcH9H4XcgE3xszi2o4NmMXRSLic4Znv+fkMy7I OmajW79LgabZq5ZMui2Ea/5q99yYmAmyKF7ci71GNJ09IgT90KyrSejDEC8x2qClpuazUQMfzsk NOcmvvzr1CfKgDKNfUr61hs3Cz7IKQgJVXXB2v90JboHYt+Hofif/YE84IOR53acv64aADvpzpA N+y/FC7wlT4rEfx5cQ5mcblPMYGyaQ/mPnn7AJalp7E30Iiy7BcOxv0E+K3pYBz7ItwIOkXDWSA vxSk+GvOZELY4DOJhzc50rV4RgJAxIpW1ZLfwV6gsubZzeSGHesoMbGv7WCTpXb3vfqVoyU+3bF pModixwkS4cJo8Q== 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-20240415_090544_859034_021E9404 X-CRM114-Status: GOOD ( 10.48 ) 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 properies obtained from the partition information descriptor as part of initial partitions discovery is useful as it contain info if the partition - Runs in AArch64 or AArch32 execution state - Can send and/or receive direct requests - Can send and receive indirect message - Does support receipt of notifications. These can be used for querying before attempting to do any of the above operations. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_ffa/driver.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c index 9bc2e10381af..d258d04c1eda 100644 --- a/drivers/firmware/arm_ffa/driver.c +++ b/drivers/firmware/arm_ffa/driver.c @@ -721,6 +721,7 @@ static int ffa_notification_get(u32 flags, struct ffa_notify_bitmaps *notify) } struct ffa_dev_part_info { + u32 properties; ffa_sched_recv_cb callback; void *cb_data; rwlock_t rw_lock; @@ -863,6 +864,17 @@ static void ffa_mode_32bit_set(struct ffa_device *dev) dev->mode_32bit = true; } +static bool ffa_partition_check_property(struct ffa_device *dev, u32 property) +{ + struct ffa_dev_part_info *partition; + + partition = xa_load(&drv_info->partition_info, dev->vm_id); + if (!partition) + return false; + + return partition->properties & property; +} + static int ffa_sync_send_receive(struct ffa_device *dev, struct ffa_send_direct_data *data) { @@ -1236,6 +1248,8 @@ static int ffa_setup_partitions(void) ffa_device_unregister(ffa_dev); continue; } + + info->properties = tpbuf->properties; rwlock_init(&info->rw_lock); ret = xa_insert(&drv_info->partition_info, tpbuf->id, info, GFP_KERNEL);