linux/arch/s390
Niklas Schnelle 2c89064ecf s390/pci: Handle futile config accesses of disabled devices directly
[ Upstream commit 84d875e698 ]

On s390 PCI busses and slots with multiple functions may have holes
because PCI functions are passed-through by the hypervisor on a per
function basis and some functions may be in standby or reserved. This
fact is indicated by returning true from the
hypervisor_isolated_pci_functions() helper and triggers common code to
scan all possible devfn values. Via pci_scan_single_device() this in
turn causes config reads for the device and vendor IDs, even for PCI
functions which are in standby and thereofore disabled.

So far these futile config reads, as well as potentially writes, which
can never succeed were handled by the PCI load/store instructions
themselves. This works as the platform just returns an error for
a disabled and thus not usable function handle. It does cause spamming
of error logs and additional overhead though.

Instead check if the used function handle is enabled in zpci_cfg_load()
and zpci_cfg_write() and if not enable directly return -ENODEV. Also
refactor zpci_cfg_load() and zpci_cfg_store() slightly to accommodate
the new logic while meeting modern kernel style guidelines.

Cc: stable@vger.kernel.org
Fixes: a50297cf82 ("s390/pci: separate zbus creation from scanning")
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Reviewed-by: Farhan Ali <alifm@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2026-03-04 07:21:07 -05:00
..
appldata s390: Explicitly include <linux/export.h> 2025-06-17 18:18:02 +02:00
boot s390/boot: Add -Wno-default-const-init-unsafe to KBUILD_CFLAGS 2026-03-04 07:19:33 -05:00
configs s390: Update defconfigs 2025-10-24 15:25:43 +02:00
crypto crypto: s390/phmac - Do not modify the req->nbytes value 2025-10-23 12:53:23 +08:00
hypfs more s390 updates for 6.18 merge window 2025-10-09 10:51:43 -07:00
include s390/ipl: Clear SBP flag when bootprog is set 2026-01-02 12:57:25 +01:00
kernel s390/perf: Disable register readout on sampling events 2026-03-04 07:19:37 -05:00
kvm more s390 updates for 6.18 merge window 2025-10-09 10:51:43 -07:00
lib s390: Remove superfluous newlines from inline assemblies 2025-09-29 13:52:08 +02:00
mm KVM: s390: Fix gmap_helper_zap_one_page() again 2026-01-08 10:16:41 +01:00
net bpf, x86: Add support for signed arena loads 2025-09-23 12:00:22 -07:00
pci s390/pci: Handle futile config accesses of disabled devices directly 2026-03-04 07:21:07 -05:00
purgatory s390/purgatory: Add -Wno-default-const-init-unsafe to KBUILD_CFLAGS 2026-03-04 07:19:33 -05:00
tools s390: Allow to compile with z17 optimizations 2025-04-09 12:12:41 +02:00
Kbuild - An extensive rework of kexec and crash Kconfig from Eric DeVolder 2023-08-29 14:53:51 -07:00
Kconfig s390/kexec: Make KEXEC_SIG available when CONFIG_MODULES=n 2026-02-26 14:59:43 -08:00
Kconfig.debug s390/mm: Add configurable STRICT_MM_TYPECHECKS 2025-03-11 15:27:34 +01:00
Makefile s390: Add -Wno-pointer-sign to KBUILD_CFLAGS_DECOMPRESSOR 2025-09-29 13:52:08 +02:00
Makefile.postlink kbuild: Create intermediate vmlinux build with relocations preserved 2025-03-17 00:29:50 +09:00