From patchwork Thu May 6 15:31:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 12242485 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EA6AC433ED for ; Thu, 6 May 2021 15:36:03 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 74EC5610C8 for ; Thu, 6 May 2021 15:36:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 74EC5610C8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; 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=nw2ZF9dKlW+OYiGYbAYkOM28fZA0su1m0Tu9gSsrx2M=; b=YJoDewqMRsaGmNRhgxTIAuOIm 3LiLmxsv7EkDaIw6z3lwDUurrtYTxxMUp5XhJppkfJX6lAGl+17uZzlKGzKf6zZFKY18w+rxvZ3fC HACpm2NfIyv8lRExF+SYZhW0FabZVn/X0P31Y1ievo4o8JOI6wIah/HOBUNduaftLGU5tMDeZ2Wzd t/CWCWZnGnYakE2cHCjzvcZK47/0T60bacnh6xF37DQqsrffWyB3tqwCk9kiQ5E1/XHBXaM4dgQvS u/DvGtMWG34yibTV4qrXx3m5fbUpOwHRDI04BIvHCy/F5o82FOxTgkm10i8cYAOf969yAwmnkgDRH tXNNg/rNA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1leg1R-004aca-SR; Thu, 06 May 2021 15:34:42 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lefzi-004a3a-25 for linux-arm-kernel@desiato.infradead.org; Thu, 06 May 2021 15:32:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=deWJqWWARCcJDrEXdA9FwIAbum+H/RqXNFR28NaEsnQ=; b=hJ1BAvIlBDubPK1qv3uuSzk5Tp T35/UynrOkIcdA+AJBcfqp/XMRPbDLuunmnad/wl5jo3h+CB2AnQ8jg3/RF9+oTAOh+JSynXq9sfg UCHn7/o/t4ywSXUAz8UQSPqkWqRYFxjzrLV5/4I/4Bz/VJv2OsgIjf/4hlpFg6NKGq0BPk5kLLH44 BGmN7LpJFVOMHVroxBLtPAcU2ziqzuzURCv246bQkmPOxb11yUy9dpvuaBFeJS4sTmEsAyzyAO3pL ceZOaWDAs3zm4RdVVIDz4hjvO6A0FwkX2/dHAT63hmsh5Laa4rz0uWuiJFhLJ/ZoMY0yjIdOHGca7 ejHem5yg==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lefzd-0069ga-Ie for linux-arm-kernel@lists.infradead.org; Thu, 06 May 2021 15:32:52 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id C0C7A613E4; Thu, 6 May 2021 15:32:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620315167; bh=dHsqdNjyH3uEKBJHdSqdXMTYkvi4cwFKXYRKyfqwHMw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hCUkcoTnKQxQXmXSBCd/GlARbvZoU+rw8K89DtIUwxZ9FWx0T2FxmToOoseROJIPt EbMQJwckfLttJTjMmp0CZ5QcCGEUbk7qeSERhshVV9QuEtdJTjUuU58n2bUKWslOKC xKdI8T7nq/whQmzDwIibtK4pP1dcP5mm8Zc+wSH8HSBCVm1Pkp7pIyLmwXlpBBi+4M 9Q0ZiP8oYE7kKsgvHENJz3j1MM455BxNDEzyY7ZWV5jLSYsix3OaxK5z7RWUIRjePk bq8HqOablna25truOZSUKba7UVWnPAqggA6x81wxntVKU7HHCjiMhqHhH37deWQf6P jmhXzwsDzj70w== Received: by pali.im (Postfix) id A824211AB; Thu, 6 May 2021 17:32:45 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Lorenzo Pieralisi , Thomas Petazzoni , Rob Herring , Bjorn Helgaas Cc: Russell King , =?utf-8?q?Marek_Beh=C3=BAn?= , Remi Pommarel , Xogium , Tomasz Maciej Nowak , Marc Zyngier , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 06/42] PCI: aardvark: Fix reporting CRS Software Visibility on emulated bridge Date: Thu, 6 May 2021 17:31:17 +0200 Message-Id: <20210506153153.30454-7-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210506153153.30454-1-pali@kernel.org> References: <20210506153153.30454-1-pali@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210506_083249_684363_D32D15A2 X-CRM114-Status: GOOD ( 11.80 ) 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 CRS Software Visibility is supported and always enabled by PIO. Correctly report this information via emulated root bridge. Signed-off-by: Pali Rohár Reviewed-by: Marek Behún Fixes: 8a3ebd8de328 ("PCI: aardvark: Implement emulated root PCI bridge config space") Cc: stable@vger.kernel.org --- drivers/pci/controller/pci-aardvark.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c index 3f3c72927afb..e297ec9ec390 100644 --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c @@ -578,6 +578,8 @@ advk_pci_bridge_emul_pcie_conf_read(struct pci_bridge_emul *bridge, case PCI_EXP_RTCTL: { u32 val = advk_readl(pcie, PCIE_ISR0_MASK_REG); *value = (val & PCIE_MSG_PM_PME_MASK) ? 0 : PCI_EXP_RTCTL_PMEIE; + *value |= PCI_EXP_RTCTL_CRSSVE; + *value |= PCI_EXP_RTCAP_CRSVIS << 16; return PCI_BRIDGE_EMUL_HANDLED; } @@ -659,6 +661,7 @@ static struct pci_bridge_emul_ops advk_pci_bridge_emul_ops = { static int advk_sw_pci_bridge_init(struct advk_pcie *pcie) { struct pci_bridge_emul *bridge = &pcie->bridge; + int ret; bridge->conf.vendor = cpu_to_le16(advk_readl(pcie, PCIE_CORE_DEV_ID_REG) & 0xffff); @@ -682,7 +685,16 @@ static int advk_sw_pci_bridge_init(struct advk_pcie *pcie) bridge->data = pcie; bridge->ops = &advk_pci_bridge_emul_ops; - return pci_bridge_emul_init(bridge, 0); + /* PCIe config space can be initialized after pci_bridge_emul_init() */ + ret = pci_bridge_emul_init(bridge, 0); + if (ret < 0) + return ret; + + /* Completion Retry Status is supported and always enabled by PIO */ + bridge->pcie_conf.rootctl = cpu_to_le16(PCI_EXP_RTCTL_CRSSVE); + bridge->pcie_conf.rootcap = cpu_to_le16(PCI_EXP_RTCAP_CRSVIS); + + return 0; } static bool advk_pcie_valid_device(struct advk_pcie *pcie, struct pci_bus *bus,