From patchwork Fri Jun 24 07:45:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 12894042 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 17D93C433EF for ; Fri, 24 Jun 2022 07:47:09 +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:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date:Subject:Cc:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=KUGT9WhblbDqlUatQgp3dM7gV2EOEkIqO9cA72/jL1M=; b=zDAvYNyPsWfbYR ElwKiKje3NtZMrQ7PeqeMYajjrwY8hqTzJWRuw+HtCpwKOhvO+a8bi98SDrQ7esxHfw5g72bJKXuL ZUDZTV8C75fX4OyeBAtWsVkVVSWR9Xk4qW0c6aME3TK8Ip2E951ox3G/UA0/V1AOgh3jbyLLSpFjw YNClmDMF56su79Nj59EmZR1/mnUBFihAVV/15O6DGVtxtXO7O+bLjjvWOlfORSEPuBZTttZiDBlxK X3VLcPk98a8HCFtHImvTkU9HZnCI9OozeIrP97vnJpJZyd1Y3NI2wWAEWXmXQpxv20xBLI59+fJwB NL/zqkaxOvwJS6EbhRgw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o4e0t-001253-TC; Fri, 24 Jun 2022 07:46:00 +0000 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o4e0q-00122M-CK for linux-arm-kernel@lists.infradead.org; Fri, 24 Jun 2022 07:45:57 +0000 Received: by mail-wr1-x435.google.com with SMTP id e10so1941015wra.11 for ; Fri, 24 Jun 2022 00:45:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=0ZlmPLrZBq2C2GM7uxjJCPFVuBCp2JLIVhQIgplZtYk=; b=Kp2Nv1BQ1WXuHYS+r+amWX7zs4ExnkoARLCQ3YEZzS+pd3iLAehijDsI13VEWsRW39 D+gWnHOT4eCVZ8kLJmNaB8a9XnR1PlXyrBk5KZe3RNkQOLC9GQbzsoE/Cfc7VxYBsjPH Ps8Bz1tau1dvnPaxZ1DXFfIIhgKzyJpC3gAqdyZuMB1OhhlLwv5kMdzCfcxlE1IsSD4Y lQJk/dygWkaMKBLbsK9dBAp9mVkQzuDL8Ew5QdAUE+hw19FMORJhUbg6Qkkh7/bNrHOk Zu3E1BJ5GQVbzW3Xq9GHoeuDkRsHn57ZobjtxEZxpCzAswM4EN/bg1vk60rozNnynm+X vV2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=0ZlmPLrZBq2C2GM7uxjJCPFVuBCp2JLIVhQIgplZtYk=; b=jL3QTT3ZIQwHClnldM4PobZdYZJBDFnxrYpaZssEk8p+eTQxPr71GIIzHGA+GwqIyt i7/rmS+h4RjfQTwVa2bpdzwD6NqVAydHsNhLyCzfo0crlCMBKVpdOEWo4AIEw0vdih5G w5cA4N7phiM/O+68K2WGT9gidJId8Lms+lgizKwoo02ZPrn7Aceb9mz9WT1tZGljKk3k YWK2Nd7YwUNpOQyd5YL8B6yi/NtzfJTRKup6H7JzAjt/17YwxgiM/MKOKOuxEKiQSKA7 MY/2QsJEVzh2RD5Ca6cr0UFfA9lwd+m8+a+yYDf/fCKihh1sHS0+IlRmaqVLMZ8GgMis Ct6A== X-Gm-Message-State: AJIora/jpg30aXfiaE12DKnZQKnsM5kJC9q0qh++wENdo8k6Fr90V9Vm qLPIYwHb3QfOCNCfISrxE+4t6A== X-Google-Smtp-Source: AGRyM1u229Xg0jnxyiwwGmz48kdjamFG0VBRWUfXHBmPxvLHYMUtXWbKweF8OrKj6IP0zuy0VJl2tg== X-Received: by 2002:a05:6000:168c:b0:218:4523:c975 with SMTP id y12-20020a056000168c00b002184523c975mr11934867wrd.23.1656056753037; Fri, 24 Jun 2022 00:45:53 -0700 (PDT) Received: from localhost.localdomain ([2a01:e0a:f:6020:a0f3:21fd:ac8:ae79]) by smtp.gmail.com with ESMTPSA id y15-20020a5d4acf000000b0021b9c520953sm1508526wrs.64.2022.06.24.00.45.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jun 2022 00:45:52 -0700 (PDT) From: Vincent Guittot To: sudeep.holla@arm.com, cristian.marussi@arm.com, linux-arm-kernel@lists.infradead.org, etienne.carriere@linaro.org, linux-kernel@vger.kernel.org Cc: Vincent Guittot Subject: [PATCH] scmi/optee: fix response size warning Date: Fri, 24 Jun 2022 09:45:49 +0200 Message-Id: <20220624074549.3298-1-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220624_004556_471077_D896AB0D X-CRM114-Status: GOOD ( 14.62 ) 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: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Reviewed-by: Cristian Marussi Reviewed-by: Etienne Carriere --- 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); }