From patchwork Wed Jun 21 01:00:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishanth Menon X-Patchwork-Id: 110724 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp4063066vqr; Tue, 20 Jun 2023 18:58:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4rmkaZ7Y5rIboNqpIbJ/S4MXh4Au/h7H8HESZ0aK77NmKHhtZQgaL/NJEg2Ex9S+M66272 X-Received: by 2002:a05:6a00:b55:b0:668:6eed:7c12 with SMTP id p21-20020a056a000b5500b006686eed7c12mr8084304pfo.22.1687312691436; Tue, 20 Jun 2023 18:58:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687312691; cv=none; d=google.com; s=arc-20160816; b=iHDW9BV1S60AR61xZTsYKXsdhp9YUIdaKJCklY+itzIIPhx5FFo4dfnj59KncckoR6 3KsP83NQwsobJ4hhs7zZnv32Q+/u9j1xK2142CXn5sQ2uLpEAo1NHRxpPDwIDouUokQe APLv/zNVUPCYcLzfcRgv+EZ3KF5FKo/4ZWCDZyBe1M8eDlttoPAhD8Su1RiAkAQbAHYs BEkSUNK7dv0WYgoEXvsrXHtLEKn91A+wpcO36qxOo7kcb1df+DEQwzUBWuwNsnktNEB3 JoWkdk7gPy5ACVowRqpSfk6qp0wp8RzY/XDKEtceX4R7CH53H5zpgf2dT3mzpugd8q9z iChw== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r26-20020aa79eda000000b00655079704afsi2974520pfq.119.2023.06.20.18.57.56; Tue, 20 Jun 2023 18:58:11 -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 S229727AbjFUBAe (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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769275592551792720?= X-GMAIL-MSGID: =?utf-8?q?1769275592551792720?= 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))