From patchwork Mon Apr 15 16:05:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 13630253 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 6C323C4345F for ; Mon, 15 Apr 2024 16:06: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: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=z8Z4DfGCYk9eq641kh3Qti46j7uYdise9WwIqR0fOYc=; b=DtkhkElTCGwL32 9WBuhkADR1yk26f6Xx1aAyaRFDIwjKBajjFyuC449Hq6BxAVX8abKuiZ3Ihutc5yRdozWlD0Z3rzj RxfJ8NKW9DuDmEtDVuxQmvQhQWSwtRIU/CpLJZ/TwzsaXQvU9RhFHDzpzGGb0pfk3EAxAguwOLXO0 t1T5LXuhQPSDPnpDkPLUx+9GPPILcLZErQ9KYYZdHAyCLq7a2teRpLdei2PQqDxkt6SaBWlXkRqmw txQvOzOhib9GrfVoyvKsUeV98U5wvZ3qbNkBdX9z2RpJP7/uqjYf2MkKi0Q+1Acq5++K0orlRro+x HGqvEMFDxUkrJ8oTjAtg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwOqB-00000008zRa-12KV; Mon, 15 Apr 2024 16:05:55 +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-00000008zOS-3VLT for linux-arm-kernel@lists.infradead.org; Mon, 15 Apr 2024 16:05:50 +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 23D201476; Mon, 15 Apr 2024 09:06: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 C584D3F64C; Mon, 15 Apr 2024 09:05:42 -0700 (PDT) From: Sudeep Holla Date: Mon, 15 Apr 2024 17:05:23 +0100 Subject: [PATCH 2/4] firmware: arm_ffa: Check if receiving direct requests are supported before sending MIME-Version: 1.0 Message-Id: <20240415-ffa_msg2_support-v1-2-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=1040; i=sudeep.holla@arm.com; h=from:subject:message-id; bh=ldcV2q/CyksOPnbMW3IM9q/GlT3LqBZyJRakr/Qu/lY=; b=owEBbQKS/ZANAwAIAQBBurwxfuKYAcsmYgBmHVBUki8AoAfxLn6RHiPHGXc5qsU627EdiKYet AkXTCjqXRGJAjMEAAEIAB0WIQS6ceUSBvMeskPdk+EAQbq8MX7imAUCZh1QVAAKCRAAQbq8MX7i mFh9D/wMeQ6e6QHdrGqLNSqWy4+I9B5y1x169e0jq2aWoOuV25xZFeC4QaDo8bsxGLrcuke32Ie 5rShvtJ690D9PyLp7sFmMHWCTiV9v8G3btTgdG394ekrjsZ/t6cPCM025iYfwRtoCwkPcffRWep vWem4X3hMcPKYhfFJSDuaWIF218Ee3y/q3Wq8PMYQoImzHsQTs+Ex2RgWmOeGCsO+yj735oNaRM nxF/z+x9y0XarUoav0y5epNJFgmZ7zH8LQIh8G0H5r6sh//11UAh8auid7z2FRBkrkEzVlJGTo5 XHLeWmgfYYwvmOTy42ZTd8mIKlN7fFO3iptdczyaw5Tc4RbBv+wB2EMBXFa5kKWzuAJA0c6ZTYz pgQG+PLbhNb01oWpwKJQyXtB90HX7L3hSY1V0UXNLNq1rWha26O3zj8SfL4+3E6iaM5Cf2pFj7B 0DKXQusbmXpL5n0FafWraXW8dS3DV9ZgwMNxDPGEFHbOeDa6lBGlP19GvbjidkVmy4mCbsoSQyy qhsBccyZOcX7eoWI6q6brnrtPjAKLKfsLHn1GvDxp757DOcu0Oru+dT0MYzeSFYV6m4lXkr4Ynz H4J2mOw4F3J7KjnGbKVFRAeelMggFjjAvUCmqc70PLcTsp2LxwmDNhbCnOndJDa4w/JOTcS01iF b0mJuzxXEER4QPw== 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_956069_FA4C70AC X-CRM114-Status: UNSURE ( 8.87 ) X-CRM114-Notice: Please train this message. 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 check to see if the target partition can receive the direct requests before sending any message to the partition. Signed-off-by: Sudeep Holla --- drivers/firmware/arm_ffa/driver.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c index d258d04c1eda..52379885a403 100644 --- a/drivers/firmware/arm_ffa/driver.c +++ b/drivers/firmware/arm_ffa/driver.c @@ -875,9 +875,15 @@ static bool ffa_partition_check_property(struct ffa_device *dev, u32 property) return partition->properties & property; } +#define ffa_partition_supports_direct_recv(dev) \ + ffa_partition_check_property(dev, FFA_PARTITION_DIRECT_RECV) + static int ffa_sync_send_receive(struct ffa_device *dev, struct ffa_send_direct_data *data) { + if (!ffa_partition_supports_direct_recv(dev)) + return -EOPNOTSUPP; + return ffa_msg_send_direct_req(drv_info->vm_id, dev->vm_id, dev->mode_32bit, data); }