From mboxrd@z Thu Jan 1 00:00:00 1970 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 D7650C4345F for ; Tue, 16 Apr 2024 09:47:50 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Tj6Sib4C4WsfPv2yXKVks+Vzakq3CysOxkAxF3g5H9k=; b=PBeZQi7UwfTwku flR/XPQUHx74+xC1DXMqXMU4pnDcTAS5DVuzWDt5KTFHF8iaJY3dFdnRoyOr3zW8C07tTbeU1ec0C xOVX74hKQA7TwfaPfRWVTKvv4aLm2ARBAL1wcmMykqWeFpq8giR3IyF4/THJcKl2woheY6QN1ZUZA zpxGW+3WxINjwL3PZcIOvDQL9l+rcT+L+BKumnqvNvsDzdTlHNhrmbUl8O4y58LNeAZ4ncf5Exefl Rdyi7ieRC2jlT5/yqp8KZsMm+btN+rAI/hDjiH7oY/KHZt9QJ7LdxqaZ8HqMhs0bN4p6K3Y5emRaT AkgbiYdqFaA8O2LeBRqA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwfPf-0000000BeaW-0X65; Tue, 16 Apr 2024 09:47:39 +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 1rwfPc-0000000Bea2-3kIE for linux-arm-kernel@lists.infradead.org; Tue, 16 Apr 2024 09:47: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 F012C339; Tue, 16 Apr 2024 02:48:03 -0700 (PDT) Received: from bogus (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C26CA3F792; Tue, 16 Apr 2024 02:47:34 -0700 (PDT) Date: Tue, 16 Apr 2024 10:47:32 +0100 From: Sudeep Holla To: Bertrand Marquis Cc: "linux-arm-kernel@lists.infradead.org" , Marc Bonnici , Sudeep Holla , Olivier Deprez , Lorenzo Pieralisi , Jens Wiklander Subject: Re: [PATCH 4/4] firmware: arm_ffa: Add support for FFA_MSG_SEND2 Message-ID: References: <20240415-ffa_msg2_support-v1-0-a28c964b1b3f@arm.com> <20240415-ffa_msg2_support-v1-4-a28c964b1b3f@arm.com> <148629C4-5203-47C4-A001-214B1F8B1E53@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <148629C4-5203-47C4-A001-214B1F8B1E53@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240416_024737_015200_3FC36DB0 X-CRM114-Status: GOOD ( 21.74 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Apr 16, 2024 at 08:26:55AM +0100, Bertrand Marquis wrote: > Hi Sudeep, > > > On 15 Apr 2024, at 18:05, Sudeep Holla wrote: > > > > The FFA_MSG_SEND2 can be used to transmit a partition message from > > the Tx buffer of the sender(the driver in this case) endpoint to the Rx > > buffer of the receiver endpoint. > > > > An invocation of the FFA_MSG_SEND2 transfers the ownership to the > > receiver endpoint(or any intermediate consumer). Completion of an > > FFA_MSG_SEND2 invocation transfers the ownership back to the sender > > endpoint. > > > > The framework defines the FFA_MSG_SEND2 interface to transmit a partition > > message from the Tx buffer of the sender to the Rx buffer of a receiver > > and inform the scheduler that the receiver must be run. > > > > Signed-off-by: Sudeep Holla > > --- > > drivers/firmware/arm_ffa/driver.c | 40 +++++++++++++++++++++++++++++++++++++++ > > include/linux/arm_ffa.h | 9 +++++++++ > > 2 files changed, 49 insertions(+) > > > > diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c > > index d5087e4f6d35..6c2602f7e7cc 100644 > > --- a/drivers/firmware/arm_ffa/driver.c > > +++ b/drivers/firmware/arm_ffa/driver.c > > @@ -344,6 +344,34 @@ static int ffa_msg_send_direct_req(u16 src_id, u16 dst_id, bool mode_32bit, > > return -EINVAL; > > } > > > > +static int ffa_msg_send2(u16 src_id, u16 dst_id, void *buf, size_t sz) > > +{ > > + u32 src_dst_ids = PACK_TARGET_INFO(src_id, dst_id); > > + struct ffa_indirect_msg_hdr *msg; > > + ffa_value_t ret; > > + > > + mutex_lock(&drv_info->tx_lock); > > + > > + msg = drv_info->tx_buffer; > > + msg->flags = 0; > > + msg->res0 = 0; > > + msg->offset = sizeof(*msg); > > + msg->send_recv_id = src_dst_ids; > > + msg->size = sz; > > + memcpy(msg + msg->offset, buf, sz); > > Here there should be a check that the user is not trying to send more data > than what can fit in the TX Buffer. > Good point. > Other than that LGTM. > Thanks! -- Regards, Sudeep _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel