Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp1651091pxy; Thu, 6 May 2021 12:21:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4CBYJSOVHRCY/ZNHH7OqDUYMYFUqSqvEnoJ8DKckevuQGD2RH7/wwdVFuVJFQHxm/67sv X-Received: by 2002:a65:4382:: with SMTP id m2mr5877734pgp.354.1620328864780; Thu, 06 May 2021 12:21:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620328864; cv=none; d=google.com; s=arc-20160816; b=QM//AqvT4o9vDdVWI86oiztNy8LYRNuvixEZVvx+QtAJXgoyI+K/Ew2pb+a/hiNYMQ yc9VvqmyDYezc6MrFG4/wyNDkloSxG6QRgp8gA2eyWsTk1zPxjmO4EgCfsDcRpg0RTzW HyAZbm1qWhtrhqhamkzBUGGJ/3iHwR6qJcJPQZjsh5fgo01u6rQm1/BHksFW4fRZb13P FKdNQWH2UegewC9sMDa/niB9/rzoNySIWYHdavARa0pD6BUmFxqrVebv0R6RpKRpfotY eODYIdmnBrmUq0cLEFay3B1VqcaPukYx80e8Lo5hfTkq04uSyD4d74wVx+rAtDSNKxlz HqCw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=deWJqWWARCcJDrEXdA9FwIAbum+H/RqXNFR28NaEsnQ=; b=dHoFwllz1VuemTCR25nUdL3A7K4shKK2Op691L0mXa5wYrlrEkZHhGXONmd/4uc+79 TwH18KBWmXcVi+yeeRedDfh8CrCD/ofekjoQ3PFBQG3auopCnOVS93WzyxdibNAIRBRK Uz2yTCS9QOYcDbN8DICvxVxrYJgSK2wpWsUfR9TXrqze8H1MZ3Wsash8oAtk3pGb+LHX uxjg1u6TQBQFTWY4vvuN3W2v/+PrkIriY4TwliiZJyFTfP5tIFKB5fWnvkIkCCyFIUib GReQlFQfcFN8G1gYHBJy+vLknkIpC6z3j8m8tH2oFtrQZ4weczuNaE1leH3oqjO5d+ph oPVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hCUkcoTn; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w13si4381985ply.364.2021.05.06.12.20.52; Thu, 06 May 2021 12:21:04 -0700 (PDT) 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=@kernel.org header.s=k20201202 header.b=hCUkcoTn; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235898AbhEFPeT (ORCPT + 99 others); Thu, 6 May 2021 11:34:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:45940 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235352AbhEFPdq (ORCPT ); Thu, 6 May 2021 11:33:46 -0400 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=20Roh=C3=A1r?= To: Lorenzo Pieralisi , Thomas Petazzoni , Rob Herring , Bjorn Helgaas Cc: Russell King , =?UTF-8?q?Marek=20Beh=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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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, -- 2.20.1