Re: [PATCH] ocxl: Fix misleading comment

2020-02-25 Thread Frederic Barrat
Le 26/02/2020 à 05:39, Andrew Donnellan a écrit : In ocxl_context_free() we note that the AFU reference we're releasing was taken in "ocxl_context_init", a function that doesn't actually exist. Fix it to say ocxl_context_alloc() instead, which I expect was what was intended. Fixes: 5ef3166e8

Re: [PATCH v5 8/8] powerpc/mm: Disable set_memory() routines when strict RWX isn't enabled

2020-02-25 Thread Christophe Leroy
Le 26/02/2020 à 07:35, Russell Currey a écrit : There are a couple of reasons that the set_memory() functions are problematic when STRICT_KERNEL_RWX isn't enabled: - The linear mapping is a different size and apply_to_page_range() may modify a giant section, breaking everything -

[Bug 206669] Little-endian kernel crashing on POWER8 on heavy big-endian PowerKVM load

2020-02-25 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=206669 --- Comment #2 from John Paul Adrian Glaubitz (glaub...@physik.fu-berlin.de) --- (In reply to npiggin from comment #1) > Thanks for the report, we need to get more data about the first BUG if > we can. What function in your vmlinux contains addre

Re: [PATCH v4 8/8] powerpc/mm: Disable set_memory() routines when strict RWX isn't enabled

2020-02-25 Thread Christophe Leroy
Le 26/02/2020 à 07:24, Russell Currey a écrit : There are a couple of reasons that the set_memory() functions are problematic when STRICT_KERNEL_RWX isn't enabled: - The linear mapping is a different size and apply_to_page_range() may modify a giant section, breaking everything I

Re: [PATCH v3 11/14] powerpc/kprobes: Support kprobes on prefixed instructions

2020-02-25 Thread Nicholas Piggin
Jordan Niethe's on February 26, 2020 2:07 pm: > @@ -136,11 +148,14 @@ int arch_prepare_kprobe(struct kprobe *p) > } > > if (!ret) { > - patch_instruction(p->ainsn.insn, *p->addr); > + patch_instruction(&p->ainsn.insn[0], p->addr[0]); > + if (IS_PREF

Re: [PATCH v3 0/6] implement KASLR for powerpc/fsl_booke/64

2020-02-25 Thread Daniel Axtens
Hi Jason, > This is a try to implement KASLR for Freescale BookE64 which is based on > my earlier implementation for Freescale BookE32: > https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=131718 > > The implementation for Freescale BookE64 is similar as BookE32. One > difference is th

Re: [PATCH v3 09/14] powerpc/xmon: Add initial support for prefixed instructions

2020-02-25 Thread Nicholas Piggin
Jordan Niethe's on February 26, 2020 2:07 pm: > A prefixed instruction is composed of a word prefix and a word suffix. > It does not make sense to be able to have a breakpoint on the suffix of > a prefixed instruction, so make this impossible. > > When leaving xmon_core() we check to see if we are

Re: [PATCH v3 08/14] powerpc/xmon: Remove store_inst() for patch_instruction()

2020-02-25 Thread Nicholas Piggin
Jordan Niethe's on February 26, 2020 2:07 pm: > For modifying instructions in xmon, patch_instruction() can serve the > same role that store_inst() is performing with the advantage of not > being specific to xmon. In some places patch_instruction() is already > being using followed by store_inst().

Re: [PATCH v3 07/14] powerpc/traps: Check for prefixed instructions in facility_unavailable_exception()

2020-02-25 Thread Nicholas Piggin
Jordan Niethe's on February 26, 2020 2:07 pm: > If prefixed instructions are made unavailable by the [H]FSCR, attempting > to use them will cause a facility unavailable exception. Add "PREFIX" to > the facility_strings[]. > > Currently there are no prefixed instructions that are actually emulated

Re: [PATCH v3 01/14] powerpc: Enable Prefixed Instructions

2020-02-25 Thread Nicholas Piggin
Jordan Niethe's on February 26, 2020 2:07 pm: > From: Alistair Popple > > Prefix instructions have their own FSCR bit which needs to enabled via > a CPU feature. The kernel will save the FSCR for problem state but it > needs to be enabled initially. > > Signed-off-by: Alistair Popple > --- > a

[PATCH v5 6/8] powerpc/mm: implement set_memory_attr()

2020-02-25 Thread Russell Currey
From: Christophe Leroy In addition to the set_memory_xx() functions which allows to change the memory attributes of not (yet) used memory regions, implement a set_memory_attr() function to: - set the final memory protection after init on currently used kernel regions. - enable/disable kernel memo

[PATCH v5 5/8] powerpc/configs: Enable STRICT_MODULE_RWX in skiroot_defconfig

2020-02-25 Thread Russell Currey
skiroot_defconfig is the only powerpc defconfig with STRICT_KERNEL_RWX enabled, and if you want memory protection for kernel text you'd want it for modules too, so enable STRICT_MODULE_RWX there. Acked-by: Joel Stanley Signed-off-by: Russell Currey --- arch/powerpc/configs/skiroot_defconfig | 1

Re: [PATCH v5 8/8] powerpc/mm: Disable set_memory() routines when strict RWX isn't enabled

