linux/arch/powerpc
Michael Ellerman ae619de500 powerpc/atomic: Use YZ constraints for DS-form instructions
commit 39190ac7cf upstream.

The 'ld' and 'std' instructions require a 4-byte aligned displacement
because they are DS-form instructions. But the "m" asm constraint
doesn't enforce that.

That can lead to build errors if the compiler chooses a non-aligned
displacement, as seen with GCC 14:

  /tmp/ccuSzwiR.s: Assembler messages:
  /tmp/ccuSzwiR.s:2579: Error: operand out of domain (39 is not a multiple of 4)
  make[5]: *** [scripts/Makefile.build:229: net/core/page_pool.o] Error 1

Dumping the generated assembler shows:

  ld 8,39(8)       # MEM[(const struct atomic64_t *)_29].counter, t

Use the YZ constraints to tell the compiler either to generate a DS-form
displacement, or use an X-form instruction, either of which prevents the
build error.

See commit 2d43cc701b ("powerpc/uaccess: Fix build errors seen with
GCC 13/14") for more details on the constraint letters.

Fixes: 9f0cbea0d8 ("[POWERPC] Implement atomic{, 64}_{read, write}() without volatile")
Cc: stable@vger.kernel.org # v2.6.24+
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Closes: https://lore.kernel.org/all/20240913125302.0a06b4c7@canb.auug.org.au
Tested-by: Mina Almasry <almasrymina@google.com>
Reviewed-by: Segher Boessenkool <segher@kernel.crashing.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20240916120510.2017749-1-mpe@ellerman.id.au
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2024-10-04 16:29:48 +02:00
..
boot powerpc/boot: Only free if realloc() succeeds 2024-08-29 17:33:36 +02:00
configs powerpc/configs: Update defconfig with now user-visible CONFIG_FSL_IFC 2024-08-03 08:53:19 +02:00
crypto crypto: powerpc/p10-aes-gcm - Disable CRYPTO_AES_GCM_P10 2024-10-04 16:29:35 +02:00
include powerpc/atomic: Use YZ constraints for DS-form instructions 2024-10-04 16:29:48 +02:00
kernel powerpc/vdso: Inconditionally use CFUNC macro 2024-10-04 16:29:11 +02:00
kexec powerpc/pseries: Fix scv instruction crash with kexec 2024-07-11 12:49:17 +02:00
kvm powerpc: fix a file leak in kvm_vcpu_ioctl_enable_cap() 2024-08-03 08:54:38 +02:00
lib powerpc/qspinlock: Fix deadlock in MCS queue 2024-09-12 11:11:25 +02:00
math-emu powerpc/math-emu: Inhibit W=1 warnings 2022-09-08 11:11:18 +10:00
mm powerpc/8xx: Fix initial memory mapping 2024-10-04 16:29:10 +02:00
net Revert "powerpc/bpf: rename powerpc64_jit_data to powerpc_jit_data" 2024-07-09 11:44:29 +02:00
perf powerpc/hv-gpci: Fix the H_GET_PERF_COUNTER_INFO hcall return value checks 2024-03-26 18:19:54 -04:00
platforms Revert "change alloc_pages name in dma_map_ops to avoid name conflicts" 2024-09-04 13:28:24 +02:00
purgatory powerpc/purgatory: remove PGO flags 2023-06-12 11:31:50 -07:00
sysdev powerpc/xics: Check return value of kasprintf in icp_native_map_one_cpu 2024-08-29 17:33:30 +02:00
tools powerpc/ftrace: Add support for -fpatchable-function-entry 2023-08-22 00:09:06 +10:00
xmon powerpc/xmon: Fix disassembly CPU feature checks 2024-08-03 08:54:02 +02:00
Kbuild kbuild: use more subdir- for visiting subdirectories while cleaning 2021-10-24 13:49:46 +09:00
Kconfig powerpc/64s: Increase default stack size to 32KB 2024-01-25 15:35:42 -08:00
Kconfig.debug powerpc: allow PPC_EARLY_DEBUG_CPM only when SERIAL_CPM=y 2023-07-03 16:07:55 +10:00
Makefile powerpc/64s: Move CPU -mtune options into Kconfig 2023-08-25 08:39:29 +10:00
Makefile.postlink kbuild: remove --include-dir MAKEFLAG from top Makefile 2023-02-05 18:51:22 +09:00