From patchwork Tue May 10 15:19:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 9059321 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9CFE5BF29F for ; Tue, 10 May 2016 15:23:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AEB4D20154 for ; Tue, 10 May 2016 15:23:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6496C2014A for ; Tue, 10 May 2016 15:23:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751922AbcEJPXI (ORCPT ); Tue, 10 May 2016 11:23:08 -0400 Received: from mail-lf0-f45.google.com ([209.85.215.45]:35715 "EHLO mail-lf0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752532AbcEJPUJ (ORCPT ); Tue, 10 May 2016 11:20:09 -0400 Received: by mail-lf0-f45.google.com with SMTP id j8so18699270lfd.2 for ; Tue, 10 May 2016 08:20:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+YY5ENpaOopC24DQaEuH7ppuMNMjwyq6ON8eF48HVGY=; b=kISNzGRCujvwJtdE9r85jOL0wePOAnlCgAEbRCCMIZU41F9IOgX7CFwgSqtqgAo9py 14hZ7MqiZZm43dineHTZ7WqSeDdu6W/mrNW0SLxf8km3eg+2Kq1LrQp94bweJMpMGSk/ uFVpF1MhAB5ncemLdIKrDtaWkllTqNpCW6y7AZc5pSpeUgsyktfaBAR72sPeov5F1vBa kvC6d56aqAiKpporXj7OW42vqnu8LV4a9OlBkyJa8QU8JzuSDXZgbGUeKdv6I0HQICOc hzRLgFImqS+wOSiqB4xVqjThaQvFyZfxVrv5aPdF9kHZwb/h4P+9KHP9BSTEQTTLxOWl VIpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+YY5ENpaOopC24DQaEuH7ppuMNMjwyq6ON8eF48HVGY=; b=jibbzF+LzCzvmkdO9XP1MuTSsCJTMHYplWEkLu7hhLxAODkn8X1LWtXTmcNlxHDnlu 1PqxUn65Tj6X3nDBZC9/QPrn5GOU+Gbag/b20OOVbTSuVsDiRTMdTpnkVBGq5qVFAzxu Fy9QSg7+BqREorze4bbOqwv8NFSJnsBLTve03dezTrFPHvWNup/X6Q2OVuHx+NTxuRf4 q1rCbkHep0EuYIcaWFydbTcw5CyBfKMwFTfDrhrHndn4muHlKXGHtfqjjGAHA+AUYD3M v9sTl36fMFZf3NVfiXg4/A8HQdzwbt2u/YwUHwxLMAJcYkeCGaqEhTn2sE2CXQ7QdXk5 CtlQ== X-Gm-Message-State: AOPr4FV/wcpiXW+2sg8Dpi9fHUbk0u8dCtQd979Y/oK2GVuRb/qt55/7WvE3E7n9WLTc1g== X-Received: by 10.112.77.230 with SMTP id v6mr8686483lbw.117.1462893607526; Tue, 10 May 2016 08:20:07 -0700 (PDT) Received: from tn-HP-4.semihalf.local (cardhu.semihalf.com. [213.17.239.108]) by smtp.gmail.com with ESMTPSA id s194sm468002lfs.40.2016.05.10.08.20.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 May 2016 08:20:06 -0700 (PDT) From: Tomasz Nowicki To: helgaas@kernel.org, arnd@arndb.de, will.deacon@arm.com, catalin.marinas@arm.com, rafael@kernel.org, hanjun.guo@linaro.org, Lorenzo.Pieralisi@arm.com, okaya@codeaurora.org, jchandra@broadcom.com Cc: robert.richter@caviumnetworks.com, mw@semihalf.com, Liviu.Dudau@arm.com, ddaney@caviumnetworks.com, wangyijing@huawei.com, Suravee.Suthikulpanit@amd.com, msalter@redhat.com, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linaro-acpi@lists.linaro.org, jcm@redhat.com, andrea.gallo@linaro.org, dhdang@apm.com, jeremy.linton@arm.com, liudongdong3@huawei.com, cov@codeaurora.org, Tomasz Nowicki Subject: [PATCH V7 06/11] pci, acpi: Provide a way to assign bus domain number. Date: Tue, 10 May 2016 17:19:56 +0200 Message-Id: <1462893601-8937-7-git-send-email-tn@semihalf.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1462893601-8937-1-git-send-email-tn@semihalf.com> References: <1462893601-8937-1-git-send-email-tn@semihalf.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-8.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch provides a way to set the ACPI domain number in PCI code. pci_create_root_bus is called with NULL as parent in ACPI. This ends up calling pci_bus_assign_domain_nr with a NULL parent. So we define acpi_pci_bus_domain_nr() which is meant to retrieve the PCI domain number based on 'struct pci_bus' in the ACPI way. pci_bus_assign_domain_nr() is updated to call acpi_pci_bus_domain_nr() and assign domain number on the root bus, in case of ACPI. acpi_pci_bus_domain_nr function is stub for now. While at it, for the sake of code clarity we put ACPI and DT domain assign methods into the corresponding helpers. Signed-off-by: Jayachandran C Signed-off-by: Tomasz Nowicki --- drivers/pci/pci.c | 11 +++++++++-- include/linux/pci-acpi.h | 5 +++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index ff97a0b..a1d7bcf 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -4918,7 +4919,7 @@ int pci_get_new_domain_nr(void) } #ifdef CONFIG_PCI_DOMAINS_GENERIC -void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent) +static int of_pci_bus_domain_nr(struct device *parent) { static int use_dt_domains = -1; int domain = -1; @@ -4962,7 +4963,13 @@ void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent) domain = -1; } - bus->domain_nr = domain; + return domain; +} + +void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent) +{ + bus->domain_nr = acpi_disabled ? of_pci_bus_domain_nr(parent) : + acpi_pci_bus_domain_nr(bus); } #endif #endif diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h index 89ab057..09f9f02 100644 --- a/include/linux/pci-acpi.h +++ b/include/linux/pci-acpi.h @@ -111,6 +111,11 @@ static inline void acpi_pci_add_bus(struct pci_bus *bus) { } static inline void acpi_pci_remove_bus(struct pci_bus *bus) { } #endif /* CONFIG_ACPI */ +static inline int acpi_pci_bus_domain_nr(struct pci_bus *bus) +{ + return 0; +} + #ifdef CONFIG_ACPI_APEI extern bool aer_acpi_firmware_first(void); #else