Re: [PATCH pci] PCI: don't skip probing entire device if first fn OF node has status = "disabled"

From: Jianmin Lv
Date: Fri Jun 02 2023 - 22:36:31 EST




On 2023/6/2 下午6:16, Vladimir Oltean wrote:
Hi Jianmin,

On Fri, Jun 02, 2023 at 03:36:18PM +0800, Jianmin Lv wrote:
On 2023/6/2 下午3:21, Liu Peibao wrote:
Hi all,

It seems that modification for current PCI enumeration framework is
needed to solve the problem. If the effect of this modification is not
easy to evaluate, for the requirement of Loongson, it should be OK that
do the things in Loongson PCI controller driver like discussed
before[1].

Br,
Peibao

[1] https://lore.kernel.org/all/20221114074346.23008-1-liupeibao@xxxxxxxxxxx/


Agree. For current pci core code, all functions of the device will be
skipped if function 0 is not found, even without the patch 6fffbc7ae137
(e.g. the func 0 is disabled in bios by setting pci header to 0xffffffff).
So it seems that there are two ways for the issue:

1. Adjust the pci scan core code to allow separate function to be
enumerated, which will affect widely the pci core code.
2. Only Adjust loongson pci controller driver as Peibao said, and any
function of the device should use platform device in DT if function 0 is
disabled, which is acceptable for loongson.

Thanks,
Jianmin

How about 3. handle of_device_is_available() in the probe function of
the "loongson, pci-gmac" driver? Would that not work?

This way does work only for the specified device. There are other devices, such as HDA, I2S, etc, which have shared pins. Then we have to add of_device_is_available() checking to those drivers one by one. And we are not sure if there are other devices in new generation chips in future. So I'm afraid that the way you mentioned is not suitable for us.

Thanks,
Jianmin