2020-02-25 Thread Andrew Donnellan
On 26/2/20 5:35 pm, Russell Currey wrote: There are a couple of reasons that the set_memory() functions are problematic when STRICT_KERNEL_RWX isn't enabled: - The linear mapping is a different size and apply_to_page_range() may modify a giant section, breaking everything - patch_ins

[PATCH v5 8/8] powerpc/mm: Disable set_memory() routines when strict RWX isn't enabled

2020-02-25 Thread Russell Currey
There are a couple of reasons that the set_memory() functions are problematic when STRICT_KERNEL_RWX isn't enabled: - The linear mapping is a different size and apply_to_page_range() may modify a giant section, breaking everything - patch_instruction() doesn't know to work around a page

[PATCH v5 7/8] powerpc/32: use set_memory_attr()

2020-02-25 Thread Russell Currey
From: Christophe Leroy Use set_memory_attr() instead of the PPC32 specific change_page_attr() change_page_attr() was checking that the address was not mapped by blocks and was handling highmem, but that's unneeded because the affected pages can't be in highmem and block mapping verification is a

[PATCH v5 4/8] powerpc: Set ARCH_HAS_STRICT_MODULE_RWX

2020-02-25 Thread Russell Currey
To enable strict module RWX on powerpc, set: CONFIG_STRICT_MODULE_RWX=y You should also have CONFIG_STRICT_KERNEL_RWX=y set to have any real security benefit. ARCH_HAS_STRICT_MODULE_RWX is set to require ARCH_HAS_STRICT_KERNEL_RWX. This is due to a quirk in arch/Kconfig and arch/powerpc/Kcon

[PATCH v5 3/8] powerpc/mm/ptdump: debugfs handler for W+X checks at runtime

2020-02-25 Thread Russell Currey
Very rudimentary, just echo 1 > [debugfs]/check_wx_pages and check the kernel log. Useful for testing strict module RWX. Updated the Kconfig entry to reflect this. Also fixed a typo. Signed-off-by: Russell Currey --- arch/powerpc/Kconfig.debug | 6 -- arch/powerpc/mm/ptdum

[PATCH v5 2/8] powerpc/kprobes: Mark newly allocated probes as RO

2020-02-25 Thread Russell Currey
From: Christophe Leroy With CONFIG_STRICT_KERNEL_RWX=y and CONFIG_KPROBES=y, there will be one W+X page at boot by default. This can be tested with CONFIG_PPC_PTDUMP=y and CONFIG_PPC_DEBUG_WX=y set, and checking the kernel log during boot. powerpc doesn't implement its own alloc() for kprobes l

[PATCH v5 1/8] powerpc/mm: Implement set_memory() routines

2020-02-25 Thread Russell Currey
From: Christophe Leroy The set_memory_{ro/rw/nx/x}() functions are required for STRICT_MODULE_RWX, and are generally useful primitives to have. This implementation is designed to be completely generic across powerpc's many MMUs. It's possible that this could be optimised to be faster for specif

[PATCH v5 0/8] set_memory() routines and STRICT_MODULE_RWX

2020-02-25 Thread Russell Currey
Repost from v4 because I somehow missed half of the final patch. Picking up from Christophe's last series, including the following changes: - [6/8] Cast "data" to unsigned long instead of int to fix build - [8/8] New, to fix an issue reported by Jordan Niethe Christophe's last series is here: ht

Re: [RFC PATCH] Use IS_ENABLED() instead of #ifdefs

2020-02-25 Thread Jason Yan
在 2020/2/26 13:04, Christophe Leroy 写道: --- This works for me. Only had to leave the #ifdef around the map_mem_in_cams() Also had to set linear_sz and ram for the alternative case, otherwise I get Great. Thank you for the illustration. Jason

[PATCH v4 8/8] powerpc/mm: Disable set_memory() routines when strict RWX isn't enabled

2020-02-25 Thread Russell Currey
There are a couple of reasons that the set_memory() functions are problematic when STRICT_KERNEL_RWX isn't enabled: - The linear mapping is a different size and apply_to_page_range() may modify a giant section, breaking everything - patch_instruction() doesn't know to work around a page

[PATCH v4 7/8] powerpc/32: use set_memory_attr()

2020-02-25 Thread Russell Currey
From: Christophe Leroy Use set_memory_attr() instead of the PPC32 specific change_page_attr() change_page_attr() was checking that the address was not mapped by blocks and was handling highmem, but that's unneeded because the affected pages can't be in highmem and block mapping verification is a

[PATCH v4 6/8] powerpc/mm: implement set_memory_attr()

2020-02-25 Thread Russell Currey
From: Christophe Leroy In addition to the set_memory_xx() functions which allows to change the memory attributes of not (yet) used memory regions, implement a set_memory_attr() function to: - set the final memory protection after init on currently used kernel regions. - enable/disable kernel memo

[PATCH v4 5/8] powerpc/configs: Enable STRICT_MODULE_RWX in skiroot_defconfig

2020-02-25 Thread Russell Currey
skiroot_defconfig is the only powerpc defconfig with STRICT_KERNEL_RWX enabled, and if you want memory protection for kernel text you'd want it for modules too, so enable STRICT_MODULE_RWX there. Acked-by: Joel Stanley Signed-off-by: Russell Currey --- arch/powerpc/configs/skiroot_defconfig | 1

