x86: Fix Xen boot on 8-node AMD machines
authorKeir Fraser <keir.fraser@citrix.com>
Fri, 23 May 2008 10:15:19 +0000 (11:15 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Fri, 23 May 2008 10:15:19 +0000 (11:15 +0100)
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. We fix this by first querying the number of nodes from the
first northbridge to avoid the overflow.

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

xen/arch/x86/cpu/amd.c

index f0253152bcf5897135f4f624c3e08e074ea7eaa9..766d645f9029e481e68a1cc06a3fd9dd245bacbc 100644 (file)
@@ -74,9 +74,11 @@ static int c1_ramping_may_cause_clock_drift(struct cpuinfo_x86 *c)
 static void disable_c1_ramping(void) 
 {
        u8 pmm7;
-       int node;
+       int node, nr_nodes;
 
-       for (node=0; node < NR_CPUS; node++) {
+       /* 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. */