]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
x86: Create clflush() inline, remove hardcoded wbinvd
authorH. Peter Anvin <hpa@zytor.com>
Wed, 17 Oct 2007 16:04:37 +0000 (18:04 +0200)
committerThomas Gleixner <tglx@inhelltoy.tec.linutronix.de>
Wed, 17 Oct 2007 18:16:12 +0000 (20:16 +0200)
Create an inline function for clflush(), with the proper arguments,
and use it instead of hard-coding the instruction.

This also removes one instance of hard-coded wbinvd, based on a patch
by Bauder de Oliveira Costa.

[ tglx: arch/x86 adaptation ]

Cc: Andi Kleen <andi@firstfloor.org>
Cc: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
arch/x86/kernel/tce_64.c
arch/x86/mm/pageattr_32.c
arch/x86/mm/pageattr_64.c
drivers/char/agp/efficeon-agp.c
include/asm-x86/system_32.h
include/asm-x86/system_64.h

index e3f2569b2c44140a14d19fc7ab5e0fae0b8047c5..9e540fee70096f692a5179dc3ea9d21d687a14cf 100644 (file)
@@ -40,9 +40,9 @@ static inline void flush_tce(void* tceaddr)
 {
        /* a single tce can't cross a cache line */
        if (cpu_has_clflush)
-               asm volatile("clflush (%0)" :: "r" (tceaddr));
+               clflush(tceaddr);
        else
-               asm volatile("wbinvd":::"memory");
+               wbinvd();
 }
 
 void tce_build(struct iommu_table *tbl, unsigned long index,
index 4241a74d16c8d3181256b9ed7b0c688edb2bfe85..260073c07600da561b2213620cefd5782b7b3720 100644 (file)
@@ -70,10 +70,10 @@ static struct page *split_large_page(unsigned long address, pgprot_t prot,
 
 static void cache_flush_page(struct page *p)
 { 
-       unsigned long adr = (unsigned long)page_address(p);
+       void *adr = page_address(p);
        int i;
        for (i = 0; i < PAGE_SIZE; i += boot_cpu_data.x86_clflush_size)
-               asm volatile("clflush (%0)" :: "r" (adr + i));
+               clflush(adr+i);
 }
 
 static void flush_kernel_map(void *arg)
index 93d795d7c2ae59aa0a9acba7fb1c775dee903b29..8a4f65bf956ea85ef45ecb6157eccceca82f92a5 100644 (file)
@@ -65,7 +65,7 @@ static void cache_flush_page(void *adr)
 {
        int i;
        for (i = 0; i < PAGE_SIZE; i += boot_cpu_data.x86_clflush_size)
-               asm volatile("clflush (%0)" :: "r" (adr + i));
+               clflush(adr+i);
 }
 
 static void flush_kernel_map(void *arg)
index d78cd09186aa6cc1aa20155509ca7fe9a34b317a..cac0009cebc1fb2e18035cae68d8f9d6a8a9741e 100644 (file)
@@ -221,7 +221,7 @@ static int efficeon_create_gatt_table(struct agp_bridge_data *bridge)
                SetPageReserved(virt_to_page((char *)page));
 
                for (offset = 0; offset < PAGE_SIZE; offset += clflush_chunk)
-                       asm volatile("clflush %0" : : "m" (*(char *)(page+offset)));
+                       clflush((char *)page+offset);
 
                efficeon_private.l1_table[index] = page;
 
@@ -268,15 +268,16 @@ static int efficeon_insert_memory(struct agp_memory * mem, off_t pg_start, int t
                *page = insert;
 
                /* clflush is slow, so don't clflush until we have to */
-               if ( last_page &&
-                    ((unsigned long)page^(unsigned long)last_page) & clflush_mask )
-                   asm volatile("clflush %0" : : "m" (*last_page));
+               if (last_page &&
+                   (((unsigned long)page^(unsigned long)last_page) &
+                    clflush_mask))
+                       clflush(last_page);
 
                last_page = page;
        }
 
        if ( last_page )
-               asm volatile("clflush %0" : : "m" (*last_page));
+               clflush(last_page);
 
        agp_bridge->driver->tlb_flush(mem);
        return 0;
index 1d6fb3afa5336a2769a9966fbea9ed96690de4ef..db6283eb5e46d6f53ff24d33b0a5ec091e5a9fd0 100644 (file)
@@ -161,6 +161,10 @@ static inline void native_wbinvd(void)
        asm volatile("wbinvd": : :"memory");
 }
 
+static inline void clflush(volatile void *__p)
+{
+       asm volatile("clflush %0" : "+m" (*(char __force *)__p));
+}
 
 #ifdef CONFIG_PARAVIRT
 #include <asm/paravirt.h>
index fb4bcf99e66514498b9ba836c3f63e3672d6383b..ec4c29bcfcb00a4fe46688ec8bd284f81906ccdf 100644 (file)
@@ -137,6 +137,11 @@ static inline void write_cr8(unsigned long val)
 
 #endif /* __KERNEL__ */
 
+static inline void clflush(volatile void *__p)
+{
+       asm volatile("clflush %0" : "+m" (*(char __force *)__p));
+}
+
 #define nop() __asm__ __volatile__ ("nop")
 
 #ifdef CONFIG_SMP