Skip to contentSkip to conversation

xen: don't use PCI BIOS service for configuration space accesses

PATCH Superseded David Vrabel 3 participants 8 messages Apr 13, 2012 – Apr 16, 2012

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen: don't use PCI BIOS service for configuration space accesses

From: David Vrabel <[email protected]>

The accessing PCI configuration space with the PCI BIOS service does not work in PV guests.

This fixes boot on systems without MMCONFIG or where the BIOS hasn't marked the MMCONFIG region as reserved in the e820 map.

---
 arch/x86/xen/enlighten.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
arch/x86/xen/enlighten.c +4 -1
index b132ade..dbb5bb7 100644
@@ -63,6 +63,7 @@
 #include <asm/stackprotector.h>
 #include <asm/hypervisor.h>
 #include <asm/mwait.h>
+#include <asm/pci_x86.h>
 
 #ifdef CONFIG_ACPI
 #include <linux/acpi.h>
@@ -1365,7 +1366,9 @@ asmlinkage void __init xen_start_kernel(void)
 		/* Make sure ACS will be enabled */
 		pci_request_acs();
 	}
-		
+
+	/* PCI BIOS service won't work from a PV guest. */
+	pci_probe &= ~PCI_PROBE_BIOS;
 
 	xen_raw_console_write("about to get started...\n");
 
Signature · 1 line
1.7.2.5
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines
Quoted 1 line
Quoted 1 line · David Vrabel

From: David Vrabel <[email protected]>

The accessing PCI configuration space with the PCI BIOS service does not work in PV guests.

This fixes boot on systems without MMCONFIG or where the BIOS hasn't marked the MMCONFIG region as reserved in the e820 map.

... and where "direct" access doesn't work either? Are there really machines where Xen works on but this doesn't work? (Or, in case this is disabled in your config, is it really useful to have CONFIG_PCI_DIRECT disabled?)

That's just a comment on the description, the patch itself is fine nevertheless (but should probably be sent to the x86 and/or PCI maintainers).

Jan

Quoted 1 line
Quoted 36 lines
---
 arch/x86/xen/enlighten.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
arch/x86/xen/enlighten.c +4 -1
index b132ade..dbb5bb7 100644
@@ -63,6 +63,7 @@
 #include <asm/stackprotector.h>
 #include <asm/hypervisor.h>
 #include <asm/mwait.h>
+#include <asm/pci_x86.h>
 
 #ifdef CONFIG_ACPI
 #include <linux/acpi.h>
@@ -1365,7 +1366,9 @@ asmlinkage void __init xen_start_kernel(void)
 		/* Make sure ACS will be enabled */
 		pci_request_acs();
 	}
-		
+
+	/* PCI BIOS service won't work from a PV guest. */
+	pci_probe &= ~PCI_PROBE_BIOS;
 
 	xen_raw_console_write("about to get started...\n");
 
Signature · 7 lines
1.7.2.5


_______________________________________________
Xen-devel mailing list
[email protected] 
http://lists.xen.org/xen-devel 
#2 lore raw
Quoted 6 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · David Vrabel

From: David Vrabel <[email protected]>

The accessing PCI configuration space with the PCI BIOS service does not work in PV guests.

Quoted 7 lines
Quoted 2 lines

This fixes boot on systems without MMCONFIG or where the BIOS hasn't marked the MMCONFIG region as reserved in the e820 map.

... and where "direct" access doesn't work either? Are there really machines where Xen works on but this doesn't work? (Or, in case this is disabled in your config, is it really useful to have CONFIG_PCI_DIRECT disabled?)

If you have CONFIG_PCI_GOANY (the default) BIOS is preferred over direct. So this change makes it skip BIOS and fall back to direct.

On the system I had saw the problem, the first call into the BIOS service would hang the system.

Quoted 3 lines

That's just a comment on the description, the patch itself is fine nevertheless (but should probably be sent to the x86 and/or PCI maintainers).

I was expecting Konrad to pick it up and forward it to the relevant maintainer as appropriate. Konrad, would you prefer if I sent to direct?

Quoted 43 lines
Quoted 1 line
Quoted 36 lines
---
 arch/x86/xen/enlighten.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
arch/x86/xen/enlighten.c +4 -1
index b132ade..dbb5bb7 100644
@@ -63,6 +63,7 @@
 #include <asm/stackprotector.h>
 #include <asm/hypervisor.h>
 #include <asm/mwait.h>
+#include <asm/pci_x86.h>
 
 #ifdef CONFIG_ACPI
 #include <linux/acpi.h>
@@ -1365,7 +1366,9 @@ asmlinkage void __init xen_start_kernel(void)
 		/* Make sure ACS will be enabled */
 		pci_request_acs();
 	}
-		
+
+	/* PCI BIOS service won't work from a PV guest. */
+	pci_probe &= ~PCI_PROBE_BIOS;
 
 	xen_raw_console_write("about to get started...\n");
 
Signature · 7 lines
1.7.2.5


_______________________________________________
Xen-devel mailing list
[email protected] 
http://lists.xen.org/xen-devel 
#3 lore raw
Quoted 11 lines
Quoted 1 line
Quoted 1 line · David Vrabel
Quoted 9 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · David Vrabel

