| 
         
xen-devel
[Xen-devel] Re: [PATCH 06/10] x86/PCI: Enable scanning of all pci	functi
 
| 
To:  | 
Jeremy Fitzhardinge <jeremy@xxxxxxxx> | 
 
| 
Subject:  | 
[Xen-devel] Re: [PATCH 06/10] x86/PCI: Enable scanning of all pci	functions | 
 
| 
From:  | 
Jesse Barnes <jbarnes@xxxxxxxxxxxxxxxx> | 
 
| 
Date:  | 
Wed, 13 May 2009 10:23:16 -0700 | 
 
| 
Cc:  | 
Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>, Jeremy,	Joerg Roedel <joerg.roedel@xxxxxxx>,	the arch/x86 maintainers <x86@xxxxxxxxxx>,	Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx>,	FUJITA Tomonori <fujita.tomonori@xxxxxxxxxxxxx>,	Alex Nixon <alex.nixon@xxxxxxxxxx>,	Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>,	Matthew Wilcox <willy@xxxxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxx> | 
 
| 
Delivery-date:  | 
Wed, 13 May 2009 12:24:03 -0700 | 
 
| 
Domainkey-signature:  | 
a=rsa-sha1; q=dns; c=nofws; s=default; d=virtuousgeek.org;	h=Received:Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References:X-Mailer:Mime-Version:Content-Type:Content-Transfer-Encoding:X-Identified-User;	b=JsP3uL56Qb/N22RWDfAimHFNegHbFGfuzOKXJ+48Pgo3P4Djr2T0w5LdRe1safmLkeJRm5SiLUd66gndZr5KyROWCJTc/AJR/beCQuuJ7Ek6v5Rh3yUkCggWSLLSj0zk; | 
 
| 
Envelope-to:  | 
www-data@xxxxxxxxxxxxxxxxxxx | 
 
| 
In-reply-to:  | 
<4A0AFE84.2040805@xxxxxxxx> | 
 
| 
List-help:  | 
<mailto:xen-devel-request@lists.xensource.com?subject=help> | 
 
| 
List-id:  | 
Xen developer discussion <xen-devel.lists.xensource.com> | 
 
| 
List-post:  | 
<mailto:xen-devel@lists.xensource.com> | 
 
| 
List-subscribe:  | 
<http://lists.xensource.com/mailman/listinfo/xen-devel>,	<mailto:xen-devel-request@lists.xensource.com?subject=subscribe> | 
 
| 
List-unsubscribe:  | 
<http://lists.xensource.com/mailman/listinfo/xen-devel>,	<mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe> | 
 
| 
References:  | 
<1242164891-3859-1-git-send-email-jeremy@xxxxxxxx>	<1242164891-3859-7-git-send-email-jeremy@xxxxxxxx>	<20090513095535.140134e1@jbarnes-g45> <4A0AFE84.2040805@xxxxxxxx> | 
 
| 
Sender:  | 
xen-devel-bounces@xxxxxxxxxxxxxxxxxxx | 
 
 
 
On Wed, 13 May 2009 10:08:20 -0700
Jeremy Fitzhardinge <jeremy@xxxxxxxx> wrote:
> Jesse Barnes wrote:
> > On Tue, 12 May 2009 14:48:07 -0700
> > Jeremy Fitzhardinge <jeremy@xxxxxxxx> wrote:
> >
> >   
> >> From: Alex Nixon <alex.nixon@xxxxxxxxxx>
> >>
> >> Xen may want to enable scanning of all pci functions - if for
> >> example the device at function 0 is not passed through to the
> >> guest, but the device at function 1 is.
> >>
> >> [Impact: allow passthrough of just some PCI functions.]
> >> Signed-off-by: Alex Nixon <alex.nixon@xxxxxxxxxx>
> >> Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>
> >> Reviewed-by: "H. Peter Anvin" <hpa@xxxxxxxxx>
> >> Reviewed-by: Matthew Wilcox <willy@xxxxxxxxxxxxxxx>
> >> ---
> >>  arch/x86/include/asm/pci.h |    8 +++++++-
> >>  arch/x86/pci/common.c      |    1 +
> >>  2 files changed, 8 insertions(+), 1 deletions(-)
> >>
> >> diff --git a/arch/x86/include/asm/pci.h
> >> b/arch/x86/include/asm/pci.h index b51a1e8..092706e 100644
> >> --- a/arch/x86/include/asm/pci.h
> >> +++ b/arch/x86/include/asm/pci.h
> >> @@ -21,6 +21,7 @@ struct pci_sysdata {
> >>  extern int pci_routeirq;
> >>  extern int noioapicquirk;
> >>  extern int noioapicreroute;
> >> +extern int pci_scan_all_fns;
> >>  
> >>  /* scan a bus after allocating a pci_sysdata for it */
> >>  extern struct pci_bus *pci_scan_bus_on_node(int busno, struct
> >> pci_ops *ops, @@ -48,7 +49,11 @@ extern unsigned int
> >> pcibios_assign_all_busses(void); #else
> >>  #define pcibios_assign_all_busses()       0
> >>  #endif
> >> -#define pcibios_scan_all_fns(a, b)        0
> >> +
> >> +static inline int pcibios_scan_all_fns(struct pci_bus *bus, int
> >> devfn) +{
> >> +  return pci_scan_all_fns;
> >> +}
> >>  
> >>  extern unsigned long pci_mem_start;
> >>  #define PCIBIOS_MIN_IO            0x1000
> >> @@ -130,6 +135,7 @@ extern void pci_iommu_alloc(void);
> >>  
> >>  /* generic pci stuff */
> >>  #include <asm-generic/pci.h>
> >> +#undef pcibios_scan_all_fns
> >>     
> >
> > This is a little gross... But then I don't see any places where it's
> > actually defined to something true either.
> 
> I've got some code to set it in a series I haven't posted yet.
> 
> >   Maybe it should be a weak
> > function or a new HAVE_FOO define instead.
> >   
> 
> I'd probably go the weak function path if I were to do either of
> those, but do you think it would be significantly better?
Well it would avoid the #undef, which is the gross part.  But since
it's just a boolean, you could also do
#ifndef PCI_SCAN_ALL_FNS
#define PCI_SCAN_ALL_FNS 0
#endif
in the generic code, then just set it to 1 before asm-generic/pci.h
gets included.  That would mean updating arch code though.
Anyway it's not a big deal, this code is already ugly (a 0 define for
all arches?  why?) so you shouldn't have to spend too much time
cleaning it up.
-- 
Jesse Barnes, Intel Open Source Technology Center
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
 |   
 
 | 
    |