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

Haicheng Li
2013-07-09T14:22:12Z

On Sun, Jul 07, 2013 at 10:43:35AM +0800, Jiang Liu wrote:
> On 07/04/2013 12:09 AM, 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.
> > What's different about the Z2580? I'd be surprised if Intel forgot to
> > include such a register. 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.

Sorry for slow response due to a travel recently.
> Agree, it would be great if chipset and firmware could cooperate to
> handle this issue. Otherwise the interface may be abused and causes
> trouble to PCI hotplug operations because the notation seg:bus:dev.func
> isn't reliable. The PCI bus number may reassigned by OS.
I quickly went thru the code and thought the bus # should not be changed in runtime
by current code. do you mean after a reboot, the bus# maybe changed with new slot hotplugged?

Can you please elabrate this case? hopefully I can enhance the patch to cover it.

> >
> >> To hide pci devices, just pass such parameters to kernel at boot stage:
> >> pci=hide=[<domain>:]<bus>:<slot>.<func>[; ...]