From mboxrd@z Thu Jan 1 00:00:00 1970 From: Liviu Dudau Subject: Re: [Patch v7 4/7] PCI/ACPI: Add interface acpi_pci_root_create() Date: Wed, 21 Oct 2015 12:48:40 +0100 Message-ID: <20151021114840.GG3394@e106497-lin.cambridge.arm.com> References: <1444804182-6596-1-git-send-email-jiang.liu@linux.intel.com> <1444804182-6596-5-git-send-email-jiang.liu@linux.intel.com> <562761A1.4020306@linaro.org> <20151021110201.GE3394@e106497-lin.cambridge.arm.com> <562776A5.7000303@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Content-Disposition: inline In-Reply-To: <562776A5.7000303@linaro.org> Sender: linux-pci-owner@vger.kernel.org To: Tomasz Nowicki Cc: Jiang Liu , Bjorn Helgaas , "Rafael J . Wysocki" , Lorenzo Pieralisi , Marc Zyngier , Hanjun Guo , linux-acpi@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org List-Id: linux-acpi@vger.kernel.org On Wed, Oct 21, 2015 at 01:27:33PM +0200, Tomasz Nowicki wrote: > On 21.10.2015 13:02, Liviu Dudau wrote: > >On Wed, Oct 21, 2015 at 11:57:53AM +0200, Tomasz Nowicki wrote: > >>On 14.10.2015 08:29, Jiang Liu wrote: > >>>Introduce common interface acpi_pci_root_create() and related data > >>>structures to create PCI root bus for ACPI PCI host bridges. It wi= ll > >>>be used to kill duplicated arch specific code for IA64 and x86. It= may > >>>also help ARM64 in future. > >>> > >>>Reviewed-by: Lorenzo Pieralisi > >>>Tested-by: Tony Luck > >>>Signed-off-by: Jiang Liu > >>>Signed-off-by: Liu Jiang > >>>--- > >>> drivers/acpi/pci_root.c | 204 ++++++++++++++++++++++++++++++++= ++++++++++++++ > >>> include/linux/pci-acpi.h | 24 ++++++ > >>> 2 files changed, 228 insertions(+) > >>> > >> > >>[...] > >> > >>>+ > >>>+struct pci_bus *acpi_pci_root_create(struct acpi_pci_root *root, > >>>+ struct acpi_pci_root_ops *ops, > >>>+ struct acpi_pci_root_info *info, > >>>+ void *sysdata) > >>>+{ > >>>+ int ret, busnum =3D root->secondary.start; > >>>+ struct acpi_device *device =3D root->device; > >>>+ int node =3D acpi_get_node(device->handle); > >>>+ struct pci_bus *bus; > >>>+ > >>>+ info->root =3D root; > >>>+ info->bridge =3D device; > >>>+ info->ops =3D ops; > >>>+ INIT_LIST_HEAD(&info->resources); > >>>+ snprintf(info->name, sizeof(info->name), "PCI Bus %04x:%02x", > >>>+ root->segment, busnum); > >>>+ > >>>+ if (ops->init_info && ops->init_info(info)) > >>>+ goto out_release_info; > >>>+ if (ops->prepare_resources) > >>>+ ret =3D ops->prepare_resources(info); > >>>+ else > >>>+ ret =3D acpi_pci_probe_root_resources(info); > >>>+ if (ret < 0) > >>>+ goto out_release_info; > >>>+ > >>>+ pci_acpi_root_add_resources(info); > >>>+ pci_add_resource(&info->resources, &root->secondary); > >>>+ bus =3D pci_create_root_bus(NULL, busnum, ops->pci_ops, > >>>+ sysdata, &info->resources); > >> > >>Thank a lot for this cleanup!! > >> > >>I recall you already considered passing segment (domain nr) to > >>pci_create_root_bus, right? Can you please remind me why we gave up= on this? > >> > >>I am asking because currently I can not find the way to retrieve do= main > >>number from pci_bus_assign_domain_nr (for those platforms which cho= ose > >>PCI_DOMAINS_GENERIC and want to use segment nr from MCFG table) whi= ch is the > >>part of pci_create_root_bus. > > > >Not sure I fully understand your question, but pci_bus_assign_domain= _nr() will > >put the assigned domain number in bus->domain_nr if you chose PCI_DO= MAINS_GENERIC. > >Do you want to override that value with the segment nr from MCFG? > > >=20 > Let me give ACPI ARM64 example: >=20 > 1. We parse MCFG table and get segment nr assigned to root bridge > 2. Then PCI host bridge calls acpi_pci_root_create -> pci_create_root= _bus -> > pci_bus_assign_domain_nr > 3. At this point we cannot get segment nr for ACPI >=20 > So I would like to assign MCFG segment nr to bus->domain_nr being in > pci_bus_assign_domain_nr giving we have scenario above. I thought so. What about adding code to pci_bus_assign_domain_nr() to g= et the segment nr from MCFG table? I know the function looks scary and the com= ments don't seem to acknowledge that use_dt_domain static variable has actual= ly 3 possible values (-1, 0, 1) but you can use -1 to mean "try ACPI segment= nr first" (just a suggestion, you or others might have a better idea). Best regards, Liviu >=20 > Thanks, > Tomasz >=20 --=20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D | I would like to | | fix the world, | | but they're not | | giving me the | \ source code! / --------------- =C2=AF\_(=E3=83=84)_/=C2=AF