mirror-linux/arch/s390/kernel
Alexandra Winter 540f4a4f6e s390/topology: Use zero-based numbering for containing entities
Start the numbering scheme for higher-level topology structures (like
socket, book, drawer) at zero, matching the convention for other hardware
identifiers like e.g. CPU numbers.

Hardware documentation, the Hardware Management Console and other tools
like zmemtopo also use zero-based numbering for these containing entities.
Aligning the numbering in sysfs, procfs, and tools like lscpu improves
user experience by making it easier to correlate topology information
across different interfaces.

If available, Linux on s390 derives this physical topology information from
the stsi function code 15 store_topology instruction, which is defined to
start at 1 for the lowest numbered container id. Subtract one, so
drawer_id, book_id and socket_id in cpu_topology[] start with 0 for the
lowest numbered entity; and /proc/cpuinfo and tools like 'lscpu -ye'
display the expected values.

Display only, no functional change intended.

Example: In a partition with 3 cores in a system with
8 cores per socket; 2 sockets per book; 4 books per dawer; and 4 drawers:
Before this fix:
$ lscpu -ye
CPU NODE DRAWER BOOK SOCKET CORE L1d:L1i:L2 ONLINE CONFIGURED POLARIZATION ADDRESS
  0    0      2    4      1    0 0:0:0         yes yes        vert-high    0
  1    0      2    4      1    0 1:1:1         yes yes        vert-high    1
  2    0      2    4      1    1 2:2:2         yes yes        vert-medium  2
  3    0      2    4      1    1 3:3:3         yes yes        vert-medium  3
  4    0      2    4      2    3 4:4:4         yes yes        vert-low     4
  5    0      2    4      2    3 5:5:5         yes yes        vert-low     5
After this fix:
$ lscpu -ye
CPU NODE DRAWER BOOK SOCKET CORE L1d:L1i:L2 ONLINE CONFIGURED POLARIZATION ADDRESS
  0    0      1    3      0    0 0:0:0         yes yes        vert-high    0
  1    0      1    3      0    0 1:1:1         yes yes        vert-high    1
  2    0      1    3      0    1 2:2:2         yes yes        vert-medium  2
  3    0      1    3      0    1 3:3:3         yes yes        vert-medium  3
  4    0      1    3      1    3 4:4:4         yes yes        vert-low     4
  5    0      1    3      1    3 5:5:5         yes yes        vert-low     5

For KVM guests, qemu emulates the stsi FC15 store_topology instruction.
This emulation currently erroneously starts id numbering at 0. A qemu fix
is proposed that makes this emulation compliant to the stsi architecture.
In case a guest with this patch is running on a qemu without the other fix,
it can happen that ids of 255 are displayed erroneously.

z/VM currently does not provide or emulate physical topology information to
its guests. So this patch does not change anything for z/VM guests.

