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@xxxxxxx>
Verified by Mark.Johnson@xxxxxxx
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
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. */
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. */
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|