Hi, Julien!
On 23.11.21 18:05, Julien Grall wrote: > Hi Oleksandr, > > On 23/11/2021 06:31, Oleksandr Andrushchenko wrote: >> >> >> On 22.11.21 19:17, Julien Grall wrote: >>> Hi, >>> >>> On 22/11/2021 16:23, Oleksandr Andrushchenko wrote: >>>> On 22.11.21 17:29, Julien Grall wrote: >>>>> I would prefer to go with my way. This can be refined in the future if we >>>>> find Device-Tree that matches what you wrote. >>>> Ok, so just to make it clear: >>>> >a PCI device would always be described as a child of the hostbridges. >>>> So I would rework the 'if' to also check if the parent type is not "pci" >>> >>> That's correct. Thank you! >> Ok, so how about >> if ( is_pci_passthrough_enabled() && dt_device_type_is_equal(node, >> "pci") ) >> { >> bool skip = false; >> >> /* >> * If the parent is also a "pci" device, then "linux,pci-domain" >> * should already be there, so nothing to do then. >> */ > > This comment is a bit confusing. Do you have something on your mind? > I think what matter if the parent is a "pci" device, then the current node > must not be a hostbridge. So we can skip it. By skipping you only mean we do not need to add/assign "linux,pci-domain", right? > However... > >> if ( node->parent && dt_device_type_is_equal(node->parent, "pci") ) >> skip = true; >> >> if ( !skip && !dt_find_property(node, "linux,pci-domain", NULL) ) >> { >> I played with a single if and it looks scary... > > ... how about introducing an helper that will return true if this node is > likely an hostbridge? This is yet a single use of such a check: why would we need a helper and what would that helper do? > > Cheers, > Thank you, Oleksandr