[PATCH v4 4/8] powerpc: Set ARCH_HAS_STRICT_MODULE_RWX

2020-02-25 Thread Russell Currey
To enable strict module RWX on powerpc, set: CONFIG_STRICT_MODULE_RWX=y You should also have CONFIG_STRICT_KERNEL_RWX=y set to have any real security benefit. ARCH_HAS_STRICT_MODULE_RWX is set to require ARCH_HAS_STRICT_KERNEL_RWX. This is due to a quirk in arch/Kconfig and arch/powerpc/Kcon

[PATCH v4 3/8] powerpc/mm/ptdump: debugfs handler for W+X checks at runtime

2020-02-25 Thread Russell Currey
Very rudimentary, just echo 1 > [debugfs]/check_wx_pages and check the kernel log. Useful for testing strict module RWX. Updated the Kconfig entry to reflect this. Also fixed a typo. Signed-off-by: Russell Currey --- arch/powerpc/Kconfig.debug | 6 -- arch/powerpc/mm/ptdum

[PATCH v4 1/8] powerpc/mm: Implement set_memory() routines

2020-02-25 Thread Russell Currey
From: Christophe Leroy The set_memory_{ro/rw/nx/x}() functions are required for STRICT_MODULE_RWX, and are generally useful primitives to have. This implementation is designed to be completely generic across powerpc's many MMUs. It's possible that this could be optimised to be faster for specif

[PATCH v4 0/8] set_memory() routines and STRICT_MODULE_RWX

2020-02-25 Thread Russell Currey
Picking up from Christophe's last series, including the following changes: - [6/8] Cast "data" to unsigned long instead of int to fix build - [8/8] New, to fix an issue reported by Jordan Niethe Christophe's last series is here: https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=15642

[PATCH v4 2/8] powerpc/kprobes: Mark newly allocated probes as RO

2020-02-25 Thread Russell Currey
From: Christophe Leroy With CONFIG_STRICT_KERNEL_RWX=y and CONFIG_KPROBES=y, there will be one W+X page at boot by default. This can be tested with CONFIG_PPC_PTDUMP=y and CONFIG_PPC_DEBUG_WX=y set, and checking the kernel log during boot. powerpc doesn't implement its own alloc() for kprobes l

[PATCH] powerpc: fix emulate_step std test

2020-02-25 Thread Nicholas Piggin
Signed-off-by: Nicholas Piggin --- arch/powerpc/lib/test_emulate_step.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/lib/test_emulate_step.c b/arch/powerpc/lib/test_emulate_step.c index 42347067739c..00d70253cb5b 100644 --- a/arch/powerpc/lib/test_emulate_step

Re: [PATCH v3 10/27] powerpc: Add driver for OpenCAPI Persistent Memory

2020-02-25 Thread Alastair D'Silva
On Wed, 2020-02-26 at 16:07 +1100, Andrew Donnellan wrote: > On 21/2/20 2:27 pm, Alastair D'Silva wrote: > > From: Alastair D'Silva > > > > This driver exposes LPC memory on OpenCAPI pmem cards > > as an NVDIMM, allowing the existing nvram infrastructure > > to be used. > > > > Namespace metadat

Re: [PATCH v3 3/6] powerpc/fsl_booke/64: implement KASLR for fsl_booke64

2020-02-25 Thread Christophe Leroy
Le 26/02/2020 à 04:33, Jason Yan a écrit : 在 2020/2/26 10:40, Jason Yan 写道: 在 2020/2/20 21:48, Christophe Leroy 写道: Le 06/02/2020 à 03:58, Jason Yan a écrit : Hi Christophe, When using a standard C if/else, all code compiled for PPC32 and PPC64, but this will bring some build error

Re: [PATCH v3 3/6] powerpc/fsl_booke/64: implement KASLR for fsl_booke64

2020-02-25 Thread Christophe Leroy
Le 26/02/2020 à 03:40, Jason Yan a écrit : 在 2020/2/20 21:48, Christophe Leroy 写道: Le 06/02/2020 à 03:58, Jason Yan a écrit :   /*    * Decide which 64M we want to start    * Only use the low 8 bits of the random seed    */ -    index = random & 0xFF; +    unsigned long i

Re: [PATCH v3 10/27] powerpc: Add driver for OpenCAPI Persistent Memory

2020-02-25 Thread Andrew Donnellan
On 21/2/20 2:27 pm, Alastair D'Silva wrote: From: Alastair D'Silva This driver exposes LPC memory on OpenCAPI pmem cards as an NVDIMM, allowing the existing nvram infrastructure to be used. Namespace metadata is stored on the media itself, so scm_reserve_metadata() maps 1 section's worth of PM

[RFC PATCH] Use IS_ENABLED() instead of #ifdefs

2020-02-25 Thread Christophe Leroy
--- This works for me. Only had to leave the #ifdef around the map_mem_in_cams() Also had to set linear_sz and ram for the alternative case, otherwise I get arch/powerpc/mm/nohash/kaslr_booke.c: In function 'kaslr_early_init': arch/powerpc/mm/nohash/kaslr_booke.c:355:33: error: 'linear_sz' may b

[PATCH 2/3] mm/vma: Make vma_is_foreign() available for general use

