Consolidate asm/fixmap.h files
Subsystems (9)
cover Consolidate asm/fixmap.h files
Many architectures provide an asm/fixmap.h which defines support for compile-time 'special' virtual mappings which need to be made before paging_init() has run. This suport is also used for early ioremap on x86. Much of this support is identical across the architectures. This patch consolidates all of the common bits into asm-generic/fixmap.h which is intended to be included from arch/*/include/asm/fixmap.h.
This has been compiled on x86, arm, powerpc, and sh, but tested on x86 only.
Mark Salter (11):
Add generic fixmap.h
x86: use generic fixmap.h
arm: use generic fixmap.h
hexagon: use generic fixmap.h
metag: use generic fixmap.h
microblaze: use generic fixmap.h
mips: use generic fixmap.h
powerpc: use generic fixmap.h
sh: use generic fixmap.h
tile: use generic fixmap.h
um: use generic fixmap.h
arch/arm/include/asm/fixmap.h | 25 ++------ arch/hexagon/include/asm/fixmap.h | 40 +------------ arch/metag/include/asm/fixmap.h | 32 +---------- arch/microblaze/include/asm/fixmap.h | 44 +------------- arch/mips/include/asm/fixmap.h | 33 +---------- arch/powerpc/include/asm/fixmap.h | 44 +------------- arch/sh/include/asm/fixmap.h | 39 +------------ arch/tile/include/asm/fixmap.h | 33 +---------- arch/um/include/asm/fixmap.h | 40 +------------ arch/x86/include/asm/fixmap.h | 59 +------------------ include/asm-generic/fixmap.h | 107 +++++++++++++++++++++++++++++++++++ 11 files changed, 125 insertions(+), 371 deletions(-) create mode 100644 include/asm-generic/fixmap.h
Signature · 1 line
1.8.3.1
PATCH 1/11 Add generic fixmap.h
Many architectures provide an asm/fixmap.h which defines support for compile-time 'special' virtual mappings which need to be made before paging_init() has run. This suport is also used for early ioremap on x86. Much of this support is identical across the architectures. This patch consolidates all of the common bits into asm-generic/fixmap.h which is intended to be included from arch/*/include/asm/fixmap.h.
--- include/asm-generic/fixmap.h | 107 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 include/asm-generic/fixmap.h
include/asm-generic/fixmap.h new file +107 -0
@@ -0,0 +1,107 @@ +/* +* fixmap.h: compile-time virtual memory allocation +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 1998 Ingo Molnar +* +* Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999 +* x86_32 and x86_64 integration by Gustavo F. Padovan, February 2009 +*/ + +#ifndef __ASM_GENERIC_FIXMAP_H +#define __ASM_GENERIC_FIXMAP_H + +#define __fix_to_virt (x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) +#define __virt_to_fix (x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT) + +#ifndef __ASSEMBLY__ +extern void __this_fixmap_does_not_exist (void ); + +/* +* 'index to address' translation. If anyone tries to use the idx +* directly without translation, we catch the bug with a NULL-deference +* kernel oops. Illegal ranges of incoming indices are caught too. +*/ +static __always_inline unsigned long fix_to_virt (const unsigned int idx) +{ +/* +* this branch gets completely eliminated after inlining, +* except when someone tries to use fixaddr indices in an +* illegal way. (such as mixing up address types or using +* out-of-range indices). +* +* If it doesn't get removed, the linker will complain +* loudly with a reasonably clear error message.. +*/ +if (idx >= __end_of_fixed_addresses) +__this_fixmap_does_not_exist (); + +return __fix_to_virt (idx); +} + +static inline unsigned long virt_to_fix (const unsigned long vaddr) +{ +BUG_ON (vaddr >=FIXADDR_TOP || vaddr <FIXADDR_START ); +return __virt_to_fix (vaddr); +} + +/* +* Provide some reasonable defaults for page flags. +* Not all architectures use all of these different types and some +* architectures use different names. +*/ +#ifndef FIXMAP_PAGE_NORMAL +#define FIXMAP_PAGE_NORMAL PAGE_KERNEL +#endif +#ifndef FIXMAP_PAGE_NOCACHE +#define FIXMAP_PAGE_NOCACHE PAGE_KERNEL_NOCACHE +#endif +#ifndef FIXMAP_PAGE_IO +#define FIXMAP_PAGE_IO PAGE_KERNEL_IO +#endif +#ifndef FIXMAP_PAGE_CLEAR +#define FIXMAP_PAGE_CLEAR __pgprot(0) +#endif + +#ifndef set_fixmap +#define set_fixmap (idx, phys) \ + __set_fixmap(idx, phys, FIXMAP_PAGE_NORMAL) +#endif + +#ifndef clear_fixmap +#define clear_fixmap (idx) \ + __set_fixmap(idx, 0, FIXMAP_PAGE_CLEAR) +#endif + +/* Return an pointer with offset calculated */ +#define __set_fixmap_offset (idx, phys, flags) \ +({ \ + unsigned long addr; \ + __set_fixmap(idx, phys, flags); \ + addr = fix_to_virt(idx) + ((phys) & (PAGE_SIZE - 1)); \ + addr; \ +}) + +#define set_fixmap_offset (idx, phys) \ + __set_fixmap_offset(idx, phys, FIXMAP_PAGE_NORMAL) + +/* +* Some hardware wants to get fixmapped without caching. +*/ +#define set_fixmap_nocache (idx, phys) \ + __set_fixmap(idx, phys, FIXMAP_PAGE_NOCACHE) + +#define set_fixmap_offset_nocache (idx, phys) \ + __set_fixmap_offset(idx, phys, FIXMAP_PAGE_NOCACHE) + +/* +* Some fixmaps are for IO +*/ +#define set_fixmap_io (idx, phys) \ + __set_fixmap(idx, phys, FIXMAP_PAGE_IO) + +#endif /* __ASSEMBLY__ */ +#endif /* __ASM_GENERIC_FIXMAP_H */
Signature · 6 lines
1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-metag" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 3/11 arm: use generic fixmap.h
In reply to Mark Salter--- arch/arm/include/asm/fixmap.h | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-)
arch/arm/include/asm/fixmap.h +6 -19
@@ -17,25 +17,12 @@#define FIXADDR_TOP 0xfffe0000UL#define FIXADDR_SIZE (FIXADDR_TOP - FIXADDR_START) -#define FIX_KMAP_BEGIN 0 -#define FIX_KMAP_END (FIXADDR_SIZE >> PAGE_SHIFT) +enum fixed_addresses { +FIX_KMAP_BEGIN , +FIX_KMAP_END = (FIXADDR_SIZE >>PAGE_SHIFT ) -1 , + __end_of_fixed_addresses +}; -#define __fix_to_virt (x) (FIXADDR_START + ((x) << PAGE_SHIFT)) -#define __virt_to_fix (x) (((x) - FIXADDR_START) >> PAGE_SHIFT) - -extern void __this_fixmap_does_not_exist (void ); - -static inline unsigned long fix_to_virt (const unsigned int idx) -{ -if (idx >=FIX_KMAP_END ) -__this_fixmap_does_not_exist (); -return __fix_to_virt (idx); -} - -static inline unsigned int virt_to_fix (const unsigned long vaddr) -{ -BUG_ON (vaddr >=FIXADDR_TOP || vaddr <FIXADDR_START ); -return __virt_to_fix (vaddr); -} +#include <asm-generic/fixmap.h> #endif
Signature · 1 line
1.8.3.1
PATCH 4/11 hexagon: use generic fixmap.h
In reply to Mark Salter--- arch/hexagon/include/asm/fixmap.h | 40 +-------------------------------------- 1 file changed, 1 insertion(+), 39 deletions(-)
arch/hexagon/include/asm/fixmap.h +1 -39
@@ -26,45 +26,7 @@*/ #include <asm/mem-layout.h> -/* -* Full fixmap support involves set_fixmap() functions, but -* these may not be needed if all we're after is an area for -* highmem kernel mappings. -*/ -#define __fix_to_virt (x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) -#define __virt_to_fix (x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT) - -extern void __this_fixmap_does_not_exist (void ); - -/** -* fix_to_virt -- "index to address" translation. -* -* If anyone tries to use the idx directly without translation, -* we catch the bug with a NULL-deference kernel oops. Illegal -* ranges of incoming indices are caught too. -*/ -static inline unsigned long fix_to_virt (const unsigned int idx) -{ -/* -* This branch gets completely eliminated after inlining, -* except when someone tries to use fixaddr indices in an -* illegal way. (such as mixing up address types or using -* out-of-range indices). -* -* If it doesn't get removed, the linker will complain -* loudly with a reasonably clear error message.. -*/ -if (idx >= __end_of_fixed_addresses) -__this_fixmap_does_not_exist (); - -return __fix_to_virt (idx); -} - -static inline unsigned long virt_to_fix (const unsigned long vaddr) -{ -BUG_ON (vaddr >=FIXADDR_TOP || vaddr <FIXADDR_START ); -return __virt_to_fix (vaddr); -} +#include <asm-generic/fixmap.h> #define kmap_get_fixmap_pte (vaddr) \ pte_offset_kernel(pmd_offset(pud_offset(pgd_offset_k(vaddr), \
Signature · 1 line
1.8.3.1
PATCH 5/11 metag: use generic fixmap.h
In reply to Mark Salter--- arch/metag/include/asm/fixmap.h | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-)
arch/metag/include/asm/fixmap.h +1 -31
@@ -51,37 +51,7 @@ enum fixed_addresses {#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)#define FIXADDR_START ((FIXADDR_TOP - FIXADDR_SIZE) & PMD_MASK) -#define __fix_to_virt (x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) -#define __virt_to_fix (x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT) - -extern void __this_fixmap_does_not_exist (void ); -/* -* 'index to address' translation. If anyone tries to use the idx -* directly without tranlation, we catch the bug with a NULL-deference -* kernel oops. Illegal ranges of incoming indices are caught too. -*/ -static inline unsigned long fix_to_virt (const unsigned int idx) -{ -/* -* this branch gets completely eliminated after inlining, -* except when someone tries to use fixaddr indices in an -* illegal way. (such as mixing up address types or using -* out-of-range indices). -* -* If it doesn't get removed, the linker will complain -* loudly with a reasonably clear error message.. -*/ -if (idx >= __end_of_fixed_addresses) -__this_fixmap_does_not_exist (); - -return __fix_to_virt (idx); -} - -static inline unsigned long virt_to_fix (const unsigned long vaddr) -{ -BUG_ON (vaddr >=FIXADDR_TOP || vaddr <FIXADDR_START ); -return __virt_to_fix (vaddr); -} +#include <asm-generic/fixmap.h> #define kmap_get_fixmap_pte (vaddr) \ pte_offset_kernel( \
Signature · 6 lines
1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-metag" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 9/11 sh: use generic fixmap.h
In reply to Mark Salter--- arch/sh/include/asm/fixmap.h | 39 ++------------------------------------- 1 file changed, 2 insertions(+), 37 deletions(-)
arch/sh/include/asm/fixmap.h +2 -37
@@ -79,13 +79,6 @@ extern void __set_fixmap(enum fixed_addresses idx, unsigned long phys, pgprot_t flags);extern void __clear_fixmap (enum fixed_addresses idx,pgprot_t flags); -#define set_fixmap (idx, phys) \ - __set_fixmap(idx, phys, PAGE_KERNEL) -/* -* Some hardware wants to get fixmapped without caching. -*/ -#define set_fixmap_nocache (idx, phys) \ - __set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE)/* * used by vmalloc.c. *
@@ -101,36 +94,8 @@ extern void __clear_fixmap(enum fixed_addresses idx, pgprot_t flags);#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) -#define __fix_to_virt (x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) -#define __virt_to_fix (x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT) - -extern void __this_fixmap_does_not_exist (void ); - -/* -* 'index to address' translation. If anyone tries to use the idx -* directly without tranlation, we catch the bug with a NULL-deference -* kernel oops. Illegal ranges of incoming indices are caught too. -*/ -static inline unsigned long fix_to_virt (const unsigned int idx) -{ -/* -* this branch gets completely eliminated after inlining, -* except when someone tries to use fixaddr indices in an -* illegal way. (such as mixing up address types or using -* out-of-range indices). -* -* If it doesn't get removed, the linker will complain -* loudly with a reasonably clear error message.. -*/ -if (idx >= __end_of_fixed_addresses) -__this_fixmap_does_not_exist (); +#define FIXMAP_PAGE_NOCACHE PAGE_KERNEL_NOCACHE -return __fix_to_virt (idx); -} +#include <asm-generic/fixmap.h> -static inline unsigned long virt_to_fix (const unsigned long vaddr) -{ -BUG_ON (vaddr >=FIXADDR_TOP || vaddr <FIXADDR_START ); -return __virt_to_fix (vaddr); -}#endif
Signature · 1 line
1.8.3.1
PATCH 8/11 powerpc: use generic fixmap.h
In reply to Mark Salter--- arch/powerpc/include/asm/fixmap.h | 44 ++------------------------------------- 1 file changed, 2 insertions(+), 42 deletions(-)
arch/powerpc/include/asm/fixmap.h +2 -42
@@ -58,52 +58,12 @@ enum fixed_addresses {extern void __set_fixmap (enum fixed_addresses idx,phys_addr_t phys,pgprot_t flags); -#define set_fixmap (idx, phys) \ - __set_fixmap(idx, phys, PAGE_KERNEL) -/* -* Some hardware wants to get fixmapped without caching. -*/ -#define set_fixmap_nocache (idx, phys) \ - __set_fixmap(idx, phys, PAGE_KERNEL_NCG) - -#define clear_fixmap (idx) \ - __set_fixmap(idx, 0, __pgprot(0)) -#define __FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)#define FIXADDR_START (FIXADDR_TOP - __FIXADDR_SIZE) -#define __fix_to_virt (x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) -#define __virt_to_fix (x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT) - -extern void __this_fixmap_does_not_exist (void ); - -/* -* 'index to address' translation. If anyone tries to use the idx -* directly without tranlation, we catch the bug with a NULL-deference -* kernel oops. Illegal ranges of incoming indices are caught too. -*/ -static __always_inline unsigned long fix_to_virt (const unsigned int idx) -{ -/* -* this branch gets completely eliminated after inlining, -* except when someone tries to use fixaddr indices in an -* illegal way. (such as mixing up address types or using -* out-of-range indices). -* -* If it doesn't get removed, the linker will complain -* loudly with a reasonably clear error message.. -*/ -if (idx >= __end_of_fixed_addresses) -__this_fixmap_does_not_exist (); - -return __fix_to_virt (idx); -} +#define FIXMAP_PAGE_NOCACHE PAGE_KERNEL_NCG -static inline unsigned long virt_to_fix (const unsigned long vaddr) -{ -BUG_ON (vaddr >=FIXADDR_TOP || vaddr <FIXADDR_START ); -return __virt_to_fix (vaddr); -} +#include <asm-generic/fixmap.h> #endif /* !__ASSEMBLY__ */ #endif
Signature · 1 line
1.8.3.1
PATCH 7/11 mips: use generic fixmap.h
In reply to Mark Salter--- arch/mips/include/asm/fixmap.h | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-)
arch/mips/include/asm/fixmap.h +1 -32
@@ -71,38 +71,7 @@ enum fixed_addresses {#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) -#define __fix_to_virt (x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) -#define __virt_to_fix (x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT) - -extern void __this_fixmap_does_not_exist (void ); - -/* -* 'index to address' translation. If anyone tries to use the idx -* directly without tranlation, we catch the bug with a NULL-deference -* kernel oops. Illegal ranges of incoming indices are caught too. -*/ -static inline unsigned long fix_to_virt (const unsigned int idx) -{ -/* -* this branch gets completely eliminated after inlining, -* except when someone tries to use fixaddr indices in an -* illegal way. (such as mixing up address types or using -* out-of-range indices). -* -* If it doesn't get removed, the linker will complain -* loudly with a reasonably clear error message.. -*/ -if (idx >= __end_of_fixed_addresses) -__this_fixmap_does_not_exist (); - -return __fix_to_virt (idx); -} - -static inline unsigned long virt_to_fix (const unsigned long vaddr) -{ -BUG_ON (vaddr >=FIXADDR_TOP || vaddr <FIXADDR_START ); -return __virt_to_fix (vaddr); -} +#include <asm-generic/fixmap.h> #define kmap_get_fixmap_pte (vaddr) \ pte_offset_kernel(pmd_offset(pud_offset(pgd_offset_k(vaddr), (vaddr)), (vaddr)), (vaddr))
Signature · 1 line
1.8.3.1
PATCH 11/11 um: use generic fixmap.h
In reply to Mark Salter--- arch/um/include/asm/fixmap.h | 40 +--------------------------------------- 1 file changed, 1 insertion(+), 39 deletions(-)
arch/um/include/asm/fixmap.h +1 -39
@@ -43,13 +43,6 @@ enum fixed_addresses {extern void __set_fixmap (enum fixed_addresses idx,unsigned long phys,pgprot_t flags); -#define set_fixmap (idx, phys) \ - __set_fixmap(idx, phys, PAGE_KERNEL) -/* -* Some hardware wants to get fixmapped without caching. -*/ -#define set_fixmap_nocache (idx, phys) \ - __set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE)/* * used by vmalloc.c. *
@@ -62,37 +55,6 @@ extern void __set_fixmap (enum fixed_addresses idx,#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) -#define __fix_to_virt (x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) -#define __virt_to_fix (x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT) - -extern void __this_fixmap_does_not_exist (void ); - -/* -* 'index to address' translation. If anyone tries to use the idx -* directly without tranlation, we catch the bug with a NULL-deference -* kernel oops. Illegal ranges of incoming indices are caught too. -*/ -static inline unsigned long fix_to_virt (const unsigned int idx) -{ -/* -* this branch gets completely eliminated after inlining, -* except when someone tries to use fixaddr indices in an -* illegal way. (such as mixing up address types or using -* out-of-range indices). -* -* If it doesn't get removed, the linker will complain -* loudly with a reasonably clear error message.. -*/ -if (idx >= __end_of_fixed_addresses) -__this_fixmap_does_not_exist (); - -return __fix_to_virt (idx); -} - -static inline unsigned long virt_to_fix (const unsigned long vaddr) -{ -BUG_ON (vaddr >=FIXADDR_TOP || vaddr <FIXADDR_START ); -return __virt_to_fix (vaddr); -} +#include <asm-generic/fixmap.h> #endif
Signature · 13 lines
1.8.3.1 ------------------------------------------------------------------------------ November Webinars for C, C++, Fortran Developers Accelerate application performance with scalable programming models. Explore techniques for threading, error checking, porting, and tuning. Get the most from the latest Intel processors and coprocessors. See abstracts and register http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk _______________________________________________ User-mode-linux-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
PATCH 10/11 tile: use generic fixmap.h
In reply to Mark Salter--- arch/tile/include/asm/fixmap.h | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-)
arch/tile/include/asm/fixmap.h +1 -32
@@ -25,9 +25,6 @@#include <asm/kmap_types.h> #endif -#define __fix_to_virt (x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) -#define __virt_to_fix (x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT) -/* * Here we define all the compile-time 'special' virtual * addresses. The point is to have a constant address at
@@ -83,35 +80,7 @@ enum fixed_addresses {#define FIXADDR_START (FIXADDR_TOP + PAGE_SIZE - __FIXADDR_SIZE)#define FIXADDR_BOOT_START (FIXADDR_TOP + PAGE_SIZE - __FIXADDR_BOOT_SIZE) -extern void __this_fixmap_does_not_exist (void ); - -/* -* 'index to address' translation. If anyone tries to use the idx -* directly without tranlation, we catch the bug with a NULL-deference -* kernel oops. Illegal ranges of incoming indices are caught too. -*/ -static __always_inline unsigned long fix_to_virt (const unsigned int idx) -{ -/* -* this branch gets completely eliminated after inlining, -* except when someone tries to use fixaddr indices in an -* illegal way. (such as mixing up address types or using -* out-of-range indices). -* -* If it doesn't get removed, the linker will complain -* loudly with a reasonably clear error message.. -*/ -if (idx >= __end_of_fixed_addresses) -__this_fixmap_does_not_exist (); - -return __fix_to_virt (idx); -} - -static inline unsigned long virt_to_fix (const unsigned long vaddr) -{ -BUG_ON (vaddr >=FIXADDR_TOP || vaddr <FIXADDR_START ); -return __virt_to_fix (vaddr); -} +#include <asm-generic/fixmap.h> #endif /* !__ASSEMBLY__ */
Signature · 1 line
1.8.3.1
PATCH 6/11 microblaze: use generic fixmap.h
In reply to Mark Salter--- arch/microblaze/include/asm/fixmap.h | 44 ++---------------------------------- 1 file changed, 2 insertions(+), 42 deletions(-)
arch/microblaze/include/asm/fixmap.h +2 -42
@@ -58,52 +58,12 @@ enum fixed_addresses {extern void __set_fixmap (enum fixed_addresses idx,phys_addr_t phys,pgprot_t flags); -#define set_fixmap (idx, phys) \ - __set_fixmap(idx, phys, PAGE_KERNEL) -/* -* Some hardware wants to get fixmapped without caching. -*/ -#define set_fixmap_nocache (idx, phys) \ - __set_fixmap(idx, phys, PAGE_KERNEL_CI) - -#define clear_fixmap (idx) \ - __set_fixmap(idx, 0, __pgprot(0)) -#define __FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)#define FIXADDR_START (FIXADDR_TOP - __FIXADDR_SIZE) -#define __fix_to_virt (x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) -#define __virt_to_fix (x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT) - -extern void __this_fixmap_does_not_exist (void ); - -/* -* 'index to address' translation. If anyone tries to use the idx -* directly without tranlation, we catch the bug with a NULL-deference -* kernel oops. Illegal ranges of incoming indices are caught too. -*/ -static __always_inline unsigned long fix_to_virt (const unsigned int idx) -{ -/* -* this branch gets completely eliminated after inlining, -* except when someone tries to use fixaddr indices in an -* illegal way. (such as mixing up address types or using -* out-of-range indices). -* -* If it doesn't get removed, the linker will complain -* loudly with a reasonably clear error message.. -*/ -if (idx >= __end_of_fixed_addresses) -__this_fixmap_does_not_exist (); - -return __fix_to_virt (idx); -} +#define FIXMAP_PAGE_NOCACHE PAGE_KERNEL_CI -static inline unsigned long virt_to_fix (const unsigned long vaddr) -{ -BUG_ON (vaddr >=FIXADDR_TOP || vaddr <FIXADDR_START ); -return __virt_to_fix (vaddr); -} +#include <asm-generic/fixmap.h> #endif /* !__ASSEMBLY__ */ #endif
Signature · 1 line
1.8.3.1
PATCH 2/11 x86: use generic fixmap.h
In reply to Mark Salter--- arch/x86/include/asm/fixmap.h | 59 +------------------------------------------ 1 file changed, 1 insertion(+), 58 deletions(-)
arch/x86/include/asm/fixmap.h +1 -58
@@ -175,64 +175,7 @@ static inline void __set_fixmap(enum fixed_addresses idx, }#endif -#define set_fixmap (idx, phys) \ - __set_fixmap(idx, phys, PAGE_KERNEL) - -/* -* Some hardware wants to get fixmapped without caching. -*/ -#define set_fixmap_nocache (idx, phys) \ - __set_fixmap(idx, phys, PAGE_KERNEL_NOCACHE) - -#define clear_fixmap (idx) \ - __set_fixmap(idx, 0, __pgprot(0)) - -#define __fix_to_virt (x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) -#define __virt_to_fix (x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT) - -extern void __this_fixmap_does_not_exist (void ); - -/* -* 'index to address' translation. If anyone tries to use the idx -* directly without translation, we catch the bug with a NULL-deference -* kernel oops. Illegal ranges of incoming indices are caught too. -*/ -static __always_inline unsigned long fix_to_virt (const unsigned int idx) -{ -/* -* this branch gets completely eliminated after inlining, -* except when someone tries to use fixaddr indices in an -* illegal way. (such as mixing up address types or using -* out-of-range indices). -* -* If it doesn't get removed, the linker will complain -* loudly with a reasonably clear error message.. -*/ -if (idx >= __end_of_fixed_addresses) -__this_fixmap_does_not_exist (); - -return __fix_to_virt (idx); -} - -static inline unsigned long virt_to_fix (const unsigned long vaddr) -{ -BUG_ON (vaddr >=FIXADDR_TOP || vaddr <FIXADDR_START ); -return __virt_to_fix (vaddr); -} - -/* Return an pointer with offset calculated */ -static __always_inline unsigned long -__set_fixmap_offset (enum fixed_addresses idx,phys_addr_t phys,pgprot_t flags) -{ -__set_fixmap (idx, phys, flags); -return fix_to_virt (idx) + (phys & (PAGE_SIZE -1 )); -} - -#define set_fixmap_offset (idx, phys) \ - __set_fixmap_offset(idx, phys, PAGE_KERNEL) - -#define set_fixmap_offset_nocache (idx, phys) \ - __set_fixmap_offset(idx, phys, PAGE_KERNEL_NOCACHE) +#include <asm-generic/fixmap.h> #endif /* !__ASSEMBLY__ */ #endif /* _ASM_X86_FIXMAP_H */
Signature · 1 line
1.8.3.1
Re: [PATCH 01/11] Add generic fixmap.h
In reply to Mark SalterQuoted 6 lines · Mark Salter
Many architectures provide an
asm/fixmap.hwhich defines support for compile-time 'special' virtual mappings which need to be made beforepaging_init()has run. This suport is also used for early ioremap on x86. Much of this support is identical across the architectures. This patch consolidates all of the common bits intoasm-generic/fixmap.hwhich is intended to be included fromarch/*/include/asm/fixmap.h.
Good idea,
Quoted 4 lines · Mark Salter
include/asm-generic/fixmap.h new file +4
-0+static __always_inline unsigned long fix_to_virt (const unsigned int idx) +{ +/* +* this branch gets completely eliminated after inlining,
include/asm-generic/fixmap.h line 41
Quoted 10 lines
include/asm-generic/fixmap.h new file +10
-0+* except when someone tries to use fixaddr indices in an +* illegal way. (such as mixing up address types or using +* out-of-range indices). +* +* If it doesn't get removed, the linker will complain +* loudly with a reasonably clear error message.. +*/ +if (idx >= __end_of_fixed_addresses) +__this_fixmap_does_not_exist (); +
You might be able to turn this into the more readable BUILD_BUG_ON().
Arnd
Re: [PATCH 11/11] um: use generic fixmap.h
In reply to Mark SalterAm 12.11.2013 14:22, schrieb Mark Salter:
Quoted 7 lines
Signed-off-by Mark Salter <[email protected]>CC Jeff Dike <[email protected]>CC Richard Weinberger <[email protected]>--- arch/um/include/asm/fixmap.h | 40 +--------------------------------------- 1 file changed, 1 insertion(+), 39 deletions(-)
Thanks,
//richard
Re: [PATCH 03/11] arm: use generic fixmap.h
In reply to Mark SalterQuoted 6 lines · Mark Salter
Signed-off-by Mark Salter <[email protected]>CC Russell King <[email protected]>CC linux-arm-kernel at lists.infradead.org--- arch/arm/include/asm/fixmap.h | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-)
Okay, this one is wrong. I just noticed that arm is different from other architectures in that increasing fixed indices convert to increasing virt addresses. Does this need to be the case or is it okay to change it to match other architectures?
--Mark
Re: [PATCH 05/11] metag: use generic fixmap.h
In reply to Mark SalterQuoted 3 lines · Mark Salter
Thanks
James
Quoted 48 lines
--- arch/metag/include/asm/fixmap.h | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-)arch/metag/include/asm/fixmap.h +1
-31@@ -51,37 +51,7 @@ enum fixed_addresses {#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)#define FIXADDR_START ((FIXADDR_TOP - FIXADDR_SIZE) & PMD_MASK) -#define __fix_to_virt (x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) -#define __virt_to_fix (x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT) - -extern void __this_fixmap_does_not_exist (void ); -/* -* 'index to address' translation. If anyone tries to use the idx -* directly without tranlation, we catch the bug with a NULL-deference -* kernel oops. Illegal ranges of incoming indices are caught too. -*/ -static inline unsigned long fix_to_virt (const unsigned int idx) -{ -/* -* this branch gets completely eliminated after inlining, -* except when someone tries to use fixaddr indices in an -* illegal way. (such as mixing up address types or using -* out-of-range indices). -* -* If it doesn't get removed, the linker will complain -* loudly with a reasonably clear error message.. -*/ -if (idx >= __end_of_fixed_addresses) -__this_fixmap_does_not_exist (); - -return __fix_to_virt (idx); -} - -static inline unsigned long virt_to_fix (const unsigned long vaddr) -{ -BUG_ON (vaddr >=FIXADDR_TOP || vaddr <FIXADDR_START ); -return __virt_to_fix (vaddr); -} +#include <asm-generic/fixmap.h> #define kmap_get_fixmap_pte (vaddr) \ pte_offset_kernel( \
Michal Simek
maintainerQuoted 23 lines · Mark Salter
Many architectures provide an
asm/fixmap.hwhich defines support for compile-time 'special' virtual mappings which need to be made beforepaging_init()has run. This suport is also used for early ioremap on x86. Much of this support is identical across the architectures. This patch consolidates all of the common bits intoasm-generic/fixmap.hwhich is intended to be included fromarch/*/include/asm/fixmap.h.This has been compiled on x86, arm, powerpc, and sh, but tested on x86 only.
Mark Salter (11):
Add genericfixmap.h
x86: use genericfixmap.h
arm: use genericfixmap.h
hexagon: use genericfixmap.h
metag: use genericfixmap.h
microblaze: use genericfixmap.h
mips: use genericfixmap.h
powerpc: use genericfixmap.h
sh: use genericfixmap.h
tile: use genericfixmap.h
um: use genericfixmap.h
Quoted 13 lines
arch/arm/include/asm/fixmap.h | 25 ++------ arch/hexagon/include/asm/fixmap.h | 40 +------------ arch/metag/include/asm/fixmap.h | 32 +---------- arch/microblaze/include/asm/fixmap.h | 44 +------------- arch/mips/include/asm/fixmap.h | 33 +---------- arch/powerpc/include/asm/fixmap.h | 44 +------------- arch/sh/include/asm/fixmap.h | 39 +------------ arch/tile/include/asm/fixmap.h | 33 +---------- arch/um/include/asm/fixmap.h | 40 +------------ arch/x86/include/asm/fixmap.h | 59 +------------------ include/asm-generic/fixmap.h | 107 +++++++++++++++++++++++++++++++++++ 11 files changed, 125 insertions(+), 371 deletions(-) create mode 100644 include/asm-generic/fixmap.h
Any repo/branch with all these patches will be helpful.
Thanks,
Michal
Signature · 5 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform
Quoted 16 lines · Michal Simek
Quoted 14 lines · Mark Salter
arch/arm/include/asm/fixmap.h | 25 ++------ arch/hexagon/include/asm/fixmap.h | 40 +------------ arch/metag/include/asm/fixmap.h | 32 +---------- arch/microblaze/include/asm/fixmap.h | 44 +------------- arch/mips/include/asm/fixmap.h | 33 +---------- arch/powerpc/include/asm/fixmap.h | 44 +------------- arch/sh/include/asm/fixmap.h | 39 +------------ arch/tile/include/asm/fixmap.h | 33 +---------- arch/um/include/asm/fixmap.h | 40 +------------ arch/x86/include/asm/fixmap.h | 59 +------------------ include/asm-generic/fixmap.h | 107 +++++++++++++++++++++++++++++++++++ 11 files changed, 125 insertions(+), 371 deletions(-) create mode 100644 include/asm-generic/fixmap.h
Quoted 1 line
Any repo/branch with all these patches will be helpful.
https://github.com/mosalter/linux (fixmap branch)
Re: [PATCH 10/11] tile: use generic fixmap.h
In reply to Mark SalterQuoted 5 lines · Mark Salter
Signed-off-by Mark Salter <[email protected]>CC Chris Metcalf <[email protected]>--- arch/tile/include/asm/fixmap.h | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-)
Signature · 2 lines
Chris Metcalf, Tilera Corp. http://www.tilera.com
Quoted 17 lines · Mark Salter
Quoted 16 lines · Michal Simek
Quoted 14 lines · Mark Salter
arch/arm/include/asm/fixmap.h | 25 ++------ arch/hexagon/include/asm/fixmap.h | 40 +------------ arch/metag/include/asm/fixmap.h | 32 +---------- arch/microblaze/include/asm/fixmap.h | 44 +------------- arch/mips/include/asm/fixmap.h | 33 +---------- arch/powerpc/include/asm/fixmap.h | 44 +------------- arch/sh/include/asm/fixmap.h | 39 +------------ arch/tile/include/asm/fixmap.h | 33 +---------- arch/um/include/asm/fixmap.h | 40 +------------ arch/x86/include/asm/fixmap.h | 59 +------------------ include/asm-generic/fixmap.h | 107 +++++++++++++++++++++++++++++++++++ 11 files changed, 125 insertions(+), 371 deletions(-) create mode 100644 include/asm-generic/fixmap.h
Quoted 3 lines
Quoted 1 line
Any repo/branch with all these patches will be helpful.
https://github.com/mosalter/linux (fixmap branch)
Thanks,
For Microblaze
Thanks,
Michal
Signature · 5 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform
Re: [PATCH 04/11] hexagon: use generic fixmap.h
In reply to Mark SalterQuoted 7 lines · Mark Salter
--- arch/hexagon/include/asm/fixmap.h | 40 +-------------------------------------- 1 file changed, 1 insertion(+), 39 deletions(-)
Thanks for the cleanup!
Signature · 3 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
Re: [PATCH 07/11] mips: use generic fixmap.h
In reply to Mark SalterQuoted 6 lines · Mark Salter
Date: Tue, 12 Nov 2013 08:22:21 -0500
From: Mark Salter <[email protected]>
To: [email protected]
Cc: Mark Salter <[email protected]>, Ralf Baechle <[email protected]>,
[email protected]
Subject: [PATCH 07/11] mips: use genericfixmap.h
For patches 1/7 and this patch:
Thanks!
Ralf