2005-11-11 10:25:24 +07:00
|
|
|
#ifndef _ASM_POWERPC_PAGE_32_H
|
|
|
|
#define _ASM_POWERPC_PAGE_32_H
|
|
|
|
|
2016-02-09 23:08:25 +07:00
|
|
|
#include <asm/cache.h>
|
|
|
|
|
2008-04-22 01:22:34 +07:00
|
|
|
#if defined(CONFIG_PHYSICAL_ALIGN) && (CONFIG_PHYSICAL_START != 0)
|
|
|
|
#if (CONFIG_PHYSICAL_START % CONFIG_PHYSICAL_ALIGN) != 0
|
|
|
|
#error "CONFIG_PHYSICAL_START must be a multiple of CONFIG_PHYSICAL_ALIGN"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2005-11-11 10:25:24 +07:00
|
|
|
#define VM_DATA_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS32
|
|
|
|
|
2007-11-19 15:25:06 +07:00
|
|
|
#ifdef CONFIG_NOT_COHERENT_CACHE
|
2010-08-11 08:03:22 +07:00
|
|
|
#define ARCH_DMA_MINALIGN L1_CACHE_BYTES
|
2007-11-19 15:25:06 +07:00
|
|
|
#endif
|
|
|
|
|
2008-09-24 23:01:24 +07:00
|
|
|
#ifdef CONFIG_PTE_64BIT
|
|
|
|
#define PTE_FLAGS_OFFSET 4 /* offset of PTE flags, in bytes */
|
|
|
|
#else
|
|
|
|
#define PTE_FLAGS_OFFSET 0
|
|
|
|
#endif
|
|
|
|
|
powerpc/44x: Support for 256KB PAGE_SIZE
This patch adds support for 256KB pages on ppc44x-based boards.
For simplification of implementation with 256KB pages we still assume
2-level paging. As a side effect this leads to wasting extra memory space
reserved for PTE tables: only 1/4 of pages allocated for PTEs are
actually used. But this may be an acceptable trade-off to achieve the
high performance we have with big PAGE_SIZEs in some applications (e.g.
RAID).
Also with 256KB PAGE_SIZE we increase THREAD_SIZE up to 32KB to minimize
the risk of stack overflows in the cases of on-stack arrays, which size
depends on the page size (e.g. multipage BIOs, NTFS, etc.).
With 256KB PAGE_SIZE we need to decrease the PKMAP_ORDER at least down
to 9, otherwise all high memory (2 ^ 10 * PAGE_SIZE == 256MB) we'll be
occupied by PKMAP addresses leaving no place for vmalloc. We do not
separate PKMAP_ORDER for 256K from 16K/64K PAGE_SIZE here; actually that
value of 10 in support for 16K/64K had been selected rather intuitively.
Thus now for all cases of PAGE_SIZE on ppc44x (including the default, 4KB,
one) we have 512 pages for PKMAP.
Because ELF standard supports only page sizes up to 64K, then you should
use binutils later than 2.17.50.0.3 with '-zmax-page-size' set to 256K
for building applications, which are to be run with the 256KB-page sized
kernel. If using the older binutils, then you should patch them like follows:
--- binutils/bfd/elf32-ppc.c.orig
+++ binutils/bfd/elf32-ppc.c
-#define ELF_MAXPAGESIZE 0x10000
+#define ELF_MAXPAGESIZE 0x40000
One more restriction we currently have with 256KB page sizes is inability
to use shmem safely, so, for now, the 256KB is available only if you turn
the CONFIG_SHMEM option off (another variant is to use BROKEN).
Though, if you need shmem with 256KB pages, you can always remove the !SHMEM
dependency in 'config PPC_256K_PAGES', and use the workaround available here:
http://lkml.org/lkml/2008/12/19/20
Signed-off-by: Yuri Tikhonov <yur@emcraft.com>
Signed-off-by: Ilya Yanok <yanok@emcraft.com>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
2009-01-29 08:40:44 +07:00
|
|
|
#ifdef CONFIG_PPC_256K_PAGES
|
|
|
|
#define PTE_SHIFT (PAGE_SHIFT - PTE_T_LOG2 - 2) /* 1/4 of a page */
|
|
|
|
#else
|
2008-12-11 08:55:41 +07:00
|
|
|
#define PTE_SHIFT (PAGE_SHIFT - PTE_T_LOG2) /* full page */
|
powerpc/44x: Support for 256KB PAGE_SIZE
This patch adds support for 256KB pages on ppc44x-based boards.
For simplification of implementation with 256KB pages we still assume
2-level paging. As a side effect this leads to wasting extra memory space
reserved for PTE tables: only 1/4 of pages allocated for PTEs are
actually used. But this may be an acceptable trade-off to achieve the
high performance we have with big PAGE_SIZEs in some applications (e.g.
RAID).
Also with 256KB PAGE_SIZE we increase THREAD_SIZE up to 32KB to minimize
the risk of stack overflows in the cases of on-stack arrays, which size
depends on the page size (e.g. multipage BIOs, NTFS, etc.).
With 256KB PAGE_SIZE we need to decrease the PKMAP_ORDER at least down
to 9, otherwise all high memory (2 ^ 10 * PAGE_SIZE == 256MB) we'll be
occupied by PKMAP addresses leaving no place for vmalloc. We do not
separate PKMAP_ORDER for 256K from 16K/64K PAGE_SIZE here; actually that
value of 10 in support for 16K/64K had been selected rather intuitively.
Thus now for all cases of PAGE_SIZE on ppc44x (including the default, 4KB,
one) we have 512 pages for PKMAP.
Because ELF standard supports only page sizes up to 64K, then you should
use binutils later than 2.17.50.0.3 with '-zmax-page-size' set to 256K
for building applications, which are to be run with the 256KB-page sized
kernel. If using the older binutils, then you should patch them like follows:
--- binutils/bfd/elf32-ppc.c.orig
+++ binutils/bfd/elf32-ppc.c
-#define ELF_MAXPAGESIZE 0x10000
+#define ELF_MAXPAGESIZE 0x40000
One more restriction we currently have with 256KB page sizes is inability
to use shmem safely, so, for now, the 256KB is available only if you turn
the CONFIG_SHMEM option off (another variant is to use BROKEN).
Though, if you need shmem with 256KB pages, you can always remove the !SHMEM
dependency in 'config PPC_256K_PAGES', and use the workaround available here:
http://lkml.org/lkml/2008/12/19/20
Signed-off-by: Yuri Tikhonov <yur@emcraft.com>
Signed-off-by: Ilya Yanok <yanok@emcraft.com>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
2009-01-29 08:40:44 +07:00
|
|
|
#endif
|
2008-12-11 08:55:41 +07:00
|
|
|
|
2005-11-11 10:25:24 +07:00
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
/*
|
|
|
|
* The basic type of a PTE - 64 bits for those CPUs with > 32 bit
|
2008-09-24 23:01:24 +07:00
|
|
|
* physical addressing.
|
2005-11-11 10:25:24 +07:00
|
|
|
*/
|
|
|
|
#ifdef CONFIG_PTE_64BIT
|
|
|
|
typedef unsigned long long pte_basic_t;
|
|
|
|
#else
|
|
|
|
typedef unsigned long pte_basic_t;
|
|
|
|
#endif
|
|
|
|
|
2016-02-09 23:08:25 +07:00
|
|
|
/*
|
|
|
|
* Clear page using the dcbz instruction, which doesn't cause any
|
|
|
|
* memory traffic (except to write out any cache lines which get
|
|
|
|
* displaced). This only works on cacheable memory.
|
|
|
|
*/
|
|
|
|
static inline void clear_page(void *addr)
|
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
for (i = 0; i < PAGE_SIZE / L1_CACHE_BYTES; i++, addr += L1_CACHE_BYTES)
|
|
|
|
dcbz(addr);
|
|
|
|
}
|
2005-11-11 10:25:24 +07:00
|
|
|
extern void copy_page(void *to, void *from);
|
|
|
|
|
2009-05-14 05:56:30 +07:00
|
|
|
#include <asm-generic/getorder.h>
|
2005-11-11 10:25:24 +07:00
|
|
|
|
2008-12-11 08:55:41 +07:00
|
|
|
#define PGD_T_LOG2 (__builtin_ffs(sizeof(pgd_t)) - 1)
|
|
|
|
#define PTE_T_LOG2 (__builtin_ffs(sizeof(pte_t)) - 1)
|
|
|
|
|
2005-11-11 10:25:24 +07:00
|
|
|
#endif /* __ASSEMBLY__ */
|
|
|
|
|
|
|
|
#endif /* _ASM_POWERPC_PAGE_32_H */
|