mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
zdev: Add auto-config for PCI and crypto devices
PCI and crypto devices defined using the IBM Z Dynamic Partition Manager (DPM) will start in an offline/unconfigured state that requires manual intervention before the associated Linux function can be used. This results for example in PCI networking interfaces being unavailable in a distribution installer system. Fix this by providing a udev rule and initial RAM-disk logic that automatically enables PCI and crypto devices either during boot, or when they are defined at run-time. This processing can be suppressed by specifying the "rd.zdev=no-auto" parameter on the kernel command line. Auto-configuration is limited to Linux running in DPM LPARs because PCI-functions and crypto devices defined by DPM are always intended for use by a single LPAR only. For Linux running in classic-mode LPARs or virtual machines, leaving PCI and crypto devices in an offline state may be useful to allow defining a device as available to multiple systems, where only the system that intends to make use of the device should enable it. Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com> Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
8c6c2ef30e
commit
3949c62f6f
@@ -20,7 +20,7 @@ check() {
|
||||
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
|
||||
|
||||
# Ensure that required tools are available
|
||||
require_binaries chzdev lszdev || return 1
|
||||
require_binaries chzdev lszdev /lib/s390-tools/zdev_id || return 1
|
||||
|
||||
return 0
|
||||
}
|
||||
@@ -40,11 +40,14 @@ install() {
|
||||
local _tempfile
|
||||
|
||||
# Ensure that required tools are available
|
||||
inst_multiple chzdev lszdev vmcp
|
||||
inst_multiple chzdev lszdev vmcp /lib/s390-tools/zdev_id
|
||||
|
||||
# Hook to parse zdev kernel parameter
|
||||
inst_hook cmdline 95 "$moddir/parse-zdev.sh"
|
||||
|
||||
# Rule to automatically enable devices when running in DPM
|
||||
inst_rules "81-dpm.rules"
|
||||
|
||||
# Obtain early + root device configuration
|
||||
_tempfile=$(mktemp --tmpdir dracut-zdev.XXXXXX)
|
||||
chzdev --export "$_tempfile" --persistent --by-path / --quiet \
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright IBM Corp. 2017
|
||||
# Copyright IBM Corp. 2017,2021
|
||||
#
|
||||
# s390-tools is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the MIT license. See LICENSE for details.
|
||||
@@ -15,11 +15,14 @@
|
||||
# where
|
||||
#
|
||||
# no-auto: Indicates that firmware-provided I/O configuration data
|
||||
# should not be applied.
|
||||
# should not be applied. This also affects automatic
|
||||
# activation of PCI and crypto devices when running in a DPM
|
||||
# LPAR.
|
||||
#
|
||||
|
||||
zdev_fw_file="/sys/firmware/sclp_sd/config/data"
|
||||
zdev_base_args="--force --yes --no-root-update --no-settle --auto-conf --quiet"
|
||||
zdev_id="/lib/s390-tools/zdev_id"
|
||||
|
||||
if [ -e "$zdev_fw_file" ] ; then
|
||||
zdev_auto=1
|
||||
@@ -35,4 +38,22 @@ done
|
||||
|
||||
if [ $zdev_auto -eq 1 ] ; then
|
||||
chzdev --import "$zdev_fw_file" $zdev_base_args
|
||||
|
||||
# Get information about DPM environment
|
||||
for line in $($zdev_id) ; do
|
||||
eval "$line"
|
||||
done
|
||||
|
||||
if [ "$ZDEV_IS_DPM,$ZDEV_NEST_LEVEL,$ZDEV_HYPERVISOR_0" = "1,1,LPAR" ] ; then
|
||||
# Manually iterate over existing PCI devices - there is a udev rule
|
||||
# that handles this for PCI devices added at runtime but that doesn't
|
||||
# work for PCI devices defined before boot because there is no coldplug
|
||||
# trigger for /sys/bus/pci/slots
|
||||
for slot in /sys/bus/pci/slots/* ; do
|
||||
read power < "$slot/power"
|
||||
if [ "$power" = "0" ] ; then
|
||||
echo 1 > "$slot/power"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user