Re: [PATCH 1/3] PCI: Add hide_device support to pci subsystem.

Bjorn Helgaas
2013-07-05T17:29:06Z

On Wed, Jul 3, 2013 at 10:53 PM, Haicheng Li
<haicheng.li@linux.intel.com> wrote:
> On Wed, Jul 03, 2013 at 10:09:32AM -0600, Bjorn Helgaas wrote:
>> On Wed, Jul 3, 2013 at 9:16 AM, Haicheng Li <haicheng.li@linux.intel.com> wrote:
>> > With more and more SOCs having pci device integrated into chip (e.g. Intel
>> > Atom series), it's useful to add an interface to cleanly hide pci devices from
>> > pci device scanning, which is because:
>> >
>> > 1. phone or tablet OEMs may choose disabling some pci device in the SOC,
>> > such as camera ISP in Intel Atom Z2580 chip, and etc.
>> > 2. if such disabled devices are not cleanly removed from pci device tree,
>> > then pci-core will still try to operate on the relative device control
>> > registers while S3 suspend and resume.
>> > 3. so hiding such devices from early begining will not only reduce the kernel
>> > boot time, but also optimize the latency of system suspend and resume.
>>
>> Normally the chip provides a way to disable devices by writing a
>> configuration register. Then the device doesn't respond when Linux
>> enumerates devices, so nothing special is required in the kernel.
> Agreed, this is true.
>
>> What's different about the Z2580? I'd be surprised if Intel forgot to
>> include such a register.
> A pci shim faked by firmware was introduced to help easily port Linux onto Z2XXX
> SOC chips, which enumerates both real and fake PCI devices inside the SOC (The camera ISP
> I mentioned above is a real PCI device in this case)
>
> A detailed tech talk about this technology by Jacob Pan in elc2010 can be found online
> here: http://elinux.org/images/e/ee/Jacob-Pan-x86MID-elc2010.pdf
>
>> Maybe the firmware just isn't smart enough
>> to disable the device? If so, it would be better to fix the firmware
>> than to add kludges in the kernel.
> On PC or server, end-user/OEM can disable/hide a pci device easily thru BIOS setting or
> by hacking BIOS code directly when they find some device is broken or useless.
>
> However on phone or tablet equipment, there is no BIOS-setting alike UI exposed to end-user/developer
> to disable broken device easily (and physically removing the device is not doable on Phone or tablet)
>
> OTOH, this i/f is really *helpful* for kernel developer to power-on a new platform, debug system
> problem, or to do performance tuning of suspend/resume. At least it makes my daily job easier:).
>
> So if people are strongly against this, I would still suggest accept this i/f as a debug i/f
> at least:).
>
>> > To hide pci devices, just pass such parameters to kernel at boot stage:
>> > pci=hide=[<domain>:]<bus>:<slot>.<func>[; ...]

This doesn't seem generally useful to me. It might be useful as a
development aid, and you can easily maintain it as an out-of-tree
patch for that.

Bjorn