Re: [PATCH RFC 07/15] pci: Add pci_probe() and pci_shutdown()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 14, 2016 at 03:23:28PM +0200, Alexander Gordeev wrote:
> On Thu, Apr 14, 2016 at 09:45:57AM +0200, Thomas Huth wrote:
> > On 11.04.2016 13:04, Alexander Gordeev wrote:
> > > Cc: Thomas Huth <thuth@xxxxxxxxxx>
> > > Cc: Andrew Jones <drjones@xxxxxxxxxx>
> > > Signed-off-by: Alexander Gordeev <agordeev@xxxxxxxxxx>
> > > ---
> > >  lib/asm-generic/pci.h | 15 ++++++++++++++-
> > >  lib/pci.c             |  1 -
> > >  lib/pci.h             |  2 ++
> > >  3 files changed, 16 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/lib/asm-generic/pci.h b/lib/asm-generic/pci.h
> > > index 3fa0b2ab1fe6..175b0497ed82 100644
> > > --- a/lib/asm-generic/pci.h
> > > +++ b/lib/asm-generic/pci.h
> > > @@ -1,4 +1,17 @@
> > >  #ifndef _ASM_GENERIC_PCI_H_
> > >  #define _ASM_GENERIC_PCI_H_
> > > -#error need architecture specific asm/pci.h
> > > +
> > > +#ifndef pci_probe
> > > +static inline bool pci_probe(void)
> > > +{
> > > +	return true;
> > > +}
> > > +#endif
> > > +
> > > +#ifndef pci_shutdown
> > > +static inline void pci_shutdown(void)
> > > +{
> > > +}
> > > +#endif
> > > +
> > >  #endif
> > 
> > What are these functions supposed to do exactly? (and why is the default
> > implementation empty?) ... some comments would be really helpful here.
> 
> These two are expected to init/scan and shutdown PCI busses - something
> a firmware or bios do. Only when pci_probe() succeeded all pci_* public
> functions are expected functional.
> 
> They are empty, because this is default implementation. Architectures
> that need initialize PCI bus should override these functions.

I think a function like pci_probe would simply call probe functions for
specific pci controller / host bridges that it knows about. For starters
it'll only know about one. Even the probe code of that host bridge will
be general (i.e. not arch-specific), but it will call arch specific
functions. IOW, these functions should just be in lib/pci.[ch], and only
introduced when they have non-empty bodies. And we should leave
the #error in lib/asm-generic/pci.h

Thanks,
drew

> 
> >  Thomas
> > 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux