From patchwork Mon Jan 10 01:50:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 12708116 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EAE8AC433EF for ; Mon, 10 Jan 2022 01:57:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BatrnPJKb7jaji+IMukgXagVZcgOLOo3YxLNcAGGw4U=; b=EaZbxEIeNmah9u VpOnpBd2IFnNrgf0WkC58JqBpKxKPpIKmUfqpopT5StwQsbGplqTNqNTzQVCWNDh88LpSNXzFnUrg Q9DvChsbl3gQg47/e/yecFcYamxg1J3IG9UvPDOv18PbDEuBRz4WyjqayjnMncRER/rPRhiRHKxcf 6G1OG0ez/tVrA9KxJxeQU2Zre0974PlwhjdfkyqQEKVz1GWXHdjj4iijz1Fn14vPJ/kmK3ybSEn07 DyIyFAA6wittIjwZhpNrnuxPnX5bYRgX/UWpsMpw4HL9PIZGlka3i+QgQIXRcpdnFkhgKJ/FQzb8l FjZlzlog/34+ktZg9FKw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n6jui-008ong-Jy; Mon, 10 Jan 2022 01:56:01 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n6jpn-008lkl-2f for linux-arm-kernel@lists.infradead.org; Mon, 10 Jan 2022 01:50:57 +0000 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 D3233B81118; Mon, 10 Jan 2022 01:50:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D99BC36AEB; Mon, 10 Jan 2022 01:50:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641779452; bh=4A5p3djI1Kwo5RxvvLcygM7XaNAMZHq/gtkzkQlgd8M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SDDgnwA+fxs2NvelElNZQE0MFCGIzkAFdlmtrg4qQ9i+BLTLUceXVoSxG9dQdu60u gKwD5l3CLSPyS4jmuwKp9MGpRSkqYRQznM6eZMBTKMbsKwzdipEfCsjHOfRgfW1sYC A1+OdfUXPZnpHwBaxEQsaj/IlqZRltarhGgkZB5bYeMAbLX+n50oirpGglkxLNdZsD 9vb5EdJHwK/PzpDFGswdt9ccImzkFEcbnxAu9MSE9Xp2F3kjtVzkTeWwNqM/VEwipo W70TGrpLzb1fgupBsaQ/d7NdwtTpagoaLNuZix0LQIZce6I2ajKQ0Q0BVxRUV6l5L/ M+IhC5mgxdKbQ== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Marc Zyngier , Lorenzo Pieralisi , Bjorn Helgaas Cc: pali@kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH v2 14/23] PCI: aardvark: Fix reading PCI_EXP_RTSTA_PME bit on emulated bridge Date: Mon, 10 Jan 2022 02:50:09 +0100 Message-Id: <20220110015018.26359-15-kabel@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220110015018.26359-1-kabel@kernel.org> References: <20220110015018.26359-1-kabel@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220109_175055_305110_87BB84F5 X-CRM114-Status: GOOD ( 14.86 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Pali Rohár The emulated bridge returns incorrect value for PCI_EXP_RTSTA register during readout in advk_pci_bridge_emul_pcie_conf_read() function: the correct bit is BIT(16), but we are setting BIT(23), because the code does *value = (isr0 & PCIE_MSG_PM_PME_MASK) << 16 where PCIE_MSG_PM_PME_MASK is BIT(7). The code should probably have been something like *value = (!!(isr0 & PCIE_MSG_PM_PME_MASK)) << 16, but we are better of using an if() and using the proper macro for this bit. Fixes: 8a3ebd8de328 ("PCI: aardvark: Implement emulated root PCI bridge config space") Signed-off-by: Pali Rohár Signed-off-by: Marek Behún --- drivers/pci/controller/pci-aardvark.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c index 6fc6c3199954..8706a5f58eb5 100644 --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c @@ -876,7 +876,9 @@ advk_pci_bridge_emul_pcie_conf_read(struct pci_bridge_emul *bridge, case PCI_EXP_RTSTA: { u32 isr0 = advk_readl(pcie, PCIE_ISR0_REG); u32 msglog = advk_readl(pcie, PCIE_MSG_LOG_REG); - *value = (isr0 & PCIE_MSG_PM_PME_MASK) << 16 | (msglog >> 16); + *value = msglog >> 16; + if (isr0 & PCIE_MSG_PM_PME_MASK) + *value |= PCI_EXP_RTSTA_PME; return PCI_BRIDGE_EMUL_HANDLED; }