Fixes: 10d3858950 ("[S390] topology: expose core identifier")
Signed-off-by: Alexandra Winter <wintera@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Acked-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Acked-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
2026-05-20 09:39:24 +02:00
..
diag s390: Remove superfluous newlines from inline assemblies 2025-09-29 13:52:08 +02:00
syscalls rseq: Implement sys_rseq_slice_yield() 2026-01-22 11:11:17 +01:00
vdso Updates for the VDSO subsystem: 2026-02-10 17:02:23 -08:00
.gitignore
Makefile integrity-v7.1 2026-04-17 15:42:01 -07:00
abs_lowcore.c
alternative.c kernel.h: drop hex.h and update all hex.h users 2026-01-20 19:44:19 -08:00
asm-offsets.c KVM: s390: vsie: Avoid injecting machine check on signal 2026-03-16 16:56:39 +01:00
audit.c s390: Remove compat support 2025-11-17 11:10:38 +01:00
bpf.c s390: Introduce bpf_get_lowcore() kfunc 2026-03-03 08:35:07 -08:00
cache.c
cert_store.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
cpacf.c s390: Remove KMSG_COMPONENT macro 2025-11-24 11:45:21 +01:00
cpcmd.c s390: Remove KMSG_COMPONENT macro 2025-11-24 11:45:21 +01:00
cpufeature.c s390: Explicitly include <linux/export.h> 2025-06-17 18:18:02 +02:00
crash_dump.c s390: Explicitly include <linux/export.h> 2025-06-17 18:18:02 +02:00
ctlreg.c s390: Explicitly include <linux/export.h> 2025-06-17 18:18:02 +02:00
debug.c s390/debug: Reject zero-length input in debug_input_flush_fn() 2026-04-28 14:45:02 +02:00
dis.c s390/fault: Print unmodified PSW address on protection exception 2025-11-14 11:34:28 +01:00
dumpstack.c s390/fault: Print unmodified PSW address on protection exception 2025-11-14 11:34:28 +01:00
early.c s390: Remove KMSG_COMPONENT macro 2025-11-24 11:45:21 +01:00
early_printk.c
ebcdic.c
entry.S s390 fixes for 7.0-rc6 2026-03-28 09:50:11 -07:00
entry.h s390/idle: Inline update_timer_idle() 2026-02-25 16:46:07 +01:00
facility.c s390: Explicitly include <linux/export.h> 2025-06-17 18:18:02 +02:00
fpu.c s390: Explicitly include <linux/export.h> 2025-06-17 18:18:02 +02:00
ftrace.c
ftrace.h
guarded_storage.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
head.S s390: Rename head64.S to head.S 2025-11-25 15:28:07 +01:00
hiperdispatch.c s390: Remove KMSG_COMPONENT macro 2025-11-24 11:45:21 +01:00
idle.c s390/idle: Inline update_timer_idle() 2026-02-25 16:46:07 +01:00
ipl.c integrity: Eliminate weak definition of arch_get_secureboot() 2026-03-13 11:37:13 -04:00
ipl_vmparm.c
irq.c s390: Revert "s390/irq/idle: Remove psw bits early" 2026-03-07 22:41:10 +01:00
jump_label.c
kdebugfs.c
kexec_elf.c s390: kexec: initialize kexec_buf struct 2025-09-03 17:10:37 -07:00
kexec_image.c s390: kexec: initialize kexec_buf struct 2025-09-03 17:10:37 -07:00
kprobes.c
lgr.c
machine_kexec.c
machine_kexec_file.c module: Give MODULE_SIG_STRING a more descriptive name 2026-03-24 21:42:37 +00:00
machine_kexec_reloc.c
mcount.S
module.c s390: Add stackprotector support 2025-11-24 11:45:21 +01:00
nmi.c KVM: s390: vsie: Avoid injecting machine check on signal 2026-03-16 16:56:39 +01:00
nospec-branch.c
nospec-sysfs.c
numa.c
os_info.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
perf_cpum_cf.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
perf_cpum_cf_events.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
perf_cpum_sf.c s390/cpum_sf: Cap sampling rate to prevent lsctl exception 2026-03-24 20:57:31 +01:00
perf_event.c s390: Remove KMSG_COMPONENT macro 2025-11-24 11:45:21 +01:00
perf_pai.c s390/pai: Fix missing PAI counter increments under heavy load 2026-05-11 16:00:04 +02:00
perf_regs.c s390: Remove compat support 2025-11-17 11:10:38 +01:00
process.c s390: Remove compat support 2025-11-17 11:10:38 +01:00
processor.c s390: Remove KMSG_COMPONENT macro 2025-11-24 11:45:21 +01:00
ptrace.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
reipl.S
relocate_kernel.S
rethook.c
rethook.h
runtime_instr.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
setup.c mm, arch: consolidate hugetlb CMA reservation 2026-01-26 20:02:19 -08:00
signal.c s390/vdso: Rename vdso64 to vdso 2025-11-25 15:28:07 +01:00
skey.c s390: Remove superfluous newlines from inline assemblies 2025-09-29 13:52:08 +02:00
smp.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
stackprotector.c kernel.h: drop hex.h and update all hex.h users 2026-01-20 19:44:19 -08:00
stacktrace.c s390/stacktrace: Do not fallback to RA register 2025-12-14 11:03:58 +01:00
sthyi.c s390: Fix double word in comments 2025-11-06 14:17:27 +01:00
syscall.c hardening updates for v7.1-rc1 2026-04-13 17:52:29 -07:00
sysinfo.c s390/sysinfo: Replace sprintf() with snprintf() for buffer safety 2025-10-21 10:17:29 +02:00
text_amode31.S
time.c s390: Remove KMSG_COMPONENT macro 2025-11-24 11:45:21 +01:00
topology.c s390/topology: Use zero-based numbering for containing entities 2026-05-20 09:39:24 +02:00
trace.c
traps.c s390/bug: Skip __WARN_trap() in call traces 2026-01-27 12:16:16 +01:00
unwind_bc.c s390: Explicitly include <linux/export.h> 2025-06-17 18:18:02 +02:00
uprobes.c s390: Remove compat support 2025-11-17 11:10:38 +01:00
uv.c KVM: s390: Switch to new gmap 2026-02-04 17:00:10 +01:00
vdso.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
vmcore_info.c
vmlinux.lds.S kbuild: Split .modinfo out from ELF_DETAILS 2026-02-26 11:50:19 -07:00
vtime.c s390/vtime: Use lockdep_assert_irqs_disabled() instead of BUG_ON() 2026-02-25 16:46:07 +01:00
wti.c