Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2825956iog; Mon, 27 Jun 2022 03:51:22 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tDNYPlOjkxB+/ESgYKOzlAdGQKZf3P51Yl/hCoRNdyHJtauEFScuF+F//itJS52Ud9RuQZ X-Received: by 2002:a05:6402:b8e:b0:433:5d15:ea71 with SMTP id cf14-20020a0564020b8e00b004335d15ea71mr15403797edb.12.1656327082033; Mon, 27 Jun 2022 03:51:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656327082; cv=none; d=google.com; s=arc-20160816; b=AYokn6EVx3ab8jrwTE8md3E54kGzBa6KUSyiTiSaoxfg2As9wB3s2kXfHku/tiHcsu SakpdsoNXVcTAQ8o/in6tVn/XniSSynY3g7DAM+Ef++IU3MheTeJgC98BuyZlljSogL8 1qDgRLrGE4ranfZu12pggQendbNLtVHhws3+pkSmuKkJaF5iE+17Cfvd79bXiw1yBPEo 6g5NYnW9QQH1SXo9JxSXIeNh0eRptPIi+vS0/VqBNyeP/Rwg51OvKsQ8BoQpSY2amCtK 2a3vAWYDB7T0r30rqkJsJkVDRgvcwYaNZrdqLyt1V7bVeBe5VE3ixPGWrcYB5WbLijTQ 1ZTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=BmZKb1z18EDVwc67jEwsvqQ2o+cNJLYi4tj3i//9p34=; b=YAPaiFoSJSnidDPeKTs2bciX+3hlBqy1/qbVAGryHBVCSGAkvrWFE+ne0hDy9ENoPV 2vigarhh8tExToytXeLgqGNdOxcCO6kesvPdrLCa2rf6rFJPdkVySEUXjINiDv7iLBAc 2s5dkBTI/lJfk9MfuHBAr3hRdJ70aGGOA+Gdh0et6b4gbrhTfRnsrpg4XzcEAjjxFBWD YeuPiPGtIUIk8GlF2RwWdQwt8wruIvJLp1+irgZpSjKrQG6CmZr+ycabfW24M050nBcQ n/sXAd9+DUn35kxBapUSZD4h4xLb1ekcy0yQLnen+c1wc3ySZ9UxD+6lpvsrNPXDgplE /KFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GHPKRSKr; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bu22-20020a170906a15600b00722d5b8794dsi10614777ejb.308.2022.06.27.03.50.57; Mon, 27 Jun 2022 03:51:22 -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; dkim=pass header.i=@linaro.org header.s=google header.b=GHPKRSKr; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234286AbiF0Krf (ORCPT + 99 others); Mon, 27 Jun 2022 06:47:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233342AbiF0Krf (ORCPT ); Mon, 27 Jun 2022 06:47:35 -0400 Received: from mail-oi1-x230.google.com (mail-oi1-x230.google.com [IPv6:2607:f8b0:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47B97642B for ; Mon, 27 Jun 2022 03:47:34 -0700 (PDT) Received: by mail-oi1-x230.google.com with SMTP id u9so12210796oiv.12 for ; Mon, 27 Jun 2022 03:47:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BmZKb1z18EDVwc67jEwsvqQ2o+cNJLYi4tj3i//9p34=; b=GHPKRSKrUAHBUwVDZE3XUgMpB/fT11Y1/6i9ub8wLkh7bteMlcs2VuSKn7E3ub+zad /N+i0Ro5cItgL8qQuegPDkAuzDbeoYeP09clLXn9rT5WZQnSGhgujfMGcYoaniIBKTua alv415OSebEWYA/d+ZtMCoQTiS8f4c6iYHQgySNFkjE5IrZ73AolYW/g7OCzas2WwDW8 k9MtlRZn2MLllCNX71SeBB38vPzlY12FuhCFrfyDK4TVnYZoV/NEEzd0XrOxIlObkMah 4/pyJ/t1NryP0XH2nhcuFsL+5lxk/hB5rfZvjju1vpHd1axAx9Td0mMJRQTpQirY09PP 7gdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BmZKb1z18EDVwc67jEwsvqQ2o+cNJLYi4tj3i//9p34=; b=zsj795bGmh1dozhoWCtk97KAz2VMNLr89Sk8pwUodcFVbYaLOLD9dwifhCZ8eEYWcH 3l7ldXTYSxSUFync8OpVuaOXPHg2qaz3v0jYLLY3uDfe/drYmvKCUcueibLY59syHM33 mg/P5yc7KrxSFazLXZN1KOX5CeAF2lUnoaLlt4yZeubaJjMq5zX/g08AiKPq8vbLI0l4 kjQAgC9U1GsECZnwpJOyrsEtWhqgDFFRJhMF3uIcEmaWYjboMZV5vvwffe4POTBnvgRR 40Zy32Ym2NKHhZ8yLZfwafxKajkvGUbWjnf8ACTDT3VEBXgnl9mm8t8V343hXxZ0WrT1 8M8g== X-Gm-Message-State: AJIora+j4eA12JgiWvZUkWSRFgnwJPKKDUyZR2bfwH4hOJfIKedP9u9U B8bMfBaycYxO1Q4k5+haNU0HUhZjC+E1xvjUuYxOnQ== X-Received: by 2002:a05:6808:ed0:b0:331:4811:737f with SMTP id q16-20020a0568080ed000b003314811737fmr7451560oiv.104.1656326853588; Mon, 27 Jun 2022 03:47:33 -0700 (PDT) MIME-Version: 1.0 References: <20220624074549.3298-1-vincent.guittot@linaro.org> In-Reply-To: From: Etienne Carriere Date: Mon, 27 Jun 2022 12:47:22 +0200 Message-ID: Subject: Re: [PATCH] scmi/optee: fix response size warning To: Cristian Marussi Cc: Vincent Guittot , sudeep.holla@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,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 Hello Vincent, On Fri, 24 Jun 2022 at 11:23, Cristian Marussi wrote: > > 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); > > } Thanks for the fix. Reviewed-by: Etienne Carriere > > Looks good to me. > > Reviewed-by: Cristian Marussi > > Thanks, > Cristian >