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 D647BCCA47F for ; Fri, 24 Jun 2022 09:24:25 +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=w2zWx3GKRWTWDTAvX+zhq8LHWpHaexOuBPaAahcZJGQ=; b=0hMW67e1+yVrv4 O1KDSvFyiE3o1gQfDUA8G2qF09bEwkWPjEEK8APbcDIP2SHdreeMNjM3T3fciHX6TgD1FDorRHiES Z0+2ZyvwAPkpx8hr3IAXVeaLw7d9hNDO83CPE9dqJjKlqlQstzIU/8rjyO2gWpIzdgkg0mWf8inJs 1T+03a32duP5Sl3PfoEC/xybDcb+Jcy5IvHBcDJfMd5OX5/pCyWAWu3naCOLiwPjs8s5eynUW5Hpx VRjpPzkxV00wiYv/fXmih8D/u4vryUV5wQdLKZl6TSrAPFACUV7k6zLLsbaVDRnvFbu2pEwyBz1/y 9Toj5+NttFbt3vgaVdxQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o4fX5-001Nsz-Ld; Fri, 24 Jun 2022 09:23:19 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o4fX1-001Nqp-T4 for linux-arm-kernel@lists.infradead.org; Fri, 24 Jun 2022 09:23:17 +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 5F7F3143D; Fri, 24 Jun 2022 02:23:09 -0700 (PDT) Received: from e120937-lin (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 652A13F792; Fri, 24 Jun 2022 02:23:08 -0700 (PDT) Date: Fri, 24 Jun 2022 10:22:58 +0100 From: Cristian Marussi To: Vincent Guittot Cc: sudeep.holla@arm.com, linux-arm-kernel@lists.infradead.org, etienne.carriere@linaro.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] scmi/optee: fix response size warning Message-ID: References: <20220624074549.3298-1-vincent.guittot@linaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220624074549.3298-1-vincent.guittot@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220624_022316_022282_8737BF1D X-CRM114-Status: GOOD ( 21.38 ) 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 Fri, Jun 24, 2022 at 09:45:49AM +0200, Vincent Guittot wrote: > Some protocols check the response size with the expected value but optee > shared memory doesn't return such size whereas it is available in the > optee output buffer. > > As an example, the base protocol compares the response size with the > expected result when requesting the list of protocol which triggers a > warning with optee shared memory: > > [ 1.260306] arm-scmi firmware:scmi0: Malformed reply - real_sz:116 calc_sz:4 (loop_num_ret:4) > > Save the output buffer length and use it when fetching the answer. > > Signed-off-by: Vincent Guittot Hi Vincent, > --- > > Tested on sudeep's for-next/scmi branch > > drivers/firmware/arm_scmi/optee.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/firmware/arm_scmi/optee.c b/drivers/firmware/arm_scmi/optee.c > index b503c22cfd32..8abace56b958 100644 > --- a/drivers/firmware/arm_scmi/optee.c > +++ b/drivers/firmware/arm_scmi/optee.c > @@ -117,6 +117,7 @@ struct scmi_optee_channel { > u32 channel_id; > u32 tee_session; > u32 caps; > + u32 rx_len; > struct mutex mu; > struct scmi_chan_info *cinfo; > union { > @@ -302,6 +303,9 @@ static int invoke_process_msg_channel(struct scmi_optee_channel *channel, size_t > return -EIO; > } > > + /* Save response size */ > + channel->rx_len = param[2].u.memref.size; > + > return 0; > } > > @@ -353,6 +357,7 @@ static int setup_dynamic_shmem(struct device *dev, struct scmi_optee_channel *ch > shbuf = tee_shm_get_va(channel->tee_shm, 0); > memset(shbuf, 0, msg_size); > channel->req.msg = shbuf; > + channel->rx_len = msg_size; > > return 0; > } > @@ -508,7 +513,7 @@ static void scmi_optee_fetch_response(struct scmi_chan_info *cinfo, > struct scmi_optee_channel *channel = cinfo->transport_info; > > if (channel->tee_shm) > - msg_fetch_response(channel->req.msg, SCMI_OPTEE_MAX_MSG_SIZE, xfer); > + msg_fetch_response(channel->req.msg, channel->rx_len, xfer); > else > shmem_fetch_response(channel->req.shmem, xfer); > } Looks good to me. Reviewed-by: Cristian Marussi Thanks, Cristian _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel