From patchwork Wed Dec 16 15:16:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 7862671 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 CC1BBBEEE1 for ; Wed, 16 Dec 2015 15:22:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DD0502038E for ; Wed, 16 Dec 2015 15:22:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5D66120382 for ; Wed, 16 Dec 2015 15:21:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965794AbbLPPSH (ORCPT ); Wed, 16 Dec 2015 10:18:07 -0500 Received: from mail-wm0-f44.google.com ([74.125.82.44]:36948 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934016AbbLPPSC (ORCPT ); Wed, 16 Dec 2015 10:18:02 -0500 Received: by mail-wm0-f44.google.com with SMTP id p187so5612764wmp.0 for ; Wed, 16 Dec 2015 07:18:02 -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=qcmCzJtWLOqcEhkX0viYFxIXX3VmX6CpMvg/YaSkp7Y=; b=f04DUmDYYx/+P9+avfXLVENyG2l3wBGw2aJOeEe/Pi7Bvap+VcDmXvoq9MTDbdfi2y 6Zw7LmazpQkGEJniLnFNCrfX/X/pXugsvgGZz420K+pV0XY0TLDeL8IOK1CmUMUMhSwL dkgrTtKP1H1sAE2U3ZuYs+pH+Ecp8m7Y+kBSAfwck3tS+tdghhfkBBqIouYqGYjxxiHF /OdpJm4e38IQnCGTtiq/tCmQVO7rIMqVOEyBiI0uDyVr4q+h1DQGpG9tTKKHOnyO+Hjj A907UiLtHfHxsFo/6SmGySeQMLc8z6SbvYmJnzSeRlkC9WpBwlxXpbtUFLTXpkmunAog zP9g== 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=qcmCzJtWLOqcEhkX0viYFxIXX3VmX6CpMvg/YaSkp7Y=; b=ggJGMmSY0ym6nT/fcFhBE96rgjuuXTEufWuA4HXliSHLxh2dcxLBs6ZBs/wnrSEfkO U7FFo5VzdK6QQJyaIontJM7nYvy90+pgM+CXaH24i9fZYg6nvqNNW8TPVluNVWDCuf/Y hKSsVZfv9G5OGkn/bZZGqGPP4EvgrXLixjRYI1mEzdAAobNdgaQ8D9q+t3vcWqvDHAja NM5JcBTNiObb4Hv4qkITjLkEmkynuKbtIu8k7WQxLOc0/SOZWS8EqOWlm3TDZIXxZk/A 7C02ogdjes95dPQiOeKKOE4D4IwonXAGNAI7y8vyfAcHc1iBGiLvkKlPM8T6NwGmsTxg 96UQ== X-Gm-Message-State: ALoCoQlAiJP03Cn6SLnZ1tXUHe71k6ur4AmQhd0fd1CNfk3TAYNI16Jxziyll1GyCMC86tEJ4kXT1oKlkFE67GTgq2mdzX9XhA== X-Received: by 10.28.180.138 with SMTP id d132mr11667861wmf.78.1450279081073; Wed, 16 Dec 2015 07:18:01 -0800 (PST) Received: from tn-HP-4.semihalf.local ([80.82.22.190]) by smtp.gmail.com with ESMTPSA id z17sm6438761wjq.1.2015.12.16.07.17.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 16 Dec 2015 07:18:00 -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 Cc: robert.richter@caviumnetworks.com, mw@semihalf.com, Liviu.Dudau@arm.com, ddaney@caviumnetworks.com, tglx@linutronix.de, 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, jchandra@broadcom.com, jcm@redhat.com, Tomasz Nowicki Subject: [PATCH V2 12/23] pci, acpi: Move ACPI host bridge device companion assignment to core code. Date: Wed, 16 Dec 2015 16:16:22 +0100 Message-Id: <1450278993-12664-13-git-send-email-tn@semihalf.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1450278993-12664-1-git-send-email-tn@semihalf.com> References: <1450278993-12664-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=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,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 pill to pass down parent device reference and both relay on NULL parent in pci_create_root_bus() to validate sysdata content. It looks hacky and prevent us from getting some frimware specific info for PCI host controller e.g. bus domain number. However, it seems we can 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. Signed-off-by: Tomasz Nowicki --- 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 553a029..cad836f 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -2107,6 +2107,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);