From patchwork Mon May 3 14:46:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boqun Feng X-Patchwork-Id: 12236071 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=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 70AC0C43460 for ; Mon, 3 May 2021 14:50:45 +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 AA7426101E for ; Mon, 3 May 2021 14:50:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AA7426101E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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=mG07HsEdkShTps3ToDUajB+VPZxSf629s+lISoN5gMs=; b=mZ+AFmuyf0oNPyF/+7K4No0OZ NhdG47wdhO97Ou8p64H+6zuQPGS9mIzl8c441h7g/LEuC943+HTRKyBbwxOLIRTlxLSurHtMw/F3m 8VS30Ddi0RhqwwdQwN3upQOtjvpA5lJlvwOW+OKbyJuzdgJPB8ESKTPYsfdj13stnCCA+xi8NzbI5 p6hh+S5hRxeo7t53PYK9ZLwoKl1TXajPTkgIJlwAsk18SQklyPEX0RQlmPvwfSuKrL4Bs1YEeGGOs Qgy38kNx5ALFioqoGRbp+UiSnW6Ds5FjBRsXSTgb+JJrrZiHWTX9Hlx0wMsgIOHLxIocPKhvacOIl suZOmGDtg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ldZrZ-00E6Zh-VK; Mon, 03 May 2021 14:47:58 +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 1ldZrN-00E6XU-AX for linux-arm-kernel@desiato.infradead.org; Mon, 03 May 2021 14:47:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=1FSEhDRBQeVQjstn1rh+EE8wSzHzDFWAgXa30qx5G9M=; b=Eqf/DIrQbzWjolwZ9SLbdIRChT peDRPMqAi6uBwuRuHDC1caUdT5r7TOJRxIZn+hNOjv0wtn68yc6UZ3cpqLklQExwaqR0VOO3Y2SoM 6UkL/PsukUYXH6iLf4/GdmdXdJlSmuXsJzMxDuEJ9KIMFWq86Cqyx64UjX2cJfQQQhZZ01Qze28NL SAQyDkk9a7x74DYyLStAafcWygevt0Kw4IYCUmV4ifpw9y/OEh9ZZnLAvpS2qYcpbioD4E/48krWf XKKe2EruJDfjSN1ToPEAZnLUqOGtq4/spXkY7A9Gj1YG6v7qA/SQu6IAUMoeXajc8T26gcFZ7Jz51 aZ+At9Fg==; Received: from mail-qk1-x732.google.com ([2607:f8b0:4864:20::732]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ldZrK-0038bG-9u for linux-arm-kernel@lists.infradead.org; Mon, 03 May 2021 14:47:44 +0000 Received: by mail-qk1-x732.google.com with SMTP id 8so5228548qkv.8 for ; Mon, 03 May 2021 07:47:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1FSEhDRBQeVQjstn1rh+EE8wSzHzDFWAgXa30qx5G9M=; b=fug6smugDkskCRhinWaiLtXji0LdsCSMENxrHWEDPVUB8cETbNLSJt71Mqohm5tm90 d/A8W+KELZX2BTkHtlxh1bSBfAcOKMgS5/eehT3vAW6yms3LoU8SDA3wHoUdEYwOXQ/u hEQgfZZt9c2QKF0CaxHfL5lZFIVU/T0RxMFfMLMXXrfLJwfbbsU8xadgUGPIkSSlU32/ iJFe9qV0Z5t83f185ChRQUD/6ySb0G7Vl8+A2ELP/dYkxRQnQzCARXpJZ8anEyDSAk8h zPeLrwd7U5Exz4nyWEe6NgQMdXqsl6a5g31nOIa59h5XzuHfI2WAEH94SyHQWAWLNy8Z WEHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1FSEhDRBQeVQjstn1rh+EE8wSzHzDFWAgXa30qx5G9M=; b=ory9LTBE9GmhlKeLP9Y1YuQ73ePx+5uuX/7sflVO1i8FFdIHMKixwM0/0lpB2HWcvv qKOlFhYzcOc1otHb5ha6hzkbONyPLxcvzXZZE15sYmFLSLHreZuTde5yQ2Ln93KQhxpv QsXUAncG7CmV/bHvmDsi6kw+njteR0kxtbdGUUzLFIfFCIaDxYPBi0rdaJHAINqYNXPr NOUH82cPl/fMxGHgp8zjBkNo0KJRfrdLg8KueT2iP0dfmhc+QLvo6cQHSQe64jGr9sWj Oa7rzr+q8j7Lm72fYM/6VBu0JK6bHNy6UUoa2izlmMjCa7X/XVcy0GylD+dpI6H7kjc0 cngw== X-Gm-Message-State: AOAM531Yq8yOAZo8E78UbItb2ETdoPY7ri/GUhhArbhdNWpCrzrbUff1 6tq7rn4cE2d8zu4c1Cz7p8E= X-Google-Smtp-Source: ABdhPJx62G3wY4pYdtLDRjmUo8hJHBJuEW481c96AunDZIukoWSkSAUgwuT5KHNy7p8rk2UTj2nZSQ== X-Received: by 2002:ae9:f302:: with SMTP id p2mr18993638qkg.103.1620053261145; Mon, 03 May 2021 07:47:41 -0700 (PDT) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com. [66.111.4.227]) by smtp.gmail.com with ESMTPSA id o189sm8645068qkd.60.2021.05.03.07.47.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 May 2021 07:47:40 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailauth.nyi.internal (Postfix) with ESMTP id 191D727C0054; Mon, 3 May 2021 10:47:40 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 03 May 2021 10:47:40 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdefgedgkedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeeuohhquhhn ucfhvghnghcuoegsohhquhhnrdhfvghnghesghhmrghilhdrtghomheqnecuggftrfgrth htvghrnhephedvveetfefgiedutedtfeevvddvleekjeeuffffleeguefhhfejteekieeu ueelnecukfhppedufedurddutdejrddurddvheegnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepsghoqhhunhdomhgvshhmthhprghuthhhphgv rhhsohhnrghlihhthidqieelvdeghedtieegqddujeejkeehheehvddqsghoqhhunhdrfh gvnhhgpeepghhmrghilhdrtghomhesfhhigihmvgdrnhgrmhgv X-ME-Proxy: Received: from localhost (unknown [131.107.1.254]) by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 3 May 2021 10:47:37 -0400 (EDT) From: Boqun Feng To: Bjorn Helgaas , Arnd Bergmann , Marc Zyngier Cc: Russell King , Andrew Lunn , Sebastian Hesselbarth , Gregory Clement , Catalin Marinas , Will Deacon , Thomas Bogendoerfer , Lorenzo Pieralisi , Rob Herring , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Thomas Petazzoni , Boqun Feng , Mike Rapoport , Robin Murphy , Thomas Gleixner , Jon Derrick , Sunil Muthuswamy , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-pci@vger.kernel.org, linux-hyperv@vger.kernel.org Subject: [RFC v2 1/7] PCI: Introduce pci_host_bridge::domain_nr Date: Mon, 3 May 2021 22:46:29 +0800 Message-Id: <20210503144635.2297386-2-boqun.feng@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210503144635.2297386-1-boqun.feng@gmail.com> References: <20210503144635.2297386-1-boqun.feng@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210503_074742_371715_28018540 X-CRM114-Status: GOOD ( 21.72 ) 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 Currently we retrieve the PCI domain number of the host bridge from the bus sysdata (or pci_config_window if PCI_DOMAINS_GENERIC=y). Actually we have the information at PCI host bridge probing time, and it makes sense that we store it into pci_host_bridge. One benefit of doing so is the requirement for supporting PCI on Hyper-V for ARM64, because the host bridge of Hyper-V doesnt' have pci_config_window, whereas ARM64 is a PCI_DOMAINS_GENERIC=y arch, so we cannot retrieve the PCI domain number from pci_config_window on ARM64 Hyper-V guest. As the preparation for ARM64 Hyper-V PCI support, we introduce the domain_nr in pci_host_bridge, and set it properly at probing time, then for PCI_DOMAINS_GENERIC=y archs, bus domain numbers are set by the bridge domain_nr. Signed-off-by: Boqun Feng --- arch/arm/kernel/bios32.c | 2 ++ arch/arm/mach-dove/pcie.c | 2 ++ arch/arm/mach-mv78xx0/pcie.c | 2 ++ arch/arm/mach-orion5x/pci.c | 2 ++ arch/arm64/kernel/pci.c | 3 +-- arch/mips/pci/pci-legacy.c | 2 ++ arch/mips/pci/pci-xtalk-bridge.c | 2 ++ drivers/pci/controller/pci-ftpci100.c | 2 ++ drivers/pci/controller/pci-mvebu.c | 2 ++ drivers/pci/pci.c | 4 ++-- drivers/pci/probe.c | 7 ++++++- include/linux/pci.h | 11 ++++++++--- 12 files changed, 33 insertions(+), 8 deletions(-) diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c index e7ef2b5bea9c..4942cd681e41 100644 --- a/arch/arm/kernel/bios32.c +++ b/arch/arm/kernel/bios32.c @@ -471,6 +471,8 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw, bridge->sysdata = sys; bridge->busnr = sys->busnr; bridge->ops = hw->ops; + if (IS_ENABLED(CONFIG_PCI_DOMAINS_GENERIC)) + bridge->domain_nr = pci_bus_find_domain_nr(sys, parent); ret = pci_scan_root_bus_bridge(bridge); } diff --git a/arch/arm/mach-dove/pcie.c b/arch/arm/mach-dove/pcie.c index ee91ac6b5ebf..92eb8484b49b 100644 --- a/arch/arm/mach-dove/pcie.c +++ b/arch/arm/mach-dove/pcie.c @@ -167,6 +167,8 @@ dove_pcie_scan_bus(int nr, struct pci_host_bridge *bridge) bridge->sysdata = sys; bridge->busnr = sys->busnr; bridge->ops = &pcie_ops; + if (IS_ENABLED(CONFIG_PCI_DOMAINS_GENERIC)) + bridge->domain_nr = pci_bus_find_domain_nr(sys, NULL); return pci_scan_root_bus_bridge(bridge); } diff --git a/arch/arm/mach-mv78xx0/pcie.c b/arch/arm/mach-mv78xx0/pcie.c index 636d84b40466..6703d394bcde 100644 --- a/arch/arm/mach-mv78xx0/pcie.c +++ b/arch/arm/mach-mv78xx0/pcie.c @@ -208,6 +208,8 @@ static int __init mv78xx0_pcie_scan_bus(int nr, struct pci_host_bridge *bridge) bridge->sysdata = sys; bridge->busnr = sys->busnr; bridge->ops = &pcie_ops; + if (IS_ENABLED(CONFIG_PCI_DOMAINS_GENERIC)) + bridge->domain_nr = pci_bus_find_domain_nr(sys, NULL); return pci_scan_root_bus_bridge(bridge); } diff --git a/arch/arm/mach-orion5x/pci.c b/arch/arm/mach-orion5x/pci.c index 76951bfbacf5..6257fbd4e705 100644 --- a/arch/arm/mach-orion5x/pci.c +++ b/arch/arm/mach-orion5x/pci.c @@ -563,6 +563,8 @@ int __init orion5x_pci_sys_scan_bus(int nr, struct pci_host_bridge *bridge) bridge->dev.parent = NULL; bridge->sysdata = sys; bridge->busnr = sys->busnr; + if (IS_ENABLED(CONFIG_PCI_DOMAINS_GENERIC)) + bridge->domain_nr = pci_bus_find_domain_nr(sys, NULL); if (nr == 0) { bridge->ops = &pcie_ops; diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c index 1006ed2d7c60..e9a6eeb6a694 100644 --- a/arch/arm64/kernel/pci.c +++ b/arch/arm64/kernel/pci.c @@ -71,9 +71,8 @@ struct acpi_pci_generic_root_info { struct pci_config_window *cfg; /* config space mapping */ }; -int acpi_pci_bus_find_domain_nr(struct pci_bus *bus) +int acpi_pci_bus_find_domain_nr(struct pci_config_window *cfg) { - struct pci_config_window *cfg = bus->sysdata; struct acpi_device *adev = to_acpi_device(cfg->parent); struct acpi_pci_root *root = acpi_driver_data(adev); diff --git a/arch/mips/pci/pci-legacy.c b/arch/mips/pci/pci-legacy.c index 39052de915f3..84ad482be22d 100644 --- a/arch/mips/pci/pci-legacy.c +++ b/arch/mips/pci/pci-legacy.c @@ -97,6 +97,8 @@ static void pcibios_scanbus(struct pci_controller *hose) bridge->ops = hose->pci_ops; bridge->swizzle_irq = pci_common_swizzle; bridge->map_irq = pcibios_map_irq; + if (IS_ENABLED(CONFIG_PCI_DOMAINS_GENERIC)) + bridge->domain_nr = pci_bus_find_domain_nr(hose, NULL); ret = pci_scan_root_bus_bridge(bridge); if (ret) { pci_free_host_bridge(bridge); diff --git a/arch/mips/pci/pci-xtalk-bridge.c b/arch/mips/pci/pci-xtalk-bridge.c index 50f7d42cca5a..23355ab720be 100644 --- a/arch/mips/pci/pci-xtalk-bridge.c +++ b/arch/mips/pci/pci-xtalk-bridge.c @@ -712,6 +712,8 @@ static int bridge_probe(struct platform_device *pdev) host->ops = &bridge_pci_ops; host->map_irq = bridge_map_irq; host->swizzle_irq = pci_common_swizzle; + if (IS_ENABLED(CONFIG_PCI_DOMAINS_GENERIC)) + host->domain_nr = pci_bus_find_domain_nr(bc, dev); err = pci_scan_root_bus_bridge(host); if (err < 0) diff --git a/drivers/pci/controller/pci-ftpci100.c b/drivers/pci/controller/pci-ftpci100.c index da3cd216da00..cf6eec7f90e1 100644 --- a/drivers/pci/controller/pci-ftpci100.c +++ b/drivers/pci/controller/pci-ftpci100.c @@ -439,6 +439,8 @@ static int faraday_pci_probe(struct platform_device *pdev) host->ops = &faraday_pci_ops; p = pci_host_bridge_priv(host); host->sysdata = p; + if (IS_ENABLED(CONFIG_PCI_DOMAINS_GENERIC)) + host->domain_nr = pci_bus_find_domain_nr(p, dev); p->dev = dev; /* Retrieve and enable optional clocks */ diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pci-mvebu.c index ed13e81cd691..b329ed2f0956 100644 --- a/drivers/pci/controller/pci-mvebu.c +++ b/drivers/pci/controller/pci-mvebu.c @@ -1122,6 +1122,8 @@ static int mvebu_pcie_probe(struct platform_device *pdev) bridge->sysdata = pcie; bridge->ops = &mvebu_pcie_ops; bridge->align_resource = mvebu_pcie_align_resource; + if (IS_ENABLED(CONFIG_PCI_DOMAINS_GENERIC)) + bridge->domain_nr = pci_bus_find_domain_nr(pcie, dev); return mvebu_pci_host_probe(bridge); } diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 16a17215f633..a249dbf78c34 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -6505,10 +6505,10 @@ static int of_pci_bus_find_domain_nr(struct device *parent) return domain; } -int pci_bus_find_domain_nr(struct pci_bus *bus, struct device *parent) +int pci_bus_find_domain_nr(void *sysdata, struct device *parent) { return acpi_disabled ? of_pci_bus_find_domain_nr(parent) : - acpi_pci_bus_find_domain_nr(bus); + acpi_pci_bus_find_domain_nr(sysdata); } #endif diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 953f15abc850..5e71cc5e1b6c 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -899,7 +899,7 @@ static int pci_register_host_bridge(struct pci_host_bridge *bridge) bus->ops = bridge->ops; bus->number = bus->busn_res.start = bridge->busnr; #ifdef CONFIG_PCI_DOMAINS_GENERIC - bus->domain_nr = pci_bus_find_domain_nr(bus, parent); + bus->domain_nr = bridge->domain_nr; #endif b = pci_find_bus(pci_domain_nr(bus), bridge->busnr); @@ -2974,6 +2974,8 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus, bridge->sysdata = sysdata; bridge->busnr = bus; bridge->ops = ops; + if (IS_ENABLED(CONFIG_PCI_DOMAINS_GENERIC)) + bridge->domain_nr = pci_bus_find_domain_nr(sysdata, parent); error = pci_register_host_bridge(bridge); if (error < 0) @@ -2992,6 +2994,9 @@ int pci_host_probe(struct pci_host_bridge *bridge) struct pci_bus *bus, *child; int ret; + if (IS_ENABLED(CONFIG_PCI_DOMAINS_GENERIC)) + bridge->domain_nr = pci_bus_find_domain_nr(bridge->sysdata, bridge->dev.parent); + ret = pci_scan_root_bus_bridge(bridge); if (ret < 0) { dev_err(bridge->dev.parent, "Scanning root bridge failed"); diff --git a/include/linux/pci.h b/include/linux/pci.h index 86c799c97b77..5bbd8417d219 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -534,6 +534,7 @@ struct pci_host_bridge { struct pci_ops *child_ops; void *sysdata; int busnr; + int domain_nr; struct list_head windows; /* resource_entry */ struct list_head dma_ranges; /* dma ranges resource list */ u8 (*swizzle_irq)(struct pci_dev *, u8 *); /* Platform IRQ swizzler */ @@ -1637,13 +1638,17 @@ static inline int pci_domain_nr(struct pci_bus *bus) { return bus->domain_nr; } +struct pci_config_window; #ifdef CONFIG_ACPI -int acpi_pci_bus_find_domain_nr(struct pci_bus *bus); +int acpi_pci_bus_find_domain_nr(struct pci_config_window *cfg); #else -static inline int acpi_pci_bus_find_domain_nr(struct pci_bus *bus) +static inline int acpi_pci_bus_find_domain_nr(struct pci_config_window *cfg) { return 0; } #endif -int pci_bus_find_domain_nr(struct pci_bus *bus, struct device *parent); +int pci_bus_find_domain_nr(void *sysdata, struct device *parent); +#else +static inline int pci_bus_find_domain_nr(void *sysdata, struct device *parent) +{ return 0; } #endif /* Some architectures require additional setup to direct VGA traffic */ From patchwork Mon May 3 14:46:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boqun Feng X-Patchwork-Id: 12236059 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=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,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 BC5E1C433B4 for ; Mon, 3 May 2021 14:49:40 +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 1E59C611C2 for ; Mon, 3 May 2021 14:49:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1E59C611C2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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=UEcGKv/TT3P6WYrLM6z7pR9+9oLebAK+vlM00kVO+lE=; b=Q2pQLHKAGBVPA6GhewrAiXW4O fe6FLzkyk6fhZi6E12r+7o8tjmQ3I68yKWgCETpE5UUObi3rpPzD1RCOgEZon9/O+/ucMb89xQNQP Lh9ozb7KYA40ssIfBdNAABkTW6ZxKiRfIKUAonPMTadGOH8q5nhz5tnHMUCBioBt0kS+qIRNCW1BJ QW2Z6cx322qbbwz617vnjg6Iw0PUMph0h3KC4S1hXMclxx0/oTcY2lE+DEavJoUkCPmB5SuR/IAgJ 6oRjXnsOzj34M2aCddRrS6GtOuIhds0OBkw2ejUzGjQForMJFmpJCUtmTNXNnyA7PbZAg7jTstF56 5or7XNB3g==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ldZrk-00E6fl-2U; Mon, 03 May 2021 14:48:08 +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 1ldZrN-00E6Xb-QW for linux-arm-kernel@desiato.infradead.org; Mon, 03 May 2021 14:47:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=pHMX7e7cca//f8WV13d54/Yw94IX+FFVKn38d4yzFvQ=; b=sXO+xBQigV//v+54umudyE/jp8 kpJq/03k8wrg8hWuRXv4HZGjDMlG+TrotcId3uvHMJzVg5NYCe9nOEazYRE6VOka5TBBuY9jBFWNS BsfAX90488TJIuTefjpeahn+069tZE2ZhFwaDXm9a8xmSk3t82hvA1pyY+95hUmb30DSWHeMRmIxv znIhAZReNDslA9GdqULCELfKJ7mPGtoMOxH5YcRkxhP7r0oaOucalahDKWzBmHJVuH8nL5WN5nmnY eKmg/rteongK/qurL44rFpH/6xmcPuJrJfOLHUHLBrcU8CN1t3q0rgI2vjvWG8QyZA8vy40b9/pOH YZK58yJg==; Received: from mail-qk1-x72b.google.com ([2607:f8b0:4864:20::72b]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ldZrL-0038bd-DF for linux-arm-kernel@lists.infradead.org; Mon, 03 May 2021 14:47:44 +0000 Received: by mail-qk1-x72b.google.com with SMTP id q136so5233916qka.7 for ; Mon, 03 May 2021 07:47:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pHMX7e7cca//f8WV13d54/Yw94IX+FFVKn38d4yzFvQ=; b=DXIVVgn/RF6pH7mvY6Z3OTOmlU2LdBLelvX8YbNY7kbgAtVktcAGzGNMzkVfVkZ4SD yRuA+W4bm5yLjpw/kGhARLMGrNqENocXS94O4wxIFVXw4WXoBCaBd29lECEU/8vx1/Zc crMH0ojzcJIzgn5acEbz8ATuh9da596Gf9e0qgeN+Ir7NSIRwN9s3sN6vqCtS7t7luLK 4/E3tcJOeNgLbHkB0SPyLhCSKePOBhpXQ9cnWvXgsYS2G63V3BYZx/t0RUiHYgiexhGp itI/gL9VD23M3kEmsuJeQGeNEzDqfrXKZiDHjIqygiNNmpJxQ0Vx3JbnQe0hUHxVTVwT QSAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pHMX7e7cca//f8WV13d54/Yw94IX+FFVKn38d4yzFvQ=; b=GhbeHnT623JrNNwmrvgQcOU2vgChtpfyUK8NPsmYL27UgVB+CfdBzFNZgOEOSpjjHn 6/LTrshLVHAbR8hPgUQSWsoCTddP0BWqxWFutEicK0YvCnUpbUBh103L5EprGrtpdpJ7 qDQCeTJZZcSWyX10p/MBscz/ijYUVNz8cnV0JM2E+Xa95uW9iaR503MkotUtykaVeqQE glDLa5A69pUdgqdwRwlwBz6WANCKMqQkoBjXigFa7+UlM4SqqrebmGG1udl3+BLsdhJb QW5okEWxMFqGTt2lZIOqjmibiFc1KBZ9nxkogX3ZFAxT96ZkpvLZJRj0/6okZXpXhSxH nj9g== X-Gm-Message-State: AOAM531SsTwKjz1QTayCULG1GoqtPJe48Qsc1nis/8uNTXP5TIFNdViF C2ZfQNbQX4ld9QnMdabjUe4= X-Google-Smtp-Source: ABdhPJyEQrN4krK3JagLFsgtZiFtRmmcwogE+AlaLeRSuxSI0/l3UkXy8YAiBwdd49W8aQxYoGf0Ow== X-Received: by 2002:a37:9c50:: with SMTP id f77mr6786789qke.107.1620053262469; Mon, 03 May 2021 07:47:42 -0700 (PDT) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com. [66.111.4.227]) by smtp.gmail.com with ESMTPSA id a26sm9287261qtg.60.2021.05.03.07.47.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 May 2021 07:47:42 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailauth.nyi.internal (Postfix) with ESMTP id 5AE9527C0054; Mon, 3 May 2021 10:47:41 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Mon, 03 May 2021 10:47:41 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdefgedgkedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeeuohhquhhn ucfhvghnghcuoegsohhquhhnrdhfvghnghesghhmrghilhdrtghomheqnecuggftrfgrth htvghrnhephedvveetfefgiedutedtfeevvddvleekjeeuffffleeguefhhfejteekieeu ueelnecukfhppedufedurddutdejrddurddvheegnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepsghoqhhunhdomhgvshhmthhprghuthhhphgv rhhsohhnrghlihhthidqieelvdeghedtieegqddujeejkeehheehvddqsghoqhhunhdrfh gvnhhgpeepghhmrghilhdrtghomhesfhhigihmvgdrnhgrmhgv X-ME-Proxy: Received: from localhost (unknown [131.107.1.254]) by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 3 May 2021 10:47:40 -0400 (EDT) From: Boqun Feng To: Bjorn Helgaas , Arnd Bergmann , Marc Zyngier Cc: Russell King , Andrew Lunn , Sebastian Hesselbarth , Gregory Clement , Catalin Marinas , Will Deacon , Thomas Bogendoerfer , Lorenzo Pieralisi , Rob Herring , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Thomas Petazzoni , Boqun Feng , Mike Rapoport , Robin Murphy , Thomas Gleixner , Jon Derrick , Sunil Muthuswamy , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-pci@vger.kernel.org, linux-hyperv@vger.kernel.org Subject: [RFC v2 2/7] PCI: Allow msi domain set-up at host probing time Date: Mon, 3 May 2021 22:46:30 +0800 Message-Id: <20210503144635.2297386-3-boqun.feng@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210503144635.2297386-1-boqun.feng@gmail.com> References: <20210503144635.2297386-1-boqun.feng@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210503_074743_465298_32BB5C04 X-CRM114-Status: GOOD ( 15.93 ) 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 For GENERIC_MSI_IRQ_DOMAIN drivers, we can set up the msi domain via dev_set_msi_domain() at probing time, and drivers can use this more generic way to set up the msi domain for the host bridge. This is the preparation for ARM64 Hyper-V PCI support. Originally-by: Arnd Bergmann Signed-off-by: Boqun Feng --- drivers/pci/probe.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 5e71cc5e1b6c..90afa05ab2f1 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -828,11 +828,14 @@ static struct irq_domain *pci_host_bridge_msi_domain(struct pci_bus *bus) { struct irq_domain *d; + /* Default set by host bridge driver */ + d = dev_get_msi_domain(bus->bridge); /* * Any firmware interface that can resolve the msi_domain * should be called from here. */ - d = pci_host_bridge_of_msi_domain(bus); + if (!d) + d = pci_host_bridge_of_msi_domain(bus); if (!d) d = pci_host_bridge_acpi_msi_domain(bus); From patchwork Mon May 3 14:46:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boqun Feng X-Patchwork-Id: 12236061 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=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 ACDD3C433B4 for ; Mon, 3 May 2021 14:49:57 +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 E1903611C0 for ; Mon, 3 May 2021 14:49:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E1903611C0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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=o308nsq/hNUvS/O9KXnoBbxeyOjD7W0Rt6nEGw8TzaM=; b=NIOg1/TBUCTp5n4uLPbModOWR nRZxklHq7hR5MmhUdTKBh5vl4BFMt7jNFLODQDuvF5GW0Qb3JrsdFZr80UrFpy2bVXPBFy86+HTaW GoSy/5Gt0b8kHmHmrD3FdLPepQFAJtEHThOW18yw16xzkCZ2WcUsJWurcLmQ86v8vc0vepQy7Qkay bPfn1ghO4RiPIcnLo7cXjLcgMjJZMR6wnNqillhBWKXGQ+XzvIFu0HKL1bqH2lSDUTY3c7JiZ5Eba IgrBtHIhSFzK4pYkqm4xRzxoXPboynif0JPm2Z9jDqPeoiFLzgwB8s1HWWfi5D/rp6Xu/0DymWnoK 6HYNWIcbw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ldZry-00E6hM-6U; Mon, 03 May 2021 14:48:22 +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 1ldZrQ-00E6Xz-S2 for linux-arm-kernel@desiato.infradead.org; Mon, 03 May 2021 14:47:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=K7WNcv9gpl7Pc9Bs4CClcYzbGI8iLKijx7i4GjrAumE=; b=CgdHW48Vh3XyZm5BCUALltVIoF NQtqSmSNJ/SeTHAKQ6/SA39yoOJj9UfqEyweTKD37HiHq/PtRMnrdgvxZmCuyx/XyJob3wXGNXFae I3zp93HIRlLUUBNmucaQzyuIXBviY2OFRKgbE0eabV+fRJ7pLgT6dlfe4Z+AqbujaYPA0lfy/kopu YRSJgUlTF/dEm7WS226FU6KDzO2t7Ki7+sn5S8hTRA0yUnjTnF6uaOY3HHeVCbSJbaPbARRjoOpGs C4q03MhL3/TF84Xe6Q0OExBQZQcmda7O+hIQNoW+aIvx/eMmOQOs0AyfRhMY0YWxVE/ouidy8GzvK WuMUzl/Q==; Received: from mail-qv1-xf34.google.com ([2607:f8b0:4864:20::f34]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ldZrN-0038c4-VK for linux-arm-kernel@lists.infradead.org; Mon, 03 May 2021 14:47:47 +0000 Received: by mail-qv1-xf34.google.com with SMTP id h1so1869736qvv.10 for ; Mon, 03 May 2021 07:47:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=K7WNcv9gpl7Pc9Bs4CClcYzbGI8iLKijx7i4GjrAumE=; b=hDTXkLgdcBg/8iActEuVZQsBNINluBlGBSf7I7odEakWa+wbqfIS8ru5mGYOIN3W9a Z8u+zqGdzHrqgNzvNLnG2YTpfUBkO9Pm69m3IWELrOgpm07CycymYoSV0E7Tlh5a12GP N8CSKMpNXgp2AGXk4Id6oTZoCkc0gd1FWZJyKTEf42SJBXZo7FdHE+6ELCXM9YKMX2ua HLOgS1hcP12qpAIdthqyAUltnITk3NcCCVGNaMnj9wjeIq9+MPZNM9ApVf8SFVAMs/7m 0kdHTcxfFvXHezgVH14WCzSV8H+wu03fGHprIRg5AChgBT9MZqNHQyp+zB9vhKkQtV+X xY0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=K7WNcv9gpl7Pc9Bs4CClcYzbGI8iLKijx7i4GjrAumE=; b=BU4LtkUzrrnOhqZ+b9OlqZRSTRlsa8kPxKndkVs6Uo4Ya+WCj8XgdBIXTf7XwNZm4g Xm8gel7abA7vyzuuBr3yREAHc/7jkeNcafQYfFLggqJ/pRk2JCz/u+UBgl81rFlpLJ7i 2ZoLdmazpM6krpfWgaFwWGgzzGXfOSp6IvdVPvfq4ja5H+alG+y8TyZQ/DSlItxbqaVq KNPAZmD04sjCUIed1fUlmeYaO6ruTz9zpQl3cNp8caF0K6hFTSSyPJDeZ0CsC2ZhFBwC avDHPfXgVNAm02KJ7EHEjxhiOoQmPrXYTeJbLhJ2YBT6plcIlfP3VQYWF0s7plCSJPWQ JPHg== X-Gm-Message-State: AOAM533/y3d72QFMDmS2P3m/T/EO9fYWGD2UGfVmXXpFvwEqfrYmp3sG rsVY14qSnIYFaCmSXdEIK8g= X-Google-Smtp-Source: ABdhPJwhFORps0pBFTvoj1SZER6t9pF8hcj2oPdiHng2UNuDKEAEABMrq6X2quoa/uEV0cg+fxBuVA== X-Received: by 2002:ad4:4f11:: with SMTP id fb17mr20178028qvb.18.1620053264946; Mon, 03 May 2021 07:47:44 -0700 (PDT) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com. [66.111.4.227]) by smtp.gmail.com with ESMTPSA id n15sm8qti.51.2021.05.03.07.47.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 May 2021 07:47:44 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailauth.nyi.internal (Postfix) with ESMTP id 8439927C005A; Mon, 3 May 2021 10:47:43 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 03 May 2021 10:47:43 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdefgedgkedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeeuohhquhhn ucfhvghnghcuoegsohhquhhnrdhfvghnghesghhmrghilhdrtghomheqnecuggftrfgrth htvghrnhephedvveetfefgiedutedtfeevvddvleekjeeuffffleeguefhhfejteekieeu ueelnecukfhppedufedurddutdejrddurddvheegnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepsghoqhhunhdomhgvshhmthhprghuthhhphgv rhhsohhnrghlihhthidqieelvdeghedtieegqddujeejkeehheehvddqsghoqhhunhdrfh gvnhhgpeepghhmrghilhdrtghomhesfhhigihmvgdrnhgrmhgv X-ME-Proxy: Received: from localhost (unknown [131.107.1.254]) by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 3 May 2021 10:47:42 -0400 (EDT) From: Boqun Feng To: Bjorn Helgaas , Arnd Bergmann , Marc Zyngier Cc: Russell King , Andrew Lunn , Sebastian Hesselbarth , Gregory Clement , Catalin Marinas , Will Deacon , Thomas Bogendoerfer , Lorenzo Pieralisi , Rob Herring , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Thomas Petazzoni , Boqun Feng , Mike Rapoport , Robin Murphy , Thomas Gleixner , Jon Derrick , Sunil Muthuswamy , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-pci@vger.kernel.org, linux-hyperv@vger.kernel.org Subject: [RFC v2 3/7] PCI: hv: Generify PCI probing Date: Mon, 3 May 2021 22:46:31 +0800 Message-Id: <20210503144635.2297386-4-boqun.feng@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210503144635.2297386-1-boqun.feng@gmail.com> References: <20210503144635.2297386-1-boqun.feng@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210503_074746_038607_DD0F73F7 X-CRM114-Status: GOOD ( 25.98 ) 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: Arnd Bergmann In order to support ARM64 Hyper-V PCI, we need to set up the bridge at probing time because ARM64 is a PCI_DOMAIN_GENERIC arch and we don't have pci_config_window (ARM64 sysdata) for a PCI root bus on Hyper-V, so it's impossible to retrieve the information (e.g. PCI domains, irq domains) from bus sysdata on ARM64 after creation. Originally in create_root_hv_pci_bus(), pci_create_root_bus() is used to create the root bus and the corresponding bridge based on x86 sysdata. Now we create a bridge first and then call pci_scan_root_bus_bridge(), which allows us to do the necessary set-ups for the bridge. Signed-off-by: Arnd Bergmann Signed-off-by: Boqun Feng --- drivers/pci/controller/pci-hyperv.c | 61 +++++++++++++++-------------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c index 27a17a1e4a7c..27b922b4bb7b 100644 --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -450,6 +450,7 @@ enum hv_pcibus_state { struct hv_pcibus_device { struct pci_sysdata sysdata; + struct pci_host_bridge *bridge; /* Protocol version negotiated with the host */ enum pci_protocol_version_t protocol_version; enum hv_pcibus_state state; @@ -462,13 +463,10 @@ struct hv_pcibus_device { struct resource *high_mmio_res; struct completion *survey_event; struct completion remove_event; - struct pci_bus *pci_bus; spinlock_t config_lock; /* Avoid two threads writing index page */ spinlock_t device_list_lock; /* Protect lists below */ void __iomem *cfg_addr; - struct list_head resources_for_children; - struct list_head children; struct list_head dr_list; @@ -1804,7 +1802,7 @@ static void hv_pci_assign_slots(struct hv_pcibus_device *hbus) slot_nr = PCI_SLOT(wslot_to_devfn(hpdev->desc.win_slot.slot)); snprintf(name, SLOT_NAME_SIZE, "%u", hpdev->desc.ser); - hpdev->pci_slot = pci_create_slot(hbus->pci_bus, slot_nr, + hpdev->pci_slot = pci_create_slot(hbus->bridge->bus, slot_nr, name, NULL); if (IS_ERR(hpdev->pci_slot)) { pr_warn("pci_create slot %s failed\n", name); @@ -1834,7 +1832,7 @@ static void hv_pci_remove_slots(struct hv_pcibus_device *hbus) static void hv_pci_assign_numa_node(struct hv_pcibus_device *hbus) { struct pci_dev *dev; - struct pci_bus *bus = hbus->pci_bus; + struct pci_bus *bus = hbus->bridge->bus; struct hv_pci_dev *hv_dev; list_for_each_entry(dev, &bus->devices, bus_list) { @@ -1857,24 +1855,24 @@ static void hv_pci_assign_numa_node(struct hv_pcibus_device *hbus) */ static int create_root_hv_pci_bus(struct hv_pcibus_device *hbus) { - /* Register the device */ - hbus->pci_bus = pci_create_root_bus(&hbus->hdev->device, - 0, /* bus number is always zero */ - &hv_pcifront_ops, - &hbus->sysdata, - &hbus->resources_for_children); - if (!hbus->pci_bus) - return -ENODEV; + int error; + struct pci_host_bridge *bridge = hbus->bridge; + + bridge->dev.parent = &hbus->hdev->device; + bridge->sysdata = &hbus->sysdata; + bridge->ops = &hv_pcifront_ops; + bridge->msi = &hbus->msi_chip; + bridge->msi->dev = &hbus->hdev->device; - hbus->pci_bus->msi = &hbus->msi_chip; - hbus->pci_bus->msi->dev = &hbus->hdev->device; + error = pci_scan_root_bus_bridge(bridge); + if (error) + return error; pci_lock_rescan_remove(); - pci_scan_child_bus(hbus->pci_bus); hv_pci_assign_numa_node(hbus); - pci_bus_assign_resources(hbus->pci_bus); + pci_bus_assign_resources(bridge->bus); hv_pci_assign_slots(hbus); - pci_bus_add_devices(hbus->pci_bus); + pci_bus_add_devices(bridge->bus); pci_unlock_rescan_remove(); hbus->state = hv_pcibus_installed; return 0; @@ -2139,7 +2137,7 @@ static void pci_devices_present_work(struct work_struct *work) * because there may have been changes. */ pci_lock_rescan_remove(); - pci_scan_child_bus(hbus->pci_bus); + pci_scan_child_bus(hbus->bridge->bus); hv_pci_assign_numa_node(hbus); hv_pci_assign_slots(hbus); pci_unlock_rescan_remove(); @@ -2310,8 +2308,8 @@ static void hv_eject_device_work(struct work_struct *work) /* * Ejection can come before or after the PCI bus has been set up, so * attempt to find it and tear down the bus state, if it exists. This - * must be done without constructs like pci_domain_nr(hbus->pci_bus) - * because hbus->pci_bus may not exist yet. + * must be done without constructs like pci_domain_nr(hbus->bridge->bus) + * because hbus->bridge->bus may not exist yet. */ wslot = wslot_to_devfn(hpdev->desc.win_slot.slot); pdev = pci_get_domain_bus_and_slot(hbus->sysdata.domain, 0, wslot); @@ -2680,8 +2678,7 @@ static int hv_pci_allocate_bridge_windows(struct hv_pcibus_device *hbus) /* Modify this resource to become a bridge window. */ hbus->low_mmio_res->flags |= IORESOURCE_WINDOW; hbus->low_mmio_res->flags &= ~IORESOURCE_BUSY; - pci_add_resource(&hbus->resources_for_children, - hbus->low_mmio_res); + pci_add_resource(&hbus->bridge->windows, hbus->low_mmio_res); } if (hbus->high_mmio_space) { @@ -2700,8 +2697,7 @@ static int hv_pci_allocate_bridge_windows(struct hv_pcibus_device *hbus) /* Modify this resource to become a bridge window. */ hbus->high_mmio_res->flags |= IORESOURCE_WINDOW; hbus->high_mmio_res->flags &= ~IORESOURCE_BUSY; - pci_add_resource(&hbus->resources_for_children, - hbus->high_mmio_res); + pci_add_resource(&hbus->bridge->windows, hbus->high_mmio_res); } return 0; @@ -3031,6 +3027,7 @@ static void hv_put_dom_num(u16 dom) static int hv_pci_probe(struct hv_device *hdev, const struct hv_vmbus_device_id *dev_id) { + struct pci_host_bridge *bridge; struct hv_pcibus_device *hbus; u16 dom_req, dom; char *name; @@ -3043,6 +3040,10 @@ static int hv_pci_probe(struct hv_device *hdev, */ BUILD_BUG_ON(sizeof(*hbus) > HV_HYP_PAGE_SIZE); + bridge = devm_pci_alloc_host_bridge(&hdev->device, 0); + if (!bridge) + return -ENOMEM; + /* * With the recent 59bb47985c1d ("mm, sl[aou]b: guarantee natural * alignment for kmalloc(power-of-two)"), kzalloc() is able to allocate @@ -3064,6 +3065,8 @@ static int hv_pci_probe(struct hv_device *hdev, hbus = kzalloc(HV_HYP_PAGE_SIZE, GFP_KERNEL); if (!hbus) return -ENOMEM; + + hbus->bridge = bridge; hbus->state = hv_pcibus_init; hbus->wslot_res_allocated = -1; @@ -3101,7 +3104,6 @@ static int hv_pci_probe(struct hv_device *hdev, refcount_set(&hbus->remove_lock, 1); INIT_LIST_HEAD(&hbus->children); INIT_LIST_HEAD(&hbus->dr_list); - INIT_LIST_HEAD(&hbus->resources_for_children); spin_lock_init(&hbus->config_lock); spin_lock_init(&hbus->device_list_lock); spin_lock_init(&hbus->retarget_msi_interrupt_lock); @@ -3307,9 +3309,9 @@ static int hv_pci_remove(struct hv_device *hdev) if (hbus->state == hv_pcibus_installed) { /* Remove the bus from PCI's point of view. */ pci_lock_rescan_remove(); - pci_stop_root_bus(hbus->pci_bus); + pci_stop_root_bus(hbus->bridge->bus); hv_pci_remove_slots(hbus); - pci_remove_root_bus(hbus->pci_bus); + pci_remove_root_bus(hbus->bridge->bus); pci_unlock_rescan_remove(); hbus->state = hv_pcibus_removed; } @@ -3320,7 +3322,6 @@ static int hv_pci_remove(struct hv_device *hdev) iounmap(hbus->cfg_addr); hv_free_config_window(hbus); - pci_free_resource_list(&hbus->resources_for_children); hv_pci_free_bridge_windows(hbus); irq_domain_remove(hbus->irq_domain); irq_domain_free_fwnode(hbus->sysdata.fwnode); @@ -3406,7 +3407,7 @@ static int hv_pci_restore_msi_msg(struct pci_dev *pdev, void *arg) */ static void hv_pci_restore_msi_state(struct hv_pcibus_device *hbus) { - pci_walk_bus(hbus->pci_bus, hv_pci_restore_msi_msg, NULL); + pci_walk_bus(hbus->bridge->bus, hv_pci_restore_msi_msg, NULL); } static int hv_pci_resume(struct hv_device *hdev) From patchwork Mon May 3 14:46:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boqun Feng X-Patchwork-Id: 12236063 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=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,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 1601AC433B4 for ; Mon, 3 May 2021 14:50:01 +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 89662611C2 for ; Mon, 3 May 2021 14:50:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 89662611C2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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=8JSEtuckdZltaZqy9/xkwbiGyFlGBGQQEBNTsxQa4V8=; b=koS/a4YCGzKtzHucAr2qloAs+ DI7JIoTP6155h023Aac2NT5MLNLsqQDgcMppeuGnTSTIJXDxoZem8RuBA3fB/rdKFdpi0kLWbFks8 U92QsVxEtmELr679BauitOo9nj9XC/4AAqcr7oxjVROFkfD+FSCGfhz5GdK0F/1Qp1/DHJL8JNpMX B7NN8OtmEXD13dB17VAi76bDQKaSckmMI5ZrzNRgnDTWbIjSeqO67jQVBUMyRdAdL3bWwiDT09GNj QUSf4C1gjuNbsJON0/7zoMNI30MRZrcOJSd0fU+2Fqhuw4FQ0z4ISlwNiEcOlciyXV9VYEaoSvkT0 7nhsptJtg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ldZs9-00E6jQ-MK; Mon, 03 May 2021 14:48:34 +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 1ldZrT-00E6Y4-PW for linux-arm-kernel@desiato.infradead.org; Mon, 03 May 2021 14:47:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=ZaynnOWtz1Te8wfxtYrLIk63miL/F4a1HGn3nv7Urqg=; b=zkCG4XmevK6XESMQkG2J8pW1eQ bAPrFYibA63BKbDDnbVxaOmsXWP78UgLB2sNa+qGqhtsJXxAan9Hevffi7ud/8x9ImLNseVnG8OvK pc9kfcnZPD+ug5JwklL0ujGorT3RPi5LOm400a3H9NEI3cT3E8P7RCmZYPYUDm7s6B8R2UrhQSUKA q2uCI/9xotRxJ203e6na+M8NlLYRCMIunC6Fvxb5q7ZKZ909zTXBQ1euFjAAUT2csSGugXFQGb3K/ INuI7lJ7vN8Se87MBu2np8PM2JBu1hFTf/oGNxgDHv9Y+Fw7aWAHVZFH5aP8cuOGJM6NEGmOHUzvL eoDY2Lnw==; Received: from mail-qv1-xf29.google.com ([2607:f8b0:4864:20::f29]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ldZrR-0038d6-Aq for linux-arm-kernel@lists.infradead.org; Mon, 03 May 2021 14:47:50 +0000 Received: by mail-qv1-xf29.google.com with SMTP id jm10so2669246qvb.5 for ; Mon, 03 May 2021 07:47:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZaynnOWtz1Te8wfxtYrLIk63miL/F4a1HGn3nv7Urqg=; b=f/kTbAKtjUtsRiWLTilOvljJRnbusQs75pq0RiLwmv7SAWfvilihFauytr+8eYpRCG p6Bw1dlvN0JUvKcbDHNfaePTMO5t9yoSHT5fr1g3FRqFF7a+Nvfy2R4kRxpi4zTCM7Jb 1J4kYadymJVE2oeMq8x52ToZBDd12wtbZ1j7YFETYif+mAjM/hBh9MiK0L96l54wxrb6 +MbWQij5LBdaoflS3wtkvlwgXY812BAd3U+OqfV3Fsgwgk51Ct2OuV3SkOWsW+tbdebt OzzHccXeu5s/Wbd9exI0FgfL04jPmRmoEk6j+d/v/2uxwktFzhj5g7oFhx+wdcG7AcEU /TlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZaynnOWtz1Te8wfxtYrLIk63miL/F4a1HGn3nv7Urqg=; b=ihRryjWT2ombmWuqET5+e0PmtBHBv2oH+rDgA31Ys/sJijfbe/EBK94e0oFLtNRfId geeY+oEe+JN7l5ltFUrPb2U7a9NnCyU46Gi3rGay94z2UeVfssGa6YSlKafS6ujjI/vc eeJmF+mR4NKqqoeYCG5a7v/Dkjqnw9EzcJ6WK81Mpya4JuQjrwSgr0mmmKv/KEXUkd47 taBr87ZaQJiwsNL6bfEKnGv9M9p1g+PE9UP/QgqYmSHYG19cimKDe58Z8XzqftVMK+MO k4BZrld7QYkMsjdHtGltkoYA6Q6nfKSEuY+G/RZcM8KLDKxHv+5i0F4uhRjCKi5e9Cml w2Ow== X-Gm-Message-State: AOAM533iLokRPvjwcoKhhowufkLi2fVMslZu/I72DTiI8bQrBEMymGup qc8Be+qQaufxDRn66eOxpvY= X-Google-Smtp-Source: ABdhPJzZoxPhUl5k38exLjHPsVAjKcwCE/twF8waDy9XYOrkcwBv7GeAm9ddoUSKZURoSAmsT/SChg== X-Received: by 2002:a05:6214:486:: with SMTP id ay6mr19861358qvb.18.1620053268704; Mon, 03 May 2021 07:47:48 -0700 (PDT) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com. [66.111.4.227]) by smtp.gmail.com with ESMTPSA id r81sm8757152qka.82.2021.05.03.07.47.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 May 2021 07:47:48 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailauth.nyi.internal (Postfix) with ESMTP id 8210527C0054; Mon, 3 May 2021 10:47:47 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 03 May 2021 10:47:47 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdefgedgkedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeeuohhquhhn ucfhvghnghcuoegsohhquhhnrdhfvghnghesghhmrghilhdrtghomheqnecuggftrfgrth htvghrnhephedvveetfefgiedutedtfeevvddvleekjeeuffffleeguefhhfejteekieeu ueelnecukfhppedufedurddutdejrddurddvheegnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepsghoqhhunhdomhgvshhmthhprghuthhhphgv rhhsohhnrghlihhthidqieelvdeghedtieegqddujeejkeehheehvddqsghoqhhunhdrfh gvnhhgpeepghhmrghilhdrtghomhesfhhigihmvgdrnhgrmhgv X-ME-Proxy: Received: from localhost (unknown [131.107.1.254]) by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 3 May 2021 10:47:44 -0400 (EDT) From: Boqun Feng To: Bjorn Helgaas , Arnd Bergmann , Marc Zyngier Cc: Russell King , Andrew Lunn , Sebastian Hesselbarth , Gregory Clement , Catalin Marinas , Will Deacon , Thomas Bogendoerfer , Lorenzo Pieralisi , Rob Herring , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Thomas Petazzoni , Boqun Feng , Mike Rapoport , Robin Murphy , Thomas Gleixner , Jon Derrick , Sunil Muthuswamy , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-pci@vger.kernel.org, linux-hyperv@vger.kernel.org Subject: [RFC v2 4/7] PCI: hv: Use pci_host_bridge::domain_nr for PCI domain Date: Mon, 3 May 2021 22:46:32 +0800 Message-Id: <20210503144635.2297386-5-boqun.feng@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210503144635.2297386-1-boqun.feng@gmail.com> References: <20210503144635.2297386-1-boqun.feng@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210503_074749_399882_84E5CAB8 X-CRM114-Status: GOOD ( 13.72 ) 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 No functional change, just store and maintain the PCI domain number in the generic pci_host_bridge instead of x86 specific pci_sysdata. Signed-off-by: Boqun Feng --- drivers/pci/controller/pci-hyperv.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c index 27b922b4bb7b..05b73d5dfe9d 100644 --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -2312,7 +2312,7 @@ static void hv_eject_device_work(struct work_struct *work) * because hbus->bridge->bus may not exist yet. */ wslot = wslot_to_devfn(hpdev->desc.win_slot.slot); - pdev = pci_get_domain_bus_and_slot(hbus->sysdata.domain, 0, wslot); + pdev = pci_get_domain_bus_and_slot(hbus->bridge->domain_nr, 0, wslot); if (pdev) { pci_lock_rescan_remove(); pci_stop_and_remove_bus_device(pdev); @@ -3098,6 +3098,7 @@ static int hv_pci_probe(struct hv_device *hdev, "PCI dom# 0x%hx has collision, using 0x%hx", dom_req, dom); + hbus->bridge->domain_nr = dom; hbus->sysdata.domain = dom; hbus->hdev = hdev; @@ -3109,7 +3110,7 @@ static int hv_pci_probe(struct hv_device *hdev, spin_lock_init(&hbus->retarget_msi_interrupt_lock); init_completion(&hbus->remove_event); hbus->wq = alloc_ordered_workqueue("hv_pci_%x", 0, - hbus->sysdata.domain); + hbus->bridge->domain_nr); if (!hbus->wq) { ret = -ENOMEM; goto free_dom; @@ -3236,7 +3237,7 @@ static int hv_pci_probe(struct hv_device *hdev, destroy_wq: destroy_workqueue(hbus->wq); free_dom: - hv_put_dom_num(hbus->sysdata.domain); + hv_put_dom_num(hbus->bridge->domain_nr); free_bus: kfree(hbus); return ret; @@ -3329,7 +3330,7 @@ static int hv_pci_remove(struct hv_device *hdev) wait_for_completion(&hbus->remove_event); destroy_workqueue(hbus->wq); - hv_put_dom_num(hbus->sysdata.domain); + hv_put_dom_num(hbus->bridge->domain_nr); kfree(hbus); return ret; From patchwork Mon May 3 14:46:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boqun Feng X-Patchwork-Id: 12236067 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=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 BDF15C433ED for ; Mon, 3 May 2021 14:50:12 +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 25699611C0 for ; Mon, 3 May 2021 14:50:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 25699611C0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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=ZhzdlmAFJPVYRiFxmt5C9Md8KMJHp5miIXh1435NdtI=; b=njDk+3reORjS9FXTD1r3xEAsz 5yJGRma5Bpm2g2GUxMRpRprtJahByAZUT89iAhMZAamvDTIVXPhkYkOICRH2w1haE7kuyh/KZQ+u/ uUwn67Q552RgyR+Z9XPNROzCxSpqTWshjtji+kDABYawagf3rDtoRlEafTwUPuer6JlN/34K1v8Ia 5E8JVFel1oGHhjMxcrrSAz4qY3iYR+kovpiAHA1VZH7HIyul8Guoi/ldkSGyufisFYBFpx2synYeq n32/djI7IbhlJOA87uXyIYykADXMtui0p45bcLFATS4Fsfy7SegvL68HjxEtz1mj90nY+tpZB6Yb3 j1kTXArLQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ldZsP-00E6n5-Nf; Mon, 03 May 2021 14:48:50 +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 1ldZrV-00E6YK-MF for linux-arm-kernel@desiato.infradead.org; Mon, 03 May 2021 14:47:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=QWGd3JZfCgq7eTKfJP0e8l8aGD/9nEGlQMt+hKKZY8A=; b=X80oQ+1u+AX8ILQEWB6pqSZol4 5Jn/PT5OYDt2L7QBxG5/57u7uQyq1W7phOjE98ahUsV1bIHUXKmOSIYQZjm4TL6z3J92tE7+o1cIi 58BSU2ddhyOQHgXSWF8tpvzojpZ3HA+hgKWmuF3roBKIYjjs1Qk2pDJxP2AnUPhHBBS6uc/3m6PDc WrnfdFwv6/uALzjx5KfJ2m+DTAMcerBwf+bmejbhP7wxt4DeqBoB9nT4BzbFrLlpAKabzSP/Iodhq Z5rJO8FamUMB9+V96MW7lKV9xiBjtBd244HE1nxOUgC+0UMO9Ui39siCoKt+KLIrIpomOR7GqmpZx fz+HMcSA==; Received: from mail-qv1-xf2e.google.com ([2607:f8b0:4864:20::f2e]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ldZrT-0038dS-3O for linux-arm-kernel@lists.infradead.org; Mon, 03 May 2021 14:47:52 +0000 Received: by mail-qv1-xf2e.google.com with SMTP id r13so2666448qvm.7 for ; Mon, 03 May 2021 07:47:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QWGd3JZfCgq7eTKfJP0e8l8aGD/9nEGlQMt+hKKZY8A=; b=pSkfiyb0wtubGvLMi2eXrfzDkJ5X9eLg/4Me5N9YOiME/jPpHKHSwGwsXH1+X1BcSb HlcPE2vOJFcg7orkh4S9K5GSwhd/ytSDy00syRcCCUuZYivKJFufAE/XWV1FFrf1jpeF mvjia0KQQmZcP/goMIGJknd325xKQCRhCUfJe3RmXEhAwNwRDxTmpJilBF4B3IXCF5+y wsq/KrzAA0bp2cXTqsVihNVSS66srFWnf6k73SF2VwwpNIVQfQVL9ilYFvzz8vWEk5Xg odwKKCYTmR32q4yH9WhxmerI/HiVkYMllNfDrTvVcP2inTA2602GZAfDPkF0xsq3KH5F 4WDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QWGd3JZfCgq7eTKfJP0e8l8aGD/9nEGlQMt+hKKZY8A=; b=Cy7DLDvM9i2iiPq4AWPWaTByQ0DlCHqQ4n89upHKaBT8ADjOI/bq2lvnLHAVBoDpR1 dJkJfzFOXsy9fFneGZsRvDh1keQkzJQegS8AlJT97uRrrARDERuiXv9TysF9kWkBIjZf HVcRWMTBMRHgFdSCoyWurZ3mOeyYPXbYmIhFs/rB8H2VNb/tSuqkhVno8sj3UxjBm9sJ ybTfAPYoVOV43c1zIIk5X79F13gS644WWGR5+CNovbEfE1BIOTvJLlvkYcdT/BHwJYNF ETP16O5oY8Ivpqr3mflQ2usqp8RPw5ebn/nZtJ1T54xB0kBOyOUrtx6GiFxlbvGj/eVr N3ZQ== X-Gm-Message-State: AOAM530vFIgLS5JdrFWFRSf+/g0oRT+fFRQ7vpWaZdj70916q8IOeYvE Xxwb5lbNi8FeFO3KihxazNo= X-Google-Smtp-Source: ABdhPJxGkDhQ4Z7gX1EcIbTfincvhtJ+ymk7z9TCLM44IZ4v0r18q4U9mIVYSELaANxcDuZJOCoJ4g== X-Received: by 2002:a0c:ea86:: with SMTP id d6mr16429735qvp.5.1620053270101; Mon, 03 May 2021 07:47:50 -0700 (PDT) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com. [66.111.4.227]) by smtp.gmail.com with ESMTPSA id o12sm5247623qtq.96.2021.05.03.07.47.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 May 2021 07:47:49 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailauth.nyi.internal (Postfix) with ESMTP id D923D27C0054; Mon, 3 May 2021 10:47:48 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 03 May 2021 10:47:48 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdefgedgkedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeeuohhquhhn ucfhvghnghcuoegsohhquhhnrdhfvghnghesghhmrghilhdrtghomheqnecuggftrfgrth htvghrnhephedvveetfefgiedutedtfeevvddvleekjeeuffffleeguefhhfejteekieeu ueelnecukfhppedufedurddutdejrddurddvheegnecuvehluhhsthgvrhfuihiivgepud enucfrrghrrghmpehmrghilhhfrhhomhepsghoqhhunhdomhgvshhmthhprghuthhhphgv rhhsohhnrghlihhthidqieelvdeghedtieegqddujeejkeehheehvddqsghoqhhunhdrfh gvnhhgpeepghhmrghilhdrtghomhesfhhigihmvgdrnhgrmhgv X-ME-Proxy: Received: from localhost (unknown [131.107.1.254]) by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 3 May 2021 10:47:48 -0400 (EDT) From: Boqun Feng To: Bjorn Helgaas , Arnd Bergmann , Marc Zyngier Cc: Russell King , Andrew Lunn , Sebastian Hesselbarth , Gregory Clement , Catalin Marinas , Will Deacon , Thomas Bogendoerfer , Lorenzo Pieralisi , Rob Herring , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Thomas Petazzoni , Boqun Feng , Mike Rapoport , Robin Murphy , Thomas Gleixner , Jon Derrick , Sunil Muthuswamy , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-pci@vger.kernel.org, linux-hyperv@vger.kernel.org Subject: [RFC v2 5/7] PCI: hv: Set up msi domain at bridge probing time Date: Mon, 3 May 2021 22:46:33 +0800 Message-Id: <20210503144635.2297386-6-boqun.feng@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210503144635.2297386-1-boqun.feng@gmail.com> References: <20210503144635.2297386-1-boqun.feng@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210503_074751_165167_82B86254 X-CRM114-Status: GOOD ( 17.59 ) 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 Since PCI_HYPERV depends on PCI_MSI_IRQ_DOMAIN which selects GENERIC_MSI_IRQ_DOMAIN, we can use dev_set_msi_domain() to set up the msi irq domain at probing time, and this works for both x86 and ARM64. Therefore use it as the preparation for ARM64 Hyper-V PCI support. As a result, there is no need to set the pci_sysdata::fwnode which is x86 specific. In addition, make hv_pcibus_device own the fwnode instead of sysdata to make the code generic. Signed-off-by: Boqun Feng --- drivers/pci/controller/pci-hyperv.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c index 05b73d5dfe9d..4ec7839d0adf 100644 --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -451,6 +451,7 @@ enum hv_pcibus_state { struct hv_pcibus_device { struct pci_sysdata sysdata; struct pci_host_bridge *bridge; + struct fwnode_handle *fwnode; /* Protocol version negotiated with the host */ enum pci_protocol_version_t protocol_version; enum hv_pcibus_state state; @@ -1571,7 +1572,7 @@ static int hv_pcie_init_irq_domain(struct hv_pcibus_device *hbus) hbus->msi_info.handler = handle_edge_irq; hbus->msi_info.handler_name = "edge"; hbus->msi_info.data = hbus; - hbus->irq_domain = pci_msi_create_irq_domain(hbus->sysdata.fwnode, + hbus->irq_domain = pci_msi_create_irq_domain(hbus->fwnode, &hbus->msi_info, x86_vector_domain); if (!hbus->irq_domain) { @@ -1580,6 +1581,8 @@ static int hv_pcie_init_irq_domain(struct hv_pcibus_device *hbus) return -ENODEV; } + dev_set_msi_domain(&hbus->bridge->dev, hbus->irq_domain); + return 0; } @@ -3147,9 +3150,9 @@ static int hv_pci_probe(struct hv_device *hdev, goto unmap; } - hbus->sysdata.fwnode = irq_domain_alloc_named_fwnode(name); + hbus->fwnode = irq_domain_alloc_named_fwnode(name); kfree(name); - if (!hbus->sysdata.fwnode) { + if (!hbus->fwnode) { ret = -ENOMEM; goto unmap; } @@ -3227,7 +3230,7 @@ static int hv_pci_probe(struct hv_device *hdev, free_irq_domain: irq_domain_remove(hbus->irq_domain); free_fwnode: - irq_domain_free_fwnode(hbus->sysdata.fwnode); + irq_domain_free_fwnode(hbus->fwnode); unmap: iounmap(hbus->cfg_addr); free_config: @@ -3325,7 +3328,7 @@ static int hv_pci_remove(struct hv_device *hdev) hv_free_config_window(hbus); hv_pci_free_bridge_windows(hbus); irq_domain_remove(hbus->irq_domain); - irq_domain_free_fwnode(hbus->sysdata.fwnode); + irq_domain_free_fwnode(hbus->fwnode); put_hvpcibus(hbus); wait_for_completion(&hbus->remove_event); destroy_workqueue(hbus->wq); From patchwork Mon May 3 14:46:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boqun Feng X-Patchwork-Id: 12236069 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=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,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 87158C433B4 for ; Mon, 3 May 2021 14:50:43 +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 DA49C6101E for ; Mon, 3 May 2021 14:50:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DA49C6101E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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=ghb39Jsfkg7NhYr4PgnWVYsam64NDQx2M2XZ/VscHdM=; b=KyABM3SPenxJdXR4QBnWO7l5j fjyo4SwtkCNtShRzrXUIO7aQq995sDxgt/Bd8dieg1Haxh/jVWBL74GcwG+xX3oDeJ60QaouJbWHg KggE6kB3ftb5I1oLtG11yRdckaKujBQeW+HJoGTZXGNPjYMBj5ATFDasTGMLMginaQw7cgEb16PEu sz1IbHAy7vXfWMM1lInzFH47wKIMPDguHbwjMk/HsPCJlEB/spek8IyH+7lV1bdICYpNlsYdZZAQK wLkILvnJEpJZ7HpqZAJtqi4vK5xo6YoMscFIIF5DAJyaB38599Wvk8wWENSspopE54xkzCCtA7+SD nkpLmeAfQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ldZsc-00E6r5-HW; Mon, 03 May 2021 14:49:02 +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 1ldZrW-00E6YS-Rx for linux-arm-kernel@desiato.infradead.org; Mon, 03 May 2021 14:47:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=09mjDqOchQ3sXLyBszDvLfbZqoTTMTmDKqqwf4ikQZc=; b=CH8wNKjCIRpWFMhJwZnqYYjpgn y4E4DZqVZLMSCz6fvhm/X/9Ugua1NL/bJ2O/Tuy/JHhuFXqjkUbMpgev/yJ0hS8cM3DC6XRTYfpTV J4lZGEZZor2YcmjJKxJaY5xe06mARCftuR2VuC1aHfK0iys3RGEtVK8/v8FSXTVAS/IIdziannGv/ u7Sd4QZQUI8fKTpx8da4bzqaQmZebeHjzWGDdp6RjJrRByIVJVbK5bpMwCk/5L/YNMmmn5mMCCmTq LmAvbrWPRHUDGQoZgxn2hxK83k5dFlIhctKqetWpX7U9CIuW3o+VtUGcfMEadmzW8bdr8dmAl4aEs RKwnXpkA==; Received: from mail-qk1-x731.google.com ([2607:f8b0:4864:20::731]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ldZrU-0038dp-EB for linux-arm-kernel@lists.infradead.org; Mon, 03 May 2021 14:47:53 +0000 Received: by mail-qk1-x731.google.com with SMTP id i17so5250912qki.3 for ; Mon, 03 May 2021 07:47:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=09mjDqOchQ3sXLyBszDvLfbZqoTTMTmDKqqwf4ikQZc=; b=pmMsJxnVey9c4E53pvhRKlEYMcqliE6+RrOBshRD/M+ZTyjc9fmHmwm3wnJBOjHAVJ IoxAfwILIF79HKEN8ZOeXsjhpImJXJx9xAvNnbGNIdv5Nq2kN0ADIg4bGzHlh3+gZ+Tx T9CCEtfurLhqW9KOJi1N6hSgscu43eSoJP79Pn2aNmHU9GF18BFDSSPrLPdyt6+ix51l YHpIvMj8z0WuXZ/QS2tn/T3KIqlSySHLDlYmahJHqw8RF9mIpUdNF/sCvCNL6tuHqYCQ n3seNl+bmEIbXff96WBJCTnIYErxDfKUPQUJD3nLd9mp+sDlNzMoguHdj1ZN9v5wmSrL CheA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=09mjDqOchQ3sXLyBszDvLfbZqoTTMTmDKqqwf4ikQZc=; b=TgHDIFnxLF+nG2UU0HhTOU1VYSiNoHiZ3RtE/+XNWQTAcPNYM2tCElO6oT9w+39G6K 8MxmVxNtypJOMiSlQzGYTWZkQHe0474BGAvmKFUIvx0gpGoiLFXVmObw/FM7iDunVmTB myGdKZgEjmeW5Yq80BGYnW/sz9TJDCasJv/4lAEJ/INKI9T7lrnVJdTQ9UsDF8vqNXXD YedfEJV+AgHifaEyGGv8xlPNt9Z3Ct8PX7OJeTEe09KKykyABgLl/GLjO7TEX/Ex80PP jDJ6+K+IuaolEcCEfm7NoY1hXtvtWwObnAw69eg3EhKU08X0kH5DS3+jRPrXYjwSkLGZ CW7w== X-Gm-Message-State: AOAM532Uj77/pYS7aHwRFfZCo1Rn8f8NZ37BcEwOXwrSQjbWhodxFfBF nJtavg98JTxJCslc1HV4ElY= X-Google-Smtp-Source: ABdhPJwHMaknaOV1erqRimblxefA4bDS+Fyjtw1hIZw24oH0fma3iXqpy4sVMOm+4vJaCAJAJZ0QQw== X-Received: by 2002:a37:8084:: with SMTP id b126mr19407096qkd.175.1620053271518; Mon, 03 May 2021 07:47:51 -0700 (PDT) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com. [66.111.4.227]) by smtp.gmail.com with ESMTPSA id a10sm4472qtm.16.2021.05.03.07.47.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 May 2021 07:47:51 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailauth.nyi.internal (Postfix) with ESMTP id 3989B27C005A; Mon, 3 May 2021 10:47:50 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Mon, 03 May 2021 10:47:50 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdefgedgkedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeeuohhquhhn ucfhvghnghcuoegsohhquhhnrdhfvghnghesghhmrghilhdrtghomheqnecuggftrfgrth htvghrnhephedvveetfefgiedutedtfeevvddvleekjeeuffffleeguefhhfejteekieeu ueelnecukfhppedufedurddutdejrddurddvheegnecuvehluhhsthgvrhfuihiivgepud enucfrrghrrghmpehmrghilhhfrhhomhepsghoqhhunhdomhgvshhmthhprghuthhhphgv rhhsohhnrghlihhthidqieelvdeghedtieegqddujeejkeehheehvddqsghoqhhunhdrfh gvnhhgpeepghhmrghilhdrtghomhesfhhigihmvgdrnhgrmhgv X-ME-Proxy: Received: from localhost (unknown [131.107.1.254]) by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 3 May 2021 10:47:49 -0400 (EDT) From: Boqun Feng To: Bjorn Helgaas , Arnd Bergmann , Marc Zyngier Cc: Russell King , Andrew Lunn , Sebastian Hesselbarth , Gregory Clement , Catalin Marinas , Will Deacon , Thomas Bogendoerfer , Lorenzo Pieralisi , Rob Herring , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Thomas Petazzoni , Boqun Feng , Mike Rapoport , Robin Murphy , Thomas Gleixner , Jon Derrick , Sunil Muthuswamy , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-pci@vger.kernel.org, linux-hyperv@vger.kernel.org Subject: [RFC v2 6/7] PCI: arm64: Allow pci_config_window::parent to be NULL Date: Mon, 3 May 2021 22:46:34 +0800 Message-Id: <20210503144635.2297386-7-boqun.feng@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210503144635.2297386-1-boqun.feng@gmail.com> References: <20210503144635.2297386-1-boqun.feng@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210503_074752_505149_A142422A X-CRM114-Status: GOOD ( 15.39 ) 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 This is purely a hack, for ARM64 Hyper-V guest, there is no corresponding ACPI device for the root bridge, so the best we can provide is an all-zeroed pci_config_window, and in this case make pcibios_root_bridge_prepare() act as the ACPI device is NULL. Signed-off-by: Boqun Feng --- arch/arm64/kernel/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c index e9a6eeb6a694..f159df903ccb 100644 --- a/arch/arm64/kernel/pci.c +++ b/arch/arm64/kernel/pci.c @@ -83,7 +83,7 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge) { if (!acpi_disabled) { struct pci_config_window *cfg = bridge->bus->sysdata; - struct acpi_device *adev = to_acpi_device(cfg->parent); + struct acpi_device *adev = cfg->parent ? to_acpi_device(cfg->parent) : NULL; struct device *bus_dev = &bridge->bus->dev; ACPI_COMPANION_SET(&bridge->dev, adev); From patchwork Mon May 3 14:46:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boqun Feng X-Patchwork-Id: 12236073 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=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,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 04F0DC433B4 for ; Mon, 3 May 2021 14:51:01 +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 614676101E for ; Mon, 3 May 2021 14:51:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 614676101E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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=Ad3cyTGNfN2jOVUcoZxd8UFFdp1dzIbyVB/VOpYsSnw=; b=ZSz6ye5aDYNy+0qiN7klhHnlm FcuyK1P4YdKe5vRJolVucAaSuT6B2mchdIG3EU9vI8z8HIIPeOpdbbZokJUAsITAIsqDCeP5GVPiC omUcMpIVBFKCryu/27r/GruCYZbvDg89oGqB2+ivjPHfX9p5DxcgkWUuvOkii3VQEZgV5U/QT3d7m rcR0Qn+/ya7N9ROG3oHJwvkwGDB48KF9bkemHPbz+4Q67ZJMGQbFAFEC4EoYh+H5GqlMh9SSLFmaB gvq0K9NGLX60t6ddicZZd4E2/q0CwYUKjaDmxm0yq40SWv03uamLkMtxLBSFxD0V4QzyfEh3RgRD9 CLCjWb2nw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ldZss-00E6vV-8b; Mon, 03 May 2021 14:49:18 +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 1ldZrY-00E6YX-47 for linux-arm-kernel@desiato.infradead.org; Mon, 03 May 2021 14:47:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=WmxD0ZZWyLDmbUI7WJl5Chz/U5d4iCfhGGuYidByI1Y=; b=PM9sZFNl2ACxE7Cp4RGLETlXVa 8aZXNhbLq1bhwcNEMQ33GwmJAc3qJ0+mAg8t2fuk7DLzpO02v0MpqxIeEq/GxkzTkTLmqmywrh0FX I7NRI1Qa7BPFo5dL3L09yotjlPtuD+viLRTrnUz0r0G4D3vLh6Ddc42GESJ/qj+eUcrL3xk56lyzG ekW8NM29vCJIKntTR7nAD0sYSmr8VG+PI94C7xCxUHqqh/7nKB9E7E2Q5sAsijia/WAoQqp8euihg T+SPEoPk8AV2YSXB0jkwg3A8MZZZEybBCyW9KbRpTvFXKDk/CH+43HIJqDMxN1fGpgByr4F9gYDwZ erjrAsUA==; Received: from mail-qk1-x735.google.com ([2607:f8b0:4864:20::735]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ldZrV-0038eF-NB for linux-arm-kernel@lists.infradead.org; Mon, 03 May 2021 14:47:54 +0000 Received: by mail-qk1-x735.google.com with SMTP id o5so5273626qkb.0 for ; Mon, 03 May 2021 07:47:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WmxD0ZZWyLDmbUI7WJl5Chz/U5d4iCfhGGuYidByI1Y=; b=c/7Dh3OQepXd3Gk7+Ktnjc/Q1371ta4WGDJVxAkXb0L72Joe3A+fNs0b5ySNu/jZoD vinJS+TmbfjEYKiAEX4R9lq6tDPkYOlWnfW54p6wLHRr16yh3U1nPH5k8cw29O2XuN5k vAgrU/G3YbZF6jq8+W/77AmS/QUqQxehMoC6oWYfDJgT9B+ih0/CTwM5oXYYkg9hzn9C 2/zxwc8VAuPm2b+ki/jnLscwtksaMRdc10Lek3dsjl+SYRhwAS6OlUjtFBRxb1pPCRNS ZRvP6/1CemSsV4rUkXoJhE4rNVLeT2q6wdJPPc0vcgkcq3gL/3jdWjNCpoQ0GlrKVTxf FbWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WmxD0ZZWyLDmbUI7WJl5Chz/U5d4iCfhGGuYidByI1Y=; b=O3ou5ZH5hSVf+jPjcr+KeNZRjKE0y1/VXQfRI80j8GtQfN97Y6EMcq/cg3sXf4icUh 3HK0EXbX4VK/Hll057n6JKkOBqh7vxCVeFTfsOrKAR8UKuqFBPZddDuNAZxTXxFrs6cp q0ZDOCD0GuWeOjFqgx5qs3Fg/AWuCKQilwRxlGmU+c9rcMV9KoQTS1Us8KC/pWLu+qrL 8ic6HcFvpIZHEhtwJXX1/XvHviIrzc9ysj1ykKiNKDqL5V/YWtTrKRziSlqWZGDRNRkk XjkczWL2Pmauoi1InIzG7pxUt1++QugaovaITe5NL9EHXQzQBilq7Lf6lIDDTibmVjaL DSGQ== X-Gm-Message-State: AOAM532Giii4kno5mkvDbPVa1xHH7cjdfUst4NWjgWThKvbnQhM4Xiyu CfNeZDaX28Fkb7YsNFzR8j8= X-Google-Smtp-Source: ABdhPJwJQTQ+i5t7XI+bNqjB0PUR0SiUXldDNi1Jbkj/jxzJyLKY99BDP7WgJCH0Jv+QngE01hMA2g== X-Received: by 2002:a37:7004:: with SMTP id l4mr19996241qkc.476.1620053272797; Mon, 03 May 2021 07:47:52 -0700 (PDT) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com. [66.111.4.227]) by smtp.gmail.com with ESMTPSA id w4sm7801qti.6.2021.05.03.07.47.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 May 2021 07:47:52 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailauth.nyi.internal (Postfix) with ESMTP id 7B8A627C0054; Mon, 3 May 2021 10:47:51 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 03 May 2021 10:47:51 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdefgedgkedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeeuohhquhhn ucfhvghnghcuoegsohhquhhnrdhfvghnghesghhmrghilhdrtghomheqnecuggftrfgrth htvghrnhephedvveetfefgiedutedtfeevvddvleekjeeuffffleeguefhhfejteekieeu ueelnecukfhppedufedurddutdejrddurddvheegnecuvehluhhsthgvrhfuihiivgepvd enucfrrghrrghmpehmrghilhhfrhhomhepsghoqhhunhdomhgvshhmthhprghuthhhphgv rhhsohhnrghlihhthidqieelvdeghedtieegqddujeejkeehheehvddqsghoqhhunhdrfh gvnhhgpeepghhmrghilhdrtghomhesfhhigihmvgdrnhgrmhgv X-ME-Proxy: Received: from localhost (unknown [131.107.1.254]) by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 3 May 2021 10:47:50 -0400 (EDT) From: Boqun Feng To: Bjorn Helgaas , Arnd Bergmann , Marc Zyngier Cc: Russell King , Andrew Lunn , Sebastian Hesselbarth , Gregory Clement , Catalin Marinas , Will Deacon , Thomas Bogendoerfer , Lorenzo Pieralisi , Rob Herring , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Thomas Petazzoni , Boqun Feng , Mike Rapoport , Robin Murphy , Thomas Gleixner , Jon Derrick , Sunil Muthuswamy , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-pci@vger.kernel.org, linux-hyperv@vger.kernel.org Subject: [RFC v2 7/7] PCI: hv: Turn on the host bridge probing on ARM64 Date: Mon, 3 May 2021 22:46:35 +0800 Message-Id: <20210503144635.2297386-8-boqun.feng@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210503144635.2297386-1-boqun.feng@gmail.com> References: <20210503144635.2297386-1-boqun.feng@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210503_074753_775614_07854DCC X-CRM114-Status: GOOD ( 14.07 ) 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 Now we have everything we need, just provide a proper sysdata type for the bus to use on ARM64 and everything else works. Signed-off-by: Boqun Feng --- drivers/pci/controller/pci-hyperv.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c index 4ec7839d0adf..75ff47bedf2a 100644 --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -449,7 +450,11 @@ enum hv_pcibus_state { }; struct hv_pcibus_device { +#ifdef CONFIG_X86 struct pci_sysdata sysdata; +#elif defined(CONFIG_ARM64) + struct pci_config_window sysdata; +#endif struct pci_host_bridge *bridge; struct fwnode_handle *fwnode; /* Protocol version negotiated with the host */ @@ -3102,7 +3107,9 @@ static int hv_pci_probe(struct hv_device *hdev, dom_req, dom); hbus->bridge->domain_nr = dom; +#ifdef CONFIG_X86 hbus->sysdata.domain = dom; +#endif hbus->hdev = hdev; refcount_set(&hbus->remove_lock, 1);