Received: by 2002:a05:622a:251a:b0:39a:b4a2:e86 with SMTP id cm26csp313716qtb; Wed, 19 Oct 2022 02:37:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Z7Vry9bsF5OabAEk5IS+gMv8ylorgdi9a11/ICgnulLWn90voe/TdCqzHlix39Je1wvjL X-Received: by 2002:a05:6a00:248e:b0:563:7910:29b9 with SMTP id c14-20020a056a00248e00b00563791029b9mr7724870pfv.43.1666172264570; Wed, 19 Oct 2022 02:37:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666172264; cv=none; d=google.com; s=arc-20160816; b=L1EMvrsNW2bJR3W3TQgFAVv/7aj8MovpW5LzmKM+XrV6qqZZNGXdmEFtQeIdhCBE8w A1UI9w6qvzhChl6CMsXLm0Bb5EvHyRnjvFWv+xl8CfuW6/GwiW542wN6LmsGsM4sPSAY yQV7uSIwRusaw5ObU11icJqve8owdVwYdmn1rfJqsw0d9yWrIKVKmaFbqiWHpE0XTAy9 aRqVtXYit2aAuLlF35fOhZQOxNPV1cqg+UM4SC1wXLj441i33dI7gkCLL6SZxcGR79JV uKG3wbRPE3lVa+3DU/z4B5nLimdn1JuPE27ILU5EGqZeBbrxSoZEu5/0q8FSc+I09vFX BNkg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xJzHFxIB5ABkFlipgr6KWm7rM26EFsRk2b6RS9pkBzY=; b=W+liaz3QP9s+9rsJ0zHfM0EDOGK3OC7urNk/GYNs7qZRTtOLgSG4BzVw/PhtCCPqok AUMIUymuYvjwmvYRUQThZaTf0jt6bHStd6NRb62eAn5/1ZwSR548K0Rzti9QSB6nqRVf CBDYFJXRtXl9LT1bVvxvmf+8uypSz4dC6888YyFaMvf4ML59r4mRsZaYAM1cJfvIcVG5 tCNUBh5sByvmbckJKNJPH8tGfaiMDyZjJ48rOZPcjcaWNEfPJx4/dOUCJtjl5g2XQLSR OjOLl7haaK11hs2hQO2wNKNVTtlgm9weYZaVDNmfOnFs9F6HBfyqf6Y9Y6KUojbtNvC8 ZwQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jDU3wPmH; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g18-20020a63e612000000b0045b0a113f6asi18579819pgh.846.2022.10.19.02.37.32; Wed, 19 Oct 2022 02:37:44 -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=@linuxfoundation.org header.s=korg header.b=jDU3wPmH; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232833AbiJSJUO (ORCPT + 99 others); Wed, 19 Oct 2022 05:20:14 -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-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 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-polarfire-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) for (index = 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 = ALIGN_DOWN(msg->cmd_data_size, 4); u8 *byte_buf = msg->cmd_data + byte_off; - val = readl_relaxed(mbox->mbox_base + index * 0x4); + val = readl_relaxed(mbox->mbox_base + msg->mbox_offset + index * 0x4); for (i = 0u; i < extra_bits; i++) { val &= ~(0xffu << (i * 8u)); val |= (byte_buf[i] << (i * 8u)); } - writel_relaxed(val, - mbox->mbox_base + index * 0x4); + writel_relaxed(val, mbox->mbox_base + msg->mbox_offset + index * 0x4); } } -- 2.35.1