From nobody Fri Oct 17 12:02:59 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E80D4C4321E for ; Wed, 19 Oct 2022 09:20:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233005AbiJSJUP (ORCPT ); Wed, 19 Oct 2022 05:20:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233274AbiJSJRz (ORCPT ); Wed, 19 Oct 2022 05:17:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B38665654; Wed, 19 Oct 2022 02:07:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7CB2361851; Wed, 19 Oct 2022 09:06:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91F40C433D7; Wed, 19 Oct 2022 09:06:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170395; bh=znIfOAw2qnyy3/KsoXWVQh5iihyrexv06scq5zFQkEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jDU3wPmHGcyBPIuY3bhri4ccsj0TQDR3M8Wb6zddMdzCBc6Oiez9M6FihpKZ6dP+6 8wP2Z1MgsaaL8ETHdBsLbq+iXV9mUXAL+NCtzjDcmbskQt7U3x5Gu7JfEFZkPEgzHR dAXMuPWOBTEvvu2E8pfh+/FAihM1M7BAPIe1CXlo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Conor Dooley , Jassi Brar , Sasha Levin Subject: [PATCH 6.0 604/862] mailbox: mpfs: account for mbox offsets while sending Date: Wed, 19 Oct 2022 10:31:31 +0200 Message-Id: <20221019083316.634652306@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Conor Dooley [ Upstream commit 0d1aadfe10ba17ebdeb96abb9638eb0f623f9b55 ] The mailbox offset is not only used for receiving messages, but it is also used by messages sent to the system controller by Linux that have a payload, such as the "digital signature service". It is also overloaded by certain other services (reprogramming of the FPGA fabric, see Link:) to have a meaning other than the offset the system controller should read from. When the driver was written, no such services of the latter type were in use & those of the former used an offset of zero so this has gone un-noticed. Link: https://www.microsemi.com/document-portal/doc_download/1245815-polarf= ire-fpga-and-polarfire-soc-fpga-system-services-user-guide # Section 5.2 Fixes: 83d7b1560810 ("mbox: add polarfire soc system controller mailbox") Signed-off-by: Conor Dooley Signed-off-by: Jassi Brar Signed-off-by: Sasha Levin --- drivers/mailbox/mailbox-mpfs.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/mailbox/mailbox-mpfs.c b/drivers/mailbox/mailbox-mpfs.c index e432a8f0d148..cfacb3f320a6 100644 --- a/drivers/mailbox/mailbox-mpfs.c +++ b/drivers/mailbox/mailbox-mpfs.c @@ -100,21 +100,20 @@ static int mpfs_mbox_send_data(struct mbox_chan *chan= , void *data) =20 for (index =3D 0; index < (msg->cmd_data_size / 4); index++) writel_relaxed(word_buf[index], - mbox->mbox_base + index * 0x4); + mbox->mbox_base + msg->mbox_offset + index * 0x4); if (extra_bits) { u8 i; u8 byte_off =3D ALIGN_DOWN(msg->cmd_data_size, 4); u8 *byte_buf =3D msg->cmd_data + byte_off; =20 - val =3D readl_relaxed(mbox->mbox_base + index * 0x4); + val =3D readl_relaxed(mbox->mbox_base + msg->mbox_offset + index * 0x4); =20 for (i =3D 0u; i < extra_bits; i++) { val &=3D ~(0xffu << (i * 8u)); val |=3D (byte_buf[i] << (i * 8u)); } =20 - writel_relaxed(val, - mbox->mbox_base + index * 0x4); + writel_relaxed(val, mbox->mbox_base + msg->mbox_offset + index * 0x4); } } =20 --=20 2.35.1