Re: [PATCH V5 07/15] pci, acpi: Provide generic way to assign bus domain number.

From: Tomasz Nowicki
Date: Wed Feb 17 2016 - 10:35:41 EST


On 17.02.2016 16:21, Jayachandran Chandrashekaran Nair wrote:
On Wed, Feb 17, 2016 at 8:35 PM, Tomasz Nowicki <tn@xxxxxxxxxxxx> wrote:
On 17.02.2016 15:21, Jayachandran Chandrashekaran Nair wrote:

On Wed, Feb 17, 2016 at 7:37 PM, Tomasz Nowicki <tn@xxxxxxxxxxxx> wrote:

On 17.02.2016 14:44, Jayachandran Chandrashekaran Nair wrote:


Tomasz, Lorenzo,

On Tue, Feb 16, 2016 at 7:23 PM, Tomasz Nowicki<tn@xxxxxxxxxxxx> wrote:


As we now have valid PCI host bridge device reference we can
introduce code that is going to find its bus domain number using
ACPI _SEG method.

Note that _SEG method is optional, therefore _SEG absence means
that all PCI buses belong to domain 0.

While at it, for the sake of code clarity we put ACPI and DT domain
assign methods into the corresponding helpers.


In my patchset, I had a slightly different and I think better approach
for
this without calling the _SEG method again. Please see
http://www.spinics.net/lists/arm-kernel/msg478167.html
at the last part
ofhttp://www.spinics.net/lists/arm-kernel/msg478169.html


Relying on NULL parent device to make decision on boot method is really
ugly
way. This may hit us again once we want to obtain another firmware
specific
info e.g. numa node. IMO we need to fix it this way.


I am not relying on NULL there, in the current code parent is NULL
in case of ACPI, and the check is needed not to crash (unless that
has changed).


This series passes down valid parent, see [PATCH V5 06/15].


The main part was the macro acpi_pci_get_segment() and the use
of acpi_pci_root_info from sysdata to do this.


Since we can obtain related firmware specific data from valid parent device
(without defining another accessors), I do not see the point to use sysdata.
Let me know your opinion.

In the patch, you use the parent info and call _SEG method again.
The segment information is available in the ->root->segment of
acpi_pci_root_info if you setup the sysdata like in my patch

I know it is in sysdata->root->segment, but the way it is passed down is wrong. sysdata is the pointer to unknown content (void *) so we need to validate it before we can use it. If we merge this patch we can remove first _SEG call.

Tomasz