LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: (subset) [PATCH 00/38] Replace deprecated CPU-hotplug
From: Michael Ellerman @ 2021-08-18 13:38 UTC (permalink / raw)
  To: linux-kernel, Sebastian Andrzej Siewior; +Cc: linuxppc-dev
In-Reply-To: <20210803141621.780504-1-bigeasy@linutronix.de>

On Tue, 3 Aug 2021 16:15:43 +0200, Sebastian Andrzej Siewior wrote:
> This is a tree wide replacement of the deprecated CPU hotplug functions
> which are only wrappers around the actual functions.
> 
> Each patch is independent and can be picked up by the relevant maintainer.
> 
> [...]

Applied to powerpc/next.

[03/38] powerpc: Replace deprecated CPU-hotplug functions.
        https://git.kernel.org/powerpc/c/5ae36401ca4ea2737d779ce7c267444b16530001

cheers

^ permalink raw reply

* Re: [PATCH v2 1/2] powerpc/bug: Remove specific powerpc BUG_ON() and WARN_ON() on PPC32
From: Michael Ellerman @ 2021-08-18 13:38 UTC (permalink / raw)
  To: Christophe Leroy, Benjamin Herrenschmidt, Michael Ellerman,
	Paul Mackerras
  Cc: linuxppc-dev, linux-kernel
In-Reply-To: <b286e07fb771a664b631cd07a40b09c06f26e64b.1618331881.git.christophe.leroy@csgroup.eu>

On Tue, 13 Apr 2021 16:38:09 +0000 (UTC), Christophe Leroy wrote:
> powerpc BUG_ON() and WARN_ON() are based on using twnei instruction.
> 
> For catching simple conditions like a variable having value 0, this
> is efficient because it does the test and the trap at the same time.
> But most conditions used with BUG_ON or WARN_ON are more complex and
> forces GCC to format the condition into a 0 or 1 value in a register.
> This will usually require 2 to 3 instructions.
> 
> [...]

Applied to powerpc/next.

[1/2] powerpc/bug: Remove specific powerpc BUG_ON() and WARN_ON() on PPC32
      https://git.kernel.org/powerpc/c/db87a7199229b75c9996bf78117eceb81854fce2
[2/2] powerpc/bug: Provide better flexibility to WARN_ON/__WARN_FLAGS() with asm goto
      https://git.kernel.org/powerpc/c/1e688dd2a3d6759d416616ff07afc4bb836c4213

cheers

^ permalink raw reply

* Re: [PATCH 0/2] KVM: PPC: Book3S HV: XIVE: Improve guest entries and exits
From: Michael Ellerman @ 2021-08-18 13:38 UTC (permalink / raw)
  To: linuxppc-dev, Cédric Le Goater; +Cc: Paul Mackerras, kvm-ppc
In-Reply-To: <20210720134209.256133-1-clg@kaod.org>

On Tue, 20 Jul 2021 15:42:07 +0200, Cédric Le Goater wrote:
> The XIVE interrupt controller on P10 can automatically save and
> restore the state of the interrupt registers under the internal NVP
> structure representing the VCPU. This saves a costly store/load in
> guest entries and exits.
> 
> Thanks,
> 
> [...]

Applied to powerpc/next.

[1/2] KVM: PPC: Book3S HV: XIVE: Add a 'flags' field
      https://git.kernel.org/powerpc/c/b68c6646cce5ee8caefa6333ee743f960222dcea
[2/2] KVM: PPC: Book3S HV: XIVE: Add support for automatic save-restore
      https://git.kernel.org/powerpc/c/f5af0a978776b710f16dc99a85496b1e760bf9e0

cheers

^ permalink raw reply

* Re: [PATCH] powerpc: use IRQF_NO_DEBUG for IPIs
From: Michael Ellerman @ 2021-08-18 13:38 UTC (permalink / raw)
  To: linuxppc-dev, Cédric Le Goater; +Cc: Thomas Gleixner
In-Reply-To: <20210719130614.195886-1-clg@kaod.org>

On Mon, 19 Jul 2021 15:06:14 +0200, Cédric Le Goater wrote:
> There is no need to use the lockup detector ("noirqdebug") for IPIs.
> The ipistorm benchmark measures a ~10% improvement on high systems
> when this flag is set.

Applied to powerpc/next.

[1/1] powerpc: use IRQF_NO_DEBUG for IPIs
      https://git.kernel.org/powerpc/c/17df41fec5b80b16ea4774495f1eb730e2225619

cheers

^ permalink raw reply

* Re: [PATCH] powerpc: Remove in_kernel_text()
From: Michael Ellerman @ 2021-08-18 13:38 UTC (permalink / raw)
  To: Christophe Leroy, Benjamin Herrenschmidt, Michael Ellerman,
	Paul Mackerras
  Cc: linuxppc-dev, linux-kernel
In-Reply-To: <2a3a5b6f8cc0ef4e854d7b764f66aa8d2ee270d2.1624813698.git.christophe.leroy@csgroup.eu>

