From patchwork Wed Aug 11 15:36:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boqun Feng X-Patchwork-Id: 12431465 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 8799AC4338F for ; Wed, 11 Aug 2021 15:39:51 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 3DEAC60E09 for ; Wed, 11 Aug 2021 15:39:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3DEAC60E09 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=qdQCkYyK3TZctvx2OHFyUognMkYNY9980gWWeYCMYKY=; b=Svc0VcWAzf3RaJ m2CdF5DFfuYxyKvmSMjzgleA+DMZkcBA7rjNFrm7YOk2HiSiCwb23JpaE2NTl+MmXmaUUNOjqalbb 9SucpMheqvIaB546J89Ue94a6vGRm80aXVZpAPFbLgy2MNWVNi9C0J1jeNU4XECBA8Y9gHYewOEXr 4FrxiQSKtSVBMEC2/04nGVCqLoB9xJVPscBVkq949Eb8nvm0GfGeF1MxMJMyfMyLjzfH13/HekzMJ 1UQOyl9LpIAjS5efIyfDSemE0aWhQGH5gm4wGRrppnA4mNG9EDbgn1r0elO+H/vl/wX8Zmb9MoQ9g 4uNQZMd6AqjQ//VTU9ZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDqHo-007ZCl-OZ; Wed, 11 Aug 2021 15:36:56 +0000 Received: from mail-il1-x131.google.com ([2607:f8b0:4864:20::131]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDqHV-007Z55-AE for linux-arm-kernel@lists.infradead.org; Wed, 11 Aug 2021 15:36:38 +0000 Received: by mail-il1-x131.google.com with SMTP id f8so3310768ilr.4 for ; Wed, 11 Aug 2021 08:36:37 -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=GWLHS7/8sRUtmPBUfizlYA1mSy1P6fTX/Paccfguq6M=; b=qcNIH8Msq5OiNc+L3Z12ZCE8w4EtGd20JL38KwwamTSNTSTMC3eqGwkenBJAWDayAK nqm0sz6epxb9sWaCbqn+N7LA0kHi15vojXcwMD3qAQNU0GBY7jUSv/6onB95VYDkLp/y sghqlkytM26c+cPSX0otKUN4wcrCkIwtQ61pf7sOlDRKuyrUSAL0jwIEWi224YLcx8I9 TalWA6dpPTmMh3cVQ/mcz8PxKTKJsCdomhx5gm8u0uXReyo+4almtLtZ+NI6cDUAjyd1 V2CR5diJMvIGg8IA/Pw3UD7Fh9p1mjqyGBqbLGxeO7VbuffW/yUgeiAhSLxE4xxL1i6o TNrA== 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=GWLHS7/8sRUtmPBUfizlYA1mSy1P6fTX/Paccfguq6M=; b=In8474XueblAce+8LjOIE8ZaA+kAwEdPHOtgD/p5KTWWV5LR81stlPFPzet22VkAvl ALaiEF5SkKQk1X9PvfSa673cm/F5hvpGHzgh8sD+aDBRW/tPDPjTD4fu9KSbQ2h5ryRQ dyt744vYtHExM0OXFXkv2f9H1XcWgZhLsnbpnxmuSF2T4q32+2suYIV44W2navnTvhWe /9ZffJxRIWXE6DotGOmDP45PT3DwlDrdw2kIgE08MXAUXOjAxRg52pghE71RsXAXTA9C 4sJSpvJMn/OejFIYJ1igePwhrK14dwJK1NZyGV2OapPEq7r6kj5odFSoiM6JjDzFdvia 9Jsg== X-Gm-Message-State: AOAM5338ezffSV06pVbWqlAigJR6Dyp8vfgAaYo9FTSu/bKdtY8R5tXX wkAsKAVK8JQ8XzaHX7UOn4U= X-Google-Smtp-Source: ABdhPJw7CZTvEfUfPqm/j+ddaSI2a9I3c0fRLtrRijCPdrvAwL2rCz2j6pNCSqyitNsKHlsE4XcAPQ== X-Received: by 2002:a92:4453:: with SMTP id a19mr335155ilm.221.1628696196604; Wed, 11 Aug 2021 08:36:36 -0700 (PDT) Received: from auth2-smtp.messagingengine.com (auth2-smtp.messagingengine.com. [66.111.4.228]) by smtp.gmail.com with ESMTPSA id h8sm5899493ile.39.2021.08.11.08.36.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Aug 2021 08:36:36 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailauth.nyi.internal (Postfix) with ESMTP id 422DF27C005A; Wed, 11 Aug 2021 11:36:35 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 11 Aug 2021 11:36:35 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrkedugdeltdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepuehoqhhunhcu hfgvnhhguceosghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmqeenucggtffrrghtth gvrhhnpeehvdevteefgfeiudettdefvedvvdelkeejueffffelgeeuhffhjeetkeeiueeu leenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegsoh hquhhnodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdeiledvgeehtdeigedq udejjeekheehhedvqdgsohhquhhnrdhfvghngheppehgmhgrihhlrdgtohhmsehfihigmh gvrdhnrghmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 11 Aug 2021 11:36:34 -0400 (EDT) From: Boqun Feng To: Lorenzo Pieralisi Cc: Catalin Marinas , Will Deacon , Bjorn Helgaas , "Rafael J. Wysocki" , Len Brown , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Dexuan Cui , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Boqun Feng , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, linux-hyperv@vger.kernel.org, Sunil Muthuswamy , Marc Zyngier , Arnd Bergmann Subject: [RFC 1/5] PCI: Introduce pci_create_root_bus_priv() Date: Wed, 11 Aug 2021 23:36:15 +0800 Message-Id: <20210811153619.88922-2-boqun.feng@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210811153619.88922-1-boqun.feng@gmail.com> References: <20210811153619.88922-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-20210811_083637_401826_078A87E5 X-CRM114-Status: GOOD ( 15.53 ) 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 In order to allow root bus creation to populate the ->private of the pci_host_bridge at the same, pci_create_root_bus_priv() is introduced. The new function will be used to support passing the corresponding ACPI device as the ->private field when creating the PCI root bus. No functional change. Signed-off-by: Boqun Feng --- drivers/pci/probe.c | 15 ++++++++++++--- include/linux/pci.h | 3 +++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index ea7f2a57e2f5..8f5fea2a7bd9 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -2991,13 +2991,14 @@ void __weak pcibios_remove_bus(struct pci_bus *bus) { } -struct pci_bus *pci_create_root_bus(struct device *parent, int bus, - struct pci_ops *ops, void *sysdata, struct list_head *resources) +struct pci_bus *pci_create_root_bus_priv(struct device *parent, int bus, + struct pci_ops *ops, void *sysdata, struct list_head *resources, + void *private, size_t priv_size) { int error; struct pci_host_bridge *bridge; - bridge = pci_alloc_host_bridge(0); + bridge = pci_alloc_host_bridge(priv_size); if (!bridge) return NULL; @@ -3008,6 +3009,9 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus, bridge->busnr = bus; bridge->ops = ops; + if (priv_size) + memcpy(bridge->private, private, priv_size); + error = pci_register_host_bridge(bridge); if (error < 0) goto err_out; @@ -3018,6 +3022,11 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus, put_device(&bridge->dev); return NULL; } +struct pci_bus *pci_create_root_bus(struct device *parent, int bus, + struct pci_ops *ops, void *sysdata, struct list_head *resources) +{ + return pci_create_root_bus_priv(parent, bus, ops, sysdata, resources, NULL, 0); +} EXPORT_SYMBOL_GPL(pci_create_root_bus); int pci_host_probe(struct pci_host_bridge *bridge) diff --git a/include/linux/pci.h b/include/linux/pci.h index 01aa201e1df0..119356312979 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1041,6 +1041,9 @@ void pcibios_scan_specific_bus(int busn); struct pci_bus *pci_find_bus(int domain, int busnr); void pci_bus_add_devices(const struct pci_bus *bus); struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata); +struct pci_bus *pci_create_root_bus_priv(struct device *parent, int bus, + struct pci_ops *ops, void *sysdata, struct list_head *resources, + void *private, size_t priv_size); struct pci_bus *pci_create_root_bus(struct device *parent, int bus, struct pci_ops *ops, void *sysdata, struct list_head *resources); From patchwork Wed Aug 11 15:36:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boqun Feng X-Patchwork-Id: 12431459 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 7F94FC4338F for ; Wed, 11 Aug 2021 15:39:43 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 222BF60FA0 for ; Wed, 11 Aug 2021 15:39:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 222BF60FA0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=GsSuJa7r27weQrO5RwNILXRflX4gd3PZj2zKkW0nowo=; b=pICub/kJ2s5Eb6 Xri4UJ90YWMNtyu7u+Xu9uv9Je2EYgSiRP/ohSinzbW6EzODg1BW9dyoNrHHOixe2AS32wWE/gp6U VghgXFmWEc1oD5x+LyLd3LQ3HqFxjEmO7sQe9LZVkSAPOae4oCZJiVLA1vyRhioUss3ckPDfN22IS 3ku21DZ+88dyQO+xfl2cFrGFKWlqLX6hESNoWEpmCVyLFvZEvbUPqBxg2VXbPrQ9A5eY/t1pn4HZ9 W7Gcv5MSM/xOx0jdNgt7rcH74fXtwFR23HULeSlFZknFSr9LrrO0p1pAgn8a0Y3u6IRyWiHu0mNVd Hb3j3vU/19RsHgjGgbJw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDqI1-007ZGS-Oz; Wed, 11 Aug 2021 15:37:10 +0000 Received: from mail-io1-xd36.google.com ([2607:f8b0:4864:20::d36]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDqHW-007Z5h-OB for linux-arm-kernel@lists.infradead.org; Wed, 11 Aug 2021 15:36:40 +0000 Received: by mail-io1-xd36.google.com with SMTP id n17so2656449ioc.7 for ; Wed, 11 Aug 2021 08:36:38 -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=H0aePHbvBlMQFFOlxS/RlBo9IjhQNt3o+m5ARm3Lb0E=; b=KSxqYJ+KWw7Gg3DhQLJkgDY1JuTJXIjrCvPJgn3MOCKyuVYdmdz68zetkXAXt3bu4x ES6AUIJPnki5DiPDmJ8aDEAo+XTY5BJ7Kg1rKv0gTRR+0i2E6TJO6igmNq15J3L5y3kv x+7brmJEjp2AiWLmaoPuAXa/PABSGWuETv74xIQmjrTlKl40vcEthWTA1Gr/CWv2lLQN khucthDm/e6F/W6tTJb9zWZ+/5HTQrjlwe94h4NDZ+/5C7i4lyeaPA2J2CXH2JitEFDw fNVbFqtmVgDS4r35EnL6xOX8mTE93LdZ61zLRoZiGGDhJUDGXWYWD3kKsMFiIdcR/DQd gonA== 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=H0aePHbvBlMQFFOlxS/RlBo9IjhQNt3o+m5ARm3Lb0E=; b=OMHwHGYspT9gCP//I4koNfEV9+FAB8qZ6eNsvC2EOs5MqX2kVZu0nRgE3vfI6iDFPz tWk/TFt97SEFSp+pvYwEWh3GuLWKKUmz/p/KK3TJeQyniLVZser65MlHtrLVzwl3ueAE FFIOrueNbVBy07UWD4U26kcI3G/SteiPZsHS39ox720e/ZZocNiakPGHOvzd36xjMbfC QjSI+OfSI8WHyAEjqD4YfORODqLnfVDWtS0D9mjz0/bqSeDuIKDDlWVTgKrzyXe27Iuy UO58bQlfGe1LjdXS35Dj+U4CWeLIRWmutl7rRJMlrawVU8f53+aNyM4zn9OnLoJ259SW 3LpA== X-Gm-Message-State: AOAM531yOyl5p0UHW62H4FSVjOAXByty8p6YQoH9OFjDThVTg20LDuLR 8INvQyhkJrS/goCg0HV3cvc= X-Google-Smtp-Source: ABdhPJw4swY5OoR9NWjAtDhIiSaQ+1h4/lWhktDxZBX90x+/YF3KS5bdFjgKxgydOLGMjvvdPVEdyA== X-Received: by 2002:a6b:b502:: with SMTP id e2mr256604iof.152.1628696198048; Wed, 11 Aug 2021 08:36:38 -0700 (PDT) Received: from auth2-smtp.messagingengine.com (auth2-smtp.messagingengine.com. [66.111.4.228]) by smtp.gmail.com with ESMTPSA id x11sm14111871ilu.3.2021.08.11.08.36.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Aug 2021 08:36:37 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailauth.nyi.internal (Postfix) with ESMTP id 7433527C0054; Wed, 11 Aug 2021 11:36:36 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 11 Aug 2021 11:36:36 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrkedugdeltdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepuehoqhhunhcu hfgvnhhguceosghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmqeenucggtffrrghtth gvrhhnpeehvdevteefgfeiudettdefvedvvdelkeejueffffelgeeuhffhjeetkeeiueeu leenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegsoh hquhhnodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdeiledvgeehtdeigedq udejjeekheehhedvqdgsohhquhhnrdhfvghngheppehgmhgrihhlrdgtohhmsehfihigmh gvrdhnrghmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 11 Aug 2021 11:36:36 -0400 (EDT) From: Boqun Feng To: Lorenzo Pieralisi Cc: Catalin Marinas , Will Deacon , Bjorn Helgaas , "Rafael J. Wysocki" , Len Brown , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Dexuan Cui , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Boqun Feng , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, linux-hyperv@vger.kernel.org, Sunil Muthuswamy , Marc Zyngier , Arnd Bergmann Subject: [RFC 2/5] PCI/ACPI: Store ACPI device information in the host bridge structure Date: Wed, 11 Aug 2021 23:36:16 +0800 Message-Id: <20210811153619.88922-3-boqun.feng@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210811153619.88922-1-boqun.feng@gmail.com> References: <20210811153619.88922-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-20210811_083638_839696_12574462 X-CRM114-Status: GOOD ( 14.29 ) 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 In order to decouple the ACPI device information of a PCI host bridge from the sysdata, ->private of pci_host_bridge is used to store the ACPI device, and it's done by the new pci_create_root_bus_priv(). A reader function is also added, to retrieve the ACPI device information in pci_host_bridge. Signed-off-by: Boqun Feng --- drivers/acpi/pci_root.c | 5 +++-- include/linux/pci-acpi.h | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index d7deedf3548e..82824841cbda 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -894,8 +894,9 @@ struct pci_bus *acpi_pci_root_create(struct acpi_pci_root *root, pci_acpi_root_add_resources(info); pci_add_resource(&info->resources, &root->secondary); - bus = pci_create_root_bus(NULL, busnum, ops->pci_ops, - sysdata, &info->resources); + bus = pci_create_root_bus_priv(NULL, busnum, ops->pci_ops, sysdata, + &info->resources, &root->device, + sizeof(struct acpi_device *)); if (!bus) goto out_release_info; diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h index 5ba475ca9078..21d4cc80aa55 100644 --- a/include/linux/pci-acpi.h +++ b/include/linux/pci-acpi.h @@ -80,6 +80,11 @@ extern struct pci_bus *acpi_pci_root_create(struct acpi_pci_root *root, struct acpi_pci_root_ops *ops, struct acpi_pci_root_info *info, void *sd); +static inline struct acpi_device * +acpi_pci_root_device(struct pci_host_bridge *bridge) +{ + return *((struct acpi_device **)bridge->private); +} void acpi_pci_add_bus(struct pci_bus *bus); void acpi_pci_remove_bus(struct pci_bus *bus); From patchwork Wed Aug 11 15:36:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boqun Feng X-Patchwork-Id: 12431461 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 0469EC4338F for ; Wed, 11 Aug 2021 15:39:47 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 AB02D60FA0 for ; Wed, 11 Aug 2021 15:39:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org AB02D60FA0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=a5o/s3QYBLxXJkpRLb7JEudkucwWZvv3olfH8nk3Jz0=; b=jAW21Goo2CykVR MAjxewwCv0UapqQRr02cGAnGk8O1kuEXQyGEVvefrq7Ei3km7/XWuB49shkbTJav8P+Z46md0xwMW AFbjkc747c1sIWKZpJubQFYTb1Fudjf5yRdfX0G0BvXSFs15lkKAfGwcnESecenQqiq9tH6mppDEv RnEramYKKM2LL2UbgKOeh0IR9cFc/vt1wu9RXAiFAdAs8hrojR9Ksh2Gvqgvg/s1sujW/MK9HiLAG HV9J4MZjgNISuG9ARqzclce/dfOkn5xcyH3O1wsXwAie6T/DEPAIYgznqI6EaorHMr3833KZCJnQU BWrOhRGQskGiFji/8Ltw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDqIF-007ZKL-Ok; Wed, 11 Aug 2021 15:37:24 +0000 Received: from mail-il1-x133.google.com ([2607:f8b0:4864:20::133]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDqHY-007Z6a-VU for linux-arm-kernel@lists.infradead.org; Wed, 11 Aug 2021 15:36:42 +0000 Received: by mail-il1-x133.google.com with SMTP id u7so3295136ilk.7 for ; Wed, 11 Aug 2021 08:36:40 -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=m+WerKLNTuUcJjz5ppPIhMIuAZu9yrWomJykGHOMdQE=; b=Xw6bPBKjGySndzPoxC/HBXcfij6Ej8gsr8XCwc/zUlawabtn9idGbjPtC5CiRKkBTI IA8wyHhBi1Eb/DNR66nHkc+bGlSqJ1oMU4yomnzFoL0dLvsgp9EijGkpycy+ME8ywYAU 9miztcb3otIBCm1rnSjISWjbUkHjtO5Zh2zXHk64EhOOR4+ZoIniFCi6Vzp+VeQwPEFF 0swypePmtrL4wWMaRNBmi/e63ZXF5YQpxE0eYKmevPTTY0pWT9oCPylMLKRBiOT3TNq1 9Jbxxt1ehFQEq3YrJUL7/RrF9dIgres10UXUChxe2NvXIyryaSik9xOkU7x4vyd0R6Yz cr1g== 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=m+WerKLNTuUcJjz5ppPIhMIuAZu9yrWomJykGHOMdQE=; b=I5AcWE+1GeGEqFeVbqEAvfopRWgfLLLpjaERjKD5DeNI3MafAyERqglKNovLsRDhiA /IMpRHVI1R6BIYIxyawkQ7p0itCfHIxeomijaaiKdLNZj3kmSCRYr+6BkP2x4bgyfPkL vVrxfL2CyN6T/0+cdobPuqyI7Koed3tYadJho9nBmTy5nGIhF4dnogUySsHI614rTmN/ Li2+2oXkl4E8ecfFUgwEV8W7aGyS8oTa+07lcmD2HiK9OEwyrov4Zue594bobiCU6SXP HPnUuDB9/XjkRoy9dEJrVXLZ+U1XqyKEG+PmLACmjBWn6Ve2qg5Kl5eOllyNyirXGz3c PiWQ== X-Gm-Message-State: AOAM532hRsjmhKhUezmLWuUWMKiEaYl0pDB2F94qs2deDcVmUTLzZE0G LIRTZi5O0u9KTS2VnIY4Emg= X-Google-Smtp-Source: ABdhPJwG2Q43Tufl+2zOtEvKna7XTvih3Y7p27iDvAbAfAT9elYx46qIz2mqI+h/bG7cZprSEiAaxg== X-Received: by 2002:a05:6e02:13f0:: with SMTP id w16mr276304ilj.268.1628696200058; Wed, 11 Aug 2021 08:36:40 -0700 (PDT) Received: from auth2-smtp.messagingengine.com (auth2-smtp.messagingengine.com. [66.111.4.228]) by smtp.gmail.com with ESMTPSA id t15sm12914887iln.77.2021.08.11.08.36.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Aug 2021 08:36:39 -0700 (PDT) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailauth.nyi.internal (Postfix) with ESMTP id BCAAA27C0054; Wed, 11 Aug 2021 11:36:38 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Wed, 11 Aug 2021 11:36:38 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrkedugdeklecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepuehoqhhunhcu hfgvnhhguceosghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmqeenucggtffrrghtth gvrhhnpeehvdevteefgfeiudettdefvedvvdelkeejueffffelgeeuhffhjeetkeeiueeu leenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegsoh hquhhnodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdeiledvgeehtdeigedq udejjeekheehhedvqdgsohhquhhnrdhfvghngheppehgmhgrihhlrdgtohhmsehfihigmh gvrdhnrghmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 11 Aug 2021 11:36:37 -0400 (EDT) From: Boqun Feng To: Lorenzo Pieralisi Cc: Catalin Marinas , Will Deacon , Bjorn Helgaas , "Rafael J. Wysocki" , Len Brown , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Dexuan Cui , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Boqun Feng , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, linux-hyperv@vger.kernel.org, Sunil Muthuswamy , Marc Zyngier , Arnd Bergmann Subject: [RFC 3/5] PCI: hv: Set NULL as the ACPI device for the PCI host bridge Date: Wed, 11 Aug 2021 23:36:17 +0800 Message-Id: <20210811153619.88922-4-boqun.feng@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210811153619.88922-1-boqun.feng@gmail.com> References: <20210811153619.88922-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-20210811_083641_113513_33D05544 X-CRM114-Status: GOOD ( 15.56 ) 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 A PCI host bridge of Hyper-V doesn't have the corresponding ACPI device, therefore a NULL pointer needs to be set as the ->private of pci_host_bridge since for platforms with ACPI ->private is used to store the ACPI device information for the host bridges. And since kzalloc() is used to allocate pci_host_bridge, as a result, what is needed is just setting the correct size of ->private, kzalloc() will zero the field as if set a NULL pointer to it. Signed-off-by: Boqun Feng --- drivers/pci/controller/pci-hyperv.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c index 62dbe98d1fe1..fd3792b5edcc 100644 --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -3021,7 +3021,12 @@ 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); + /* + * devm_pci_alloc_host_bridge() use kzalloc(), and we want to set + * ->private as a NULL pointer, therefore no need to set ->private after + * allocation. + */ + bridge = devm_pci_alloc_host_bridge(&hdev->device, sizeof(struct acpi_device *)); if (!bridge) return -ENOMEM; From patchwork Wed Aug 11 15:36:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boqun Feng X-Patchwork-Id: 12431467 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 285ECC4320E for ; Wed, 11 Aug 2021 15:40:02 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 E0D3E60FA0 for ; Wed, 11 Aug 2021 15:40:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E0D3E60FA0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=kYy/UJjqVUtN9KMsxSMcVyzIZQcrqmTJgV01+lzgYtc=; b=L+FA3qDIRFUx4r nmAMOlXrQauNQ+9iFasdMWpI1jlwPOXHn16rej2jpqlVgpFfECDLRY9Zbe+UF0+RbJb4wLkvjduwI 1W2ZzqPnMuyydiPn2MUUC6e3GAD97sfD/uSW4Lmpr2860+myzaZyp+jFPZns9ACb0hBGqjeo1pk6F YuEEM+dub7R6/xPq9ixCjjOk+UZABquipQeMTUJq1xwnDu4BLiatGqUxUECSkUyOFtuPcYR1EajLD w4WfEB49ATP02xlJmdYWX8SfYNCZ2NsPGDyEX4HVZ44ihOlN4zikbj2o/t3yePRXN4dJTR0p79Vmw Js96RJWOsT2DU508ZgjA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDqIX-007ZQB-45; Wed, 11 Aug 2021 15:37:42 +0000 Received: from mail-io1-xd29.google.com ([2607:f8b0:4864:20::d29]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDqHa-007Z7K-5J for linux-arm-kernel@lists.infradead.org; Wed, 11 Aug 2021 15:36:43 +0000 Received: by mail-io1-xd29.google.com with SMTP id b142so2853268iof.4 for ; Wed, 11 Aug 2021 08:36:41 -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=wRFXDsRsZFP+swHvW0it2ljd9zsnjdp5Y+aRBZEgtII=; b=j5aHS3h3ClzuSFzHjW1f232qNdqNbr8RGmFfs1lj042PPgg1xQq48+wOSbQ6ijMk1k 0P8EFECxSVN6ir2xkYjqEWGSvKwYEwyesE0KZccKhWYE2JTCq9YwgUTJHRfy1dWG5XNx 5MgVnHvDXCsAK9L7G/zrejy+Q0uxWntknVdsx9iWGHecdzRCrdoc3zBBkHDgrXwV8jUo hDx2uSgwQrnf1mApyxjC04Sr4HFSDJFgf1MjBGveh8iPShD1Lt2iaY62cHA+N+INnYrJ swT1HASYf58Zn/+R/k4cWRkhZnW4J2DWEBlE6bmuDIfKNouocM7r7+zkjHHvhoAbmJYC 4Q1A== 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=wRFXDsRsZFP+swHvW0it2ljd9zsnjdp5Y+aRBZEgtII=; b=PBmXd33iZXmtGt+E/QlkZeN6TOnRbYw190Ea5Ri898IWWxPqf4Y2++qYQWyEUOObJD OarW7sEeDj+8rBZsNChaPdhpka2IPRnguzH0EmhPQwg7q5eO9PobPDhjcz41NJI8Zvf0 ehDF/MSHPP729251J2TF4zAcuOnkraqJA543y82V3X9xVBqLgX7mDZ8xkKNtOsKiUMgH qUacJSouPWBG0ve87H7C7xFNitf6O63BIN/FLmA9nNYuylifv3LQxhOIbYyaD7bvTvRr vYjZ49t1e68tgAx0p+j0rvZrflyFHkD6lcctOU8kh6+mitEt3rwlOdGKuu6HFnfAWMvk sDig== X-Gm-Message-State: AOAM533xJnZ7RMTGjLiI4nExHfamsrMMUhTANF2yn+4LpmccGpatAW5P zM5YA7llXQ6VtHCDGkWKrxo= X-Google-Smtp-Source: ABdhPJyewK+8jlT5DsfKdoU00MeBnHa8omGalrNwdkPuKHZw2jePTbG33EdqpOUGziPz18+svZ0UTQ== X-Received: by 2002:a02:7711:: with SMTP id g17mr476718jac.132.1628696201381; Wed, 11 Aug 2021 08:36:41 -0700 (PDT) Received: from auth2-smtp.messagingengine.com (auth2-smtp.messagingengine.com. [66.111.4.228]) by smtp.gmail.com with ESMTPSA id w16sm13438214ilh.21.2021.08.11.08.36.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Aug 2021 08:36:41 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailauth.nyi.internal (Postfix) with ESMTP id 0357327C005A; Wed, 11 Aug 2021 11:36:40 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 11 Aug 2021 11:36:40 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrkedugdeltdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepuehoqhhunhcu hfgvnhhguceosghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmqeenucggtffrrghtth gvrhhnpeehvdevteefgfeiudettdefvedvvdelkeejueffffelgeeuhffhjeetkeeiueeu leenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpegsoh hquhhnodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdeiledvgeehtdeigedq udejjeekheehhedvqdgsohhquhhnrdhfvghngheppehgmhgrihhlrdgtohhmsehfihigmh gvrdhnrghmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 11 Aug 2021 11:36:39 -0400 (EDT) From: Boqun Feng To: Lorenzo Pieralisi Cc: Catalin Marinas , Will Deacon , Bjorn Helgaas , "Rafael J. Wysocki" , Len Brown , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Dexuan Cui , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Boqun Feng , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, linux-hyperv@vger.kernel.org, Sunil Muthuswamy , Marc Zyngier , Arnd Bergmann Subject: [RFC 4/5] arm64: PCI: Retrieve ACPI device information directly from host bridges Date: Wed, 11 Aug 2021 23:36:18 +0800 Message-Id: <20210811153619.88922-5-boqun.feng@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210811153619.88922-1-boqun.feng@gmail.com> References: <20210811153619.88922-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-20210811_083642_252376_D42F7842 X-CRM114-Status: GOOD ( 15.82 ) 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 since we store the corresponding ACPI device pointer in the ->private of pci_host_bridge, use it instead of the sysdata to retrieve the ACPI device information. Doing this decouples the dependency on the pci_config_window structure in Hyper-V virtual PCI, because passing a NULL pointer as the ACPI device is the soly reason of the dependency. The decoupling avoids adding pci_config_window in hv_pcibus_dev and also makes the code cleaner. Signed-off-by: Boqun Feng --- arch/arm64/kernel/pci.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c index 2276689b5411..783971749eb7 100644 --- a/arch/arm64/kernel/pci.c +++ b/arch/arm64/kernel/pci.c @@ -82,25 +82,13 @@ int acpi_pci_bus_find_domain_nr(struct pci_bus *bus) int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge) { - struct pci_config_window *cfg; struct acpi_device *adev; struct device *bus_dev; if (acpi_disabled) return 0; - cfg = bridge->bus->sysdata; - - /* - * On Hyper-V there is no corresponding ACPI device for a root bridge, - * therefore ->parent is set as NULL by the driver. And set 'adev' as - * NULL in this case because there is no proper ACPI device. - */ - if (!cfg->parent) - adev = NULL; - else - adev = to_acpi_device(cfg->parent); - + adev = acpi_pci_root_device(bridge); bus_dev = &bridge->bus->dev; ACPI_COMPANION_SET(&bridge->dev, adev); From patchwork Wed Aug 11 15:36:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boqun Feng X-Patchwork-Id: 12431469 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 B86FAC4338F for ; Wed, 11 Aug 2021 15:40:18 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 80B7160E09 for ; Wed, 11 Aug 2021 15:40:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 80B7160E09 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=QSt95/cgNRIPSreet/trsHe7GH6FqSwrRN29pZfZeiM=; b=x3+kepnPtn7ek1 yj0Q/yccLXNMvbHuQRoCzqctMKcUWwYW62iD18VxxWqiEjRCqXMZ52kgXqbg46Cyc+8tq+L2BT6on FALQA4RpLRFLEN+n0D/grJHHGjCG3RRrUDBB1fXSl4EbFgIX914agb08UZkruBUeu/M/Z/8gufE8M X+O5VhBpSRyJknFYhOxCeZw4tzrDYTBugeBEHtx5fqAuEFBp1hPPwyuQZVJNtjm/n1/cQSwngZxRo 24YL4Ik5PE8sB2k54D/T8MIUL2kfG5orrmOdfXyNe5pCJpyq4AkvMChx9YwSMyyZXQJmWmhVC46dj XWDk86Mq+xBM9Cbbh42w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDqIv-007ZYw-3N; Wed, 11 Aug 2021 15:38:05 +0000 Received: from mail-io1-xd2d.google.com ([2607:f8b0:4864:20::d2d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDqHb-007Z8D-AJ for linux-arm-kernel@lists.infradead.org; Wed, 11 Aug 2021 15:36:44 +0000 Received: by mail-io1-xd2d.google.com with SMTP id e186so4150164iof.12 for ; Wed, 11 Aug 2021 08:36: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=DQztCj7/CCGbKaKfsGCj2ylvssWy2hoSLtQUB8lGvqA=; b=XxdVMm6fenLsjMT3qAxdEjlJ+RMQ5X4WvI9Cx8RWNlvtVC+bhg0+IiOIOWs6QAXGzW jkQe1TurjzzTv9GUVGVu0YTsBAO3Q9XHzzW4O88HO8drG9qcx8EKovfgNPMeut0/preL 3FCzsFlWsg7vGO1XaDZhP1CcV8lkQYW5VV8mja8Yf+odS6OlCePmYV0P9s6UaHmmEW7f ziS2asakbEYEYnsvZLuj4tJpGTNJGpKB8WjhZFG8t4r1A9hMqA4oaVQ7Ko6ueU17dW8z SKaBDqcbedh7KSlTBOD4QTvLHGsU3gpdmmTaBb3PaUhQpaE7hpGwgStS9ew5DUu7zjWw EtoA== 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=DQztCj7/CCGbKaKfsGCj2ylvssWy2hoSLtQUB8lGvqA=; b=BQiNqSbKQ3lUs3ogNEUTxKSrL82gA3WNd/lLS0Cw5xcclpaWhPfLgwzMEuOJ+RGIvq h/WKPO1AuIa6BWCcb0sQkBQne6N7SfBdZcgx2zuWnuFsE8B2g70Z6HUpsprl/hdjBB8a khm0Ty+pAHwrAMbDbOy7sTo/liu88eetKGxlm0LEfj/DnLIpHMlrplR0WxHTsw78CfHu Vwy/A7TRyTpYacIZpF1HuydQWzxwV44lhcZ6VDRfIJQsXD5MHqpfV4x8SCnmmtl4JzmC /S+FXjWzD16kIZlPgrmZ0HE3u2DlNfhGsK2wvcIMlxvs3c0R4jl4igKgA5bqsdbiI0ag Wdpg== X-Gm-Message-State: AOAM530OndWQ0HIpQwdcrVP6t+asWVzAhO6g+i0TSe45oWhd1LIonirS 8ecCeFz4ri1NRQbZPPPmL+4= X-Google-Smtp-Source: ABdhPJzLLBPJ4N7FhEZx/e0t1/uMyV5jGKrTQJ5t5039LpTMBPPzh67wbfKPDN5YlpUF01jwpsVe+w== X-Received: by 2002:a05:6602:1848:: with SMTP id d8mr32570ioi.72.1628696202630; Wed, 11 Aug 2021 08:36:42 -0700 (PDT) Received: from auth2-smtp.messagingengine.com (auth2-smtp.messagingengine.com. [66.111.4.228]) by smtp.gmail.com with ESMTPSA id m1sm13261529ilf.24.2021.08.11.08.36.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Aug 2021 08:36:42 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailauth.nyi.internal (Postfix) with ESMTP id 3382527C0054; Wed, 11 Aug 2021 11:36:41 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 11 Aug 2021 11:36:41 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrkedugdeltdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepuehoqhhunhcu hfgvnhhguceosghoqhhunhdrfhgvnhhgsehgmhgrihhlrdgtohhmqeenucggtffrrghtth gvrhhnpeehvdevteefgfeiudettdefvedvvdelkeejueffffelgeeuhffhjeetkeeiueeu leenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpegsoh hquhhnodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdeiledvgeehtdeigedq udejjeekheehhedvqdgsohhquhhnrdhfvghngheppehgmhgrihhlrdgtohhmsehfihigmh gvrdhnrghmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 11 Aug 2021 11:36:40 -0400 (EDT) From: Boqun Feng To: Lorenzo Pieralisi Cc: Catalin Marinas , Will Deacon , Bjorn Helgaas , "Rafael J. Wysocki" , Len Brown , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Dexuan Cui , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Boqun Feng , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, linux-hyperv@vger.kernel.org, Sunil Muthuswamy , Marc Zyngier , Arnd Bergmann Subject: [RFC 5/5] PCI: hv: Remove the dependency of pci_config_window Date: Wed, 11 Aug 2021 23:36:19 +0800 Message-Id: <20210811153619.88922-6-boqun.feng@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210811153619.88922-1-boqun.feng@gmail.com> References: <20210811153619.88922-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-20210811_083643_390632_D8D8D0D6 X-CRM114-Status: GOOD ( 12.61 ) 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 The ACPI device information is now correctly set via ->private of pci_host_bridge, therefore no need to use pci_config_window in hv_pcibus_device, so remove it. Note we still need an empty pci_sysdata structure for non-x86, because it's x86-specific. Signed-off-by: Boqun Feng --- drivers/pci/controller/pci-hyperv.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c index fd3792b5edcc..f2b977ef7b84 100644 --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -448,12 +448,17 @@ enum hv_pcibus_state { hv_pcibus_maximum }; +/* + * Defines a empty struct for non-x86 architecture, this is OK because we only + * use this field as an "anchor" to get back to hv_pcibus_device object on + * non-x86 architecture. + */ +#ifndef CONFIG_X86 +struct pci_sysdata { }; +#endif + 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 */