2020-02-25 Thread Anshuman Khandual
Idea of a foreign VMA with respect to the present context is very generic. But currently there are two identical definitions for this in powerpc and x86 platforms. Lets consolidate those redundant definitions while making vma_is_foreign() available for general use later. This should not cause any f

[PATCH 0/3] mm/vma: some more minor changes

2020-02-25 Thread Anshuman Khandual
The motivation here is to consolidate VMA flags and helpers in generic memory header and reduce code duplication when ever applicable. If there are other possible similar instances which might be missing here, please do let me me know. I will be happy to incorporate them. This series is based on v

[PATCH] ocxl: Fix misleading comment

2020-02-25 Thread Andrew Donnellan
In ocxl_context_free() we note that the AFU reference we're releasing was taken in "ocxl_context_init", a function that doesn't actually exist. Fix it to say ocxl_context_alloc() instead, which I expect was what was intended. Fixes: 5ef3166e8a32 ("ocxl: Driver code for 'generic' opencapi devices"

[PATCH v3 14/14] powerpc: Add prefix support to mce_find_instr_ea_and_pfn()

2020-02-25 Thread Jordan Niethe
mce_find_instr_ea_and_pfn analyses an instruction to determine the effective address that caused the machine check. Update this to load and pass the suffix to analyse_instr for prefixed instructions. Signed-off-by: Jordan Niethe --- v2: - Rename sufx to suffix --- arch/powerpc/kernel/mce_power.c

[PATCH v3 13/14] powerpc/hw_breakpoints: Initial support for prefixed instructions

2020-02-25 Thread Jordan Niethe
Currently when getting an instruction to emulate in hw_breakpoint_handler() we do not load the suffix of a prefixed instruction. Ensure we load the suffix if the instruction we need to emulate is a prefixed instruction. Signed-off-by: Jordan Niethe --- v2: Rename sufx to suffix v3: Add __user to

[PATCH v3 12/14] powerpc/uprobes: Add support for prefixed instructions

2020-02-25 Thread Jordan Niethe
Uprobes can execute instructions out of line. Increase the size of the buffer used for this so that this works for prefixed instructions. Take into account the length of prefixed instructions when fixing up the nip. Signed-off-by: Jordan Niethe --- v2: - Fix typo - Use macro for instruction

[PATCH v3 11/14] powerpc/kprobes: Support kprobes on prefixed instructions

2020-02-25 Thread Jordan Niethe
A prefixed instruction is composed of a word prefix followed by a word suffix. It does not make sense to be able to have a kprobe on the suffix of a prefixed instruction, so make this impossible. Kprobes work by replacing an instruction with a trap and saving that instruction to be single stepped

[PATCH v3 10/14] powerpc/xmon: Dump prefixed instructions

2020-02-25 Thread Jordan Niethe
Currently when xmon is dumping instructions it reads a word at a time and then prints that instruction (either as a hex number or by disassembling it). For prefixed instructions it would be nice to show its prefix and suffix as together. Use read_instr() so that if a prefix is encountered its suffi

[PATCH v3 09/14] powerpc/xmon: Add initial support for prefixed instructions

2020-02-25 Thread Jordan Niethe
A prefixed instruction is composed of a word prefix and a word suffix. It does not make sense to be able to have a breakpoint on the suffix of a prefixed instruction, so make this impossible. When leaving xmon_core() we check to see if we are currently at a breakpoint. If this is the case, the bre

[PATCH v3 08/14] powerpc/xmon: Remove store_inst() for patch_instruction()

2020-02-25 Thread Jordan Niethe
For modifying instructions in xmon, patch_instruction() can serve the same role that store_inst() is performing with the advantage of not being specific to xmon. In some places patch_instruction() is already being using followed by store_inst(). In these cases just remove the store_inst(). Otherwis

[PATCH v3 07/14] powerpc/traps: Check for prefixed instructions in facility_unavailable_exception()

2020-02-25 Thread Jordan Niethe
If prefixed instructions are made unavailable by the [H]FSCR, attempting to use them will cause a facility unavailable exception. Add "PREFIX" to the facility_strings[]. Currently there are no prefixed instructions that are actually emulated by emulate_instruction() within facility_unavailable_exc

[PATCH v3 06/14] powerpc: Support prefixed instructions in alignment handler

2020-02-25 Thread Jordan Niethe
Alignment interrupts can be caused by prefixed instructions accessing memory. In the alignment handler the instruction that caused the exception is loaded and attempted emulate. If the instruction is a prefixed instruction load the prefix and suffix to emulate. After emulating increment the NIP by

[PATCH v3 05/14] powerpc sstep: Add support for prefixed fixed-point arithmetic

2020-02-25 Thread Jordan Niethe
This adds emulation support for the following prefixed Fixed-Point Arithmetic instructions: * Prefixed Add Immediate (paddi) Signed-off-by: Jordan Niethe --- v3: Since we moved the prefixed loads/stores into the load/store switch statement it no longer makes sense to have paddi in there, so mov

[PATCH v3 04/14] powerpc sstep: Add support for prefixed load/stores

2020-02-25 Thread Jordan Niethe
This adds emulation support for the following prefixed integer load/stores: * Prefixed Load Byte and Zero (plbz) * Prefixed Load Halfword and Zero (plhz) * Prefixed Load Halfword Algebraic (plha) * Prefixed Load Word and Zero (plwz) * Prefixed Load Word Algebraic (plwa) * Prefixed Load

[PATCH v3 03/14] powerpc sstep: Prepare to support prefixed instructions

2020-02-25 Thread Jordan Niethe
Currently all instructions are a single word long. A future ISA version will include prefixed instructions which have a double word length. The functions used for analysing and emulating instructions need to be modified so that they can handle these new instruction types. A prefixed instruction is

[PATCH v3 02/14] powerpc: Define new SRR1 bits for a future ISA version

2020-02-25 Thread Jordan Niethe
Add the BOUNDARY SRR1 bit definition for when the cause of an alignment exception is a prefixed instruction that crosses a 64-byte boundary. Add the PREFIXED SRR1 bit definition for exceptions caused by prefixed instructions. Bit 35 of SRR1 is called SRR1_ISI_N_OR_G. This name comes from it being

[PATCH v3 01/14] powerpc: Enable Prefixed Instructions

2020-02-25 Thread Jordan Niethe
From: Alistair Popple Prefix instructions have their own FSCR bit which needs to enabled via a CPU feature. The kernel will save the FSCR for problem state but it needs to be enabled initially. Signed-off-by: Alistair Popple --- arch/powerpc/include/asm/reg.h| 3 +++ arch/powerpc/kernel/d

[PATCH v3 00/14] Initial Prefixed Instruction support

2020-02-25 Thread Jordan Niethe
A future revision of the ISA will introduce prefixed instructions. A prefixed instruction is composed of a 4-byte prefix followed by a 4-byte suffix. All prefixes have the major opcode 1. A prefix will never be a valid word instruction. A suffix may be an existing word instruction or a new instruc

[Bug 206669] Little-endian kernel crashing on POWER8 on heavy big-endian PowerKVM load

2020-02-25 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=206669 --- Comment #1 from npig...@gmail.com --- bugzilla-dae...@bugzilla.kernel.org's on February 26, 2020 1:26 am: > https://bugzilla.kernel.org/show_bug.cgi?id=206669 > > Bug ID: 206669 >Summary: Little-endian kernel crashing

Re: [Bug 206669] New: Little-endian kernel crashing on POWER8 on heavy big-endian PowerKVM load

2020-02-25 Thread Nicholas Piggin
bugzilla-dae...@bugzilla.kernel.org's on February 26, 2020 1:26 am: > https://bugzilla.kernel.org/show_bug.cgi?id=206669 > > Bug ID: 206669 >Summary: Little-endian kernel crashing on POWER8 on heavy > big-endian PowerKVM load >Product: Platfo

Re: [PATCH v3 26/32] powerpc/64: system call zero volatile registers when returning

2020-02-25 Thread Nicholas Piggin
Segher Boessenkool's on February 26, 2020 7:20 am: > Hi! > > On Wed, Feb 26, 2020 at 03:35:35AM +1000, Nicholas Piggin wrote: >> Kernel addresses and potentially other sensitive data could be leaked >> in volatile registers after a syscall. > >> cmpdi r3,0 >> bne .Lsyscall_restore

Re: [PATCH v3 3/6] powerpc/fsl_booke/64: implement KASLR for fsl_booke64

2020-02-25 Thread Jason Yan
在 2020/2/26 10:40, Jason Yan 写道: 在 2020/2/20 21:48, Christophe Leroy 写道: Le 06/02/2020 à 03:58, Jason Yan a écrit : The implementation for Freescale BookE64 is similar as BookE32. One difference is that Freescale BookE64 set up a TLB mapping of 1G during booting. Another difference is th

Re: [PATCH v2 3/3] ASoC: fsl_easrc: Add EASRC ASoC CPU DAI and platform drivers

2020-02-25 Thread Nicolin Chen
On Wed, Feb 26, 2020 at 09:51:39AM +0800, Shengjiu Wang wrote: > > > > > +static const struct regmap_config fsl_easrc_regmap_config = { > > > > > + .readable_reg = fsl_easrc_readable_reg, > > > > > + .volatile_reg = fsl_easrc_volatile_reg, > > > > > + .writeable_reg = fsl_easrc_writeabl

Re: [PATCH v3 6/6] powerpc/fsl_booke/kaslr: rename kaslr-booke32.rst to kaslr-booke.rst and add 64bit part

2020-02-25 Thread Jason Yan
在 2020/2/20 21:50, Christophe Leroy 写道: Le 06/02/2020 à 03:58, Jason Yan a écrit : Now we support both 32 and 64 bit KASLR for fsl booke. Add document for 64 bit part and rename kaslr-booke32.rst to kaslr-booke.rst. Signed-off-by: Jason Yan Cc: Scott Wood Cc: Diana Craciun Cc: Michael E

Re: [PATCH v3 5/6] powerpc/fsl_booke/64: clear the original kernel if randomized

2020-02-25 Thread Jason Yan
在 2020/2/20 21:49, Christophe Leroy 写道: Le 06/02/2020 à 03:58, Jason Yan a écrit : The original kernel still exists in the memory, clear it now. No such problem with PPC32 ? Or is that common ? PPC32 did this in relocate_init() in fsl_booke.c because PPC32 will not reach kaslr_early_i

Re: [PATCH v3 3/6] powerpc/fsl_booke/64: implement KASLR for fsl_booke64

2020-02-25 Thread Jason Yan
在 2020/2/20 21:48, Christophe Leroy 写道: Le 06/02/2020 à 03:58, Jason Yan a écrit : The implementation for Freescale BookE64 is similar as BookE32. One difference is that Freescale BookE64 set up a TLB mapping of 1G during booting. Another difference is that ppc64 needs the kernel to be 64K-

Re: [PATCH v3 1/6] powerpc/fsl_booke/kaslr: refactor kaslr_legal_offset() and kaslr_early_init()

2020-02-25 Thread Jason Yan
在 2020/2/20 21:40, Christophe Leroy 写道: Le 06/02/2020 à 03:58, Jason Yan a écrit : Some code refactor in kaslr_legal_offset() and kaslr_early_init(). No functional change. This is a preparation for KASLR fsl_booke64. Signed-off-by: Jason Yan Cc: Scott Wood Cc: Diana Craciun Cc: Michael

Re: [PATCH v2 3/3] ASoC: fsl_easrc: Add EASRC ASoC CPU DAI and platform drivers

2020-02-25 Thread Shengjiu Wang
On Tue, Feb 25, 2020 at 4:05 PM Nicolin Chen wrote: > > On Mon, Feb 24, 2020 at 08:53:25AM +, S.j. Wang wrote: > > Hi > > > > > > > > > > Signed-off-by: Shengjiu Wang > > > > --- > > > > sound/soc/fsl/Kconfig | 10 + > > > > sound/soc/fsl/Makefile |2 + > > > > sound

RE: [PATCH v3 00/27] Add support for OpenCAPI Persistent Memory devices

2020-02-25 Thread Alastair D'Silva
On Tue, 2020-02-25 at 16:32 -0800, Dan Williams wrote: > On Tue, Feb 25, 2020 at 4:14 PM Alastair D'Silva < > alast...@au1.ibm.com> wrote: > > On Mon, 2020-02-24 at 17:51 +1100, Oliver O'Halloran wrote: > > > On Mon, Feb 24, 2020 at 3:43 PM Alastair D'Silva < > > > alast...@au1.ibm.com> wrote: > >

Re: [PATCH v3 00/27] Add support for OpenCAPI Persistent Memory devices

2020-02-25 Thread Dan Williams
On Tue, Feb 25, 2020 at 4:14 PM Alastair D'Silva wrote: > > On Mon, 2020-02-24 at 17:51 +1100, Oliver O'Halloran wrote: > > On Mon, Feb 24, 2020 at 3:43 PM Alastair D'Silva < > > alast...@au1.ibm.com> wrote: > > > On Sun, 2020-02-23 at 20:37 -0800, Matthew Wilcox wrote: > > > > On Mon, Feb 24, 202

Re: [PATCH v3 06/27] ocxl: Tally up the LPC memory on a link & allow it to be mapped

2020-02-25 Thread Alastair D'Silva
On Tue, 2020-02-25 at 17:30 +0100, Frederic Barrat wrote: > > Le 21/02/2020 à 04:26, Alastair D'Silva a écrit : > > From: Alastair D'Silva > > > > Tally up the LPC memory on an OpenCAPI link & allow it to be mapped > > > > Signed-off-by: Alastair D'Silva > > --- > > drivers/misc/ocxl/core.c

Re: [PATCH v3 03/27] powerpc: Map & release OpenCAPI LPC memory

2020-02-25 Thread Alastair D'Silva
On Tue, 2020-02-25 at 11:02 +0100, Frederic Barrat wrote: > > Le 21/02/2020 à 04:26, Alastair D'Silva a écrit : > > From: Alastair D'Silva > > > > This patch adds platform support to map & release LPC memory. > > > > Signed-off-by: Alastair D'Silva > > --- > > arch/powerpc/include/asm/pnv-oc

RE: [PATCH v3 00/27] Add support for OpenCAPI Persistent Memory devices

2020-02-25 Thread Alastair D'Silva
On Mon, 2020-02-24 at 17:51 +1100, Oliver O'Halloran wrote: > On Mon, Feb 24, 2020 at 3:43 PM Alastair D'Silva < > alast...@au1.ibm.com> wrote: > > On Sun, 2020-02-23 at 20:37 -0800, Matthew Wilcox wrote: > > > On Mon, Feb 24, 2020 at 03:34:07PM +1100, Alastair D'Silva wrote: > > > > V3: > > > >

Re: MCE handler gets NIP wrong on MPC8378

2020-02-25 Thread Radu Rendec
On 02/20/2020 at 12:48 PM Christophe Leroy wrote: > Le 20/02/2020 à 18:34, Radu Rendec a écrit : > > On 02/20/2020 at 11:25 AM Christophe Leroy wrote: > >> Le 20/02/2020 à 17:02, Radu Rendec a écrit : > >>> On 02/20/2020 at 3:38 AM Christophe Leroy wrote: > On 02/19/2020 10:39 PM, Radu Rend

Re: [PATCH v3 26/32] powerpc/64: system call zero volatile registers when returning

2020-02-25 Thread Segher Boessenkool
Hi! On Wed, Feb 26, 2020 at 03:35:35AM +1000, Nicholas Piggin wrote: > Kernel addresses and potentially other sensitive data could be leaked > in volatile registers after a syscall. > cmpdi r3,0 > bne .Lsyscall_restore_regs > + li r0,0 > + li r4,0 > + li

Re: [PATCH] evh_bytechan: fix out of bounds accesses

2020-02-25 Thread Stephen Rothwell
Hi Laurentiu, On Tue, 25 Feb 2020 11:54:17 +0200 Laurentiu Tudor wrote: > > On 21.02.2020 01:57, Stephen Rothwell wrote: > > > > On Thu, 16 Jan 2020 11:37:14 +1100 Stephen Rothwell > > wrote: > >> > >> On Wed, 15 Jan 2020 14:01:35 -0600 Scott Wood wrote: > >>> > >>> On Thu, 2020-01-16 at

Re: [PATCH] macintosh: therm_windtunnel: fix regression when instantiating devices

2020-02-25 Thread Wolfram Sang
On Tue, Feb 25, 2020 at 03:41:22PM +0100, John Paul Adrian Glaubitz wrote: > Hello! > > On 2/25/20 3:12 PM, Wolfram Sang wrote: > > Adding the Debian-PPC List to reach further people maybe willing to > > test. > > This might be related [1]. IIUC, this is the same as https://bugzilla.kernel.org/s

[PATCH] i2c: powermac: correct comment about custom handling

2020-02-25 Thread Wolfram Sang
The comment had some flaws which are now fixed: - the prefix is 'MAC' not 'AAPL' - no kernel coding style and too short length - 'we do' instead of 'we to' Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-powermac.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) dif

[PATCH] macintosh: therm_windtunnel: fix regression when instantiating devices

2020-02-25 Thread Wolfram Sang
Removing attach_adapter from this driver caused a regression for at least some machines. Those machines had the sensors described in their DT, too, so they didn't need manual creation of the sensor devices. The old code worked, though, because manual creation came first. Creation of DT devices then

[PATCH v3 32/32] powerpc/64s: system call support for scv/rfscv instructions

2020-02-25 Thread Nicholas Piggin
Add support for the scv instruction on POWER9 and later CPUs. For now this implements the zeroth scv vector 'scv 0', as identical to 'sc' system calls, with the exception that lr is not preserved, and it is 64-bit only. There may yet be changes made to this ABI, so it's for testing only. rfscv is

[PATCH v3 31/32] powerpc/64s/exception: treat NIA below __end_interrupts as soft-masked

2020-02-25 Thread Nicholas Piggin
The scv instruction causes an interrupt which can enter the kernel with MSR[EE]=1, thus allowing interrupts to hit at any time. These must not be taken as normal interrupts, because they come from MSR[PR]=0 context, and yet the kernel stack is not yet set up and r13 is not set to the PACA). Treat

