Jesse Keating 2f82dda
PCI: Use generic cacheline sizing instead of per-vendor tests.
Jesse Keating 2f82dda
Jesse Keating 2f82dda
Instead of the pci code needing to have code to determine the
Jesse Keating 2f82dda
cacheline size of each processor, use the data the cpu identification
Jesse Keating 2f82dda
code should have already determined during early boot.
Jesse Keating 2f82dda
Jesse Keating 2f82dda
I chose not to delete the existing code for the time being.
Jesse Keating 2f82dda
Instead I added some additional debug statements to be sure that it's
Jesse Keating 2f82dda
doing the right thing, and compares it against what the old code would
Jesse Keating 2f82dda
have done.  After this has been proven to be right in a release,
Jesse Keating 2f82dda
we can delete the paranoid checks, and all the old vendor checking code.
Jesse Keating 2f82dda
Jesse Keating 2f82dda
Signed-off-by: Dave Jones <davej@redhat.com>
Jesse Keating 2f82dda
Jesse Keating 2f82dda
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
Jesse Keating 2f82dda
index 2202b62..f371fe8 100644
Jesse Keating 2f82dda
--- a/arch/x86/pci/common.c
Jesse Keating 2f82dda
+++ b/arch/x86/pci/common.c
Jesse Keating 2f82dda
@@ -432,6 +432,22 @@ int __init pcibios_init(void)
Jesse Keating 2f82dda
 	else if (c->x86 > 6 && c->x86_vendor == X86_VENDOR_INTEL)
Jesse Keating 2f82dda
 		pci_cache_line_size = 128 >> 2;	/* P4 */
Jesse Keating 2f82dda
 
Jesse Keating 2f82dda
+	if (c->x86_clflush_size != (pci_cache_line_size <<2))
Jesse Keating 2f82dda
+		printk(KERN_DEBUG "PCI: old code would have set cacheline "
Jesse Keating 2f82dda
+			"size to %d bytes, but clflush_size = %d\n",
Jesse Keating 2f82dda
+			pci_cache_line_size << 2,
Jesse Keating 2f82dda
+			c->x86_clflush_size);
Jesse Keating 2f82dda
+
Jesse Keating 2f82dda
+	/* Once we know this logic works, all the above code can be deleted. */
Jesse Keating 2f82dda
+	if (c->x86_clflush_size > 0) {
Jesse Keating 2f82dda
+		pci_cache_line_size = c->x86_clflush_size >> 2;
Jesse Keating 2f82dda
+		printk(KERN_DEBUG "PCI: pci_cache_line_size set to %d bytes\n",
Jesse Keating 2f82dda
+			pci_cache_line_size << 2);
Jesse Keating 2f82dda
+	} else {
Jesse Keating 2f82dda
+		pci_cache_line_size = 32 >> 2;
Jesse Keating 2f82dda
+		printk(KERN_DEBUG "PCI: Unknown cacheline size. Setting to 32 bytes\n");
Jesse Keating 2f82dda
+	}
Jesse Keating 2f82dda
+
Jesse Keating 2f82dda
 	pcibios_resource_survey();
Jesse Keating 2f82dda
 
Jesse Keating 2f82dda
 	if (pci_bf_sort >= pci_force_bf)