From: Keir Fraser Date: Fri, 23 May 2008 10:16:44 +0000 (+0100) Subject: x86: Fix Xen boot on 8-node AMD machines X-Git-Tag: 3.2.2-rc1~42 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=f3fb8b44ea019dc526807a9d4b9e2c4a5db97c0e;p=people%2Fvhanquez%2Fxen.git x86: Fix Xen boot on 8-node AMD machines 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 Verified by Mark.Johnson@sun.com xen-unstable changeset: 17712:5cc5b9c37c6d429502e75536822810219b23b033 xen-unstable date: Fri May 23 11:15:19 2008 +0100 --- diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c index 909a73f3f..5e68174a7 100644 --- a/xen/arch/x86/cpu/amd.c +++ b/xen/arch/x86/cpu/amd.c @@ -86,9 +86,11 @@ static void pci_write_byte(u32 bus, u32 dev, u32 fn, u32 reg, u8 val) 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_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. */