All of lore.kernel.org
 help / color / mirror / Atom feed
* [Patch] fix Xen boot on 8 nodes AMD machines
@ 2008-05-23  9:59 Andre Przywara
  0 siblings, 0 replies; only message in thread
From: Andre Przywara @ 2008-05-23  9:59 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 1564 bytes --]

Hi,

in xen/arch/x86/cpu/amd.c the function disable_c1_ramping iterates over 
the northbridges using NR_CPUS as an upper bound for the number of 
nodes. If there are no more northbridges found, it stops iterating. 
Sadly it just adds the northbridge number to 0x18 and uses this as a PCI 
device number, so probing the 9th northbridge on an 8 node system will 
be caught by the newly inserted assertion in pci_conf_read in current 
unstable. The attached patch fixes this by first querying the number of 
nodes from the first northbridge to avoid the overflow. Another possible 
workaround could be to just replace NR_CPUS with 8, which is the current 
nodes limit on the AMD K8/Fam10h architecture.
There is one patch for unstable and another for 3.2-testing and 
3.1-testing. On Xen 3.2 and 3.1 the bug exists, too, but will not stop 
booting, as is will overflow and access the first device on the next 
bus, which seems work for most cases, but is definitely wrong (and 
potentially dangerous).
So please apply to all.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Verified by Mark.Johnson@sun.com

Regards,
Andre.
-- 
Andre Przywara
AMD-Operating System Research Center (OSRC), Dresden, Germany
Tel: +49 351 277-84917
----to satisfy European Law for business letters:
AMD Saxony Limited Liability Company & Co. KG,
Wilschdorfer Landstr. 101, 01109 Dresden, Germany
Register Court Dresden: HRA 4896, General Partner authorized
to represent: AMD Saxony LLC (Wilmington, Delaware, US)
General Manager of AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy

[-- Attachment #2: 8nodes_3.2_3.1.patch --]
[-- Type: text/plain, Size: 693 bytes --]

diff -r 0016f5a1dd5a xen/arch/x86/cpu/amd.c
--- a/xen/arch/x86/cpu/amd.c	Thu May 15 15:11:29 2008 +0100
+++ b/xen/arch/x86/cpu/amd.c	Fri May 23 10:46:27 2008 +0200
@@ -86,9 +86,11 @@ static void disable_c1_ramping(void)
 static void disable_c1_ramping(void) 
 {
 	u8 pmm7;
-	int node;
-
-	for (node=0; node < NR_CPUS; node++) {
+	int node, nr_nodes;
+
+	/* read the number of nodes from the first northbridge */
+	nr_nodes = ((pci_read_byte(0, 0x18, 0x0, 0x60)>>4)&0x07)+1;
+	for (node=0; node < nr_nodes; node++) {
 		/* PMM7: bus=0, dev=0x18+node, function=0x3, register=0x87. */
 		pmm7 = pci_read_byte(0, 0x18+node, 0x3, 0x87);
 		/* Invalid read means we've updated every Northbridge. */

[-- Attachment #3: 8nodes_unstable.patch --]
[-- Type: text/plain, Size: 696 bytes --]

diff -r 2e6a51378451 xen/arch/x86/cpu/amd.c
--- a/xen/arch/x86/cpu/amd.c	Thu May 22 15:11:06 2008 +0100
+++ b/xen/arch/x86/cpu/amd.c	Fri May 23 10:42:31 2008 +0200
@@ -74,9 +74,11 @@ static void disable_c1_ramping(void)
 static void disable_c1_ramping(void) 
 {
 	u8 pmm7;
-	int node;
-
-	for (node=0; node < NR_CPUS; node++) {
+	int node, nr_nodes;
+
+	/* read the number of nodes from the first northbridge */
+	nr_nodes = ((pci_conf_read32(0, 0x18, 0x0, 0x60)>>4)&0x07)+1;
+	for (node=0; node < nr_nodes; node++) {
 		/* PMM7: bus=0, dev=0x18+node, function=0x3, register=0x87. */
 		pmm7 = pci_conf_read8(0, 0x18+node, 0x3, 0x87);
 		/* Invalid read means we've updated every Northbridge. */

[-- Attachment #4: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-05-23  9:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-23  9:59 [Patch] fix Xen boot on 8 nodes AMD machines Andre Przywara

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.