On Sun, 27 Jun 2021 17:09:18 +0000 (UTC), Christophe Leroy wrote:
> Last user of in_kernel_text() stopped using in with
> commit 549e8152de80 ("powerpc: Make the 64-bit kernel as a
> position-independent executable").
> 
> Generic function is_kernel_text() does the same.
> 
> So remote it.

Applied to powerpc/next.

[1/1] powerpc: Remove in_kernel_text()
      https://git.kernel.org/powerpc/c/09ca497528dac12cbbceab8197011c875a96d053

cheers

^ permalink raw reply

* Re: [PATCH] powerpc/configs: Disable legacy ptys on microwatt defconfig
From: Michael Ellerman @ 2021-08-18 13:38 UTC (permalink / raw)
  To: Anton Blanchard, Michael Ellerman, Paul Mackerras, Joel Stanley
  Cc: linuxppc-dev
In-Reply-To: <20210805112005.3cb1f412@kryten.localdomain>

On Thu, 5 Aug 2021 11:20:05 +1000, Anton Blanchard wrote:
> We shouldn't need legacy ptys, and disabling the option improves boot
> time by about 0.5 seconds.

Applied to powerpc/next.

[1/1] powerpc/configs: Disable legacy ptys on microwatt defconfig
      https://git.kernel.org/powerpc/c/9b49f979b3d560cb75ea9f1a596baf432d566798

cheers

^ permalink raw reply

* Re: [PATCH v8 0/5] Add support for FORM2 associativity
From: Michael Ellerman @ 2021-08-18 13:38 UTC (permalink / raw)
  To: linuxppc-dev, mpe, Aneesh Kumar K.V
  Cc: Nathan Lynch, Daniel Henrique Barboza, David Gibson
In-Reply-To: <20210812132223.225214-1-aneesh.kumar@linux.ibm.com>

On Thu, 12 Aug 2021 18:52:18 +0530, Aneesh Kumar K.V wrote:
> Form2 associativity adds a much more flexible NUMA topology layout
> than what is provided by Form1. More details can be found in patch 7.
> 
> $ numactl -H
> ...
> node distances:
> node   0   1   2   3
>   0:  10  11  222  33
>   1:  44  10  55  66
>   2:  77  88  10  99
>   3:  101  121  132  10
> $
> 
> [...]

Applied to powerpc/next.

[1/5] powerpc/pseries: rename min_common_depth to primary_domain_index
      https://git.kernel.org/powerpc/c/7e35ef662ca05c42dbc2f401bb76d9219dd7fd02
[2/5] powerpc/pseries: Rename TYPE1_AFFINITY to FORM1_AFFINITY
      https://git.kernel.org/powerpc/c/0eacd06bb8adea8dd9edb0a30144166d9f227e64
[3/5] powerpc/pseries: Consolidate different NUMA distance update code paths
      https://git.kernel.org/powerpc/c/8ddc6448ec5a5ef50eaa581a7dec0e12a02850ff
[4/5] powerpc/pseries: Add a helper for form1 cpu distance
      https://git.kernel.org/powerpc/c/ef31cb83d19c4c589d650747cd5a7e502be9f665
[5/5] powerpc/pseries: Add support for FORM2 associativity
      https://git.kernel.org/powerpc/c/1c6b5a7e74052768977855f95d6b8812f6e7772c

cheers

^ permalink raw reply

* Re: [PATCH kernel v2] KVM: PPC: Use arch_get_random_seed_long instead of powernv variant
From: Michael Ellerman @ 2021-08-18 13:38 UTC (permalink / raw)
  To: Alexey Kardashevskiy, linuxppc-dev; +Cc: kvm-ppc, kvm
In-Reply-To: <20210805075649.2086567-1-aik@ozlabs.ru>

On Thu, 5 Aug 2021 17:56:49 +1000, Alexey Kardashevskiy wrote:
> The powernv_get_random_long() does not work in nested KVM (which is
> pseries) and produces a crash when accessing in_be64(rng->regs) in
> powernv_get_random_long().
> 
> This replaces powernv_get_random_long with the ppc_md machine hook
> wrapper.

Applied to powerpc/next.

[1/1] KVM: PPC: Use arch_get_random_seed_long instead of powernv variant
      https://git.kernel.org/powerpc/c/2ac78e0c00184a9ba53d507be7549c69a3f566b6

cheers

^ permalink raw reply

* Re: [PATCH] powerpc/non-smp: Inconditionaly call smp_mb() on switch_mm
From: Michael Ellerman @ 2021-08-18 13:38 UTC (permalink / raw)
  To: Christophe Leroy, Benjamin Herrenschmidt, Michael Ellerman,
	Paul Mackerras
  Cc: linuxppc-dev, linux-kernel
In-Reply-To: <e9d501da0c59f60ca767b1b3ea4603fce6d02b9e.1625486440.git.christophe.leroy@csgroup.eu>

On Mon, 5 Jul 2021 12:00:50 +0000 (UTC), Christophe Leroy wrote:
> Commit 3ccfebedd8cf ("powerpc, membarrier: Skip memory barrier in
> switch_mm()") added some logic to skip the smp_mb() in
> switch_mm_irqs_off() before the call to switch_mmu_context().
> 
> However, on non SMP smp_mb() is just a compiler barrier and doing
> it inconditionaly is simpler than the logic used to check
> whether the barrier is needed or not.
> 
> [...]

Applied to powerpc/next.

[1/1] powerpc/non-smp: Inconditionaly call smp_mb() on switch_mm
      https://git.kernel.org/powerpc/c/c8a6d91005343dea0d53be0ff0620c66934dcd44

cheers

^ permalink raw reply

* Re: [PATCH] powerpc: Always inline radix_enabled() to fix build failure
From: Michael Ellerman @ 2021-08-18 13:38 UTC (permalink / raw)
  To: linuxppc-dev, Jordan Niethe; +Cc: erhard_f
In-Reply-To: <20210804013724.514468-1-jniethe5@gmail.com>

On Wed, 4 Aug 2021 11:37:24 +1000, Jordan Niethe wrote:
> This is the same as commit acdad8fb4a15 ("powerpc: Force inlining of
> mmu_has_feature to fix build failure") but for radix_enabled().  The
> config in the linked bugzilla causes the following build failure:
> 
> LD      .tmp_vmlinux.kallsyms1
> powerpc64-linux-ld: arch/powerpc/mm/pgtable.o: in function `.__ptep_set_access_flags':
> pgtable.c:(.text+0x17c): undefined reference to `.radix__ptep_set_access_flags'
...
> 
> [...]

Applied to powerpc/next.

[1/1] powerpc: Always inline radix_enabled() to fix build failure
      https://git.kernel.org/powerpc/c/27fd1111051dc218e5b6cb2da5dbb3f342879ff1

cheers

^ permalink raw reply

* Re: [PATCH v2 00/32] powerpc: Add MSI IRQ domains to PCI drivers
From: Michael Ellerman @ 2021-08-18 13:38 UTC (permalink / raw)
  To: linuxppc-dev, Cédric Le Goater
In-Reply-To: <20210701132750.1475580-1-clg@kaod.org>

On Thu, 1 Jul 2021 15:27:18 +0200, Cédric Le Goater wrote:
> This series adds support for MSI IRQ domains on top of the XICS (P8)
> and XIVE (P9/P10) IRQ domains for the PowerNV (baremetal) and pSeries
> (VM) platforms. It should simplify and improve IRQ affinity of PCI
> MSIs under these PowerPC platforms, specially for drivers distributing
> multiple RX/TX queues on the different CPUs of the system.
> 
> Data locality can still be improved with an interrupt controller node
> per chip but this requires FW changes. It could be done under OPAL.
> 
> [...]

Patches 1-31 applied to powerpc/next.

[01/32] powerpc/pseries/pci: Introduce __find_pe_total_msi()
        https://git.kernel.org/powerpc/c/786e5b102a0007d81579822eac23cb5bfaa0b65f
[02/32] powerpc/pseries/pci: Introduce rtas_prepare_msi_irqs()
        https://git.kernel.org/powerpc/c/e81202007363bd694b711f307f02320b5f98edaa
[03/32] powerpc/xive: Add support for IRQ domain hierarchy
        https://git.kernel.org/powerpc/c/14be098c5387eb93b794f299f3c3e2ddf6038ec7
[04/32] powerpc/xive: Ease debugging of xive_irq_set_affinity()
        https://git.kernel.org/powerpc/c/6c2ab2a5d634d4e30445ee5d52d5d1469bf74aa2
[05/32] powerpc/pseries/pci: Add MSI domains
        https://git.kernel.org/powerpc/c/a5f3d2c17b07e69166b93209f34a5fb8271a6810
[06/32] powerpc/xive: Drop unmask of MSIs at startup
        https://git.kernel.org/powerpc/c/5690bcae186084a8544b1819f0d89399268bd0cf
[07/32] powerpc/xive: Remove irqd_is_started() check when setting the affinity
        https://git.kernel.org/powerpc/c/292145a6e598c1e6633b8f5f607706b46f552ab9
[08/32] powerpc/pseries/pci: Add a domain_free_irqs() handler
        https://git.kernel.org/powerpc/c/07817a578a7a79638537480b8847dc7a12f293c5
[09/32] powerpc/pseries/pci: Add a msi_free() handler to clear XIVE data
        https://git.kernel.org/powerpc/c/9a014f456881e947bf8cdd8c984a207097e6c096
[10/32] powerpc/pseries/pci: Add support of MSI domains to PHB hotplug
        https://git.kernel.org/powerpc/c/174db9e7f775ce06fc6949c9abbe758b3eb8171c
[11/32] powerpc/powernv/pci: Introduce __pnv_pci_ioda_msi_setup()
        https://git.kernel.org/powerpc/c/2c50d7e99e39eba92b93210e740f3f9e5a06ba54
[12/32] powerpc/powernv/pci: Add MSI domains
        https://git.kernel.org/powerpc/c/0fcfe2247e75070361af2b6845030cada92cdbf8
[13/32] KVM: PPC: Book3S HV: Use the new IRQ chip to detect passthrough interrupts
        https://git.kernel.org/powerpc/c/ba418a0278265ad65f2f9544e743b7dbff3b994b
[14/32] KVM: PPC: Book3S HV: XIVE: Change interface of passthrough interrupt routines
        https://git.kernel.org/powerpc/c/e5e78b15113a73d0294141d9796969fa7b10fa3c
[15/32] KVM: PPC: Book3S HV: XIVE: Fix mapping of passthrough interrupts
        https://git.kernel.org/powerpc/c/51be9e51a8000ffc6a33083ceca9da9303ed4dc5
[16/32] powerpc/xics: Remove ICS list
        https://git.kernel.org/powerpc/c/298f6f952885eeb1f25461f085c6c238bcd9fc5e
[17/32] powerpc/xics: Rename the map handler in a check handler
        https://git.kernel.org/powerpc/c/248af248a8f45461662fb633eca4adf24ae704ad
[18/32] powerpc/xics: Give a name to the default XICS IRQ domain
        https://git.kernel.org/powerpc/c/7d14f6c60b76fa7f3f89d81a95385576ca33b483
[19/32] powerpc/xics: Add debug logging to the set_irq_affinity handlers
        https://git.kernel.org/powerpc/c/53b34e8db73af98fa652641bf490384dc665d0f2
[20/32] powerpc/xics: Add support for IRQ domain hierarchy
        https://git.kernel.org/powerpc/c/e4f0aa3b4731430ad73fb4485e97f751c7500668
[21/32] powerpc/powernv/pci: Customize the MSI EOI handler to support PHB3
        https://git.kernel.org/powerpc/c/bbb25af8fbdba4acaf955e412a84eb2eea48697c
[22/32] powerpc/pci: Drop XIVE restriction on MSI domains
        https://git.kernel.org/powerpc/c/679e30b9536eeb93bc8c9a39c0ddc77dec536f6b
[23/32] powerpc/xics: Drop unmask of MSIs at startup
        https://git.kernel.org/powerpc/c/1e661f81a522eadfe4bc5bb1ec9fbae27c13f163
[24/32] powerpc/pseries/pci: Drop unused MSI code
        https://git.kernel.org/powerpc/c/3005123eea0daa18d98602ab64b2ce3ad087d849
[25/32] powerpc/powernv/pci: Drop unused MSI code
        https://git.kernel.org/powerpc/c/6d9ba6121b1cf453985d08c141970a1b44cd9cf1
[26/32] powerpc/powernv/pci: Adapt is_pnv_opal_msi() to detect passthrough interrupt
        https://git.kernel.org/powerpc/c/f1a377f86f51b381cfc30bf2270f8a5f81e35ee9
[27/32] powerpc/xics: Fix IRQ migration
        https://git.kernel.org/powerpc/c/c80198a21792ac59412871e4e6fad5041c9be8e4
[28/32] powerpc/powernv/pci: Set the IRQ chip data for P8/CXL devices
        https://git.kernel.org/powerpc/c/5cd69651ceeed15e021cf7d19f1b1be0a80c0c7a
[29/32] powerpc/powernv/pci: Rework pnv_opal_pci_msi_eoi()
        https://git.kernel.org/powerpc/c/c325712b5f85e561ea89bae2ba5d0104e797e42c
[30/32] KVM: PPC: Book3S HV: XICS: Fix mapping of passthrough interrupts
        https://git.kernel.org/powerpc/c/1753081f2d445f9157550692fcc4221cd3ff0958
[31/32] powerpc/xive: Use XIVE domain under xmon and debugfs
        https://git.kernel.org/powerpc/c/59b2bc18b1492b46d45b6b6828ba098f09b9ba67

cheers

^ permalink raw reply

* Re: [PATCH] powerpc/kexec: fix for_each_child.cocci warning
From: Michael Ellerman @ 2021-08-18 13:38 UTC (permalink / raw)
  To: Julia Lawall, Benjamin Herrenschmidt, Michael Ellerman,
	Paul Mackerras
  Cc: Sumera Priyadarsini, linuxppc-dev, kbuild-all, linux-kernel
In-Reply-To: <alpine.DEB.2.22.394.2108031654080.17639@hadrien>

On Tue, 3 Aug 2021 16:59:55 +0200 (CEST), Julia Lawall wrote:
> for_each_node_by_type should have of_node_put() before return.
> 
> Generated by: scripts/coccinelle/iterators/for_each_child.cocci

Applied to powerpc/next.

[1/1] powerpc/kexec: fix for_each_child.cocci warning
      https://git.kernel.org/powerpc/c/c00103abf76fd3916596afd07dd3fdeee0dca15d

cheers

^ permalink raw reply

* Re: [PATCH v2] ppc64/numa: consider the max numa node for migratable LPAR
From: Michael Ellerman @ 2021-08-18 13:38 UTC (permalink / raw)
  To: paulus, benh, mpe, Laurent Dufour
  Cc: nathanl, linuxppc-dev, linux-kernel, Srikar Dronamraju
In-Reply-To: <20210511073136.17795-1-ldufour@linux.ibm.com>

On Tue, 11 May 2021 09:31:36 +0200, Laurent Dufour wrote:
> When a LPAR is migratable, we should consider the maximum possible NUMA
> node instead the number of NUMA node from the actual system.
> 
> The DT property 'ibm,current-associativity-domains' is defining the maximum
> number of nodes the LPAR can see when running on that box. But if the LPAR
> is being migrated on another box, it may seen up to the nodes defined by
> 'ibm,max-associativity-domains'. So if a LPAR is migratable, that value
> should be used.
> 
> [...]

Applied to powerpc/next.

[1/1] ppc64/numa: consider the max numa node for migratable LPAR
      https://git.kernel.org/powerpc/c/9c7248bb8de31f51c693bfa6a6ea53b1c07e0fa8

cheers

^ permalink raw reply

* Re: [PATCH v5] pseries/drmem: update LMBs after LPM
From: Michael Ellerman @ 2021-08-18 13:38 UTC (permalink / raw)
  To: paulus, benh, mpe, Laurent Dufour
  Cc: Nathan Lynch, Tyrel Datwyler, linuxppc-dev, linux-kernel,
	Aneesh Kumar K . V
In-Reply-To: <20210517090606.56930-1-ldufour@linux.ibm.com>

On Mon, 17 May 2021 11:06:06 +0200, Laurent Dufour wrote:
> After a LPM, the device tree node ibm,dynamic-reconfiguration-memory may be
> updated by the hypervisor in the case the NUMA topology of the LPAR's
> memory is updated.
> 
> This is handled by the kernel, but the memory's node is not updated because
> there is no way to move a memory block between nodes from the Linux kernel
> point of view.
> 
> [...]

Applied to powerpc/next.

[1/1] pseries/drmem: update LMBs after LPM
      https://git.kernel.org/powerpc/c/d144f4d5a8a804133d20ff311d7be70bcdbfaac2

cheers

^ permalink raw reply

* Re: [PATCH v5] pseries: prevent free CPU ids to be reused on another node
From: Michael Ellerman @ 2021-08-18 13:38 UTC (permalink / raw)
  To: paulus, benh, mpe, Laurent Dufour; +Cc: nathanl, linuxppc-dev, linux-kernel
In-Reply-To: <20210429174908.16613-1-ldufour@linux.ibm.com>

On Thu, 29 Apr 2021 19:49:08 +0200, Laurent Dufour wrote:
> When a CPU is hot added, the CPU ids are taken from the available mask from
> the lower possible set. If that set of values was previously used for CPU
> attached to a different node, this seems to application like if these CPUs
> have migrated from a node to another one which is not expected in real
> life.
> 
> To prevent this, it is needed to record the CPU ids used for each node and
> to not reuse them on another node. However, to prevent CPU hot plug to
> fail, in the case the CPU ids is starved on a node, the capability to reuse
> other nodes’ free CPU ids is kept. A warning is displayed in such a case
> to warn the user.
> 
> [...]

Applied to powerpc/next.

[1/1] pseries: prevent free CPU ids to be reused on another node
      https://git.kernel.org/powerpc/c/bd1dd4c5f5286df0148b5b316f37c583b8f55fa1

cheers

^ permalink raw reply

* Re: [PATCH v4 0/5] nvmem: nintendo-otp: Add new driver for the Wii and Wii U OTP
From: Michael Ellerman @ 2021-08-18 13:38 UTC (permalink / raw)
  To: linuxppc-dev, Emmanuel Gil Peyrot, devicetree, Rob Herring
  Cc: linux-kernel, Srinivas Kandagatla, Ash Logan, Paul Mackerras,
	Jonathan Neuschäfer
In-Reply-To: <20210801073822.12452-1-linkmauve@linkmauve.fr>

On Sun, 1 Aug 2021 09:38:17 +0200, Emmanuel Gil Peyrot wrote:
> The OTP is a read-only memory area which contains various keys and
> signatures used to decrypt, encrypt or verify various pieces of storage.
> 
> Its size depends on the console, it is 128 bytes on the Wii and
> 1024 bytes on the Wii U (split into eight 128 bytes banks).
> 
> It can be used directly by writing into one register and reading from
> the other one, without any additional synchronisation.
> 
> [...]

Patches 3-5 applied to powerpc/next.

[3/5] powerpc: wii.dts: Reduce the size of the control area
      https://git.kernel.org/powerpc/c/b11748e693166679acc13c8a4328a71efe1d4a89
[4/5] powerpc: wii.dts: Expose the OTP on this platform
      https://git.kernel.org/powerpc/c/562a610b4c5119034aed300f6ae212ec7a20c4b4
[5/5] powerpc: wii_defconfig: Enable OTP by default
      https://git.kernel.org/powerpc/c/140a89b7bfe65e9649c4a3678f74c32556834ec1

cheers

^ permalink raw reply

* Re: [PATCH 1/3] powerpc: remove unused zInstall target from arch/powerpc/boot/Makefile
From: Michael Ellerman @ 2021-08-18 13:38 UTC (permalink / raw)
  To: Masahiro Yamada, Michael Ellerman, Paul Mackerras, linuxppc-dev,
	Benjamin Herrenschmidt
  Cc: Jordan Niethe, Nick Desaulniers, Gustavo A. R. Silva,
	Nicholas Piggin, linux-kernel, Bill Wendling, Joel Stanley
In-Reply-To: <20210729141937.445051-1-masahiroy@kernel.org>

On Thu, 29 Jul 2021 23:19:35 +0900, Masahiro Yamada wrote:
> Commit c913e5f95e54 ("powerpc/boot: Don't install zImage.* from make
> install") added the zInstall target to arch/powerpc/boot/Makefile,
> but you cannot use it since the corresponding hook is missing in
> arch/powerpc/Makefile.
> 
> It has never worked since its addition. Nobody has complained about
> it for 7 years, which means this code was unneeded.
> 
> [...]

Applied to powerpc/next.

[1/3] powerpc: remove unused zInstall target from arch/powerpc/boot/Makefile
      https://git.kernel.org/powerpc/c/156ca4e650bfb9a4259b427069caa11b5a4df3d4
[2/3] powerpc: make the install target not depend on any build artifact
      https://git.kernel.org/powerpc/c/9bef456b20581e630ef9a13555ca04fed65a859d
[3/3] powerpc: move the install rule to arch/powerpc/Makefile
      https://git.kernel.org/powerpc/c/86ff0bce2e9665c8b074930fe6caed615da070c1

cheers

^ permalink raw reply

* Re: [PATCHv2 0/3] Subject: [PATCHv2 0/3] Make cache-object aware of L3 siblings by parsing "ibm, thread-groups" property
From: Michael Ellerman @ 2021-08-18 13:38 UTC (permalink / raw)
  To: linuxppc-dev, Parth Shah; +Cc: parths1229, mikey, svaidy, srikar, ego
In-Reply-To: <20210728175607.591679-1-parth@linux.ibm.com>

On Wed, 28 Jul 2021 23:26:04 +0530, Parth Shah wrote:
> Changes from v1 -> v2:
> - Based on Gautham's comments, use a separate thread_group_l3_cache_map
>   and modify parsing code to build cache_map for L3. This makes the
>   cache_map building code isolated from the parsing code.
> v1 can be found at:
> https://lists.ozlabs.org/pipermail/linuxppc-dev/2021-June/230680.html
> 
> [...]

Applied to powerpc/next.

[1/3] powerpc/cacheinfo: Lookup cache by dt node and thread-group id
      https://git.kernel.org/powerpc/c/a4bec516b9c0823d7e2bb8c8928c98b535cf9adf
[2/3] powerpc/cacheinfo: Remove the redundant get_shared_cpu_map()
      https://git.kernel.org/powerpc/c/69aa8e078545bc14d84a8b4b3cb914ac8f9f280e
[3/3] powerpc/smp: Use existing L2 cache_map cpumask to find L3 cache siblings
      https://git.kernel.org/powerpc/c/e9ef81e1079b0c4c374fba0f9affa7129c7c913b

cheers

^ permalink raw reply

* Re: [PATCH] cpuidle: pseries: Mark pseries_idle_proble() as __init
From: Michael Ellerman @ 2021-08-18 13:38 UTC (permalink / raw)
  To: Michael Ellerman, Nathan Chancellor
  Cc: Gautham R. Shenoy, linux-pm, Nick Desaulniers, linux-kernel,
	clang-built-linux, Paul Mackerras, linuxppc-dev
In-Reply-To: <20210803211547.1093820-1-nathan@kernel.org>

On Tue, 3 Aug 2021 14:15:47 -0700, Nathan Chancellor wrote:
> After commit 7cbd631d4dec ("cpuidle: pseries: Fixup CEDE0 latency only
> for POWER10 onwards"), pseries_idle_probe() is no longer inlined when
> compiling with clang, which causes a modpost warning:
> 
> WARNING: modpost: vmlinux.o(.text+0xc86a54): Section mismatch in
> reference from the function pseries_idle_probe() to the function
> .init.text:fixup_cede0_latency()
> The function pseries_idle_probe() references
> the function __init fixup_cede0_latency().
> This is often because pseries_idle_probe lacks a __init
> annotation or the annotation of fixup_cede0_latency is wrong.
> 
> [...]

Applied to powerpc/next.

[1/1] cpuidle: pseries: Mark pseries_idle_proble() as __init
      https://git.kernel.org/powerpc/c/d04691d373e75c83424b85c0e68e4a3f9370c10d

cheers

^ permalink raw reply

* Re: [PATCH] powerpc/64s/perf: Always use SIAR for kernel interrupts
From: Michael Ellerman @ 2021-08-18 13:38 UTC (permalink / raw)
  To: linuxppc-dev, Nicholas Piggin; +Cc: Athira Rajeev, Madhavan Srinivasan
In-Reply-To: <20210720141504.420110-1-npiggin@gmail.com>

On Wed, 21 Jul 2021 00:15:04 +1000, Nicholas Piggin wrote:
> If an interrupt is taken in kernel mode, always use SIAR for it rather than
> looking at regs_sipr. This prevents samples piling up around interrupt
> enable (hard enable or interrupt replay via soft enable) in PMUs / modes
> where the PR sample indication is not in synch with SIAR.
> 
> This results in better sampling of interrupt entry and exit in particular.

Applied to powerpc/next.

[1/1] powerpc/64s/perf: Always use SIAR for kernel interrupts
      https://git.kernel.org/powerpc/c/cf9c615cde49fb5d2480549c8c955a0a387798d3

cheers

^ permalink raw reply

* Re: [PATCH v2 0/1] cpufreq:powernv: Fix init_chip_info initialization in numa=off
From: Michael Ellerman @ 2021-08-18 13:38 UTC (permalink / raw)
  To: pratik.r.sampat, rjw, Pratik R. Sampat, linux-kernel, linux-pm,
	linuxppc-dev, stable, mpe
In-Reply-To: <20210728120500.87549-1-psampat@linux.ibm.com>

On Wed, 28 Jul 2021 17:34:59 +0530, Pratik R. Sampat wrote:
> v1: https://lkml.org/lkml/2021/7/26/1509
> Changelog v1-->v2:
> Based on comments from Gautham,
> 1. Included a #define for MAX_NR_CHIPS instead of hardcoding the
> allocation.
> 
> Pratik R. Sampat (1):
>   cpufreq:powernv: Fix init_chip_info initialization in numa=off
> 
> [...]

Applied to powerpc/next.

[1/1] cpufreq:powernv: Fix init_chip_info initialization in numa=off
      https://git.kernel.org/powerpc/c/f34ee9cb2c5ac5af426fee6fa4591a34d187e696

cheers

^ permalink raw reply

* Re: [PATCH 3/3] powerpc: move the install rule to arch/powerpc/Makefile
From: Masahiro Yamada @ 2021-08-18 13:58 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Linux Kernel Mailing List, Nicholas Piggin, Gustavo A. R. Silva,
	Jordan Niethe, Paul Mackerras, Bill Wendling, Miguel Ojeda,
	linuxppc-dev, Joel Stanley
In-Reply-To: <CAKwvOdkRuxaUvAi4ik2SiDgEeNOX6D76aBtHDBPyDVTumWskLg@mail.gmail.com>

On Sat, Jul 31, 2021 at 5:30 AM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> On Thu, Jul 29, 2021 at 7:22 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
> >
> > Currently, the install target in arch/powerpc/Makefile descends into
> > arch/powerpc/boot/Makefile to invoke the shell script, but there is no
> > good reason to do so.
>
> Sure, but there are more arch/ subdirs that DO invoke install.sh from
> arch/<arch>/boot/Makefile than, not:
>
> arch/<arch>/boot/Makefile:
> - parisc
> - nios2
> - arm
> - nds32
> - sparc
> - riscv
> - 390
> - ppc (this patch)
> - x86
> - arm64

I sent patches for these architectures.

Check LKML.






> arch/<arch>/Makefile:
> - ia64
> - m68k
>
> Patch is fine, but right now the tree is a bit inconsistent.
>
> >
> > arch/powerpc/Makefile can run the shell script directly.
> >
> > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> > ---
> >
> >  arch/powerpc/Makefile      | 3 ++-
> >  arch/powerpc/boot/Makefile | 6 ------
> >  2 files changed, 2 insertions(+), 7 deletions(-)
> >
> > diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
> > index 6505d66f1193..9aaf1abbc641 100644
> > --- a/arch/powerpc/Makefile
> > +++ b/arch/powerpc/Makefile
> > @@ -407,7 +407,8 @@ endef
> >
> >  PHONY += install
> >  install:
> > -       $(Q)$(MAKE) $(build)=$(boot) install
> > +       sh -x $(srctree)/$(boot)/install.sh "$(KERNELRELEASE)" vmlinux \
> > +       System.map "$(INSTALL_PATH)"
> >
> >  archclean:
> >         $(Q)$(MAKE) $(clean)=$(boot)
> > diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
> > index 0d165bd98b61..10c0fb306f15 100644
> > --- a/arch/powerpc/boot/Makefile
> > +++ b/arch/powerpc/boot/Makefile
> > @@ -444,12 +444,6 @@ $(obj)/zImage:             $(addprefix $(obj)/, $(image-y))
> >  $(obj)/zImage.initrd:  $(addprefix $(obj)/, $(initrd-y))
> >         $(Q)rm -f $@; ln $< $@
> >
> > -# Only install the vmlinux
> > -install:
> > -       sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)"
> > -
> > -PHONY += install
> > -
> >  # anything not in $(targets)
> >  clean-files += $(image-) $(initrd-) cuImage.* dtbImage.* treeImage.* \
> >         zImage zImage.initrd zImage.chrp zImage.coff zImage.holly \
> > --
> > 2.27.0
> >
>
>
> --
> Thanks,
> ~Nick Desaulniers



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply

* Re: [PATCH v2] powerpc/mm: Fix set_memory_*() against concurrent accesses
From: Murilo Opsfelder Araújo @ 2021-08-18 14:29 UTC (permalink / raw)
  To: Michael Ellerman, linuxppc-dev
  Cc: lvivier, jniethe5, aneesh.kumar, npiggin, farosas
In-Reply-To: <20210818120518.3603172-1-mpe@ellerman.id.au>

On 8/18/21 9:05 AM, Michael Ellerman wrote:
> Laurent reported that STRICT_MODULE_RWX was causing intermittent crashes
> on one of his systems:
> 
>    kernel tried to execute exec-protected page (c008000004073278) - exploit attempt? (uid: 0)
>    BUG: Unable to handle kernel instruction fetch
>    Faulting instruction address: 0xc008000004073278
>    Oops: Kernel access of bad area, sig: 11 [#1]
>    LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA pSeries
>    Modules linked in: drm virtio_console fuse drm_panel_orientation_quirks ...
>    CPU: 3 PID: 44 Comm: kworker/3:1 Not tainted 5.14.0-rc4+ #12
>    Workqueue: events control_work_handler [virtio_console]
>    NIP:  c008000004073278 LR: c008000004073278 CTR: c0000000001e9de0
>    REGS: c00000002e4ef7e0 TRAP: 0400   Not tainted  (5.14.0-rc4+)
>    MSR:  800000004280b033 <SF,VEC,VSX,EE,FP,ME,IR,DR,RI,LE>  CR: 24002822 XER: 200400cf
>    ...
>    NIP fill_queue+0xf0/0x210 [virtio_console]
>    LR  fill_queue+0xf0/0x210 [virtio_console]
>    Call Trace:
>      fill_queue+0xb4/0x210 [virtio_console] (unreliable)
>      add_port+0x1a8/0x470 [virtio_console]
>      control_work_handler+0xbc/0x1e8 [virtio_console]
>      process_one_work+0x290/0x590
>      worker_thread+0x88/0x620
>      kthread+0x194/0x1a0
>      ret_from_kernel_thread+0x5c/0x64
> 
> Jordan, Fabiano & Murilo were able to reproduce and identify that the
> problem is caused by the call to module_enable_ro() in do_init_module(),
> which happens after the module's init function has already been called.
> 
> Our current implementation of change_page_attr() is not safe against
> concurrent accesses, because it invalidates the PTE before flushing the
> TLB and then installing the new PTE. That leaves a window in time where
> there is no valid PTE for the page, if another CPU tries to access the
> page at that time we see something like the fault above.
> 
> We can't simply switch to set_pte_at()/flush TLB, because our hash MMU
> code doesn't handle a set_pte_at() of a valid PTE. See [1].
> 
> But we do have pte_update(), which replaces the old PTE with the new,
> meaning there's no window where the PTE is invalid. And the hash MMU
> version hash__pte_update() deals with synchronising the hash page table
> correctly.
> 
> [1]: https://lore.kernel.org/linuxppc-dev/87y318wp9r.fsf@linux.ibm.com/
> 
> Fixes: 1f9ad21c3b38 ("powerpc/mm: Implement set_memory() routines")
> Reported-by: Laurent Vivier <lvivier@redhat.com>
> Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

Reviewed-by: Murilo Opsfelder Araújo <muriloo@linux.ibm.com>

> ---
>   arch/powerpc/mm/pageattr.c | 23 ++++++++++-------------
>   1 file changed, 10 insertions(+), 13 deletions(-)
> 
> v2: Use pte_update(..., ~0, pte_val(pte), ...) as suggested by Fabiano,
>      and ptep_get() as suggested by Christophe.
> 
> diff --git a/arch/powerpc/mm/pageattr.c b/arch/powerpc/mm/pageattr.c
> index 0876216ceee6..edea388e9d3f 100644
> --- a/arch/powerpc/mm/pageattr.c
> +++ b/arch/powerpc/mm/pageattr.c
> @@ -18,16 +18,12 @@
>   /*
>    * Updates the attributes of a page in three steps:
>    *
> - * 1. invalidate the page table entry
> - * 2. flush the TLB
> - * 3. install the new entry with the updated attributes
> - *
> - * Invalidating the pte means there are situations where this will not work
> - * when in theory it should.
> - * For example:
> - * - removing write from page whilst it is being executed
> - * - setting a page read-only whilst it is being read by another CPU
> + * 1. take the page_table_lock
> + * 2. install the new entry with the updated attributes
> + * 3. flush the TLB
>    *
> + * This sequence is safe against concurrent updates, and also allows updating the
> + * attributes of a page currently being executed or accessed.
>    */
>   static int change_page_attr(pte_t *ptep, unsigned long addr, void *data)
>   {
> @@ -36,9 +32,7 @@ static int change_page_attr(pte_t *ptep, unsigned long addr, void *data)
>   
>   	spin_lock(&init_mm.page_table_lock);
>   
> -	/* invalidate the PTE so it's safe to modify */
> -	pte = ptep_get_and_clear(&init_mm, addr, ptep);
> -	flush_tlb_kernel_range(addr, addr + PAGE_SIZE);
> +	pte = ptep_get(ptep);
>   
>   	/* modify the PTE bits as desired, then apply */
>   	switch (action) {
> @@ -59,11 +53,14 @@ static int change_page_attr(pte_t *ptep, unsigned long addr, void *data)
>   		break;
>   	}
>   
> -	set_pte_at(&init_mm, addr, ptep, pte);
> +	pte_update(&init_mm, addr, ptep, ~0UL, pte_val(pte), 0);
>   
>   	/* See ptesync comment in radix__set_pte_at() */
>   	if (radix_enabled())
>   		asm volatile("ptesync": : :"memory");
> +
> +	flush_tlb_kernel_range(addr, addr + PAGE_SIZE);
> +
>   	spin_unlock(&init_mm.page_table_lock);
>   
>   	return 0;
> 
> base-commit: cbc06f051c524dcfe52ef0d1f30647828e226d30
> 


-- 
Murilo

^ permalink raw reply

* Re: [PATCH v2 1/2] powerpc/bug: Remove specific powerpc BUG_ON() and WARN_ON() on PPC32
From: Segher Boessenkool @ 2021-08-18 15:06 UTC (permalink / raw)
  To: Nicholas Piggin; +Cc: linux-kernel, Paul Mackerras, linuxppc-dev
In-Reply-To: <1628834356.pr4zgn1xf1.astroid@bobo.none>

On Fri, Aug 13, 2021 at 04:08:13PM +1000, Nicholas Piggin wrote:
> This one possibly the branches end up in predictors, whereas conditional 
> trap is always just speculated not to hit. Branches may also have a
> throughput limit on execution whereas trap could be more (1 per cycle
> vs 4 per cycle on POWER9).

I thought only *taken* branches are just one per cycle?  And those
branches are only taken for the exceptional condition (or the case where
we do not care about performance, anyway, if we do have an error most of
the time ;-) )

> On typical ppc32 CPUs, maybe it's a more obvious win. As you say there
> is the CFAR issue as well which makes it a problem for 64s. It would
> have been nice if it could use the same code though.

On 64-bit the code looks better for the no-error path as well.

> Maybe one day gcc's __builtin_trap() will become smart enough around
> conditional statements that it it generates better code and tries to
> avoid branches.

Internally *all* traps are conditional, in GCC.  It also can optimise
them quite well.  There must be something in the kernel macros that
prevents good optimisation.


Segher

^ permalink raw reply

* [PATCH 1/1] selftests/powerpc: Add memmove_64 test
From: Ritesh Harjani @ 2021-08-18 15:50 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Aneesh Kumar K . V, Ritesh Harjani, Vaibhav Jain

While debugging an issue, we wanted to check whether the arch specific
kernel memmove implementation is correct. This selftest could help test that.

Suggested-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Suggested-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com>
---
 tools/testing/selftests/powerpc/Makefile      |  1 +
 .../selftests/powerpc/memmoveloop/.gitignore  |  2 +
 .../selftests/powerpc/memmoveloop/Makefile    | 19 +++++++
 .../powerpc/memmoveloop/asm/asm-compat.h      |  0
 .../powerpc/memmoveloop/asm/export.h          |  4 ++
 .../powerpc/memmoveloop/asm/feature-fixups.h  |  0
 .../selftests/powerpc/memmoveloop/asm/kasan.h |  0
 .../powerpc/memmoveloop/asm/ppc_asm.h         | 39 +++++++++++++
 .../powerpc/memmoveloop/asm/processor.h       |  0
 .../selftests/powerpc/memmoveloop/mem_64.S    |  1 +
 .../selftests/powerpc/memmoveloop/memcpy_64.S |  1 +
 .../selftests/powerpc/memmoveloop/stubs.S     |  8 +++
 .../selftests/powerpc/memmoveloop/validate.c  | 56 +++++++++++++++++++
 13 files changed, 131 insertions(+)
 create mode 100644 tools/testing/selftests/powerpc/memmoveloop/.gitignore
 create mode 100644 tools/testing/selftests/powerpc/memmoveloop/Makefile
 create mode 100644 tools/testing/selftests/powerpc/memmoveloop/asm/asm-compat.h
 create mode 100644 tools/testing/selftests/powerpc/memmoveloop/asm/export.h
 create mode 100644 tools/testing/selftests/powerpc/memmoveloop/asm/feature-fixups.h
 create mode 100644 tools/testing/selftests/powerpc/memmoveloop/asm/kasan.h
 create mode 100644 tools/testing/selftests/powerpc/memmoveloop/asm/ppc_asm.h
 create mode 100644 tools/testing/selftests/powerpc/memmoveloop/asm/processor.h
 create mode 120000 tools/testing/selftests/powerpc/memmoveloop/mem_64.S
 create mode 120000 tools/testing/selftests/powerpc/memmoveloop/memcpy_64.S
 create mode 100644 tools/testing/selftests/powerpc/memmoveloop/stubs.S
 create mode 100644 tools/testing/selftests/powerpc/memmoveloop/validate.c

diff --git a/tools/testing/selftests/powerpc/Makefile b/tools/testing/selftests/powerpc/Makefile
index 0830e63818c1..d110b3e5cbcd 100644
--- a/tools/testing/selftests/powerpc/Makefile
+++ b/tools/testing/selftests/powerpc/Makefile
@@ -16,6 +16,7 @@ export CFLAGS
 SUB_DIRS = alignment		\
 	   benchmarks		\
 	   cache_shape		\
+	   memmoveloop		\
 	   copyloops		\
 	   dscr			\
 	   mm			\
diff --git a/tools/testing/selftests/powerpc/memmoveloop/.gitignore b/tools/testing/selftests/powerpc/memmoveloop/.gitignore
new file mode 100644
index 000000000000..56c1426013d5
--- /dev/null
+++ b/tools/testing/selftests/powerpc/memmoveloop/.gitignore
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
+memmove_64
diff --git a/tools/testing/selftests/powerpc/memmoveloop/Makefile b/tools/testing/selftests/powerpc/memmoveloop/Makefile
new file mode 100644
index 000000000000..d58d8c100099
--- /dev/null
+++ b/tools/testing/selftests/powerpc/memmoveloop/Makefile
@@ -0,0 +1,19 @@
+# SPDX-License-Identifier: GPL-2.0
+CFLAGS += -m64
+CFLAGS += -I$(CURDIR)
+CFLAGS += -D SELFTEST
+CFLAGS += -maltivec
+
+ASFLAGS = $(CFLAGS) -Wa,-mpower4
+
+TEST_GEN_PROGS := memmove_64
+EXTRA_SOURCES := validate.c ../harness.c stubs.S
+CPPFLAGS += -D TEST_MEMMOVE=test_memmove
+
+top_srcdir = ../../../../..
+include ../../lib.mk
+
+$(OUTPUT)/memmove_64: mem_64.S memcpy_64.S $(EXTRA_SOURCES)
+	$(CC) $(CPPFLAGS) $(CFLAGS) \
+		-D TEST_MEMMOVE=test_memmove \
+		-o $@ $^
diff --git a/tools/testing/selftests/powerpc/memmoveloop/asm/asm-compat.h b/tools/testing/selftests/powerpc/memmoveloop/asm/asm-compat.h
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/tools/testing/selftests/powerpc/memmoveloop/asm/export.h b/tools/testing/selftests/powerpc/memmoveloop/asm/export.h
new file mode 100644
index 000000000000..e6b80d5fbd14
--- /dev/null
+++ b/tools/testing/selftests/powerpc/memmoveloop/asm/export.h
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#define EXPORT_SYMBOL(x)
+#define EXPORT_SYMBOL_GPL(x)
+#define EXPORT_SYMBOL_KASAN(x)
diff --git a/tools/testing/selftests/powerpc/memmoveloop/asm/feature-fixups.h b/tools/testing/selftests/powerpc/memmoveloop/asm/feature-fixups.h
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/tools/testing/selftests/powerpc/memmoveloop/asm/kasan.h b/tools/testing/selftests/powerpc/memmoveloop/asm/kasan.h
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/tools/testing/selftests/powerpc/memmoveloop/asm/ppc_asm.h b/tools/testing/selftests/powerpc/memmoveloop/asm/ppc_asm.h
new file mode 100644
index 000000000000..117005c56e19
--- /dev/null
+++ b/tools/testing/selftests/powerpc/memmoveloop/asm/ppc_asm.h
@@ -0,0 +1,39 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __SELFTESTS_POWERPC_PPC_ASM_H
+#define __SELFTESTS_POWERPC_PPC_ASM_H
+#include <ppc-asm.h>
+
+#define CONFIG_ALTIVEC
+
+#define r1	1
+
+#define R14 r14
+#define R15 r15
+#define R16 r16
+#define R17 r17
+#define R18 r18
+#define R19 r19
+#define R20 r20
+#define R21 r21
+#define R22 r22
+#define R29 r29
+#define R30 r30
+#define R31 r31
+
+#define STACKFRAMESIZE	256
+#define STK_REG(i)	(112 + ((i)-14)*8)
+
+#define _GLOBAL(A) FUNC_START(test_ ## A)
+#define _GLOBAL_TOC(A) _GLOBAL(A)
+#define _GLOBAL_TOC_KASAN(A) _GLOBAL(A)
+#define _GLOBAL_KASAN(A) _GLOBAL(A)
+
+#define PPC_MTOCRF(A, B)	mtocrf A, B
+
+#define BEGIN_FTR_SECTION
+#define FTR_SECTION_ELSE
+#define ALT_FTR_SECTION_END_IFCLR(x)
+#define ALT_FTR_SECTION_END(x, y)
+#define END_FTR_SECTION_IFCLR(x)
+
+#endif /* __SELFTESTS_POWERPC_PPC_ASM_H */
diff --git a/tools/testing/selftests/powerpc/memmoveloop/asm/processor.h b/tools/testing/selftests/powerpc/memmoveloop/asm/processor.h
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/tools/testing/selftests/powerpc/memmoveloop/mem_64.S b/tools/testing/selftests/powerpc/memmoveloop/mem_64.S
new file mode 120000
index 000000000000..db254c9a5f5c
--- /dev/null
+++ b/tools/testing/selftests/powerpc/memmoveloop/mem_64.S
@@ -0,0 +1 @@
+../../../../../arch/powerpc/lib/mem_64.S
\ No newline at end of file
diff --git a/tools/testing/selftests/powerpc/memmoveloop/memcpy_64.S b/tools/testing/selftests/powerpc/memmoveloop/memcpy_64.S
new file mode 120000
index 000000000000..cce33fb6f9d8
--- /dev/null
+++ b/tools/testing/selftests/powerpc/memmoveloop/memcpy_64.S
@@ -0,0 +1 @@
+../../../../../arch/powerpc/lib/memcpy_64.S
\ No newline at end of file
diff --git a/tools/testing/selftests/powerpc/memmoveloop/stubs.S b/tools/testing/selftests/powerpc/memmoveloop/stubs.S
new file mode 100644
index 000000000000..d9baa832fa49
--- /dev/null
+++ b/tools/testing/selftests/powerpc/memmoveloop/stubs.S
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#include <asm/ppc_asm.h>
+
+FUNC_START(memcpy)
+	b test_memcpy
+
+FUNC_START(backwards_memcpy)
+	b test_backwards_memcpy
diff --git a/tools/testing/selftests/powerpc/memmoveloop/validate.c b/tools/testing/selftests/powerpc/memmoveloop/validate.c
new file mode 100644
index 000000000000..52f7d32bb3fe
--- /dev/null
+++ b/tools/testing/selftests/powerpc/memmoveloop/validate.c
@@ -0,0 +1,56 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <malloc.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include "utils.h"
+
+void *TEST_MEMMOVE(const void *s1, const void *s2, size_t n);
+
+#define BUF_LEN 65536
+#define MAX_OFFSET 512
+
+size_t max(size_t a, size_t b)
+{
+	if (a >= b) return a;
+	return b;
+}
+
+static int testcase_run(void)
+{
+	size_t i, src_off, dst_off, len;
+
+	char *usermap = memalign(BUF_LEN, BUF_LEN);
+	char *kernelmap = memalign(BUF_LEN, BUF_LEN);
+
+	assert(usermap != NULL);
+	assert(kernelmap != NULL);
+
+	memset(usermap, 0, BUF_LEN);
+	memset(kernelmap, 0, BUF_LEN);
+
+	for (i = 0; i < BUF_LEN; i++) {
+		usermap[i] = i & 0xff;
+		kernelmap[i] = i & 0xff;
+	}
+
+	for (src_off = 0; src_off < MAX_OFFSET; src_off++) {
+		for (dst_off = 0; dst_off < MAX_OFFSET; dst_off++) {
+			for (len = 1; len < MAX_OFFSET - max(src_off, dst_off); len++) {
+
+				memmove(usermap + dst_off, usermap + src_off, len);
+				TEST_MEMMOVE(kernelmap + dst_off, kernelmap + src_off, len);
+				if (memcmp(usermap, kernelmap, MAX_OFFSET) != 0) {
+					printf("memmove failed at %ld %ld %ld\n", src_off, dst_off, len);
+					abort();
+				}
+			}
+		}
+	}
+	return 0;
+}
+
+int main(void)
+{
+	return test_harness(testcase_run, "memmove");
+}
--
2.31.1


^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox