linux/arch/s390
Niklas Schnelle f0cddb616f 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:45 -05:00
..
appldata sysctl: treewide: constify the ctl_table argument of proc_handlers 2024-07-24 20:59:29 +02:00
boot s390/mm: Do not map lowcore with identity mapping 2025-08-28 16:31:15 +02:00
configs s390: Update defconfigs 2024-10-16 11:32:32 +02:00
crypto crypto: s390/sha - Fix uninitialized variable in SHA-1 and SHA-2 2025-07-17 18:37:01 +02:00
hypfs s390/hypfs: Enable limited access during lockdown 2025-08-28 16:31:16 +02:00
include tracing: Add ftrace_fill_perf_regs() for perf event 2026-03-04 07:19:37 -05:00
kernel s390/perf: Disable register readout on sampling events 2026-03-04 07:20:55 -05:00
kvm KVM: s390: rename PROT_NONE to PROT_TYPE_DUMMY 2025-06-27 11:11:23 +01:00
lib ftrace: Make ftrace_regs abstract from direct use 2026-03-04 07:19:36 -05:00
mm s390/mm: Fix __ptep_rdp() inline assembly 2025-12-01 11:43:37 +01:00
net s390/bpf: Write back tail call counter for BPF_TRAMP_F_CALL_ORIG 2025-10-19 16:34:05 +02:00
pci s390/pci: Handle futile config accesses of disabled devices directly 2026-03-04 07:21:45 -05:00
purgatory s390/purgatory: Add -Wno-default-const-init-unsafe to KBUILD_CFLAGS 2026-03-04 07:20:53 -05:00
tools s390 updates for 6.12 merge window 2024-09-21 09:02:54 -07: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-03-04 07:20:43 -05:00
Kconfig.debug s390/Kconfig.debug: fix indentation 2022-06-01 12:03:15 +02:00
Makefile s390: Add -Wno-pointer-sign to KBUILD_CFLAGS_DECOMPRESSOR 2025-10-19 16:33:57 +02:00
Makefile.postlink s390/build: Avoid relocation information in final vmlinux 2024-08-27 20:16:48 +02:00