Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp760165pxb; Tue, 5 Apr 2022 22:07:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwm691iG0J0w+e1D5WPFNVjIpPkCSJJCIq5+E/m0LQAOrSuU72bd5IKLzq3m6LFoQxojZnE X-Received: by 2002:a63:2263:0:b0:399:561e:810b with SMTP id t35-20020a632263000000b00399561e810bmr5578293pgm.615.1649221657240; Tue, 05 Apr 2022 22:07:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649221657; cv=none; d=google.com; s=arc-20160816; b=ypdW2uiGnvKUsWUDThwhOiz8xZkweXfA1cfruk+gmbnOtjX/z2b8CQx0Rt3Wu2milZ ato8ZixYaAQoFWarKkQ7oAjdf5/jRzAAmX4huWd9rDvc1DfW1gWiKtxYjEYHJ5rJRwgF iW7eFvwkWiUB9nYRNxPQ4HtNCdHc2O7ihkKrvdS+lRkg4HqveTogfV5T4q3Tdk1oz3Ku c4YoQrsDJWPSMelTxwO75WLxRrVO1bIHhUmPyo8X4uqUj+2EvCJkDGFeIiTPezWkHuOa KxQDv1Vd7ORq/85QhewiuOSH8vqwezykmyn8ekHdOIJqbMLYh6EGvpWZfKcAlrbJBjwq VvRQ== 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=MbuZvhL1nTKFJWZv9+4TAusstCdl25756bV4s7/8gCE=; b=hBQ0HrwIurwKNtcoG6qyuh3F6ZuZSN4U4MLhi1Ew+xSi9+AC1eO5jWB7RzFchdYh7M Jj4dWLNYvyphA1/sqQ01r8TrH8lYOqcMV/Etvsjs4OovQQXtzxtlmmtpylWyMYOSqxq0 HjRiLgW1KPDDzxsOx176+ukh5e3v6htWpq449PMv5c3AN3KDUkwEQuFzmBdu+7y9XX+S 9kTJqgv6/soA0NVnpfdDXiJgiTh/ee1U5KRmr/NRIOucPqgCtUJbjBtfesbL8UiNR9FT YoT9LmTr0JQu4YCrSyb4lE5ZyioIWoT2Ll4qKaUl2QZ9mCbMdvSD2emNEMMzuERnBHag FX6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rE5rs8sw; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id k82-20020a628455000000b004fe3d0e5d61si4381864pfd.359.2022.04.05.22.07.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 22:07:37 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rE5rs8sw; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D818F20DDC1; Tue, 5 Apr 2022 20:31:10 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245625AbiDEI4h (ORCPT + 99 others); Tue, 5 Apr 2022 04:56:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234190AbiDEIMU (ORCPT ); Tue, 5 Apr 2022 04:12:20 -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 434546E358; Tue, 5 Apr 2022 01:03:00 -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 98959B81B16; Tue, 5 Apr 2022 08:02:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E50FAC385A2; Tue, 5 Apr 2022 08:02:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649145778; bh=mcXObXzAbkIV2NnSPRY4FHVSKdiRd91ADCJdY18KVDw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rE5rs8sw4bEy0x0BNEMCB4v6FTvOqgk/xDSnij2QOWP8m1MPMjByiWu4qInq+XR7j tPvjBGafDkedHX6C6wzkElUa656uNFcGhIYASMIz+QcHKTVHaR2wW6Ge9eltkJ68Qh LjHhftyDRly3FtuiC5hF8XXrn3elXzWQYmfeBJWQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Pali=20Roh=C3=A1r?= , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Lorenzo Pieralisi , Sasha Levin Subject: [PATCH 5.17 0526/1126] PCI: aardvark: Fix reading PCI_EXP_RTSTA_PME bit on emulated bridge Date: Tue, 5 Apr 2022 09:21:13 +0200 Message-Id: <20220405070423.069486912@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070407.513532867@linuxfoundation.org> References: <20220405070407.513532867@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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: Pali Rohár [ Upstream commit 735f5ae49e1b44742cc63ca9b5c1ffde3e94ba91 ] 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. Link: https://lore.kernel.org/r/20220110015018.26359-15-kabel@kernel.org Fixes: 8a3ebd8de328 ("PCI: aardvark: Implement emulated root PCI bridge config space") Signed-off-by: Pali Rohár Signed-off-by: Marek Behún Signed-off-by: Lorenzo Pieralisi Signed-off-by: Sasha Levin --- 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 10e936363461..82e2c618d532 100644 --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c @@ -846,7 +846,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; } -- 2.34.1