1. 03 Dec, 2020 6 commits
    • Michael Ellerman's avatar
      powerpc: Update NUMA Kconfig description & help text · bae80c27
      Michael Ellerman authored
      Update the NUMA Kconfig description to match other architectures, and
      add some help text. Shamelessly borrowed from x86/arm64.
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Reviewed-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Link: https://lore.kernel.org/r/20201124120547.1940635-3-mpe@ellerman.id.au
      bae80c27
    • Michael Ellerman's avatar
      powerpc: Make NUMA default y for powernv · 4c28b32b
      Michael Ellerman authored
      Our NUMA option is default y for pseries, but not powernv. The bulk of
      powernv systems are NUMA, so make NUMA default y for powernv also.
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Reviewed-by: default avatarSrikar Dronamraju <srikar@linux.vnet.ibm.com>
      Link: https://lore.kernel.org/r/20201124120547.1940635-2-mpe@ellerman.id.au
      4c28b32b
    • Michael Ellerman's avatar
      powerpc: Make NUMA depend on SMP · 25395cd2
      Michael Ellerman authored
      Our Kconfig allows NUMA to be enabled without SMP, but none of
      our defconfigs use that combination. This means it can easily be
      broken inadvertently by code changes, which has happened recently.
      
      Although it's theoretically possible to have a machine with a single
      CPU and multiple memory nodes, I can't think of any real systems where
      that's the case. Even so if such a system exists, it can just run an
      SMP kernel anyway.
      
      So to avoid the need to add extra #ifdefs and/or build breaks, make
      NUMA depend on SMP.
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Reported-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Reviewed-by: default avatarSrikar Dronamraju <srikar@linux.vnet.ibm.com>
      Reviewed-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Link: https://lore.kernel.org/r/20201124120547.1940635-1-mpe@ellerman.id.au
      25395cd2
    • Christophe Leroy's avatar
      powerpc: inline iomap accessors · 894fa235
      Christophe Leroy authored
      ioreadXX()/ioreadXXbe() accessors are equivalent to ppc
      in_leXX()/in_be16() accessors but they are not inlined.
      
      Since commit 0eb57368 ("powerpc/kerenl: Enable EEH for IO
      accessors"), the 'le' versions are equivalent to the ones
      defined in asm-generic/io.h, allthough the ones there are inlined.
      
      Include asm-generic/io.h to get them. Keep ppc versions of the
      'be' ones as they are optimised, but make them inline in ppc io.h.
      
      This reduces the size of ppc64e_defconfig build by 3 kbytes:
      
         text	   data	    bss	    dec	    hex	filename
      10160733	4343422	 562972	15067127	 e5e7f7	vmlinux.before
      10159239	4341590	 562972	15063801	 e5daf9	vmlinux.after
      
      A typical function using ioread and iowrite before the change:
      
      c00000000066a3c4 <.ata_bmdma_stop>:
      c00000000066a3c4:	7c 08 02 a6 	mflr    r0
      c00000000066a3c8:	fb c1 ff f0 	std     r30,-16(r1)
      c00000000066a3cc:	f8 01 00 10 	std     r0,16(r1)
      c00000000066a3d0:	fb e1 ff f8 	std     r31,-8(r1)
      c00000000066a3d4:	f8 21 ff 81 	stdu    r1,-128(r1)
      c00000000066a3d8:	eb e3 00 00 	ld      r31,0(r3)
      c00000000066a3dc:	eb df 00 98 	ld      r30,152(r31)
      c00000000066a3e0:	7f c3 f3 78 	mr      r3,r30
      c00000000066a3e4:	4b 9b 6f 7d 	bl      c000000000021360 <.ioread8>
      c00000000066a3e8:	60 00 00 00 	nop
      c00000000066a3ec:	7f c4 f3 78 	mr      r4,r30
      c00000000066a3f0:	54 63 06 3c 	rlwinm  r3,r3,0,24,30
      c00000000066a3f4:	4b 9b 70 4d 	bl      c000000000021440 <.iowrite8>
      c00000000066a3f8:	60 00 00 00 	nop
      c00000000066a3fc:	7f e3 fb 78 	mr      r3,r31
      c00000000066a400:	38 21 00 80 	addi    r1,r1,128
      c00000000066a404:	e8 01 00 10 	ld      r0,16(r1)
      c00000000066a408:	eb c1 ff f0 	ld      r30,-16(r1)
      c00000000066a40c:	7c 08 03 a6 	mtlr    r0
      c00000000066a410:	eb e1 ff f8 	ld      r31,-8(r1)
      c00000000066a414:	4b ff ff 8c 	b       c00000000066a3a0 <.ata_sff_dma_pause>
      
      The same function with this patch:
      
      c000000000669cb4 <.ata_bmdma_stop>:
      c000000000669cb4:	e8 63 00 00 	ld      r3,0(r3)
      c000000000669cb8:	e9 43 00 98 	ld      r10,152(r3)
      c000000000669cbc:	7c 00 04 ac 	hwsync
      c000000000669cc0:	89 2a 00 00 	lbz     r9,0(r10)
      c000000000669cc4:	0c 09 00 00 	twi     0,r9,0
      c000000000669cc8:	4c 00 01 2c 	isync
      c000000000669ccc:	55 29 06 3c 	rlwinm  r9,r9,0,24,30
      c000000000669cd0:	7c 00 04 ac 	hwsync
      c000000000669cd4:	99 2a 00 00 	stb     r9,0(r10)
      c000000000669cd8:	a1 4d 06 f0 	lhz     r10,1776(r13)
      c000000000669cdc:	2c 2a 00 00 	cmpdi   r10,0
      c000000000669ce0:	41 c2 00 08 	beq-    c000000000669ce8 <.ata_bmdma_stop+0x34>
      c000000000669ce4:	b1 4d 06 f2 	sth     r10,1778(r13)
      c000000000669ce8:	4b ff ff a8 	b       c000000000669c90 <.ata_sff_dma_pause>
      Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/18b357d68c4cde149f75c7a1031c850925cd8128.1605981539.git.christophe.leroy@csgroup.eu
      894fa235
    • Athira Rajeev's avatar
      powerpc/perf: Fix crash with is_sier_available when pmu is not set · f75e7d73
      Athira Rajeev authored
      On systems without any specific PMU driver support registered, running
      'perf record' with —intr-regs  will crash ( perf record -I <workload> ).
      
      The relevant portion from crash logs and Call Trace:
      
      Unable to handle kernel paging request for data at address 0x00000068
      Faulting instruction address: 0xc00000000013eb18
      Oops: Kernel access of bad area, sig: 11 [#1]
      CPU: 2 PID: 13435 Comm: kill Kdump: loaded Not tainted 4.18.0-193.el8.ppc64le #1
      NIP:  c00000000013eb18 LR: c000000000139f2c CTR: c000000000393d80
      REGS: c0000004a07ab4f0 TRAP: 0300   Not tainted  (4.18.0-193.el8.ppc64le)
      NIP [c00000000013eb18] is_sier_available+0x18/0x30
      LR [c000000000139f2c] perf_reg_value+0x6c/0xb0
      Call Trace:
      [c0000004a07ab770] [c0000004a07ab7c8] 0xc0000004a07ab7c8 (unreliable)
      [c0000004a07ab7a0] [c0000000003aa77c] perf_output_sample+0x60c/0xac0
      [c0000004a07ab840] [c0000000003ab3f0] perf_event_output_forward+0x70/0xb0
      [c0000004a07ab8c0] [c00000000039e208] __perf_event_overflow+0x88/0x1a0
      [c0000004a07ab910] [c00000000039e42c] perf_swevent_hrtimer+0x10c/0x1d0
      [c0000004a07abc50] [c000000000228b9c] __hrtimer_run_queues+0x17c/0x480
      [c0000004a07abcf0] [c00000000022aaf4] hrtimer_interrupt+0x144/0x520
      [c0000004a07abdd0] [c00000000002a864] timer_interrupt+0x104/0x2f0
      [c0000004a07abe30] [c0000000000091c4] decrementer_common+0x114/0x120
      
      When perf record session is started with "-I" option, capturing registers
      on each sample calls is_sier_available() to check for the
      SIER (Sample Instruction Event Register) availability in the platform.
      This function in core-book3s accesses 'ppmu->flags'. If a platform specific
      PMU driver is not registered, ppmu is set to NULL and accessing its
      members results in a crash. Fix the crash by returning false in
      is_sier_available() if ppmu is not set.
      
      Fixes: 333804dc ("powerpc/perf: Update perf_regs structure to include SIER")
      Reported-by: default avatarSachin Sant <sachinp@linux.vnet.ibm.com>
      Signed-off-by: default avatarAthira Rajeev <atrajeev@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/1606185640-1720-1-git-send-email-atrajeev@linux.vnet.ibm.com
      f75e7d73
    • Alan Modra's avatar
      powerpc/boot: Make use of REL16 relocs in powerpc/boot/util.S · 3d635aba
      Alan Modra authored
      Use bcl 20,31,0f rather than plain bl to avoid unbalancing the link
      stack.
      
      Update the code to use REL16 relocs, available for ppc64 in 2009 (and
      ppc32 in 2005).
      Signed-off-by: default avatarAlan Modra <amodra@gmail.com>
      [mpe: Incorporate more detail into the change log]
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      3d635aba
  2. 26 Nov, 2020 7 commits
  3. 25 Nov, 2020 1 commit
  4. 23 Nov, 2020 2 commits
    • Stephen Rothwell's avatar
      powerpc/64s: Fix allnoconfig build since uaccess flush · b6b79dd5
      Stephen Rothwell authored
      Using DECLARE_STATIC_KEY_FALSE needs linux/jump_table.h.
      
      Otherwise the build fails with eg:
      
        arch/powerpc/include/asm/book3s/64/kup-radix.h:66:1: warning: data definition has no type or storage class
           66 | DECLARE_STATIC_KEY_FALSE(uaccess_flush_key);
      
      Fixes: 9a32a7e7 ("powerpc/64s: flush L1D after user accesses")
      Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      [mpe: Massage change log]
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20201123184016.693fe464@canb.auug.org.au
      b6b79dd5
    • Michael Ellerman's avatar
      Merge tag 'powerpc-cve-2020-4788' into fixes · 962f8e64
      Michael Ellerman authored
      From Daniel's cover letter:
      
      IBM Power9 processors can speculatively operate on data in the L1 cache
      before it has been completely validated, via a way-prediction mechanism. It
      is not possible for an attacker to determine the contents of impermissible
      memory using this method, since these systems implement a combination of
      hardware and software security measures to prevent scenarios where
      protected data could be leaked.
      
      However these measures don't address the scenario where an attacker induces
      the operating system to speculatively execute instructions using data that
      the attacker controls. This can be used for example to speculatively bypass
      "kernel user access prevention" techniques, as discovered by Anthony
      Steinhauser of Google's Safeside Project. This is not an attack by itself,
      but there is a possibility it could be used in conjunction with
      side-channels or other weaknesses in the privileged code to construct an
      attack.
      
      This issue can be mitigated by flushing the L1 cache between privilege
      boundaries of concern.
      
      This patch series flushes the L1 cache on kernel entry (patch 2) and after the
      kernel performs any user accesses (patch 3). It also adds a self-test and
      performs some related cleanups.
      962f8e64
  5. 19 Nov, 2020 24 commits