Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp216860iog; Fri, 24 Jun 2022 02:39:13 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ufyPBMixir+sYc7mgJHcrVkl5PtdW206uX5Om6lq3MxwIUoe+sRU08U0dcfCATMbkJdBVH X-Received: by 2002:a05:6402:b34:b0:435:d064:8762 with SMTP id bo20-20020a0564020b3400b00435d0648762mr9623858edb.238.1656063553642; Fri, 24 Jun 2022 02:39:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656063553; cv=none; d=google.com; s=arc-20160816; b=s+LqQ0gAealsPv51N5RxbR8XZlBxwyTR95++uIyS9HfEc+ggkEuHzX8ph0hzm0bYMH PzeKJk89/rYAb2GYNZaoADd4gBAIcv1dbHTU3+ojzDP/ev167bMQq9R/782KMAYOSlLN 0uPY3PecoOLsoV9KSfq8h0NSuLDtlFKG/t698Qgssr11r5qbv72V/01i6jpRnY5kFxDc zOAbenN4AksX0H1Ex+U2bVKehZgBrc2ZoDFgvZaFTEj0Ym0L5S2tQlUz74W9eLX3a8Hm X5/1lJcOnWtvMcHIUJECnBzeA3shmAFjTU/4U6yTTrWrLSN0hMpebOzWn3vh6/0hs0Bd v7Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=50K7mDM90QedxYUaM94/XcxeX7sVkOW0HE4A78Jzlqo=; b=R6+Wh6H+dUjv4p2rwRO8nRa9NPkvdCHjFoWHX2P7fEoT2mWl1pXciE98TubFTcX9nI Ovq0G+0o3LhNiwJYk/33bpYIOsByJQEsD9+PrkwozFfWqOXmxn+aJ9DA2MIOeqm3nRWT /CtbaYyrs9pLIJ+thV/M4RfAPgQJHiWHCXB+I30+nXD0/vqf1i/Ro7nMoVpn/iFvXpVF StyLWqtMyK8xIiVFHMFUtiNsvRFdZhEzBjdLJk4j7FC+rEb3g7KbRjV+YmuJH5XKHLIs eln4IWA4ECStT3646DHXetep9vUzTI5ZkrNs9EHE3/LWU2YLiCrJTIMkBGfXphmtzV8P X7xA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id my12-20020a1709065a4c00b0070897236380si1110324ejc.19.2022.06.24.02.38.49; Fri, 24 Jun 2022 02:39:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231630AbiFXJXP (ORCPT + 99 others); Fri, 24 Jun 2022 05:23:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231620AbiFXJXM (ORCPT ); Fri, 24 Jun 2022 05:23:12 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E10BF4F9EB for ; Fri, 24 Jun 2022 02:23:09 -0700 (PDT) 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220624074549.3298-1-vincent.guittot@linaro.org> X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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