From patchwork Sat Oct 22 07:26:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7705 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109423wrr; Sat, 22 Oct 2022 01:48:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5E/VlRR9w2fMB8UQZS+hDsJCPZEwcqfZWPUOR7CyM95PxcLqIiiW9lS6ZoIKdT+ZplLd72 X-Received: by 2002:a17:906:9b94:b0:78d:b8a5:7493 with SMTP id dd20-20020a1709069b9400b0078db8a57493mr18578825ejc.530.1666428507140; Sat, 22 Oct 2022 01:48:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428507; cv=none; d=google.com; s=arc-20160816; b=032GHkItZUo9aba/wSIFN8BaCjee8gTSMIQjRAkMwIZh5rIHPfjwhJyAwUSqFW3yHX uvBdohRlxhplNWbr1oVkN5JogDBE8kHK2SYdneb+QKnCI0eEmSlS2PBUfbz1cZSTiPZv mW19795yBVBV3HL07nqXjFn5PKyNhTlhAnd+3beX31CXiuoRNaLUT10O/cinqEH2YRZi 9dwn8t8cPug9kKhfP/gom1IqoKen3jqe6ohEWBFR0OpWUbNKAxxQNMOHtyxO8Dm9Od73 zoBfu8wVG3n9rt5KS6k4WVyS3jWlNBmU8Kgif5kxbfBFkvY8GzpLM4F+vI18QlIhoXFQ RyvQ== 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=xm5IxsHRlpQY98P+O1A5+6M6jQKthLYWXcMKMaje+z25h/xHC1PsujJ87hksP37/6Z VauWrxvKWhgNSsGuqKaniEWRGc8vo0qRHmxx32I/PNMV0SaTd5G4nfwcMPwzlUW1FVCu DaaufpWY1xmnYhy5o6xzTeFzQ9uGXbvtwhs1CTkq13Z2Vmw/r9UO6HfWB+mdUMUHeSyu JDsmWNgdhq4P6lKB05FWLGmJerVu0mkV/V3E1NoCO5vQZhP6Mp6dHTxoUyV8Q4eHB9iD bsnbMgUmzh1FTPl0YJGcXXd88BZK9ejZzJamgv9B/KY5Ds5ZmobIW6glsqgjinbaODSD YbSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LLYMSF+H; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d4-20020a05640208c400b004615d1d6b1dsi2455358edz.502.2022.10.22.01.48.03; Sat, 22 Oct 2022 01:48:27 -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=LLYMSF+H; 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 S234661AbiJVIrf (ORCPT + 99 others); Sat, 22 Oct 2022 04:47:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235214AbiJVIoz (ORCPT ); Sat, 22 Oct 2022 04:44:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC3C62D5E84; Sat, 22 Oct 2022 01:08:53 -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 ams.source.kernel.org (Postfix) with ESMTPS id CC77FB82E02; Sat, 22 Oct 2022 07:57:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39F7EC433D6; Sat, 22 Oct 2022 07:57:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425456; bh=znIfOAw2qnyy3/KsoXWVQh5iihyrexv06scq5zFQkEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LLYMSF+HXIHk0a0ILsJ8MWaq8L3Op5SmNS7uUCpCLrBimji7Xq4sE/kSzFRuwLXKe ooX8tYLTRQDoK7Z/2LqWFN51CQeP75fwbCxgT6AfumoMYsCe8Qkdi7S6Nsl51I5puL 9NxgclEk1JzEU7NmLx55j0ch3grwwPridXFNF0Hw= 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 5.19 490/717] mailbox: mpfs: account for mbox offsets while sending Date: Sat, 22 Oct 2022 09:26:09 +0200 Message-Id: <20221022072519.996543965@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747376938050886291?= X-GMAIL-MSGID: =?utf-8?q?1747376938050886291?= 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); } }