* [PATCH 00/11] Consolidate asm/fixmap.h files
@ 2013-11-12 13:22 Mark Salter
2013-11-12 13:22 ` [PATCH 01/11] Add generic fixmap.h Mark Salter
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Mark Salter @ 2013-11-12 13:22 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arch, linux-mips, Michal Simek, James Hogan, Russell King,
Arnd Bergmann, linux-hexagon, microblaze-uclinux, Ralf Baechle,
Richard Kuo, Mark Salter, Paul Mackerras, linuxppc-dev,
linux-metag, linux-arm-kernel
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
--
1.8.3.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 01/11] Add generic fixmap.h
2013-11-12 13:22 [PATCH 00/11] Consolidate asm/fixmap.h files Mark Salter
@ 2013-11-12 13:22 ` Mark Salter
2013-11-12 13:46 ` Arnd Bergmann
2013-11-12 13:22 ` [PATCH 08/11] powerpc: use " Mark Salter
2013-11-12 15:39 ` [PATCH 00/11] Consolidate asm/fixmap.h files Michal Simek
2 siblings, 1 reply; 7+ messages in thread
From: Mark Salter @ 2013-11-12 13:22 UTC (permalink / raw)
To: linux-kernel
Cc: linux-arch, linux-mips, Michal Simek, James Hogan, Russell King,
Arnd Bergmann, linux-hexagon, microblaze-uclinux, Ralf Baechle,
Richard Kuo, Mark Salter, Paul Mackerras, linuxppc-dev,
linux-metag, linux-arm-kernel
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.
Signed-off-by: Mark Salter <msalter@redhat.com>
CC: Arnd Bergmann <arnd@arndb.de>
CC: linux-arch@vger.kernel.org
CC: Russell King <linux@arm.linux.org.uk>
CC: linux-arm-kernel@lists.infradead.org
CC: Richard Kuo <rkuo@codeaurora.org>
CC: linux-hexagon@vger.kernel.org
CC: James Hogan <james.hogan@imgtec.com>
CC: linux-metag@vger.kernel.org
CC: Michal Simek <monstr@monstr.eu>
CC: microblaze-uclinux@itee.uq.edu.au
CC: Ralf Baechle <ralf@linux-mips.org>
CC: linux-mips@linux-mips.org
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: Paul Mackerras <paulus@samba.org>
CC: linuxppc-dev@lists.ozlabs.org
---
include/asm-generic/fixmap.h | 107 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 107 insertions(+)
create mode 100644 include/asm-generic/fixmap.h
diff --git a/include/asm-generic/fixmap.h b/include/asm-generic/fixmap.h
new file mode 100644
index 0000000..8d453db
--- /dev/null
+++ b/include/asm-generic/fixmap.h
@@ -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 */
--
1.8.3.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 08/11] powerpc: use generic fixmap.h
2013-11-12 13:22 [PATCH 00/11] Consolidate asm/fixmap.h files Mark Salter
2013-11-12 13:22 ` [PATCH 01/11] Add generic fixmap.h Mark Salter
@ 2013-11-12 13:22 ` Mark Salter
2013-11-12 15:39 ` [PATCH 00/11] Consolidate asm/fixmap.h files Michal Simek
2 siblings, 0 replies; 7+ messages in thread
From: Mark Salter @ 2013-11-12 13:22 UTC (permalink / raw)
To: linux-kernel; +Cc: Paul Mackerras, linuxppc-dev, Mark Salter
Signed-off-by: Mark Salter <msalter@redhat.com>
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: Paul Mackerras <paulus@samba.org>
CC: linuxppc-dev@lists.ozlabs.org
---
arch/powerpc/include/asm/fixmap.h | 44 ++-------------------------------------
1 file changed, 2 insertions(+), 42 deletions(-)
diff --git a/arch/powerpc/include/asm/fixmap.h b/arch/powerpc/include/asm/fixmap.h
index 5c2c023..90f604b 100644
--- a/arch/powerpc/include/asm/fixmap.h
+++ b/arch/powerpc/include/asm/fixmap.h
@@ -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
--
1.8.3.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 01/11] Add generic fixmap.h
2013-11-12 13:22 ` [PATCH 01/11] Add generic fixmap.h Mark Salter
@ 2013-11-12 13:46 ` Arnd Bergmann
0 siblings, 0 replies; 7+ messages in thread
From: Arnd Bergmann @ 2013-11-12 13:46 UTC (permalink / raw)
To: Mark Salter
Cc: linux-arch, linux-mips, Michal Simek, James Hogan, Russell King,
linux-hexagon, linux-kernel, Ralf Baechle, Richard Kuo,
microblaze-uclinux, Paul Mackerras, linuxppc-dev, linux-metag,
linux-arm-kernel
On Tuesday 12 November 2013, Mark Salter wrote:
> 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.
Good idea,
Acked-by: Arnd Bergmann <arnd@arndb.de>
On Tuesday 12 November 2013, Mark Salter wrote:
> +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();
> +
You might be able to turn this into the more readable BUILD_BUG_ON().
Arnd
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 00/11] Consolidate asm/fixmap.h files
2013-11-12 13:22 [PATCH 00/11] Consolidate asm/fixmap.h files Mark Salter
2013-11-12 13:22 ` [PATCH 01/11] Add generic fixmap.h Mark Salter
2013-11-12 13:22 ` [PATCH 08/11] powerpc: use " Mark Salter
@ 2013-11-12 15:39 ` Michal Simek
2013-11-12 15:55 ` Mark Salter
2 siblings, 1 reply; 7+ messages in thread
From: Michal Simek @ 2013-11-12 15:39 UTC (permalink / raw)
To: Mark Salter
Cc: linux-arch, linux-mips, James Hogan, Russell King, Arnd Bergmann,
linux-hexagon, linux-kernel, Ralf Baechle, Richard Kuo,
microblaze-uclinux, Paul Mackerras, linuxppc-dev, linux-metag,
linux-arm-kernel
[-- Attachment #1: Type: text/plain, Size: 2135 bytes --]
On 11/12/2013 02:22 PM, Mark Salter wrote:
> 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
Any repo/branch with all these patches will be helpful.
Thanks,
Michal
--
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
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 00/11] Consolidate asm/fixmap.h files
2013-11-12 15:39 ` [PATCH 00/11] Consolidate asm/fixmap.h files Michal Simek
@ 2013-11-12 15:55 ` Mark Salter
2013-11-14 9:39 ` Michal Simek
0 siblings, 1 reply; 7+ messages in thread
From: Mark Salter @ 2013-11-12 15:55 UTC (permalink / raw)
To: monstr
Cc: linux-arch, linux-mips, James Hogan, Russell King, Arnd Bergmann,
linux-hexagon, linux-kernel, Ralf Baechle, Richard Kuo,
microblaze-uclinux, Paul Mackerras, linuxppc-dev, linux-metag,
linux-arm-kernel
On Tue, 2013-11-12 at 16:39 +0100, Michal Simek wrote:
> On 11/12/2013 02:22 PM, Mark Salter wrote:
> >
> > 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.
https://github.com/mosalter/linux (fixmap branch)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 00/11] Consolidate asm/fixmap.h files
2013-11-12 15:55 ` Mark Salter
@ 2013-11-14 9:39 ` Michal Simek
0 siblings, 0 replies; 7+ messages in thread
From: Michal Simek @ 2013-11-14 9:39 UTC (permalink / raw)
To: Mark Salter
Cc: linux-arch, linux-mips, James Hogan, Russell King, Arnd Bergmann,
linux-hexagon, linux-kernel, Ralf Baechle, Richard Kuo,
microblaze-uclinux, Paul Mackerras, linuxppc-dev, linux-metag,
linux-arm-kernel
[-- Attachment #1: Type: text/plain, Size: 1503 bytes --]
On 11/12/2013 04:55 PM, Mark Salter wrote:
> On Tue, 2013-11-12 at 16:39 +0100, Michal Simek wrote:
>> On 11/12/2013 02:22 PM, Mark Salter wrote:
>>>
>>> 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.
>
> https://github.com/mosalter/linux (fixmap branch)
Thanks,
For Microblaze
Tested-by: Michal Simek <monstr@monstr.eu>
Thanks,
Michal
--
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
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-11-14 9:40 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-12 13:22 [PATCH 00/11] Consolidate asm/fixmap.h files Mark Salter
2013-11-12 13:22 ` [PATCH 01/11] Add generic fixmap.h Mark Salter
2013-11-12 13:46 ` Arnd Bergmann
2013-11-12 13:22 ` [PATCH 08/11] powerpc: use " Mark Salter
2013-11-12 15:39 ` [PATCH 00/11] Consolidate asm/fixmap.h files Michal Simek
2013-11-12 15:55 ` Mark Salter
2013-11-14 9:39 ` Michal Simek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).