[PATCH v3 30/32] powerpc/64: system call reconcile interrupts

2020-02-25 Thread Nicholas Piggin
This reconciles interrupts in the system call case like all other interrupts. This allows system_call_common to be shared with the scv system call implementation in a subsequent patch. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/entry_64.S | 11 +++ arch/powerpc/kernel/sysca

[PATCH v3 29/32] powerpc/64s/exception: remove lite interrupt return

2020-02-25 Thread Nicholas Piggin
The difference between lite and regular returns is that the lite case restores all NVGPRs, whereas lite skips that. This is quite clumsy though, most interrupts want the NVGPRs saved for debugging, not to modify in the caller, so the NVGPRs restore is not necessary most of the time. Restore NVGPRs

[PATCH v3 28/32] powerpc/64s: interrupt implement exit logic in C

2020-02-25 Thread Nicholas Piggin
Implement the bulk of interrupt return logic in C. The asm return code must handle a few cases: restoring full GPRs, and emulating stack store. The stack store emulation is significantly simplfied, rather than creating a new return frame and switching to that before performing the store, it uses t

[PATCH v3 27/32] powerpc/64: implement soft interrupt replay in C

2020-02-25 Thread Nicholas Piggin
When local_irq_enable() finds a pending soft-masked interrupt, it "replays" it by setting up registers like the initial interrupt entry, then calls into the low level handler to set up an interrupt stack frame and process the interrupt. This is not necessary, and uses more stack than needed. The h