From: David Vrabel <[email protected]>

The accessing PCI configuration space with the PCI BIOS service does not work in PV guests.

This fixes boot on systems without MMCONFIG or where the BIOS hasn't marked the MMCONFIG region as reserved in the e820 map.

Quoted 7 lines
Quoted 4 lines

... and where "direct" access doesn't work either? Are there really machines where Xen works on but this doesn't work? (Or, in case this is disabled in your config, is it really useful to have CONFIG_PCI_DIRECT disabled?)

If you have CONFIG_PCI_GOANY (the default) BIOS is preferred over direct. So this change makes it skip BIOS and fall back to direct.

How is that? When I look at pci_arch_init(), I see pci_direct_probe() being called first.

Quoted 2 lines

On the system I had saw the problem, the first call into the BIOS service would hang the system.

Sure.

Jan

#4 lore raw
Quoted 16 lines · Jan Beulich
Quoted 16 lines
Quoted 1 line
Quoted 1 line · David Vrabel
Quoted 13 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · David Vrabel

From: David Vrabel <[email protected]>

The accessing PCI configuration space with the PCI BIOS service does not work in PV guests.

This fixes boot on systems without MMCONFIG or where the BIOS hasn't marked the MMCONFIG region as reserved in the e820 map.

... and where "direct" access doesn't work either? Are there really machines where Xen works on but this doesn't work? (Or, in case this is disabled in your config, is it really useful to have CONFIG_PCI_DIRECT disabled?)

Quoted 5 lines
Quoted 2 lines

If you have CONFIG_PCI_GOANY (the default) BIOS is preferred over direct. So this change makes it skip BIOS and fall back to direct.

How is that? When I look at pci_arch_init(), I see pci_direct_probe() being called first.

Hmm. Direct /is/ preferred over BIOS. But the BIOS is initialized even if direct is eventually used and it's the init of the BIOS that dies.

I'll fixup the description to make this clearer.

David

#5 lore raw
In reply to David Vrabel
Quoted 21 lines · David Vrabel
Quoted 6 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · David Vrabel

From: David Vrabel <[email protected]>

The accessing PCI configuration space with the PCI BIOS service does not work in PV guests.

Quoted 7 lines
Quoted 2 lines

This fixes boot on systems without MMCONFIG or where the BIOS hasn't marked the MMCONFIG region as reserved in the e820 map.

... and where "direct" access doesn't work either? Are there really machines where Xen works on but this doesn't work? (Or, in case this is disabled in your config, is it really useful to have CONFIG_PCI_DIRECT disabled?)

If you have CONFIG_PCI_GOANY (the default) BIOS is preferred over direct. So this change makes it skip BIOS and fall back to direct.

On the system I had saw the problem, the first call into the BIOS service would hang the system.

Quoted 6 lines
Quoted 3 lines

That's just a comment on the description, the patch itself is fine nevertheless (but should probably be sent to the x86 and/or PCI maintainers).

I was expecting Konrad to pick it up and forward it to the relevant maintainer as appropriate. Konrad, would you prefer if I sent to direct?

You can send it to me. But I think it makes sense to stick this in arch/x86/pci/xen.c - if it is not to late in teh bootup cycle?

Quoted 44 lines
Quoted 44 lines
Quoted 2 lines
Quoted 36 lines
---
 arch/x86/xen/enlighten.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
arch/x86/xen/enlighten.c +4 -1
index b132ade..dbb5bb7 100644
@@ -63,6 +63,7 @@
 #include <asm/stackprotector.h>
 #include <asm/hypervisor.h>
 #include <asm/mwait.h>
+#include <asm/pci_x86.h>
 
 #ifdef CONFIG_ACPI
 #include <linux/acpi.h>
@@ -1365,7 +1366,9 @@ asmlinkage void __init xen_start_kernel(void)
 		/* Make sure ACS will be enabled */
 		pci_request_acs();
 	}
-		
+
+	/* PCI BIOS service won't work from a PV guest. */
+	pci_probe &= ~PCI_PROBE_BIOS;
 
 	xen_raw_console_write("about to get started...\n");
 
Signature · 7 lines
1.7.2.5


_______________________________________________
Xen-devel mailing list
[email protected] 
http://lists.xen.org/xen-devel 
#6 lore raw
Quoted 3 lines · Konrad Rzeszutek Wilk

But I think it makes sense to stick this in arch/x86/pci/xen.c - if it is not to late in teh bootup cycle?

pci_xen_init() is called early enough I think, but is only called for domU (not dom0). I can change this if you prefer.

David

#7 lore raw
Quoted 7 lines · David Vrabel
Quoted 3 lines · Konrad Rzeszutek Wilk

But I think it makes sense to stick this in arch/x86/pci/xen.c - if it is not to late in teh bootup cycle?

pci_xen_init() is called early enough I think, but is only called for domU (not dom0). I can change this if you prefer.

For dom0 it could be done in: pci_xen_initial_domain ?

Quoted 2 lines

David