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: 9059461 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9E4509F6FA for ; Tue, 10 May 2016 15:24:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9312120154 for ; Tue, 10 May 2016 15:24:02 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7270520160 for ; Tue, 10 May 2016 15:24:01 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1b09UT-0006qN-4G; Tue, 10 May 2016 15:22:29 +0000 Received: from mail-lf0-x235.google.com ([2a00:1450:4010:c07::235]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1b09SX-0004GZ-FY for linux-arm-kernel@lists.infradead.org; Tue, 10 May 2016 15:20:36 +0000 Received: by mail-lf0-x235.google.com with SMTP id j8so18699277lfd.2 for ; Tue, 10 May 2016 08:20:09 -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=ffGV41RtDBeQcx2iigcjw4XvF1VvZ4mtYUqY/D1c3ilaaRUSKCJOGlHrqRgOECnCPE ubyzwEOdrXuizktHLvc1r4lXJM31v4xDiKyKfNjAYxk1BsE5lYqBKRVxOOaDXlV5fGCT MJCCF9J9q8+1G5i0y8+o+DePP07Vw/8muDv7IdpVqdYYzFH//lk13+qY+w/fDni1tYka 26hXaTj9rBEYWYZ7XZNMSn24i0dTFPEj/41dnUzDJ7H7/zppJbIXUglaW1puAMM0a7DJ OC30O5RRnmwwwC4z7Jk8L0bG4xShT3lde/HANYQRqxh+VopssJ2Et7MMZqPMgSyAR4ST zYjQ== X-Gm-Message-State: AOPr4FVdjWDWBcNaOWzOlIK3HQiuduw6/sV+qMZ1uPKezY0PlFUHNbKL7LTt9dEdweQPbA== 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160510_082030_119551_66692980 X-CRM114-Status: GOOD ( 15.54 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jcm@redhat.com, linaro-acpi@lists.linaro.org, linux-pci@vger.kernel.org, dhdang@apm.com, Liviu.Dudau@arm.com, ddaney@caviumnetworks.com, jeremy.linton@arm.com, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, robert.richter@caviumnetworks.com, cov@codeaurora.org, Suravee.Suthikulpanit@amd.com, msalter@redhat.com, wangyijing@huawei.com, Tomasz Nowicki , mw@semihalf.com, andrea.gallo@linaro.org, linux-arm-kernel@lists.infradead.org, liudongdong3@huawei.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,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