[PATCH] AGP: Make gart iterator in K8 AGP driver SMP safe
authorAndi Kleen <ak@suse.de>
Sat, 5 Nov 2005 16:25:54 +0000 (17:25 +0100)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 15 Nov 2005 03:55:16 +0000 (19:55 -0800)
Ugh!

Cc: davej@redhat.com
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/char/agp/amd64-agp.c

index ec36c833387baf2ea509e1f0d8ae31abb5ecb2f5..49996c692a734cdb8784cc247871d8c73cb99bb7 100644 (file)
@@ -58,7 +58,6 @@ static struct pci_dev * hammers[MAX_HAMMER_GARTS];
 static struct resource *aperture_resource;
 static int __initdata agp_try_unsupported = 1;
 
-static int gart_iterator;
 #define for_each_nb() for(gart_iterator=0;gart_iterator<nr_garts;gart_iterator++)
 
 static void flush_amd64_tlb(struct pci_dev *dev)
@@ -72,6 +71,7 @@ static void flush_amd64_tlb(struct pci_dev *dev)
 
 static void amd64_tlbflush(struct agp_memory *temp)
 {
+       int gart_iterator;
        for_each_nb()
                flush_amd64_tlb(hammers[gart_iterator]);
 }
@@ -221,6 +221,7 @@ static struct aper_size_info_32 amd_8151_sizes[7] =
 static int amd_8151_configure(void)
 {
        unsigned long gatt_bus = virt_to_gart(agp_bridge->gatt_table_real);
+       int gart_iterator;
 
        /* Configure AGP regs in each x86-64 host bridge. */
        for_each_nb() {
@@ -234,7 +235,7 @@ static int amd_8151_configure(void)
 static void amd64_cleanup(void)
 {
        u32 tmp;
-
+       int gart_iterator;
        for_each_nb() {
                /* disable gart translation */
                pci_read_config_dword (hammers[gart_iterator], AMD64_GARTAPERTURECTL, &tmp);