[PATCH v3 26/32] powerpc/64: system call zero volatile registers when returning

2020-02-25 Thread Nicholas Piggin
Kernel addresses and potentially other sensitive data could be leaked in volatile registers after a syscall. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/entry_64.S | 12 1 file changed, 12 insertions(+) diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/en

[PATCH v3 25/32] powerpc/64: system call implement entry/exit logic in C

2020-02-25 Thread Nicholas Piggin
System call entry and particularly exit code is beyond the limit of what is reasonable to implement in asm. This conversion moves all conditional branches out of the asm code, except for the case that all GPRs should be restored at exit. Null syscall test is about 5% faster after this patch, beca

[PATCH v3 24/32] powerpc/64: sstep ifdef the deprecated fast endian switch syscall

2020-02-25 Thread Nicholas Piggin
Signed-off-by: Nicholas Piggin --- arch/powerpc/lib/sstep.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c index c077acb983a1..5f3a7bd9d90d 100644 --- a/arch/powerpc/lib/sstep.c +++ b/arch/powerpc/lib/sstep.c @@ -3179,8

[PATCH v3 23/32] powerpc/64: system call remove non-volatile GPR save optimisation

2020-02-25 Thread Nicholas Piggin
powerpc has an optimisation where interrupts avoid saving the non-volatile (or callee saved) registers to the interrupt stack frame if they are not required. Two problems with this are that an interrupt does not always know whether it will need non-volatiles; and if it does need them, they can onl

