* [PATCH] x86/pci: claim SR-IOV bar in pcibios_allocate_resource
@ 2009-11-15 7:46 Yinghai Lu
2009-11-24 21:19 ` Jesse Barnes
0 siblings, 1 reply; 6+ messages in thread
From: Yinghai Lu @ 2009-11-15 7:46 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Jesse Barnes
Cc: linux-pci, linux-kernel, Yu Zhao, Matthew Wilcox
so use correct allocation from BIOS, instead of later assign another one.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/pci/i386.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Index: linux-2.6/arch/x86/pci/i386.c
===================================================================
--- linux-2.6.orig/arch/x86/pci/i386.c
+++ linux-2.6/arch/x86/pci/i386.c
@@ -155,7 +155,9 @@ static void __init pcibios_allocate_reso
for_each_pci_dev(dev) {
pci_read_config_word(dev, PCI_COMMAND, &command);
- for (idx = 0; idx < PCI_ROM_RESOURCE; idx++) {
+ for (idx = 0; idx < PCI_BRIDGE_RESOURCES; idx++) {
+ if (idx == PCI_ROM_RESOURCE)
+ continue;
r = &dev->resource[idx];
if (r->parent) /* Already allocated */
continue;
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] x86/pci: claim SR-IOV bar in pcibios_allocate_resource
2009-11-15 7:46 [PATCH] x86/pci: claim SR-IOV bar in pcibios_allocate_resource Yinghai Lu
@ 2009-11-24 21:19 ` Jesse Barnes
2009-11-24 21:21 ` Yinghai Lu
0 siblings, 1 reply; 6+ messages in thread
From: Jesse Barnes @ 2009-11-24 21:19 UTC (permalink / raw)
To: Yinghai Lu
Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, linux-pci,
linux-kernel, Yu Zhao, Matthew Wilcox
On Sat, 14 Nov 2009 23:46:46 -0800
Yinghai Lu <yinghai@kernel.org> wrote:
>
> so use correct allocation from BIOS, instead of later assign another
> one.
>
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
>
> ---
> arch/x86/pci/i386.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> Index: linux-2.6/arch/x86/pci/i386.c
> ===================================================================
> --- linux-2.6.orig/arch/x86/pci/i386.c
> +++ linux-2.6/arch/x86/pci/i386.c
> @@ -155,7 +155,9 @@ static void __init pcibios_allocate_reso
>
> for_each_pci_dev(dev) {
> pci_read_config_word(dev, PCI_COMMAND, &command);
> - for (idx = 0; idx < PCI_ROM_RESOURCE; idx++) {
> + for (idx = 0; idx < PCI_BRIDGE_RESOURCES; idx++) {
> + if (idx == PCI_ROM_RESOURCE)
> + continue;
> r = &dev->resource[idx];
> if (r->parent) /* Already
> allocated */ continue;
I'm worried this might have side effects beyond just allocating SR-IOV
BARs, since it looks like we'll walk through all the bridge resources
all the time?
--
Jesse Barnes, Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] x86/pci: claim SR-IOV bar in pcibios_allocate_resource
2009-11-24 21:19 ` Jesse Barnes
@ 2009-11-24 21:21 ` Yinghai Lu
2009-11-24 21:40 ` Jesse Barnes
0 siblings, 1 reply; 6+ messages in thread
From: Yinghai Lu @ 2009-11-24 21:21 UTC (permalink / raw)
To: Jesse Barnes
Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, linux-pci,
linux-kernel, Yu Zhao, Matthew Wilcox
Jesse Barnes wrote:
> On Sat, 14 Nov 2009 23:46:46 -0800
> Yinghai Lu <yinghai@kernel.org> wrote:
>
>> so use correct allocation from BIOS, instead of later assign another
>> one.
>>
>> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
>>
>> ---
>> arch/x86/pci/i386.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> Index: linux-2.6/arch/x86/pci/i386.c
>> ===================================================================
>> --- linux-2.6.orig/arch/x86/pci/i386.c
>> +++ linux-2.6/arch/x86/pci/i386.c
>> @@ -155,7 +155,9 @@ static void __init pcibios_allocate_reso
>>
>> for_each_pci_dev(dev) {
>> pci_read_config_word(dev, PCI_COMMAND, &command);
>> - for (idx = 0; idx < PCI_ROM_RESOURCE; idx++) {
>> + for (idx = 0; idx < PCI_BRIDGE_RESOURCES; idx++) {
>> + if (idx == PCI_ROM_RESOURCE)
>> + continue;
>> r = &dev->resource[idx];
>> if (r->parent) /* Already
>> allocated */ continue;
>
> I'm worried this might have side effects beyond just allocating SR-IOV
> BARs, since it looks like we'll walk through all the bridge resources
> all the time?
/*
* For PCI devices, the region numbers are assigned this way:
*/
enum {
/* #0-5: standard PCI resources */
PCI_STD_RESOURCES,
PCI_STD_RESOURCE_END = 5,
/* #6: expansion ROM resource */
PCI_ROM_RESOURCE,
/* device specific resources */
#ifdef CONFIG_PCI_IOV
PCI_IOV_RESOURCES,
PCI_IOV_RESOURCE_END = PCI_IOV_RESOURCES + PCI_SRIOV_NUM_BARS - 1,
#endif
/* resources assigned to buses behind the bridge */
#define PCI_BRIDGE_RESOURCE_NUM 4
PCI_BRIDGE_RESOURCES,
so will only add IOV BAR related.
YH
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] x86/pci: claim SR-IOV bar in pcibios_allocate_resource
2009-11-24 21:21 ` Yinghai Lu
@ 2009-11-24 21:40 ` Jesse Barnes
2009-11-25 2:05 ` [PATCH] x86/pci: claim SR-IOV bar in pcibios_allocate_resource -v2 Yinghai Lu
0 siblings, 1 reply; 6+ messages in thread
From: Jesse Barnes @ 2009-11-24 21:40 UTC (permalink / raw)
To: Yinghai Lu
Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, linux-pci,
linux-kernel, Yu Zhao, Matthew Wilcox
On Tue, 24 Nov 2009 13:21:45 -0800
Yinghai Lu <yinghai@kernel.org> wrote:
> Jesse Barnes wrote:
> > On Sat, 14 Nov 2009 23:46:46 -0800
> > Yinghai Lu <yinghai@kernel.org> wrote:
> >
> >> so use correct allocation from BIOS, instead of later assign
> >> another one.
> >>
> >> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> >>
> >> ---
> >> arch/x86/pci/i386.c | 4 +++-
> >> 1 file changed, 3 insertions(+), 1 deletion(-)
> >>
> >> Index: linux-2.6/arch/x86/pci/i386.c
> >> ===================================================================
> >> --- linux-2.6.orig/arch/x86/pci/i386.c
> >> +++ linux-2.6/arch/x86/pci/i386.c
> >> @@ -155,7 +155,9 @@ static void __init pcibios_allocate_reso
> >>
> >> for_each_pci_dev(dev) {
> >> pci_read_config_word(dev, PCI_COMMAND, &command);
> >> - for (idx = 0; idx < PCI_ROM_RESOURCE; idx++) {
> >> + for (idx = 0; idx < PCI_BRIDGE_RESOURCES; idx++) {
> >> + if (idx == PCI_ROM_RESOURCE)
> >> + continue;
> >> r = &dev->resource[idx];
> >> if (r->parent) /* Already
> >> allocated */ continue;
> >
> > I'm worried this might have side effects beyond just allocating
> > SR-IOV BARs, since it looks like we'll walk through all the bridge
> > resources all the time?
>
> /*
> * For PCI devices, the region numbers are assigned this way:
> */
> enum {
> /* #0-5: standard PCI resources */
> PCI_STD_RESOURCES,
> PCI_STD_RESOURCE_END = 5,
>
> /* #6: expansion ROM resource */
> PCI_ROM_RESOURCE,
>
> /* device specific resources */
> #ifdef CONFIG_PCI_IOV
> PCI_IOV_RESOURCES,
> PCI_IOV_RESOURCE_END = PCI_IOV_RESOURCES + PCI_SRIOV_NUM_BARS
> - 1, #endif
>
> /* resources assigned to buses behind the bridge */
> #define PCI_BRIDGE_RESOURCE_NUM 4
>
> PCI_BRIDGE_RESOURCES,
>
> so will only add IOV BAR related.
Oh right, *up to* bridge resources... Still we should probably add a
comment about that. SR-IOV is still somewhat new.
--
Jesse Barnes, Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] x86/pci: claim SR-IOV bar in pcibios_allocate_resource -v2
2009-11-24 21:40 ` Jesse Barnes
@ 2009-11-25 2:05 ` Yinghai Lu
2009-12-05 0:00 ` Jesse Barnes
0 siblings, 1 reply; 6+ messages in thread
From: Yinghai Lu @ 2009-11-25 2:05 UTC (permalink / raw)
To: Jesse Barnes, Ingo Molnar, Thomas Gleixner, H. Peter Anvin
Cc: linux-pci, linux-kernel, Matthew Wilcox
so use correct allocation from BIOS, instead of later assign another one.
-v2: use idx_range, so make it more clear
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
arch/x86/pci/i386.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
Index: linux-2.6/arch/x86/pci/i386.c
===================================================================
--- linux-2.6.orig/arch/x86/pci/i386.c
+++ linux-2.6/arch/x86/pci/i386.c
@@ -146,16 +146,29 @@ static void __init pcibios_allocate_bus_
}
}
+struct pci_check_idx_range {
+ int start;
+ int end;
+};
+
static void __init pcibios_allocate_resources(int pass)
{
struct pci_dev *dev = NULL;
- int idx, disabled;
+ int idx, disabled, i;
u16 command;
struct resource *r;
+ struct pci_check_idx_range idx_range[] = {
+ { PCI_STD_RESOURCES, PCI_STD_RESOURCE_END },
+#ifdef CONFIG_PCI_IOV
+ { PCI_IOV_RESOURCES, PCI_IOV_RESOURCE_END },
+#endif
+ };
+
for_each_pci_dev(dev) {
pci_read_config_word(dev, PCI_COMMAND, &command);
- for (idx = 0; idx < PCI_ROM_RESOURCE; idx++) {
+ for (i = 0; i < ARRAY_SIZE(idx_range); i++)
+ for (idx = idx_range[i].start; idx <= idx_range[i].end; idx++) {
r = &dev->resource[idx];
if (r->parent) /* Already allocated */
continue;
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] x86/pci: claim SR-IOV bar in pcibios_allocate_resource -v2
2009-11-25 2:05 ` [PATCH] x86/pci: claim SR-IOV bar in pcibios_allocate_resource -v2 Yinghai Lu
@ 2009-12-05 0:00 ` Jesse Barnes
0 siblings, 0 replies; 6+ messages in thread
From: Jesse Barnes @ 2009-12-05 0:00 UTC (permalink / raw)
To: Yinghai Lu
Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, linux-pci,
linux-kernel, Matthew Wilcox
On Tue, 24 Nov 2009 18:05:12 -0800
Yinghai Lu <yinghai@kernel.org> wrote:
>
> so use correct allocation from BIOS, instead of later assign another
> one.
>
Applied, thanks.
--
Jesse Barnes, Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-12-05 0:01 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-15 7:46 [PATCH] x86/pci: claim SR-IOV bar in pcibios_allocate_resource Yinghai Lu
2009-11-24 21:19 ` Jesse Barnes
2009-11-24 21:21 ` Yinghai Lu
2009-11-24 21:40 ` Jesse Barnes
2009-11-25 2:05 ` [PATCH] x86/pci: claim SR-IOV bar in pcibios_allocate_resource -v2 Yinghai Lu
2009-12-05 0:00 ` Jesse Barnes
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.