Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp8619428rwd; Tue, 20 Jun 2023 18:27:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6DP0cLY2wGHhm46xi3CSVL/i8qDbdTVe1P4XMsDXiQMi0M6Gzbj/XYVytwsib16DrADP59 X-Received: by 2002:a05:6a20:4f30:b0:115:197c:e7d4 with SMTP id gi48-20020a056a204f3000b00115197ce7d4mr8786937pzb.35.1687310850985; Tue, 20 Jun 2023 18:27:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687310850; cv=none; d=google.com; s=arc-20160816; b=bvZPmVdQEhFb4I3EncdgO/VqQZUQDZBj+L22VLepWS+deY8KzAJqdS0irI692Wpslz RDfTfG9tEI/+qXdCqPytix0iyYE4uUtd/xqgJedxTa+AVdf6SdyiQZvP5Uo+6hs0ZK8b aRmOE2JkaKjwxp2kJIz+vVGSN81GAv1xC9/HYIqM5LBZyvzAcuMzkNQwvcsPfGudYLzy LYF6NsAcrhYP/2swRXlTgeRV7TRPE0DQM5okZ4dflephQBFwZoDpUXhhOK3Qnr8fuwzh I6QX2nylYlfHC3CtKtylaC7EXlCeTLeE/0HRYIW02/o7QrUHh0LVWsG9hoBIqVGCn8zQ FuTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=8CDTcOmq/dQciFNG3eoxG8Ph7s1HxOKsVHuVKlcktQE=; b=aVY8Hqtbl4Wzzh5XnpOxLiVQ46xnmMKSuKDDlZdUWTcixckucGXIh+GynMvYBAybLz YA+hO6ucNNdnBAjkt3Oogg+jSYe54WFOuUkm8kcrwLMtJ8/6+LW0WZOq+htNR0SLAlIS VAAgSaybjirO0Fp7Se5cqa61tfLQnaR262FZXa/DI5AkZVhYoVzLEOSQZ39UBdJ/q584 C7yqs22HZKoQNcieDJ59iBLp+XIoBEozsR3m7+plA4Q/tNYtFqTPlJKYd6Hp3SS0/1Kr tYwIeuprKSAohmwL/qvPmVsCxpZ9dJxsPSkVQbo0TTu/p7a5Jehz0tGulUd0Q8DGhBLG dYzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=I8moJvgk; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lb13-20020a170902fa4d00b001b533facaa6si2845158plb.313.2023.06.20.18.27.16; Tue, 20 Jun 2023 18:27:30 -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=@ti.com header.s=ti-com-17Q1 header.b=I8moJvgk; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229696AbjFUBAe (ORCPT + 99 others); Tue, 20 Jun 2023 21:00:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229628AbjFUBAc (ORCPT ); Tue, 20 Jun 2023 21:00:32 -0400 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B37510D2 for ; Tue, 20 Jun 2023 18:00:30 -0700 (PDT) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 35L10O58038938; Tue, 20 Jun 2023 20:00:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1687309224; bh=8CDTcOmq/dQciFNG3eoxG8Ph7s1HxOKsVHuVKlcktQE=; h=From:To:CC:Subject:Date; b=I8moJvgk3m+uadKvEauDvdj0apwrvRk8YcjgUrotwwvJsm2H+aR5mOjA7gPN2HTWz MaTqpMX+cewpGsdasuT0LmfUMEPbJdo0eTIhiQcRfyxus8poN0PtwHWTZd3bJ9rxqa UD2T7slb5R5aaitQ6Vj1bo3HsKx2bznj2Woq7/Rc= Received: from DFLE100.ent.ti.com (dfle100.ent.ti.com [10.64.6.21]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 35L10OlU109241 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 20 Jun 2023 20:00:24 -0500 Received: from DFLE115.ent.ti.com (10.64.6.36) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Tue, 20 Jun 2023 20:00:23 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Tue, 20 Jun 2023 20:00:23 -0500 Received: from localhost (ileaxei01-snat.itg.ti.com [10.180.69.5]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 35L10Npr013278; Tue, 20 Jun 2023 20:00:23 -0500 From: Nishanth Menon To: Jassi Brar CC: , , Jassi Brar , , , Suman Anna , , , Nishanth Menon Subject: [PATCH] mailbox: ti-msgmgr: Fill non-message tx data fields with 0x0 Date: Tue, 20 Jun 2023 20:00:22 -0500 Message-ID: <20230621010022.240211-1-nm@ti.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Sec proxy/message manager data buffer is 60 bytes with the last of the registers indicating transmission completion. This however poses a bit of a challenge. The backing memory for sec_proxy / message manager is regular memory, and all sec proxy does is to trigger a burst of all 60 bytes of data over to the target thread backing ring accelerator. It doesn't do a memory scrub when it moves data out in the burst. When we transmit multiple messages, remnants of previous message is also transmitted which results in some random data being set in TISCI fields of messages that have been expanded forward. The entire concept of backward compatibility hinges on the fact that the unused message fields remain 0x0 allowing for 0x0 value to be specially considered when backward compatibility of message extension is done. So, instead of just writing the completion register, we continue to fill the message buffer up with 0x0 (note: for partial message involving completion, we already do this). This allows us to scale and introduce ABI changes back also work with other boot stages that may have left data in the internal memory. While at this, be consistent and explicit with the data_reg pointer increment. Fixes: aace66b170ce ("mailbox: Introduce TI message manager driver") Signed-off-by: Nishanth Menon --- Test logs: K2 platforms: https://gist.github.com/nmenon/ee4198b0a5889e8beb068798d8a440e0 K3 platforms: https://gist.github.com/nmenon/f0a9e7bd814aa475c3d71d3ead944f02 Tests based on next-20230615 drivers/mailbox/ti-msgmgr.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/mailbox/ti-msgmgr.c b/drivers/mailbox/ti-msgmgr.c index ddac423ac1a9..03048cbda525 100644 --- a/drivers/mailbox/ti-msgmgr.c +++ b/drivers/mailbox/ti-msgmgr.c @@ -430,14 +430,20 @@ static int ti_msgmgr_send_data(struct mbox_chan *chan, void *data) /* Ensure all unused data is 0 */ data_trail &= 0xFFFFFFFF >> (8 * (sizeof(u32) - trail_bytes)); writel(data_trail, data_reg); - data_reg++; + data_reg += sizeof(u32); } + /* * 'data_reg' indicates next register to write. If we did not already * write on tx complete reg(last reg), we must do so for transmit + * In addition, we also need to make sure all intermediate data + * registers(if any required), are reset to 0 for TISCI backward + * compatibility to be maintained. */ - if (data_reg <= qinst->queue_buff_end) - writel(0, qinst->queue_buff_end); + while (data_reg <= qinst->queue_buff_end) { + writel(0, data_reg); + data_reg += sizeof(u32); + } /* If we are in polled mode, wait for a response before proceeding */ if (ti_msgmgr_chan_has_polled_queue_rx(message->chan_rx)) -- 2.40.0