* Re: [04/12] powerpc/prom_init: Replace __initdata with __prombss when applicable
From: Michael Ellerman @ 2018-10-19 2:51 UTC (permalink / raw)
To: Benjamin Herrenschmidt, linuxppc-dev
In-Reply-To: <20181015025000.4522-4-benh@kernel.crashing.org>
On Mon, 2018-10-15 at 02:49:52 UTC, Benjamin Herrenschmidt wrote:
> This replaces all occurrences of __initdata for uninitialized
> data with a new __prombss
>
> Currently __promdata is defined to be __initdata but we'll
> eventually change that.
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/e63334e556d9286fc30bec10503608
cheers
^ permalink raw reply
* Re: [05/12] powerpc/prom_init: Remove support for OPAL v2
From: Michael Ellerman @ 2018-10-19 2:51 UTC (permalink / raw)
To: Benjamin Herrenschmidt, linuxppc-dev
In-Reply-To: <20181015025000.4522-5-benh@kernel.crashing.org>
On Mon, 2018-10-15 at 02:49:53 UTC, Benjamin Herrenschmidt wrote:
> We removed support for running under any OPAL version
> earlier than v3 in 2015 (they never saw the light of day
> anyway), but we kept some leftovers of this support in
> prom_init.c, so let's take it out.
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/11fdb309341ca1ba2e3d03fd1c9c0c
cheers
^ permalink raw reply
* Re: [06/12] powerpc/prom_init: Move prom_radix_disable to __prombss
From: Michael Ellerman @ 2018-10-19 2:51 UTC (permalink / raw)
To: Benjamin Herrenschmidt, linuxppc-dev
In-Reply-To: <20181015025000.4522-6-benh@kernel.crashing.org>
On Mon, 2018-10-15 at 02:49:54 UTC, Benjamin Herrenschmidt wrote:
> Initialize it dynamically instead of statically
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/c886087caee759790db47f345f8382
cheers
^ permalink raw reply
* Re: [07/12] powerpc/prom_init: Move ibm_arch_vec to __prombss
From: Michael Ellerman @ 2018-10-19 2:51 UTC (permalink / raw)
To: Benjamin Herrenschmidt, linuxppc-dev
In-Reply-To: <20181015025000.4522-7-benh@kernel.crashing.org>
On Mon, 2018-10-15 at 02:49:55 UTC, Benjamin Herrenschmidt wrote:
> Make the existing initialized definition constant and copy
> it to a __prombss copy
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/a614f52e75bd69b513707b4adc6721
cheers
^ permalink raw reply
* Re: [08/12] powerpc/prom_init: Move const structures to __initconst
From: Michael Ellerman @ 2018-10-19 2:51 UTC (permalink / raw)
To: Benjamin Herrenschmidt, linuxppc-dev
In-Reply-To: <20181015025000.4522-8-benh@kernel.crashing.org>
On Mon, 2018-10-15 at 02:49:56 UTC, Benjamin Herrenschmidt wrote:
> As they are no longer used past the end of prom_init
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/d00e34b92cd7d8f1c10c2f0a8c1036
cheers
^ permalink raw reply
* Re: [09/12] powerpc/prom_init: Move a few remaining statics to appropriate sections
From: Michael Ellerman @ 2018-10-19 2:51 UTC (permalink / raw)
To: Benjamin Herrenschmidt, linuxppc-dev
In-Reply-To: <20181015025000.4522-9-benh@kernel.crashing.org>
On Mon, 2018-10-15 at 02:49:57 UTC, Benjamin Herrenschmidt wrote:
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/8ca2d5151e7f5cbef42eda780eac56
cheers
^ permalink raw reply
* Re: [10/12] powerpc/prom_init: Move __prombss to it's own section and store it in .bss
From: Michael Ellerman @ 2018-10-19 2:51 UTC (permalink / raw)
To: Benjamin Herrenschmidt, linuxppc-dev
In-Reply-To: <20181015025000.4522-10-benh@kernel.crashing.org>
On Mon, 2018-10-15 at 02:49:58 UTC, Benjamin Herrenschmidt wrote:
> This makes __prombss its own section, and for now store
> it in .bss.
>
> This will give us the ability later to store it elsewhere
> and/or free it after boot (it's about 8KB).
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/5f69e38885c3483a1838dd946aaf01
cheers
^ permalink raw reply
* Re: [11/12] powerpc: Check prom_init for disallowed sections
From: Michael Ellerman @ 2018-10-19 2:51 UTC (permalink / raw)
To: Benjamin Herrenschmidt, linuxppc-dev
In-Reply-To: <20181015025000.4522-11-benh@kernel.crashing.org>
On Mon, 2018-10-15 at 02:49:59 UTC, Benjamin Herrenschmidt wrote:
> prom_init.c must not modify the kernel image outside
> of the .bss.prominit section. Thus make sure that
> prom_init.o doesn't have anything in any of these:
>
> .data
> .bss
> .init.data
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/2c51d97ee88da897db8405f659d173
cheers
^ permalink raw reply
* Re: [12/12] powerpc/prom_init: Generate "phandle" instead of "linux, phandle"
From: Michael Ellerman @ 2018-10-19 2:51 UTC (permalink / raw)
To: Benjamin Herrenschmidt, linuxppc-dev
In-Reply-To: <20181015025000.4522-12-benh@kernel.crashing.org>
On Mon, 2018-10-15 at 02:50:00 UTC, Benjamin Herrenschmidt wrote:
> When creating the boot-time FDT from an actual Open Firmware live
> tree, let's generate "phandle" properties for the phandles instead
> of the old deprecated "linux,phandle".
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/f1f208e54d08ccf00121c700a9bb1f
cheers
^ permalink raw reply
* Re: powerpc/traps: fix machine check handlers to use pr_cont()
From: Michael Ellerman @ 2018-10-19 2:51 UTC (permalink / raw)
To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras
Cc: linuxppc-dev, linux-kernel
In-Reply-To: <c96ba8d949aa62604af12cfa030e2357f9a93597.1539587888.git.christophe.leroy@c-s.fr>
On Mon, 2018-10-15 at 07:20:45 UTC, Christophe Leroy wrote:
> When printing the machine check cause, the cause appears on the
> following line due to bad use of printk without \n:
>
> [ 33.663993] Machine check in kernel mode.
> [ 33.664011] Caused by (from SRR1=9032):
> [ 33.664036] Data access error at address c90c8000
>
> This patch fixes it by using pr_cont() for the second part:
>
> [ 133.258131] Machine check in kernel mode.
> [ 133.258146] Caused by (from SRR1=9032): Data access error at address c90c8000
>
> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/422123ccb9a13dcea2e008194ae6c2
cheers
^ permalink raw reply
* Re: powerpc/traps: remove redundant in_interrupt panic in die()
From: Michael Ellerman @ 2018-10-19 2:51 UTC (permalink / raw)
To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras
Cc: linuxppc-dev, linux-kernel
In-Reply-To: <52facff7ae5377f1f0d023917dddb588350a7028.1539589080.git.christophe.leroy@c-s.fr>
On Mon, 2018-10-15 at 07:38:10 UTC, Christophe Leroy wrote:
> do_exit() already includes a test to panic() is in_interrupt()
>
> This patch removes powerpc one which is redundant.
>
> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/bd03fd84a53ac9ddaeb0a0fc4c4c98
cheers
^ permalink raw reply
* Re: powerpc/io: remove old GCC version implementation
From: Michael Ellerman @ 2018-10-19 2:51 UTC (permalink / raw)
To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras
Cc: linuxppc-dev, linux-kernel
In-Reply-To: <199ae2a28f14f944ee9ae2770a3f1dd030e762bc.1539693039.git.christophe.leroy@c-s.fr>
On Tue, 2018-10-16 at 12:33:40 UTC, Christophe Leroy wrote:
> GCC 4.6 is the minimum supported now.
>
> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/a0e102914aa3f619a5bc68a0d33e17
cheers
^ permalink raw reply
* Re: powerpc/book3e: redefine pte_mkprivileged() and pte_mkuser()
From: Michael Ellerman @ 2018-10-19 2:51 UTC (permalink / raw)
To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras,
aneesh.kumar
Cc: linuxppc-dev, linux-kernel
In-Reply-To: <19885260cc71182f8c03840204e2553ef42acb67.1539781367.git.christophe.leroy@c-s.fr>
On Wed, 2018-10-17 at 13:03:22 UTC, Christophe Leroy wrote:
> Book3e defines both _PAGE_USER and _PAGE_PRIVILEGED, so the nohash
> default pte_mkprivileged() and pte_mkuser() are not usable.
>
> This patch redefines them for book3e.
>
> In theorie, only pte_mkprivileged() needs to be redefined because
> _PAGE_USER includes _PAGE_PRIVILEGED, but it is less confusing
> to redefine both.
>
> Fixes: a0da4bc166f2 ("powerpc/mm: Allow platforms to redefine some helpers")
> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/bde1a1335c5031758d3917d83dd5b8
cheers
^ permalink raw reply
* Re: powerpc/mm: Make pte_pgprot return all pte bits
From: Michael Ellerman @ 2018-10-19 2:51 UTC (permalink / raw)
To: Michael Ellerman, linuxppc-dev; +Cc: aneesh.kumar
In-Reply-To: <20181018133316.10073-1-mpe@ellerman.id.au>
On Thu, 2018-10-18 at 13:33:16 UTC, Michael Ellerman wrote:
> From: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
>
> Other archs do the same and instead of adding required pte bits (which
> got masked out) in __ioremap_at(), make sure we filter only pfn bits
> out.
>
> Fixes: 26973fa5ac0e ("powerpc/mm: use pte helpers in generic code")
> Reviewed-by: Christophe Leroy <christophe.leroy@c-s.fr>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Applied to powerpc next.
https://git.kernel.org/powerpc/c/b9fb4480a3af85552d88561a2fea9c
cheers
^ permalink raw reply
* [PATCH] selftests/powerpc: Fix out-of-tree build errors
From: Michael Ellerman @ 2018-10-19 4:06 UTC (permalink / raw)
To: linuxppc-dev
Some of our Makefiles don't do the right thing when building the
selftests with O=, fix them up.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
tools/testing/selftests/powerpc/cache_shape/Makefile | 2 --
tools/testing/selftests/powerpc/ptrace/Makefile | 2 --
tools/testing/selftests/powerpc/signal/Makefile | 2 --
tools/testing/selftests/powerpc/switch_endian/Makefile | 1 +
4 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/tools/testing/selftests/powerpc/cache_shape/Makefile b/tools/testing/selftests/powerpc/cache_shape/Makefile
index ede4d3dae750..62e947ca9921 100644
--- a/tools/testing/selftests/powerpc/cache_shape/Makefile
+++ b/tools/testing/selftests/powerpc/cache_shape/Makefile
@@ -1,8 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
TEST_PROGS := cache_shape
-all: $(TEST_PROGS)
-
$(TEST_PROGS): ../harness.c ../utils.c
top_srcdir = ../../../../..
diff --git a/tools/testing/selftests/powerpc/ptrace/Makefile b/tools/testing/selftests/powerpc/ptrace/Makefile
index 9b35ca8e8f13..6ac71b629276 100644
--- a/tools/testing/selftests/powerpc/ptrace/Makefile
+++ b/tools/testing/selftests/powerpc/ptrace/Makefile
@@ -7,8 +7,6 @@ TEST_PROGS := ptrace-gpr ptrace-tm-gpr ptrace-tm-spd-gpr \
top_srcdir = ../../../../..
include ../../lib.mk
-all: $(TEST_PROGS)
-
CFLAGS += -m64 -I../../../../../usr/include -I../tm -mhtm -fno-pie
ptrace-pkey core-pkey: child.h
diff --git a/tools/testing/selftests/powerpc/signal/Makefile b/tools/testing/selftests/powerpc/signal/Makefile
index 1fca25c6ace0..d34a7c7710db 100644
--- a/tools/testing/selftests/powerpc/signal/Makefile
+++ b/tools/testing/selftests/powerpc/signal/Makefile
@@ -1,8 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
TEST_PROGS := signal signal_tm
-all: $(TEST_PROGS)
-
$(TEST_PROGS): ../harness.c ../utils.c signal.S
CFLAGS += -maltivec
diff --git a/tools/testing/selftests/powerpc/switch_endian/Makefile b/tools/testing/selftests/powerpc/switch_endian/Makefile
index fcd2dcb8972b..bdc081afedb0 100644
--- a/tools/testing/selftests/powerpc/switch_endian/Makefile
+++ b/tools/testing/selftests/powerpc/switch_endian/Makefile
@@ -8,6 +8,7 @@ EXTRA_CLEAN = $(OUTPUT)/*.o $(OUTPUT)/check-reversed.S
top_srcdir = ../../../../..
include ../../lib.mk
+$(OUTPUT)/switch_endian_test: ASFLAGS += -I $(OUTPUT)
$(OUTPUT)/switch_endian_test: $(OUTPUT)/check-reversed.S
$(OUTPUT)/check-reversed.o: $(OUTPUT)/check.o
--
2.17.2
^ permalink raw reply related
* [PATCH] powerpc/mm: Fix page table dump to work on Radix
From: Michael Ellerman @ 2018-10-19 4:12 UTC (permalink / raw)
To: linuxppc-dev; +Cc: aneesh.kumar
When we're running on Book3S with the Radix MMU enabled the page table
dump currently prints the wrong addresses because it uses the wrong
start address.
Fix it to use PAGE_OFFSET rather than KERN_VIRT_START.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/mm/dump_linuxpagetables.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/mm/dump_linuxpagetables.c b/arch/powerpc/mm/dump_linuxpagetables.c
index e60aa6d7456d..2b74f8adf4d0 100644
--- a/arch/powerpc/mm/dump_linuxpagetables.c
+++ b/arch/powerpc/mm/dump_linuxpagetables.c
@@ -267,12 +267,13 @@ static void walk_pagetables(struct pg_state *st)
unsigned int i;
unsigned long addr;
+ addr = st->start_address;
+
/*
* Traverse the linux pagetable structure and dump pages that are in
* the hash pagetable.
*/
- for (i = 0; i < PTRS_PER_PGD; i++, pgd++) {
- addr = KERN_VIRT_START + i * PGDIR_SIZE;
+ for (i = 0; i < PTRS_PER_PGD; i++, pgd++, addr += PGDIR_SIZE) {
if (!pgd_none(*pgd) && !pgd_huge(*pgd))
/* pgd exists */
walk_pud(st, pgd, addr);
@@ -321,9 +322,14 @@ static int ptdump_show(struct seq_file *m, void *v)
{
struct pg_state st = {
.seq = m,
- .start_address = KERN_VIRT_START,
.marker = address_markers,
};
+
+ if (radix_enabled())
+ st.start_address = PAGE_OFFSET;
+ else
+ st.start_address = KERN_VIRT_START;
+
/* Traverse kernel page tables */
walk_pagetables(&st);
note_page(&st, 0, 0, 0);
--
2.17.2
^ permalink raw reply related
* [PATCH 1/6] powerpc/mm/radix: Fix off-by-one in split mapping logic
From: Michael Ellerman @ 2018-10-19 4:13 UTC (permalink / raw)
To: linuxppc-dev; +Cc: aneesh.kumar
When we have CONFIG_STRICT_KERNEL_RWX enabled, we try to split the
kernel linear (1:1) mapping so that the kernel text is in a separate
page to kernel data, so we can mark the former read-only.
We could achieve that just by always using 64K pages for the linear
mapping, but we try to be smarter. Instead we use huge pages when
possible, and only switch to smaller pages when necessary.
However we have an off-by-one bug in that logic, which causes us to
calculate the wrong boundary between text and data.
For example with the end of the kernel text at 16M we see:
radix-mmu: Mapped 0x0000000000000000-0x0000000001200000 with 64.0 KiB pages
radix-mmu: Mapped 0x0000000001200000-0x0000000040000000 with 2.00 MiB pages
radix-mmu: Mapped 0x0000000040000000-0x0000000100000000 with 1.00 GiB pages
ie. we mapped from 0 to 18M with 64K pages, even though the boundary
between text and data is at 16M.
With the fix we see we're correctly hitting the 16M boundary:
radix-mmu: Mapped 0x0000000000000000-0x0000000001000000 with 64.0 KiB pages
radix-mmu: Mapped 0x0000000001000000-0x0000000040000000 with 2.00 MiB pages
radix-mmu: Mapped 0x0000000040000000-0x0000000100000000 with 1.00 GiB pages
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/mm/pgtable-radix.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/mm/pgtable-radix.c b/arch/powerpc/mm/pgtable-radix.c
index c879979faa73..d88d76231754 100644
--- a/arch/powerpc/mm/pgtable-radix.c
+++ b/arch/powerpc/mm/pgtable-radix.c
@@ -294,14 +294,14 @@ static int __meminit create_physical_mapping(unsigned long start,
}
if (split_text_mapping && (mapping_size == PUD_SIZE) &&
- (addr <= __pa_symbol(__init_begin)) &&
+ (addr < __pa_symbol(__init_begin)) &&
(addr + mapping_size) >= __pa_symbol(_stext)) {
max_mapping_size = PMD_SIZE;
goto retry;
}
if (split_text_mapping && (mapping_size == PMD_SIZE) &&
- (addr <= __pa_symbol(__init_begin)) &&
+ (addr < __pa_symbol(__init_begin)) &&
(addr + mapping_size) >= __pa_symbol(_stext)) {
mapping_size = PAGE_SIZE;
psize = mmu_virtual_psize;
--
2.17.2
^ permalink raw reply related
* [PATCH 2/6] powerpc/mm/radix: Fix overuse of small pages in splitting logic
From: Michael Ellerman @ 2018-10-19 4:13 UTC (permalink / raw)
To: linuxppc-dev; +Cc: aneesh.kumar
In-Reply-To: <20181019041334.4945-1-mpe@ellerman.id.au>
When we have CONFIG_STRICT_KERNEL_RWX enabled, we want to split the
linear mapping at the text/data boundary so we can map the kernel text
read only.
But the current logic uses small pages for the entire text section,
regardless of whether a larger page size would fit. eg. with the
boundary at 16M we could use 2M pages, but instead we use 64K pages up
to the 16M boundary:
Mapped 0x0000000000000000-0x0000000001000000 with 64.0 KiB pages
Mapped 0x0000000001000000-0x0000000040000000 with 2.00 MiB pages
Mapped 0x0000000040000000-0x0000000100000000 with 1.00 GiB pages
This is because the test is checking if addr is < __init_begin
and addr + mapping_size is >= _stext. But that is true for all pages
between _stext and __init_begin.
Instead what we want to check is if we are crossing the text/data
boundary, which is at __init_begin. With that fixed we see:
Mapped 0x0000000000000000-0x0000000000e00000 with 2.00 MiB pages
Mapped 0x0000000000e00000-0x0000000001000000 with 64.0 KiB pages
Mapped 0x0000000001000000-0x0000000040000000 with 2.00 MiB pages
Mapped 0x0000000040000000-0x0000000100000000 with 1.00 GiB pages
ie. we're correctly using 2MB pages below __init_begin, but we still
drop down to 64K pages unnecessarily at the boundary.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/mm/pgtable-radix.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/mm/pgtable-radix.c b/arch/powerpc/mm/pgtable-radix.c
index d88d76231754..bb85c58b96c8 100644
--- a/arch/powerpc/mm/pgtable-radix.c
+++ b/arch/powerpc/mm/pgtable-radix.c
@@ -295,14 +295,14 @@ static int __meminit create_physical_mapping(unsigned long start,
if (split_text_mapping && (mapping_size == PUD_SIZE) &&
(addr < __pa_symbol(__init_begin)) &&
- (addr + mapping_size) >= __pa_symbol(_stext)) {
+ (addr + mapping_size) >= __pa_symbol(__init_begin)) {
max_mapping_size = PMD_SIZE;
goto retry;
}
if (split_text_mapping && (mapping_size == PMD_SIZE) &&
(addr < __pa_symbol(__init_begin)) &&
- (addr + mapping_size) >= __pa_symbol(_stext)) {
+ (addr + mapping_size) >= __pa_symbol(__init_begin)) {
mapping_size = PAGE_SIZE;
psize = mmu_virtual_psize;
}
--
2.17.2
^ permalink raw reply related
* [PATCH 3/6] powerpc/mm/radix: Fix small page at boundary when splitting
From: Michael Ellerman @ 2018-10-19 4:13 UTC (permalink / raw)
To: linuxppc-dev; +Cc: aneesh.kumar
In-Reply-To: <20181019041334.4945-1-mpe@ellerman.id.au>
When we have CONFIG_STRICT_KERNEL_RWX enabled, we want to split the
linear mapping at the text/data boundary so we can map the kernel
text read only.
Currently we always use a small page at the text/data boundary, even
when that's not necessary:
Mapped 0x0000000000000000-0x0000000000e00000 with 2.00 MiB pages
Mapped 0x0000000000e00000-0x0000000001000000 with 64.0 KiB pages
Mapped 0x0000000001000000-0x0000000040000000 with 2.00 MiB pages
This is because the check that the mapping crosses the __init_begin
boundary is too strict, it also returns true when we map exactly up to
the boundary.
So fix it to check that the mapping would actually map past
__init_begin, and with that we see:
Mapped 0x0000000000000000-0x0000000040000000 with 2.00 MiB pages
Mapped 0x0000000040000000-0x0000000100000000 with 1.00 GiB pages
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/mm/pgtable-radix.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/mm/pgtable-radix.c b/arch/powerpc/mm/pgtable-radix.c
index bb85c58b96c8..7a44ec276290 100644
--- a/arch/powerpc/mm/pgtable-radix.c
+++ b/arch/powerpc/mm/pgtable-radix.c
@@ -295,14 +295,14 @@ static int __meminit create_physical_mapping(unsigned long start,
if (split_text_mapping && (mapping_size == PUD_SIZE) &&
(addr < __pa_symbol(__init_begin)) &&
- (addr + mapping_size) >= __pa_symbol(__init_begin)) {
+ (addr + mapping_size) > __pa_symbol(__init_begin)) {
max_mapping_size = PMD_SIZE;
goto retry;
}
if (split_text_mapping && (mapping_size == PMD_SIZE) &&
(addr < __pa_symbol(__init_begin)) &&
- (addr + mapping_size) >= __pa_symbol(__init_begin)) {
+ (addr + mapping_size) > __pa_symbol(__init_begin)) {
mapping_size = PAGE_SIZE;
psize = mmu_virtual_psize;
}
--
2.17.2
^ permalink raw reply related
* [PATCH 4/6] powerpc/mm/radix: Remove the retry in the split mapping logic
From: Michael Ellerman @ 2018-10-19 4:13 UTC (permalink / raw)
To: linuxppc-dev; +Cc: aneesh.kumar
In-Reply-To: <20181019041334.4945-1-mpe@ellerman.id.au>
When we have CONFIG_STRICT_KERNEL_RWX enabled, we want to split the
linear mapping at the text/data boundary so we can map the kernel
text read only.
The current logic uses a goto inside the for loop, which works, but is
hard to reason about.
When we hit the goto retry case we set max_mapping_size to PMD_SIZE
and go back to the start.
Setting max_mapping_size means we skip the PUD case and go to the PMD
case.
We know we will pass the alignment and gap checks because the only
reason we are there is we hit the goto retry, and that is guarded by
mapping_size == PUD_SIZE, which means addr is PUD aligned and gap is
greater or equal to PUD_SIZE.
So the only part of the check that can fail is the mmu_psize_defs
check for the 2M page size.
If we just duplicate that check we can avoid the goto, and we get the
same result.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/mm/pgtable-radix.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/arch/powerpc/mm/pgtable-radix.c b/arch/powerpc/mm/pgtable-radix.c
index 7a44ec276290..030543451229 100644
--- a/arch/powerpc/mm/pgtable-radix.c
+++ b/arch/powerpc/mm/pgtable-radix.c
@@ -261,7 +261,6 @@ static int __meminit create_physical_mapping(unsigned long start,
{
unsigned long vaddr, addr, mapping_size = 0;
pgprot_t prot;
- unsigned long max_mapping_size;
#ifdef CONFIG_STRICT_KERNEL_RWX
int split_text_mapping = 1;
#else
@@ -276,12 +275,9 @@ static int __meminit create_physical_mapping(unsigned long start,
gap = end - addr;
previous_size = mapping_size;
- max_mapping_size = PUD_SIZE;
-retry:
if (IS_ALIGNED(addr, PUD_SIZE) && gap >= PUD_SIZE &&
- mmu_psize_defs[MMU_PAGE_1G].shift &&
- PUD_SIZE <= max_mapping_size) {
+ mmu_psize_defs[MMU_PAGE_1G].shift) {
mapping_size = PUD_SIZE;
psize = MMU_PAGE_1G;
} else if (IS_ALIGNED(addr, PMD_SIZE) && gap >= PMD_SIZE &&
@@ -296,8 +292,10 @@ static int __meminit create_physical_mapping(unsigned long start,
if (split_text_mapping && (mapping_size == PUD_SIZE) &&
(addr < __pa_symbol(__init_begin)) &&
(addr + mapping_size) > __pa_symbol(__init_begin)) {
- max_mapping_size = PMD_SIZE;
- goto retry;
+ if (mmu_psize_defs[MMU_PAGE_2M].shift)
+ mapping_size = PMD_SIZE;
+ else
+ mapping_size = PAGE_SIZE;
}
if (split_text_mapping && (mapping_size == PMD_SIZE) &&
--
2.17.2
^ permalink raw reply related
* [PATCH 5/6] powerpc/mm/radix: Simplify split mapping logic
From: Michael Ellerman @ 2018-10-19 4:13 UTC (permalink / raw)
To: linuxppc-dev; +Cc: aneesh.kumar
In-Reply-To: <20181019041334.4945-1-mpe@ellerman.id.au>
If we look closely at the logic in create_physical_mapping(), when
we're doing STRICT_KERNEL_RWX, we do the following steps:
- determine the gap from where we are to the end of the range
- choose an appropriate mapping_size based on the gap
- check if that mapping_size would overlap the __init_begin
boundary, and if not choose an appropriate mapping_size
We can simplify the logic by taking the __init_begin boundary into
account when we calculate the initial gap.
So add a next_boundary() function which tells us what the next
boundary is, either the __init_begin boundary or end. In future we can
add more boundaries.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/mm/pgtable-radix.c | 32 ++++++++++----------------------
1 file changed, 10 insertions(+), 22 deletions(-)
diff --git a/arch/powerpc/mm/pgtable-radix.c b/arch/powerpc/mm/pgtable-radix.c
index 030543451229..0e87733eed80 100644
--- a/arch/powerpc/mm/pgtable-radix.c
+++ b/arch/powerpc/mm/pgtable-radix.c
@@ -255,17 +255,21 @@ static inline void __meminit print_mapping(unsigned long start,
pr_info("Mapped 0x%016lx-0x%016lx with %s pages\n", start, end, buf);
}
+static unsigned long next_boundary(unsigned long addr, unsigned long end)
+{
+#ifdef CONFIG_STRICT_KERNEL_RWX
+ if (addr < __pa_symbol(__init_begin))
+ return __pa_symbol(__init_begin);
+#endif
+ return end;
+}
+
static int __meminit create_physical_mapping(unsigned long start,
unsigned long end,
int nid)
{
unsigned long vaddr, addr, mapping_size = 0;
pgprot_t prot;
-#ifdef CONFIG_STRICT_KERNEL_RWX
- int split_text_mapping = 1;
-#else
- int split_text_mapping = 0;
-#endif
int psize;
start = _ALIGN_UP(start, PAGE_SIZE);
@@ -273,7 +277,7 @@ static int __meminit create_physical_mapping(unsigned long start,
unsigned long gap, previous_size;
int rc;
- gap = end - addr;
+ gap = next_boundary(addr, end) - addr;
previous_size = mapping_size;
if (IS_ALIGNED(addr, PUD_SIZE) && gap >= PUD_SIZE &&
@@ -289,22 +293,6 @@ static int __meminit create_physical_mapping(unsigned long start,
psize = mmu_virtual_psize;
}
- if (split_text_mapping && (mapping_size == PUD_SIZE) &&
- (addr < __pa_symbol(__init_begin)) &&
- (addr + mapping_size) > __pa_symbol(__init_begin)) {
- if (mmu_psize_defs[MMU_PAGE_2M].shift)
- mapping_size = PMD_SIZE;
- else
- mapping_size = PAGE_SIZE;
- }
-
- if (split_text_mapping && (mapping_size == PMD_SIZE) &&
- (addr < __pa_symbol(__init_begin)) &&
- (addr + mapping_size) > __pa_symbol(__init_begin)) {
- mapping_size = PAGE_SIZE;
- psize = mmu_virtual_psize;
- }
-
if (mapping_size != previous_size) {
print_mapping(start, addr, previous_size);
start = addr;
--
2.17.2
^ permalink raw reply related
* [PATCH 6/6] powerpc/mm/radix: Display if mappings are exec or not
From: Michael Ellerman @ 2018-10-19 4:13 UTC (permalink / raw)
To: linuxppc-dev; +Cc: aneesh.kumar
In-Reply-To: <20181019041334.4945-1-mpe@ellerman.id.au>
At boot we print the ranges we've mapped for the linear mapping and
what page size we've used. Also track whether the range is mapped
executable or not and display that as well.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/mm/pgtable-radix.c | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/arch/powerpc/mm/pgtable-radix.c b/arch/powerpc/mm/pgtable-radix.c
index 0e87733eed80..931156069a81 100644
--- a/arch/powerpc/mm/pgtable-radix.c
+++ b/arch/powerpc/mm/pgtable-radix.c
@@ -241,9 +241,8 @@ void radix__mark_initmem_nx(void)
}
#endif /* CONFIG_STRICT_KERNEL_RWX */
-static inline void __meminit print_mapping(unsigned long start,
- unsigned long end,
- unsigned long size)
+static inline void __meminit
+print_mapping(unsigned long start, unsigned long end, unsigned long size, bool exec)
{
char buf[10];
@@ -252,7 +251,8 @@ static inline void __meminit print_mapping(unsigned long start,
string_get_size(size, 1, STRING_UNITS_2, buf, sizeof(buf));
- pr_info("Mapped 0x%016lx-0x%016lx with %s pages\n", start, end, buf);
+ pr_info("Mapped 0x%016lx-0x%016lx with %s pages%s\n", start, end, buf,
+ exec ? " (exec)" : "");
}
static unsigned long next_boundary(unsigned long addr, unsigned long end)
@@ -269,6 +269,7 @@ static int __meminit create_physical_mapping(unsigned long start,
int nid)
{
unsigned long vaddr, addr, mapping_size = 0;
+ bool prev_exec, exec = false;
pgprot_t prot;
int psize;
@@ -279,6 +280,7 @@ static int __meminit create_physical_mapping(unsigned long start,
gap = next_boundary(addr, end) - addr;
previous_size = mapping_size;
+ prev_exec = exec;
if (IS_ALIGNED(addr, PUD_SIZE) && gap >= PUD_SIZE &&
mmu_psize_defs[MMU_PAGE_1G].shift) {
@@ -293,18 +295,21 @@ static int __meminit create_physical_mapping(unsigned long start,
psize = mmu_virtual_psize;
}
- if (mapping_size != previous_size) {
- print_mapping(start, addr, previous_size);
- start = addr;
- }
-
vaddr = (unsigned long)__va(addr);
if (overlaps_kernel_text(vaddr, vaddr + mapping_size) ||
- overlaps_interrupt_vector_text(vaddr, vaddr + mapping_size))
+ overlaps_interrupt_vector_text(vaddr, vaddr + mapping_size)) {
prot = PAGE_KERNEL_X;
- else
+ exec = true;
+ } else {
prot = PAGE_KERNEL;
+ exec = false;
+ }
+
+ if (mapping_size != previous_size || exec != prev_exec) {
+ print_mapping(start, addr, previous_size, prev_exec);
+ start = addr;
+ }
rc = __map_kernel_page(vaddr, addr, prot, mapping_size, nid, start, end);
if (rc)
@@ -313,7 +318,7 @@ static int __meminit create_physical_mapping(unsigned long start,
update_page_count(psize, 1);
}
- print_mapping(start, addr, mapping_size);
+ print_mapping(start, addr, mapping_size, exec);
return 0;
}
--
2.17.2
^ permalink raw reply related
* [PATCH] powerpc/time: Fix clockevent_decrementer initalisation for PR KVM
From: Michael Ellerman @ 2018-10-19 4:23 UTC (permalink / raw)
To: linuxppc-dev; +Cc: paulus, anton, kvm-ppc
In the recent commit 8b78fdb045de ("powerpc/time: Use
clockevents_register_device(), fixing an issue with large
decrementer") we changed the way we initialise the decrementer
clockevent(s).
We no longer initialise the mult & shift values of
decrementer_clockevent itself.
This has the effect of breaking PR KVM, because it uses those values
in kvmppc_emulate_dec(). The symptom is guest kernels spin forever
mid-way through boot.
For now fix it by assigning back to decrementer_clockevent the mult
and shift values.
Fixes: 8b78fdb045de ("powerpc/time: Use clockevents_register_device(), fixing an issue with large decrementer")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/kernel/time.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 40868f3ee113..68e8f963d108 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -989,6 +989,10 @@ static void register_decrementer_clockevent(int cpu)
printk_once(KERN_DEBUG "clockevent: %s mult[%x] shift[%d] cpu[%d]\n",
dec->name, dec->mult, dec->shift, cpu);
+
+ /* Set values for KVM, see kvm_emulate_dec() */
+ decrementer_clockevent.mult = dec->mult;
+ decrementer_clockevent.shift = dec->shift;
}
static void enable_large_decrementer(void)
--
2.17.2
^ permalink raw reply related
* Re: [PATCH 7/8] eisa: consolidate EISA Kconfig entry in drivers/eisa
From: Masahiro Yamada @ 2018-10-19 4:46 UTC (permalink / raw)
To: Christoph Hellwig
Cc: linux-arch, linux-scsi, Linux Kbuild mailing list, linux-pci,
Linux Kernel Mailing List, Dominik Brodowski, Alex Bounine,
linuxppc-dev
In-Reply-To: <20181017080201.10866-8-hch@lst.de>
On Wed, Oct 17, 2018 at 5:03 PM Christoph Hellwig <hch@lst.de> wrote:
>
> Let architectures opt into EISA support by selecting HAS_EISA and
> handle everything else in drivers/eisa.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Acked-by: Thomas Gleixner <tglx@linutronix.de>
> ---
> index 60e37b9a715d..c90a1a4d6079 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -59,6 +59,7 @@ config ARM
> select HAVE_ARCH_TRACEHOOK
> select HAVE_ARM_SMCCC if CPU_V7
> select HAVE_EBPF_JIT if !CPU_ENDIAN_BE32
> + select HAVE_EISA
I doubt this.
arch/arm/Kconfig previously did not include
driver/eisa/Kconfig.
No ARM platform enabled CONFIG_EISA either.
> select HAVE_CONTEXT_TRACKING
> select HAVE_C_RECORDMCOUNT
> select HAVE_DEBUG_KMEMLEAK
> @@ -162,21 +163,6 @@ config HAVE_PROC_CPU
> config NO_IOPORT_MAP
> bool
>
> -config EISA
> - bool
> - ---help---
> - The Extended Industry Standard Architecture (EISA) bus was
> - developed as an open alternative to the IBM MicroChannel bus.
> -
> - The EISA bus provided some of the features of the IBM MicroChannel
> - bus while maintaining backward compatibility with cards made for
> - the older ISA bus. The EISA bus saw limited use between 1988 and
> - 1995 when it was made obsolete by the PCI bus.
> -
> - Say Y here if you are building a kernel for an EISA-based machine.
> -
> - Otherwise, say N.
> -
> config SBUS
> bool
>
--
Best Regards
Masahiro Yamada
^ permalink raw reply
* Re: [PATCH 7/8] eisa: consolidate EISA Kconfig entry in drivers/eisa
From: Masahiro Yamada @ 2018-10-19 4:48 UTC (permalink / raw)
To: Christoph Hellwig
Cc: linux-arch, linux-scsi, Linux Kbuild mailing list, linux-pci,
Linux Kernel Mailing List, Dominik Brodowski, Alex Bounine,
linuxppc-dev
In-Reply-To: <20181017080201.10866-8-hch@lst.de>
On Wed, Oct 17, 2018 at 5:03 PM Christoph Hellwig <hch@lst.de> wrote:
>
> Let architectures opt into EISA support by selecting HAS_EISA and
Nit.
HAS_EISA -> HAVE_EISA
since you renamed it in this version.
> handle everything else in drivers/eisa.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Acked-by: Thomas Gleixner <tglx@linutronix.de>
> ---
--
Best Regards
Masahiro Yamada
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox