Skip to content

Commit

Permalink
powerpc/kconfig: define CONFIG_DATA_SHIFT and CONFIG_ETEXT_SHIFT
Browse files Browse the repository at this point in the history
CONFIG_STRICT_KERNEL_RWX requires a special alignment
for DATA for some subarches. Today it is just defined
as an #ifdef in vmlinux.lds.S

In order to get more flexibility, this patch moves the
definition of this alignment in Kconfig

On some subarches, CONFIG_STRICT_KERNEL_RWX will
require a special alignment of _etext.

This patch also adds a configuration item for it in Kconfig

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
  • Loading branch information
Christophe Leroy authored and Michael Ellerman committed Feb 23, 2019
1 parent 555f4fd commit 166d97d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
9 changes: 9 additions & 0 deletions arch/powerpc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,15 @@ config THREAD_SHIFT
Used to define the stack size. The default is almost always what you
want. Only change this if you know what you are doing.

config ETEXT_SHIFT
int
default PPC_PAGE_SHIFT

config DATA_SHIFT
int
default 24 if STRICT_KERNEL_RWX && PPC64
default PPC_PAGE_SHIFT

config FORCE_MAX_ZONEORDER
int "Maximum zone order"
range 8 9 if PPC64 && PPC_64K_PAGES
Expand Down
9 changes: 3 additions & 6 deletions arch/powerpc/kernel/vmlinux.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@
#include <asm/cache.h>
#include <asm/thread_info.h>

#if defined(CONFIG_STRICT_KERNEL_RWX) && !defined(CONFIG_PPC32)
#define STRICT_ALIGN_SIZE (1 << 24)
#else
#define STRICT_ALIGN_SIZE PAGE_SIZE
#endif
#define STRICT_ALIGN_SIZE (1 << CONFIG_DATA_SHIFT)
#define ETEXT_ALIGN_SIZE (1 << CONFIG_ETEXT_SHIFT)

ENTRY(_stext)

Expand Down Expand Up @@ -131,7 +128,7 @@ SECTIONS

} :kernel

. = ALIGN(PAGE_SIZE);
. = ALIGN(ETEXT_ALIGN_SIZE);
_etext = .;
PROVIDE32 (etext = .);

Expand Down

0 comments on commit 166d97d

Please sign in to comment.