From patchwork Wed Jan 20 13:40:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Nowicki X-Patchwork-Id: 8072151 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@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 48C429F818 for ; Wed, 20 Jan 2016 13:42:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7085220434 for ; Wed, 20 Jan 2016 13:42:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7B42620443 for ; Wed, 20 Jan 2016 13:42:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932744AbcATNmO (ORCPT ); Wed, 20 Jan 2016 08:42:14 -0500 Received: from mail-wm0-f49.google.com ([74.125.82.49]:33264 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933132AbcATNmM (ORCPT ); Wed, 20 Jan 2016 08:42:12 -0500 Received: by mail-wm0-f49.google.com with SMTP id 123so133237115wmz.0 for ; Wed, 20 Jan 2016 05:42:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-type:content-transfer-encoding; bh=0C9w0Ad+jdB0xhVBQdwenp0LE9nkgaBaY5qysW2w9aQ=; b=ghdoYLdA4/6Q4+lVjDYJpiJp7rrKqOgCJqVeMsRaOTIVCsvxCxjS/zDaEtM/w3GnIS JGQQL3emOWYYDv0fHw2WcaKMQ/jur6lDuN0e3lEMjXd/GjN1UX8+s6sSmDxAu9h+LckA NCeByU6p43MxjwZwHviXIJMDyL3MwA9gh+dzhK8OYzHnEWnHzHSojYKNxfyyFbc66xEd YUDQPs48ffYzz4wcRVEa0nx9e9Gia7Ndv8pD6we9xZ4PWQ9V4wXhaNS16TPCBUkqqNqJ rZfrg6MNR7tRRMfoyhYFqjpG1JEWwIR3w7Vazl1svdrVf21tj4YLg/FE8oJAqjcejqkx gH+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=0C9w0Ad+jdB0xhVBQdwenp0LE9nkgaBaY5qysW2w9aQ=; b=l9Tn9RYIzQuh+mipwavX8C7nmIR0jhfAQwByqcbyXvHiO8C9VTg2tqVErTnKHILSZy KoiGcyABgHOfQ8+oTmRgUSfYBt/BDn7dTbUG9wL96+f8LQaqgBZdFlFzej03jamyb7wT IxYdYyrVpmHz8F6BhTZfe6hkgJbwQNNtJxAHv4EmsKnRarMw7qDgXcCK3DY/tjvSQvGk OIcDuewm1KhW6EIRHTCHTKpNfXHKdgCdQ1x+HxBFNqSjEWCZR8D+KGPwzbaubvtDoPD0 w6kft/t7kHCJZgOU2PI4viMXmgeYDwUepqg6bFvHL3vQJTnLOiahKBeZS8GNPCer2Uap Ocbg== X-Gm-Message-State: ALoCoQlG8wRhtne+KKZMZ4DqKQsdfDgijkaeqIqz6gcEtv4EYwEO58HFtLuuW3HNBcWraZ2TZUsHZP8g59CY30EVCIWv1oEfhw== X-Received: by 10.194.60.231 with SMTP id k7mr35792037wjr.61.1453297330369; Wed, 20 Jan 2016 05:42:10 -0800 (PST) Received: from [10.0.0.11] ([80.82.22.190]) by smtp.googlemail.com with ESMTPSA id 198sm25262652wml.22.2016.01.20.05.42.08 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 20 Jan 2016 05:42:09 -0800 (PST) Subject: Re: [PATCH V3 11/21] pci, acpi: Move ACPI host bridge device companion assignment to core code. To: Lorenzo Pieralisi References: <1452691267-32240-1-git-send-email-tn@semihalf.com> <1452691267-32240-12-git-send-email-tn@semihalf.com> <20160119160224.GD5276@red-moon> <569F6D67.5000000@semihalf.com> <20160120123849.GA13437@red-moon> Cc: bhelgaas@google.com, arnd@arndb.de, will.deacon@arm.com, catalin.marinas@arm.com, rjw@rjwysocki.net, hanjun.guo@linaro.org, okaya@codeaurora.org, jiang.liu@linux.intel.com, Stefano.Stabellini@eu.citrix.com, 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 From: Tomasz Nowicki Message-ID: <569F8E38.5030101@semihalf.com> Date: Wed, 20 Jan 2016 14:40:08 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <20160120123849.GA13437@red-moon> 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,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 On 20.01.2016 13:38, Lorenzo Pieralisi wrote: > On Wed, Jan 20, 2016 at 12:20:07PM +0100, Tomasz Nowicki wrote: >> On 19.01.2016 17:02, Lorenzo Pieralisi wrote: >>> On Wed, Jan 13, 2016 at 02:20:57PM +0100, Tomasz Nowicki wrote: >> [...] >>>> device via pci_create_root_bus parameter (as the ACPI device type) >>> >>> I do not understand what you mean by "as the ACPI device type". >> >> See below. >> >>> >>>> 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 >>>> --- >>>> 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); >>> >>> I do not understand why the code above is needed, can you elaborate >>> please ? >>> >> >> This makes sure that device->dev can be identified as ACPI device, >> so we can use to_acpi_device_node() and assign companion safely >> below. > > I do not follow. If you refer to the fwnode handle type, that is > already set by ACPI core code (before acpi_pci_root_add() is called, > in acpi_init_device_object()). acpi_init_device_object() sets ACPI fwnode handle type only for "device", but not for "device->dev" which is what is passed as an argument to pci_create_root_bus(). Without ACPI_COMPANION_SET(&device->dev, device) here, no one can be sure if we have ACPI device in pci_create_root_bus(). > > Did you add the code above to solve a real issue you encountered ? Yes. You can try to run series with this patch: Thanks, Tomasz --- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 88c9d20..1b74bf6 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -967,7 +967,11 @@ struct pci_bus *acpi_pci_root_create(struct acpi_pci_root *root, pci_add_resource(&info->resources, &root->secondary); - /* Root bridge device needs to be sure of parent ACPI type */ - ACPI_COMPANION_SET(&device->dev, device); + if (to_acpi_device_node(device->dev.fwnode) == NULL) + pr_err("NON-ACPI TYPE\n"); + else + pr_err("ACPI TYPE\n"); + bus = pci_create_root_bus(&device->dev, busnum, ops->pci_ops, sysdata, &info->resources);