From 9f0fc191371843c4fc000a226b0a26b6c059aacd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 18 May 2024 19:40:19 +0200 Subject: Merging upstream version 6.7.7. Signed-off-by: Daniel Baumann --- arch/m68k/include/asm/bitops.h | 21 ++++++++++ arch/m68k/include/asm/cacheflush_mm.h | 1 + arch/m68k/include/asm/dvma.h | 8 +++- arch/m68k/include/asm/fb.h | 19 ++++----- arch/m68k/include/asm/io_mm.h | 24 ++++++------ arch/m68k/include/asm/irq.h | 5 +++ arch/m68k/include/asm/kexec.h | 4 +- arch/m68k/include/asm/mcfgpio.h | 8 ++-- arch/m68k/include/asm/nettel.h | 5 +-- arch/m68k/include/asm/oplib.h | 4 +- arch/m68k/include/asm/page_mm.h | 45 +++++++++++---------- arch/m68k/include/asm/pgtable.h | 9 +++++ arch/m68k/include/asm/pgtable_no.h | 1 - arch/m68k/include/asm/raw_io.h | 32 ++++++++------- arch/m68k/include/asm/sun3_pgalloc.h | 10 ++--- arch/m68k/include/asm/syscalls.h | 19 +++++++++ arch/m68k/include/asm/tlbflush.h | 73 +++++++++++++++++------------------ 17 files changed, 175 insertions(+), 113 deletions(-) create mode 100644 arch/m68k/include/asm/syscalls.h (limited to 'arch/m68k/include') diff --git a/arch/m68k/include/asm/bitops.h b/arch/m68k/include/asm/bitops.h index e984af71df..14c64a6f12 100644 --- a/arch/m68k/include/asm/bitops.h +++ b/arch/m68k/include/asm/bitops.h @@ -319,6 +319,27 @@ arch___test_and_change_bit(unsigned long nr, volatile unsigned long *addr) return test_and_change_bit(nr, addr); } +static inline bool xor_unlock_is_negative_byte(unsigned long mask, + volatile unsigned long *p) +{ +#ifdef CONFIG_COLDFIRE + __asm__ __volatile__ ("eorl %1, %0" + : "+m" (*p) + : "d" (mask) + : "memory"); + return *p & (1 << 7); +#else + char result; + char *cp = (char *)p + 3; /* m68k is big-endian */ + + __asm__ __volatile__ ("eor.b %1, %2; smi %0" + : "=d" (result) + : "di" (mask), "o" (*cp) + : "memory"); + return result; +#endif +} + /* * The true 68020 and more advanced processors support the "bfffo" * instruction for finding bits. ColdFire and simple 68000 parts diff --git a/arch/m68k/include/asm/cacheflush_mm.h b/arch/m68k/include/asm/cacheflush_mm.h index ed12358c47..9a71b01484 100644 --- a/arch/m68k/include/asm/cacheflush_mm.h +++ b/arch/m68k/include/asm/cacheflush_mm.h @@ -191,6 +191,7 @@ extern void cache_push_v(unsigned long vaddr, int len); #define flush_cache_all() __flush_cache_all() #define flush_cache_vmap(start, end) flush_cache_all() +#define flush_cache_vmap_early(start, end) do { } while (0) #define flush_cache_vunmap(start, end) flush_cache_all() static inline void flush_cache_mm(struct mm_struct *mm) diff --git a/arch/m68k/include/asm/dvma.h b/arch/m68k/include/asm/dvma.h index f609ec1de3..d1d66d0484 100644 --- a/arch/m68k/include/asm/dvma.h +++ b/arch/m68k/include/asm/dvma.h @@ -58,12 +58,16 @@ extern void dvma_free(void *vaddr); #define dvma_vtob(x) dvma_vtop(x) #define dvma_btov(x) dvma_ptov(x) +void sun3_dvma_init(void); + static inline int dvma_map_cpu(unsigned long kaddr, unsigned long vaddr, int len) { return 0; } +static inline void dvma_unmap_iommu(unsigned long baddr, int len) { } + #else /* Sun3x */ /* sun3x dvma page support */ @@ -78,9 +82,11 @@ static inline int dvma_map_cpu(unsigned long kaddr, unsigned long vaddr, #define dvma_vtob(x) ((unsigned long)(x) & 0x00ffffff) #define dvma_btov(x) ((unsigned long)(x) | 0xff000000) -extern int dvma_map_cpu(unsigned long kaddr, unsigned long vaddr, int len); +static inline void sun3_dvma_init(void) { } +int dvma_map_cpu(unsigned long kaddr, unsigned long vaddr, int len); +void dvma_unmap_iommu(unsigned long baddr, int len); /* everything below this line is specific to dma used for the onboard ESP scsi on sun3x */ diff --git a/arch/m68k/include/asm/fb.h b/arch/m68k/include/asm/fb.h index 24273fc7ad..9941b7434b 100644 --- a/arch/m68k/include/asm/fb.h +++ b/arch/m68k/include/asm/fb.h @@ -5,26 +5,27 @@ #include #include -struct file; - -static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma, - unsigned long off) +static inline pgprot_t pgprot_framebuffer(pgprot_t prot, + unsigned long vm_start, unsigned long vm_end, + unsigned long offset) { #ifdef CONFIG_MMU #ifdef CONFIG_SUN3 - pgprot_val(vma->vm_page_prot) |= SUN3_PAGE_NOCACHE; + pgprot_val(prot) |= SUN3_PAGE_NOCACHE; #else if (CPU_IS_020_OR_030) - pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE030; + pgprot_val(prot) |= _PAGE_NOCACHE030; if (CPU_IS_040_OR_060) { - pgprot_val(vma->vm_page_prot) &= _CACHEMASK040; + pgprot_val(prot) &= _CACHEMASK040; /* Use no-cache mode, serialized */ - pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE_S; + pgprot_val(prot) |= _PAGE_NOCACHE_S; } #endif /* CONFIG_SUN3 */ #endif /* CONFIG_MMU */ + + return prot; } -#define fb_pgprotect fb_pgprotect +#define pgprot_framebuffer pgprot_framebuffer #include diff --git a/arch/m68k/include/asm/io_mm.h b/arch/m68k/include/asm/io_mm.h index 6a0abd4846..47525f2a57 100644 --- a/arch/m68k/include/asm/io_mm.h +++ b/arch/m68k/include/asm/io_mm.h @@ -272,20 +272,20 @@ static inline void isa_delay(void) #define isa_outsb(port, buf, nr) raw_outsb(isa_itb(port), (u8 *)(buf), (nr)) #define isa_insw(port, buf, nr) \ - (ISA_SEX ? raw_insw(isa_itw(port), (u16 *)(buf), (nr)) : \ - raw_insw_swapw(isa_itw(port), (u16 *)(buf), (nr))) + (ISA_SEX ? raw_insw(isa_itw(port), (u16 *)(buf), (nr)) : \ + raw_insw_swapw(isa_itw(port), (u16 *)(buf), (nr))) #define isa_outsw(port, buf, nr) \ - (ISA_SEX ? raw_outsw(isa_itw(port), (u16 *)(buf), (nr)) : \ - raw_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr))) + (ISA_SEX ? raw_outsw(isa_itw(port), (u16 *)(buf), (nr)) : \ + raw_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr))) #define isa_insl(port, buf, nr) \ - (ISA_SEX ? raw_insl(isa_itl(port), (u32 *)(buf), (nr)) : \ - raw_insw_swapw(isa_itw(port), (u16 *)(buf), (nr)<<1)) + (ISA_SEX ? raw_insl(isa_itl(port), (u32 *)(buf), (nr)) : \ + raw_insw_swapw(isa_itw(port), (u16 *)(buf), (nr)<<1)) #define isa_outsl(port, buf, nr) \ - (ISA_SEX ? raw_outsl(isa_itl(port), (u32 *)(buf), (nr)) : \ - raw_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr)<<1)) + (ISA_SEX ? raw_outsl(isa_itl(port), (u32 *)(buf), (nr)) : \ + raw_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr)<<1)) #ifdef CONFIG_ATARI_ROM_ISA @@ -297,14 +297,14 @@ static inline void isa_delay(void) #define isa_rom_insb(port, buf, nr) raw_rom_insb(isa_itb(port), (u8 *)(buf), (nr)) #define isa_rom_insw(port, buf, nr) \ - (ISA_SEX ? raw_rom_insw(isa_itw(port), (u16 *)(buf), (nr)) : \ - raw_rom_insw_swapw(isa_itw(port), (u16 *)(buf), (nr))) + (ISA_SEX ? raw_rom_insw(isa_itw(port), (u16 *)(buf), (nr)) : \ + raw_rom_insw_swapw(isa_itw(port), (u16 *)(buf), (nr))) #define isa_rom_outsb(port, buf, nr) raw_rom_outsb(isa_itb(port), (u8 *)(buf), (nr)) #define isa_rom_outsw(port, buf, nr) \ - (ISA_SEX ? raw_rom_outsw(isa_itw(port), (u16 *)(buf), (nr)) : \ - raw_rom_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr))) + (ISA_SEX ? raw_rom_outsw(isa_itw(port), (u16 *)(buf), (nr)) : \ + raw_rom_outsw_swapw(isa_itw(port), (u16 *)(buf), (nr))) #endif /* CONFIG_ATARI_ROM_ISA */ #endif /* CONFIG_ISA || CONFIG_ATARI_ROM_ISA */ diff --git a/arch/m68k/include/asm/irq.h b/arch/m68k/include/asm/irq.h index 7829e955ca..14992fde73 100644 --- a/arch/m68k/include/asm/irq.h +++ b/arch/m68k/include/asm/irq.h @@ -2,6 +2,9 @@ #ifndef _M68K_IRQ_H_ #define _M68K_IRQ_H_ +#include +#include + /* * This should be the same as the max(NUM_X_SOURCES) for all the * different m68k hosts compiled into the kernel. @@ -59,6 +62,8 @@ struct irq_data; struct irq_chip; struct irq_desc; +struct pt_regs; + extern unsigned int m68k_irq_startup(struct irq_data *data); extern unsigned int m68k_irq_startup_irq(unsigned int irq); extern void m68k_irq_shutdown(struct irq_data *data); diff --git a/arch/m68k/include/asm/kexec.h b/arch/m68k/include/asm/kexec.h index f5a8b2defa..3b0b64f0a3 100644 --- a/arch/m68k/include/asm/kexec.h +++ b/arch/m68k/include/asm/kexec.h @@ -2,7 +2,7 @@ #ifndef _ASM_M68K_KEXEC_H #define _ASM_M68K_KEXEC_H -#ifdef CONFIG_KEXEC +#ifdef CONFIG_KEXEC_CORE /* Maximum physical address we can use pages from */ #define KEXEC_SOURCE_MEMORY_LIMIT (-1UL) @@ -25,6 +25,6 @@ static inline void crash_setup_regs(struct pt_regs *newregs, #endif /* __ASSEMBLY__ */ -#endif /* CONFIG_KEXEC */ +#endif /* CONFIG_KEXEC_CORE */ #endif /* _ASM_M68K_KEXEC_H */ diff --git a/arch/m68k/include/asm/mcfgpio.h b/arch/m68k/include/asm/mcfgpio.h index 7abd322c01..019f244395 100644 --- a/arch/m68k/include/asm/mcfgpio.h +++ b/arch/m68k/include/asm/mcfgpio.h @@ -8,10 +8,6 @@ #ifndef mcfgpio_h #define mcfgpio_h -#ifdef CONFIG_GPIOLIB -#include -#else - int __mcfgpio_get_value(unsigned gpio); void __mcfgpio_set_value(unsigned gpio, int value); int __mcfgpio_direction_input(unsigned gpio); @@ -19,6 +15,10 @@ int __mcfgpio_direction_output(unsigned gpio, int value); int __mcfgpio_request(unsigned gpio); void __mcfgpio_free(unsigned gpio); +#ifdef CONFIG_GPIOLIB +#include +#else + /* our alternate 'gpiolib' functions */ static inline int __gpio_get_value(unsigned gpio) { diff --git a/arch/m68k/include/asm/nettel.h b/arch/m68k/include/asm/nettel.h index 45716ead7b..3bd4b7a461 100644 --- a/arch/m68k/include/asm/nettel.h +++ b/arch/m68k/include/asm/nettel.h @@ -14,9 +14,8 @@ #define nettel_h /****************************************************************************/ - /****************************************************************************/ -#ifdef CONFIG_NETtel +#if defined(CONFIG_NETtel) || defined(CONFIG_CLEOPATRA) /****************************************************************************/ #ifdef CONFIG_COLDFIRE @@ -26,7 +25,7 @@ #endif /*---------------------------------------------------------------------------*/ -#if defined(CONFIG_M5307) +#if defined(CONFIG_M5307) || defined(CONFIG_M5407) /* * NETtel/5307 based hardware first. DTR/DCD lines are wired to * GPIO lines. Most of the LED's are driver through a latch diff --git a/arch/m68k/include/asm/oplib.h b/arch/m68k/include/asm/oplib.h index 48cb4fd09f..6d5ea67c65 100644 --- a/arch/m68k/include/asm/oplib.h +++ b/arch/m68k/include/asm/oplib.h @@ -9,6 +9,8 @@ #ifndef __SPARC_OPLIB_H #define __SPARC_OPLIB_H +#include + #include /* The master romvec pointer... */ @@ -149,7 +151,7 @@ extern char prom_getchar(void); extern void prom_putchar(char character); /* Prom's internal printf routine, don't use in kernel/boot code. */ -void prom_printf(char *fmt, ...); +__printf(1, 2) void prom_printf(char *fmt, ...); /* Query for input device type */ diff --git a/arch/m68k/include/asm/page_mm.h b/arch/m68k/include/asm/page_mm.h index 363aa0f9ba..e0ae4d5fc9 100644 --- a/arch/m68k/include/asm/page_mm.h +++ b/arch/m68k/include/asm/page_mm.h @@ -13,17 +13,16 @@ #ifdef CPU_M68040_OR_M68060_ONLY static inline void copy_page(void *to, void *from) { - unsigned long tmp; - - __asm__ __volatile__("1:\t" - ".chip 68040\n\t" - "move16 %1@+,%0@+\n\t" - "move16 %1@+,%0@+\n\t" - ".chip 68k\n\t" - "dbra %2,1b\n\t" - : "=a" (to), "=a" (from), "=d" (tmp) - : "0" (to), "1" (from) , "2" (PAGE_SIZE / 32 - 1) - ); + unsigned long tmp; + + __asm__ __volatile__("1:\t" + ".chip 68040\n\t" + "move16 %1@+,%0@+\n\t" + "move16 %1@+,%0@+\n\t" + ".chip 68k\n\t" + "dbra %2,1b\n\t" + : "=a" (to), "=a" (from), "=d" (tmp) + : "0" (to), "1" (from), "2" (PAGE_SIZE / 32 - 1)); } static inline void clear_page(void *page) @@ -95,23 +94,23 @@ static inline void *__va(unsigned long paddr) #define __pa(x) ___pa((unsigned long)(x)) static inline unsigned long ___pa(unsigned long x) { - if(x == 0) - return 0; - if(x >= PAGE_OFFSET) - return (x-PAGE_OFFSET); - else - return (x+0x2000000); + if (x == 0) + return 0; + if (x >= PAGE_OFFSET) + return (x - PAGE_OFFSET); + else + return (x + 0x2000000); } static inline void *__va(unsigned long x) { - if(x == 0) - return (void *)0; + if (x == 0) + return (void *)0; - if(x < 0x2000000) - return (void *)(x+PAGE_OFFSET); - else - return (void *)(x-0x2000000); + if (x < 0x2000000) + return (void *)(x + PAGE_OFFSET); + else + return (void *)(x - 0x2000000); } #endif /* CONFIG_SUN3 */ diff --git a/arch/m68k/include/asm/pgtable.h b/arch/m68k/include/asm/pgtable.h index ad15d655a9..27525c6a12 100644 --- a/arch/m68k/include/asm/pgtable.h +++ b/arch/m68k/include/asm/pgtable.h @@ -1,6 +1,15 @@ /* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __M68K_PGTABLE_H +#define __M68K_PGTABLE_H + #ifdef __uClinux__ #include #else #include #endif + +#ifndef __ASSEMBLY__ +extern void paging_init(void); +#endif + +#endif /* __M68K_PGTABLE_H */ diff --git a/arch/m68k/include/asm/pgtable_no.h b/arch/m68k/include/asm/pgtable_no.h index fc044df52b..1a86c15b90 100644 --- a/arch/m68k/include/asm/pgtable_no.h +++ b/arch/m68k/include/asm/pgtable_no.h @@ -28,7 +28,6 @@ #define PAGE_READONLY __pgprot(0) #define PAGE_KERNEL __pgprot(0) -extern void paging_init(void); #define swapper_pg_dir ((pgd_t *) 0) /* diff --git a/arch/m68k/include/asm/raw_io.h b/arch/m68k/include/asm/raw_io.h index 3ba40bc1df..95a6ff694a 100644 --- a/arch/m68k/include/asm/raw_io.h +++ b/arch/m68k/include/asm/raw_io.h @@ -17,15 +17,15 @@ * two accesses to memory, which may be undesirable for some devices. */ #define in_8(addr) \ - ({ u8 __v = (*(__force volatile u8 *) (unsigned long)(addr)); __v; }) + ({ u8 __v = (*(__force const volatile u8 *) (unsigned long)(addr)); __v; }) #define in_be16(addr) \ - ({ u16 __v = (*(__force volatile u16 *) (unsigned long)(addr)); __v; }) + ({ u16 __v = (*(__force const volatile u16 *) (unsigned long)(addr)); __v; }) #define in_be32(addr) \ - ({ u32 __v = (*(__force volatile u32 *) (unsigned long)(addr)); __v; }) + ({ u32 __v = (*(__force const volatile u32 *) (unsigned long)(addr)); __v; }) #define in_le16(addr) \ - ({ u16 __v = le16_to_cpu(*(__force volatile __le16 *) (unsigned long)(addr)); __v; }) + ({ u16 __v = le16_to_cpu(*(__force const volatile __le16 *) (unsigned long)(addr)); __v; }) #define in_le32(addr) \ - ({ u32 __v = le32_to_cpu(*(__force volatile __le32 *) (unsigned long)(addr)); __v; }) + ({ u32 __v = le32_to_cpu(*(__force const volatile __le32 *) (unsigned long)(addr)); __v; }) #define out_8(addr,b) (void)((*(__force volatile u8 *) (unsigned long)(addr)) = (b)) #define out_be16(addr,w) (void)((*(__force volatile u16 *) (unsigned long)(addr)) = (w)) @@ -73,11 +73,11 @@ #if defined(CONFIG_ATARI_ROM_ISA) #define rom_in_8(addr) \ - ({ u16 __v = (*(__force volatile u16 *) (addr)); __v >>= 8; __v; }) + ({ u16 __v = (*(__force const volatile u16 *) (addr)); __v >>= 8; __v; }) #define rom_in_be16(addr) \ - ({ u16 __v = (*(__force volatile u16 *) (addr)); __v; }) + ({ u16 __v = (*(__force const volatile u16 *) (addr)); __v; }) #define rom_in_le16(addr) \ - ({ u16 __v = le16_to_cpu(*(__force volatile u16 *) (addr)); __v; }) + ({ u16 __v = le16_to_cpu(*(__force const volatile u16 *) (addr)); __v; }) #define rom_out_8(addr, b) \ (void)({u8 __maybe_unused __w, __v = (b); u32 _addr = ((u32) (addr)); \ @@ -98,7 +98,8 @@ #define raw_rom_outw(val, port) rom_out_be16((port), (val)) #endif /* CONFIG_ATARI_ROM_ISA */ -static inline void raw_insb(volatile u8 __iomem *port, u8 *buf, unsigned int len) +static inline void raw_insb(const volatile u8 __iomem *port, u8 *buf, + unsigned int len) { unsigned int i; @@ -146,7 +147,7 @@ static inline void raw_outsb(volatile u8 __iomem *port, const u8 *buf, } } -static inline void raw_insw(volatile u16 __iomem *port, u16 *buf, unsigned int nr) +static inline void raw_insw(volatile const u16 __iomem *port, u16 *buf, unsigned int nr) { unsigned int tmp; @@ -225,7 +226,7 @@ static inline void raw_outsw(volatile u16 __iomem *port, const u16 *buf, } } -static inline void raw_insl(volatile u32 __iomem *port, u32 *buf, unsigned int nr) +static inline void raw_insl(const volatile u32 __iomem *port, u32 *buf, unsigned int nr) { unsigned int tmp; @@ -305,7 +306,7 @@ static inline void raw_outsl(volatile u32 __iomem *port, const u32 *buf, } -static inline void raw_insw_swapw(volatile u16 __iomem *port, u16 *buf, +static inline void raw_insw_swapw(const volatile u16 __iomem *port, u16 *buf, unsigned int nr) { if ((nr) % 8) @@ -413,7 +414,8 @@ static inline void raw_outsw_swapw(volatile u16 __iomem *port, const u16 *buf, #if defined(CONFIG_ATARI_ROM_ISA) -static inline void raw_rom_insb(volatile u8 __iomem *port, u8 *buf, unsigned int len) +static inline void raw_rom_insb(const volatile u8 __iomem *port, u8 *buf, + unsigned int len) { unsigned int i; @@ -430,7 +432,7 @@ static inline void raw_rom_outsb(volatile u8 __iomem *port, const u8 *buf, rom_out_8(port, *buf++); } -static inline void raw_rom_insw(volatile u16 __iomem *port, u16 *buf, +static inline void raw_rom_insw(const volatile u16 __iomem *port, u16 *buf, unsigned int nr) { unsigned int i; @@ -448,7 +450,7 @@ static inline void raw_rom_outsw(volatile u16 __iomem *port, const u16 *buf, rom_out_be16(port, *buf++); } -static inline void raw_rom_insw_swapw(volatile u16 __iomem *port, u16 *buf, +static inline void raw_rom_insw_swapw(const volatile u16 __iomem *port, u16 *buf, unsigned int nr) { unsigned int i; diff --git a/arch/m68k/include/asm/sun3_pgalloc.h b/arch/m68k/include/asm/sun3_pgalloc.h index ff48573db2..4a137eecb6 100644 --- a/arch/m68k/include/asm/sun3_pgalloc.h +++ b/arch/m68k/include/asm/sun3_pgalloc.h @@ -41,12 +41,12 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, pgtable_t page static inline pgd_t * pgd_alloc(struct mm_struct *mm) { - pgd_t *new_pgd; + pgd_t *new_pgd; - new_pgd = (pgd_t *)get_zeroed_page(GFP_KERNEL); - memcpy(new_pgd, swapper_pg_dir, PAGE_SIZE); - memset(new_pgd, 0, (PAGE_OFFSET >> PGDIR_SHIFT)); - return new_pgd; + new_pgd = (pgd_t *)get_zeroed_page(GFP_KERNEL); + memcpy(new_pgd, swapper_pg_dir, PAGE_SIZE); + memset(new_pgd, 0, (PAGE_OFFSET >> PGDIR_SHIFT)); + return new_pgd; } #endif /* SUN3_PGALLOC_H */ diff --git a/arch/m68k/include/asm/syscalls.h b/arch/m68k/include/asm/syscalls.h new file mode 100644 index 0000000000..fb3639acd0 --- /dev/null +++ b/arch/m68k/include/asm/syscalls.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef _ASM_M68K_SYSCALLS_H +#define _ASM_M68K_SYSCALLS_H + +#include +#include + +asmlinkage int sys_cacheflush(unsigned long addr, int scope, int cache, + unsigned long len); +asmlinkage int sys_atomic_cmpxchg_32(unsigned long newval, int oldval, int d3, + int d4, int d5, unsigned long __user *mem); +asmlinkage int sys_getpagesize(void); +asmlinkage unsigned long sys_get_thread_area(void); +asmlinkage int sys_set_thread_area(unsigned long tp); +asmlinkage int sys_atomic_barrier(void); + +#include + +#endif /* _ASM_M68K_SYSCALLS_H */ diff --git a/arch/m68k/include/asm/tlbflush.h b/arch/m68k/include/asm/tlbflush.h index b882e2f4f5..6d42e29068 100644 --- a/arch/m68k/include/asm/tlbflush.h +++ b/arch/m68k/include/asm/tlbflush.h @@ -112,53 +112,51 @@ extern unsigned char pmeg_ctx[SUN3_PMEGS_NUM]; sun?) */ static inline void flush_tlb_all(void) { - unsigned long addr; - unsigned char ctx, oldctx; - - oldctx = sun3_get_context(); - for(addr = 0x00000000; addr < TASK_SIZE; addr += SUN3_PMEG_SIZE) { - for(ctx = 0; ctx < 8; ctx++) { - sun3_put_context(ctx); - sun3_put_segmap(addr, SUN3_INVALID_PMEG); - } - } - - sun3_put_context(oldctx); - /* erase all of the userspace pmeg maps, we've clobbered them - all anyway */ - for(addr = 0; addr < SUN3_INVALID_PMEG; addr++) { - if(pmeg_alloc[addr] == 1) { - pmeg_alloc[addr] = 0; - pmeg_ctx[addr] = 0; - pmeg_vaddr[addr] = 0; - } - } + unsigned long addr; + unsigned char ctx, oldctx; + oldctx = sun3_get_context(); + for (addr = 0x00000000; addr < TASK_SIZE; addr += SUN3_PMEG_SIZE) { + for (ctx = 0; ctx < 8; ctx++) { + sun3_put_context(ctx); + sun3_put_segmap(addr, SUN3_INVALID_PMEG); + } + } + + sun3_put_context(oldctx); + /* erase all of the userspace pmeg maps, we've clobbered them + all anyway */ + for (addr = 0; addr < SUN3_INVALID_PMEG; addr++) { + if (pmeg_alloc[addr] == 1) { + pmeg_alloc[addr] = 0; + pmeg_ctx[addr] = 0; + pmeg_vaddr[addr] = 0; + } + } } /* Clear user TLB entries within the context named in mm */ static inline void flush_tlb_mm (struct mm_struct *mm) { - unsigned char oldctx; - unsigned char seg; - unsigned long i; - - oldctx = sun3_get_context(); - sun3_put_context(mm->context); + unsigned char oldctx; + unsigned char seg; + unsigned long i; - for(i = 0; i < TASK_SIZE; i += SUN3_PMEG_SIZE) { - seg = sun3_get_segmap(i); - if(seg == SUN3_INVALID_PMEG) - continue; + oldctx = sun3_get_context(); + sun3_put_context(mm->context); - sun3_put_segmap(i, SUN3_INVALID_PMEG); - pmeg_alloc[seg] = 0; - pmeg_ctx[seg] = 0; - pmeg_vaddr[seg] = 0; - } + for (i = 0; i < TASK_SIZE; i += SUN3_PMEG_SIZE) { + seg = sun3_get_segmap(i); + if (seg == SUN3_INVALID_PMEG) + continue; - sun3_put_context(oldctx); + sun3_put_segmap(i, SUN3_INVALID_PMEG); + pmeg_alloc[seg] = 0; + pmeg_ctx[seg] = 0; + pmeg_vaddr[seg] = 0; + } + sun3_put_context(oldctx); } /* Flush a single TLB page. In this case, we're limited to flushing a @@ -208,6 +206,7 @@ static inline void flush_tlb_range (struct vm_area_struct *vma, next: start += SUN3_PMEG_SIZE; } + sun3_put_context(oldctx); } static inline void flush_tlb_kernel_range(unsigned long start, unsigned long end) -- cgit v1.2.3