* Re: [PATCH -next] ocxl: remove set but not used variables 'tid' and 'lpid'
From: Michael Ellerman @ 2019-05-03 6:59 UTC (permalink / raw)
To: Yue Haibing, fbarrat, andrew.donnellan, arnd, gregkh
Cc: linuxppc-dev, YueHaibing, linux-kernel
In-Reply-To: <20190329154456.27152-1-yuehaibing@huawei.com>
On Fri, 2019-03-29 at 15:44:56 UTC, Yue Haibing wrote:
> From: YueHaibing <yuehaibing@huawei.com>
>
> Fixes gcc '-Wunused-but-set-variable' warning:
>
> drivers/misc/ocxl/link.c: In function 'xsl_fault_handler':
> drivers/misc/ocxl/link.c:187:17: warning: variable 'tid' set but not used [-Wunused-but-set-variable]
> drivers/misc/ocxl/link.c:187:6: warning: variable 'lpid' set but not used [-Wunused-but-set-variable]
>
> They are never used and can be removed.
>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
> Acked-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
> Acked-by: Frederic Barrat <fbarrat@linux.ibm.com>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/32eeb5614d3bf166e84fe69bb5f3a51a
cheers
^ permalink raw reply
* Re: [PATCH] powerpc/nohash64: clean pgtable.h
From: Michael Ellerman @ 2019-05-03 6:59 UTC (permalink / raw)
To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras
Cc: linuxppc-dev, linux-kernel
In-Reply-To: <a048e3619ef2c378d075f46119ff5b7091320ecc.1553779159.git.christophe.leroy@c-s.fr>
On Thu, 2019-03-28 at 13:19:47 UTC, Christophe Leroy wrote:
> TRANSPARENT_HUGEPAGE is only supported by book3s
>
> VMEMMAP_REGION_ID is never used
>
> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/71faf8145cdc20f22aa398eb7b206b33
cheers
^ permalink raw reply
* Re: [PATCH v4 1/7] ocxl: Split pci.c
From: Michael Ellerman @ 2019-05-03 6:59 UTC (permalink / raw)
To: Alastair D'Silva, alastair
Cc: Arnd Bergmann, Greg Kroah-Hartman, linux-kernel, Andrew Donnellan,
Frederic Barrat, linuxppc-dev
In-Reply-To: <20190327053137.15173-2-alastair@au1.ibm.com>
On Wed, 2019-03-27 at 05:31:30 UTC, "Alastair D'Silva" wrote:
> From: Alastair D'Silva <alastair@d-silva.org>
>
> In preparation for making core code available for external drivers,
> move the core code out of pci.c and into core.c
>
> Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
> Acked-by: Frederic Barrat <fbarrat@linux.ibm.com>
> Acked-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Series applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/1ba2143606a10f1c2e7308bc7abd940a
cheers
^ permalink raw reply
* Re: [PATCH] powerpc/book3e: drop BUG_ON() in map_kernel_page()
From: Michael Ellerman @ 2019-05-03 6:59 UTC (permalink / raw)
To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras
Cc: linuxppc-dev, linux-kernel
In-Reply-To: <92e8f0bcec682e878796758e1efb88c172c7ffe4.1553778054.git.christophe.leroy@c-s.fr>
On Thu, 2019-03-28 at 13:03:45 UTC, Christophe Leroy wrote:
> early_alloc_pgtable() never returns NULL as it panics on failure.
>
> This patch drops the three BUG_ON() which check the non nullity
> of early_alloc_pgtable() returned value.
>
> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/a1ac2a9c4f98482e49305ab5551b7b32
cheers
^ permalink raw reply
* Re: [PATCH v4 1/4] ocxl: Rename struct link to ocxl_link
From: Michael Ellerman @ 2019-05-03 6:59 UTC (permalink / raw)
To: Alastair D'Silva, alastair
Cc: Arnd Bergmann, Greg Kroah-Hartman, Greg Kurz, linux-kernel,
Andrew Donnellan, Frederic Barrat, linuxppc-dev
In-Reply-To: <20190325053456.14599-2-alastair@au1.ibm.com>
On Mon, 2019-03-25 at 05:34:52 UTC, "Alastair D'Silva" wrote:
> From: Alastair D'Silva <alastair@d-silva.org>
>
> The term 'link' is ambiguous (especially when the struct is used for a
> list), so rename it for clarity.
>
> Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
> Reviewed-by: Greg Kurz <groug@kaod.org>
> Acked-by: Frederic Barrat <fbarrat@linux.ibm.com>
> Acked-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Series applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/9c4ae0645682b97437072693f0edbee1
cheers
^ permalink raw reply
* Re: [PATCH 1/7] powerpc/fadump: define an empty fadump_cleanup()
From: Michael Ellerman @ 2019-05-03 6:59 UTC (permalink / raw)
To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras
Cc: linuxppc-dev, linux-kernel
In-Reply-To: <a2ac33258063682558fe0cac8eedcbd28aa4a141.1553242059.git.christophe.leroy@c-s.fr>
On Fri, 2019-03-22 at 08:08:39 UTC, Christophe Leroy wrote:
> To avoid #ifdefs, define an static inline fadump_cleanup() function
> when CONFIG_FADUMP is not selected
>
> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Series applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/9c1d38b34e944cace44e0d2bea0beb56
cheers
^ permalink raw reply
* Re: [PATCH v2] powerpc/64s: Remove 'dummy_copy_buffer'
From: Michael Ellerman @ 2019-05-03 6:59 UTC (permalink / raw)
To: Mathieu Malaterre
Cc: Mathieu Malaterre, linuxppc-dev, Paul Mackerras, linux-kernel,
Nicholas Piggin
In-Reply-To: <20190313200030.19145-1-malat@debian.org>
On Wed, 2019-03-13 at 20:00:30 UTC, Mathieu Malaterre wrote:
> In commit 2bf1071a8d50 ("powerpc/64s: Remove POWER9 DD1 support") the
> function __switch_to remove usage for 'dummy_copy_buffer'. Since it is
> not used anywhere else, remove it completely.
>
> This remove the following warning:
>
> arch/powerpc/kernel/process.c:1156:17: error: 'dummy_copy_buffer' defined but not used [-Werror=unused-const-variable=]
>
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Suggested-by: Christophe Leroy <christophe.leroy@c-s.fr>
> Signed-off-by: Mathieu Malaterre <malat@debian.org>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/a5ae043de7678f189303559782f60570
cheers
^ permalink raw reply
* Re: [PATCH 08/14] powerpc: entry: Remove unneeded need_resched() loop
From: Michael Ellerman @ 2019-05-03 6:59 UTC (permalink / raw)
To: Valentin Schneider, linux-kernel; +Cc: linuxppc-dev, Paul Mackerras
In-Reply-To: <20190311224752.8337-9-valentin.schneider@arm.com>
On Mon, 2019-03-11 at 22:47:46 UTC, Valentin Schneider wrote:
> Since the enabling and disabling of IRQs within preempt_schedule_irq()
> is contained in a need_resched() loop, we don't need the outer arch
> code loop.
>
> Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: linuxppc-dev@lists.ozlabs.org
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/90437bffa5f9b1440ba03e023f4875d1
cheers
^ permalink raw reply
* Re: [PATCH] powerpc/dts/fsl: add crypto node alias for B4
From: Michael Ellerman @ 2019-05-03 6:59 UTC (permalink / raw)
To: Horia Geantă, Rob Herring, Mark Rutland
Cc: Scott Wood, devicetree, Paul Mackerras, linuxppc-dev
In-Reply-To: <20190320125516.12277-1-horia.geanta@nxp.com>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 361 bytes --]
On Wed, 2019-03-20 at 12:55:16 UTC, =?utf-8?q?Horia_Geant=C4=83?= wrote:
> crypto node alias is needed by U-boot to identify the node and
> perform fix-ups, like adding "fsl,sec-era" property.
>
> Signed-off-by: Horia GeantÄ <horia.geanta@nxp.com>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/32eebf96669568014b79b83a03f7895f
cheers
^ permalink raw reply
* Re: [PATCH] powerpc/irq: drop __irq_offset_value
From: Michael Ellerman @ 2019-05-03 6:59 UTC (permalink / raw)
To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras
Cc: linuxppc-dev, linux-kernel
In-Reply-To: <20190309174727.186371051B7@localhost.localdomain>
On Sat, 2019-03-09 at 17:47:27 UTC, Christophe Leroy wrote:
> This patch drops__irq_offset_value which has not been used since
> commit 9c4cb8251513 ("powerpc: Remove use of CONFIG_PPC_MERGE")
>
> This removes a sparse warning.
>
> Fixes: 9c4cb8251513 ("powerpc: Remove use of CONFIG_PPC_MERGE")
> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/502523fd1d2ac559b41d8302dc9f826f
cheers
^ permalink raw reply
* Re: [PATCH] powerpc/hmi: Fix kernel hang when TB is in error state.
From: Michael Ellerman @ 2019-05-03 6:59 UTC (permalink / raw)
To: Mahesh J Salgaonkar, linuxppc-dev; +Cc: Stewart Smith
In-Reply-To: <155172853902.20037.16712960724031791025.stgit@jupiter>
On Mon, 2019-03-04 at 19:42:19 UTC, Mahesh J Salgaonkar wrote:
> From: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
>
> On TOD/TB errors timebase register stops/freezes until HMI error recovery
> gets TOD/TB back into running state. On successful recovery, TB starts
> running again and udelay() that relies on TB value continues to function
> properly. But in case when HMI fails to recover from TOD/TB errors, the
> TB register stay freezed. With TB not running the __delay() function
> keeps looping and never return. If __delay() is called while in panic
> path then system hangs and never reboots after panic.
>
> Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/de269129a48a2d590ba1d20c719e19d8
cheers
^ permalink raw reply
* Re: [PATCH] Selftests/powerpc: Add a signal fuzzer selftest
From: Michael Ellerman @ 2019-05-03 6:59 UTC (permalink / raw)
To: Breno Leitao, linuxppc-dev; +Cc: Breno Leitao, mikey, gromero
In-Reply-To: <1547744514-7276-1-git-send-email-leitao@debian.org>
On Thu, 2019-01-17 at 17:01:54 UTC, Breno Leitao wrote:
> This is a new selftest that raises SIGUSR1 signals and handles it in a set
> of different ways, trying to create different scenario for testing
> purpose.
>
> This test works raising a signal and calling sigreturn interleaved with
> TM operations, as starting, suspending and terminating a transaction. The
> test depends on random numbers, and, based on them, it sets different TM
> states.
>
> Other than that, the test fills out the user context struct that is passed
> to the sigreturn system call with random data, in order to make sure that
> the signal handler syscall can handle different and invalid states
> properly.
>
> This selftest has command line parameters to control what kind of tests the
> user wants to run, as for example, if a transaction should be started prior
> to signal being raised, or, after the signal being raised and before the
> sigreturn. If no parameter is given, the default is enabling all options.
>
> This test does not check if the user context is being read and set
> properly by the kernel. Its purpose, at this time, is basically
> guaranteeing that the kernel does not crash on invalid scenarios.
>
> Signed-off-by: Breno Leitao <leitao@debian.org>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/83e367f9ad18d42a1883ee29f20608a2
cheers
^ permalink raw reply
* Re: [PATCH] powerpc/tm: Avoid machine crash on rt_sigreturn
From: Michael Ellerman @ 2019-05-03 6:59 UTC (permalink / raw)
To: Breno Leitao, linuxppc-dev; +Cc: Breno Leitao, mikey, gromero
In-Reply-To: <1547657264-28761-1-git-send-email-leitao@debian.org>
On Wed, 2019-01-16 at 16:47:44 UTC, Breno Leitao wrote:
> There is a kernel crash that happens if rt_sigreturn is called inside a
> transactional block.
>
> This crash happens if the kernel hits an in-kernel page fault when
> accessing userspace memory, usually through copy_ckvsx_to_user(). A major
> page fault calls might_sleep() function, which can cause a task reschedule.
> A task reschedule (switch_to()) reclaim and recheckpoint the TM states,
> but, in the signal return path, the checkpointed memory was already
> reclaimed, thus the exception stack has MSR that points to MSR[TS]=0.
>
> When the code returns from might_sleep() and a task reschedule happened,
> then this task is returned with the memory recheckpointed, and
> CPU MSR[TS] = suspended.
>
> This means that there is a side effect at might_sleep() if it is called
> with CPU MSR[TS] = 0 and the task has regs->msr[TS] != 0.
>
> This side effect can cause a TM bad thing, since at the exception entrance,
> the stack saves MSR[TS]=0, and this is what will be used at RFID, but,
> the processor has MSR[TS] = Suspended, and this transition will be invalid
> and a TM Bad thing will be raised, causing the following crash:
>
> Unexpected TM Bad Thing exception at c00000000000e9ec (msr 0x8000000302a03031) tm_scratch=800000010280b033
> cpu 0xc: Vector: 700 (Program Check) at [c00000003ff1fd70]
> pc: c00000000000e9ec: fast_exception_return+0x100/0x1bc
> lr: c000000000032948: handle_rt_signal64+0xb8/0xaf0
> sp: c0000004263ebc40
> msr: 8000000302a03031
> current = 0xc000000415050300
> paca = 0xc00000003ffc4080 irqmask: 0x03 irq_happened: 0x01
> pid = 25006, comm = sigfuz
> Linux version 5.0.0-rc1-00001-g3bd6e94bec12 (breno@debian) (gcc version 8.2.0 (Debian 8.2.0-3)) #899 SMP Mon Jan 7 11:30:07 EST 2019
> WARNING: exception is not recoverable, can't continue
> enter ? for help
> [c0000004263ebc40] c000000000032948 handle_rt_signal64+0xb8/0xaf0 (unreliable)
> [c0000004263ebd30] c000000000022780 do_notify_resume+0x2f0/0x430
> [c0000004263ebe20] c00000000000e844 ret_from_except_lite+0x70/0x74
> --- Exception: c00 (System Call) at 00007fffbaac400c
> SP (7fffeca90f40) is in userspace
>
> The solution for this problem is running the sigreturn code with
> regs->msr[TS] disabled, thus, avoiding hitting the side effect above. This
> does not seem to be a problem since regs->msr will be replaced by the
> ucontext value, so, it is being flushed already. In this case, it is
> flushed earlier.
>
> Signed-off-by: Breno Leitao <leitao@debian.org>
> Acked-by: Michael Neuling <mikey@neuling.org>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/e620d45065c7b5b8d6ae11217c09c093
cheers
^ permalink raw reply
* Re: [PATCH v2] powerpc/perf: Fix loop exit condition in nest_imc_event_init
From: Michael Ellerman @ 2019-05-03 6:59 UTC (permalink / raw)
To: Anju T Sudhakar; +Cc: maddy, linuxppc-dev, anju, dan.carpenter
In-Reply-To: <20181218062041.25198-1-anju@linux.vnet.ibm.com>
On Tue, 2018-12-18 at 06:20:41 UTC, Anju T Sudhakar wrote:
> The data structure (i.e struct imc_mem_info) to hold the memory address
> information for nest imc units is allocated based on the number of nodes
> in the system.
>
> nest_imc_event_init() traverse this struct array to calculate the memory
> base address for the event-cpu. If we fail to find a match for the event
> cpu's chip-id in imc_mem_info struct array, then the do-while loop will
> iterate until we crash.
>
> Fix this by changing the loop exit condition based on the number of
> non zero vbase elements in the array, since the allocation is done for
> nr_chips + 1.
>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Fixes: 885dcd709ba91 ( powerpc/perf: Add nest IMC PMU support)
> Signed-off-by: Anju T Sudhakar <anju@linux.vnet.ibm.com>
> Reviewed-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/860b7d2286236170a36f94946d03ca98
cheers
^ permalink raw reply
* Re: [PATCH] powerpc/perf: Return accordingly on invalid chip-id in
From: Michael Ellerman @ 2019-05-03 6:59 UTC (permalink / raw)
To: Anju T Sudhakar; +Cc: maddy, linuxppc-dev, anju, dan.carpenter
In-Reply-To: <20181127082452.8307-2-anju@linux.vnet.ibm.com>
On Tue, 2018-11-27 at 08:24:52 UTC, Anju T Sudhakar wrote:
> Nest hardware counter memory resides in a per-chip reserve-memory.
> During nest_imc_event_init(), chip-id of the event-cpu is considered to
> calculate the base memory addresss for that cpu. Return, proper error
> condition if the chip_id calculated is invalid.
>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Fixes: 885dcd709ba91 ("powerpc/perf: Add nest IMC PMU support")
> Reviewed-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
> Signed-off-by: Anju T Sudhakar <anju@linux.vnet.ibm.com>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/a913e5e8b43be1d3897a141ce61c1ec0
cheers
^ permalink raw reply
* Re: [PATCH v11 10/13] powerpc/32: Add KASAN support
From: Christophe Leroy @ 2019-05-03 6:51 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
Nicholas Piggin, Aneesh Kumar K.V, Andrey Ryabinin,
Alexander Potapenko, Dmitry Vyukov, Daniel Axtens
Cc: linux-mm, linuxppc-dev, linux-kernel, kasan-dev
In-Reply-To: <c08fe3fee59343ebf76fd7ea0de11f4ad07a1d6e.1556295461.git.christophe.leroy@c-s.fr>
Le 26/04/2019 à 18:23, Christophe Leroy a écrit :
> This patch adds KASAN support for PPC32. The following patch
> will add an early activation of hash table for book3s. Until
> then, a warning will be raised if trying to use KASAN on an
> hash 6xx.
>
> To support KASAN, this patch initialises that MMU mapings for
> accessing to the KASAN shadow area defined in a previous patch.
>
> An early mapping is set as soon as the kernel code has been
> relocated at its definitive place.
>
> Then the definitive mapping is set once paging is initialised.
>
> For modules, the shadow area is allocated at module_alloc().
>
> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
> ---
> arch/powerpc/Kconfig | 1 +
> arch/powerpc/include/asm/kasan.h | 9 ++
> arch/powerpc/kernel/head_32.S | 3 +
> arch/powerpc/kernel/head_40x.S | 3 +
> arch/powerpc/kernel/head_44x.S | 3 +
> arch/powerpc/kernel/head_8xx.S | 3 +
> arch/powerpc/kernel/head_fsl_booke.S | 3 +
> arch/powerpc/kernel/setup-common.c | 3 +
> arch/powerpc/mm/Makefile | 1 +
> arch/powerpc/mm/init_32.c | 3 +
> arch/powerpc/mm/kasan/Makefile | 5 ++
Looks like the above Makefile is missing in powerpc/next ???
Christophe
> arch/powerpc/mm/kasan/kasan_init_32.c | 156 ++++++++++++++++++++++++++++++++++
> 12 files changed, 193 insertions(+)
> create mode 100644 arch/powerpc/mm/kasan/Makefile
> create mode 100644 arch/powerpc/mm/kasan/kasan_init_32.c
>
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index a7c80f2b08b5..1a2fb50126b2 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -173,6 +173,7 @@ config PPC
> select GENERIC_TIME_VSYSCALL
> select HAVE_ARCH_AUDITSYSCALL
> select HAVE_ARCH_JUMP_LABEL
> + select HAVE_ARCH_KASAN if PPC32
> select HAVE_ARCH_KGDB
> select HAVE_ARCH_MMAP_RND_BITS
> select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT
> diff --git a/arch/powerpc/include/asm/kasan.h b/arch/powerpc/include/asm/kasan.h
> index 05274dea3109..296e51c2f066 100644
> --- a/arch/powerpc/include/asm/kasan.h
> +++ b/arch/powerpc/include/asm/kasan.h
> @@ -27,5 +27,14 @@
>
> #define KASAN_SHADOW_SIZE (KASAN_SHADOW_END - KASAN_SHADOW_START)
>
> +#ifdef CONFIG_KASAN
> +void kasan_early_init(void);
> +void kasan_mmu_init(void);
> +void kasan_init(void);
> +#else
> +static inline void kasan_init(void) { }
> +static inline void kasan_mmu_init(void) { }
> +#endif
> +
> #endif /* __ASSEMBLY */
> #endif
> diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S
> index 40aec3f00a05..6e85171e513c 100644
> --- a/arch/powerpc/kernel/head_32.S
> +++ b/arch/powerpc/kernel/head_32.S
> @@ -969,6 +969,9 @@ start_here:
> * Do early platform-specific initialization,
> * and set up the MMU.
> */
> +#ifdef CONFIG_KASAN
> + bl kasan_early_init
> +#endif
> li r3,0
> mr r4,r31
> bl machine_init
> diff --git a/arch/powerpc/kernel/head_40x.S b/arch/powerpc/kernel/head_40x.S
> index a9c934f2319b..efa219d2136e 100644
> --- a/arch/powerpc/kernel/head_40x.S
> +++ b/arch/powerpc/kernel/head_40x.S
> @@ -848,6 +848,9 @@ start_here:
> /*
> * Decide what sort of machine this is and initialize the MMU.
> */
> +#ifdef CONFIG_KASAN
> + bl kasan_early_init
> +#endif
> li r3,0
> mr r4,r31
> bl machine_init
> diff --git a/arch/powerpc/kernel/head_44x.S b/arch/powerpc/kernel/head_44x.S
> index 37117ab11584..34a5df827b38 100644
> --- a/arch/powerpc/kernel/head_44x.S
> +++ b/arch/powerpc/kernel/head_44x.S
> @@ -203,6 +203,9 @@ _ENTRY(_start);
> /*
> * Decide what sort of machine this is and initialize the MMU.
> */
> +#ifdef CONFIG_KASAN
> + bl kasan_early_init
> +#endif
> li r3,0
> mr r4,r31
> bl machine_init
> diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S
> index 03c73b4c6435..d25adb6ef235 100644
> --- a/arch/powerpc/kernel/head_8xx.S
> +++ b/arch/powerpc/kernel/head_8xx.S
> @@ -853,6 +853,9 @@ start_here:
> /*
> * Decide what sort of machine this is and initialize the MMU.
> */
> +#ifdef CONFIG_KASAN
> + bl kasan_early_init
> +#endif
> li r3,0
> mr r4,r31
> bl machine_init
> diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S
> index 32332e24e421..567e0ed45ca8 100644
> --- a/arch/powerpc/kernel/head_fsl_booke.S
> +++ b/arch/powerpc/kernel/head_fsl_booke.S
> @@ -268,6 +268,9 @@ set_ivor:
> /*
> * Decide what sort of machine this is and initialize the MMU.
> */
> +#ifdef CONFIG_KASAN
> + bl kasan_early_init
> +#endif
> mr r3,r30
> mr r4,r31
> bl machine_init
> diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
> index 1729bf409562..15afb01b4374 100644
> --- a/arch/powerpc/kernel/setup-common.c
> +++ b/arch/powerpc/kernel/setup-common.c
> @@ -67,6 +67,7 @@
> #include <asm/livepatch.h>
> #include <asm/mmu_context.h>
> #include <asm/cpu_has_feature.h>
> +#include <asm/kasan.h>
>
> #include "setup.h"
>
> @@ -871,6 +872,8 @@ static void smp_setup_pacas(void)
> */
> void __init setup_arch(char **cmdline_p)
> {
> + kasan_init();
> +
> *cmdline_p = boot_command_line;
>
> /* Set a half-reasonable default so udelay does something sensible */
> diff --git a/arch/powerpc/mm/Makefile b/arch/powerpc/mm/Makefile
> index dd945ca869b2..01afb10a7b33 100644
> --- a/arch/powerpc/mm/Makefile
> +++ b/arch/powerpc/mm/Makefile
> @@ -53,6 +53,7 @@ obj-$(CONFIG_PPC_COPRO_BASE) += copro_fault.o
> obj-$(CONFIG_SPAPR_TCE_IOMMU) += mmu_context_iommu.o
> obj-$(CONFIG_PPC_PTDUMP) += ptdump/
> obj-$(CONFIG_PPC_MEM_KEYS) += pkeys.o
> +obj-$(CONFIG_KASAN) += kasan/
>
> # Disable kcov instrumentation on sensitive code
> # This is necessary for booting with kcov enabled on book3e machines
> diff --git a/arch/powerpc/mm/init_32.c b/arch/powerpc/mm/init_32.c
> index 80cc97cd8878..5b61673e7eed 100644
> --- a/arch/powerpc/mm/init_32.c
> +++ b/arch/powerpc/mm/init_32.c
> @@ -46,6 +46,7 @@
> #include <asm/sections.h>
> #include <asm/hugetlb.h>
> #include <asm/kup.h>
> +#include <asm/kasan.h>
>
> #include "mmu_decl.h"
>
> @@ -179,6 +180,8 @@ void __init MMU_init(void)
> btext_unmap();
> #endif
>
> + kasan_mmu_init();
> +
> setup_kup();
>
> /* Shortly after that, the entire linear mapping will be available */
> diff --git a/arch/powerpc/mm/kasan/Makefile b/arch/powerpc/mm/kasan/Makefile
> new file mode 100644
> index 000000000000..6577897673dd
> --- /dev/null
> +++ b/arch/powerpc/mm/kasan/Makefile
> @@ -0,0 +1,5 @@
> +# SPDX-License-Identifier: GPL-2.0
> +
> +KASAN_SANITIZE := n
> +
> +obj-$(CONFIG_PPC32) += kasan_init_32.o
> diff --git a/arch/powerpc/mm/kasan/kasan_init_32.c b/arch/powerpc/mm/kasan/kasan_init_32.c
> new file mode 100644
> index 000000000000..42617fcad828
> --- /dev/null
> +++ b/arch/powerpc/mm/kasan/kasan_init_32.c
> @@ -0,0 +1,156 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +#define DISABLE_BRANCH_PROFILING
> +
> +#include <linux/kasan.h>
> +#include <linux/printk.h>
> +#include <linux/memblock.h>
> +#include <linux/sched/task.h>
> +#include <linux/vmalloc.h>
> +#include <asm/pgalloc.h>
> +#include <asm/code-patching.h>
> +#include <mm/mmu_decl.h>
> +
> +static void kasan_populate_pte(pte_t *ptep, pgprot_t prot)
> +{
> + unsigned long va = (unsigned long)kasan_early_shadow_page;
> + phys_addr_t pa = __pa(kasan_early_shadow_page);
> + int i;
> +
> + for (i = 0; i < PTRS_PER_PTE; i++, ptep++)
> + __set_pte_at(&init_mm, va, ptep, pfn_pte(PHYS_PFN(pa), prot), 0);
> +}
> +
> +static int kasan_init_shadow_page_tables(unsigned long k_start, unsigned long k_end)
> +{
> + pmd_t *pmd;
> + unsigned long k_cur, k_next;
> +
> + pmd = pmd_offset(pud_offset(pgd_offset_k(k_start), k_start), k_start);
> +
> + for (k_cur = k_start; k_cur != k_end; k_cur = k_next, pmd++) {
> + pte_t *new;
> +
> + k_next = pgd_addr_end(k_cur, k_end);
> + if ((void *)pmd_page_vaddr(*pmd) != kasan_early_shadow_pte)
> + continue;
> +
> + new = pte_alloc_one_kernel(&init_mm);
> +
> + if (!new)
> + return -ENOMEM;
> + kasan_populate_pte(new, PAGE_KERNEL_RO);
> + pmd_populate_kernel(&init_mm, pmd, new);
> + }
> + return 0;
> +}
> +
> +static void __ref *kasan_get_one_page(void)
> +{
> + if (slab_is_available())
> + return (void *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
> +
> + return memblock_alloc(PAGE_SIZE, PAGE_SIZE);
> +}
> +
> +static int __ref kasan_init_region(void *start, size_t size)
> +{
> + unsigned long k_start = (unsigned long)kasan_mem_to_shadow(start);
> + unsigned long k_end = (unsigned long)kasan_mem_to_shadow(start + size);
> + unsigned long k_cur;
> + int ret;
> + void *block = NULL;
> +
> + ret = kasan_init_shadow_page_tables(k_start, k_end);
> + if (ret)
> + return ret;
> +
> + if (!slab_is_available())
> + block = memblock_alloc(k_end - k_start, PAGE_SIZE);
> +
> + for (k_cur = k_start; k_cur < k_end; k_cur += PAGE_SIZE) {
> + pmd_t *pmd = pmd_offset(pud_offset(pgd_offset_k(k_cur), k_cur), k_cur);
> + void *va = block ? block + k_cur - k_start : kasan_get_one_page();
> + pte_t pte = pfn_pte(PHYS_PFN(__pa(va)), PAGE_KERNEL);
> +
> + if (!va)
> + return -ENOMEM;
> +
> + __set_pte_at(&init_mm, k_cur, pte_offset_kernel(pmd, k_cur), pte, 0);
> + }
> + flush_tlb_kernel_range(k_start, k_end);
> + return 0;
> +}
> +
> +static void __init kasan_remap_early_shadow_ro(void)
> +{
> + kasan_populate_pte(kasan_early_shadow_pte, PAGE_KERNEL_RO);
> +
> + flush_tlb_kernel_range(KASAN_SHADOW_START, KASAN_SHADOW_END);
> +}
> +
> +void __init kasan_mmu_init(void)
> +{
> + int ret;
> + struct memblock_region *reg;
> +
> + for_each_memblock(memory, reg) {
> + phys_addr_t base = reg->base;
> + phys_addr_t top = min(base + reg->size, total_lowmem);
> +
> + if (base >= top)
> + continue;
> +
> + ret = kasan_init_region(__va(base), top - base);
> + if (ret)
> + panic("kasan: kasan_init_region() failed");
> + }
> +}
> +
> +void __init kasan_init(void)
> +{
> + kasan_remap_early_shadow_ro();
> +
> + clear_page(kasan_early_shadow_page);
> +
> + /* At this point kasan is fully initialized. Enable error messages */
> + init_task.kasan_depth = 0;
> + pr_info("KASAN init done\n");
> +}
> +
> +#ifdef CONFIG_MODULES
> +void *module_alloc(unsigned long size)
> +{
> + void *base = vmalloc_exec(size);
> +
> + if (!base)
> + return NULL;
> +
> + if (!kasan_init_region(base, size))
> + return base;
> +
> + vfree(base);
> +
> + return NULL;
> +}
> +#endif
> +
> +void __init kasan_early_init(void)
> +{
> + unsigned long addr = KASAN_SHADOW_START;
> + unsigned long end = KASAN_SHADOW_END;
> + unsigned long next;
> + pmd_t *pmd = pmd_offset(pud_offset(pgd_offset_k(addr), addr), addr);
> +
> + BUILD_BUG_ON(KASAN_SHADOW_START & ~PGDIR_MASK);
> +
> + kasan_populate_pte(kasan_early_shadow_pte, PAGE_KERNEL);
> +
> + do {
> + next = pgd_addr_end(addr, end);
> + pmd_populate_kernel(&init_mm, pmd, kasan_early_shadow_pte);
> + } while (pmd++, addr = next, addr != end);
> +
> + if (early_mmu_has_feature(MMU_FTR_HPTE_TABLE))
> + WARN(true, "KASAN not supported on hash 6xx");
> +}
>
^ permalink raw reply
* Re: [PATCH v9 1/2] powerpc/64s: reimplement book3s idle code in C
From: Michael Ellerman @ 2019-05-03 6:50 UTC (permalink / raw)
To: Nicholas Piggin, linuxppc-dev
Cc: Gautham R . Shenoy, Nicholas Piggin, kvm-ppc
In-Reply-To: <20190412143053.18567-1-npiggin@gmail.com>
On Fri, 2019-04-12 at 14:30:52 UTC, Nicholas Piggin wrote:
> Reimplement Book3S idle code in C, moving POWER7/8/9 implementation
> speific HV idle code to the powernv platform code.
>
> Book3S assembly stubs are kept in common code and used only to save
> the stack frame and non-volatile GPRs before executing architected
> idle instructions, and restoring the stack and reloading GPRs then
> returning to C after waking from idle.
>
> The complex logic dealing with threads and subcores, locking, SPRs,
> HMIs, timebase resync, etc., is all done in C which makes it more
> maintainable.
>
> This is not a strict translation to C code, there are some
> significant differences:
>
> - Idle wakeup no longer uses the ->cpu_restore call to reinit SPRs,
> but saves and restores them itself.
>
> - The optimisation where EC=ESL=0 idle modes did not have to save GPRs
> or change MSR is restored, because it's now simple to do. ESL=1
> sleeps that do not lose GPRs can use this optimization too.
>
> - KVM secondary entry and cede is now more of a call/return style
> rather than branchy. nap_state_lost is not required because KVM
> always returns via NVGPR restoring path.
>
> - KVM secondary wakeup from offline sequence is moved entirely into
> the offline wakeup, which avoids a hwsync in the normal idle wakeup
> path.
>
> Performance measured with context switch ping-pong on different
> threads or cores, is possibly improved a small amount, 1-3% depending
> on stop state and core vs thread test for shallow states. Deep states
> it's in the noise compared with other latencies.
>
> Reviewed-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Applied to powerpc topic/ppc-kvm, thanks.
https://git.kernel.org/powerpc/c/10d91611f426d4bafd2a83d966c36da8
cheers
^ permalink raw reply
* Re: [PATCH v5 01/16] powerpc/xive: add OPAL extensions for the XIVE native exploitation support
From: Michael Ellerman @ 2019-05-03 6:50 UTC (permalink / raw)
To: Cédric Le Goater, kvm-ppc
Cc: linuxppc-dev, Paul Mackerras, Cédric Le Goater, kvm,
David Gibson
In-Reply-To: <20190410170448.3923-2-clg@kaod.org>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 489 bytes --]
On Wed, 2019-04-10 at 17:04:33 UTC, =?utf-8?q?C=C3=A9dric_Le_Goater?= wrote:
> The support for XIVE native exploitation mode in Linux/KVM needs a
> couple more OPAL calls to get and set the state of the XIVE internal
> structures being used by a sPAPR guest.
>
> Signed-off-by: Céddric Le Goater <clg@kaod.org>
> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Applied to powerpc topic/ppc-kvm, thanks.
https://git.kernel.org/powerpc/c/88ec6b93c8e7d6d4ffaf6ad6395ceb3b
cheers
^ permalink raw reply
* Re: [PATCH v2] powerpc: Add force enable of DAWR on P9 option
From: Michael Ellerman @ 2019-05-03 6:50 UTC (permalink / raw)
To: Michael Neuling; +Cc: mikey, linuxppc-dev, Cameron Kaiser
In-Reply-To: <20190401060312.22670-1-mikey@neuling.org>
On Mon, 2019-04-01 at 06:03:12 UTC, Michael Neuling wrote:
> This adds a flag so that the DAWR can be enabled on P9 via:
> echo Y > /sys/kernel/debug/powerpc/dawr_enable_dangerous
>
> The DAWR was previously force disabled on POWER9 in:
> 9654153158 powerpc: Disable DAWR in the base POWER9 CPU features
> Also see Documentation/powerpc/DAWR-POWER9.txt
>
> This is a dangerous setting, USE AT YOUR OWN RISK.
>
> Some users may not care about a bad user crashing their box
> (ie. single user/desktop systems) and really want the DAWR. This
> allows them to force enable DAWR.
>
> This flag can also be used to disable DAWR access. Once this is
> cleared, all DAWR access should be cleared immediately and your
> machine once again safe from crashing.
>
> Userspace may get confused by toggling this. If DAWR is force
> enabled/disabled between getting the number of breakpoints (via
> PTRACE_GETHWDBGINFO) and setting the breakpoint, userspace will get an
> inconsistent view of what's available. Similarly for guests.
>
> For the DAWR to be enabled in a KVM guest, the DAWR needs to be force
> enabled in the host AND the guest. For this reason, this won't work on
> POWERVM as it doesn't allow the HCALL to work. Writes of 'Y' to the
> dawr_enable_dangerous file will fail if the hypervisor doesn't support
> writing the DAWR.
>
> To double check the DAWR is working, run this kernel selftest:
> tools/testing/selftests/powerpc/ptrace/ptrace-hwbreak.c
> Any errors/failures/skips mean something is wrong.
>
> Signed-off-by: Michael Neuling <mikey@neuling.org>
Applied to powerpc topic/ppc-kvm, thanks.
https://git.kernel.org/powerpc/c/c1fe190c06723322f2dfac31d3b982c5
cheers
^ permalink raw reply
* [PATCH v3 1/3] powerpc: Move PPC_HA() PPC_HI() and PPC_LO() to ppc-opcode.h
From: Christophe Leroy @ 2019-05-03 6:40 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
Cc: linuxppc-dev, linux-kernel
PPC_HA() PPC_HI() and PPC_LO() macros are nice macros. Move them
from module64.c to ppc-opcode.h in order to use them in other places.
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
v3: no change
v2: no change
arch/powerpc/include/asm/ppc-opcode.h | 7 +++++++
arch/powerpc/kernel/module_64.c | 7 -------
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h
index 23f7ed796f38..c5ff44400d4d 100644
--- a/arch/powerpc/include/asm/ppc-opcode.h
+++ b/arch/powerpc/include/asm/ppc-opcode.h
@@ -412,6 +412,13 @@
#define __PPC_SPR(r) ((((r) & 0x1f) << 16) | ((((r) >> 5) & 0x1f) << 11))
#define __PPC_RC21 (0x1 << 10)
+/* Both low and high 16 bits are added as SIGNED additions, so if low
+ 16 bits has high bit set, high 16 bits must be adjusted. These
+ macros do that (stolen from binutils). */
+#define PPC_LO(v) ((v) & 0xffff)
+#define PPC_HI(v) (((v) >> 16) & 0xffff)
+#define PPC_HA(v) PPC_HI ((v) + 0x8000)
+
/*
* Only use the larx hint bit on 64bit CPUs. e500v1/v2 based CPUs will treat a
* larx with EH set as an illegal instruction.
diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c
index 8661eea78503..c2e1b06253b8 100644
--- a/arch/powerpc/kernel/module_64.c
+++ b/arch/powerpc/kernel/module_64.c
@@ -400,13 +400,6 @@ static inline unsigned long my_r2(const Elf64_Shdr *sechdrs, struct module *me)
return (sechdrs[me->arch.toc_section].sh_addr & ~0xfful) + 0x8000;
}
-/* Both low and high 16 bits are added as SIGNED additions, so if low
- 16 bits has high bit set, high 16 bits must be adjusted. These
- macros do that (stolen from binutils). */
-#define PPC_LO(v) ((v) & 0xffff)
-#define PPC_HI(v) (((v) >> 16) & 0xffff)
-#define PPC_HA(v) PPC_HI ((v) + 0x8000)
-
/* Patch stub to reference function and correct r2 value. */
static inline int create_stub(const Elf64_Shdr *sechdrs,
struct ppc64_stub_entry *entry,
--
2.13.3
^ permalink raw reply related
* [PATCH v3 3/3] powerpc/module64: Use symbolic instructions names.
From: Christophe Leroy @ 2019-05-03 6:40 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
Cc: linuxppc-dev, linux-kernel
In-Reply-To: <298f344bdb21ab566271f5d18c6782ed20f072b7.1556865423.git.christophe.leroy@c-s.fr>
To increase readability/maintainability, replace hard coded
instructions values by symbolic names.
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
v3: fixed warning by adding () in an 'if' around X | Y (unlike said in v2 history, this change was forgotten in v2)
v2: rearranged comments
arch/powerpc/kernel/module_64.c | 53 +++++++++++++++++++++++++++--------------
1 file changed, 35 insertions(+), 18 deletions(-)
diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c
index c2e1b06253b8..b33a5d5e2d35 100644
--- a/arch/powerpc/kernel/module_64.c
+++ b/arch/powerpc/kernel/module_64.c
@@ -133,20 +133,27 @@ struct ppc64_stub_entry
* the stub, but it's significantly shorter to put these values at the
* end of the stub code, and patch the stub address (32-bits relative
* to the TOC ptr, r2) into the stub.
+ *
+ * addis r11,r2, <high>
+ * addi r11,r11, <low>
+ * std r2,R2_STACK_OFFSET(r1)
+ * ld r12,32(r11)
+ * ld r2,40(r11)
+ * mtctr r12
+ * bctr
*/
-
static u32 ppc64_stub_insns[] = {
- 0x3d620000, /* addis r11,r2, <high> */
- 0x396b0000, /* addi r11,r11, <low> */
+ PPC_INST_ADDIS | __PPC_RT(R11) | __PPC_RA(R2),
+ PPC_INST_ADDI | __PPC_RT(R11) | __PPC_RA(R11),
/* Save current r2 value in magic place on the stack. */
- 0xf8410000|R2_STACK_OFFSET, /* std r2,R2_STACK_OFFSET(r1) */
- 0xe98b0020, /* ld r12,32(r11) */
+ PPC_INST_STD | __PPC_RS(R2) | __PPC_RA(R1) | R2_STACK_OFFSET,
+ PPC_INST_LD | __PPC_RT(R12) | __PPC_RA(R11) | 32,
#ifdef PPC64_ELF_ABI_v1
/* Set up new r2 from function descriptor */
- 0xe84b0028, /* ld r2,40(r11) */
+ PPC_INST_LD | __PPC_RT(R2) | __PPC_RA(R11) | 40,
#endif
- 0x7d8903a6, /* mtctr r12 */
- 0x4e800420 /* bctr */
+ PPC_INST_MTCTR | __PPC_RS(R12),
+ PPC_INST_BCTR,
};
#ifdef CONFIG_DYNAMIC_FTRACE
@@ -704,18 +711,21 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
* ld r2, ...(r12)
* add r2, r2, r12
*/
- if ((((uint32_t *)location)[0] & ~0xfffc)
- != 0xe84c0000)
+ if ((((uint32_t *)location)[0] & ~0xfffc) !=
+ (PPC_INST_LD | __PPC_RT(R2) | __PPC_RA(R12)))
break;
- if (((uint32_t *)location)[1] != 0x7c426214)
+ if (((uint32_t *)location)[1] !=
+ (PPC_INST_ADD | __PPC_RT(R2) | __PPC_RA(R2) | __PPC_RB(R12)))
break;
/*
* If found, replace it with:
* addis r2, r12, (.TOC.-func)@ha
* addi r2, r12, (.TOC.-func)@l
*/
- ((uint32_t *)location)[0] = 0x3c4c0000 + PPC_HA(value);
- ((uint32_t *)location)[1] = 0x38420000 + PPC_LO(value);
+ ((uint32_t *)location)[0] = PPC_INST_ADDIS | __PPC_RT(R2) |
+ __PPC_RA(R12) | PPC_HA(value);
+ ((uint32_t *)location)[1] = PPC_INST_ADDI | __PPC_RT(R2) |
+ __PPC_RA(R12) | PPC_LO(value);
break;
case R_PPC64_REL16_HA:
@@ -769,12 +779,19 @@ static unsigned long create_ftrace_stub(const Elf64_Shdr *sechdrs,
{
struct ppc64_stub_entry *entry;
unsigned int i, num_stubs;
+ /*
+ * ld r12,PACATOC(r13)
+ * addis r12,r12,<high>
+ * addi r12,r12,<low>
+ * mtctr r12
+ * bctr
+ */
static u32 stub_insns[] = {
- 0xe98d0000 | PACATOC, /* ld r12,PACATOC(r13) */
- 0x3d8c0000, /* addis r12,r12,<high> */
- 0x398c0000, /* addi r12,r12,<low> */
- 0x7d8903a6, /* mtctr r12 */
- 0x4e800420, /* bctr */
+ PPC_INST_LD | __PPC_RT(R12) | __PPC_RA(R13) | PACATOC,
+ PPC_INST_ADDIS | __PPC_RT(R12) | __PPC_RA(R12),
+ PPC_INST_ADDI | __PPC_RT(R12) | __PPC_RA(R12),
+ PPC_INST_MTCTR | __PPC_RS(R12),
+ PPC_INST_BCTR,
};
long reladdr;
--
2.13.3
^ permalink raw reply related
* [PATCH v3 2/3] powerpc/module32: Use symbolic instructions names.
From: Christophe Leroy @ 2019-05-03 6:40 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
Cc: linuxppc-dev, linux-kernel
In-Reply-To: <298f344bdb21ab566271f5d18c6782ed20f072b7.1556865423.git.christophe.leroy@c-s.fr>
To increase readability/maintainability, replace hard coded
instructions values by symbolic names.
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
v3: no change
v2: Remove the ENTRY_JMP0 and ENTRY_JMP1 macros ; left real instructions as a comment.
arch/powerpc/kernel/module_32.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/arch/powerpc/kernel/module_32.c b/arch/powerpc/kernel/module_32.c
index 88d83771f462..9cf201111d6c 100644
--- a/arch/powerpc/kernel/module_32.c
+++ b/arch/powerpc/kernel/module_32.c
@@ -172,10 +172,12 @@ int module_frob_arch_sections(Elf32_Ehdr *hdr,
static inline int entry_matches(struct ppc_plt_entry *entry, Elf32_Addr val)
{
- if (entry->jump[0] == 0x3d800000 + ((val + 0x8000) >> 16)
- && entry->jump[1] == 0x398c0000 + (val & 0xffff))
- return 1;
- return 0;
+ if (entry->jump[0] != (PPC_INST_ADDIS | __PPC_RT(R12) | PPC_HA(val)))
+ return 0;
+ if (entry->jump[1] != (PPC_INST_ADDI | __PPC_RT(R12) | __PPC_RA(R12) |
+ PPC_LO(val)))
+ return 0;
+ return 1;
}
/* Set up a trampoline in the PLT to bounce us to the distant function */
@@ -200,10 +202,16 @@ static uint32_t do_plt_call(void *location,
entry++;
}
- entry->jump[0] = 0x3d800000+((val+0x8000)>>16); /* lis r12,sym@ha */
- entry->jump[1] = 0x398c0000 + (val&0xffff); /* addi r12,r12,sym@l*/
- entry->jump[2] = 0x7d8903a6; /* mtctr r12 */
- entry->jump[3] = 0x4e800420; /* bctr */
+ /*
+ * lis r12, sym@ha
+ * addi r12, r12, sym@l
+ * mtctr r12
+ * bctr
+ */
+ entry->jump[0] = PPC_INST_ADDIS | __PPC_RT(R12) | PPC_HA(val);
+ entry->jump[1] = PPC_INST_ADDI | __PPC_RT(R12) | __PPC_RA(R12) | PPC_LO(val);
+ entry->jump[2] = PPC_INST_MTCTR | __PPC_RS(R12);
+ entry->jump[3] = PPC_INST_BCTR;
pr_debug("Initialized plt for 0x%x at %p\n", val, entry);
return (uint32_t)entry;
--
2.13.3
^ permalink raw reply related
* Re: [PATCH V6 1/3] ASoC: fsl_asrc: Fix the issue about unsupported rate
From: Mark Brown @ 2019-05-03 6:17 UTC (permalink / raw)
To: S.j. Wang
Cc: alsa-devel@alsa-project.org, timur@kernel.org,
Xiubo.Lee@gmail.com, festevam@gmail.com,
linux-kernel@vger.kernel.org, nicoleotsuka@gmail.com,
linuxppc-dev@lists.ozlabs.org
In-Reply-To: <2cea4cb992a445863e88fa7865f55a02a83e031e.1555908545.git.shengjiu.wang@nxp.com>
[-- Attachment #1: Type: text/plain, Size: 818 bytes --]
On Mon, Apr 22, 2019 at 04:52:02AM +0000, S.j. Wang wrote:
> When the output sample rate is [8kHz, 30kHz], the limitation
> of the supported ratio range is [1/24, 8]. In the driver
> we use (8kHz, 30kHz) instead of [8kHz, 30kHz].
> So this patch is to fix this issue and the potential rounding
> issue with divider.
>
None of this series applies either, with similar error messages:
Applying: ASoC: fsl_asrc: Fix the issue about unsupported rate
Using index info to reconstruct a base tree...
error: patch failed: sound/soc/fsl/fsl_asrc.c:282
error: sound/soc/fsl/fsl_asrc.c: patch does not apply
error: Did you hand edit your patch?
It does not apply to blobs recorded in its index.
(I get the same error message for your PM patch when applying without
using patchwork as my main workflow does.)
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply
* Re: [PATCH kernel] prom_init: Fetch flatten device tree from the system firmware
From: David Gibson @ 2019-05-03 2:35 UTC (permalink / raw)
To: Stewart Smith; +Cc: Alexey Kardashevskiy, linuxppc-dev, Suraj Jitindar Singh
In-Reply-To: <87bm0ktn1q.fsf@linux.vnet.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 2638 bytes --]
On Fri, May 03, 2019 at 10:10:57AM +1000, Stewart Smith wrote:
> David Gibson <david@gibson.dropbear.id.au> writes:
> > On Wed, May 01, 2019 at 01:42:21PM +1000, Alexey Kardashevskiy wrote:
> >> At the moment, on 256CPU + 256 PCI devices guest, it takes the guest
> >> about 8.5sec to fetch the entire device tree via the client interface
> >> as the DT is traversed twice - for strings blob and for struct blob.
> >> Also, "getprop" is quite slow too as SLOF stores properties in a linked
> >> list.
> >>
> >> However, since [1] SLOF builds flattened device tree (FDT) for another
> >> purpose. [2] adds a new "fdt-fetch" client interface for the OS to fetch
> >> the FDT.
> >>
> >> This tries the new method; if not supported, this falls back to
> >> the old method.
> >>
> >> There is a change in the FDT layout - the old method produced
> >> (reserved map, strings, structs), the new one receives only strings and
> >> structs from the firmware and adds the final reserved map to the end,
> >> so it is (fw reserved map, strings, structs, reserved map).
> >> This still produces the same unflattened device tree.
> >>
> >> This merges the reserved map from the firmware into the kernel's reserved
> >> map. At the moment SLOF generates an empty reserved map so this does not
> >> change the existing behaviour in regard of reservations.
> >>
> >> This supports only v17 onward as only that version provides dt_struct_size
> >> which works as "fdt-fetch" only produces v17 blobs.
> >>
> >> If "fdt-fetch" is not available, the old method of fetching the DT is used.
> >>
> >> [1] https://git.qemu.org/?p=SLOF.git;a=commitdiff;h=e6fc84652c9c00
> >> [2] https://git.qemu.org/?p=SLOF.git;a=commit;h=ecda95906930b80
> >>
> >> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> >
> > Hrm. I've gotta say I'm not terribly convinced that it's worth adding
> > a new interface we'll need to maintain to save 8s on a somewhat
> > contrived testcase.
>
> 256CPUs aren't that many anymore though. Although I guess that many PCI
> devices is still a little uncommon.
Yeah, it was the PCI devices I was meaning, not the cpus.
> A 4 socket POWER8 or POWER9 can easily be that large, and a small test
> kernel/userspace will boot in ~2.5-4 seconds. So it's possible that
> the device tree fetch could be surprisingly non-trivial percentage of boot
> time at least on some machines.
>
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply
* Re: [EXT] Re: [PATCH V4] ASoC: fsl_esai: Add pm runtime function
From: Mark Brown @ 2019-05-03 4:27 UTC (permalink / raw)
To: S.j. Wang
Cc: alsa-devel@alsa-project.org, timur@kernel.org,
Xiubo.Lee@gmail.com, festevam@gmail.com,
linux-kernel@vger.kernel.org, nicoleotsuka@gmail.com,
linuxppc-dev@lists.ozlabs.org
In-Reply-To: <VE1PR04MB6479F3EED50613DF8F041713E3340@VE1PR04MB6479.eurprd04.prod.outlook.com>
[-- Attachment #1: Type: text/plain, Size: 800 bytes --]
On Thu, May 02, 2019 at 09:13:58AM +0000, S.j. Wang wrote:
> I am checking, but I don't know why this patch failed in your side. I
> Tried to apply this patch on for-5.1, for 5.2, for-linus and for-next, all are
> Successful. The git is git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git.
> I can't reproduce your problem. Is there any my operation wrong?
The error message I got was:
Applying: ASoC: fsl_esai: Add pm runtime function
error: patch failed: sound/soc/fsl/fsl_esai.c:9
error: sound/soc/fsl/fsl_esai.c: patch does not apply
Patch failed at 0001 ASoC: fsl_esai: Add pm runtime function
which is the header addition. I can't spot any obvious issues visually
looking at the patch, only thing I can think is some kind of whitespace
damage somewhere.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ 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