Skip to content

Commit

Permalink
powerpc/32s: Move setup_{kuep/kuap}() into {kuep/kuap}.c
Browse files Browse the repository at this point in the history
[ Upstream commit 91ec667 ]

Avoids the #ifdef in mmu.c

Signed-off-by: Christophe Leroy <[email protected]>
Signed-off-by: Michael Ellerman <[email protected]>
Link: https://lore.kernel.org/r/0b7a13d414837e58264edc336b89c2fe9f35f9bc.1622708530.git.christophe.leroy@csgroup.eu
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
chleroy authored and Sasha Levin committed Aug 26, 2021
1 parent 534a0bc commit efe40fd
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
1 change: 1 addition & 0 deletions arch/powerpc/mm/book3s32/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ obj-y += mmu.o mmu_context.o
obj-$(CONFIG_PPC_BOOK3S_603) += nohash_low.o
obj-$(CONFIG_PPC_BOOK3S_604) += hash_low.o tlb.o
obj-$(CONFIG_PPC_KUEP) += kuep.o
obj-$(CONFIG_PPC_KUAP) += kuap.o
11 changes: 11 additions & 0 deletions arch/powerpc/mm/book3s32/kuap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// SPDX-License-Identifier: GPL-2.0-or-later

#include <asm/kup.h>

void __init setup_kuap(bool disabled)
{
pr_info("Activating Kernel Userspace Access Protection\n");

if (disabled)
pr_warn("KUAP cannot be disabled yet on 6xx when compiled in\n");
}
8 changes: 8 additions & 0 deletions arch/powerpc/mm/book3s32/kuep.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,11 @@ void kuep_unlock(void)
{
kuep_update(mfsr(0) & ~SR_NX);
}

void __init setup_kuep(bool disabled)
{
pr_info("Activating Kernel Userspace Execution Prevention\n");

if (disabled)
pr_warn("KUEP cannot be disabled yet on 6xx when compiled in\n");
}
20 changes: 0 additions & 20 deletions arch/powerpc/mm/book3s32/mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,26 +445,6 @@ void __init print_system_hash_info(void)
pr_info("Hash_mask = 0x%lx\n", Hash_mask);
}

#ifdef CONFIG_PPC_KUEP
void __init setup_kuep(bool disabled)
{
pr_info("Activating Kernel Userspace Execution Prevention\n");

if (disabled)
pr_warn("KUEP cannot be disabled yet on 6xx when compiled in\n");
}
#endif

#ifdef CONFIG_PPC_KUAP
void __init setup_kuap(bool disabled)
{
pr_info("Activating Kernel Userspace Access Protection\n");

if (disabled)
pr_warn("KUAP cannot be disabled yet on 6xx when compiled in\n");
}
#endif

void __init early_init_mmu(void)
{
}

0 comments on commit efe40fd

Please sign in to comment.