Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3721671pxb; Mon, 24 Jan 2022 16:18:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJzfzU576xqTmD56adR/TcolwwB1i1/WNk8y0JPHyne1DuhzCBXE76oOWSsXeB0cR1DhqyJY X-Received: by 2002:a17:90a:5d8d:: with SMTP id t13mr815174pji.47.1643069935852; Mon, 24 Jan 2022 16:18:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643069935; cv=none; d=google.com; s=arc-20160816; b=O706kAsO0BKdZXy23NjG23AV+klqPKTeBKQL7pI5wA7bYopY7YIQwT2i65FFFpcDN5 V18laTxvme5BRJPDoXSDHizqcQDIoetoSlu2aF1xKgfj/CL8t4oJl5S/doANhNPrtCyH v1cx7KDJ7XNRuJghG3UJngRevsD4ID7k6a6tixREQewRhospuUqmj1nyjZLH1jJE3ltg StS/tRBeA9DLQzj0LzLoC9kIcP6w24CQmpZeIaao3FTpX8kcL41DkQqTg4uByMsfW+Lb 7TGowYgJPqANXEbfYp0QHqaHbJfkqiZ4+++ImaP0yWjGtCT2dTNWjGdPQ/LOv3HVR8Ss u9hw== 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=v08H37LQUaFO3HIbUkQaDI2atYBRr+vsoDjScrZ1mK4=; b=f5+Y1d109qLlRBEHc6dWgVVm6TsQEEFANyVbRrL81b+O2g2CPsHIWZMdfd2CAuDlyu FCMaNmIGEMq5zcvvcjSzrdK1L0AjMD3nwUgwsd+dzmGZFDy3nAG2FxwIm2E/H1UEJZO8 /BBLiLFQObtvmBnK4ciKT7r4Ak9A/P8TZH6QuzTDf5xaDP4DTWqvvkh3Rx5xHKiIWpaE 4zruXx4H5MzUPh+lpU+5c3BpIQwrZP2HVO3/MTeKYNb3/W0zOTe7cuIgZC6al2OxzhQs FX1GiGh4e+PCCClIQQpoUwK3D+EaJQVCSuo6kYUAwnlFS0SVycZodiQfmB7QJ3P8MP1A Ek3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=T84VTGmr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v13si4424780pfc.372.2022.01.24.16.18.44; Mon, 24 Jan 2022 16:18:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=T84VTGmr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S2373428AbiAYANt (ORCPT + 99 others); Mon, 24 Jan 2022 19:13:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1587671AbiAXX2Q (ORCPT ); Mon, 24 Jan 2022 18:28:16 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06AD9C06137C; Mon, 24 Jan 2022 13:33:24 -0800 (PST) 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 9A16B61305; Mon, 24 Jan 2022 21:33:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B87FC340E4; Mon, 24 Jan 2022 21:33:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060003; bh=1JwUsDPGsn0+DgdjBcBpmV32LGvRqYu/Cx8GkXso3cM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T84VTGmrSEwEAsFE+UjQQRLYdaOYlXrJmeuU54KrCf0Jzb7DBfeWyDAKNlIm8VBhO 6yO+2jYzhrtUq3sUMRjtqixrhaCT+PGvJWccIs8gNEHUG1ruXD32o5QVDxJZJev26t hBb4uR7/QsSZISYNI1xuYtwoQQqs3OJGXjfQ9oy0= 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?= , Lorenzo Pieralisi , Sasha Levin Subject: [PATCH 5.16 0807/1039] PCI: mvebu: Fix support for DEVCAP2, DEVCTL2 and LNKCTL2 registers on emulated bridge Date: Mon, 24 Jan 2022 19:43:16 +0100 Message-Id: <20220124184152.438249854@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pali Rohár [ Upstream commit 4ab34548c55fbbb3898306a47dfaccd4860e1ccb ] Armada XP and new hardware supports access to DEVCAP2, DEVCTL2 and LNKCTL2 configuration registers of PCIe core via PCIE_CAP_PCIEXP. So export them via emulated software root bridge. Pre-XP hardware does not support these registers and returns zeros. Link: https://lore.kernel.org/r/20211125124605.25915-16-pali@kernel.org Fixes: 1f08673eef12 ("PCI: mvebu: Convert to PCI emulated bridge config space") Signed-off-by: Pali Rohár Signed-off-by: Lorenzo Pieralisi Signed-off-by: Sasha Levin --- drivers/pci/controller/pci-mvebu.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pci-mvebu.c index 618c34e8879ec..ffcbb8d1d09d5 100644 --- a/drivers/pci/controller/pci-mvebu.c +++ b/drivers/pci/controller/pci-mvebu.c @@ -524,6 +524,18 @@ mvebu_pci_bridge_emul_pcie_conf_read(struct pci_bridge_emul *bridge, *value = mvebu_readl(port, PCIE_RC_RTSTA); break; + case PCI_EXP_DEVCAP2: + *value = mvebu_readl(port, PCIE_CAP_PCIEXP + PCI_EXP_DEVCAP2); + break; + + case PCI_EXP_DEVCTL2: + *value = mvebu_readl(port, PCIE_CAP_PCIEXP + PCI_EXP_DEVCTL2); + break; + + case PCI_EXP_LNKCTL2: + *value = mvebu_readl(port, PCIE_CAP_PCIEXP + PCI_EXP_LNKCTL2); + break; + default: return PCI_BRIDGE_EMUL_NOT_HANDLED; } @@ -615,6 +627,17 @@ mvebu_pci_bridge_emul_pcie_conf_write(struct pci_bridge_emul *bridge, if (new & PCI_EXP_RTSTA_PME) mvebu_writel(port, ~PCIE_INT_PM_PME, PCIE_INT_CAUSE_OFF); break; + + case PCI_EXP_DEVCTL2: + mvebu_writel(port, new, PCIE_CAP_PCIEXP + PCI_EXP_DEVCTL2); + break; + + case PCI_EXP_LNKCTL2: + mvebu_writel(port, new, PCIE_CAP_PCIEXP + PCI_EXP_LNKCTL2); + break; + + default: + break; } } -- 2.34.1