[PATCH v3 22/32] powerpc/64s/exception: soft nmi interrupt should not use ret_from_except

2020-02-25 Thread Nicholas Piggin
The soft nmi handler does not reconcile interrupt state, so it should not return via the normal ret_from_except path. Return like other NMIs, using the EXCEPTION_RESTORE_REGS macro. This becomes important when the scv interrupt is implemented, which must handle soft-masked interrupts that have r13

[PATCH v3 21/32] powerpc/64s/exception: sreset interrupts reconcile fix

2020-02-25 Thread Nicholas Piggin
This adds IRQ_HARD_DIS to irq_happened. Although it doesn't seem to matter much because we're not allowed to enable irqs in an NMI handler, the soft-irq debugging code is becoming more strict about ensuring IRQ_HARD_DIS is in sync with MSR[EE], this may help avoid asserts or other issues. Add a co

[PATCH v3 20/32] powerpc/64s/exception: only test KVM in SRR interrupts when PR KVM is supported

2020-02-25 Thread Nicholas Piggin
Apart from SRESET, MCE, and syscall (hcall variant), the SRR type interrupts are not escalated to hypervisor mode, so delivered to the OS. When running PR KVM, the OS is the hypervisor, and the guest runs with MSR[PR]=1, so these interrupts must test if a guest was running when interrupted. These

