From patchwork Thu Feb 4 17:28:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 8226561 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 C1EA59F1C0 for ; Thu, 4 Feb 2016 17:39:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D44F62015A for ; Thu, 4 Feb 2016 17:39:41 +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 EECB22012E for ; Thu, 4 Feb 2016 17:39:40 +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 1aRNql-00082D-IO; Thu, 04 Feb 2016 17:37:47 +0000 Received: from mail-wm0-x235.google.com ([2a00:1450:400c:c09::235]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aRNiu-0006jb-EZ for linux-arm-kernel@lists.infradead.org; Thu, 04 Feb 2016 17:29:44 +0000 Received: by mail-wm0-x235.google.com with SMTP id 128so37636119wmz.1 for ; Thu, 04 Feb 2016 09:29:20 -0800 (PST) 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=9YN1Gd4SpI4A0hkGiy4pI5eOT2i3WQRtTJ5DxLrXgc8=; b=YsiYchKkK6irkntzxYEKAsrXGh8V5GSiipZ2zzEVyxwrOufTTUmbMjKulxPTB3T8ic 0lI0B1rqfS5qlfpYxcO1C3Fvm8itSAz7wDIjDPKL/z2dsp4KWdelWyapGcEGE21MN/3Y XWBNnBPx/5aZlTRxM+W5ifPNToh+WBz4xgCwBfLReEAdtc4hFRswPJjjG8W8+MJ0VWEY 46QV8m4fYqafB9pR7GCdPNRv9YDn1TJbEKOBG34Uso5SESReR0EkhmQZvUncKdCYtgcw W9ok7B0Oy4ff9fCPM1iH1hV8QBftsYkvM1+DGoYmmY6ItskvGAWZ5NPD5zs2I2p9++Vg uNJA== 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=9YN1Gd4SpI4A0hkGiy4pI5eOT2i3WQRtTJ5DxLrXgc8=; b=PgKdqI79jKap/KCJBANgO0YSEOJrapIpd71mwkHMyDDX34T1QeMmO45YllNj6RZiB+ uaiIpCX0njqO+32ilKSJsKu7VJvFW7wo3R9ATVfcitq4d7ZZuz33bPTqPa+DN1UpRqAH 3acKZMJQeW853LMGCCWdW3XAR02ycgwOb5PiCi8LDc0eEnfNTClXsT2++yij+aUW21MF iM7+V4DsK8g4brAOlVYCHmRMmMi0YXmUtsM26D5x+baXP9DdGrhaNX5yhvCUjPXRLfmS bYa7ANqEkWabVhiKtaZFQgbEx/rrLyM+s4j0+zcvcDpqb8mRcPpek21zlmu7++ynlT3R xxrA== X-Gm-Message-State: AG10YOQJFQRiRzMzO7l+DPR1S5c6qVvTcU644dT4QnBE1FnV71SSk8UuSu/2nUtJkodoxA== X-Received: by 10.28.217.74 with SMTP id q71mr31508903wmg.68.1454606958914; Thu, 04 Feb 2016 09:29:18 -0800 (PST) Received: from tn-HP-4.semihalf.local (cardhu.semihalf.com. [213.17.239.108]) by smtp.gmail.com with ESMTPSA id w8sm12238889wjx.21.2016.02.04.09.29.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 04 Feb 2016 09:29:18 -0800 (PST) From: Tomasz Nowicki To: bhelgaas@google.com, arnd@arndb.de, will.deacon@arm.com, catalin.marinas@arm.com, rjw@rjwysocki.net, hanjun.guo@linaro.org, Lorenzo.Pieralisi@arm.com, okaya@codeaurora.org, jiang.liu@linux.intel.com, Stefano.Stabellini@eu.citrix.com Subject: [PATCH V4 11/23] pci, acpi: Move ACPI host bridge device companion assignment to core code. Date: Thu, 4 Feb 2016 18:28:49 +0100 Message-Id: <1454606941-9523-12-git-send-email-tn@semihalf.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1454606941-9523-1-git-send-email-tn@semihalf.com> References: <1454606941-9523-1-git-send-email-tn@semihalf.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160204_092940_913149_B003C686 X-CRM114-Status: GOOD ( 11.37 ) 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: jchandra@broadcom.com, jcm@redhat.com, linaro-acpi@lists.linaro.org, linux-pci@vger.kernel.org, Liviu.Dudau@arm.com, ddaney@caviumnetworks.com, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, robert.richter@caviumnetworks.com, Suravee.Suthikulpanit@amd.com, msalter@redhat.com, wangyijing@huawei.com, Tomasz Nowicki , mw@semihalf.com, linux-arm-kernel@lists.infradead.org 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=-4.5 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 Currently we have two platforms (x86 & ia64) capable of PCI ACPI host bridge initialization. They both use sysdata to pass down parent device reference and both rely on NULL parent in pci_create_root_bus() to validate sysdata content. It looks hacky and prevents us from getting some firmware specific info for PCI host controller e.g. PCI bus domain number. However, we overcome that blocker by passing down parent device via pci_create_root_bus parameter (as the ACPI device type) and using ACPI_COMPANION_SET in core code for ACPI boot method. ACPI_COMPANION_SET is safe to run for all cases DT, ACPI and DT&ACPI. Suggested-by: Lorenzo Pieralisi Signed-off-by: Tomasz Nowicki Tested-by: Duc Dang Tested-by: Dongdong Liu Tested-by: Hanjun Guo Tested-by: Graeme Gregory Tested-by: Sinan Kaya Reviewed-by: Lorenzo Pieralisi --- drivers/acpi/pci_root.c | 5 ++++- drivers/pci/probe.c | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index ae3fe4e..a65c8c2 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -846,7 +846,10 @@ 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, + + /* Root bridge device needs to be sure of parent ACPI type */ + ACPI_COMPANION_SET(&device->dev, device); + bus = pci_create_root_bus(&device->dev, busnum, ops->pci_ops, sysdata, &info->resources); if (!bus) goto out_release_info; diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 6d7ab9b..81dd3a2 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -2100,6 +2100,8 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus, bridge->dev.parent = parent; bridge->dev.release = pci_release_host_bridge_dev; dev_set_name(&bridge->dev, "pci%04x:%02x", pci_domain_nr(b), bus); + ACPI_COMPANION_SET(&bridge->dev, + parent ? to_acpi_device_node(parent->fwnode) : NULL); error = pcibios_root_bridge_prepare(bridge); if (error) { kfree(bridge);