From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yijing Wang Subject: Re: [PATCH v10 07/10] OF: Introduce helper function for getting PCI domain_nr Date: Tue, 9 Sep 2014 13:54:21 +0800 Message-ID: <540E960D.7080408@huawei.com> References: <1410184472-17630-1-git-send-email-Liviu.Dudau@arm.com> <1410184472-17630-8-git-send-email-Liviu.Dudau@arm.com> <20140908145459.GO27864@e106497-lin.cambridge.arm.com> <20140908155931.GP27864@e106497-lin.cambridge.arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: Received: from szxga02-in.huawei.com ([119.145.14.65]:34756 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755322AbaIIF5U (ORCPT ); Tue, 9 Sep 2014 01:57:20 -0400 In-Reply-To: <20140908155931.GP27864@e106497-lin.cambridge.arm.com> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Liviu Dudau , Rob Herring Cc: Bjorn Helgaas , Arnd Bergmann , Rob Herring , Jason Gunthorpe , Benjamin Herrenschmidt , Catalin Marinas , Will Deacon , Russell King , linux-pci , Linus Walleij , Tanmay Inamdar , Grant Likely , Sinan Kaya , Jingoo Han , Kukjin Kim , Suravee Suthikulanit , linux-arch , LKML , Device Tree ML , LAKML , "grant.likely@linaro.org" >>> on new requests. This function gets called quite a lot and I'm trying not to >>> make it too heavy weight. >> >> Generally, nothing should be accessing the same DT value frequently. >> It should get cached somewhere. >> > > The problem appears for DTs that don't have the pci-domain info. Then the cached > value is left at the default non-valid value and attempts to rescan the DT will > be made every time the function is called. > >> I don't really understand how domains are used so it's hard to provide >> a recommendation here. Do domains even belong in the DT? > > ACPI calls them segments and the way Bjorn explained it to me at some moment was > that it was an attempt to split up a bus in different groups (or alternatively, > merge a few busses together). To be honest I haven't seen systems where the domain > is anything other than zero, but JasonG (or maybe Benjamin) were floating an > idea of using the domain number to identify physical slots. PCI domain(or named segment) is provided by firmware, in ACPI system, we evaluated it by method "_SEG". in IA64 with ACPI, PCI hostbridge driver retrieves the domain from ACPI, if it's absent, the default domain is zero. So I wonder why in DTS, if it's absent, we get a auto increment domain value. PCI get domain by ACPI "_SEG" in IA64(drivers/acpi/pci_root.c) ...... status = acpi_evaluate_integer(handle, METHOD_NAME__SEG, NULL, &segment); if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { dev_err(&device->dev, "can't evaluate _SEG\n"); result = -ENODEV; goto end; } ....... Thanks! Yijing. > >> This function >> is just a weird mixture of data retrieval and allocation. I think you >> need to separate it into 2 functions. > > It is meant to do allocation with the retrieval being a short-cut (or fine > control if you want). > > I need to think a bit more for a better solution. > > Best regards, > Liviu > >> >> Rob >> > -- Thanks! Yijing