SHA256
1
0
forked from pool/s390-tools
s390-tools/s390-tools-sles15sp1-07-zdev-Integrate-firmware-auto-configuration-with-drac.patch

156 lines
5.2 KiB
Diff
Raw Normal View History

Subject: zdev: Integrate firmware auto-configuration with dracut
From: Peter Oberparleiter <oberpar@linux.ibm.com>
Summary: zdev: Add support for handling I/O configuration data
Description: LPARs that are running in IBM Dynamic Partition Manager (DPM) mode
can access a firmware-generated I/O configuration data file that
contains s390-specific information about available I/O devices
such as qeth device numbers and parameters, and FCP device IDs.
This data file is intended to remove the need for users to
manually enter the corresponding device data during installation.
Linux kernels with the corresponding support make the I/O
configuration data available at the following location:
/sys/firmware/sclp_sd/config/data
This patch set adds support for handling this data file using the
chzdev and lszdev tools:
- I/O configuration data can be applied using chzdev's --import
option
- Initial RAM-Disk scripts automatically apply the
I/O configuration data to the system configuration
- lszdev can be used to display the applied auto-configuration
data
- chzdev can be used to manually override the
auto-configuration data
Upstream-ID: 3fb356ebd297e4384208b7688d49cb3eb8f5b3e1
Problem-ID: LS1604
Upstream-Description:
zdev: Integrate firmware auto-configuration with dracut
Add a dracut hook that applies firmware-provided I/O configuration data
as auto-configuration during boot. This way, all I/O devices configured
by DPM are automatically brought online without further user
interaction.
This mechanism is active by default. It can be deactivated by specifying
the following parameter on the kernel command line:
rd.zdev=no-auto
Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
---
zdev/dracut/95zdev/module-setup.sh | 19 ++++++++++----
zdev/dracut/95zdev/parse-zdev.sh | 38 +++++++++++++++++++++++++++++
zdev/dracut/Makefile | 3 ++
3 files changed, 55 insertions(+), 5 deletions(-)
--- a/zdev/dracut/95zdev/module-setup.sh
+++ b/zdev/dracut/95zdev/module-setup.sh
@@ -9,7 +9,8 @@
# 95zdev/module_setup.sh
# This module installs configuration files (udev rules and modprobe.conf
# files) required to enable the root device on s390. It will only work when
-# the root device was configured using the chzdev tool.
+# the root device was configured using the chzdev tool. In addition,
+# a hook is installed to parse rd.zdev= kernel parameters.
#
check() {
@@ -29,15 +30,23 @@ depends() {
}
installkernel() {
- local _modules=$(lszdev --by-path / --columns MODULES --no-headings 2>/dev/null)
-
- [ -z "$_modules" ] && return 0
- [ ! -z "$_modules" ] && instmods $_modules
+ # Add modules for all device types supported by chzdev (required for
+ # auto-configuration)
+ instmods lcs qeth qeth_l2 qeth_l3 dasd_mod dasd_eckd_mod dasd_fba_mod \
+ dasd_diag_mod zfcp
}
install() {
local _tempfile
+ # Ensure that required tools are available
+ inst_multiple chzdev lszdev vmcp
+
+ # Hook to parse zdev kernel parameter
+ inst_hook cmdline 95 "$moddir/parse-zdev.sh"
+
+ # Obtain root device configuration
+
# Exit early if root device type is unknown
if ! lszdev --by-path / >/dev/null 2>&1 ; then
return 0
--- /dev/null
+++ b/zdev/dracut/95zdev/parse-zdev.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+#
+# Copyright IBM Corp. 2017
+#
+# s390-tools is free software; you can redistribute it and/or modify
+# it under the terms of the MIT license. See LICENSE for details.
+#
+# 95zdev/parse-zdev.sh
+# Parse the kernel command line for rd.zdev kernel parameters. These
+# parameters are evaluated and used to configure z Systems specific devices.
+#
+# Format:
+# rd.zdev=no-auto
+#
+# where
+#
+# no-auto: Indicates that firmware-provided I/O configuration data
+# should not be applied.
+#
+
+zdev_fw_file="/sys/firmware/sclp_sd/config/data"
+zdev_base_args="--force --yes --no-root-update --no-settle --auto-conf --quiet"
+
+if [ -e "$zdev_fw_file" ] ; then
+ zdev_auto=1
+else
+ zdev_auto=0
+fi
+
+for zdev_arg in $(getargs rd.zdev); do
+ if [ "$zdev_arg" = "no-auto" ] ; then
+ zdev_auto=0
+ fi
+done
+
+if [ $zdev_auto -eq 1 ] ; then
+ chzdev --import "$zdev_fw_file" $zdev_base_args
+fi
--- a/zdev/dracut/Makefile
+++ b/zdev/dracut/Makefile
@@ -11,11 +11,14 @@ ZDEVDIR := 95zdev
# performs the following functions when dracut is run:
#
# - copy the persistent root device configuration to the initial ram disk
+# - install a boot-time hook to apply firmware-provided configuration data
+# to the system
#
ifeq ($(HAVE_DRACUT),1)
install:
$(INSTALL) -m 755 -d $(DESTDIR)$(MODDIR)
$(INSTALL) -m 755 -d $(DESTDIR)$(MODDIR)/$(ZDEVDIR)
$(INSTALL) -m 755 $(ZDEVDIR)/module-setup.sh \
+ $(ZDEVDIR)/parse-zdev.sh \
$(DESTDIR)$(MODDIR)/$(ZDEVDIR)/
endif