[PATCH v3 19/32] powerpc/64s/exception: add more comments for interrupt handlers

2020-02-25 Thread Nicholas Piggin
A few of the non-standard handlers are left uncommented. Some more description could be added to some. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 391 --- 1 file changed, 353 insertions(+), 38 deletions(-) diff --git a/arch/powerpc/kernel/e

[PATCH v3 18/32] powerpc/64s/exception: Clean up SRR specifiers

2020-02-25 Thread Nicholas Piggin
Remove more magic numbers and replace with nicely named bools. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 68 +--- 1 file changed, 32 insertions(+), 36 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/ex

[PATCH v3 17/32] powerpc/64s/exception: re-inline some handlers

2020-02-25 Thread Nicholas Piggin
The reduction in interrupt entry size allows some handlers to be re-inlined. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64

[PATCH v3 16/32] powerpc/64s/exception: hdecrementer avoid touching the stack

2020-02-25 Thread Nicholas Piggin
The hdec interrupt handler is reported to sometimes fire in Linux if KVM leaves it pending after a guest exists. This is harmless, so there is a no-op handler for it. The interrupt handler currently uses the regular kernel stack. Change this to avoid touching the stack entirely. This should be th

[PATCH v3 15/32] powerpc/64s/exception: trim unused arguments from KVMTEST macro

2020-02-25 Thread Nicholas Piggin
Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index feb563416abd..7e056488d42a 100644 --- a/arch/powerpc/kernel/exc

[PATCH v3 12/32] powerpc/64s/exception: move KVM test to common code

2020-02-25 Thread Nicholas Piggin
This allows more code to be moved out of unrelocated regions. The system call KVMTEST is changed to be open-coded and remain in the tramp area to avoid having to move it to entry_64.S. The custom nature of the system call entry code means the hcall case can be made more streamlined than regular int

[PATCH v3 13/32] powerpc/64s/exception: remove confusing IEARLY option

2020-02-25 Thread Nicholas Piggin
Replace IEARLY=1 and IEARLY=2 with IBRANCH_COMMON, which controls if the entry code branches to a common handler; and IREALMODE_COMMON, which controls whether the common handler should remain in real mode. These special cases no longer avoid loading the SRR registers, there is no point as most of

[PATCH v3 14/32] powerpc/64s/exception: remove the SPR saving patch code macros

2020-02-25 Thread Nicholas Piggin
These are used infrequently enough they don't provide much help, so inline them. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 82 ++-- 1 file changed, 28 insertions(+), 54 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch

[PATCH v3 11/32] powerpc/64s/exception: move soft-mask test to common code

2020-02-25 Thread Nicholas Piggin
As well as moving code out of the unrelocated vectors, this allows the masked handlers to be moved to common code, and allows the soft_nmi handler to be generated more like a regular handler. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 106 +-

[PATCH v3 10/32] powerpc/64s/exception: move real->virt switch into the common handler

2020-02-25 Thread Nicholas Piggin
The real mode interrupt entry points currently use rfid to branch to the common handler in virtual mode. This is a significant amount of code, and forces other code (notably the KVM test) to live in the real mode handler. In the interest of minimising the amount of code that runs unrelocated move

[PATCH v3 09/32] powerpc/64s/exception: Add ISIDE option

2020-02-25 Thread Nicholas Piggin
Rather than using DAR=2 to select the i-side registers, add an explicit option. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 23 --- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerp

[PATCH v3 07/32] powerpc/64s/exception: Remove old INT_COMMON macro

2020-02-25 Thread Nicholas Piggin
Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 51 +--- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index 74bf6e0bf61f..90514766dc7d 100644 --- a/arc

  1   2   >