Compare commits

..

161 Commits

Author SHA1 Message Date
Jan Höppner
d6925a30da New release s390-tools-2.7.0
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-10-31 11:44:17 +01:00
Ingo Franzki
fe4cc7c479 zkey: add generated files to .gitignore
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-10-31 11:44:17 +01:00
Ingo Franzki
fa3cabc8af zkey: Makefile: Don't rebuild .o.d files on 'make install'
The .o.d make targets in common.mak do not expect that
header files are generated by a make target. When a new header
file is generated, the .o.d targets will be rebuilt on the
next make invocation, because that new header file is then
detected, and is then treated as a new dependency of all .o.d
targets.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-10-31 11:44:17 +01:00
Jan Höppner
5a9b56f814 lscss: Fix email address
The linux.vnet.ibm.com addresses will be become disfunct by eoy.

Signed-off-by: Stefan Raspl <raspl@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-10-31 11:44:17 +01:00
Julian Wiedmann
20145b6d06 qethqoat: add OSA-Express7S support
Add the missing identifiers to report the card name and link speed.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-10-25 13:42:12 +02:00
Ingo Franzki
9561a0b983 zkey: Enhance error message on key store open
Print a meaningful reason when the keystore can not be
accessed, e.g. because the user is not allowed to access
the keystore directory.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-10-25 11:00:52 +02:00
Philipp Rudo
97fa88299f zfcpdump: Remove unneeded include <zlib.h>
Dump compression was a feature of the file system dumper which was removed
several years ago. This include is a leftover. Remove it.

Signed-off-by: Philipp Rudo <prudo@linux.ibm.com>
Acked-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-10-25 11:00:52 +02:00
Jan Höppner
aaaebb2030 zpcictl: Change wording of man-page and help output
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-10-25 11:00:52 +02:00
Karsten Graul
ff2a403bd2 osasnmpd: remove unused code, improve readability
Remove unused code because query_OSA_EXP does actually never return -1.
So make its return value unsigned and remove all checks for negative
return values.

Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-10-25 11:00:52 +02:00
Karsten Graul
66ed1727f9 osasnmpd: start without real OSA devices
Osasnmpd would start without any devices, but refuses to start when all
devices are no real OSA devices.
Start osasnmpd in this case because it re-scans via update_mib_info
whenever the interface data changes.

Reviewed-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-10-25 11:00:52 +02:00
Ingo Franzki
c33cc5a619 zkey: Makefile: Avoid relink of modules during 'make install'
Because targets check-dep-zkey and check-dep-zkey-cryptsetup
do not produce any file, any targets that have a pre-req on those
targets are rebuilt during 'make install'.

Also correct .PHONY targets.

Fixes: https://github.com/ibm-s390-tools/s390-tools/issues/46
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-10-22 14:02:35 +02:00
Karsten Graul
cd46297d7c s390-tools/utils: handle util_scandir errors correctly
The util_scandir_* functions may return 0 or -1, in which case no vector
is allocated in libutil/util_scandir.c. util_ptr_vec_free, called by
util_scandir_free or directly from lschp.c and lsscm.c, does always
call free for the vector which might be not initialized.

Fix this by always initializing the vector with NULL in __scandir and
add some api hardening by checking the vector and count in
util_ptr_vec_free before iterating over the vector.
And update the comment for util_scandir to indicate that -1 may be
returned in error cases plus that the vector is initialized with NULL.

Fixes: https://github.com/ibm-s390-tools/s390-tools/issues/43
Reported-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-10-19 15:32:53 +02:00
Dimitri John Ledkov
07b11982e3 zdev: Trigger generic_ccw devices on any kernel module loads.
Generic CCW device can use any driver, and the value of the driver is
not known ahead of time. To avoid the race between loading and binding
a kernel module, and devices added - retrigger generic-ccw devices on
any kernel module load.

Fixes: https://github.com/ibm-s390-tools/s390-tools/issues/37
Link: https://bugs.launchpad.net/ubuntu-z-systems/+bug/1794308
Closes: https://github.com/ibm-s390-tools/s390-tools/pull/45

Signed-off-by: Dimitri John Ledkov <xnox@ubuntu.com>
Acked-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-10-19 15:32:40 +02:00
Dimitri John Ledkov
35348c302b zdev/initramfs: add s390-tools- prefix to hook, due to conflicts.
Unfortunately zdev hook already exists in Ubuntu, from an unrelated
project. ZFS uses zdev/zpool names, and ships a zdev hook to do ZFS
specific initialisation. It is available on s390x and thus results in
file-conflict upon installing both. Thus renaming this zdev hook to
s390-tools-zdev.

Closes: https://github.com/ibm-s390-tools/s390-tools/pull/41
Signed-off-by: Dimitri John Ledkov <xnox@ubuntu.com>
Acked-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-10-19 15:31:54 +02:00
Dimitri John Ledkov
35312d0c47 cpacfstatsd.service: only run on LPARs.
Add ConditionVirtualization=no to the service file such that it is
only started on LPARs. This service cannot run on z/VM nor KVM, and
fails resulting in a degraded boot.

Closes: https://github.com/ibm-s390-tools/s390-tools/pull/38
Signed-off-by: Dimitri John Ledkov <xnox@ubuntu.com>
Acked-by: Harald Freudenberger <freude@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-10-19 15:31:40 +02:00
Jan Höppner
342c6a3707 zpcictl: Make device node for NVMe optional
At the moment, if we specify the slot address of an NVMe device but
can't find the corresponding device node, the execution is terminated.

This is a bit harsh as the device node is rather optional and only
necessary to collect S.M.A.R.T. data. We should still be able to issue
the error reporting, even if we couldn't determine the device node.

Therefore, make sure the device node for NVMe devices is optional by
changing various error messages to warnings.
Change sysfs_get_slot_addr() to have a return value and work with that
accordingly.
Also make sure, that execution is terminated when a valid device node
was specified but no matching slot address was determined. The slot
address is necessary to issue the error reporting commands.

Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-10-11 14:41:32 +02:00
Jan Höppner
e2a8d85916 zpcictl: Read device link to obtain device address
The address sysfs attribute might not be present on some older kernel
levels. Read the device link instead using readlink() to obtain the
address.

Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-10-11 14:41:32 +02:00
Jan Höppner
8f0496b26a zpcictl: Use fopen() instead of open() for writes
Be consistent with the rest of the code and use fopen() rather than
open().

Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-10-11 14:41:32 +02:00
Jan Höppner
d03be73536 zpcictl: Rephrase man page entries and tool output
Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-10-11 14:41:32 +02:00
Michael Holzheu
a87268d62e util_path_example: Fix usage message
Document that for the "sysfs" invocation the mount point is optional.

Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-10-11 14:41:32 +02:00
Michael Holzheu
9cc06a0529 util_proc: Fix typos in description of util_proc_mnt_get_entry()
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-10-11 14:41:32 +02:00
Michael Holzheu
3b1ccce515 util_proc: Fix return code handling for util_proc_mnt_get_entry()
Correctly return -1 if the requested file system is not mounted.

Reported-by: Peter Morjan <peter.morjan@de.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-10-11 14:41:32 +02:00
Hans Wippel
ffe91d1b30 zdev: fix qeth BridgePort and VNICC conflict checking
This patch fixes false positives when attributes are checked for
conflicts between BridgePort and VNICC.

Signed-off-by: Hans Wippel <hwippel@linux.ibm.com>
Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-10-11 14:41:32 +02:00
Hendrik Brueckner
f35c5d01fd zpcictl: include sys/sysmacros.h to avoid minor/major glibc warnings
The minor()/major() function definitions are moved to sys/sysmacros.h
and will be removed from sys/types.h.  To correct below warning, simply
include sys/sysmacros.h.

  zpcictl.c: In function ‘sysfs_get_slot_addr’:
  zpcictl.c:184:13: warning: In the GNU C Library, "major" is defined
   by <sys/sysmacros.h>. For historical compatibility, it is
   currently defined by <sys/types.h> as well, but we plan to
   remove this soon. To use "major", include <sys/sysmacros.h>
   directly. If you did not intend to use a system-defined macro
   "major", you should undefine it after including <sys/types.h>.
    major = major(dev_stat.st_rdev);
               ^~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
2018-10-02 09:55:27 +02:00
Jan Höppner
b23c35c390 zcryptctl: Add binary to .gitignore
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-09-29 12:41:54 +02:00
Jan Höppner
177cf8cfeb zpcictl: Introduce new tool zpcictl
zpcictl is used to manage PCI devices on z Systems. In this first
version it is mainly used to handle erroneous PCI devices by changing
their state and make those changes known to the SE. Log data, such as
S.M.A.R.T. data for NVMe devices, is sent alongside those state changes.

The state change is issued by sending data via the PCI 'report_error'
sysfs attribute. It's a binary attribute which will cause the host to
send an Adapter Notification Event.

Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-09-29 12:41:44 +02:00
Harald Freudenberger
f05f7d656b zcryptctl: new tool zcryptctl for multiple zcrypt node management
With the latest kernel comes an extension for the zcrypt
device driver to support multiple zcrypt device nodes.

Here is the userspace part of this which adds a new
application zcryptctl for user friendly management of
this feature.

Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-09-29 12:41:31 +02:00
Dan Horák
0bf4f1b957 zkey: Be explicit about linking the tools
I've met cases when the make's default rule for linking was used instead
omitting the ALL_LDFLAGS variable. The linking rule from common.mak is
defined for linking *.o files only, here we have libutil.a too.

Closes: https://github.com/ibm-s390-tools/s390-tools/pull/35
Signed-off-by: Dan Horák <dan@danny.cz>
Acked-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-09-29 12:41:28 +02:00
Dan Horák
cd38119888 zkey: Be consistent when referring to libutil.a
Link: https://github.com/ibm-s390-tools/s390-tools/pull/35
Signed-off-by: Dan Horák <dan@danny.cz>
Acked-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-09-29 12:41:21 +02:00
Dan Horák
cadef5c0ff zkey: Drop redundant include
Link: https://github.com/ibm-s390-tools/s390-tools/pull/35
Signed-off-by: Dan Horák <dan@danny.cz>
Acked-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-09-29 12:41:15 +02:00
Dan Horák
02e1c783f6 Makefile: drop LOADLIBES variable
Remove deprecated LOADLIBES variable from the Makefile rules, LDLIBS
serves the same purpose these days.

Link: https://github.com/ibm-s390-tools/s390-tools/pull/35
Signed-off-by: Dan Horák <dan@danny.cz>
Acked-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-09-29 12:41:08 +02:00
Eric Sandeen
07e30951f8 zipl: use FIEMAP mapping ioctl if it exists
zipl currently uses the FIBMAP ioctl to map blocks for the bootloader;
on XFS, if FIBMAP is requested on a reflinked file, it will fail -
and FIBMAP returns 0 in this case, which is indistinguishable from a
hole.  This causes boot to fail because the file is not mapped.

We can use the FIEMAP ioctl instead, which is able to map reflinked
files.  While FIEMAP is able to map entire extents at once, here we
simply use it to obtain the mapping block-by-block so that it fits
in with the current FIBMAP calls.

Fixes: https://github.com/ibm-s390-tools/s390-tools/issues/34
Closes: https://github.com/ibm-s390-tools/s390-tools/pull/36
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Tested-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-09-17 14:28:18 +02:00
Harald Freudenberger
0a0b4c3826 lszcrypt: support for alternate zcrypt device drivers
With kernel 4.19 there comes an extension to the existing
AP bus which supports alternate zcrypt drivers. For details
about this see kernel patch "s390/zcrypt: AP bus support for
alternate driver(s)". So now lszcrypt displays the driver
name in verbose mode. As some of the information displayed
by lszcrypt was based on sysfs attributes, which are only
available when the default zcrypt driver is bound to the
device, this also needed some rework. If a sysfs attribute
is not available because of an alternate driver binding
(or no driver) a question mark is printed into the field.

Together with this a slight rework of the displayed information
has been done. The two columns for pending requests and pending
replies has been merged to one pending column and the column
sizes have been adjusted.

Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-09-17 14:26:29 +02:00
Peter Oberparleiter
eade995185 zdsfs: Direct --help and --version output to stdout
zdsfs writes output for --help and --version to stderr. This is
likely because zdsfs calls into a FUSE function for additional
usage output that also writes to stderr (prior to FUSE 3.0.0).

To be consistent with other s390-tools and GNU coding guide lines,
fix this by using stdout for zdsfs generated output, and by
redirecting stderr to stdout before calling the FUSE function.

Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-09-17 14:23:47 +02:00
Peter Oberparleiter
0eba8d11df tape390_display: Direct --help output to stdout
tape390_display writes output for --help to stderr. To be consistent
with other s390-tools and GNU coding guide lines, fix this by using
stdout for tool-generated usage help.

Reviewed-by: Jens Remus <jremus@linux.ibm.com>
Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-09-17 14:23:47 +02:00
Peter Oberparleiter
257490366b util_prg_example: Add --help and --version options
Add missing long options for --help and --version in util_prg_example.

Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-09-17 14:23:47 +02:00
Peter Oberparleiter
5ef1320a7b iucvconn/iucvtty: Direct --help output to stdout
Both iucvconn and iucvtty write output for --help to stderr. To be
consistent with other s390-tools and GNU coding guide lines,
fix this by using stdout for tool-generated usage help.

Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-09-17 14:23:47 +02:00
Peter Oberparleiter
f2f572fa70 hmcdrvfs: Direct --help and --version output to stdout
hmcdrvfs writes output for --help and --version to stderr. This is
likely because hmcdrvfs calls into a FUSE function for additional
usage output that also writes to stderr (prior to FUSE 3.0.0).

To be consistent with other s390-tools and GNU coding guide lines,
fix this by using stdout for hmcdrvfs generated output, and by
redirecting stderr to stdout before calling the FUSE function.

Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-09-17 14:23:47 +02:00
Peter Oberparleiter
e655f0cd7b cmsfs-fuse: Direct --help and --version output to stdout
cmsfs-fuse writes output for --help and --version to stderr. This is
likely because cmsfs-fuse calls into a FUSE function for additional
usage output that also writes to stderr (prior to FUSE 3.0.0).

To be consistent with other s390-tools and GNU coding guide lines,
fix this by using stdout for cmsfs-fuse generated output, and by
redirecting stderr to stdout before calling the FUSE function.

Also remove an inactive call to add FUSE version output on --version to
be consistent with other FUSE-based s390-tools.

Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-09-17 14:23:47 +02:00
Peter Oberparleiter
68b46eea7a zipl: Add missing build dependency
Building zipl from outside the zipl/ sub-directory fails due to a
missing dependency:

  # cd s390-tools
  # make -C zipl/src/ zipl
  boot.c:18:10: fatal error: ../boot/data.h: No such file or directory
   #include "../boot/data.h"

This is because boot/data.h needs to be generated before src/boot.c can
be compiled. Fix this by adding the missing dependency to the zipl
Makefile.

Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-09-04 14:09:24 +02:00
Ingo Franzki
9894e391ef zkey: Man page correction
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-09-04 14:09:24 +02:00
Steffen Maier
5982fd98bf CHANGELOG: lstape, lsluns: handle non-zfcp; lin_tape multiple paths
Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-09-04 14:09:24 +02:00
Steffen Maier
d5291eed1c lstape: fix SCSI HBA CCW device bus-ID e.g. for virtio-scsi-ccw
Get the SCSI HBA device bus-ID in general for HBAs on the CCW bus.

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Fedor Loshakov <loshakov@linux.ibm.com>
Reviewed-by: Jens Remus <jremus@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-09-04 14:09:24 +02:00
Steffen Maier
34260f1736 lstape: fix SCSI output description in man page
Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Jens Remus <jremus@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-09-04 14:09:24 +02:00
Steffen Maier
b9b3d2d230 lstape: fix description of --type and <devbusid> filter for channel tapes
Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Jens Remus <jremus@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-09-04 14:09:24 +02:00
Steffen Maier
4cf8f5f46c lstape: fix to prevent error messages if there are non-zfcp SCSI devices
Assume "N/A" for non-zfcp SCSI devices, such as iSCSI or virtio-scsi-ccw,
to not erroneously access absent zfcp-specific sysfs attributes.

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Reviewed-by: Jens Remus <jremus@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-09-04 14:09:24 +02:00
Steffen Maier
eba744a25e lsluns: fix to prevent error messages if there are non-zfcp SCSI devices
Simply skip non-zfcp SCSI devices, such as iSCSI or virtio-scsi-ccw,
to not erroneously access absent zfcp-specific sysfs attributes.

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Reviewed-by: Jens Remus <jremus@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-09-04 14:09:24 +02:00
Steffen Maier
80e0c41b89 lstape: fix output without SCSI generic (sg)
The default bash setting have nullglob disabled so if
$SCSI_DEV/scsi_generic*
aka
/sys/bus/scsi/devices/*:*:*:*/scsi_generic*
does not match anything, it leaves the glob pattern unmodified and
SG_DEV=$(basename $SG_DEV/*)
results in the literal:
*
If $SG_INQ exists, it invoked sg_inq with more than the one allowed
positional argument for a SCSI generic device node:
sg_inq /dev/*
Causing error messages and the usage of sg_inq to land in $TAPE_SERIAL.

To not have to rely on the nullglob setting, explicitly check for the
existence of $SCSI_DEV/scsi_generic before evaluating
SG_DEV=$(basename $SG_DEV/*).

Also handle availability of sg_inq but absence of scsi_generic
individually to provide the user with a hint if only sg is missing.

Suggested-by: Eric Farman <farman@linux.vnet.ibm.com>
Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Jens Remus <jremus@linux.ibm.com>
Cc: Eric Farman <farman@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-09-04 14:09:24 +02:00
Steffen Maier
cdc787db1b lstape: fix to prefer sysfs to find lin_tape device name for SCSI device
This should be more stable than parsing the IBM lin_tape proc-fs output.
If sysfs is not available or provides no match, fall back to proc-fs.

An alternative to "ls -1d ... | head -n1" would have been to use
"shopt -s extglob; ls -d $SCSI_DEV/lin_tape/$DEV_NAME+([0-9])"
but I did not want to have to rely on extglob potentially influencing
other old code of lstape.

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Jens Remus <jremus@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-09-04 14:09:24 +02:00
Steffen Maier
ef4dc7a45b lstape: fix output with SCSI lin_tape and multiple paths to same tape/changer
https://www.ibm.com/developerworks/linux/linux390/s390-tools-1.8.0.html
before the first upstream commit b627b8d8e1 ("Initial s390-tools-2.0.0
import") introduced SCSI tape/changer output for lstape. It used the SCSI
device serial number as lookup key to find a match in IBM lin_tape device
driver proc-fs output for a given SCSI device name. Since multiple paths
to the same tape/changer have the same serial number, multiple matches can
occur and distort the output:

% lstape
...
SCSI tape devices (found 12):
...
Generic Device        Target       Vendor   Model            Type     State
sg0     IBMtape0      3            0:0:0:0  IBM              ULT3580-TD6 tapedrv
running
sg1     IBMchanger0   1            2        3                0:0:0:1  IBM
3573-TL changer       running
...

There are unexpected additional Device suffix numbers for each additional
path of the same tape/changer (independent of actual path failover
enablement in lin_tape). The multiple matches above cause excess arguments
to printf. Explaining the resulting output, the bash man page says:
"The format is reused as necessary to consume all of the arguments."
This also causes a wrong number of found devices.

Current lin_tape (v3.0.31) uses the printf format string
"%-8d%-12s%-25s%-16s%-16s%-10s" for fixed column proc-fs output.
This causes the following example input to lstape:

==> /proc/scsi/IBMchanger <==
lin_tape version: 3.0.31
lin_tape major number: 251
Attached Changer Devices:
Number  model       SN                       HBA             SCSI            FO Path
0       3573-TL     00L4U78W6497_LL0         Virtio SCSI HBA 0:0:0:1         Primary
1       3573-TL     00L4U78W6497_LL0         Virtio SCSI HBA 0:0:1:1         Alternate
2       3573-TL     00L4U78W6497_LL0         Virtio SCSI HBA 1:0:1:1         Alternate
3       3573-TL     00L4U78W6497_LL0         Virtio SCSI HBA 1:0:0:1         Alternate

==> /proc/scsi/IBMtape <==
lin_tape version: 3.0.31
lin_tape major number: 251
Attached Tape Devices:
Number  model       SN                       HBA             SCSI            FO Path
0       ULT3580-TD6 10WT037733               Virtio SCSI HBA 0:0:0:0         Primary
1       ULT3580-TD6 10WT037701               Virtio SCSI HBA 0:0:1:0         Primary
2       ULT3580-TD6 10WT037701               Virtio SCSI HBA 1:0:1:0         Alternate
3       ULT3580-TD6 10WT037733               Virtio SCSI HBA 1:0:0:0         Alternate

If that was reliable and stable, we could use fixed column parsing:
			IBM_IDX=$(
				awk 'BEGIN {
					FIELDWIDTHS="8 12 25 16 16 10"
				}
				gensub(" ","","g",$5) == "'$SCSI_ID'"{
					print gensub(" ","","g",$1)
				}' /proc/scsi/$DEV_NAME
			)
However, we can hardly guarantee a field value always fits into the left-
adjusted columns (printf won't cap to field width!). Also, the fixed column
format changed between lin_tape v3.0.20 and v3.0.18 from
"%-8d%-12s%-18s%-16s%-16s%-10s" with less width for the 'SN' field.
The column format also changed between v2.2.0 and v1.37.0 from
"%-8d%-12s%-18s%-32s%-10s" where the 'SCSI' field did not even exist.
Likely that was the reason for the original Serial lookup in lstape.

As can be seen in the example, at least the HBA device driver string can
contain whitespace and breaks the field numbers with tokenized parsing.
We want to match column 5 (SCSI) but above we would match against the
string 'SCSI' as part of "Virtio SCSI HBA" instead of e.g. '0:0:0:0'.

The following works currently knowing that the last two columns do not
contain white space. But it can also fail if the value of field
'HBA' does not fit into the left-adjusted columns so there is no white
space between columns 'HBA' and 'SCSI' making them collapse:
awk '$(NF-1) == "'$SCSI_ID'" { print $1 }' /proc/scsi/$DEV_NAME

Grep for the SCSI device name as word (to skip names with same substring,
such as 0:0:1:1 also matching 0:0:1:10) and cut the first field 'Number'.
If there is no SCSI column at all (and no SCSI LLDD or other column with a
name accidentally matching an existing SCSI device name), we get no match
and better bail out with the initialized "N/A" for the lstape column
"Device". If the SCSI column exists, the SCSI device names are unique and
we always get at most one match.

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Reviewed-by: Jens Remus <jremus@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-09-04 14:09:24 +02:00
Philipp Rudo
cb3e949772 zfcpdump: Fix incompatible cast compile warning
When zfcpdump is built you get a compile warning

zfcpdump.c: In function ‘init_sig’:
zfcpdump.c:307:24: warning: cast between incompatible function types from ‘void (* (*)(int,  siginfo_t *, void *))(int)’ {aka ‘void (* (*)(int,  struct <anonymous> *, void *))(int)’} to ‘void (*)(int)’ [-Wcast-function-type]
  g.sigact.sa_handler = (__sighandler_t)dump_sig_handler;

Furthermore the man pages for sigaction says

$man 2 sigaction
[...]
       If SA_SIGINFO is specified in sa_flags, then sa_sigaction (instead
       of sa_handler) specifies the signal-handling function for signum.
       This function receives three arguments, as described below.
[...]

Because SA_SIGINFO is set, using sa_handler at all is wrong in this case.

Fix this by giving dump_sig_handler the correct return type and assign it
to sa_sigaction.

Signed-off-by: Philipp Rudo <prudo@linux.ibm.com>
Reviewed-by: Steffen Maier <maier@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-09-04 14:09:24 +02:00
Philipp Rudo
f02de298c1 zfcpdump: Remove module load
The zfcpdump kernel is built without module support. Furthermore the initrd
doesn't contain modprobe. So trying to load modules using modprobe in
zfcpdump userspace doesn't really make sense.

Signed-off-by: Philipp Rudo <prudo@linux.ibm.com>
Reviewed-by: Steffen Maier <maier@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-09-04 14:09:24 +02:00
Philipp Rudo
eb0dc13c88 zfcpdump: Add install script for zfcpdump
Since version 198 (Feb 2013) systemd contains kernel-install, a script
managing kernel installs. This script allows execution of drop-in scripts
for customization. Add such a drop-in script to s390-tools to handle the
installation of zfcpdump kernels.

It's main purpose is to manage a link to the latest installed zfcpudump
kernel at ZFCPDUMP_IMAGE, where zipl expects to find the image to install
for a SCSI dumper.

The script supports two installation modes. One recommended by the
BootLoaderSpecs [1] to /boot/<machine-id>/<kernel-version> directories and
one directly to /boot. In the second case files are renamed during
installation to <original-name>-<kernel-version> to guarantee unique names.

Because the zfcpdump kernel is so special make the script stand-alone and
prevent any other script from being executed (exit 77) when a zfcpdump is
installed. Especially avoid functionality like creating an initrd (already
provided by s390-tools) or creating a boot entry (the zfcpdump kernel
should not be used for any other purpose than dumping).

The script requires systemd >= 203.

[1] https://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/

Signed-off-by: Philipp Rudo <prudo@linux.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-09-04 14:09:24 +02:00
Philipp Rudo
d08bd23c1e zipl: Move macro definition to Makefile
In the zipl Makefile macros are defined with the sole purpose to define
other macros in zipl.h. Remove this unnecessary indirection.

Signed-off-by: Philipp Rudo <prudo@linux.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-09-04 14:09:24 +02:00
Philipp Rudo
724f1fea2c Makefile: Rename ZFCPDUMP_PART_* macros
The file system dumper no longer exists. So there is no need in keeping
'PART' to distinguish between the file system and the partition dumper.
Adjust the macro name to the usage in zipl by removing 'PART'.

While at it also adjust the file names the macros stand for.

Signed-off-by: Philipp Rudo <prudo@linux.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-09-04 14:09:24 +02:00
Philipp Rudo
dcc63e6dfc zipl: Rename FSDUMP_PART_* macros
The macro names are a mixture of the original file system dumper (FSDUMP)
and its extension to cut the file system and write directly to a partition
(PART). The original dumper no longer exists and today the feature is
called zfcpdump. Prevent confusion by renaming the macros to fit todays
usage.

Signed-off-by: Philipp Rudo <prudo@linux.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-09-04 14:09:24 +02:00
Philipp Rudo
576034e94a zfcpdump: Remove unused macros
There are no more users for these macros. Remove them.

Signed-off-by: Philipp Rudo <prudo@linux.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-09-04 14:09:24 +02:00
Jan Höppner
3ec49ba7bd Prepare for next release
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-09-04 14:09:24 +02:00
Jan Höppner
60c687238d New release s390-tools-2.6.0
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-08-10 12:41:17 +02:00
Sebastian Ott
57b992ffa1 lscss: document behavior of subchannels bound to alternate drivers
Provide information on how subchannels bound to vfio_ccw are displayed.

Reported-by: Cornelia Huck <cohuck@redhat.com>
Link: https://github.com/ibm-s390-tools/s390-tools/issues/32
Fixes: #32
Signed-off-by: Sebastian Ott <sebott@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-08-10 12:41:17 +02:00
Ingo Franzki
1f07a41d5a zkey: Add volume-type property to support LUKS2 volumes
Allow to specify a volume-type for a key. This applies to all
associated volumes. The volume type can be either 'plain' or
'luks2'. New keys created will default to 'luks2', but existing
keys that do not have a volume-type property default to 'plain'
for compatibility reasons.

The volume type 'luks2' is only available when the define
HAVE_LUKS2_SUPPORT is set in the makefile. This is set only
when libcryptsetup version 2.0.3 or newer is available
at build time. If the define is not set, the volume-type
option is not available to the user, and the volume-type of
a key defaults to 'plain'.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-08-10 12:41:12 +02:00
Ingo Franzki
512b47c004 zkey: Add key verification pattern property
Store a verification pattern in the properties file along
with the secure key. The verification pattern allows to identify
the inner key even when the secure key is no longer valid.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-08-10 10:42:18 +02:00
Ingo Franzki
818ffbc4b0 zkey: Add build dependency for libcryptsetup and json-c
The zkey-cryptsetup tool has a build dependency to
libcryptsetup version 2.0.3 or later, and json-c.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-08-10 10:42:18 +02:00
Ingo Franzki
5e65df7375 zkey: Add man page for zkey-cryptsetup
Add documentation for the new zkey-cryptsetup tool

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-08-10 10:42:18 +02:00
Ingo Franzki
4eb80d14a0 zkey: Add zkey-cryptsetup tool
The zkey-cryptsetup tool is used to validate and re-encipher
secure AES volume keys of volumes encrypted with LUKS2 and
the paes cipher.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-08-10 10:42:18 +02:00
Viktor Mihajlovski
7247a61e0b netboot: add BOOTIF support
The IPAPPEND option in the pxelinux config file can be used
to pass information about the boot interface to the booted
Linux kernel.

The support for this option was missing and could lead to
installation failures, e.g. using kickstart.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-08-10 10:42:18 +02:00
Viktor Mihajlovski
c856f28e11 netboot: Send client architecture and handle path prefix
Client architecture aware DHCP configurations may send a
bootfile for the wrong architecture, if the DHCP request
doesn't include the client architecture identifier 0x001f.

Further, the DHCP reply may include the pxepathprefix option,
which points to the base directory to use for TFT requests.
If the value is not honored by the client, the wrong
configuration file, kernel, etc. could be loaded.

Both issues are fixed by this commit.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-08-10 10:42:18 +02:00
Viktor Mihajlovski
ca30cfd341 netboot: Include compressed kernel modules in initramfs
Compressed kernel modules (filename *.ko.xz) would not be included
since the script was looking for files with .ko suffix only.

This can result in a pxelinux.0 image that can't access the
network, which is not good for a network boot loader...

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-08-10 10:42:18 +02:00
Gerald Schaefer
58ecf1f363 mon_procd: fix parsing of /proc/<pid>/stat
The output of /proc/<pid>/stat will show the process name in parentheses.
The parsing code in read_stat() tries to filter out the parentheses, which
will go wrong when the process name itself also contains parentheses, e.g.
in an output like this: "2421 ((sd-pam)) S 2420 2420 2420 ..."

In this case, the first closing parentheses will be taken as end marker,
and the sscanf() on the remaining string will silently fail, leaving its
values in uninitialized state and producing wrong data.

Fix this by using strrchr() instead of strchr() to find the last closing
parentheses. Also add return value checking for sscanf() and initialize the
values to 0.

Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-07-04 13:10:20 +02:00
Sa Liu
d36ff82999 dbginfo: Add VM command query time. Corrected error messages.
Signed-off-by: Sa Liu <saliu@de.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-07-04 13:09:58 +02:00
Dimitri John Ledkov
d4398aea89 zdev: Adjust zdev modprobe path to be compatible with split-usr systems.
mk-pxelinux-ramfs, mod_fsstatd|procd.service, zfcpdump all use
/sbin/modprobe path. Adjust zdev to use that path as well. This works
universally on both usr-merge systems (e.g. Debian/Ubuntu with
usrmerge package installed), and split-usr systems alike
(Debian/Ubuntu current stable releases default).

Closes: #31
Link: https://bugs.launchpad.net/ubuntu/+source/s390-tools/+bug/1777600
Signed-off-by: Dimitri John Ledkov <xnox@ubuntu.com>
Acked-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-06-22 17:25:06 +02:00
Ingo Franzki
672548ce30 zkey: Fix generate and import leaving key in an inconsistent state
When a volume or APQN association is made while generating or
importing a key, and a duplicate association is detected, then
this may leave the key in an inconsistent state.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-06-22 17:25:06 +02:00
Ingo Franzki
344965bd29 zkey: Fix APQN validation routine
When a zkey generate or change command is used to associate one
or multiple APQNs the command succeeds, but no key is generated
and no APQNs are associated, because the return code returned by
_keystore_apqn_check() is wrong.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-06-22 17:25:06 +02:00
Ingo Franzki
d6a96f07c1 zkey: Fix memory leak
The APQN check routine as well as the properties helper functions
do not free all memory that they allocated.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-06-22 17:25:06 +02:00
Jan Höppner
6a99d95d4f Prepare for next release
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-06-22 17:25:06 +02:00
Jan Höppner
3f1bd3bb66 New release s390-tools-2.5.0
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-06-08 15:03:30 +02:00
Dan Horák
0fbc4edd29 zipl: Compute the bootloader stage size to workaround PIE
Closes: #30
Signed-off-by: Dan Horák <dan@danny.cz>
Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-06-08 15:03:30 +02:00
Javier Martinez Canillas
b8a9f0d1d3 scripts: Add script to switch zipl config to a BootLoaderSpec setup
Add a zipl-switch-to-blscfg script that can be used to switch the zipl
configuration in a system to use the BootLoaderSpec (BLS) config files
to define the IPL sections instead of having them defined in zipl.conf.

Closes: #28
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-06-08 15:03:30 +02:00
Javier Martinez Canillas
d280e5b1fa zipl: Add BootLoaderSpec support
The BootLoaderSpec (BLS) defines a file format for boot configurations,
so bootloaders can parse these files and create their boot menu entries
by using the information provided by them [0].

This allow to configure the boot items as drop-in files in a directory
instead of having to parse and modify a bootloader configuration file.

If the /boot/loader/entries exists and there are BLS files there, then
these are parsed and configuration sections are added without the need
to have these in a zipl.conf file.

A different BLS directory can be specified from the command line using
the --blsdir option.

[0]: https://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/

GitHub-ID: #28
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-06-08 15:03:30 +02:00
Javier Martinez Canillas
e04acab0ed zipl: Return number of allocated tokens in scan_file()
The function returns 0 on success and a negative number on error but is
useful to know how many tokens were allocated. This will be used by the
BLS parsing code to determine if needs to allocate mor tokens or not to
parse the BLS fragments.

GitHub-ID: #28
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-06-08 15:03:30 +02:00
Jens Remus
d868ce5ec7 lsluns: print a message if no adapter or port exists
lsluns lists nothing and returns with return code 0 if no adapter (FCP
device) or target port exists in sysfs. This can be confusing for the user.

Print a message if no adapter exists. Print a message if no port exists on
any adapter.

Reported-by: Thorsten Diehl <thorsten.diehl@de.ibm.com>
Suggested-by: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
Reviewed-by: Steffen Maier <maier@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-06-08 15:03:30 +02:00
Ingo Franzki
dec58c349e zkey: Typo in message
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-06-08 15:03:30 +02:00
Peter Oberparleiter
d82f5e1f49 zdev: Fix blocking chzdev call/udev rules with cmb_enable
Changing the cmb_enable attribute of a CCW device can cause a blocked
chzdev process or udev rule. This problem occurs when the device is
offline, cmb_enable is 0, and chzdev is used to set cmb_enable=1 and
online=1 at the same time.

The following call will block:

chzdev 190d -a cmb_enable=1 online=1

The following call will generate a udev rule that will block subsequent
calls to 'udevadm settle':

chzdev 190d -p online=1 cmb_enable=1

Fix this by ensuring that cmb_enable is only set when the CCW device
is not online.

Reported-by: André Wild <wild@linux.vnet.ibm.com>
Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-06-08 15:03:30 +02:00
Peter Oberparleiter
156450f359 zdev: Implement support for early device configuration
Enable user to specify that a device should be configured early, that is
during the initial RAM-disk boot phase. This may be necessary, e.g. to
override auto-configuration for a device which is also applied during
that boot phase. It may also be used to manually specify devices that
are required to access the root file system, such as networking devices.

Users can mark devices as requiring early configuration by specifying
a value of 1 for the newly added internal attribute zdev:early:

 # chzdev dasd-eckd 0.0.1234 -p zdev:early=1

This can be changed back by removing the attribute setting, or by
setting the attribute value to 0:

 # chzdev dasd-eckd 0.0.1234 -p -r zdev:early

or

 # chzdev dasd-eckd 0.0.1234 -p zdev:early=0

Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-06-08 15:03:30 +02:00
Peter Oberparleiter
c0392efa39 zdev: Implement internal device attributes
This change adds base infrastructure for implementing internal device
attributes. In the context of the zdev tools, an internal device
attribute is a new type of device attribute with the following
characteristics:

  - Can be set and removed like normal device attributes
  - Affects zdev-internal handling only
  - Does not correspond to an actual device attribute, that is
    it has no representation in SysFS
  - Can not be set in the active configuration
  - Name starts with "zdev:" to prevent conflicts with actual
    device attributes

Values for internal device attributes are stored in udev rules alongside
the normal persistent configuration of a device. They are encoded as
udev environment variables. Note that they have no further effect on
udev processing.

Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-06-08 15:03:30 +02:00
Peter Oberparleiter
3c5644ccfd zdev: Integrate firmware auto-configuration with initramfs-tools
Add initramfs-tools scripts that apply 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>
2018-06-08 15:03:30 +02:00
Peter Oberparleiter
3fb356ebd2 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>
2018-06-08 15:03:30 +02:00
Peter Oberparleiter
fe68ec513d zdev: Add support for handling auto-configuration data
Auto-configuration is the name of a new configuration target that is
supported by chzdev and lszdev besides the existing active and
persistent configuration targets. Directives created in this new
configuration are stored as udev rules in the /run/udev/rules.d
directory.

Auto-configuration directives are only in effect if there are no
directives for the same device in the user-provided persistent
configuration. This allows users to override auto-configuration
directives if necessary.

Due to the volatile nature of the /run directory, auto-configuration
directives are cleared on reboot. Therefore mechanisms that generate
auto-configuration directives must recreate them on every boot.

The lszdev tool displays auto-configuration data both in list view
as well as in detail view. Users can specify the new option --auto-conf
to only show data from this configuration target.

Mechanisms that generate automated configuration directives can use
chzdev together with the --auto-conf option to create the corresponding
udev rules.

Note: This change does not include a mechanism that generates
      auto-configuration directives.

Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-06-08 15:03:30 +02:00
Peter Oberparleiter
a86fb8b091 zdev: Write zfcp-lun udev rules to separate files
Change chzdev's udev rule generation from the previous approach of
combining all zfcp-lun udev rules associated with an FCP device into a
single file to storing zfcp-lun udev rules in one file per zfcp-lun.
This is done to enable per-device udev rule masking.

With udev rule masking, if a udev rule file by the same name exists in
both /etc and /run, the udev daemon will only consider the rules found
in /etc.

The auto-configuration feature will make use of per-device udev rule
masking to introduce a new class of configuration data (stored in /run)
that is only active if no user-provided configuration data (in /etc)
exists.

In addition, change chzdev to allow the regeneration of udev rules by
using the --force command line like in the following example:

 # chzdev zfcp-lun --configured --enable --persistent --force

This can be used to convert all existing zfcp-lun udev rules from the
old format to the new one.

Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-06-08 15:03:30 +02:00
Peter Oberparleiter
f32bff9688 zdev: Implement --no-settle
There are some situations where running "udevadm settle" can result in
a deadlock, such as in the early stages of initial RAM-disk processing.

Introduce a new command-line option --no-settle that can be used to
suppress calling "udevadm settle" to allow chzdev to be run in such
situations.

Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-06-08 15:03:30 +02:00
Peter Oberparleiter
7d355b0fec zdev: Add support for reading firmware configuration files
Add support for reading firmware-provided I/O configuration data files.
Such configuration files are generated by the Dynamic Partition Manager
and made available via a kernel interface for consumption by Linux.

To read a firmware configuration file, use the existing --import option:

 # chzdev --import /sys/firmware/sclp_sd/config/data

This will apply all I/O configuration data found in the specified file
to the persistent configuration.

Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-06-08 15:03:30 +02:00
Peter Oberparleiter
ab4445c261 zdev: Prepare for firmware configuration file support
Apply some changes to existing functions and data structures to simplify
the firmware configuration file support implementation.

 - Make qeth and dasd subtype objects non-static
 - Change the existing helper functions for reading file contents into
   memory to also support binary functions
 - Move some configuration file import functions to make them available
   for use in other source files

Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-06-08 15:03:30 +02:00
Jan Höppner
e14363373b Prepare for next release
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-06-08 15:03:30 +02:00
Jan Höppner
d9ca409978 New release s390-tools-2.4.0
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 15:27:24 +02:00
Jan Höppner
13596f18da udev: Replace WAIT_FOR with TEST keyword
The udev rule for SCSI devices is still using the WAIT_FOR keyword,
which was used to make sure that a file does in fact exist before any
rule is applied. That keyword, however, was removed with systemd-220 and
is therefore no longer valid, which in turn leads to errors on newer
systems.

Use the TEST keyword instead to check the existence of a file before we
apply any rules.

Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 14:28:32 +02:00
Ingo Franzki
80b66da1d8 zkey: Update README to add info about packaging requirements
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 14:28:32 +02:00
Hendrik Brueckner
3eb9af9c97 zkey: let packaging create the zkeyadm group and permission setup
Signed-off-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 14:28:32 +02:00
Ingo Franzki
f093d0bfd4 zkey: Man page updates
Add documentation for the new keystore related zkey commands.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Ingo Franzki
6a2f4fd376 zkey: Create key repository and group during make install
Create the default keystore directory '/etc/zkey/repository'
and the user group 'zkeyadm' during make install.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Ingo Franzki
e2f92e4079 zkey: Add keystore related commands
Add new commands to the zkey utility to store secure AES keys in
the secure key repository provided by the keystore implementation
introduced in the previous commit.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Ingo Franzki
c944f23d7e zkey: Add keystore implementation
Add a keystore implementation that stores secure AES keys in a
key repository, located in a directory, e.g. '/etc/zkey/repository'.
The keystore allows you to generate, validate, re-encipher, modify,
list, delete, etc secure keys.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Ingo Franzki
5872f8a21b zkey: Externalize secure key back-end functions
To reduce the size of the zkey.c source file, all routines that
deal with secure keys are moved to a new source file pkey.c.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Ingo Franzki
a090a1ffe8 zkey: Add helper functions for comma separated string handling
Comma separated strings are used in property values to store
multiple values in one property. These helper functions allow to
work with such comma separated strings.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Ingo Franzki
5e24f74fde zkey: Add build dependency to OpenSSL (libcrypto)
The integrity support for the properties file routines use
SHA-256 to build a hash of the keys and values of a property file.
The codes uses the EVP_DigestInit_ex, EVP_DigestUpdate, and
EVP_DigestFinal from the libcrypto library (OpenSSL).

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Ingo Franzki
340da73bb7 zkey: Add properties file handling routines
In preparation for a new feature, introduce property file
handling routines. A property file stores key value pairs
in a text file. Optionally a hash of all keys and values
contained in the properties file can be generated to
ensure integrity of the properties file and to detect
manual modifications.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Thomas Richter
f642019bcc cpumf: Add IBM z14 ZR1 to the CPU Measurement Facility model list
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Mikhail Zaslonko
7cc542352e zgetdump: Update the man page
Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Mikhail Zaslonko
cf99ea019e zgetdump: Add 'Dump file size' field for zgetdump -i output
Add 'Dump file size' field for zgetdump -i output to show the actual size
of dump file in s390 extended format on disk in megabytes.

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Mikhail Zaslonko
15c22ec742 zgetdump: Add verbose option
Add verbose option for zgetdump to display the detailed layout of memory
map when printing dump info for s390_ext or ELF dump format.

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Mikhail Zaslonko
45ac847dc9 zgetdump: Adjust zgetdump for ELF formatted dumps
Adjust ELF formatted dump processing by zgetdump tool in order to handle
so-called zero loads using zero memory chunks introduced with s390
extended dump format.

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Mikhail Zaslonko
4a223c70f2 zgetdump: Update zgetdump to process the new dump format
Update zgetdump tool to process dumps of the new s390 extended format.

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Mikhail Zaslonko
26d636f234 zgetdump: Update zgetdump to process the new dump tool
Update 'zgetdump -d' to process the new DASD dump tool installed (single
volume or multi-volume).

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Mikhail Zaslonko
aade05b01d zgetdump: Update s390 dump common functions
Update df_s390_dumper structure and dumper reading functions to read
certain dumper fields instead of the entire dump tool.
Update other s390 dump common functions in preparation for the new dumper
and the new s390 extended dump format.

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Mikhail Zaslonko
c3821f0821 zipl: Update progress_print() function
Adjust progress_print() function to print dump progress message based on
the time interval thus printing the message with a regular rate.

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Mikhail Zaslonko
ac0ac48f6f zipl: Extend DASD stand-alone dumpers to drop zero pages
Update zipl DASD standalone dumpers for single-volume, multi-volume and FBA
to drop the sets of zero pages when dumping memory to disk. Thus, all
continuous sets of zero-megabytes in the memory are dropped during the dump
stage.

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Mikhail Zaslonko
54519b4465 zipl: Update page_is_valid() function to avoid tprot usage
Old implementation was using Test Protection (TPROT) instruction to
validate the memory page. Given that it is a rather slow instruction and
the fact that we only need to validate the read-access for a page, we can
use simple Load or Insert Character instruction to test that.
The new version of page_is_valid() without a TPROT is introduced.

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.vnet.ibm.com>
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Mikhail Zaslonko
9f2e406525 zipl: Fixing program check handler function
The program check handler has a bug in calculating the address of the target
to jump to. Furthermore the use of relative addresses in the exception table
can lead to situations where the (calculated) fault is not unique. Storing
the absolute address of the fault and target in the exception table solves
both problems.
This patch is intended to:
  - Modify exception table to store the absolute address of 'fault' and
    'target' points
  - Adjust program check handler function pgm_check_handler_fn() accordingly

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.vnet.ibm.com>
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Vasily Gorbik
edaad2a927 chreipl: correct read-only attributes handling
chreipl could only be used as root (effective userid 0), which is
explicitly checked upon invocation.

"access" call is a wrong method to check super user read/write access
for sysfs files, because it is simply always returns 0 (success), despite
actual sysfs file permissions or underlying sysfs file callbacks setup.
The only guaranteed way of checking sysfs file super user access is an
actual open call with the corresponding access mode.

The problem is that chreipl always tries to update some sysfs attributes
even through they are not specified as command line arguments. Together
with a broken sysfs file access checks this leads to inability to use
the tool, when some sysfs attributes are read-only (which is the case
on older systems where diag308 set does not work).

$ chreipl ccw -d 0.0.ec5a
chreipl: Could not open "reipl/ccw/parm" (Permission denied)

The change fixes access checks, which are in place to handle "diag308
set does not work" case (presence of read-only sysfs attributes).

Also replaces R_OK with F_OK in "set_target_type_auto" to underline that
only file presence is checked, not an actual read access.

Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Vasily Gorbik
262a827ab4 chreipl: make write_str_errno return errno as the name suggests
Make write_str_errno return errno in all error cases, so that it would
be usable in scenarious where open call could fail and we just want to
get an errno, not to exit.

This function is currently only used by chshut in a context where
such a change wouldn't hurt debug ability.

159         if (write_str_errno(argv[2], path))
160                 ERR_EXIT_ERRNO("Could not set \"%s\"", path);

Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Vasily Gorbik
4b33d80595 chreipl: correct fcp reipl sysfs write sequence
kdump reipl implementation relies on os_info kernel structure
residing in old memory being dumped. os_info contains reipl block, which
is used (if valid) by the kdump kernel for reipl parameters.

The problem is that the reipl block and its checksum inside
os_info is updated only when /sys/firmware/reipl/reipl_type is
written. This sets an offset of a reipl block for "reipl_type" and
re-calculates reipl block checksum. Any further alteration of values
under /sys/firmware/reipl/{reipl_type}/ without subsequent write to
/sys/firmware/reipl/reipl_type lead to incorrect os_info reipl block
checksum. In such a case kdump kernel ignores it and reboots using
default logic.

This change makes sure that all fcp values are written before
reipl_type, to avoid potential problem with incorrect checksum.

Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Sa Liu
4c401162c0 dbginfo: Add VM commands to query protection settings.
Signed-off-by: Sa Liu <saliu@de.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Mikhail Zaslonko
168acec5ea zgetdump: Avoid the Segfault on processing dumps with memory limit
When dump is not complete or dump memory limit is set, zgetdump might end up
with the Segfault on reading Vector Registers. That might take place when
the Vector Registers save area is beyond the dump memory limit.

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.vnet.ibm.com>
Reviewed-by: Philipp Rudo <prudo@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Thomas Richter
aab339d3e3 cpumf: Make short descriptions common for extended counter sets
The short descriptions for a counter in the extender counter
set should be identical for all models.
This patch fixes minor differences.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Thomas Richter
1f459af568 cpumf: Add short description for crypto counter set
Add short description to the crypto counter set definition
file.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Thomas Richter
46f09a0adc cpumf: Add short description for diag counter set
Add a short description to the diagnosis counter set
definition file.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Thomas Richter
f65003a14e cpumf: Add short description for zEC12 extended counter set
Add a short description to the zEC12 extended counter set
definition file.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Thomas Richter
e092b4024a cpumf: Add short description for z196 extended counter set
Add a short description to the z196 extended counter set
definition file.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Thomas Richter
9d7bab18a4 cpumf: Add short description for z14 extended counter set
Add a short description to the z14 extended counter set
definition file.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Thomas Richter
8688d47e3d cpumf: Add short description for z13 extended counter set
Add a short description to the z13 extended counter set
definition file.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Thomas Richter
04bb72c0dc cpumf: Add short description for z10 extended counter set
Add a short description to the z10 extended counter set
definition file.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Thomas Richter
1c065082d2 cpumf: Add short description for basic counters level 3
Add a short description to the basic counter first
version number 3 definition file.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Thomas Richter
38642e6905 cpumf: Add short description for basic counters level 1
Add a short description to the basic counter first
version number 1 definition file.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Thomas Richter
ebdf888a2f cpumf: Fix typo in counter 135
Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Hendrik Brueckner
9745e4678a cpumf: correct counter name for z13 and z14
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Sebastian Ott
33a17df9fc lscss: fix scanning for defunct devices
util_scandir doesn't work with "/" at the end of the format string.

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Sebastian Ott
4ff7aeff39 lscss: fix double free in print_defunct_devices
double free or corruption (out)

Program received signal SIGABRT, Aborted.
0x000003fffdd40404 in raise () from /lib64/libc.so.6
(gdb) bt
#0  0x000003fffdd40404 in raise () from /lib64/libc.so.6
#1  0x000003fffdd41ec2 in abort () from /lib64/libc.so.6
#2  0x000003fffdd88d8e in __libc_message () from /lib64/libc.so.6
#3  0x000003fffdd905c8 in malloc_printerr () from /lib64/libc.so.6
#4  0x000003fffdd98dfa in free () from /lib64/libc.so.6
#5  0x0000000001005994 in util_ptr_vec_free (count=<optimized out>, ptr_vec=0x101de90) at ../include/lib/util_base.h:46
#6  util_scandir_free (de_vec=0x101de90, count=<optimized out>) at util_scandir.c:174
#7  0x00000000010043ce in print_defunct_devices (rec=rec@entry=0x10114f0,
    path=path@entry=0x101cc80 "/sys/devices/css0/defunct") at lscss.c:678
#8  0x0000000001004cfe in print_subchannels_of_type (type_requested=type_requested@entry=SUBCHANNEL_TYPE_IO,
    rec=rec@entry=0x10114f0) at lscss.c:726
#9  0x0000000001003888 in cmd_lscss () at lscss.c:761
#10 main (argc=<optimized out>, argv=<optimized out>) at lscss.c:932

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Thomas Richter
edb75870b5 cpumf_helper.in: Fix output of shortdesc
The cpumf_helper.in is called to parse counter definition
files stored in /usr/share/s390-tools/cpumf directory and
returns perl references to be examined by other perl tools
such as lsctrdef.

cpumf_helper.in expects several keywords in the counter
definition files, one is 'shortdesc' which contains
a short description of the purpose of the counter.

However this short description not is stored in the hash
field shortdesc keyed by counter number 'ctr' because the
wrong key is used.

Output before:
{
  '64' => {
            'desc' => 'Total number of the PRNG functions issued by the CPU',
            'name' => 'PRNG_FUNCTIONS',
            'set' => 8
          },
  '65' => {
            'desc' => 'Total number of CPU cycles when the DEA/AES coprocessor is busy performing PRNG functions issued by the CPU',
            'name' => 'PRNG_CYCLES',
            'set' => 8
          },
  ....
  'ctr' => {   <-------- WRONG
             'shortdesc' => 'AES Blocked Cycles'
           }
}

Output with this patch:
{
  '64' => {
            'desc' => 'Total number of the PRNG functions issued by the CPU',
            'name' => 'PRNG_FUNCTIONS',
            'set' => 8,
            'shortdesc' => 'PRNG Functions'
          },
  '65' => {
            'desc' => 'Total number of CPU cycles when the DEA/AES coprocessor is busy performing PRNG functions issued by the CPU',
            'name' => 'PRNG_CYCLES',
            'set' => 8,
            'shortdesc' => 'PRNG Cycles'
          },
  ...
}

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Thomas Richter
a3c746846d cpumf: add missing Description: tag for z13/z14/ctr:128
Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Thomas Richter
4044accf03 vmcp: Use libutil functions util_prg and util_opt
Use helper functions in libutil for command line parsing
and help text output.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: Jan Höppner <hoeppner@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Thomas Richter
943e7e7198 vmcp: Use libvmcp and remove local vmcp code
Use the new libvmcp.a to send commands to z/VM CP.
The error messages remain unchanged.

Local header file vmcp.h now only contains variable definitions
and some defines used by vmcp.c. Move them to the source file
and remove the now empty header file.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: Jan Höppner <hoeppner@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Thomas Richter
4f00cb6346 vmur: Use libvmcp and remove local vmcp code
Use the new libvmcp.a to send commands to z/VM CP.
The error messages remain unchanged.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Reviewed-by: Jan Höppner <hoeppner@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Thomas Richter
9d55086720 lsqeth: Use libvmcp and remove local vmcp code
Use the new libvmcp.a to send commands to z/VM CP.
The error messages remain unchanged.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: Jan Höppner <hoeppner@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Thomas Richter
eaa2ef6ba4 libvmcp: Add common vmcp code to the lib
This patch prevents code duplication in vmcp related programs.
Some applications such as vmur, vmcp, and lsqeth
use z/VM CP commands to query information. Each program
uses its own defines and code.

Supply a library and common header file to use common code.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Reviewed-by: Jan Höppner <hoeppner@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Mikhail Zaslonko
37c3752b31 zgetdump: Remove unused function prototype
Signed-off-by: Mikhail Zaslonko <zaslonko@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Philipp Rudo
8585efadbe zipl: Remove unused inline assembly load
Signed-off-by: Philipp Rudo <prudo@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Harald Freudenberger
13648dd6f4 zcrypt: Corrections at the chzcrypt man page.
Fixed typo and added one sentence to explain more details
about online switching of queue devices.

Signed-off-by: Harald Freudenberger <freude@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Thomas Richter
427dff3450 s390-tools: Move function util_strstrip
This patch
 - moves function util_strstrip to libutil/util_libc.c and deletes the
   extra files util_strstip.[ch]
 - adds doxygen comments for util_strstrip()
 - provides an example on how to use util_strstrip().

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Stefan Haberland
08bc0a947a zipl: fix some warnings in zipl_helper
Fix some warnings found by sparse.
Declare one function static and change static variables to defines.

Signed-off-by: Stefan Haberland <sth@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Stefan Haberland
c3d583fe9c zipl: remove unused include
Remove unused include to fix an error reported by make C=1.

  CHECK   zipl/src/zipl_helper.device-mapper.o
../../include/lib/dasd_base.h:159:20: error: redefinition of struct hd_geometry
../../common.mak:234: recipe for target 'zipl_helper.device-mapper.o' failed
make: *** [zipl_helper.device-mapper.o] Error 1

The structure hd_geometry is defined in dasd_base.h.

Signed-off-by: Stefan Haberland <sth@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Gerald Schaefer
983a72dab9 hmcdrvfs: fix parsing of link count >= 1000
hmcdrvfs will ignore files with a link count >= 1000, due to an inconsistency
in the input data. The parsing code relies on having spaces between the
different fields in its input data. When a file has a link count >= 1000,
there will be no space, and the "link count" field will be placed directly
after the previous "mode" field. This will confuse the parser, and all such
files will not be accesible.

The "mode" field will never contain digits, so in order to fix this issue,
the parser can recognize the "link count" field by the presence of a digit.

Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Thomas Richter
811152c08a s390-tools: Use util_strstrip in vmur
Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Thomas Richter
6a1b9cf10a s390-tools: Add function util_strstrip
Function strstrip strips leading and trailung
spaces from a given string.
During review it was decided to move this function
to the libutil library to make it available for other tools.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-05-07 13:42:03 +02:00
Rafael Fonseca
599b141b8a zipl: Rewrite helper script in C
To remove the perl dependency from zipl rewrite the helper script in C.

Closes: #18

Signed-off-by: Rafael Fonseca <r4f4rfs@gmail.com>
Reviewed-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Signed-off-by: Stefan Haberland <sth@linux.vnet.ibm.com>
2018-02-16 10:39:10 +01:00
Sebastian Ott
b9e47e356b dbginfo: gather nvme related data
Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Stefan Haberland <sth@linux.vnet.ibm.com>
2018-02-16 10:38:08 +01:00
Michael Holzheu
5e2a477bbf zfcpdump: Remove file system check from zfcpdump_initramfs.txt
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Stefan Haberland <sth@linux.vnet.ibm.com>
2018-02-16 10:37:05 +01:00
Michael Holzheu
bba34cb975 zfcpdump: Add /dev/sda to zfcpdump_initramfs.txt
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Stefan Haberland <sth@linux.vnet.ibm.com>
2018-02-16 10:36:43 +01:00
Michael Holzheu
a674011c0d zgetdump: Remove superfluous member 'size'
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Stefan Haberland <sth@linux.vnet.ibm.com>
2018-02-16 10:36:27 +01:00
Michael Holzheu
c78b5cd2ba zgetdump: Remove superfluous members from dfi_mem_chunk
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Stefan Haberland <sth@linux.vnet.ibm.com>
2018-02-16 10:36:08 +01:00
Michael Holzheu
f3e374ac77 zgetdump: Fix typo
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: Stefan Haberland <sth@linux.vnet.ibm.com>
2018-02-16 10:35:22 +01:00
Michael Holzheu
1e6a9dbd56 AUTHORS: Cleanup
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
2018-01-30 17:02:50 +01:00
Stefan Haberland
564a2601f6 Prepare for next release
Signed-off-by: Stefan Haberland <sth@linux.vnet.ibm.com>
2018-01-30 16:01:36 +01:00
194 changed files with 18525 additions and 2932 deletions

11
.gitignore vendored
View File

@@ -46,6 +46,7 @@ libutil/util_prg_example
libutil/util_rec_example
libutil/util_scandir_example
libzds/libzds.a
libvmcp/vmcp_example
mon_tools/mon_fsstatd
mon_tools/mon_procd
osasnmpd/osasnmpd
@@ -67,6 +68,7 @@ zconf/qeth/lsqeth
zconf/scm/lsscm
zconf/zcrypt/chzcrypt
zconf/zcrypt/lszcrypt
zconf/zcrypt/zcryptctl
zdev/src/chzdev
zdev/src/chzdev_usage.c
zdev/src/lszdev
@@ -75,7 +77,8 @@ zdsfs/zdsfs
zdump/zgetdump
zfcpdump/cpioinit
zfcpdump/zfcpdump_part
zfcpdump/zfcpdump_part.rd
zfcpdump/zfcpdump-initrd
zfcpdump/10-zfcpdump.install
ziomon/ziomon_mgr
ziomon/ziomon_util
ziomon/ziomon_zfcpdd
@@ -86,4 +89,10 @@ zipl/boot/*.exec
zipl/boot/data.h
zipl/src/chreipl_helper.device-mapper
zipl/src/zipl
zipl/src/zipl_helper.device-mapper
zkey/zkey
zkey/zkey-cryptsetup
zkey/check-dep-zkey
zkey/check-dep-zkey-cryptsetup
zkey/detect-libcryptsetup.dep
zpcictl/zpcictl

View File

@@ -14,15 +14,15 @@ List of all individuals having contributed content to s390-tools
- Christof Schmitt
- Claudio Imbrenda
- Clemens von Mann
- cvs2git
- Dan Horak
- Despina Papadopoulou
- Dimitri John Ledkov
- Eberhard Pasch
- Einar Lueck
- Eric Sandeen
- Erwin Vicari
- Eugene Crosser
- Eugene Dvurechenski
- Eugene (jno) Dvurechenski
- Farhan Ali
- Fedor Loshakov
- Felix Beck
@@ -47,6 +47,7 @@ List of all individuals having contributed content to s390-tools
- Jan Glauber
- Jan Hoeppner
- Jan Willeke
- Javier Martinez Canillas
- Jean-Baptiste Joret
- Jens Remus
- Jochen Roehrig
@@ -62,7 +63,6 @@ List of all individuals having contributed content to s390-tools
- Martin Schwidefsky
- Maxim Shchetynin
- Melissa Howland
- Michael
- Michael Ernst
- Michael Holzheu
- Michael Mueller
@@ -77,11 +77,9 @@ List of all individuals having contributed content to s390-tools
- Ralph Wuerthner
- Rene Trumpp
- Rolf Schaefer
- root
- Sa Liu
- Sascha Silbe
- Sebastian Ott
- Seshagiri N Ippili
- Seshagiri N. Ippili
- Simon Sturm
- Stefan Bader
@@ -101,6 +99,7 @@ List of all individuals having contributed content to s390-tools
- Thomas Weber
- Ursula Braun
- Utz Bacher
- Vasily Gorbik
- Viktor Mihajlovski
- Volker Sameske
- Wolfgang Taphorn

View File

@@ -1,5 +1,78 @@
Release history for s390-tools (MIT version)
--------------------------------------------
* __v2.7.0 (2018-10-31)__
For Linux kernel version: 4.19
Add new tool:
- zcryptctl: Add zcryptctl for multiple zcrypt node management
- zpcictl: Add zpcictl for reporting defective PCI devices
Changes of existing tools:
- qethqoat: Add OSA-Express7S support
- lszcrypt: Add support for alternative zcrypt device drivers
- zfcpdump: Add install script for zfcpdump
- zipl: Make zipl work with XFS by using the FIEMAP mapping ioctl
Bug Fixes:
- lstape: Fix output with SCSI lin_tape and multiple paths to same unit
- lstape: Fix output without SCSI generic (sg)
- lsluns: Fix to prevent error messages if there are non-zfcp SCSI devices
- lstape: Fix to prevent error messages if there are non-zfcp SCSI devices
- lstape: Fix description of --type and <devbusid> filter for channel tapes
- lstape: Fix SCSI output description in man page
- lstape: Fix SCSI HBA CCW device bus-ID e.g. for virtio-scsi-ccw
- Direct --help and --version output to stdout for several tools
- osasnmpd: Start without real OSA devices
* __v2.6.0 (2018-08-10)__
For Linux kernel version: 4.18
Add new tool:
- zkey: Add zkey-cryptsetup tool
Changes of existing tools:
- netboot: add BOOTIF support
Bug Fixes:
- mon_procd: fix parsing of /proc/<pid>/stat
- netboot: Include compressed kernel modules in initramfs
- netboot: Send client architecture and handle path prefix
* __v2.5.0 (2018-06-08)__
For Linux kernel version: 4.17
Changes of existing tools:
- zdev: Add support for reading firmware configuration files
- zipl: Add BootLoaderSpec support
- scripts: Add script to switch zipl config to a BootLoaderSpec setup
Bug Fixes:
- lsluns: Print a message if no adapter or port exists
* __v2.4.0 (2018-05-07)__
For Linux kernel version: 4.16
Changes of existing tools:
- dbginfo: Gather nvme related data
- zipl: Rewrite helper script in C
- libutil: Add function util_strstrip
- libvmcp: Introduce libvmcp
- zipl: Extend DASD stand-alone dumpers to drop zero pages
- zgetdump: Add verbose option
- zgetdump: Add 'Dump file size' field for zgetdump -i output
- cpumf: Add IBM z14 ZR1 to the CPU Measurement Facility model list
- zkey: Add build dependency to OpenSSL (libcrypto)
- zkey: Add keystore implementation
Bug Fixes:
- hmcdrvfs: fix parsing of link count >= 1000
- zgetdump: Avoid Segfault on processing dumps with memory limit
- chreipl: correct fcp reipl sysfs write sequence
- udev: Replace WAIT_FOR with TEST keyword
* __v2.3.0 (2018-01-30)__

View File

@@ -3,12 +3,12 @@ ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/ar
# Include common definitions
include common.mak
LIB_DIRS = libvtoc libu2s libutil libzds libdasd libvmdump libccw
LIB_DIRS = libvtoc libu2s libutil libzds libdasd libvmdump libccw libvmcp
TOOL_DIRS = zipl zdump fdasd dasdfmt dasdview tunedasd \
tape390 osasnmpd qetharp ip_watcher qethconf scripts zconf \
vmconvert vmcp man mon_tools dasdinfo vmur cpuplugd ipl_tools \
ziomon iucvterm hyptop cmsfs-fuse qethqoat zfcpdump zdsfs cpumf \
systemd hmcdrvfs cpacfstats zdev dump2tar zkey netboot etc
systemd hmcdrvfs cpacfstats zdev dump2tar zkey netboot etc zpcictl
SUB_DIRS = $(LIB_DIRS) $(TOOL_DIRS)
all: $(TOOL_DIRS)

View File

@@ -264,12 +264,16 @@ build options:
| pfm | `HAVE_PFM` | cpacfstats |
| net-snmp | `HAVE_SNMP` | osasnmpd |
| glibc-static | `HAVE_LIBC_STATIC` | zfcpdump |
| openssl | `HAVE_OPENSSL` | zkey |
| cryptsetup | `HAVE_CRYPTSETUP2` | zkey-cryptsetup |
| json-c | `HAVE_JSONC` | zkey-cryptsetup |
This table lists additional build or install options:
| __COMPONENT__ | __OPTION__ | __TOOLS__ |
|----------------|:----------------:|:-------------------------------:|
| dracut | `HAVE_DRACUT` | zdev |
| initramfs-tools| `HAVE_INITRAMFS` | zdev |
The s390-tools build process uses "pkg-config" if available and hard-coded
compiler and linker options otherwise.
@@ -366,3 +370,15 @@ the different tools are provided:
For running znetconf these programs are required:
- modprobe (kmod)
- vmcp (s390-tools)
* zkey:
For building the zkey tools you need openssl version 0.9.7 or newer installed
(openssl-devel.rpm). Also required are cryptsetup version 2.0.3 or newer
(cryptsetup-devel.rpm), and json-c version 0.12 or newer (json-c-devel.rpm).
Tip: you may skip the zkey build by adding `HAVE_OPENSSL=0`, and you may
may skip the zkey-cryptsetup build by adding `HAVE_CRYPTSETUP2=0`, or
`HAVE_JSONC=0` to the make invocation.
A new group 'zkeyadm' needs to be created and all users intending to use the
tool must be added to this group. The owner of the default key repository
'/etc/zkey/repository' must be set to group 'zkeyadm' with write permission
for this group.

View File

@@ -76,7 +76,7 @@ static const struct fuse_opt cmsfs_opts[] = {
static void usage(const char *progname)
{
fprintf(stderr,
fprintf(stdout,
"Usage: %s DEVICE MOUNTPOINT [OPTIONS]\n"
"\n"
"Use the cmsfs-fuse command to read and write files stored on a z/VM CMS disk.\n"
@@ -4498,14 +4498,23 @@ static int cmsfs_process_args(void *data, const char *arg, int key,
return 1;
case KEY_HELP:
usage(outargs->argv[0]);
/*
* Usage output needs to go to stdout to be consistent with
* coding guidelines. FUSE versions before 3.0.0 print help
* output to stderr. Redirect stderr to stdout here to enforce
* consistent behavior.
*/
fflush(stderr);
dup2(STDOUT_FILENO, STDERR_FILENO);
fuse_opt_add_arg(outargs, "-ho");
cmsfs_fuse_main(outargs, &cmsfs_oper);
exit(0);
case KEY_VERSION:
fprintf(stderr, COMP "FUSE file system for CMS disks "
fprintf(stdout, COMP "FUSE file system for CMS disks "
"program version %s\n", RELEASE_STRING);
fprintf(stderr, "Copyright IBM Corp. 2010, 2017\n");
fuse_opt_add_arg(outargs, "--version");
fprintf(stdout, "Copyright IBM Corp. 2010, 2017\n");
exit(0);
default:

View File

@@ -5,7 +5,7 @@ COMMON_INCLUDED = true
# The variable "DISTRELEASE" should be overwritten in rpm spec files with:
# "make DISTRELEASE=%{release}" and "make install DISTRELEASE=%{release}"
VERSION = 2
RELEASE = 3
RELEASE = 7
PATCHLEVEL = 0
DISTRELEASE = build-$(shell date +%Y%m%d)
S390_TOOLS_RELEASE = $(VERSION).$(RELEASE).$(PATCHLEVEL)-$(DISTRELEASE)
@@ -182,9 +182,10 @@ GROUP = $(shell id -gn)
export INSTALLDIR BINDIR LIBDIR MANDIR OWNER GROUP
# Special defines for zfcpdump
ZFCPDUMP_PART_IMAGE = zfcpdump_part.image
ZFCPDUMP_PART_RD = zfcpdump_part.rd
export ZFCPDUMP_DIR ZFCPDUMP_PART_IMAGE ZFCPDUMP_PART_RD
ZFCPDUMP_IMAGE = zfcpdump-image
ZFCPDUMP_INITRD = zfcpdump-initrd
ZFCPDUMP_FLAVOR = zfcpdump
export ZFCPDUMP_DIR ZFCPDUMP_IMAGE ZFCPDUMP_INITRD ZFCPDUMP_FLAVOR
CFLAGS ?= $(DEFAULT_CFLAGS) $(OPT_FLAGS)
HOSTCFLAGS ?= $(DEFAULT_CFLAGS) $(OPT_FLAGS)
@@ -239,7 +240,7 @@ endif
$(CXX) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) -c $< -o $@
%: %.o
$(LINK) $(ALL_LDFLAGS) $^ $(LOADLIBES) $(LDLIBS) -o $@
$(LINK) $(ALL_LDFLAGS) $^ $(LDLIBS) -o $@
%.a:
$(AR) rcs $@ $^
@@ -338,6 +339,10 @@ $(rootdir)/libvmdump/libvmdump.a: $(rootdir)/libvmdump
$(MAKE) -C $(rootdir)/libvmdump/ libvmdump.a
.PHONY: $(rootdir)/libvmdump
$(rootdir)/libvmcp/libvmcp.a: $(rootdir)/libvmcp
$(MAKE) -C $(rootdir)/libvmcp/ libvmcp.a
.PHONY: $(rootdir)/libvmcp
$(rootdir)/zipl/boot/data.o:
$(MAKE) -C $(rootdir)/zipl/boot/ data.o

3
cpumf/bin/cpumf_helper.in Normal file → Executable file
View File

@@ -172,7 +172,7 @@ sub cpumf_parse_ctrdef($;$)
# Parse short description (optional)
if ($line =~ m/^Short-Description:\s*(\S.*)?$/) {
$h->{ctr}->{shortdesc} = $1 || "";
$h->{$ctr}->{shortdesc} = $1 || "";
# Parse start of counter description
} elsif ($line =~ m/^Description:\s*(\S.*)?$/) {
@@ -211,6 +211,7 @@ my $system_z_hwtype_map = {
2964 => 'IBM z13',
2965 => 'IBM z13s',
3906 => 'IBM z14',
3907 => 'IBM z14 ZR1',
};
sub get_hardware_type()

View File

@@ -1,48 +1,60 @@
Counter: 0 Name:CPU_CYCLES
Short-Description:CPU Cycles
Description:
Cycle Count
.
Counter: 1 Name:INSTRUCTIONS
Short-Description:Instructions
Description:
Instruction Count
.
Counter: 2 Name:L1I_DIR_WRITES
Short-Description:L1I Directory Writes
Description:
Level-1 I-Cache Directory Write Count
.
Counter: 3 Name:L1I_PENALTY_CYCLES
Short-Description:L1I Penalty Cycles
Description:
Level-1 I-Cache Penalty Cycle Count
.
Counter: 4 Name:L1D_DIR_WRITES
Short-Description:L1D Directory Writes
Description:
Level-1 D-Cache Directory Write Count
.
Counter: 5 Name:L1D_PENALTY_CYCLES
Short-Description:L1D Penalty Cycles
Description:
Level-1 D-Cache Penalty Cycle Count
.
Counter: 32 Name:PROBLEM_STATE_CPU_CYCLES
Short-Description:Problem-State CPU Cycles
Description:
Problem-State Cycle Count
.
Counter: 33 Name:PROBLEM_STATE_INSTRUCTIONS
Short-Description:Problem-State Instructions
Description:
Problem-State Instruction Count
.
Counter: 34 Name:PROBLEM_STATE_L1I_DIR_WRITES
Short-Description:Problem-State L1I Directory Writes
Description:
Problem-State Level-1 I-Cache Directory Write Count
.
Counter: 35 Name:PROBLEM_STATE_L1I_PENALTY_CYCLES
Short-Description:Problem-State L1I Penalty Cycles
Description:
Problem-State Level-1 I-Cache Penalty Cycle Count
.
Counter: 36 Name:PROBLEM_STATE_L1D_DIR_WRITES
Short-Description:Problem-State L1D Directory Writes
Description:
Problem-State Level-1 D-Cache Directory Write Count
.
Counter: 37 Name:PROBLEM_STATE_L1D_PENALTY_CYCLES
Short-Description:Problem-State L1D Penalty Cycles
Description:
Problem-State Level-1 D-Cache Penalty Cycle Count
.

View File

@@ -1,32 +1,40 @@
Counter: 0 Name:CPU_CYCLES
Short-Description:CPU Cycles
Description:
Cycle Count
.
Counter: 1 Name:INSTRUCTIONS
Short-Description:Instructions
Description:
Instruction Count
.
Counter: 2 Name:L1I_DIR_WRITES
Short-Description:L1I Directory Writes
Description:
Level-1 I-Cache Directory Write Count
.
Counter: 3 Name:L1I_PENALTY_CYCLES
Short-Description:L1I Penalty Cycles
Description:
Level-1 I-Cache Penalty Cycle Count
.
Counter: 4 Name:L1D_DIR_WRITES
Short-Description:L1D Directory Writes
Description:
Level-1 D-Cache Directory Write Count
.
Counter: 5 Name:L1D_PENALTY_CYCLES
Short-Description:L1D Penalty Cycles
Description:
Level-1 D-Cache Penalty Cycle Count
.
Counter: 32 Name:PROBLEM_STATE_CPU_CYCLES
Short-Description:Problem-State CPU Cycles
Description:
Problem-State Cycle Count
.
Counter: 33 Name:PROBLEM_STATE_INSTRUCTIONS
Short-Description:Problem-State Instructions
Description:
Problem-State Instruction Count
.

View File

@@ -1,82 +1,98 @@
Counter: 64 Name:PRNG_FUNCTIONS
Short-Description:PRNG Functions
Description:
Total number of the PRNG functions issued by the CPU
.
Counter: 65 Name:PRNG_CYCLES
Short-Description:PRNG Cycles
Description:
Total number of CPU cycles when the DEA/AES coprocessor is busy
performing PRNG functions issued by the CPU
.
Counter: 66 Name:PRNG_BLOCKED_FUNCTIONS
Short-Description:PRNG Blocked Functions
Description:
Total number of the PRNG functions that are issued by the CPU and are
blocked because the DEA/AES coprocessor is busy performing a function
issued by another CPU
.
Counter: 67 Name:PRNG_BLOCKED_CYCLES
Short-Description:PRNG Blocked Cycles
Description:
Total number of CPU cycles blocked for the PRNG functions issued by
the CPU because the DEA/AES coprocessor is busy performing a function
issued by another CPU
.
Counter: 68 Name:SHA_FUNCTIONS
Short-Description:SHA Functions
Description:
Total number of SHA functions issued by the CPU
.
Counter: 69 Name:SHA_CYCLES
Short-Description:SHA Cycles
Description:
Total number of CPU cycles when the SHA coprocessor is busy performing
the SHA functions issued by the CPU
.
Counter: 70 Name:SHA_BLOCKED_FUNCTIONS
Short-Description:SHA Blocked Functions
Description:
Total number of the SHA functions that are issued by the CPU and are
blocked because the SHA coprocessor is busy performing a function issued
by another CPU
.
Counter: 71 Name:SHA_BLOCKED_CYCLES
Short-Description:SHA Bloced Cycles
Description:
Total number of CPU cycles blocked for the SHA functions issued by the
CPU because the SHA coprocessor is busy performing a function issued
by another CPU
.
Counter: 72 Name:DEA_FUNCTIONS
Short-Description:DEA Functions
Description:
Total number of the DEA functions issued by the CPU
.
Counter: 73 Name:DEA_CYCLES
Short-Description:DEA Cycles
Description:
Total number of CPU cycles when the DEA/AES coprocessor is busy
performing the DEA functions issued by the CPU
.
Counter: 74 Name:DEA_BLOCKED_FUNCTIONS
Short-Description:DEA Blocked Functions
Description:
Total number of the DEA functions that are issued by the CPU and are
blocked because the DEA/AES coprocessor is busy performing a function
issued by another CPU
.
Counter: 75 Name:DEA_BLOCKED_CYCLES
Short-Description:DEA Blocked Cycles
Description:
Total number of CPU cycles blocked for the DEA functions issued by the
CPU because the DEA/AES coprocessor is busy performing a function issued
by another CPU
.
Counter: 76 Name:AES_FUNCTIONS
Short-Description:AES Functions
Description:
Total number of AES functions issued by the CPU
.
Counter: 77 Name:AES_CYCLES
Short-Description:AES Cycles
Description:
Total number of CPU cycles when the DEA/AES coprocessor is busy
performing the AES functions issued by the CPU
.
Counter: 78 Name:AES_BLOCKED_FUNCTIONS
Short-Description:AES Blocked Functions
Description:
Total number of AES functions that are issued by the CPU and are blocked
because the DEA/AES coprocessor is busy performing a function issued
by another CPU
.
Counter: 79 Name:AES_BLOCKED_CYCLES
Short-Description:AES Blocked Cycles
Description:
Total number of CPU cycles blocked for the AES functions issued by the
CPU because the DEA/AES coprocessor is busy performing a function issued

View File

@@ -1,96 +1,114 @@
Counter: 128 Name:L1I_L2_SOURCED_WRITES
Short-Description:L1I L2 Sourced Writes
Description:
A directory write to the Level-1 I-Cache directory where the returned
cache line was sourced from the Level-2 (L1.5) cache
.
Counter: 129 Name:L1D_L2_SOURCED_WRITES
Short-Description:L1D L2 Sourced Writes
Description:
A directory write to the Level-1 D-Cache directory where the installed
cache line was sourced from the Level-2 (L1.5) cache
.
Counter: 130 Name:L1I_L3_LOCAL_WRITES
Short-Description:L1I L3 Local Writes
Description:
A directory write to the Level-1 I-Cache directory where the installed
cache line was sourced from the Level-3 cache that is on the same book
as the Instruction cache (Local L2 cache)
.
Counter: 131 Name:L1D_L3_LOCAL_WRITES
Short-Description:L1D L3 Local Writes
Description:
A directory write to the Level-1 D-Cache directory where the installtion
cache line was source from the Level-3 cache that is on the same book
as the Data cache (Local L2 cache)
.
Counter: 132 Name:L1I_L3_REMOTE_WRITES
Short-Description:L1I L3 Remote Writes
Description:
A directory write to the Level-1 I-Cache directory where the installed
cache line was sourced from a Level-3 cache that is not on the same
book as the Instruction cache (Remote L2 cache)
.
Counter: 133 Name:L1D_L3_REMOTE_WRITES
Short-Description:L1D L3 Remote Writes
Description:
A directory write to the Level-1 D-Cache directory where the installed
cache line was sourced from a Level-3 cache that is not on the same
book as the Data cache (Remote L2 cache)
.
Counter: 134 Name:L1D_LMEM_SOURCED_WRITES
Short-Description:L1D Local Memory Sourced Writes
Description:
A directory write to the Level-1 D-Cache directory where the installed
cache line was sourced from memory that is attached to the same book
as the Data cache (Local Memory)
.
Counter: 135 Name:L1I_LMEM_SOURCED_WRITES
Short-Description:L1I Local Memory Sourced Writes
Description:
A directory write to the Level-1 I-Cache where the installed cache
line was sourced from memory that is attached to the s ame book as the
Instruction cahe (local Memory)
Instruction cache (Local Memory)
.
Counter: 136 Name:L1D_RO_EXCL_WRITES
Short-Description:L1D Read-only Exclusive Writes
Description:
A directory write to the Level-1 D-Cache where the line was originally
in a Read-Only state in the cache but has been updated to be in the
Exclusive state that allows stores to the cache line
.
Counter: 137 Name:L1I_CACHELINE_INVALIDATES
Short-Description:L1I Cacheline Invalidates
Description:
A cache line in the Level-1 I-Cache has been invalidated by a store on
the same CPU as the Level-1 I-Cache
.
Counter: 138 Name:ITLB1_WRITES
Short-Description:ITLB1 Writes
Description:
A translation entry has been written into the Level-1 Instruction
Translation Lookaside Buffer
.
Counter: 139 Name:DTLB1_WRITES
Short-Description:DTLB1 Writes
Description:
A translation entry has been written to the Level-1 Data Translation
Lookaside Buffer
.
Counter: 140 Name:TLB2_PTE_WRITES
Short-Description:TLB2 PTE Writes
Description:
A translation entry has been written to the Level-2 TLB Page Table
Entry arrays
.
Counter: 141 Name:TLB2_CRSTE_WRITES
Short-Description:TLB2 CRSTE Writes
Description:
A translation entry has been written to the Level-2 TLB Common Region
Segment Table Entry arrays
.
Counter: 142 Name:TLB2_CRSTE_HPAGE_WRITES
Short-Description:TLB2 CRSTE One-Megabyte Page Writes
Description:
A translation entry has been written to the Level-2 TLB Common Region
Segment Table Entry arrays for a one-megabyte large page translation
.
Counter: 145 Name:ITLB1_MISSES
Short-Description:ITLB1 Misses
Description:
Level-1 Instruction TLB miss in progress. Incremented by one for every
cycle an ITLB1 miss is in progress
.
Counter: 146 Name:DTLB1_MISSES
Short-Description:DTLB1 Misses
Description:
Level-1 Data TLB miss in progress. Incremented by one for every cycle
an DTLB1 miss is in progress
.
Counter: 147 Name:L2C_STORES_SENT
Short-Description:L2C Stores Sent
Description:
Incremented by one for every store sent to Level-2 (L1.5) cache
.

View File

@@ -16,288 +16,343 @@
#
# Extended Counter Set
# ---------------------------------------------------------------------
Counter:128 Name:L1D_WRITES_RO_EXCL
Counter:128 Name:L1D_RO_EXCL_WRITES
Short-Description:L1D Read-only Exclusive Writes
Description:
A directory write to the Level-1 Data cache where the line was
originally in a Read-Only state in the cache but has been updated
to be in the Exclusive state that allows stores to the cache line.
.
Counter:129 Name:DTLB1_WRITES
Short-Description:DTLB1 Writes
Description:
A translation entry has been written to the Level-1 Data Translation
Lookaside Buffer
.
Counter:130 Name:DTLB1_MISSES
Short-Description:DTLB1 Misses
Description:
Level-1 Data TLB miss in progress. Incremented by one for every cycle
a DTLB1 miss is in progress.
.
Counter:131 Name:DTLB1_HPAGE_WRITES
Short-Description:DTLB1 One-Megabyte Page Writes
Description:
A translation entry has been written to the Level-1 Data Translation
Lookaside Buffer for a one-megabyte page
.
Counter:132 Name:DTLB1_GPAGE_WRITES
Short-Description:DTLB1 Two-Gigabyte Page Writes
A translation entry has been written to the Level-1 Data Translation
Lookaside Buffer for a two-gigabyte page.
.
Counter:133 Name:L1D_L2D_SOURCED_WRITES
Short-Description:L1D L2D Sourced Writes
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from the Level-2 Data cache
.
Counter:134 Name:ITLB1_WRITES
Short-Description:ITLB1 Writes
Description:
A translation entry has been written to the Level-1 Instruction
Translation Lookaside Buffer
.
Counter:135 Name:ITLB1_MISSES
Short-Description:ITLB1 Misses
Description:
Level-1 Instruction TLB miss in progress. Incremented by one for every
cycle an ITLB1 miss is in progress
.
Counter:136 Name:L1I_L2I_SOURCED_WRITES
Short-Description:L1I L2I Sourced Writes
Description:
A directory write to the Level-1 Instruction cache directory where the
returned cache line was sourced from the Level-2 Instruction cache
.
Counter:137 Name:TLB2_PTE_WRITES
Short-Description:TLB2 PTE Writes
Description:
A translation entry has been written to the Level-2 TLB Page Table
Entry arrays
.
Counter:138 Name:TLB2_CRSTE_HPAGE_WRITES
Short-Description:TLB2 CRSTE One-Megabyte Page Writes
Description:
A translation entry has been written to the Level-2 TLB Combined Region
Segment Table Entry arrays for a one-megabyte large page translation
.
Counter:139 Name:TLB2_CRSTE_WRITES
Short-Description:TLB2 CRSTE Writes
Description:
A translation entry has been written to the Level-2 TLB Combined Region
Segment Table Entry arrays
.
Counter:140 Name:TX_C_TEND
Short-Description:Completed TEND instructions in constrained TX mode
Description:
A TEND instruction has completed in a constrained transactional-execution
mode
.
Counter:141 Name:TX_NC_TEND
Short-Description:Completed TEND instructions in non-constrained TX mode
Description:
A TEND instruction has completed in a non-constrained
transactional-execution mode
.
Counter:143 Name:L1C_TLB1_MISSES
Short-Description:L1C TLB1 Misses
Description:
Increments by one for any cycle where a Level-1 cache or Level-1 TLB miss
is in progress.
.
Counter:144 Name:L1D_ONCHIP_L3_SOURCED_WRITES
Short-Description:L1D On-Chip L3 Sourced Writes
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from an On-Chip Level-3 cache without intervention
.
Counter:145 Name:L1D_ONCHIP_L3_SOURCED_WRITES_IV
Short-Description:L1D On-Chip L3 Sourced Writes with Intervention
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from an On-Chip Level-3 cache with intervention
.
Counter:146 Name:L1D_ONNODE_L4_SOURCED_WRITES
Short-Description:L1D On-Node L4 Sourced Writes
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from an On-Node Level-4 cache
.
Counter:147 Name:L1D_ONNODE_L3_SOURCED_WRITES_IV
Short-Description:L1D On-Node L3 Sourced Writes with Intervention
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from an On-Node Level-3 cache with intervention
.
Counter:148 Name:L1D_ONNODE_L3_SOURCED_WRITES
Short-Description:L1D On-Node L3 Sourced Writes
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from an On-Node Level-3 cache without intervention
.
Counter:149 Name:L1D_ONDRAWER_L4_SOURCED_WRITES
Short-Description:L1D On-Drawer L4 Sourced Writes
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from an On-Drawer Level-4 cache
.
Counter:150 Name:L1D_ONDRAWER_L3_SOURCED_WRITES_IV
Short-Description:L1D On-Drawer L3 Sourced Writes with Intervention
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from an On-Drawer Level-3 cache with intervention
.
Counter:151 Name:L1D_ONDRAWER_L3_SOURCED_WRITES
Short-Description:L1D On-Drawer L3 Sourced Writes
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from an On-Drawer Level-3 cache without intervention
.
Counter:152 Name:L1D_OFFDRAWER_SCOL_L4_SOURCED_WRITES
Short-Description:L1D Off-Drawer Same-Column L4 Sourced Writes
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from an Off-Drawer Same-Column Level-4 cache
.
Counter:153 Name:L1D_OFFDRAWER_SCOL_L3_SOURCED_WRITES_IV
Short-Description:L1D Off-Drawer Same-Column L3 Sourced Writes with Intervention
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from an Off-Drawer Same-Column Level-3 cache with
intervention
.
Counter:154 Name:L1D_OFFDRAWER_SCOL_L3_SOURCED_WRITES
Short-Description:L1D Off-Drawer Same-Column L3 Sourced Writes
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from an Off-Drawer Same-Column Level-3 cache
without intervention
.
Counter:155 Name:L1D_OFFDRAWER_FCOL_L4_SOURCED_WRITES
Short-Description:L1D Off-Drawer Far-Column L3 Sourced Writes
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from an Off-Drawer Far-Column Level-4 cache
.
Counter:156 Name:L1D_OFFDRAWER_FCOL_L3_SOURCED_WRITES_IV
Short-Description:L1D Off-Drawer Far-Column L3 Sourced Writes with Intervention
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from an Off-Drawer Far-Column Level-3 cache with
intervention
.
Counter:157 Name:L1D_OFFDRAWER_FCOL_L3_SOURCED_WRITES
Short-Description:L1D Off-Drawer Far-Column L3 Sourced Writes
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from an Off-Drawer Far-Column Level-3 cache
without intervention
.
Counter:158 Name:L1D_ONNODE_MEM_SOURCED_WRITES
Short-Description:L1D On-Node Memory Sourced Writes
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from On-Node memory
.
Counter:159 Name:L1D_ONDRAWER_MEM_SOURCED_WRITES
Short-Description:L1D On-Drawer Memory Sourced Writes
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from On-Drawer memory
.
Counter:160 Name:L1D_OFFDRAWER_MEM_SOURCED_WRITES
Short-Description:L1D Off-Drawer Memory Sourced Writes
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from On-Drawer memory
.
Counter:161 Name:L1D_ONCHIP_MEM_SOURCED_WRITES
Short-Description:L1D On-Chip Memory Sourced Writes
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from On-Chip memory
.
Counter:162 Name:L1I_ONCHIP_L3_SOURCED_WRITES
Short-Description:L1I On-Chip L3 Sourced Writes
Description:
A directory write to the Level-1 Instruction cache directory where the
returned cache line was sourced from an On-Chip Level-3 cache without
intervention
.
Counter:163 Name:L1I_ONCHIP_L3_SOURCED_WRITES_IV
Short-Description:L1I On-Chip L3 Sourced Writes with Intervention
Description:
A directory write to the Level-1 Instruction cache directory where the
returned cache line was sourced from an On Chip Level-3 cache with
intervention
.
Counter:164 Name:L1I_ONNODE_L4_SOURCED_WRITES
Short-Description:L1I On-Chip L4 Sourced Writes
Description:
A directory write to the Level-1 Instruction cache directory where the
returned cache line was sourced from an On-Node Level-4 cache
.
Counter:165 Name:L1I_ONNODE_L3_SOURCED_WRITES_IV
Short-Description:L1I On-Node L3 Sourced Writes with Intervention
Description:
A directory write to the Level-1 Instruction cache directory where
the returned cache line was sourced from an On-Node Level-3 cache
with intervention
.
Counter:166 Name:L1I_ONNODE_L3_SOURCED_WRITES
Short-Description:L1I On-Node L3 Sourced Writes
Description:
A directory write to the Level-1 Instruction cache directory where
the returned cache line was sourced from an On-Node Level-3 cache
without intervention
.
Counter:167 Name:L1I_ONDRAWER_L4_SOURCED_WRITES
Short-Description:L1I On-Drawer L4 Sourced Writes
Description:
A directory write to the Level-1 Instruction cache directory where
the returned cache line was sourced from an On-Drawer Level-4 cache
.
Counter:168 Name:L1I_ONDRAWER_L3_SOURCED_WRITES_IV
Short-Description:L1I On-Drawer L3 Sourced Writes with Intervention
Description:
A directory write to the Level-1 Instruction cache directory where
the returned cache line was sourced from an On-Drawer Level-3 cache
with intervention
.
Counter:169 Name:L1I_ONDRAWER_L3_SOURCED_WRITES
Short-Description:L1I On-Drawer L3 Sourced Writes
Description:
A directory write to the Level-1 Instruction cache directory where
the returned cache line was sourced from an On-Drawer Level-3 cache
without intervention
.
Counter:170 Name:L1I_OFFDRAWER_SCOL_L4_SOURCED_WRITES
Short-Description:L1I Off-Drawer Same-Column L4 Sourced Writes
Description:
A directory write to the Level-1 Instruction cache directory where
the returned cache line was sourced from an Off-Drawer Same-Column
Level-4 cache
.
Counter:171 Name:L1I_OFFDRAWER_SCOL_L3_SOURCED_WRITES_IV
Short-Description:L1I Off-Drawer Same-Column L3 Sourced Writes with Intervention
Description:
A directory write to the Level-1 Instruction cache directory where
the returned cache line was sourced from an Off-Drawer Same-Column
Level-3 cache with intervention
.
Counter:172 Name:L1I_OFFDRAWER_SCOL_L3_SOURCED_WRITES
Short-Description:L1I Off-Drawer Same-Column L3 Sourced Writes
Description:
A directory write to the Level-1 Instruction cache directory where
the returned cache line was sourced from an Off-Drawer Same-Column
Level-3 cache without intervention
.
Counter:173 Name:L1I_OFFDRAWER_FCOL_L4_SOURCED_WRITES
Short-Description:L1I Off-Drawer Far-Column L4 Sourced Writes
Description:
A directory write to the Level-1 Instruction cache directory where
the returned cache line was sourced from an Off-Drawer Far-Column
Level-4 cache
.
Counter:174 Name:L1I_OFFDRAWER_FCOL_L3_SOURCED_WRITES_IV
Short-Description:L1I Off-Drawer Far-Column L3 Sourced Writes with Intervention
Description:
A directory write to the Level-1 Instruction cache directory where
the returned cache line was sourced from an Off-Drawer Far-Column
Level-3 cache with intervention
.
Counter:175 Name:L1I_OFFDRAWER_FCOL_L3_SOURCED_WRITES
Short-Description:L1I Off-Drawer Far-Column L3 Sourced Writes
Description:
A directory write to the Level-1 Instruction cache directory where
the returned cache line was sourced from an Off-Drawer Far-Column
Level-3 cache without intervention
.
Counter:176 Name:L1I_ONNODE_MEM_SOURCED_WRITES
Short-Description:L1I On-Node Memory Sourced Writes
Description:
A directory write to the Level-1 Instruction cache directory where
the returned cache line was sourced from On-Node memory
.
Counter:177 Name:L1I_ONDRAWER_MEM_SOURCED_WRITES
Short-Description:L1I On-Drawer Memory Sourced Writes
Description:
A directory write to the Level-1 Instruction cache directory where
the returned cache line was sourced from On-Drawer memory
.
Counter:178 Name:L1I_OFFDRAWER_MEM_SOURCED_WRITES
Short-Description:L1I Off-Drawer Memory Sourced Writes
Description:
A directory write to the Level-1 Instruction cache directory where
the returned cache line was sourced from On-Drawer memory
.
Counter:179 Name:L1I_ONCHIP_MEM_SOURCED_WRITES
Short-Description:L1I On-Chip Memory Sourced Writes
Description:
A directory write to the Level-1 Instruction cache directory where
the returned cache line was sourced from On-Chip memory
.
Counter:218 Name:TX_NC_TABORT
Short-Description:Aborted transactions in non-constrained TX mode
Description:
A transaction abort has occurred in a non-constrained
transactional-execution mode
.
Counter:219 Name:TX_C_TABORT_NO_SPECIAL
Short-Description:Aborted transactions in constrained TX mode not using special completion logic
Description:
A transaction abort has occurred in a constrained transactional-execution
mode and the CPU is not using any special logic to allow the transaction
to complete
.
Counter:220 Name:TX_C_TABORT_SPECIAL
Short-Description:Aborted transactions in constrained TX mode using special completion logic
Description:
A transaction abort has occurred in a constrained transactional-execution
mode and the CPU is using special logic to allow the transaction to
@@ -307,10 +362,12 @@ complete
# MT-diagnostic counter set
# ---------------------------------------------------------------------
Counter:448 Name:MT_DIAG_CYCLES_ONE_THR_ACTIVE
Short-Description:Cycle count with one thread active
Description:
Cycle count with one thread active
.
Counter:449 Name:MT_DIAG_CYCLES_TWO_THR_ACTIVE
Short-Description:Cycle count with two threads active
Description:
Cycle count with two threads active
.

View File

@@ -19,272 +19,324 @@
#
# Extended Counter Set
# ---------------------------------------------------------------------
Counter:128 Name:L1D_WRITES_RO_EXCL
Counter:128 Name:L1D_RO_EXCL_WRITES
Short-Description:L1D Read-only Exclusive Writes
Description:
A directory write to the Level-1 Data cache where the line was
originally in a Read-Only state in the cache but has been updated
to be in the Exclusive state that allows stores to the cache line
.
Counter:129 Name:DTLB2_WRITES
Short-Description:DTLB2 Writes
Description:
A translation has been written into The Translation Lookaside
Buffer 2 (TLB2) and the request was made by the data cache
.
Counter:130 Name:DTLB2_MISSES
Short-Description:DTLB2 Misses
Description:
A TLB2 miss is in progress for a request made by the data cache.
Incremented by one for every TLB2 miss in progress for the Level-1
Data cache on this cycle
.
Counter:131 Name:DTLB2_HPAGE_WRITES
Short-Description:DTLB2 One-Megabyte Page Writes
Description:
A translation entry was written into the Combined Region and Segment
Table Entry array in the Level-2 TLB for a one-megabyte page or a
Last Host Translation was done
.
Counter:132 Name:DTLB2_GPAGE_WRITES
Short-Description:DTLB2 Two-Gigabyte Page Writes
Description:
A translation entry for a two-gigabyte page was written into the
Level-2 TLB
.
Counter:133 Name:L1D_L2D_SOURCED_WRITES
Short-Description:L1D L2D Sourced Writes
Description:
A directory write to the Level-1 Data cache directory where the
returned cache line was sourced from the Level-2 Data cache
.
Counter:134 Name:ITLB2_WRITES
Short-Description:ITLB2 Writes
Description:
A translation entry has been written into the Translation Lookaside
Buffer 2 (TLB2) and the request was made by the instruction cache
.
Counter:135 Name:ITLB2_MISSES
Short-Description:ITLB2 Misses
Description:
A TLB2 miss is in progress for a request made by the instruction cache.
Incremented by one for every TLB2 miss in progress for the Level-1
Instruction cache in a cycle
.
Counter:136 Name:L1I_L2I_SOURCED_WRITES
Short-Description:L1I L2I Sourced Writes
Description:
A directory write to the Level-1 Instruction cache directory where the
returned cache line was sourced from the Level-2 Instruction cache
.
Counter:137 Name:TLB2_PTE_WRITES
Short-Description:TLB2 PTE Writes
Description:
A translation entry was written into the Page Table Entry array in the
Level-2 TLB
.
Counter:138 Name:TLB2_CRSTE_WRITES
Short-Description:TLB2 CRSTE Writes
Description:
Translation entries were written into the Combined Region and Segment
Table Entry array and the Page Table Entry array in the Level-2 TLB
.
Counter:139 Name:TLB2_ENGINES_BUSY
Short-Description:TLB2 Engines Busy
Description:
The number of Level-2 TLB translation engines busy in a cycle
.
Counter:140 Name:TX_C_TEND
Short-Description:Completed TEND instructions in constrained TX mode
Description:
A TEND instruction has completed in a constrained transactional-execution
mode
.
Counter:141 Name:TX_NC_TEND
Short-Description:Completed TEND instructions in non-constrained TX mode
Description:
A TEND instruction has completed in a non-constrained
transactional-execution mode
.
Counter:143 Name:L1C_TLB2_MISSES
Short-Description:L1C TLB2 Misses
Description:
Increments by one for any cycle where a level-1 cache or level-2 TLB miss
is in progress
.
Counter:144 Name:L1D_ONCHIP_L3_SOURCED_WRITES
Short-Description:L1D On-Chip L3 Sourced Writes
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from an On-Chip Level-3 cache without intervention
.
Counter:145 Name:L1D_ONCHIP_MEMORY_SOURCED_WRITES
Short-Description:L1D On-Chip Memory Sourced Writes
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from On-Chip memory
.
Counter:146 Name:L1D_ONCHIP_L3_SOURCED_WRITES_IV
Short-Description:L1D On-Chip L3 Sourced Writes with Intervention
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from an On-Chip Level-3 cache with intervention
.
Counter:147 Name:L1D_ONCLUSTER_L3_SOURCED_WRITES
Short-Description:L1D On-Cluster L3 Sourced Writes
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from On-Cluster Level-3 cache withountervention
.
Counter:148 Name:L1D_ONCLUSTER_MEMORY_SOURCED_WRITES
Short-Description:L1D On-Cluster Memory Sourced Writes
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from an On-Cluster memory
.
Counter:149 Name:L1D_ONCLUSTER_L3_SOURCED_WRITES_IV
Short-Description:L1D On-Cluster L3 Sourced Writes with Intervention
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from an On-Cluster Level-3 cache with intervention
.
Counter:150 Name:L1D_OFFCLUSTER_L3_SOURCED_WRITES
Short-Description:L1D Off-Cluster L3 Sourced Writes
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from an Off-Cluster Level-3 cache without
intervention
.
Counter:151 Name:L1D_OFFCLUSTER_MEMORY_SOURCED_WRITES
Short-Description:L1D Off-Cluster Memory Sourced Writes
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from Off-Cluster memory
.
Counter:152 Name:L1D_OFFCLUSTER_L3_SOURCED_WRITES_IV
Short-Description:L1D Off-Cluster L3 Sourced Writes with Intervention
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from an Off-Cluster Level-3 cache with intervention
.
Counter:153 Name:L1D_OFFDRAWER_L3_SOURCED_WRITES
Short-Description:L1D Off-Drawer L3 Sourced Writes
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from an Off-Drawer Level-3 cache without
intervention
.
Counter:154 Name:L1D_OFFDRAWER_MEMORY_SOURCED_WRITES
Short-Description:L1D Off-Drawer Memory Sourced Writes
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from Off-Drawer memory
.
Counter:155 Name:L1D_OFFDRAWER_L3_SOURCED_WRITES_IV
Short-Description:L1D Off-Drawer L3 Sourced Writes with Intervention
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from an Off-Drawer Level-3 cache with intervention
.
Counter:156 Name:L1D_ONDRAWER_L4_SOURCED_WRITES
Short-Description:L1D On-Drawer L4 Sourced Writes
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from On-Drawer Level-4 cache
.
Counter:157 Name:L1D_OFFDRAWER_L4_SOURCED_WRITES
Short-Description:L1D Off-Drawer L4 Sourced Writes
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from Off-Drawer Level-4 cache
.
Counter:158 Name:L1D_ONCHIP_L3_SOURCED_WRITES_RO
Short-Description:L1D On-Chip L3 Sourced Writes read-only
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from On-Chip L3 but a read-only invalidate was
done to remove other copies of the cache line
.
Counter:162 Name:L1I_ONCHIP_L3_SOURCED_WRITES
Short-Description:L1I On-Chip L3 Sourced Writes
Description:
A directory write to the Level-1 Instruction cache directory where the
returned cache ine was sourced from an On-Chip Level-3 cache without
intervention
.
Counter:163 Name:L1I_ONCHIP_MEMORY_SOURCED_WRITES
Short-Description:L1I On-Chip Memory Sourced Writes
Description:
A directory write to the Level-1 Instruction cache directory where the
returned cache ine was sourced from On-Chip memory
.
Counter:164 Name:L1I_ONCHIP_L3_SOURCED_WRITES_IV
Short-Description:L1I On-Chip L3 Sourced Writes with Intervention
Description:
A directory write to the Level-1 Instruction cache directory where the
returned cache ine was sourced from an On-Chip Level-3 cache with
intervention
.
Counter:165 Name:L1I_ONCLUSTER_L3_SOURCED_WRITES
Short-Description:L1I On-Cluster L3 Sourced Writes
Description:
A directory write to the Level-1 Instruction cache directory where the
returned cache line was sourced from an On-Cluster Level-3 cache without
intervention
.
Counter:166 Name:L1I_ONCLUSTER_MEMORY_SOURCED_WRITES
Short-Description:L1I On-Cluster Memory Sourced Writes
Description:
A directory write to the Level-1 Instruction cache directory where the
returned cache line was sourced from an On-Cluster memory
.
Counter:167 Name:L1I_ONCLUSTER_L3_SOURCED_WRITES_IV
Short-Description:L1I On-Cluster L3 Sourced Writes with Intervention
Description:
A directory write to the Level-1 Instruction cache directory where the
returned cache line was sourced from On-Cluster Level-3 cache with
intervention
.
Counter:168 Name:L1I_OFFCLUSTER_L3_SOURCED_WRITES
Short-Description:L1I Off-Cluster L3 Sourced Writes
Description:
A directory write to the Level-1 Instruction cache directory where the
returned cache line was sourced from an Off-Cluster Level-3 cache without
intervention
.
Counter:169 Name:L1I_OFFCLUSTER_MEMORY_SOURCED_WRITES
Short-Description:L1I Off-Cluster Memory Sourced Writes
Description:
A directory write to the Level-1 Instruction cache directory where the
returned cache line was sourced from Off-Cluster memory
.
Counter:170 Name:L1I_OFFCLUSTER_L3_SOURCED_WRITES_IV
Short-Description:L1I Off-Cluster L3 Sourced Writes with Intervention
Description:
A directory write to the Level-1 Instruction cache directory where the
returned cache line was sourced from an Off-Cluster Level-3 cache with
intervention
.
Counter:171 Name:L1I_OFFDRAWER_L3_SOURCED_WRITES
Short-Description:L1I Off-Drawer L3 Sourced Writes
Description:
A directory write to the Level-1 Instruction cache directory where the
returned cache line was sourced from an Off-Drawer Level-3 cache without
intervention
.
Counter:172 Name:L1I_OFFDRAWER_MEMORY_SOURCED_WRITES
Short-Description:L1I Off-Drawer Memory Sourced Writes
Description:
A directory write to the Level-1 Instruction cache directory where the
returned cache line was sourced from Off-Drawer memory
.
Counter:173 Name:L1I_OFFDRAWER_L3_SOURCED_WRITES_IV
Short-Description:L1I Off-Drawer L3 Sourced Writes with Intervention
Description:
A directory write to the Level-1 Instruction cache directory where the
returned cache line was sourced from an Off-Drawer Level-3 cache with
intervention
.
Counter:174 Name:L1I_ONDRAWER_L4_SOURCED_WRITES
Short-Description:L1I On-Drawer L4 Sourced Writes
Description:
A directory write to the Level-1 Instruction cache directory where the
returned cache line was sourced from On-Drawer Level-4 cache
.
Counter:175 Name:L1I_OFFDRAWER_L4_SOURCED_WRITES
Short-Description:L1I Off-Drawer L4 Sourced Writes
Description:
A directory write to the Level-1 Instruction cache directory where the
returned cache line was sourced from Off-Drawer Level-4 cache
.
Counter:224 Name:BCD_DFP_EXECUTION_SLOTS
Short-Description:BCD DFP Execution Slots
Description:
Count of floating point execution slots used for finished Binary Coded
Decimal to Decimal Floating Point conversions. Instructions: CDZT,
CXZT, CZDT, CZXT
.
Counter:225 Name:VX_BCD_EXECUTION_SLOTS
Short-Description:VX BCD Execution Slots
Description:
Count of floating point execution slots used for finished vector arithmetic
Binary Coded Decimal instructions. Instructions: VAP, VSP, VMPVMSP, VDP,
VSDP, VRP, VLIP, VSRP, VPSOPVCP, VTP, VPKZ, VUPKZ, VCVB, VCVBG, VCVDVCVDG
.
Counter:226 Name:DECIMAL_INSTRUCTIONS
Short-Description:Decimal Instructions
Description:
Decimal instructions dispatched. Instructions: CVB, CVD, AP, CP, DP, ED,
EDMK, MP, SRP, SP, ZAP
.
Counter:232 Name:LAST_HOST_TRANSLATIONS
Short-Description:Last host translation done
Description:
Last Host Translation done
.
Counter:243 Name:TX_NC_TABORT
Short-Description:Aborted transactions in non-constrained TX mode
Description:
A transaction abort has occurred in a non-constrained
transactional-execution mode
.
Counter:244 Name:TX_C_TABORT_NO_SPECIAL
Short-Description:Aborted transactions in constrained TX mode not using special completion logic
Description:
A transaction abort has occurred in a constrained transactional-execution
mode and the CPU is not using any special logic to allow the transaction
to complete
.
Counter:245 Name:TX_C_TABORT_SPECIAL
Short-Description:Aborted transactions in constrained TX mode using special completion logic
Description:
A transaction abort has occurred in a constrained transactional-execution
mode and the CPU is using special logic to allow the transaction to
@@ -294,10 +346,12 @@ complete
# MT-diagnostic counter set
# ---------------------------------------------------------------------
Counter:448 Name:MT_DIAG_CYCLES_ONE_THR_ACTIVE
Short-Description:Cycle count with one thread active
Description:
Cycle count with one thread active
.
Counter:449 Name:MT_DIAG_CYCLES_TWO_THR_ACTIVE
Short-Description:Cycle count with two threads active
Description:
Cycle count with two threads active
.

View File

@@ -1,121 +1,145 @@
Counter: 128 Name:L1D_L2_SOURCED_WRITES
Short-Description:L1D L2 Sourced Writes
Description:
A directory write to the Level-1 D-Cache directory where the returned
cache line was sourced from the Level-2 cache
.
Counter: 129 Name:L1I_L2_SOURCED_WRITES
Short-Description:L1I L2 Sourced Writes
Description:
A directory write to the Level-1 I-Cache directory where the returned
cache line was sourced from the Level-2 cache
.
Counter: 130 Name:DTLB1_MISSES
Short-Description:DTLB1 Misses
Description:
Level-1 Data TLB miss in progress. Incremented by one for every cycle
a DTLB1 miss is in progress.
.
Counter: 131 Name:ITLB1_MISSES
Short-Description:ITLB1 Misses
Description:
Level-1 Instruction TLB miss in progress. Incremented by one for every
cycle a ITLB1 miss is in progress.
.
Counter: 133 Name:L2C_STORES_SENT
Short-Description:L2C Stores Sent
Description:
Incremented by one for every store sent to Level-2 cache
.
Counter: 134 Name:L1D_OFFBOOK_L3_SOURCED_WRITES
Short-Description:L1D Off-Book L3 Sourced Writes
Description:
A directory write to the Level-1 D-Cache directory where the returned
cache line was sourced from an Off Book Level-3 cache
.
Counter: 135 Name:L1D_ONBOOK_L4_SOURCED_WRITES
Short-Description:L1D On-Book L4 Sourced Writes
Description:
A directory write to the Level-1 D-Cache directory where the returned
cache line was sourced from an On Book Level-4 cache
.
Counter: 136 Name:L1I_ONBOOK_L4_SOURCED_WRITES
Short-Description:L1I On-Book L4 Sourced Writes
Description:
A directory write to the Level-1 I-Cache directory where the returned
cache line was sourced from an On Book Level-4 cache
.
Counter: 137 Name:L1D_RO_EXCL_WRITES
Short-Description:L1D Read-only Exclusive Writes
Description:
A directory write to the Level-1 D-Cache where the line was originally
in a Read-Only state in the cache but has been updated to be in the
Exclusive state that allows stores to the cache line
.
Counter: 138 Name:L1D_OFFBOOK_L4_SOURCED_WRITES
Short-Description:L1D Off-Book L4 Sourced Writes
Description:
A directory write to the Level-1 D-Cache directory where the returned
cache line was sourced from an Off Book Level-4 cache
.
Counter: 139 Name:L1I_OFFBOOK_L4_SOURCED_WRITES
Short-Description:L1I Off-Book L4 Sourced Writes
Description:
A directory write to the Level-1 I-Cache directory where the returned
cache line was sourced from an Off Book Level-4 cache
.
Counter: 140 Name:DTLB1_HPAGE_WRITES
Short-Description:DTLB1 One-Megabyte Page Writes
Description:
A translation entry has been written to the Level-1 Data Translation
Lookaside Buffer for a one-megabyte page
.
Counter: 141 Name:L1D_LMEM_SOURCED_WRITES
Short-Description:L1D Local Memory Sourced Writes
Description:
A directory write to the Level-1 D-Cache where the installed cache line
was sourced from memory that is attached to the same book as the Data
cache (Local Memory)
.
Counter: 142 Name:L1I_LMEM_SOURCED_WRITES
Short-Description:L1I Local Memory Sourced Writes
Description:
A directory write to the Level-1 I-Cache where the installed cache
line was sourced from memory that is attached to the same book as the
Instruction cache (Local Memory)
.
Counter: 143 Name:L1I_OFFBOOK_L3_SOURCED_WRITES
Short-Description:L1I Off-Book L3 Sourced Writes
Description:
A directory write to the Level-1 I-Cache directory where the returned
cache line was sourced from an Off Book Level-3 cache
.
Counter: 144 Name:DTLB1_WRITES
Short-Description:DTLB1 Writes
Description:
A translation entry has been written to the Level-1 Data Translation
Lookaside Buffer
.
Counter: 145 Name:ITLB1_WRITES
Short-Description:ITLB1 Writes
Description:
A translation entry has been written to the Level-1 Instruction
Translation Lookaside Buffer
.
Counter: 146 Name:TLB2_PTE_WRITES
Short-Description:TLB2 PTE Writes
Description:
A translation entry has been written to the Level-2 TLB Page Table
Entry arrays
.
Counter: 147 Name:TLB2_CRSTE_HPAGE_WRITES
Short-Description:TLB2 CRSTE One-Megabyte Page Writes
Description:
A translation entry has been written to the Level-2 TLB Common Region
Segment Table Entry arrays for a one-megabyte large page translation
.
Counter: 148 Name:TLB2_CRSTE_WRITES
Short-Description:TLB2 CRSTE Writes
Description:
A translation entry has been written to the Level-2 TLB Common Region
Segment Table Entry arrays
.
Counter: 150 Name:L1D_ONCHIP_L3_SOURCED_WRITES
Short-Description:L1D On-Chip L3 Sourced Writes
Description:
A directory write to the Level-1 D-Cache directory where the returned
cache line was sourced from an On Chip Level-3 cache
.
Counter: 152 Name:L1D_OFFCHIP_L3_SOURCED_WRITES
Short-Description:L1D Off-Chip L3 Sourced Writes
Description:
A directory write to the Level-1 D-Cache directory where the returned
cache line was sourced from an Off Chip/On Book Level-3 cache
.
Counter: 153 Name:L1I_ONCHIP_L3_SOURCED_WRITES
Short-Description:L1I On-Chip L3 Sourced Writes
Description:
A directory write to the Level-1 I-Cache directory where the returned
cache line was sourced from an On Chip Level-3 cache
.
Counter: 155 Name:L1I_OFFCHIP_L3_SOURCED_WRITES
Short-Description:L1I Off-Chip L3 Sourced Writes
Description:
A directory write to the Level-1 I-Cache directory where the returned
cache line was sourced from an Off Chip/On Book Level-3 cache

View File

@@ -1,98 +1,117 @@
Counter: 128 Name:DTLB1_MISSES
Short-Description:DTLB1 Misses
Description:
Level-1 Data TLB miss in progress. Incremented by one for every cycle
a DTLB1 miss is in progress.
.
Counter:129 Name:ITLB1_MISSES
Short-Description:ITLB1 Misses
Description:
Level-1 Instruction TLB miss in progress. Incremented by one for every
cycle a ITLB1 miss is in progress.
.
Counter:130 Name:L1D_L2I_SOURCED_WRITES
Short-Description:L1D L2I Sourced Writes
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from the Level-2 Instruction cache
.
Counter:131 Name:L1I_L2I_SOURCED_WRITES
Short-Description:L1I L2I Sourced Writes
Description:
A directory write to the Level-1 Instruction cache directory where the
returned cache line was sourced from the Level-2 Instruction cache
.
Counter:132 Name:L1D_L2D_SOURCED_WRITES
Short-Description:L1D L2D Sourced Writes
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from the Level-2 Data cache
.
Counter:133 Name:DTLB1_WRITES
Short-Description:DTLB1 Writes
Description:
A translation entry has been written to the Level-1 Data Translation
Lookaside Buffer
.
Counter:135 Name:L1D_LMEM_SOURCED_WRITES
Short-Description:L1D Local Memory Sourced Writes
Description:
A directory write to the Level-1 Data cache where the installed cache line
was sourced from memory that is attached to the same book as the Data
cache (Local Memory)
.
Counter:137 Name:L1I_LMEM_SOURCED_WRITES
Short-Description:L1I Local Memory Sourced Writes
Description:
A directory write to the Level-1 Instruction cache where the installed cache
line was sourced from memory that is attached to the same book as the
Instruction cache (Local Memory)
.
Counter:138 Name:L1D_RO_EXCL_WRITES
Short-Description:L1D Read-only Exclusive Writes
Description:
A directory write to the Level-1 D-Cache where the line was originally
in a Read-Only state in the cache but has been updated to be in the
Exclusive state that allows stores to the cache line
.
Counter:139 Name:DTLB1_HPAGE_WRITES
Short-Description:DTLB1 One-Megabyte Page Writes
Description:
A translation entry has been written to the Level-1 Data Translation
Lookaside Buffer for a one-megabyte page
.
Counter:140 Name:ITLB1_WRITES
Short-Description:ITLB1 Writes
Description:
A translation entry has been written to the Level-1 Instruction
Translation Lookaside Buffer
.
Counter:141 Name:TLB2_PTE_WRITES
Short-Description:TLB2 PTE Writes
Description:
A translation entry has been written to the Level-2 TLB Page Table
Entry arrays
.
Counter:142 Name:TLB2_CRSTE_HPAGE_WRITES
Short-Description:TLB2 CRSTE One-Megabyte Page Writes
Description:
A translation entry has been written to the Level-2 TLB Common Region
Segment Table Entry arrays for a one-megabyte large page translation
.
Counter:143 Name:TLB2_CRSTE_WRITES
Short-Description:TLB2 CRSTE Writes
Description:
A translation entry has been written to the Level-2 TLB Common Region
Segment Table Entry arrays
.
Counter:144 Name:L1D_ONCHIP_L3_SOURCED_WRITES
Short-Description:L1D On-Chip L3 Sourced Writes
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from an On Chip Level-3 cache without intervention
.
Counter:145 Name:L1D_OFFCHIP_L3_SOURCED_WRITES
Short-Description:L1D Off-Chip L3 Sourced Writes
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from an Off Chip/On Book Level-3 cache without
intervention
.
Counter:146 Name:L1D_OFFBOOK_L3_SOURCED_WRITES
Short-Description:L1D Off-Book L3 Sourced Writes
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from an Off Book Level-3 cache without intervention
.
Counter:147 Name:L1D_ONBOOK_L4_SOURCED_WRITES
Short-Description:L1D On-Book L4 Sourced Writes
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from an On Book Level-4 cache
.
Counter:148 Name:L1D_OFFBOOK_L4_SOURCED_WRITES
Short-Description:L1D Off-Book L4 Sourced Writes
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from an Off Book Level-4 cache
@@ -104,16 +123,19 @@ cache line was sourced from an Off Book Level-4 cache
# C .. constrained
#
Counter:149 Name:TX_NC_TEND
Short-Description:Completed TEND instructions in non-constrained TX mode
Description:
A TEND instruction has completed in a nonconstrained
transactional-execution mode
.
Counter:150 Name:L1D_ONCHIP_L3_SOURCED_WRITES_IV
Short-Description:L1D On-Chip L3 Sourced Writes with Intervention
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from a On Chip Level-3 cache with intervention
.
Counter:151 Name:L1D_OFFCHIP_L3_SOURCED_WRITES_IV
Short-Description:L1D Off-Chip L3 Sourced Writes with Intervention
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from an Off Chip/On Book Level-3 cache with
@@ -121,73 +143,86 @@ intervention
.
# XXX Remove SOURCED from L1D_OFFBOOK_L3_SOURCED_WRITES...
Counter:152 Name:L1D_OFFBOOK_L3_SOURCED_WRITES_IV
Short-Description:L1D Off-Book L3 Sourced Writes with Intervention
Description:
A directory write to the Level-1 Data cache directory where the returned
cache line was sourced from an Off Book Level-3 cache with intervention
.
Counter:153 Name:L1I_ONCHIP_L3_SOURCED_WRITES
Short-Description:L1I On-Chip L3 Sourced Writes
Description:
A directory write to the Level-1 Instruction cache directory where the
returned cache line was sourced from an On Chip Level-3 cache without
intervention
.
Counter:154 Name:L1I_OFFCHIP_L3_SOURCED_WRITES
Short-Description:L1I Off-Chip L3 Sourced Writes
Description:
A directory write to the Level-1 Instruction cache directory where the
returned cache line was sourced from an Off Chip/On Book Level-3 cache
without intervention
.
Counter:155 Name:L1I_OFFBOOK_L3_SOURCED_WRITES
Short-Description:L1I Off-Book L3 Sourced Writes
Description:
A directory write to the Level-1 Instruction cache directory where the
returned cache line was sourced from an Off Book Level-3 cache without
intervention
.
Counter:156 Name:L1I_ONBOOK_L4_SOURCED_WRITES
Short-Description:L1I On-Book L4 Sourced Writes
Description:
A directory write to the Level-1 Instruction cache directory where the
returned cache line was sourced from an On Book Level-4 cache
.
Counter:157 Name:L1I_OFFBOOK_L4_SOURCED_WRITES
Short-Description:L1I Off-Book L4 Sourced Writes
Description:
A directory write to the Level-1 Instruction cache directory where the
returned cache line was sourced from an Off Book Level-4 cache
.
Counter:158 Name:TX_C_TEND
Short-Description:Completed TEND instructions in constrained TX mode
Description:
A TEND instruction has completed in a constrained transactional-execution
mode
.
Counter:159 Name:L1I_ONCHIP_L3_SOURCED_WRITES_IV
Short-Description:L1I On-Chip L3 Sourced Writes with Intervention
Description:
A directory write to the Level-1 Instruction cache directory where the
returned cache line was sourced from an On Chip Level-3 cache with
intervention
.
Counter:160 Name:L1I_OFFCHIP_L3_SOURCED_WRITES_IV
Short-Description:L1I Off-Chip L3 Sourced Writes with Intervention
Description:
A directory write to the Level-1 Instruction cache directory where the
returned cache line was sourced from an Off Chip/On Book Level-3 cache
with intervention
.
Counter:161 Name:L1I_OFFBOOK_L3_SOURCED_WRITES_IV
Short-Description:L1I Off-Book L3 Sourced Writes with Intervention
Description:
A directory write to the Level-1 Instruction cache directory where the
returned cache line was sourced from an Off Book Level-3 cache with
intervention
.
Counter:177 Name:TX_NC_TABORT
Short-Description:Aborted transactions in non-constrained TX mode
Description:
A transaction abort has occurred in a nonconstrained
transactional-execution mode
.
Counter:178 Name:TX_C_TABORT_NO_SPECIAL
Short-Description:Aborted transactions in constrained TX mode not using special completion logic
Description:
A transaction abort has occurred in a constrained transactional-execution
mode and the CPU is not using any special logic to allow the transaction
to complete
.
Counter:179 Name:TX_C_TABORT_SPECIAL
Short-Description:Aborted transactions in constrained TX mode using special completion logic
Description:
A transaction abort has occurred in a constrained transactional-execution
mode and the CPU is using special logic to allow the transaction to

View File

@@ -26,4 +26,5 @@
2964 => 'cpum-cf-extended-z13.ctr',
2965 => 'cpum-cf-extended-z13.ctr',
3906 => 'cpum-cf-extended-z14.ctr',
3907 => 'cpum-cf-extended-z14.ctr',
};

View File

@@ -3,11 +3,13 @@
#
# Basic-sampling mode
Counter: 0xB0000 Name:SF_CYCLES_BASIC
Short-Description:Sample CPU Cycles Using Basic-sampling Mode
Description:
Sample CPU cycles using basic-sampling mode
.
# Diagnostic-sampling mode (includes basic-sampling)
Counter: 0xBD000 Name:SF_CYCLES_BASIC_DIAG
Short-Description:Sample CPU Cycle Using Diagnostic-sampling Mode (not for ordinary use)
Description:
Sample CPU cycle using diagnostic-sampling mode (not for ordinary use)
.

View File

@@ -7,7 +7,7 @@ LDLIBS += -lm
OBJECTS = daemon.o cpu.o info.o terms.o config.o main.o getopt.o mem.o
cpuplugd: $(OBJECTS)
$(LINK) $(ALL_LDFLAGS) $^ $(LOADLIBES) $(LDLIBS) -o $@
$(LINK) $(ALL_LDFLAGS) $^ $(LDLIBS) -o $@
clean:
rm -f cpuplugd $(OBJECTS)

View File

@@ -7,7 +7,7 @@ SUBSYSTEM!="block", GOTO="ra_end"
ACTION!="add", GOTO="ra_change"
# on device add set initial readahead to 512 (instead of in kernel 128)
KERNEL=="sd*[!0-9]", WAIT_FOR="queue/read_ahead_kb", ATTR{queue/read_ahead_kb}="512"
KERNEL=="sd*[!0-9]", TEST=="queue/read_ahead_kb", ATTR{queue/read_ahead_kb}="512"
LABEL="ra_change"

View File

@@ -821,10 +821,13 @@ static char *hmcdrv_parse_line(char *line, char *namebuf,
if ((*line != '\0') && (*line != '\n')) {
field = hmcdrv_parse_ntoken(field, line, &attr);
while ((*line != '\0') &&
(*line != '\n') &&
!isspace(*line))
while ((*line != '\0') && (*line != '\n')) {
if (isspace(*line))
break;
if (field == 1 && isdigit(*line))
break;
++line; /* search end of field */
}
}
} /* while */
@@ -1335,7 +1338,7 @@ static int hmcdrv_fuse_main(struct fuse_args *args)
*/
static void hmcdrv_fuse_usage(const char *progname)
{
fprintf(stderr,
fprintf(stdout,
"Usage: %s MOUNTPOINT [OPTIONS]\n\n"
"Use the %s command to read files from a HMC drive DVD.\n"
"\n"
@@ -1447,7 +1450,7 @@ static int hmcdrv_fuse_optproc(void *data, const char *arg,
return 1;
case HMCDRV_FUSE_OPTKEY_VERSION:
fprintf(stderr, HMCDRV_FUSE_LOGHEAD
fprintf(stdout, HMCDRV_FUSE_LOGHEAD
"HMC drive DVD file system, version %s\n"
"Copyright IBM Corp. 2015, 2017\n",
HMCDRV_FUSE_RELEASE);
@@ -1455,6 +1458,16 @@ static int hmcdrv_fuse_optproc(void *data, const char *arg,
case HMCDRV_FUSE_OPTKEY_HELP:
hmcdrv_fuse_usage(outargs->argv[0]);
/*
* Usage output needs to go to stdout to be consistent with
* coding guidelines. FUSE versions before 3.0.0 print help
* output to stderr. Redirect stderr to stdout here to enforce
* consistent behavior.
*/
fflush(stderr);
dup2(STDOUT_FILENO, STDERR_FILENO);
fuse_opt_add_arg(outargs, "-ho");
hmcdrv_fuse_main(outargs);
exit(EXIT_SUCCESS);

View File

@@ -42,6 +42,9 @@ static inline void util_ptr_vec_free(void **ptr_vec, int count)
{
int i;
if (!ptr_vec || count < 0)
return;
for (i = 0; i < count; i++)
free(ptr_vec[i]);
free(ptr_vec);

View File

@@ -14,6 +14,10 @@
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* Allocate memory or panic in case of failure
*
@@ -125,4 +129,10 @@ int __util_vsprintf(const char *func, const char *file, int line,
char *util_strcat_realloc(char *str1, const char *str2);
void util_str_toupper(char *str);
char *util_strstrip(char *s);
#ifdef __cplusplus
}
#endif
#endif /** LIB_UTIL_LIBC_H @} */

52
include/lib/vmcp.h Normal file
View File

@@ -0,0 +1,52 @@
/*
* vmcp - z/VM CP command library
*
* Copyright IBM Corp. 2005, 2018
*
* s390-tools is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
*/
#ifndef LIB_VMCP_H
#define LIB_VMCP_H
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
#define VMCP_DEVICE_NODE "/dev/vmcp" /* VMCP device name */
#define VMCP_DEFAULT_BUFSZ 0x4000 /* VMCP default buffer size */
/*
* Error codes returned by vmcp() function. This enables the caller
* to emit a detailed error message on the type of failure.
*/
#define VMCP_SUCCESS 0 /* VMCP operation completed successfully */
#define VMCP_ERR_OPEN (-1) /* Error Open of VMCP device */
#define VMCP_ERR_SETBUF (-2) /* Error VMCP_SETBUF ioctl */
#define VMCP_ERR_READ (-3) /* Error VMCP read system call */
#define VMCP_ERR_GETCODE (-4) /* Error VMCP_GETCODE ioctl */
#define VMCP_ERR_GETSIZE (-5) /* Error VMCP_GETSIZE ioctl */
#define VMCP_ERR_TOOSMALL (-6) /* Error VMCP buffer too small for
* response
*/
#define VMCP_ERR_WRITE (-7) /* Error VMCP write system call */
struct vmcp_parm {
const char *cpcmd;
unsigned int buffer_size;
bool do_upper;
int cprc;
char *response;
unsigned int response_size;
};
int vmcp(struct vmcp_parm *cp);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -6,7 +6,7 @@ objects = main.o ccw.o fcp.o system.o shutdown.o \
cmd_lsshut.o cmd_chshut.o cmd_lsreipl.o cmd_chreipl.o proc.o
chreipl: $(objects)
$(LINK) $(ALL_LDFLAGS) $^ $(LOADLIBES) $(LDLIBS) -o $@
$(LINK) $(ALL_LDFLAGS) $^ $(LDLIBS) -o $@
lsreipl:
ln -sf chreipl lsreipl

View File

@@ -445,7 +445,7 @@ static void set_target_type_auto(const char *arg)
{
char busid[10];
if (access(arg, R_OK) == 0) {
if (access(arg, F_OK) == 0) {
set_target_type(TT_NODE, 1);
return;
}
@@ -539,12 +539,19 @@ static void parse_chreipl_options(int argc, char *argv[])
parse_pos_args(&argv[optind], argc - optind);
}
static void verify_write_access(const char *path, const char *attr)
static void check_exists(const char *path, const char *attr)
{
char fpath[PATH_MAX];
snprintf(fpath, sizeof(fpath), "/sys/firmware/%s", path);
if (access(fpath, W_OK) != 0)
if (access(fpath, F_OK) != 0)
ERR_EXIT("System does not allow to set %s", attr);
}
static void write_str_optional(char *string, char *file, int exit_on_fail,
const char *attr)
{
if (write_str_errno(string, file) && exit_on_fail)
ERR_EXIT("System does not allow to set %s", attr);
}
@@ -585,22 +592,18 @@ static void chreipl_ccw(void)
ERR_EXIT("Could not find DASD CCW device \"%s\"", l.busid);
}
if (l.bootparms_set && strlen(l.bootparms) > BOOTPARMS_CCW_MAX) {
ERR_EXIT("Maximum boot parameter length exceeded (%zu/%u)",
strlen(l.bootparms), BOOTPARMS_CCW_MAX);
}
/*
* On old systems that use CCW reipl loadparm cannot be set
*/
if (l.loadparm_set)
verify_write_access("reipl/ccw/loadparm", "loadparm");
if (l.bootparms_set) {
verify_write_access("reipl/ccw/parm", "boot parameters");
if (strlen(l.bootparms) > BOOTPARMS_CCW_MAX)
ERR_EXIT("Maximum boot parameter length exceeded "
"(%zu/%u)", strlen(l.bootparms),
BOOTPARMS_CCW_MAX);
}
if (access("/sys/firmware/reipl/ccw/parm", W_OK) == 0)
write_str(l.bootparms, "reipl/ccw/parm");
if (access("/sys/firmware/reipl/ccw/loadparm", W_OK) == 0)
write_str(l.loadparm, "reipl/ccw/loadparm");
write_str_optional(l.loadparm, "reipl/ccw/loadparm", l.loadparm_set,
"loadparm");
write_str_optional(l.bootparms, "reipl/ccw/parm", l.bootparms_set,
"boot parameters");
write_str(l.busid, "reipl/ccw/device");
write_str("ccw", "reipl/reipl_type");
@@ -616,27 +619,21 @@ static void chreipl_fcp(void)
ERR_EXIT("Device is on cio_ignore list, try \"cio_ignore -r %s\"?", l.busid);
ERR_EXIT("Could not find FCP device \"%s\"", l.busid);
}
verify_write_access("reipl/fcp/device", "\"fcp\" re-IPL target");
check_exists("reipl/fcp/device", "\"fcp\" re-IPL target");
if (l.bootparms_set && strlen(l.bootparms) > BOOTPARMS_FCP_MAX) {
ERR_EXIT("Maximum boot parameter length exceeded (%zu/%u)",
strlen(l.bootparms), BOOTPARMS_FCP_MAX);
}
/*
* On old systems the FCP reipl loadparm cannot be set
*/
if (l.loadparm_set)
verify_write_access("reipl/fcp/loadparm", "loadparm");
if (l.bootparms_set) {
verify_write_access("reipl/fcp/scp_data", "boot parameters");
if (strlen(l.bootparms) > BOOTPARMS_FCP_MAX)
ERR_EXIT("Maximum boot parameter length exceeded "
"(%zu/%u)", strlen(l.bootparms),
BOOTPARMS_FCP_MAX);
}
if (access("/sys/firmware/reipl/fcp/scp_data", W_OK) == 0)
write_str(l.bootparms, "reipl/fcp/scp_data");
if (access("/sys/firmware/reipl/fcp/loadparm", W_OK) == 0)
write_str(l.loadparm, "reipl/fcp/loadparm");
write_str_optional(l.loadparm, "reipl/fcp/loadparm", l.loadparm_set,
"loadparm");
write_str_optional(l.bootparms, "reipl/fcp/scp_data", l.bootparms_set,
"boot parameters");
write_str(l.busid, "reipl/fcp/device");
write_str(l.wwpn, "reipl/fcp/wwpn");
write_str(l.lun, "reipl/fcp/lun");
write_str("fcp", "reipl/reipl_type");
/*
* set the boot record logical block address. Master boot
* record. It is always 0 for Linux
@@ -645,6 +642,7 @@ static void chreipl_fcp(void)
if (!l.bootprog_set)
sprintf(l.bootprog, "0");
write_str(l.bootprog, "reipl/fcp/bootprog");
write_str("fcp", "reipl/reipl_type");
print_fcp(0, 0);
}
@@ -652,17 +650,14 @@ static void chreipl_fcp(void)
static void chreipl_nss(void)
{
check_nss_opts();
verify_write_access("reipl/nss/name", "\"nss\" re-IPL target");
if (l.bootparms_set) {
verify_write_access("reipl/nss/parm", "boot parameters");
if (strlen(l.bootparms) > BOOTPARMS_NSS_MAX)
ERR_EXIT("Maximum boot parameter length exceeded "
"(%zu/%u)", strlen(l.bootparms),
BOOTPARMS_NSS_MAX);
check_exists("reipl/nss/name", "\"nss\" re-IPL target");
if (l.bootparms_set && strlen(l.bootparms) > BOOTPARMS_NSS_MAX) {
ERR_EXIT("Maximum boot parameter length exceeded (%zu/%u)",
strlen(l.bootparms), BOOTPARMS_NSS_MAX);
}
write_str_optional(l.bootparms, "reipl/nss/parm", l.bootparms_set,
"boot parameters");
write_str(l.nss_name, "reipl/nss/name");
if (access("/sys/firmware/reipl/nss/parm", W_OK) == 0)
write_str(l.bootparms, "reipl/nss/parm");
write_str("nss", "reipl/reipl_type");
print_nss(0);
}

View File

@@ -129,7 +129,7 @@ int write_str_errno(char *string, char *file)
snprintf(path, sizeof(path), "/sys/firmware/%s", file);
fh = open(path, O_WRONLY);
if (fh < 0)
ERR_EXIT_ERRNO("Could not open \"%s\"", file);
return errno;
if (write(fh, value, strlen(value)) < 0)
return errno;
close(fh);

View File

@@ -75,9 +75,11 @@ static const struct tool_info iucv_tool[2] = {
static void __noreturn usage_exit(const struct tool_info *prg, int is_error,
const char *msg)
{
FILE *file = is_error ? stderr : stdout;
if (msg != NULL)
fprintf(stderr, _("%s: %s\n"), prg->name, msg);
fprintf(stderr, _(prg->usage), prg->name, prg->name);
fprintf(file, _("%s: %s\n"), prg->name, msg);
fprintf(file, _(prg->usage), prg->name, prg->name);
exit(is_error ? 1 : 0); /* rc=1 .. invalid args */
}

View File

@@ -198,3 +198,33 @@ int __util_vsprintf(const char *func, const char *file, int line,
rc != -1, "Could not format string\n");
return rc;
}
/**
* Strip leading and trailing spaces from string
*
* Remove string \a s leading and trailing spaces
*
* @param[in,out] s String to manipulate
*
* @returns Pointer to first non-space character in string \a s
*/
char *util_strstrip(char *s)
{
size_t size;
char *end;
size = strlen(s);
if (!size)
return s;
end = s + size - 1;
while (end >= s && isspace(*end))
end--;
*(end + 1) = '\0';
while (*s && isspace(*s))
s++;
return s;
}

View File

@@ -10,10 +10,13 @@
//! [code]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "lib/util_libc.h"
#include "lib/util_panic.h"
#define EXAMPLE_WORD " /sys/devices/system/cpu "
/*
* Demonstrate that out of memory is automatically handled via panic()
*/
@@ -22,6 +25,12 @@ int main(void)
unsigned long ulong_max = (unsigned long)-1;
void *ptr;
char *zeroes, *str;
char buffer[sizeof(EXAMPLE_WORD)];
strcat(buffer, EXAMPLE_WORD);
fprintf(stderr, "Try to remove leading and trailing spaces from "
"\"%s\"\nresult = \"%s\"\n", EXAMPLE_WORD,
util_strstrip(buffer));
/* Use util_strcat_realloc() for string concatenation */
fprintf(stderr, "Try to concatenate \"Hello\", \", \" and \"world!\": ");

View File

@@ -90,7 +90,7 @@ static void test_util_path_is_xxx(void)
}
/*
* Usage: util_path_example [sysfs mount point] | "is_xxx"
* Usage: util_path_example sysfs [MOUNT_POINT] | is_xxx
*/
int main(int argc, char *argv[])
{
@@ -111,6 +111,6 @@ int main(int argc, char *argv[])
}
return EXIT_SUCCESS;
out_fail:
errx(EXIT_FAILURE, "Usage: %s sysfs <path> | is_xxx", argv[0]);
errx(EXIT_FAILURE, "Usage: %s sysfs [MOUNT_POINT] | is_xxx", argv[0]);
}
//! [code]

View File

@@ -34,6 +34,12 @@ const struct util_prg prg = {
}
};
static const struct option opt_list[] = {
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'v' },
{ NULL, no_argument, NULL, 0 },
};
/*
* Demonstrate the util_prg_print() functions
*/
@@ -49,7 +55,7 @@ int main(int argc, char *argv[])
util_prg_init(&prg);
while ((opt = getopt(argc, argv, "vhe")) != -1) {
while ((opt = getopt_long(argc, argv, "vhe", opt_list, NULL)) != -1) {
switch (opt) {
case 'v':
util_prg_print_version();

View File

@@ -442,9 +442,9 @@ util_proc_dev_get_entry(dev_t device, int blockdev,
/*
* Provide one record form a /proc/mounts like file
* Provide one record from a /proc/mounts like file
*
* The parameter file_name distinguishes the file form procfs which
* The parameter file_name distinguishes the file from procfs which
* is read, the parameter spec is the selector for the record.
*/
int util_proc_mnt_get_entry(const char *file_name, const char *spec,
@@ -456,7 +456,6 @@ int util_proc_mnt_get_entry(const char *file_name, const char *spec,
rc = get_file_buffer(&file, file_name);
if (rc)
return rc;
rc = -1;
while (!eof(&file)) {
rc = scan_mnt_entry(&file, entry);
if (rc)
@@ -467,6 +466,7 @@ int util_proc_mnt_get_entry(const char *file_name, const char *spec,
}
util_proc_mnt_free_entry(entry);
}
rc = -1;
out_free:
free_file_buffer(&file);
return rc;

View File

@@ -59,6 +59,7 @@ static int __scandir(struct dirent ***de_vec, const char *path,
int count = 0;
DIR *dirp;
*de_vec = NULL;
dirp = opendir(path);
if (!dirp)
return -1;
@@ -134,13 +135,13 @@ int util_scandir_hexsort(const struct dirent **de1, const struct dirent **de2)
* directory entries. The entries as well as the pointer array itself are
* allocated by the function and has to be released by the user via free.
*
* @param[out] de_vec Vector of matched directory entries
* @param[out] de_vec Vector of matched directory entries, or NULL
* @param[in] compar_fn Callback function for sorting the entry list
* @param[in] path Path to the directory to scan
* @param[in] fmt Format string, describes the search pattern as POSIX regex
* @param[in] ... Values for format string
*
* @returns Number of returned directory entries
* @returns Number of returned directory entries, or -1 on error
*/
int util_scandir(struct dirent ***de_vec,
int compar_fn(const struct dirent **first,

18
libvmcp/Makefile Normal file
View File

@@ -0,0 +1,18 @@
include ../common.mak
lib = libvmcp.a
examples = vmcp_example
all: $(lib) $(examples)
objects = vmcp.o
$(lib): $(objects)
install: all
vmcp_example: vmcp_example.o $(lib) $(rootdir)/libutil/libutil.a
clean:
rm -f *.o $(lib) $(examples)

134
libvmcp/vmcp.c Normal file
View File

@@ -0,0 +1,134 @@
/*
* vmcp - z/VM CP function library
*
* Copyright IBM Corp. 2018
*
* s390-tools is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/ioctl.h>
#include "lib/util_libc.h"
#include "lib/vmcp.h"
#define VMCP_DEVICE_NODE "/dev/vmcp"
#define VMCP_GETSIZE _IOR(0x10, 3, int)
#define VMCP_SETBUF _IOW(0x10, 2, int)
#define VMCP_GETCODE _IOR(0x10, 1, int)
/*
* Read at most COUNT bytes from FD into memory at location BUF.
* Return number of bytes read on success, -1 on error.
*/
static ssize_t read_buffer(int fd, char *buf, ssize_t count)
{
ssize_t ret, done;
for (done = 0; done < (ssize_t)count; done += ret) {
ret = read(fd, &buf[done], count - done);
if (ret == -1 && errno == EINTR)
continue;
if (ret == -1)
return -1;
if (ret == 0)
break;
}
return done;
}
/**
* Submit a command to z/VM CP and return the response, the size in bytes
* of the response and CP command response code.
*
* The member response contains the response from CP. It is a pointer
* to a malloc'ed buffer which must be freed by the caller when the return
* code is zero or VMCP_ERR_TOOSMALL.
*
* @param[in,out] cmd Pointer to struct vmcp_parm.
* @param[in] cpcmd Pointer to CP command string.
* @param[in] do_upper If true convert cpcmd string to upper case.
* @param[out] cprc Return code of the CP command.
* @param[out] response Return buffer, has been allocated via malloc()
* must be freed by caller, see below.
* @param[out] response_size Size of the response in bytes, can be larger
* than buffer_size.
*
* @returns Zero on success or a negative error number on failure.
* @retval VMCP_SUCCESS Success valid members: cprc, response,
* response_size
* @retval VMCP_ERR_OPEN Error opening VMCP device, valid members: none
* @retval VMCP_ERR_SETBUF Error setting buffer, valid members: none
* @retval VMCP_ERR_GETCODE Error getting cp exit code, valid members: none
* @retval VMCP_ERR_WRITE Error write CP command, valid members: none
* @retval VMCP_ERR_GETSIZE Error reading response size,
* valid members: cprc
* @retval VMCP_ERR_READ Error reading resp
* @retval VMCP_ERR_TOOSMALL Error response buffer too small, response
* truncated, valid members: cprc, response,
* response_size
*/
int vmcp(struct vmcp_parm *cmd)
{
int rc = VMCP_SUCCESS, fd, len;
char *cpcmd;
cmd->response = NULL;
cmd->response_size = 0;
cmd->cprc = 0;
fd = open(VMCP_DEVICE_NODE, O_RDWR);
if (fd == -1)
return VMCP_ERR_OPEN;
cpcmd = util_strdup(cmd->cpcmd); /* Exits on failure */
if (cmd->do_upper)
util_str_toupper(cpcmd);
if (ioctl(fd, VMCP_SETBUF, &cmd->buffer_size) == -1) {
rc = VMCP_ERR_SETBUF;
goto fail;
}
if (write(fd, cpcmd, strlen(cpcmd)) == -1) {
rc = VMCP_ERR_WRITE;
goto fail;
}
if (ioctl(fd, VMCP_GETCODE, &cmd->cprc) == -1) {
rc = VMCP_ERR_GETCODE;
goto fail;
}
if (ioctl(fd, VMCP_GETSIZE, &cmd->response_size) == -1) {
rc = VMCP_ERR_GETSIZE;
goto fail;
}
if (cmd->response_size <= cmd->buffer_size) {
len = cmd->response_size;
} else {
len = cmd->buffer_size;
rc = VMCP_ERR_TOOSMALL;
}
/* Exits on failure */
cmd->response = (char *)util_zalloc(len + 1);
if (read_buffer(fd, cmd->response, len) == -1) {
rc = VMCP_ERR_READ;
free(cmd->response);
cmd->response = NULL;
}
fail:
close(fd);
free(cpcmd);
return rc;
}

65
libvmcp/vmcp_example.c Normal file
View File

@@ -0,0 +1,65 @@
/**
* vmcp_example - Example program for vmcp.c
*
* Copyright 2018 IBM Corp.
*
* s390-tools is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
*/
//! [code]
#include <stdio.h>
#include <stdlib.h>
#include <err.h>
#include "lib/vmcp.h"
/*
* Demonstrate vmcp() function usage
*/
int main(void)
{
struct vmcp_parm cp;
int rc;
cp.cpcmd = "q osa";
cp.buffer_size = VMCP_DEFAULT_BUFSZ;
cp.do_upper = true;
rc = vmcp(&cp);
switch (rc) {
case VMCP_SUCCESS:
printf("%s\n", cp.response);
free(cp.response);
break;
case VMCP_ERR_OPEN:
errx(EXIT_FAILURE, "Could not open device %s", VMCP_DEVICE_NODE);
break;
case VMCP_ERR_SETBUF:
errx(EXIT_FAILURE, "Could not set buffer size");
break;
case VMCP_ERR_GETCODE:
errx(EXIT_FAILURE, "Could not query return code");
break;
case VMCP_ERR_GETSIZE:
errx(EXIT_FAILURE, "Could not query response size");
break;
case VMCP_ERR_WRITE:
errx(EXIT_FAILURE, "Could not issue CP command");
break;
case VMCP_ERR_READ:
errx(EXIT_FAILURE, "Could not read CP response");
break;
case VMCP_ERR_TOOSMALL:
free(cp.response);
printf("Response truncated (requires %u bytes)\n",
cp.response_size);
errx(EXIT_FAILURE, "Response buffer (%u bytes) too small",
cp.buffer_size);
break;
}
return EXIT_SUCCESS;
}
//! [code]

View File

@@ -594,17 +594,18 @@ static void cal_task_pcpu(struct task_t *task, const unsigned long long tics)
*/
static int read_stat(struct task_t *task)
{
int ppid, tty, proc;
unsigned long flags, pri, nice;
unsigned long long maj_flt, utime, stime, cutime, cstime;
unsigned long long maj_flt = 0, utime = 0, stime = 0, cutime = 0,
cstime = 0;
unsigned long flags = 0, pri = 0, nice = 0;
char *cmd_start, *cmd_end, *cmdlenp, *cmdp;
int ppid = 0, tty = 0, proc = 0, rc;
snprintf(fname, sizeof(fname), "/proc/%u/stat", task->pid);
if (read_file(fname, buf, sizeof(buf) - 1) == -1)
return 0;
cmd_start = strchr(buf, '(') + 1;
cmd_end = strchr(cmd_start, ')');
cmd_end = strrchr(cmd_start, ')');
name_lens.cmd_len = cmd_end - cmd_start;
cmdlenp = mon_record + sizeof(struct monwrite_hdr);
cmdlenp += sizeof(struct procd_hdr);
@@ -625,7 +626,7 @@ static int read_stat(struct task_t *task)
memcpy(cmdlenp, &name_lens.cmd_len, sizeof(__u16));
cmd_end += 2;
sscanf(cmd_end,
rc = sscanf(cmd_end,
"%c %d %*d %*d %d %*d "
"%lu %*s %*s %Lu %*s "
"%Lu %Lu %Lu %Lu "
@@ -642,6 +643,8 @@ static int read_stat(struct task_t *task)
&utime, &stime, &cutime, &cstime,
&pri, &nice,
&proc);
if (rc != 12)
syslog(LOG_ERR, "bad data in %s \n", fname);
task->ppid = (__u32)ppid;
task->tty = (__u16)tty;
task->flags = (__u32)flags;

View File

@@ -134,8 +134,8 @@ echo "$cmd: Copying virtio modules"
mkdir -p $builddir/$netdir
mkdir -p $builddir/$blkdir
set +e
cp $netdir/virtio_net.ko $builddir/$netdir 2> /dev/null
cp $blkdir/virtio_blk.ko $builddir/$blkdir 2> /dev/null
cp $netdir/virtio_net.ko* $builddir/$netdir 2> /dev/null
cp $blkdir/virtio_blk.ko* $builddir/$blkdir 2> /dev/null
set -e
# Busybox (+ dependencies)
@@ -170,7 +170,7 @@ cat <<'EOF' > $builddir/init
/bin/mount -t tmpfs none /run
/sbin/modprobe virtio_net
/sbin/udhcpc -O pxeconffile -O pxepathprefix &
/sbin/udhcpc -O pxeconffile -O pxepathprefix -x 93:001F &
/sbin/pxeboot.script
EOF
@@ -237,6 +237,7 @@ case "$1" in
echo " router: $router"
echo " domain: $domain $dns"
echo " tftp: $siaddr"
echo " pxepathprefix: $pxepathprefix"
# flush routes
/sbin/ip route flush table all
# setup if link
@@ -272,6 +273,7 @@ case "$1" in
echo "siaddr=$siaddr" > $PXECONF
echo "interface=$interface" >> $PXECONF
echo "ip=$ip" >> $PXECONF
echo "pxepathprefix=$pxepathprefix" >> $PXECONF
fi
;;
@@ -354,7 +356,7 @@ then
for c in $CONFIGS
do
echo "fetching config pxelinux.cfg/$c from $siaddr"
if /usr/bin/tftp -g -l /tmp/config -r pxelinux.cfg/$c $siaddr
if /usr/bin/tftp -g -l /tmp/config -r ${pxepathprefix}pxelinux.cfg/$c $siaddr
then
break
fi
@@ -371,6 +373,7 @@ fi
kernel=$(/bin/grep -i "^[[:space:]]*kernel" /tmp/config | sed "s/^[[:space:]]*kernel[[:space:]]*//I")
initrd=$(/bin/grep -i "^[[:space:]]*initrd" /tmp/config | sed "s/^[[:space:]]*initrd[[:space:]]*//I")
append=$(/bin/grep -i "^[[:space:]]*append" /tmp/config | sed "s/^[[:space:]]*append[[:space:]]*//I")
ipappend=$(/bin/grep -i "^[[:space:]]*ipappend" /tmp/config | sed "s/^[[:space:]]*ipappend[[:space:]]*//I")
if [ -z "$kernel" ]
then
@@ -378,13 +381,13 @@ then
exit
else
echo fetch kernel $kernel from $siaddr
/usr/bin/tftp -g -l /tmp/kernel -r $kernel $siaddr
/usr/bin/tftp -g -l /tmp/kernel -r $pxepathprefix$kernel $siaddr
fi
if [ -n "$initrd" ]
then
echo fetch initrd $initrd from $siaddr
/usr/bin/tftp -g -l /tmp/initrd -r $initrd $siaddr
/usr/bin/tftp -g -l /tmp/initrd -r $pxepathprefix$initrd $siaddr
INITRD="--initrd=/tmp/initrd"
else
INITRD=""
@@ -394,6 +397,9 @@ if [ -z "$append" ]; then
echo "Kexec load: kexec -l /tmp/kernel $INITRD"
kexec -l /tmp/kernel $INITRD
else
if [ "$ipappend" = "2" ]; then
$append="$append BOOTIF=01-$ifaddr"
fi
echo "Kexec load: kexec -l /tmp/kernel $INITRD --append=\"$append\""
kexec -l /tmp/kernel $INITRD --append="$append"
fi

View File

@@ -85,20 +85,12 @@ void init_ibmOSAMib(void) {
/* query OSA-E device driver for OSA-E devices and mark them in IF-MIB interface list */
osaexp_num = query_OSA_EXP ( &if_list, ifNumber );
if ( osaexp_num < 0 )
if ( osaexp_num == 0 )
{
fprintf( stderr, "init_ibmOSAMib(): "
"OSA-E device driver query interface ioctl() failed\n"
"check agent log file for more details\n"
"Cannot start subagent...exiting...\n");
exit(1);
}
else if ( osaexp_num == 0 )
{
fprintf( stderr, "init_ibmOSAMib(): bad or no OSA-E devices reported\n"
"check agent log file for more details\n"
"Cannot start subagent...exiting...\n");
exit(1);
get_time( time_buf );
snmp_log( LOG_ERR, "%s init_ibmOSAMib(): none of the %d interfaces is a real "
"OSA-E device - starting subagent anyway\n", time_buf, ifNumber);
return;
}
/* end if */

View File

@@ -1204,18 +1204,7 @@ void update_mib_info ()
* and mark them in IF-MIB interface list
* */
osaexp_num = query_OSA_EXP( &tmp_list, if_num );
if ( osaexp_num < 0 )
{
get_time( time_buf );
fprintf( stderr, "%s update_mib_info(): "
"OSA-E device driver query interface ioctl() "
"failed\nupdate_mib_info(): going to stop osasnmpd daemon\n"
"update_mib_info(): check subagent logfile for more details\n"
"update_mib_info(): sending termination signal to osasnmpd...\n",
time_buf );
exit(-1);
}
else if ( osaexp_num == 0 )
if ( osaexp_num == 0 )
{
get_time( time_buf );
snmp_log( LOG_ERR, "%s update_mib_info(): "
@@ -1698,9 +1687,8 @@ int query_IF_MIB ( IF_LIST** ifList )
* IN int if_Number: number of network interfaces
* returns: int num - number of OSA Express devices found on this
* system (>=0)
* -1 -an error occurred , no valid info avail
*********************************************************************/
int query_OSA_EXP ( IF_LIST** ifList, int if_Number )
unsigned int query_OSA_EXP ( IF_LIST** ifList, int if_Number )
{
int j, num = 0;
char time_buf[TIME_BUF_SIZE]; /* date/time buffer */

View File

@@ -91,7 +91,7 @@ void update_mib_info ( );
int query_IF_MIB( IF_LIST** );
/* retrieves OSA Express interface information from kernel */
int query_OSA_EXP ( IF_LIST** ,int );
unsigned int query_OSA_EXP ( IF_LIST** ,int );
/* get time of day */
int get_time( char* );

View File

@@ -208,6 +208,9 @@ static void print_physical(struct qeth_qoat_physical *phdr)
case OAT_OSA_GEN_OSAE6S:
osagen = "OSA-Express6S";
break;
case OAT_OSA_GEN_OSAE7S:
osagen = "OSA-Express7S";
break;
default:
sprintf(tmp, "unknown (0x%x)", phdr->osa_gen);
osagen = tmp;
@@ -239,6 +242,9 @@ static void print_physical(struct qeth_qoat_physical *phdr)
case OAT_PORT_SPEED_10gbs_full:
speed = "10 Gb/s / full duplex";
break;
case OAT_PORT_SPEED_25gbs_full:
speed = "25 Gb/s / full duplex";
break;
case OAT_PORT_SPEED_UNKNOWN:
speed = "unknown / unknown";
break;

View File

@@ -58,6 +58,7 @@ struct qeth_qoat_physical {
#define OAT_OSA_GEN_OSAE4S 0x02
#define OAT_OSA_GEN_OSAE5S 0x03
#define OAT_OSA_GEN_OSAE6S 0x04
#define OAT_OSA_GEN_OSAE7S 0x05
__u8 osa_gen;
#define OAT_PORT_SPEED_UNKNOWN 0x00
#define OAT_PORT_SPEED_10mbs_half 0x01
@@ -68,6 +69,7 @@ struct qeth_qoat_physical {
#define OAT_PORT_SPEED_1000mbs_full 0x06
#define OAT_PORT_SPEED_NA 0x07
#define OAT_PORT_SPEED_10gbs_full 0x08
#define OAT_PORT_SPEED_25gbs_full 0x0A
__u8 port_speed;
#define OAT_PORT_MEDIA_COPPER 0x01
#define OAT_PORT_MEDIA_MULTI_MODE 0x02

View File

@@ -1,7 +1,7 @@
include ../common.mak
SCRIPTS = dbginfo.sh zfcpdbf scsi_logging_level
MAN_PAGES = dbginfo.sh.1 zfcpdbf.1
SCRIPTS = dbginfo.sh zfcpdbf zipl-switch-to-blscfg scsi_logging_level
MAN_PAGES = dbginfo.sh.1 zfcpdbf.1 zipl-switch-to-blscfg.1
all:

View File

@@ -2,7 +2,7 @@
#
# dbginfo.sh - Tool to collect runtime, configuration, and trace information
#
# Copyright IBM Corp. 2002, 2017
# Copyright IBM Corp. 2002, 2018
#
# s390-tools is free software; you can redistribute it and/or modify
# it under the terms of the MIT license. See LICENSE for details.
@@ -21,7 +21,7 @@ readonly SCRIPTNAME="${0##*/}"
print_version() {
cat <<EOF
${SCRIPTNAME}: Debug information script version %S390_TOOLS_VERSION%
Copyright IBM Corp. 2002, 2017
Copyright IBM Corp. 2002, 2018
EOF
}
@@ -182,11 +182,14 @@ readonly OUTPUT_FILE_XML="${WORKPATH}domain_xml"
# File that includes the docker inspect output
readonly OUTPUT_FILE_DOCKER="${WORKPATH}docker_inspect.out"
# File that includes nvme related information
readonly OUTPUT_FILE_NVME="${WORKPATH}nvme.out"
# Mount point of the debug file system
readonly MOUNT_POINT_DEBUGFS="/sys/kernel/debug"
# The amount of steps running the whole collections
readonly COLLECTION_COUNT=11
readonly COLLECTION_COUNT=12
# The kernel version (e.g. '2' from 2.6.32 or '3' from 3.2.1)
readonly KERNEL_VERSION=$(uname -r 2>/dev/null | cut -d'.' -f1)
@@ -471,10 +474,13 @@ VM_CMDS="q userid\
:q privclass\
:q cplevel\
:q cpservice\
:q cpprot user\
:q specex\
:q ssi\
:q cpus\
:q srm\
:q vtod\
:q time full\
:q timezone\
:q loaddev\
:q v osa\
@@ -826,6 +832,25 @@ collect_docker() {
pr_log_stdout " "
}
########################################
collect_nvme() {
local NVME
pr_syslog_stdout "11 of ${COLLECTION_COUNT}: Collecting nvme output"
call_run_command "nvme list" "${OUTPUT_FILE_NVME}"
for NVME in /dev/nvme[0-9]*; do
if [ -c $NVME ]; then
call_run_command "smartctl -x $NVME" "${OUTPUT_FILE_NVME}"
call_run_command "nvme fw-log $NVME" "${OUTPUT_FILE_NVME}"
call_run_command "nvme smart-log $NVME" "${OUTPUT_FILE_NVME}"
call_run_command "nvme error-log $NVME" "${OUTPUT_FILE_NVME}"
fi
done
pr_log_stdout " "
}
########################################
post_processing() {
local file_mtime
@@ -833,7 +858,7 @@ post_processing() {
local tmp_file
local file_name
pr_syslog_stdout "11 of ${COLLECTION_COUNT}: Postprocessing"
pr_syslog_stdout "${COLLECTION_COUNT} of ${COLLECTION_COUNT}: Postprocessing"
find "${WORKPATH}etc/libvirt/qemu/" -maxdepth 1 -name "*.xml" 2>/dev/null | while IFS= read -r file_name; do
file_mtime_epoche=$(stat --format=%Y "${file_name}")
@@ -992,25 +1017,31 @@ environment_setup()
# create gzip-ped tar file
create_package()
{
local rc_tar
pr_stdout "Finalizing: Creating archive with collected data"
cd "${WORKDIR_BASE}"
if ! tar -czf "${WORKARCHIVE}" "${WORKDIR_CURRENT}"; then
pr_stdout " "
pr_stdout "${SCRIPTNAME}: Error: Collection of data failed!"
pr_stdout " The creation of \"${WORKARCHIVE}\" was not successful."
pr_stdout " Please check the directory \"${WORKDIR_BASE}\""
pr_stdout " to provide enough free available space."
tar -czf "${WORKARCHIVE}" "${WORKDIR_CURRENT}"
rc_tar=$?
if [ $rc_tar -eq 0 ]; then
chmod 0600 "${WORKARCHIVE}"
pr_stdout " "
pr_stdout "Collected data was saved to:"
pr_stdout " >> ${WORKARCHIVE} <<"
pr_stdout " "
pr_stdout "Review the collected data before sending to your service organization. "
pr_stdout " "
elif [ $rc_tar -eq 127 ]; then
pr_stdout " "
pr_stdout "${SCRIPTNAME}: Error: tar command is not available!"
pr_stdout " Please install the corresponding package!"
else
chmod 0600 "${WORKARCHIVE}"
pr_stdout " "
pr_stdout "Collected data was saved to:"
pr_stdout " >> ${WORKARCHIVE} <<"
pr_stdout " "
pr_stdout "${SCRIPTNAME}: Error: Collection of data failed!"
pr_stdout " The creation of \"${WORKARCHIVE}\" was not successful."
pr_stdout " Please check the directory \"${WORKDIR_BASE}\""
pr_stdout " to provide enough free available space."
fi
pr_stdout " "
pr_stdout "Review the collected data before sending to your service organization. "
pr_stdout " "
}
@@ -1118,6 +1149,8 @@ collect_domain_xml
collect_docker
collect_nvme
post_processing
create_package

213
scripts/zipl-switch-to-blscfg Executable file
View File

@@ -0,0 +1,213 @@
#!/bin/bash
#
# zipl-switch-to-blscfg - Switch zipl to use BootLoaderSpec configuration
#
# Copyright 2018 Red Hat, Inc.
#
# s390-tools is free software; you can redistribute it and/or modify
# it under the terms of the MIT license. See LICENSE for details.
#
readonly SCRIPTNAME="${0##*/}"
declare -A zipl_to_bls
zipl_to_bls["image"]="linux"
zipl_to_bls["ramdisk"]="initrd"
zipl_to_bls["parameters"]="options"
print_error() {
echo "$1" >&2
exit 1
}
function on_exit() {
if ! rm -rf $TMP; then
echo "Delete temporary files failed!" >&2
exit 1
fi
}
if ! TMP="$(mktemp -d)"; then
print_error "Creating a temporary dir for config files failed!"
fi
trap 'on_exit' EXIT
print_version() {
cat <<EOF
${SCRIPTNAME}: version %S390_TOOLS_VERSION%
Copyright Red Hat, Inc. 2018
EOF
}
print_usage()
{
print_version
cat <<EOF
Usage: ${SCRIPTNAME} [OPTIONS]
Switches the zipl boot-loader configuration to use BootLoaderSpec files.
Options:
-h, --help print this help and exit
-v, --version print version information and exit
--backup-suffix=SUFFIX suffix used for backup files, defaults to .bak
--bls-directory=DIR path to generate BLS files, defaults to /boot/loader/entries
--config-file=FILE path to zipl configuration file, defaults to /etc/zipl.conf
--ignore-default ignore the default option from the zipl configuration file
--use-version-name use the section kernel version as the BLS file name
EOF
}
OPTS="$(getopt -o hv --long help,version,backup-suffix:,bls-directory:,config-file:,\
ignore-default,use-version-name -n \'$SCRIPTNAME\' -- "$@")"
eval set -- "$OPTS"
BACKUP_SUFFIX=.bak
BLS_DIR="/boot/loader/entries"
CMDLINE_LINUX_DEBUG=" systemd.log_level=debug systemd.log_target=kmsg"
LINUX_DEBUG_VERSION_POSTFIX="_with_debugging"
LINUX_DEBUG_TITLE_POSTFIX=" with debugging"
CONFIG="/etc/zipl.conf"
while [ ${#} -gt 0 ]; do
case "$1" in
--help|-h)
print_usage
exit 0
;;
--version|-v)
print_version
exit 0
;;
--backup-suffix)
BACKUP_SUFFIX=${2}
shift
;;
--bls-directory)
BLS_DIR=${2}
shift
;;
--config-file)
CONFIG=${2}
shift
;;
--ignore-default)
ignore_default=true
;;
--use-version-name)
version_name=true
;;
--)
shift
break
;;
*)
echo >&2
echo "${SCRIPTNAME}: invalid option \"${1}\"" >&2
echo "Try '${SCRIPTNAME} --help' for more information" >&2
echo >&2
exit 1
;;
esac
shift
done
TMP_CONFIG="${TMP}/${CONFIG##*/}"
[[ -d "$BLS_DIR" ]] || mkdir -m 0700 -p "$BLS_DIR"
if [ -f /etc/machine-id ]; then
read MACHINE_ID < /etc/machine-id
MACHINE_ID=${MACHINE_ID}-
fi
count=0
OUTPUT=""
TARGET=""
while IFS='= ' read key val; do
# for BLS the default kernel is always the latest one
if [[ $key == \#* ]] || [[ $key == "default" && $ignore_default == true ]]; then
continue
fi
# remove spaces
key="$(echo $key | sed -e 's/^[ \t"]*//;s/[ \t"]*$//')"
if [[ $key = \[*] ]]; then
if [[ $key == "[defaultboot]" ]]; then
OUTPUT=${TMP_CONFIG}
echo $key >> ${OUTPUT}
else
key="${key%\]}"
key="${key#\[}"
section=$key
OUTPUT=${BLS_DIR}/${MACHINE_ID}${section}.conf
if [ -f "${OUTPUT}" ]; then
print_error "BLS file ${OUTPUT} already exists"
fi
fi
elif [[ $val ]]; then
val="$(echo $val | sed -e 's/^[ \t"]*//;s/[ \t"]*$//')"
if [[ $key == "target" ]]; then
if [ -z ${TARGET} ]; then
echo $key=$val >> ${TMP_CONFIG}
TARGET=$val
else if [ "${TARGET}" != "${val}" ]; then
print_error "BLS is only supported if all sections have the same target"
fi
fi
else
if [ -n "${zipl_to_bls[$key]}" ]; then
if [[ $key = "image" && $version_name == true ]]; then
if [[ $val = *"vmlinuz-"* ]]; then
version="${val##*/vmlinuz-}"
else
version="${val##*/}"
fi
echo "version $version" >> ${OUTPUT}
if [[ $version = *"rescue"* ]]; then
FILENAME=${BLS_DIR}/${MACHINE_ID}0-rescue.conf
else
FILENAME=${BLS_DIR}/${MACHINE_ID}${version}.conf
fi
if [[ ${OUTPUT} != ${FILENAME} ]]; then
if [ -f "${FILENAME}" ]; then
print_error "BLS file ${FILENAME} already exists"
fi
mv ${OUTPUT} ${FILENAME}
if [ ! $? -eq 0 ]; then
print_error "Creating BLS file ${FILENAME} failed"
fi
OUTPUT=${FILENAME}
fi
elif [[ $key = "image" ]]; then
echo "version $section" >> ${OUTPUT}
fi
echo "${zipl_to_bls[$key]} ${val}" >> ${OUTPUT}
else
echo $key=$val >> ${TMP_CONFIG}
fi
fi
fi
done < "${CONFIG}"
if [ -f "${CONFIG}${BACKUP_SUFFIX}" ]; then
print_error "Backup file ${CONFIG}${BACKUP_SUFFIX} already exists"
fi
cp -af "${CONFIG}" "${CONFIG}${BACKUP_SUFFIX}"
mv "${TMP_CONFIG}" "${CONFIG}"
zipl > /dev/null
if [ ! $? -eq 0 ]; then
mv "${CONFIG}${BACKUP_SUFFIX}" "${CONFIG}"
fi
exit 0

View File

@@ -0,0 +1,45 @@
.TH ZIPL-SWITCH-TO-BLSCFG 1 "April 2018" "s390-tools"
.SH NAME
zipl-switch-to-blscfg \- Switch zipl to use BootLoaderSpec configuration
.SH SYNOPSIS
.br
\fBzipl-switch-to-blscfg\fP [OPTIONS]
.br
\fBzipl-switch-to-blscfg\fP {\-h|\-v}
.SH DESCRIPTION
This script switches the zipl boot-loader configuration to use BootLoaderSpec files
to define IPL sections. For each Linux kernel defined in the zipl.conf config file,
a BLS fragment is generated in the BLS directory specified. Also, the zipl.conf is
modified it only contains global configurations, all IPL sections comes from BLS.
.SH OPTIONS
.TP
\fB\-h\fP, \fB\-\-help\fP
Print this help and exit
.TP
\fB\-v\fP, \fB\-\-version\fP
Print version information and exit
.TP
\fB\-\-backup-suffix <SUFFIX>\fP
The suffix used for backup files, defaults to .bak.
.TP
\fB\-\-bls-directory <DIRECTORY>\fP
The DIRECTORY where the BLS fragments will be generated. The directory is created if it doesn't exists, by default /boot/loader/entries is used.
.TP
\fB\-\-config-file <FILE>\fP
The FILE used for zipl configuration file, defaults to /etc/zipl.conf.
.TP
\fB\-\-ignore-default\fP
Ignore the default option from the zipl configuration file
.TP
\fB\-\-use-version-name\fP
Use the section kernel version as the BLS file name

View File

@@ -10,6 +10,7 @@
[Unit]
Description=CPACF statistics collection daemon process for Linux on System z
Documentation=man:cpacfstatsd(8)
ConditionVirtualization=no
[Service]
Type=forking

View File

@@ -174,7 +174,7 @@ int main(int argc, char *argv[]) {
) {
switch(c) {
case 'h':
fprintf(stderr, "%s", help_text);
fprintf(stdout, "%s", help_text);
exit(0);
case 'b':
ds.cntrl.blink = 1;

View File

@@ -9,7 +9,7 @@ libs = $(rootdir)/libvmdump/libvmdump.a
objects = vmconvert.o
vmconvert: $(objects) $(libs)
$(LINKXX) $(ALL_LDFLAGS) $^ $(LOADLIBES) $(LDLIBS) -o $@
$(LINKXX) $(ALL_LDFLAGS) $^ $(LDLIBS) -o $@
install: all
$(INSTALL) -d -m 755 $(DESTDIR)$(USRBINDIR) $(DESTDIR)$(MANDIR)/man1

View File

@@ -2,7 +2,9 @@ include ../common.mak
all: vmcp
vmcp: vmcp.o
libs = $(rootdir)/libvmcp/libvmcp.a $(rootdir)/libutil/libutil.a
vmcp: vmcp.o $(libs)
install: all
$(INSTALL) -d -m 755 $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man8

View File

@@ -4,7 +4,7 @@
* Tool for accessing the control program of z/VM using the
* kernel module vmcp
* return codes:
* 0: everything was fine (VMCP_OK)
* 0: everything was fine (EXIT_SUCCESS)
* 1: CP returned a nn zero response code (VMCP_CP)
* 2: the response buffer was not large enough (VMCP_BUF)
* 3: an internal Linux error occurred (VMCP_LIN)
@@ -28,33 +28,58 @@
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/param.h>
#include <unistd.h>
#include "vmcp.h"
#include "lib/zt_common.h"
#include "lib/vmcp.h"
#include "lib/util_opt.h"
#include "lib/util_prg.h"
#define MAXBUFFER 1048576
#define MINBUFFER 4096
#define MAXCMDLEN 240
#define VMCP_OK 0
#define VMCP_CP 1
#define VMCP_BUF 2
#define VMCP_LIN 3
#define VMCP_OPT 4
static int keep_case = 0;
static int buffersize = 8192;
static int buffersize = VMCP_DEFAULT_BUFSZ;
static char command[MAXCMDLEN + 1];
static void print_help(const char *name)
{
printf("%s: z/VM CP command interface.\n%s", name, help_text);
}
static struct util_opt opt_vec[] = {
UTIL_OPT_SECTION("OPTIONS"),
{
.option = { "keepcase", no_argument, NULL, 'k' },
.desc = "Do not convert CP-command string to uppercase",
},
{
.option = { "buffer", required_argument, NULL, 'b' },
.argument = "SIZE",
.desc = "Specify buffer size in bytes, kilobytes (k) "
"or megabytes (M). SIZE range from 4096 to 1048576 "
"bytes"
},
UTIL_OPT_HELP,
UTIL_OPT_VERSION,
UTIL_OPT_END
};
static void print_version(const char *name)
{
printf("%s: z/VM CP command interface version %s\n"
"Copyright IBM Corp. 2005, 2017\n",
name, RELEASE_STRING);
}
static void uppercase(char *string)
{
while (*string != '\0') {
*string = toupper(*string);
string++;
static const struct util_prg prg = {
.desc = "z/VM CP command interface",
.args = "CP-command",
.copyright_vec = {
{
.owner = "IBM Corp.",
.pub_first = 2005,
.pub_last = 2018,
},
UTIL_PRG_COPYRIGHT_END
}
}
};
/* Parse STRING for buffer size in bytes, allowing size modifier suffix 'k' and
* 'm'. Return buffer size in bytes on success, -1 on error. */
@@ -95,17 +120,18 @@ static int parse_args(int argc, char **argv)
int index;
do {
opt = getopt_long(argc, argv, opt_string, options, NULL);
opt = util_opt_getopt_long(argc, argv);
switch (opt) {
case -1:
/* Reached end of parameter list. */
break;
case 'h':
print_help(argv[0]);
exit(VMCP_OK);
util_prg_print_help();
util_opt_print_help();
exit(EXIT_SUCCESS);
case 'v':
print_version(argv[0]);
exit(VMCP_OK);
util_prg_print_version();
exit(EXIT_SUCCESS);
case 'k':
keep_case = 1;
break;
@@ -137,7 +163,8 @@ static int parse_args(int argc, char **argv)
strcat(command, argv[index]);
}
if (strlen(command) == 0) {
print_help(argv[0]);
util_prg_print_help();
util_opt_print_help();
return VMCP_OPT;
}
return VMCP_OK;
@@ -148,25 +175,6 @@ static inline void linux_error(const char *message)
fprintf(stderr, "Error: %s: %s\n", message, strerror(errno));
}
/* Read at most COUNT bytes from FD into memory at location BUF. Return
* number of bytes read on success, -1 on error. */
static ssize_t read_buffer(int fd, char *buf, size_t count)
{
ssize_t ret;
ssize_t done;
for (done = 0; done < (ssize_t) count; done += ret) {
ret = read(fd, &buf[done], count - done);
if (ret == -1 && errno == EINTR)
continue;
if (ret == -1)
return -1;
if (ret == 0)
break;
}
return done;
}
/* Write COUNT bytes to FD from memory at location BUF. Return number of bytes
* written on success, -1 otherwise. */
static ssize_t write_buffer(int fd, const char *buf, size_t count)
@@ -188,77 +196,54 @@ static ssize_t write_buffer(int fd, const char *buf, size_t count)
int main(int argc, char **argv)
{
struct vmcp_parm cp;
int ret;
int fd;
int response_code;
int response_size;
char *buffer;
util_prg_init(&prg);
util_opt_init(opt_vec, NULL);
ret = parse_args(argc, argv);
if (ret != VMCP_OK)
return ret;
if (!keep_case)
uppercase(command);
cp.buffer_size = buffersize;
cp.cpcmd = command;
cp.do_upper = !keep_case;
buffer = malloc(buffersize);
if (!buffer) {
linux_error("Could not allocate return buffer");
ret = vmcp(&cp);
switch (ret) {
case VMCP_ERR_OPEN:
linux_error("Could not open device " VMCP_DEVICE_NODE);
return VMCP_LIN;
}
fd = open(DEVICE_NODE, O_RDWR);
if (fd == -1) {
linux_error("Could not open device " DEVICE_NODE);
free(buffer);
return VMCP_LIN;
}
if (ioctl(fd, VMCP_SETBUF, &buffersize) == -1) {
case VMCP_ERR_SETBUF:
linux_error("Could not set buffer size");
free(buffer);
close(fd);
return VMCP_LIN;
}
if (write(fd, command, strlen(command)) == -1) {
case VMCP_ERR_WRITE:
linux_error("Could not issue CP command");
free(buffer);
close(fd);
return VMCP_LIN;
}
if (ioctl(fd, VMCP_GETCODE, &response_code) == -1) {
case VMCP_ERR_GETCODE:
linux_error("Could not query return code");
free(buffer);
close(fd);
return VMCP_LIN;
}
if (ioctl(fd, VMCP_GETSIZE, &response_size) == -1) {
case VMCP_ERR_GETSIZE:
linux_error("Could not query response size");
free(buffer);
close(fd);
return VMCP_LIN;
}
ret = read_buffer(fd, buffer, buffersize);
if (ret == -1) {
case VMCP_ERR_READ:
linux_error("Could not read CP response");
free(buffer);
close(fd);
return VMCP_LIN;
}
write_buffer(STDOUT_FILENO, buffer, ret);
if (response_size > buffersize) {
write_buffer(STDOUT_FILENO, cp.response,
MIN(cp.response_size, cp.buffer_size));
free(cp.response);
if (ret == VMCP_ERR_TOOSMALL) {
fprintf(stderr, "Error: output (%d bytes) was truncated, try "
"--buffer to increase size\n", response_size);
free(buffer);
close(fd);
"--buffer to increase size\n", cp.response_size);
return VMCP_BUF;
}
if (response_code > 0) {
if (cp.cprc > 0) {
fprintf(stderr, "Error: non-zero CP response for command '%s': "
"#%d\n", command, response_code);
free(buffer);
close(fd);
"#%d\n", command, cp.cprc);
return VMCP_CP;
}
free(buffer);
close(fd);
return VMCP_OK;
return EXIT_SUCCESS;
}

View File

@@ -1,59 +0,0 @@
/*
* vmcp - Send commands to the z/VM control program
*
* Definitions used by vmcp
*
* Copyright IBM Corp. 2005, 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.
*/
#ifndef __vmcp_h__
#define __vmcp_h__
#include <getopt.h>
#include <sys/ioctl.h>
#include "lib/zt_common.h"
#define DEVICE_NODE "/dev/vmcp"
#define VMCP_GETCODE _IOR(0x10, 1, int)
#define VMCP_SETBUF _IOW(0x10, 2, int)
#define VMCP_GETSIZE _IOR(0x10, 3, int)
#define MAXBUFFER 1048576
#define MINBUFFER 4096
#define MAXCMDLEN 240
#define VMCP_OK 0
#define VMCP_CP 1
#define VMCP_BUF 2
#define VMCP_LIN 3
#define VMCP_OPT 4
static struct option options[] = {
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'v'},
{"keepcase", no_argument, NULL, 'k'},
{"buffer", required_argument, NULL, 'b'},
{NULL, 0, NULL, 0}
};
static const char opt_string[] = "+hvkb:";
static const char help_text[] =
"Usage:\n"
"vmcp [-k] [-b <size>] command\n"
"vmcp [-h|-v]\n\n"
"Options:\n"
"-h or --help :Print usage information, then exit\n"
"-v or --version :Print version information, then exit\n"
"-k or --keepcase :Using this option, vmcp does not convert the command\n"
" to uppercase. The default is to translate the command\n"
" string.\n"
"-b <size> or :defines the buffer size for the response\n"
"--buffer=<size> valid values are from 4096 to 1048576 bytes\n"
" the k and M suffixes are also supported\n";
#endif

View File

@@ -5,11 +5,13 @@ LDLIBS += -lz
all: vmur
libs = $(rootdir)/libvmdump/libvmdump.a
libs = $(rootdir)/libvmdump/libvmdump.a \
$(rootdir)/libvmcp/libvmcp.a $(rootdir)/libutil/libutil.a
objects = vmur.o
vmur: $(objects) $(libs)
$(LINKXX) $(ALL_LDFLAGS) $^ $(LOADLIBES) $(LDLIBS) -o $@
$(LINKXX) $(ALL_LDFLAGS) $^ $(LDLIBS) -o $@
install: all
$(INSTALL) -d -m 755 $(DESTDIR)$(USRSBINDIR) $(DESTDIR)$(MANDIR)/man8

View File

@@ -31,9 +31,13 @@
#include "lib/vmdump.h"
#include "lib/zt_common.h"
#include "lib/util_libc.h"
#include "lib/vmcp.h"
#include "vmur.h"
#define CP_PREFIX_LEN 11
/* Program name */
static char *prog_name;
@@ -243,24 +247,6 @@ fail:
ERR_EXIT("Could not initialize signal handler (errno = %i)\n", errno);
}
/*
* Read at most COUNT bytes from FD into memory at location BUF.
* Return number of bytes read on success, -1 on error.
*/
static ssize_t read_buf(int fd, char *buf, ssize_t count)
{
ssize_t rc, len;
for (len = 0; len < count; len += rc) {
rc = read(fd, &buf[len], count - len);
if (rc == -1)
return -1;
if (rc == 0)
break;
}
return len;
}
/*
* Strip leading CP header from error message
*/
@@ -293,64 +279,63 @@ static void cperr_exit(char *cpcmd, int cprc, char *buf)
static void _cpcmd(char *cpcmd, char **resp, int *rc, int retry, int upper)
{
int fd, len, cprc, bufsize = VMCP_BUFSIZE;
char *buf;
struct vmcp_parm cp;
char cmd[MAXCMDLEN];
int ret;
strcpy(cmd, cpcmd);
if (upper)
to_upper(cmd);
cp.cpcmd = cmd;
cp.do_upper = upper;
cp.buffer_size = VMCP_DEFAULT_BUFSZ;
fd = open(VMCP_DEVICE_NODE, O_RDWR);
if (fd == -1)
retry:
ret = vmcp(&cp);
switch (ret) {
case VMCP_ERR_OPEN:
ERR_EXIT("Could not issue CP command: \"%s\"\n"
"Ensure that vmcp kernel module is loaded!\n", cmd);
do {
if (ioctl(fd, VMCP_SETBUF, &bufsize) == -1)
goto fail;
if (write(fd, cmd, strlen(cmd)) == -1)
goto fail;
if (ioctl(fd, VMCP_GETCODE, &cprc) == -1)
goto fail;
if (ioctl(fd, VMCP_GETSIZE, &len) == -1)
goto fail;
if (len <= bufsize)
break;
else if (retry)
bufsize = len;
else
ERR_EXIT("Not enough buffer space (%i/%i) for CP "
"command '%s'.\nSorry, please issue command "
"on your 3270 console!\n", len, bufsize, cmd);
} while (1);
buf = (char *) malloc(len + 1);
if (!buf)
ERR_EXIT("Out of memory for CP command '%s'\n", cmd);
memset(buf, 0, len + 1);
if (read_buf(fd, buf, len) == -1)
case VMCP_ERR_SETBUF:
goto fail;
case VMCP_ERR_WRITE:
goto fail;
case VMCP_ERR_GETCODE:
goto fail;
case VMCP_ERR_GETSIZE:
goto fail;
case VMCP_ERR_READ:
goto fail;
case VMCP_ERR_TOOSMALL:
if (retry) {
cp.buffer_size = cp.response_size;
free(cp.response);
goto retry;
}
ERR_EXIT("Not enough buffer space (%u/%u) for CP "
"command '%s'.\nSorry, please issue command "
" on your 3270 console!\n", cp.response_size,
cp.buffer_size, cmd);
}
if (rc == NULL) {
if (cprc != 0) {
if (cp.cprc != 0) {
/* caller wants us to handle the error */
cperr_exit(cmd, cprc, buf);
cperr_exit(cmd, cp.cprc, cp.response);
}
} else {
*rc = cprc;
*rc = cp.cprc;
}
if (resp)
*resp = buf;
*resp = cp.response;
else
free(buf);
close(fd);
free(cp.response);
return;
fail:
@@ -1369,30 +1354,6 @@ static void close_reader(struct vmur *info, const char *hold)
cpcmd(cmd, NULL, NULL, 0);
}
/*
* strip leading and trailing blanks
*/
static char *strstrip(char *s)
{
size_t size;
char *end;
size = strlen(s);
if (!size)
return s;
end = s + size - 1;
while (end >= s && isspace(*end))
end--;
*(end + 1) = '\0';
while (*s && isspace(*s))
s++;
return s;
}
/*
* Check whether reader can handle class of reader spool file
*/
@@ -1431,9 +1392,9 @@ static int get_filename_from_reader(struct vmur *info)
sprintf(cmd, "QUERY RDR * %s ALL SHORTDATE", info->spoolid);
cpcmd(cmd, &buf, NULL, 0);
memcpy(name, &buf[130], 8);
strstrip(name);
util_strstrip(name);
memcpy(type, &buf[140], 8);
strstrip(type);
util_strstrip(type);
free(buf);
if (strlen(name) == 0) {
ERR("Please specify name to receive "

View File

@@ -31,14 +31,6 @@ do { \
ERR_EXIT(str " can only be specified once.\n"); \
} while (0)
#define VMCP_DEVICE_NODE "/dev/vmcp"
#define VMCP_BUFSIZE 0x4000
#define VMCP_GETSIZE _IOR(0x10, 3, int)
#define VMCP_SETBUF _IOW(0x10, 2, int)
#define VMCP_GETCODE _IOR(0x10, 1, int)
#define CP_PREFIX_LEN 11
#define VMRDR_DEVICE_NODE "/dev/vmrdr-0.0.000c"
#define VMPUN_DEVICE_NODE "/dev/vmpun-0.0.000d"
#define VMPRT_DEVICE_NODE "/dev/vmprt-0.0.000e"

View File

@@ -111,10 +111,14 @@ In rare situations a device might temporarily not be accessible to
the subchannel. Then "none" is displayed as the device identifier and the
other device attributes are empty.
For subchannels bound to an alternate driver (most notably vfio_ccw) the
device identifier may also be displayed as "none". In this case use the
\fB--vfio\fR option to show VFIO specific subchannel information.
.SH AUTHOR
.nf
This man-page was written by Stefan Bader <shbader@de.ibm.com>.
New options added by Sebastian Ott <sebott@linux.vnet.ibm.com>.
New options added by Sebastian Ott <sebott@linux.ibm.com>.
.SH "SEE ALSO"
.BR chccwdev (8)
.fi

View File

@@ -649,14 +649,12 @@ static void print_defunct_devices(struct util_rec *rec, char *path)
snprintf(buf, sizeof(buf), "%s", device);
}
if (cmd.opt_devrange && cmd.rng_count > 0 &&
!id_in_ranges_list(device)) {
util_scandir_free(de_vec, count);
!id_in_ranges_list(device))
continue;
}
if (fill_device_info(rec, path, device) != 0) {
util_scandir_free(de_vec, count);
if (fill_device_info(rec, path, device) != 0)
continue;
}
if (cmd.opt_uppercase)
util_str_toupper(buf);
util_rec_set(rec, "device", "%s", buf);
@@ -719,7 +717,7 @@ static void print_subchannels_of_type(enum sch_type type_requested,
if (!cmd.opt_devrange && cmd.rng_count > 0)
return;
path = util_path_sysfs("devices");
count = util_scandir(&de_vec, alphasort, path, "css.*/");
count = util_scandir(&de_vec, alphasort, path, "css.*");
free(path);
for (i = 0; i < count; i++) {
path = util_path_sysfs("devices/%s/defunct", de_vec[i]->d_name);

View File

@@ -2,7 +2,7 @@
#
# lsluns - list LUNs discovered in the FC SAN, or show encryption state of attached LUNs
#
# Copyright IBM Corp. 2008, 2017
# Copyright IBM Corp. 2008, 2018
#
# s390-tools is free software; you can redistribute it and/or modify
# it under the terms of the MIT license. See LICENSE for details.
@@ -152,6 +152,11 @@ sub get_lun_hash
my %lun_hash;
foreach my $device (</$sg_dir/sg*>) {
# skip non-zfcp SCSI devices and avoid file access error messages
next unless -r "$device/device/fcp_lun";
next unless -r "$device/device/wwpn";
next unless -r "$device/device/hba_id";
my $l = `cat $device/device/fcp_lun`;
my $p = `cat $device/device/wwpn`;
my $a = `cat $device/device/hba_id`;
@@ -170,9 +175,8 @@ sub get_lun_hash
sub lsluns_usage {
print <<EOD;
Usage:
This tool is designed for environments where all SCSI devices are attached
through the zfcp device driver. Expect error messages in mixed environments
such as with iSCSI.
This tool is designed for environments with SCSI devices attached
through the zfcp device driver.
$PROGRAM_NAME [-c <busid>] ... [-p <wwpn>] ... [-h] [-v]
@@ -220,7 +224,7 @@ EOD
sub lsluns_version {
print "$PROGRAM_NAME: version %S390_TOOLS_VERSION%\n";
print "Copyright IBM Corp. 2008, 2017\n";
print "Copyright IBM Corp. 2008, 2018\n";
}
sub lsluns_invalid_usage {
@@ -235,8 +239,15 @@ sub get_env_list
my @res ;
my %res_hash;
if (!</sys/bus/ccw/drivers/zfcp/*.*.*/>) {
print "$PROGRAM_NAME: No adapter exists\n";
return;
}
@res = </sys/bus/ccw/drivers/zfcp/*.*.*/0x*>;
return () if (!@res);
if (!@res) {
print "$PROGRAM_NAME: No port on any adapter exists\n";
return;
}
foreach my $entry (@res) {
my $a = ${[split('/', $entry)]}[-2];
my $p = ${[split('/', $entry)]}[-1];

View File

@@ -28,9 +28,8 @@ zfcp-attached LUNs
.SH DESCRIPTION
.PP
This tool is designed for environments where all SCSI devices are attached
through the zfcp device driver. Expect error messages in mixed environments
such as with iSCSI.
This tool is designed for environments with SCSI devices attached
through the zfcp device driver.
.B lsluns
lists all logical unit numbers (LUNs) discovered in the

View File

@@ -2,7 +2,7 @@
#
# lstape - Tool to show information about tape devices
#
# Copyright IBM Corp. 2003, 2017
# Copyright IBM Corp. 2003, 2018
#
# s390-tools is free software; you can redistribute it and/or modify
# it under the terms of the MIT license. See LICENSE for details.
@@ -48,6 +48,9 @@ function PrintUsage() {
: -v|--version
: Display the version of the tools package and
: the lstape command.
:
:$(basename $0) without the --ccw-only option causes extra SAN traffic
:for each SCSI tape or changer device by invoking the sg_inq command.
EOD
}
@@ -55,7 +58,7 @@ function PrintVersion()
{
cat <<-EOD
$CMD: version %S390_TOOLS_VERSION%
Copyright IBM Corp. 2003, 2017
Copyright IBM Corp. 2003, 2018
EOD
}
@@ -220,6 +223,24 @@ function SysfsCreateListCCW() {
' | sort
}
# handle SCSI device not necessarily zfcp-attached, e.g. virtio-scsi-ccw
function SCSISearchCCWBusid()
{
local SCSI_DEV=$1
local SDEVCAN=$(readlink -e $SCSI_DEV)
while [ -n "$SDEVCAN" ]; do
# ascend to parent: strip last path part
SDEVCAN=${SDEVCAN%/*}
[ -h $SDEVCAN/subsystem ] || continue
local SUBSYSTEM=$(readlink -e $SDEVCAN/subsystem)
if [ "${SUBSYSTEM##*/}" = "ccw" ]; then
echo ${SDEVCAN##*/}
return
fi
done
echo "N/A"
}
function SysfsCreateListSCSI()
{
for SCSI_DEV in $1/bus/scsi/devices/*:*:*:*; do
@@ -249,11 +270,16 @@ function SysfsCreateListSCSI()
if [ -h $SG_DEV ]; then
# deprecated sysfs layout
SG_DEV=$(echo $SG_DEV | awk -F: '{print $NF}')
else
elif [ -d $SCSI_DEV/scsi_generic ]; then
SG_DEV=$(basename $SG_DEV/*)
else
SG_DEV=""
fi
if [ "$SG_INQ" != "" ]; then
if [ -z "$SG_DEV" ]; then
SG_DEV="N/A"
TAPE_SERIAL="NO/SG"
elif [ "$SG_INQ" != "" ]; then
TAPE_SERIAL=$(
sg_inq /dev/$SG_DEV |
awk '/serial/{print $NF}'
@@ -291,17 +317,31 @@ function SysfsCreateListSCSI()
if [ "$CHG_IDX" != "" ]; then
TAPE_DEV=$CHG_IDX
fi
elif [ -r /proc/scsi/$DEV_NAME ]; then
if [ "$TAPE_SERIAL" != "NO/INQ" ]; then
elif [ "$(echo "$SCSI_LIST"|grep lin_tape)" != "" ]; then
# bash glob sorts so IBMtape0 comes before IBMtape0n
local IBM_PATH=$(
ls -1d $SCSI_DEV/lin_tape/$DEV_NAME[0-9]* |
head -n 1)
if [ -d "$IBM_PATH" ]; then
IBM_IDX=${IBM_PATH##*/}
else
# deprecated sysfs layout
IBM_IDX=$(
awk '$3 == "'$TAPE_SERIAL'"{
print $1
}' /proc/scsi/$DEV_NAME
echo "$SCSI_LIST" |
awk -F: '/lin_tape\:'"$DEV_NAME"'[0-9]+$/{print $NF}'
)
fi
if [ "$IBM_IDX" != "" ]; then
TAPE_DEV=$IBM_IDX
fi
elif [ -r /proc/scsi/$DEV_NAME ]; then
IBM_IDX=$(
grep -wF "$SCSI_ID" /proc/scsi/$DEV_NAME |
cut -d ' ' -f 1
)
if [ "$IBM_IDX" != "" ]; then
TAPE_DEV=$DEV_NAME$IBM_IDX
fi
fi
fi
printf "$SCSIFORMAT" \
@@ -313,9 +353,16 @@ function SysfsCreateListSCSI()
$STATE
if $VERBOSE; then
if [ -r $SCSI_DEV/hba_id ]; then
HBA_ID=$(cat $SCSI_DEV/hba_id)
else
HBA_ID=$(SCSISearchCCWBusid $SCSI_DEV)
fi
WWPN="N/A"
[ -r $SCSI_DEV/wwpn ] && WWPN=$(cat $SCSI_DEV/wwpn)
printf "$SCSIVFORMAT" \
$(cat $SCSI_DEV/hba_id) \
$(cat $SCSI_DEV/wwpn) \
"$HBA_ID" \
"$WWPN" \
$TAPE_SERIAL
fi
done

View File

@@ -1,8 +1,8 @@
.\" Copyright 2017 IBM Corp.
.\" Copyright 2017, 2018 IBM Corp.
.\" s390-tools is free software; you can redistribute it and/or modify
.\" it under the terms of the MIT license. See LICENSE for details.
.\"
.TH LSTAPE 8 "Jul 2007" "s390-tools"
.TH LSTAPE 8 "Jun 2018" "s390-tools"
.SH NAME
lstape \- list tape devices.
@@ -20,6 +20,8 @@ lstape \- list tape devices.
.br
.RB [ -t
.IR <device-type> [, <device-type> ] "" ...]
.br
.RI [ <device-bus-ID> ...]
.SH DESCRIPTION
The lstape command lists all available tape devices on the current host. For
@@ -27,19 +29,8 @@ channel attached tape devices this output is the same as the contents of
/proc/tapedevices (which is obsolete) but also includes offline devices. By
default all tape devices are displayed.
Since SCSI tape devices are accessed differently to channel attached tape
devices they are only visible if they are known to the SCSI layer. There
are at least two possible drivers that can claim a SCSI tape device and the
lstape command tries to find out which one this is. For the generic tape
and changer driver the device names start with "st" or "sch", while for the
IBM tape driver this would be "IBMtape" or "IBMchanger". If "N/A" is shown,
the correct driver could not be obtained.
This happens for example if there is no sg_inq command installed which is
required to read the drive's serial number which in turn is used to find out
the device number of the IBM tape driver.
The serial number of a SCSI tape can be displayed with the --verbose option. If
there is no sg_inq command available "NO/INQ" is shown as the tape's serial.
The lstape command without the --ccw-only option causes extra SAN traffic
for each SCSI tape or changer device by invoking the sg_inq command.
.SH OPTIONS
.TP 8
@@ -75,12 +66,64 @@ on the output of SCSI devices.
.TP
.BR -t | --type " \fI<device-type>\fR"
Limit output to given device types (currently only applies to channel attached
Limit output to given device types, for example 3490
(currently only applies to channel-attached
tape devices).
.TP
\fB<device-type>\fR =
Device type of devices that should be displayed (e.g. 3490).
.I <device-bus-ID>
Limits the output to information about the specified tape device or
devices only. For CCW-attached devices only.
.SH OUTPUT FIELDS FOR SCSI TAPE/CHANGER DEVICES
.TP
.B Generic
SCSI generic device file for the tape drive, for example /dev/sg0.
"N/A" if the SCSI generic (sg) kernel functionality is not available.
.TP
.B Device
Main character device node file for accessing the tape drive or medium changer.
SCSI tape devices are only visible if they are known to the SCSI layer. There
are at least two possible drivers that can claim a SCSI tape device. The
lstape command tries to determine the device driver. For the generic tape
and changer driver the device names start with "st" or "sch", while for the
IBM tape driver this would be "IBMtape" or "IBMchanger". If "N/A" is shown,
the device driver could not be determined.
.TP
.B Target
Linux SCSI device name in H:C:T:L format.
.TP
.B Vendor
The vendor field from the SCSI device.
.TP
.B Model
The model field from the SCSI device.
.TP
.B Type
"tapedrv" for a tape drive or "changer" for a medium changer.
.TP
.B State
The state of the SCSI device object in the kernel.
Any state other than "running" can indicate problems.
.PP
For SCSI devices, the --verbose option additionally displays:
.TP
.B HBA
The device bus-ID of the FCP device
or of the virtio-scsi-ccw virtual HBA
through which the tape drive is attached.
"N/A" if the device does not have a sysfs ancestor with subsystem ccw.
.TP
.B WWPN
The WWPN (worldwide port name) of the tape drive in the SAN.
"N/A" if device is not attached through zfcp.
.TP
.B Serial
The serial number.
"NO/INQ" if there is no sg_inq command available.
"NO/SG" if no SCSI generic (sg) kernel support is available.
.SH EXAMPLES
\fBlstape\fR
@@ -92,3 +135,8 @@ List all tape devices that are available
.RS
Show all 3490 CCW devices that are online.
.RE
\fBlstape --scsi-only --verbose\fR
.RS
Show all SCSI tape or changer devices with maximum information.
.RE

View File

@@ -2,7 +2,7 @@ include ../../common.mak
all: lsqeth
libs = $(rootdir)/libutil/libutil.a
libs = $(rootdir)/libvmcp/libvmcp.a $(rootdir)/libutil/libutil.a
lsqeth: lsqeth.o misc.o $(libs)

View File

@@ -37,6 +37,7 @@
#include "lib/util_rec.h"
#include "lib/util_scandir.h"
#include "lib/zt_common.h"
#include "lib/vmcp.h"
#include "misc.h"
@@ -44,15 +45,6 @@
#define MAX_ID_LENGTH 10
#define PAGE_SIZE 4096
/*
* Constants for CP call (taken from vmcp.h)
*/
#define VMCP_DEVICE_NODE "/dev/vmcp"
#define VMCP_GETCODE _IOR(0x10, 1, int)
#define VMCP_SETBUF _IOW(0x10, 2, int)
#define VMCP_GETSIZE _IOR(0x10, 3, int)
#define CP_BUF_SIZE 8192
/*
* Private data
*/
@@ -197,32 +189,38 @@ static void ethtool_checksumming(char *buf, const char *if_name)
*/
static void exec_cp(char **argz, size_t *argz_len, const char *fmt, ...)
{
int fd, response_code, response_size, rc;
static const int buf_size = CP_BUF_SIZE;
char *buf, *command;
struct vmcp_parm cp;
char *command;
va_list ap;
int rc;
fd = open(VMCP_DEVICE_NODE, O_RDWR);
if (fd == -1)
errx(EXIT_FAILURE, "Could not open device %s", VMCP_DEVICE_NODE);
if (ioctl(fd, VMCP_SETBUF, &buf_size) == -1)
errx(EXIT_FAILURE, "Could not set buffer size");
UTIL_VASPRINTF(&command, fmt, ap);
if (write(fd, command, strlen(command)) == -1)
errx(EXIT_FAILURE, "Could not issue CP command");
cp.cpcmd = command;
cp.do_upper = false;
cp.buffer_size = VMCP_DEFAULT_BUFSZ;
rc = vmcp(&cp);
free(command);
if (ioctl(fd, VMCP_GETCODE, &response_code) == -1)
switch (rc) {
case VMCP_ERR_OPEN:
errx(EXIT_FAILURE, "Could not open device %s", VMCP_DEVICE_NODE);
case VMCP_ERR_SETBUF:
errx(EXIT_FAILURE, "Could not set buffer size");
case VMCP_ERR_GETCODE:
errx(EXIT_FAILURE, "Could not query return code");
if (ioctl(fd, VMCP_GETSIZE, &response_size) == -1)
case VMCP_ERR_GETSIZE:
errx(EXIT_FAILURE, "Could not query response size");
buf = util_malloc(buf_size);
rc = misc_read_buf(fd, buf, buf_size);
if (rc == -1)
case VMCP_ERR_WRITE:
errx(EXIT_FAILURE, "Could not issue CP command");
case VMCP_ERR_READ:
errx(EXIT_FAILURE, "Could not read CP response");
rc = argz_create_sep(buf, '\n', argz, argz_len);
case VMCP_ERR_TOOSMALL:
break; /* Truncated CP response treated as good */
}
rc = argz_create_sep(cp.response, '\n', argz, argz_len);
if (rc)
errx(EXIT_FAILURE, "Memory allocation error for CP response processing");
free(buf);
free(cp.response);
}
/*

View File

@@ -1,21 +1,24 @@
include ../../common.mak
all: chzcrypt lszcrypt
all: chzcrypt lszcrypt zcryptctl
libs = $(rootdir)/libutil/libutil.a
chzcrypt: chzcrypt.o misc.o $(libs)
lszcrypt: lszcrypt.o misc.o $(libs)
zcryptctl: zcryptctl.o misc.o $(libs)
install: all
$(INSTALL) -d -m 755 $(DESTDIR)$(BINDIR)
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 755 chzcrypt $(DESTDIR)$(BINDIR)
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 755 lszcrypt $(DESTDIR)$(BINDIR)
$(INSTALL) -g $(GROUP) -o $(OWNER) -m 755 zcryptctl $(DESTDIR)$(BINDIR)
$(INSTALL) -d -m 755 $(DESTDIR)$(MANDIR)/man8
$(INSTALL) -m 644 -c chzcrypt.8 $(DESTDIR)$(MANDIR)/man8
$(INSTALL) -m 644 -c lszcrypt.8 $(DESTDIR)$(MANDIR)/man8
$(INSTALL) -m 644 -c zcryptctl.8 $(DESTDIR)$(MANDIR)/man8
clean:
rm -f *.o chzcrypt lszcrypt
rm -f *.o chzcrypt lszcrypt zcryptctl
.PHONY: all install clean

View File

@@ -57,6 +57,7 @@ Set all available cryptographic device(s) online or offline.
.B <device id>
Specifies a cryptographic device which will be set either online or offline.
The device can either be a card device or a queue device.
A queue device can only get switched online when the providing card is online.
Please note that the card device and queue device representation are both
in hexadecimal notation.
@@ -95,7 +96,7 @@ Print version information and exit.
.B chzcrypt -e 0 1 12
Will set the cryptographic card devices 0, 1 and 12 online.
.TP
.B chzcrypt -e 01.0038
.B chzcrypt -e 10.0038
Will set the cryptographic device '10.0038' respectively card id 16
(0x10) with domain 56 (0x38) online.
.TP

View File

@@ -54,8 +54,8 @@ status.
.B -V, --verbose
The verbose level for cryptographic device information.
With this verbose level additional information like hardware card type,
hardware queue depth, pending request queue count, outstanding
request queue count, and installed function facilities are displayed.
hardware queue depth, pending requests count, installed function
facilities and driver binding is displayed.
.TP 8
.B <device-id>
Specifies a cryptographic device to display. A cryptographic device can be

View File

@@ -1,7 +1,7 @@
/**
* lszcrypt - Display zcrypt devices and configuration settings
*
* Copyright IBM Corp. 2008, 2017
* Copyright IBM Corp. 2008, 2018
*
* s390-tools is free software; you can redistribute it and/or modify
* it under the terms of the MIT license. See LICENSE for details.
@@ -56,6 +56,25 @@ struct lszcrypt_l *lszcrypt_l = &l;
#define MASK_CLASS_STATELESS 0x00400000
#define CLASS_STATELESS "restricted function set"
/*
* facility bits
*/
#define MAX_FAC_BITS 9
static struct fac_bits_s {
int mask;
char c;
} fac_bits[MAX_FAC_BITS] = {
{ 0x80000000, 'S' },
{ 0x40000000, 'M' },
{ 0x20000000, 'C' },
{ 0x10000000, 'D' },
{ 0x08000000, 'A' },
{ 0x04000000, 'X' },
{ 0x02000000, 'N' },
{ 0x00800000, 'F' },
{ 0x00400000, 'R' },
};
/*
* Program configuration
*/
@@ -66,7 +85,7 @@ const struct util_prg prg = {
{
.owner = "IBM Corp.",
.pub_first = 2008,
.pub_last = 2017,
.pub_last = 2018,
},
UTIL_PRG_COPYRIGHT_END
}
@@ -255,7 +274,8 @@ static void show_capability(const char *id_str)
/* Skip devices, which are not supported by zcrypt layer */
if (!util_path_is_readable("%s/type", dev) ||
!util_path_is_readable("%s/online", dev)) {
printf("Detailed capability information for %s (hardware type %ld) is not available.\n", card, hwtype);
printf("Detailed capability information for %s (hardware type %ld) is not available.\n",
card, hwtype);
return;
}
cbuf[0] = '\0';
@@ -299,11 +319,13 @@ static void show_capability(const char *id_str)
} else if (func_val & MASK_EP11) {
printf("%s", CAP_EP11);
} else {
printf("Detailed capability information for %s (hardware type %ld) is not available.", card, hwtype);
printf("Detailed capability information for %s (hardware type %ld) is not available.",
card, hwtype);
}
break;
default:
printf("Detailed capability information for %s (hardware type %ld) is not available.", card, hwtype);
printf("Detailed capability information for %s (hardware type %ld) is not available.",
card, hwtype);
break;
}
printf("\n");
@@ -315,17 +337,22 @@ static void show_capability(const char *id_str)
static void read_subdev_rec_default(struct util_rec *rec, const char *grp_dev,
const char *sub_dev)
{
unsigned long facility;
char buf[256];
unsigned long facility;
util_file_read_line(buf, sizeof(buf), "%s/type", grp_dev);
util_rec_set(rec, "type", buf);
util_file_read_line(buf, sizeof(buf), "%s/%s/online", grp_dev, sub_dev);
if (strcmp(buf, "0") == 0)
util_rec_set(rec, "online", "offline");
if (util_file_read_line(buf, sizeof(buf), "%s/type", grp_dev))
util_rec_set(rec, "type", "-");
else
util_rec_set(rec, "online", "online");
util_rec_set(rec, "type", buf);
if (util_file_read_line(buf, sizeof(buf), "%s/%s/online",
grp_dev, sub_dev))
util_rec_set(rec, "online", "-");
else
if (strcmp(buf, "0") == 0)
util_rec_set(rec, "online", "offline");
else
util_rec_set(rec, "online", "online");
util_file_read_ul(&facility, 16, "%s/ap_functions", grp_dev);
if (facility & MASK_COPRO)
@@ -339,7 +366,7 @@ static void read_subdev_rec_default(struct util_rec *rec, const char *grp_dev,
util_file_read_line(buf, sizeof(buf), "%s/%s/request_count",
grp_dev, sub_dev);
util_rec_set(rec, "request_count", buf);
util_rec_set(rec, "requests", buf);
}
/*
@@ -348,20 +375,19 @@ static void read_subdev_rec_default(struct util_rec *rec, const char *grp_dev,
static void read_subdev_rec_verbose(struct util_rec *rec, const char *grp_dev,
const char *sub_dev)
{
int i;
unsigned long facility;
char buf[256];
long depth;
char buf[256], afile[PATH_MAX];
long depth, pending1, pending2;
if (l.verbose == 0)
return;
util_file_read_line(buf, sizeof(buf), "%s/%s/pendingq_count",
grp_dev, sub_dev);
util_rec_set(rec, "pendingq_count", buf);
util_file_read_line(buf, sizeof(buf), "%s/%s/requestq_count",
grp_dev, sub_dev);
util_rec_set(rec, "requestq_count", buf);
util_file_read_l(&pending1, 10, "%s/%s/pendingq_count",
grp_dev, sub_dev);
util_file_read_l(&pending2, 10, "%s/%s/requestq_count",
grp_dev, sub_dev);
util_rec_set(rec, "pending", "%ld", pending1 + pending2);
util_file_read_line(buf, sizeof(buf), "%s/hwtype", grp_dev);
util_rec_set(rec, "hwtype", buf);
@@ -370,7 +396,18 @@ static void read_subdev_rec_verbose(struct util_rec *rec, const char *grp_dev,
util_rec_set(rec, "depth", "%02d", depth + 1);
util_file_read_ul(&facility, 16, "%s/ap_functions", grp_dev);
util_rec_set(rec, "facility", "0x%08x", facility);
for (i = 0; i < MAX_FAC_BITS; i++)
buf[i] = facility & fac_bits[i].mask ? fac_bits[i].c : '-';
buf[i] = '\0';
util_rec_set(rec, "facility", buf);
snprintf(afile, sizeof(afile), "%s/%s/driver", grp_dev, sub_dev);
afile[sizeof(afile) - 1] = '\0';
memset(buf, 0, sizeof(buf));
if (readlink(afile, buf, sizeof(buf)) > 0)
util_rec_set(rec, "driver", strrchr(buf, '/') + 1);
else
util_rec_set(rec, "driver", "-no-driver-");
}
/*
@@ -382,9 +419,13 @@ static void show_subdevice(struct util_rec *rec, const char *grp_dev,
if (!util_path_is_dir("%s/%s", grp_dev, sub_dev))
errx(EXIT_FAILURE, "Error - cryptographic device %s/%s does not exist.", grp_dev, sub_dev);
/* Skip devices, which are not supported by zcrypt layer */
if (!util_path_is_readable("%s/type", grp_dev) ||
!util_path_is_readable("%s/%s/online", grp_dev, sub_dev))
/*
* If not verbose mode, skip devices which are not supported
* by the zcrypt layer.
*/
if (l.verbose == 0 &&
(!util_path_is_readable("%s/type", grp_dev) ||
!util_path_is_readable("%s/%s/online", grp_dev, sub_dev)))
return;
util_rec_set(rec, "card", sub_dev);
@@ -414,11 +455,13 @@ static void show_subdevices(struct util_rec *rec, const char *grp_dev)
*/
static void read_rec_default(struct util_rec *rec, const char *grp_dev)
{
unsigned long facility;
char buf[256];
unsigned long facility;
util_file_read_line(buf, sizeof(buf), "%s/type", grp_dev);
util_rec_set(rec, "type", buf);
if (util_file_read_line(buf, sizeof(buf), "%s/type", grp_dev))
util_rec_set(rec, "type", "-");
else
util_rec_set(rec, "type", buf);
util_file_read_ul(&facility, 16, "%s/ap_functions", grp_dev);
if (facility & MASK_COPRO)
@@ -430,14 +473,16 @@ static void read_rec_default(struct util_rec *rec, const char *grp_dev)
else
util_rec_set(rec, "mode", "Unknown");
util_file_read_line(buf, sizeof(buf), "%s/online", grp_dev);
if (strcmp(buf, "0") == 0)
util_rec_set(rec, "online", "offline");
if (util_file_read_line(buf, sizeof(buf), "%s/online", grp_dev))
util_rec_set(rec, "online", "-");
else
util_rec_set(rec, "online", "online");
if (strcmp(buf, "0") == 0)
util_rec_set(rec, "online", "offline");
else
util_rec_set(rec, "online", "online");
util_file_read_line(buf, sizeof(buf), "%s/request_count", grp_dev);
util_rec_set(rec, "request_count", buf);
util_rec_set(rec, "requests", buf);
}
/*
@@ -445,18 +490,17 @@ static void read_rec_default(struct util_rec *rec, const char *grp_dev)
*/
static void read_rec_verbose(struct util_rec *rec, const char *grp_dev)
{
int i;
unsigned long facility;
char buf[256];
long depth;
char buf[256], afile[PATH_MAX];
long depth, pending1, pending2;
if (l.verbose == 0)
return;
util_file_read_line(buf, sizeof(buf), "%s/pendingq_count", grp_dev);
util_rec_set(rec, "pendingq_count", buf);
util_file_read_line(buf, sizeof(buf), "%s/requestq_count", grp_dev);
util_rec_set(rec, "requestq_count", buf);
util_file_read_l(&pending1, 10, "%s/pendingq_count", grp_dev);
util_file_read_l(&pending2, 10, "%s/requestq_count", grp_dev);
util_rec_set(rec, "pending", "%ld", pending1 + pending2);
util_file_read_line(buf, sizeof(buf), "%s/hwtype", grp_dev);
util_rec_set(rec, "hwtype", buf);
@@ -465,7 +509,18 @@ static void read_rec_verbose(struct util_rec *rec, const char *grp_dev)
util_rec_set(rec, "depth", "%02d", depth + 1);
util_file_read_ul(&facility, 16, "%s/ap_functions", grp_dev);
util_rec_set(rec, "facility", "0x%08x", facility);
for (i = 0; i < MAX_FAC_BITS; i++)
buf[i] = facility & fac_bits[i].mask ? fac_bits[i].c : '-';
buf[i] = '\0';
util_rec_set(rec, "facility", buf);
snprintf(afile, sizeof(afile), "%s/driver", grp_dev);
afile[sizeof(afile) - 1] = '\0';
memset(buf, 0, sizeof(buf));
if (readlink(afile, buf, sizeof(buf)) > 0)
util_rec_set(rec, "driver", strrchr(buf, '/') + 1);
else
util_rec_set(rec, "driver", "-no-driver-");
}
/*
@@ -481,9 +536,14 @@ static void show_device(struct util_rec *rec, const char *device)
grp_dev = util_path_sysfs("devices/ap/%s", device);
if (!util_path_is_dir(grp_dev))
errx(EXIT_FAILURE, "Error - cryptographic device %s does not exist.", device);
/* Skip devices, which are not supported by zcrypt layer */
if (!util_path_is_readable("%s/type", grp_dev) ||
!util_path_is_readable("%s/online", grp_dev)) {
/*
* If not verbose mode, skip devices which are not supported
* by the zcrypt layer.
*/
if (l.verbose == 0 &&
(!util_path_is_readable("%s/type", grp_dev) ||
!util_path_is_readable("%s/online", grp_dev))) {
goto out_free;
}
util_rec_set(rec, "card", card);
@@ -506,8 +566,7 @@ static void define_rec_default(struct util_rec *rec)
util_rec_def(rec, "type", UTIL_REC_ALIGN_LEFT, 5, "TYPE");
util_rec_def(rec, "mode", UTIL_REC_ALIGN_LEFT, 11, "MODE");
util_rec_def(rec, "online", UTIL_REC_ALIGN_LEFT, 7, "STATUS");
util_rec_def(rec, "request_count", UTIL_REC_ALIGN_RIGHT, 11,
"REQUEST_CNT");
util_rec_def(rec, "requests", UTIL_REC_ALIGN_RIGHT, 8, "REQUESTS");
}
/*
@@ -517,13 +576,11 @@ static void define_rec_verbose(struct util_rec *rec)
{
if (l.verbose == 0)
return;
util_rec_def(rec, "pendingq_count", UTIL_REC_ALIGN_RIGHT, 12,
"PENDINGQ_CNT");
util_rec_def(rec, "requestq_count", UTIL_REC_ALIGN_RIGHT, 12,
"REQUESTQ_CNT");
util_rec_def(rec, "hwtype", UTIL_REC_ALIGN_RIGHT, 7, "HW_TYPE");
util_rec_def(rec, "depth", UTIL_REC_ALIGN_RIGHT, 7, "Q_DEPTH");
util_rec_def(rec, "pending", UTIL_REC_ALIGN_RIGHT, 8, "PENDING");
util_rec_def(rec, "hwtype", UTIL_REC_ALIGN_RIGHT, 6, "HWTYPE");
util_rec_def(rec, "depth", UTIL_REC_ALIGN_RIGHT, 6, "QDEPTH");
util_rec_def(rec, "facility", UTIL_REC_ALIGN_LEFT, 10, "FUNCTIONS");
util_rec_def(rec, "driver", UTIL_REC_ALIGN_LEFT, 11, "DRIVER");
}
/*

147
zconf/zcrypt/zcryptctl.8 Normal file
View File

@@ -0,0 +1,147 @@
.\" zcryptctl.8
.\"
.\" Copyright 2018 IBM Corp.
.\" s390-tools is free software; you can redistribute it and/or modify
.\" it under the terms of the MIT license. See LICENSE for details.
.\"
.\" use
.\" groff -man -Tutf8 zcryptctl.8
.\" or
.\" nroff -man zcryptctl.8
.\" to process this source
.\"
.TH ZCRYPTCTL 8 "AUG 2018" "s390-tools"
.SH NAME
zcryptctl \- display information and administrate zcrypt multiple device nodes
.SH SYNOPSIS
.TP 8
.B zcryptctl list
.TP
.B zcryptctl create
.R [
.I node-name
.R ]
.TP
.B zcryptctl destroy
.I node-name
.TP
.B zcryptctl addap
.R |
.B delap
.I node-name adapter-nr
.TP
.B zcryptctl adddom
.R |
.B deldom
.I node-name domain-nr
.TP
.B zcryptctl addioctl
.R |
.B delioctl
.I node-name ioctl-term
.TP
.B zcryptctl config
.I config-file
.TP
.B zcryptctl listconfig
.SH DESCRIPTION
The
.B zcryptctl
command displays information and maintains the multi device node
extension for the zcrypt device driver.
.P
With the multi device node extension you can create and configure
additional zcrypt device nodes which can be used as alternate device
nodes to access the crypto hardware provided by the zcrypt device
driver. Each zcrypt device node can be restricted in terms of crypto
cards, domains, and available ioctls. Such a device node can be used
as a base for container solutions like Docker to control and restrict
the access to crypto resources.
.SH COMMANDS
.TP 8
.B zcryptctl list
Show all the additional device nodes that are currently active.
.TP
.B zcryptctl create
.R [
.I node-name
.R ]
Create a new zcrypt device node. The \fInode-name\fP might be given
and needs to be unique and not in use. If there is no node name
provided, the zcrypt device driver will create a new one with pattern
zcrypt_\fIx\fP, with \fIx\fP being the next free number. Up to 256
additional device nodes can be created. The newly created additional
device node appears in /dev and has read and write permissions enabled
only for root. By default all adapters, domains and ioctls are
initially disabled on this new device node.
.TP
.B zcryptctl destroy
.I node-name
Destroy an additional zcrypt device node. The device node is only
marked for disposal and destroyed when it is no longer used.
.TP
.B zcryptctl addap
.R |
.B delap
.I node-name adapter-nr
Update the filter for the specified zcrypt device node and add or
delete a crypto adapter to be accessible via this node. The symbol
\fBALL\fP can be used to enable or disable all adapters.
.TP
.B zcryptctl adddom
.R |
.B deldom
.I node-name domain-nr
Update the filter for the specified zcrypt device node and add or
delete a domain to be accessible through this node. The symbol
\fBALL\fP can be used to enable or disable all domains.
.TP
.B zcryptctl addioctl
.R |
.B delioctl
.I node-name ioctl-term
Update the filter for the specified zcrypt device node and add or
delete an ioctl. The ioctl might be specified as symbolic string (one
of \fBICARSAMODEXPO\fP, \fBICARSACRT\fP, \fBZSECSENDCPRB\fP,
\fBZSENDEP11CPRB\fP, \fBZCRYPT_DEVICE_STATUS\fP,
\fBZCRYPT_STATUS_MASK\fP, \fBZCRYPT_QDEPTH_MASK\fP,
\fBZCRYPT_PERDEV_REQCNT\fP) or numeric value in the range 0-255 and
the symbol \fBALL\fP can be used to include all ioctls.
.TP
.B zcryptctl config
.I config-file
Process a config file. The given configuration file is read line by
line and the settings are applied. Syntax is simple:
.RS
.IP "node=<node-name>"
.IP "aps=<list of ap numbers separated by space, tab or ','>"
.IP "doms=<list of domain numbers separated by space, tab or ','>"
.IP "ioctls=<list of ioctl as numeric or symbolic number separated by space, tab or ','>"
.LP
Empty lines are ignored and the '#' marks the rest of the
line as comment.
.LP
The \fBnode=\fP line creates a new zcrypt device node, the \fBaps=\fP,
\fBdoms=\fP and \fBioctls=\fP lines customize the previously created
node. The symbol \fBALL\fP is also recognized for aps, doms, and
ioctls.
.LP
Each action must fit into one line, spreading over multiple lines is
not supported. But you can use more than one \fBaps=\fP, \fBdoms=\fP
and \fBioctls=\fP lines to customize the very same node.
.LP
Processing stops when a line cannot be parsed or the current action
fails. In this case the exit status is non zero but the successful
actions until the failure occurs are not rolled back.
.RE
.TP
.B zcryptctl listconfig
List the current configuration in a form suitable for input to the
\fBzcryptctl config\fP command.
.LP
.SH EXIT STATUS
On successful completion of the command the exit status is 0. A non
zero return code (and some kind of failure message) is emitted if the
processing could not complete successful.
.SH SEE ALSO
\fBlszcrypt\fR(8)

1030
zconf/zcrypt/zcryptctl.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -8,6 +8,7 @@ install: all
$(MAKE) -C src install
$(MAKE) -C man install
$(MAKE) -C dracut install
$(MAKE) -C initramfs install
clean:
$(MAKE) -C src clean

View File

@@ -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,30 +30,27 @@ 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
# Exit early if root device type is unknown
if ! lszdev --by-path / >/dev/null 2>&1 ; then
return 0
fi
# 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 early + root device configuration
_tempfile=$(mktemp --tmpdir dracut-zdev.XXXXXX)
if chzdev --export - --persistent --by-path / >/dev/null 2>&1 ; then
# Use persistent configuration
chzdev --export "$_tempfile" --persistent --by-path / --quiet --type
else
# Use active configuration
chzdev --export "$_tempfile" --active --by-path / --quiet --type
sed -i -e 's/active/persistent/g' "$_tempfile"
fi
chzdev --export "$_tempfile" --persistent --by-path / --quiet \
--type 2>/dev/null
chzdev --export - --persistent --by-attrib "zdev:early=1" --quiet \
--type 2>/dev/null >> "$_tempfile"
# Apply via --import to prevent other devices from being configured
chzdev --import "$_tempfile" --persistent --base "/etc=$initdir/etc" \

View File

@@ -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

View File

@@ -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

View File

@@ -189,6 +189,7 @@ struct value_map {
* in the persistent configuration
* @nounload: (Device type attributes only) This attribute can be set while
* the corresponding kernel module remains loaded.
* @internal: This attribute only affects internal handling
* @order: A number indicating the order in which to apply attribute
* @order_cmp: A function determining if a setting for this attribute should
* be applied before (-1) or after (1) another setting, or
@@ -216,6 +217,7 @@ struct attrib {
unsigned int activerem :1;
unsigned int defunset :1;
unsigned int nounload :1;
unsigned int internal :1;
/* Optional */
int order;

View File

@@ -62,10 +62,12 @@ struct ccw_devinfo {
* ccw_subtype_data - CCW subtype specific information
* @ccwdrv: The name of the CCW device driver for this subtype
* @mod: The name of the main kernel module for this subtype
* @any_driver: If set, the exact driver for this subtype are not known
*/
struct ccw_subtype_data {
const char *ccwdrv;
const char *mod;
bool any_driver;
};
extern struct attrib ccw_attr_online;

View File

@@ -11,7 +11,10 @@
#define DASD_H
struct devtype;
struct subtype;
extern struct devtype dasd_devtype;
extern struct subtype dasd_subtype_eckd;
extern struct subtype dasd_subtype_fba;
#endif /* DASD_H */

View File

@@ -45,6 +45,7 @@ struct device_state {
* @node: Node for adding this device to a list
* @active: Device state in the active configuration
* @persistent: Device state in the persistent configuration
* @autoconf: Auto-configured device state
* @errors: A strlist of error and warning messages issued for the device
* @processed: Device has been processed
*/
@@ -59,6 +60,7 @@ struct device {
struct device_state active;
struct device_state persistent;
struct device_state autoconf;
unsigned int processed:1;
};
@@ -94,5 +96,9 @@ void device_list_add(struct device_list *, struct device *);
struct device *device_list_find(struct device_list *, const char *,
struct device *);
void device_list_print(struct device_list *, int);
struct setting_list *device_get_setting_list(struct device *dev,
config_t config);
config_t device_get_config(struct device *dev);
#endif /* DEVICE_H */

View File

@@ -31,6 +31,7 @@ struct export_object {
} ptr;
};
struct export_object *object_new(export_t type, void *ptr);
exit_code_t export_write_device(FILE *, struct device *, config_t, int *);
exit_code_t export_write_devtype(FILE *, struct devtype *, config_t, int *);
exit_code_t export_read(FILE *, const char *, struct util_list *);

25
zdev/include/firmware.h Normal file
View File

@@ -0,0 +1,25 @@
/*
* zdev - Modify and display the persistent configuration of devices
*
* 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.
*/
#ifndef FIRMWARE_H
#define FIRMWARE_H
#include <stdio.h>
#include <stdbool.h>
#include "exit_code.h"
#include "misc.h"
struct util_list;
bool firmware_detect(FILE *fd);
exit_code_t firmware_read(FILE *fd, const char *filename, long skip,
config_t config, struct util_list *objects);
#endif /* FIRMWARE_H */

25
zdev/include/internal.h Normal file
View File

@@ -0,0 +1,25 @@
/*
* zdev - Modify and display the persistent configuration of devices
*
* 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.
*/
#ifndef INTERNAL_H
#define INTERNAL_H
#include <stdbool.h>
#include "attrib.h"
#define INTERNAL_ATTR_PREFIX "zdev:"
#define INTERNAL_ATTR_EARLY INTERNAL_ATTR_PREFIX "early"
extern struct attrib internal_attr_early;
const char *internal_get_name(const char *name);
bool internal_by_name(const char *name);
#endif /* INTERNAL_H */

View File

@@ -19,9 +19,14 @@
#include "exit_code.h"
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#define SCOPE_ACTIVE(x) (((x) == config_active) || ((x) == config_all))
#define SCOPE_PERSISTENT(x) (((x) == config_persistent) || \
((x) == config_all))
#define SCOPE_ACTIVE(x) ((x) & config_active ? 1 : 0)
#define SCOPE_PERSISTENT(x) ((x) & config_persistent ? 1 : 0)
#define SCOPE_AUTOCONF(x) ((x) & config_autoconf ? 1 : 0)
#define SCOPE_ALL(x) ((x) == (config_active | config_persistent |\
config_autoconf))
#define SCOPE_SINGLE(x) ((x) == config_active || \
(x) == config_persistent || \
(x) == config_autoconf)
#define DELAY_INDENT 4
@@ -34,12 +39,15 @@
#define EVEN(x) (((x) & 1) == 0)
/* Enumeration of configuration sets. */
typedef enum {
config_active,
config_persistent,
config_all,
} config_t;
/* Enumeration of configuration sets. Multiple configuration sets can be
* combined using bit-wise or. */
enum {
config_active = 1,
config_persistent = 2,
config_autoconf = 4,
config_all = 7,
};
typedef int config_t;
typedef enum {
err_ignore,
@@ -159,6 +167,7 @@ bool misc_read_dir(const char *, struct util_list *,
bool (*)(const char *, void *), void *);
bool file_is_devnode(const char *);
exit_code_t remove_file(const char *);
exit_code_t misc_read_fd(FILE *fd, void **buffer, size_t *size_ptr);
char *misc_read_text_file(const char *, int, err_t);
char *misc_read_cmd_output(const char *, int, err_t);
char *config_read_cmd_output(const char *, int, err_t);
@@ -166,7 +175,7 @@ exit_code_t misc_write_text_file(const char *, const char *, err_t);
exit_code_t misc_write_text_file_retry(const char *, const char *, err_t);
exit_code_t misc_mktemp(char **, int *);
char *misc_readlink(const char *path);
config_t get_config(int, int);
config_t get_config(int act, int pers, int ac);
bool is_zvm(void);
bool is_terminal(void);
const char *config_to_str(config_t);
@@ -174,6 +183,7 @@ bool str_to_config(const char *, config_t *);
char *quote_str(const char *, int);
char *unquote_str(const char *);
char *shrink_str(const char *);
char *misc_strrstr(const char *haystack, const char *needle);
struct util_list *strlist_new(void);
void strlist_free(struct util_list *);

View File

@@ -20,10 +20,11 @@
#define UDEV_SUFFIX ".rules"
#define PATH_MODPROBE_CONF "/etc/modprobe.d"
#define PATH_MODPROBE "/usr/sbin/modprobe"
#define PATH_MODPROBE "/sbin/modprobe"
#define PATH_CCW_BUS "/sys/bus/ccw"
#define PATH_CCWGROUP_BUS "/sys/bus/ccwgroup"
#define PATH_UDEV_RULES "/etc/udev/rules.d"
#define PATH_UDEV_RULES_VOLATILE "/run/udev/rules.d"
#define PATH_PROC "/proc"
#define PATH_UDEVADM "udevadm"
@@ -55,8 +56,8 @@ char *path_get_ccw_device(const char *, const char *);
char *path_get_ccw_devices(const char *);
char *path_get_ccwgroup_device(const char *, const char *);
char *path_get_ccwgroup_devices(const char *);
char *path_get_udev_rule(const char *, const char *);
char *path_get_udev_rules(void);
char *path_get_udev_rule(const char *type, const char *id, bool vol);
char *path_get_udev_rules(bool vol);
char *path_get_proc(const char *);
char *path_get_sys_bus_dev(const char *, const char *);
char *path_get_sys_bus_drv(const char *, const char *);

View File

@@ -17,9 +17,11 @@
#define QETH_NUM_DEVS 3
struct devtype;
struct subtype;
struct namespace;
extern struct devtype qeth_devtype;
extern struct subtype qeth_subtype_qeth;
extern struct namespace qeth_namespace;
#endif /* QETH_H */

View File

@@ -94,7 +94,8 @@ void setting_list_map_values(struct setting_list *);
void setting_list_mark_default_derived(struct setting_list *);
int setting_list_count_set(struct setting_list *);
void setting_list_remove_derived(struct setting_list *);
char *setting_get_changes(struct setting_list *, struct setting_list *);
char *setting_get_changes(struct setting_list *act, struct setting_list *pers,
struct setting_list *ac);
bool setting_match_value(struct setting *, const char *);
#endif /* SETTING_H */

View File

@@ -67,17 +67,22 @@ typedef exit_code_t (*subtype_cb_t)(struct subtype *st, const char *id,
*
* @exists_active: Check if device exists in active configuration
* @exists_persistent: Check if device exists in persistent configuration
* @exists_autoconf: Check if device exists in autoconf configuration
*
* @add_active_ids: Add IDs of all devices existing in active configuration to
* specified strlist
* @add_persistent_ids: Add IDs of all devices existing in persistent
* configuration to specified strlist
* @add_autoconf_ids: Add IDs of all devices existing in autoconf
* configuration to specified strlist
*
* @read_active: Read device configuration from active configuration
* @read_persistent: Read device configuration from persistent configuration
* @read_autoconf: Read device configuration from autoconf configuration
*
* @configure_active: Apply configuration to active configuration
* @configure_persistent: Apply configuration to persistent configuration
* @configure_autoconf: Apply configuration to autoconf configuration
*
* @check_pre_write: Optional: Determine if the given configuration is valid
* for the specified device. If not, emit warning messages
@@ -150,24 +155,33 @@ struct subtype {
bool (*exists_active)(struct subtype *, const char *);
bool (*exists_persistent)(struct subtype *, const char *);
bool (*exists_autoconf)(struct subtype *, const char *);
void (*add_active_ids)(struct subtype *, struct util_list *);
void (*add_persistent_ids)(struct subtype *,
struct util_list *);
void (*add_autoconf_ids)(struct subtype *,
struct util_list *);
exit_code_t (*read_active)(struct subtype *, struct device *,
read_scope_t);
exit_code_t (*read_persistent)(struct subtype *, struct device *,
read_scope_t);
exit_code_t (*read_autoconf)(struct subtype *, struct device *,
read_scope_t);
exit_code_t (*configure_active)(struct subtype *, struct device *);
exit_code_t (*configure_persistent)(struct subtype *,
struct device *);
exit_code_t (*configure_autoconf)(struct subtype *,
struct device *);
exit_code_t (*deconfigure_active)(struct subtype *,
struct device *);
exit_code_t (*deconfigure_persistent)(struct subtype *,
struct device *);
exit_code_t (*deconfigure_autoconf)(struct subtype *,
struct device *);
exit_code_t (*check_pre_configure)(struct subtype *,
struct device *, int, config_t);
@@ -217,23 +231,31 @@ void subtype_exit(struct subtype *);
bool subtype_device_exists_active(struct subtype *, const char *);
bool subtype_device_exists_persistent(struct subtype *, const char *);
bool subtype_device_exists_autoconf(struct subtype *st, const char *id);
void subtype_add_active_ids(struct subtype *, struct util_list *);
void subtype_add_persistent_ids(struct subtype *, struct util_list *);
void subtype_add_autoconf_ids(struct subtype *st, struct util_list *ids);
exit_code_t subtype_device_read_active(struct subtype *, struct device *,
read_scope_t);
exit_code_t subtype_device_read_persistent(struct subtype *, struct device *,
read_scope_t);
exit_code_t subtype_device_read_autoconf(struct subtype *st, struct device *dev,
read_scope_t scope);
exit_code_t subtype_device_configure_active(struct subtype *, struct device *);
exit_code_t subtype_device_configure_persistent(struct subtype *,
struct device *);
exit_code_t subtype_device_configure_autoconf(struct subtype *st,
struct device *dev);
exit_code_t subtype_device_deconfigure_active(struct subtype *,
struct device *);
exit_code_t subtype_device_deconfigure_persistent(struct subtype *st,
struct device *);
exit_code_t subtype_device_deconfigure_autoconf(struct subtype *st,
struct device *dev);
exit_code_t subtype_check_pre_configure(struct subtype *, struct device *, int,
config_t);

View File

@@ -13,7 +13,11 @@
#include "lib/util_list.h"
#include "exit_code.h"
struct attrib;
struct setting_list;
extern int udev_need_settle;
extern int udev_no_settle;
/* Single key-operator-value entry in a udev rule line.*/
struct udev_entry_node {
@@ -39,9 +43,14 @@ exit_code_t udev_read_file(const char *, struct udev_file **);
void udev_free_file(struct udev_file *);
void udev_file_print(struct udev_file *);
void udev_get_device_ids(const char *, struct util_list *);
exit_code_t udev_remove_rule(const char *, const char *);
void udev_get_device_ids(const char *type, struct util_list *list,
bool autoconf);
exit_code_t udev_remove_rule(const char *type, const char *id, bool autoconf);
void udev_settle(void);
void udev_add_internal_from_entry(struct setting_list *list,
struct udev_entry_node *entry,
struct attrib **attribs);
#endif /* UDEV_H */

View File

@@ -15,9 +15,9 @@
struct device;
bool udev_ccw_exists(const char *, const char *);
exit_code_t udev_ccw_read_device(struct device *);
exit_code_t udev_ccw_write_device(struct device *);
exit_code_t udev_ccw_write_cio_ignore(const char *);
bool udev_ccw_exists(const char *type, const char *id, bool autoconf);
exit_code_t udev_ccw_read_device(struct device *dev, bool autoconf);
exit_code_t udev_ccw_write_device(struct device *dev, bool autoconf);
exit_code_t udev_ccw_write_cio_ignore(const char *id_list, bool autoconf);
#endif /* UDEV_CCW_H */

View File

@@ -16,10 +16,12 @@
struct device;
struct util_list;
bool udev_ccwgroup_exists(const char *, const char *);
exit_code_t udev_ccwgroup_read_device(struct device *);
exit_code_t udev_ccwgroup_write_device(struct device *);
void udev_ccwgroup_add_device_ids(const char *, struct util_list *);
exit_code_t udev_ccwgroup_remove_rule(const char *, const char *);
bool udev_ccwgroup_exists(const char *type, const char *id, bool autoconf);
exit_code_t udev_ccwgroup_read_device(struct device *dev, bool autoconf);
exit_code_t udev_ccwgroup_write_device(struct device *dev, bool autoconf);
void udev_ccwgroup_add_device_ids(const char *type, struct util_list *list,
bool autoconf);
exit_code_t udev_ccwgroup_remove_rule(const char *type, const char *id,
bool autoconf);
#endif /* UDEV_CCWGROUP_H */

View File

@@ -15,10 +15,10 @@
struct device;
void udev_zfcp_lun_add_device_ids(struct util_list *);
bool udev_zfcp_lun_exists(const char *);
exit_code_t udev_zfcp_lun_read_device(struct device *);
exit_code_t udev_zfcp_lun_write_device(struct device *);
exit_code_t udev_zfcp_lun_remove_rule(const char *);
void udev_zfcp_lun_add_device_ids(struct util_list *list, bool autoconf);
bool udev_zfcp_lun_exists(const char *id, bool autoconf);
exit_code_t udev_zfcp_lun_read_device(struct device *dev, bool autoconf);
exit_code_t udev_zfcp_lun_write_device(struct device *dev, bool autoconf);
exit_code_t udev_zfcp_lun_remove_rule(const char *id, bool autoconf);
#endif /* UDEV_ZFCP_LUN_H */

22
zdev/initramfs/Makefile Normal file
View File

@@ -0,0 +1,22 @@
# Common definitions
include ../../common.mak
INITRAMFSDIR := /usr/share/initramfs-tools
HOOKDIR := $(INITRAMFSDIR)/hooks
INITTOP := $(INITRAMFSDIR)/scripts/init-top
# HAVE_INITRAMFS
#
# This install time parameter determines whether the zdev initramfs support is
# installed (HAVE_INITRAMFS=1) or not (default). When installed, the module
# performs the following functions when mkinitramfs is run:
#
# - install a boot-time hook to apply firmware-provided configuration data
# to the system
#
ifeq ($(HAVE_INITRAMFS),1)
install:
$(INSTALL) -m 755 -d $(DESTDIR)/$(HOOKDIR) $(DESTDIR)/$(INITTOP)
$(INSTALL) -m 755 hooks/s390-tools-zdev $(DESTDIR)/$(HOOKDIR)
$(INSTALL) -m 755 scripts/init-top/s390-tools-zdev $(DESTDIR)/$(INITTOP)
endif

View File

@@ -0,0 +1,56 @@
#!/bin/sh
#
# Copyright IBM Corp. 2016, 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.
#
# hooks/s390-tools-zdev
# This hook script adds files required to apply firmware-provided I/O
# configuration data during boot.
#
# Needs to run after udev or resulting udev rules could be overwritten
PREREQ="udev"
prereqs()
{
echo "$PREREQ"
}
case $1 in
prereqs)
prereqs
exit 0
;;
esac
. /usr/share/initramfs-tools/hook-functions
# Add modules for all device types supported by chzdev (required for
# auto-configuration)
zdev_modules="lcs qeth qeth_l2 qeth_l3 dasd_mod dasd_eckd_mod dasd_fba_mod dasd_diag_mod zfcp"
for x in $zdev_modules ; do
manual_add_modules ${x}
done
copy_exec /sbin/chzdev
copy_exec /sbin/lszdev
copy_exec /sbin/vmcp
_tempfile=$(mktemp --tmpdir initramfs-zdev.XXXXXX)
# Obtain early + root device configuration
chzdev --export "$_tempfile" --persistent --by-path / \
--by-attrib "zdev:early=1" --quiet --type 2>/dev/null
# Apply via --import to prevent other devices from being configured.
# Rename the resulting cio-ignore rule to ensure that it does not override
# the one copied by the initramfs udev hook to /lib/udev.
chzdev --import "$_tempfile" --persistent \
--base "/etc/udev/rules.d/41-cio-ignore.rules=$DESTDIR/etc/udev/rules.d/41-cio-ignore-root.rules" \
--base "/etc=$DESTDIR/etc" --yes --quiet --no-root-update --force \
>/dev/null
rm -f "$_tempfile"

View File

@@ -0,0 +1,67 @@
#!/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.
#
# scripts/init-top/s390-tools-zdev
# 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.
#
PREREQ="udev"
prereqs()
{
echo "$PREREQ"
}
case $1 in
prereqs)
prereqs
exit 0
;;
esac
. /scripts/functions
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 x in $(cat /proc/cmdline); do
case ${x} in
rd.zdev=*)
zdev_arg=${x#*=}
if [ "$zdev_arg" = "no-auto" ] ; then
zdev_auto=0
fi
;;
esac
done
if [ $zdev_auto -eq 1 ] ; then
log_begin_msg "Starting firmware auto-configuration"
chzdev --import "$zdev_fw_file" $zdev_base_args
log_end_msg
# Repeat cold-plug after creating udev rules
udevadm control --reload
udevadm trigger --type=subsystems --action=add
udevadm trigger --action=add
udevadm settle || true
fi

View File

@@ -334,6 +334,35 @@ a specific attribute.
.PP
.
.
.SS "Special settings"
The following special settings affect how devices are handled by chzdev:
.PP
.
.BR zdev:early =0|1
.RS 4
Control in which stage of the boot process a device is activated:
.TP 4
.B 0
Device is activated normally during boot (default).
.PP
.TP 4
.B 1
Device is activated early in the boot process, by the initial RAM-disk.
.PP
Specify a value of 1 for this attribute in any of the following situations:
.TP 4
\(bu
To ensure that your settings override auto-configuration settings.
.PP
.TP 4
\(bu
To ensure that a device required to access the root file system is correctly
enabled during boot. An example would be a networking device, or a device that
is intended to extend a logical volume that provides the root file system.
.PP
.RE
.
.
.SH ACTIONS
You can use one of the action options listed below to specify the
.B main tool action
@@ -409,17 +438,27 @@ default value.
.PP
.
.OD import "" "FILENAME" "|-"
Import configuration data from a text file.
Import configuration data from a text or machine-provided file.
Reads configuration data from FILENAME and applies it. If a single hyphen ("-")
is specified as FILENAME data is read from the standard input stream. The
input format of the data read must be the same format as produced by the
chzdev \-\-export action.
input format must be either in the format as produced by the chzdev \-\-export
action, or in the format of a machine-provided I/O configuration data file.
.B Machine-provided data:
Some machine models provide I/O configuration data which is made available
by the Linux kernel via a sysfs interface. While this data is intended for
automatic consumption during the boot phase, you can also apply it manually
using the \-\-import action like in the following example
.B Example:
.CL chzdev --import /sys/firmware/sclp_sd/config/data
.B Note:
By default all configuration data that is read is also applied. To reduce the
scope of imported configuration data, you can select specific devices, a device
type, or define whether only data for the active or persistent configuration
should be imported.
type, or define whether only data for the active, persistent or
auto-configuration should be imported.
.PP
.
.OD list-attributes "l" ""
@@ -462,6 +501,18 @@ on reboot, or when a device becomes unavailable, or when a device driver is
unloaded.
.PP
.
.OD auto-conf "" ""
Apply changes to the auto-configuration only.
This option is used internally to apply machine-provided I/O configuration data
to a Linux system.
.B Note:
There is typically no need for users to specify this option directly.
In particular, user-initiated changes to this configuration will be lost
the next time that machine-provided data is obtained (i.e. during boot).
.PP
.
.OD base "" "PATH" | "KEY" = "VALUE"
Change file system paths used to access files.
@@ -518,6 +569,15 @@ device configuration persistent. Typically such steps include rebuilding the
initial RAM disk, or modifying the kernel command line.
.PP
.
.OD no-settle "" ""
Do not wait for udev processing to complete.
Skips all calls to the udevadm tool that are intended to wait for udev to
finish processing before continuing. There is typically no need to use this
option unless chzdev is run in an environment where udev is not fully
functional (such as in the early phase of an initial RAM disk).
.PP
.
.OD persistent "p" ""
Apply changes to persistent configuration only.

View File

@@ -69,12 +69,13 @@ With no further options specified, the output format defaults to list format.
.
.
.SS "Configurations"
There are two sources for configuration information: the active configuration
of the currently running system, and the persistent configuration stored in
configuration files.
There are three sources for configuration information: the active configuration
of the currently running system, the persistent configuration stored in
configuration files, and the auto-configuration that is provided by some
machine types to automatically enable I/O devices.
.PP
By default lszdev displays information from both the active and the persistent
configuration.
configuration, and, if available, from the auto-configuration.
.PP
.
.
@@ -319,6 +320,19 @@ Restricts output to information obtained from the active configuration, that
is information from the running system.
.PP
.
.OD auto-conf "" ""
List information from the auto-configuration only.
Restricts output to information obtained from the auto-configuration.
The auto-configuration is the collection of configuration data obtained
automatically on some machine models during boot.
.B Note:
This data is refreshed during each boot. Also configuration directives in
the auto-configuration only take effect if there is no directive for the
same device in the persistent configuration.
.PP
.
.OD base "" "PATH" | "KEY" = "VALUE"
Change file system paths used to access files.

View File

@@ -8,7 +8,7 @@ ALL_CPPFLAGS += -I ../include -std=gnu99 -Wno-unused-parameter \
chzdev_objects += attrib.o chzdev.o device.o devnode.o devtype.o exit_code.o \
export.o hash.o inuse.o misc.o namespace.o opts.o path.o \
root.o select.o setting.o subtype.o table.o table_attribs.o \
table_types.o net.o
table_types.o net.o firmware.o internal.o
# Devtype Helpers
chzdev_objects += blkinfo.o ccw.o ccwgroup.o findmnt.o modprobe.o module.o \
@@ -38,7 +38,7 @@ chzdev_objects += generic_ccw.o
lszdev_objects += attrib.o lszdev.o device.o devnode.o devtype.o exit_code.o \
export.o hash.o inuse.o misc.o namespace.o opts.o path.o \
root.o select.o setting.o subtype.o table.o table_types.o \
net.o
net.o internal.o
# Devtype Helpers
lszdev_objects += blkinfo.o ccw.o ccwgroup.o findmnt.o modprobe.o module.o \

View File

@@ -73,6 +73,7 @@ struct attrib ccw_attr_cmb_enable = {
" 1: Data collection is enabled (rewrite 1 to reset data)\n",
.rewrite = 1,
.defval = "0",
.order_cmp = ccw_offline_only_order_cmp,
.accept = ACCEPT_ARRAY(ACCEPT_RANGE(0, 1)),
};
@@ -892,12 +893,13 @@ static exit_code_t collect_group_cb(struct subtype *st, const char *id,
}
/* Set bits for all persistently configured CCW devices. */
static char ***id_bitmap_collect(void)
static char ***id_bitmap_collect(bool autoconf)
{
char ***id_bitmap;
int i, j;
struct devtype *dt;
struct subtype *st;
config_t config = autoconf ? config_autoconf : config_persistent;
id_bitmap = id_bitmap_new();
@@ -906,14 +908,14 @@ static char ***id_bitmap_collect(void)
for (j = 0; (st = dt->subtypes[j]); j++) {
/* Collect CCW device IDs. */
if (st->namespace == &ccw_namespace) {
subtype_for_each_id(st, config_persistent,
subtype_for_each_id(st, config,
collect_cb, id_bitmap);
}
/* Collect CCWGROUP device IDs. Since there may be
* multiple namespaces, we need to make use of this
* hack. */
if (ccwgroup_compatible_namespace(st->namespace)) {
subtype_for_each_id(st, config_persistent,
subtype_for_each_id(st, config,
collect_group_cb,
id_bitmap);
}
@@ -952,7 +954,7 @@ static void range_add(struct util_list *list, struct ccw_devid *from,
free(f_str);
}
static struct util_list *cio_ignore_get_ranges(void)
static struct util_list *cio_ignore_get_ranges(bool autoconf)
{
char ***id_bitmap;
unsigned int cssid, ssid, devno;
@@ -962,7 +964,7 @@ static struct util_list *cio_ignore_get_ranges(void)
ranges = strlist_new();
id_bitmap = id_bitmap_collect();
id_bitmap = id_bitmap_collect(autoconf);
for (cssid = 0; cssid < CSSID_MAX; cssid++) {
if (!id_bitmap[cssid])
continue;
@@ -1003,24 +1005,34 @@ static struct util_list *cio_ignore_get_ranges(void)
}
/* Persistently configure cio_ignore. */
exit_code_t ccw_blacklist_persist(void)
static exit_code_t _ccw_blacklist_persist(bool autoconf)
{
struct util_list *ranges;
char *id_list;
exit_code_t rc;
/* Get string to write to /proc/cio_ignore. */
ranges = cio_ignore_get_ranges();
ranges = cio_ignore_get_ranges(autoconf);
id_list = strlist_flatten(ranges, ",");
strlist_free(ranges);
/* Write udev rule to automatically write cio_ignore. */
rc = udev_ccw_write_cio_ignore(id_list);
rc = udev_ccw_write_cio_ignore(id_list, autoconf);
free(id_list);
return rc;
}
exit_code_t ccw_blacklist_persist(void)
{
exit_code_t rc1, rc2;
rc1 = _ccw_blacklist_persist(false);
rc2 = _ccw_blacklist_persist(true);
return rc1 ? rc1 : rc2;
}
/*
* CCW device ID namespace.
*/
@@ -1368,7 +1380,13 @@ static bool ccw_st_exists_active(struct subtype *st, const char *id)
/* Check if a configuration exists for a CCW device with the specified @id. */
static bool ccw_st_exists_persistent(struct subtype *st, const char *id)
{
return udev_ccw_exists(st->name, id);
return udev_ccw_exists(st->name, id, false);
}
/* Check if a configuration exists for a CCW device with the specified @id. */
static bool ccw_st_exists_autoconf(struct subtype *st, const char *id)
{
return udev_ccw_exists(st->name, id, true);
}
static bool get_ids_cb(const char *file, void *data)
@@ -1404,7 +1422,14 @@ static void ccw_st_add_active_ids(struct subtype *st, struct util_list *ids)
* to strlist @ids. */
static void ccw_st_add_persistent_ids(struct subtype *st, struct util_list *ids)
{
udev_get_device_ids(st->name, ids);
udev_get_device_ids(st->name, ids, false);
}
/* Add the IDs of all CCW devices for which a autoconf configuration exists
* to strlist @ids. */
static void ccw_st_add_autoconf_ids(struct subtype *st, struct util_list *ids)
{
udev_get_device_ids(st->name, ids, true);
}
/* Read the configuration of the CCW device with the specified @id from the
@@ -1440,7 +1465,16 @@ static exit_code_t ccw_st_read_persistent(struct subtype *st,
struct device *dev,
read_scope_t scope)
{
return udev_ccw_read_device(dev);
return udev_ccw_read_device(dev, false);
}
/* Read the configuration of the CCW device with the specified @id from the
* autoconf configuration and add the resulting data to @dev. */
static exit_code_t ccw_st_read_autoconf(struct subtype *st,
struct device *dev,
read_scope_t scope)
{
return udev_ccw_read_device(dev, true);
}
static int get_online(struct setting_list *list)
@@ -1505,7 +1539,14 @@ static exit_code_t ccw_st_configure_active(struct subtype *st,
static exit_code_t ccw_st_configure_persistent(struct subtype *st,
struct device *dev)
{
return udev_ccw_write_device(dev);
return udev_ccw_write_device(dev, false);
}
/* Create a autoconf configuration for the specified device @dev. */
static exit_code_t ccw_st_configure_autoconf(struct subtype *st,
struct device *dev)
{
return udev_ccw_write_device(dev, true);
}
@@ -1552,7 +1593,22 @@ static exit_code_t ccw_st_deconfigure_active(struct subtype *st,
static exit_code_t ccw_st_deconfigure_persistent(struct subtype *st,
struct device *dev)
{
return udev_remove_rule(st->name, dev->id);
return udev_remove_rule(st->name, dev->id, false);
}
/**
* ccw_st_deconfigure_autoconf - Deconfigure device in autoconf
* configuration set
* @st: Subtype of target device
* @dev: Target device
*
* Deconfigure device @dev in the autoconf configuration set. Return %EXIT_OK
* on success, an error code otherwise.
*/
static exit_code_t ccw_st_deconfigure_autoconf(struct subtype *st,
struct device *dev)
{
return udev_remove_rule(st->name, dev->id, true);
}
/* Perform basic sanity checks. */
@@ -1589,6 +1645,8 @@ static void ccw_st_online_set(struct subtype *st, struct device *dev,
setting_list_apply(dev->active.settings, a, name, value);
if (SCOPE_PERSISTENT(config))
setting_list_apply(dev->persistent.settings, a, name, value);
if (SCOPE_AUTOCONF(config))
setting_list_apply(dev->autoconf.settings, a, name, value);
}
/* Determine the online state of the specified CCW device (0=offline, 1=online,
@@ -1596,14 +1654,16 @@ static void ccw_st_online_set(struct subtype *st, struct device *dev,
static int ccw_st_online_get(struct subtype *st, struct device *dev,
config_t config)
{
int act_online = 1, pers_online = 1;
int act_online = 1, pers_online = 1, auto_online = 1;
if (SCOPE_ACTIVE(config))
act_online = get_online(dev->active.settings);
if (SCOPE_PERSISTENT(config))
pers_online = get_online(dev->persistent.settings);
if (SCOPE_AUTOCONF(config))
auto_online = get_online(dev->autoconf.settings);
return MIN(act_online, pers_online);
return MIN(MIN(act_online, pers_online), auto_online);
}
/* Determine if the online state of the specified CCW device was specified */
@@ -1622,6 +1682,11 @@ static bool ccw_st_online_specified(struct subtype *st, struct device *dev,
if (s && s->specified)
return true;
}
if (SCOPE_AUTOCONF(config) && dev->autoconf.settings) {
s = setting_list_find(dev->autoconf.settings, "online");
if (s && s->specified)
return true;
}
return false;
}
@@ -1769,18 +1834,23 @@ struct subtype ccw_subtype = {
.exists_active = &ccw_st_exists_active,
.exists_persistent = &ccw_st_exists_persistent,
.exists_autoconf = &ccw_st_exists_autoconf,
.add_active_ids = &ccw_st_add_active_ids,
.add_persistent_ids = &ccw_st_add_persistent_ids,
.add_autoconf_ids = &ccw_st_add_autoconf_ids,
.read_active = &ccw_st_read_active,
.read_persistent = &ccw_st_read_persistent,
.read_autoconf = &ccw_st_read_autoconf,
.configure_active = &ccw_st_configure_active,
.configure_persistent = &ccw_st_configure_persistent,
.configure_autoconf = &ccw_st_configure_autoconf,
.deconfigure_active = &ccw_st_deconfigure_active,
.deconfigure_persistent = &ccw_st_deconfigure_persistent,
.deconfigure_autoconf = &ccw_st_deconfigure_autoconf,
.check_pre_configure = &ccw_st_check_pre_configure,

View File

@@ -426,6 +426,8 @@ static void ccwgroup_st_online_set(struct subtype *st, struct device *dev,
}
if (SCOPE_PERSISTENT(config))
setting_list_apply(dev->persistent.settings, a, name, value);
if (SCOPE_AUTOCONF(config))
setting_list_apply(dev->autoconf.settings, a, name, value);
}
static int get_online(struct setting_list *list)
@@ -446,18 +448,20 @@ static int get_online(struct setting_list *list)
}
/* Return -1 if online state is not configured, 0 for offline and 1 for online.
* If multiple configurations are specified, return the minimum of both. */
* If multiple configurations are specified, return the minimum of all. */
static int ccwgroup_st_online_get(struct subtype *st, struct device *dev,
config_t config)
{
int act_online = 1, pers_online = 1;
int act_online = 1, pers_online = 1, auto_online = 1;
if (SCOPE_ACTIVE(config))
act_online = get_online(dev->active.settings);
if (SCOPE_PERSISTENT(config))
pers_online = get_online(dev->persistent.settings);
if (SCOPE_AUTOCONF(config))
auto_online = get_online(dev->autoconf.settings);
return MIN(act_online, pers_online);
return MIN(MIN(act_online, pers_online), auto_online);
}
/* Determine if the online state of the specified device was modified. */
@@ -476,6 +480,11 @@ static bool ccwgroup_st_online_specified(struct subtype *st,
if (s && s->specified)
return true;
}
if (SCOPE_AUTOCONF(config) && dev->autoconf.settings) {
s = setting_list_find(dev->autoconf.settings, "online");
if (s && s->specified)
return true;
}
return false;
}
@@ -682,7 +691,18 @@ static exit_code_t ccwgroup_st_read_persistent(struct subtype *st,
expand_id(data->ccwgroupdrv, dev);
return udev_ccwgroup_read_device(dev);
return udev_ccwgroup_read_device(dev, false);
}
static exit_code_t ccwgroup_st_read_autoconf(struct subtype *st,
struct device *dev,
read_scope_t scope)
{
struct ccwgroup_subtype_data *data = st->data;
expand_id(data->ccwgroupdrv, dev);
return udev_ccwgroup_read_device(dev, true);
}
static exit_code_t ccwgroup_st_configure_active(struct subtype *st,
@@ -693,8 +713,9 @@ static exit_code_t ccwgroup_st_configure_active(struct subtype *st,
return device_write_active_settings(dev);
}
static exit_code_t ccwgroup_st_configure_persistent(struct subtype *st,
struct device *dev)
static exit_code_t _ccwgroup_st_configure_persistent(struct subtype *st,
struct device *dev,
bool autoconf)
{
struct ccwgroup_subtype_data *data = st->data;
struct ccwgroup_devid *devid = dev->devid;
@@ -703,9 +724,22 @@ static exit_code_t ccwgroup_st_configure_persistent(struct subtype *st,
delayed_err("Incomplete device ID specified\n");
return EXIT_INCOMPLETE_ID;
}
return udev_ccwgroup_write_device(dev);
return udev_ccwgroup_write_device(dev, autoconf);
}
static exit_code_t ccwgroup_st_configure_persistent(struct subtype *st,
struct device *dev)
{
return _ccwgroup_st_configure_persistent(st, dev, false);
}
static exit_code_t ccwgroup_st_configure_autoconf(struct subtype *st,
struct device *dev)
{
return _ccwgroup_st_configure_persistent(st, dev, true);
}
static char *ccwgroup_st_get_active_attrib_path(struct subtype *,
struct device *, const char *);
@@ -733,7 +767,13 @@ static exit_code_t ccwgroup_st_deconfigure_active(struct subtype *st,
static exit_code_t ccwgroup_st_deconfigure_persistent(struct subtype *st,
struct device *dev)
{
return udev_ccwgroup_remove_rule(st->name, dev->id);
return udev_ccwgroup_remove_rule(st->name, dev->id, false);
}
static exit_code_t ccwgroup_st_deconfigure_autoconf(struct subtype *st,
struct device *dev)
{
return udev_ccwgroup_remove_rule(st->name, dev->id, true);
}
/* Check if a CCWGROUP device with the specified ID exists. */
@@ -774,7 +814,12 @@ static bool ccwgroup_st_exists_active(struct subtype *st, const char *id)
static bool ccwgroup_st_exists_persistent(struct subtype *st, const char *id)
{
return udev_ccwgroup_exists(st->name, id);
return udev_ccwgroup_exists(st->name, id, false);
}
static bool ccwgroup_st_exists_autoconf(struct subtype *st, const char *id)
{
return udev_ccwgroup_exists(st->name, id, true);
}
int ccwgroup_qsort_cmp(const void *a_ptr, const void *b_ptr)
@@ -796,7 +841,13 @@ static void ccwgroup_st_add_active_ids(struct subtype *st,
static void ccwgroup_st_add_persistent_ids(struct subtype *st,
struct util_list *ids)
{
udev_ccwgroup_add_device_ids(st->name, ids);
udev_ccwgroup_add_device_ids(st->name, ids, false);
}
static void ccwgroup_st_add_autoconf_ids(struct subtype *st,
struct util_list *ids)
{
udev_ccwgroup_add_device_ids(st->name, ids, true);
}
/* Check if CCW device ID @b is part of CCW group device ID @a. */
@@ -1185,18 +1236,23 @@ struct subtype ccwgroup_subtype = {
.exists_active = &ccwgroup_st_exists_active,
.exists_persistent = &ccwgroup_st_exists_persistent,
.exists_autoconf = &ccwgroup_st_exists_autoconf,
.add_active_ids = &ccwgroup_st_add_active_ids,
.add_persistent_ids = &ccwgroup_st_add_persistent_ids,
.add_autoconf_ids = &ccwgroup_st_add_autoconf_ids,
.read_active = &ccwgroup_st_read_active,
.read_persistent = &ccwgroup_st_read_persistent,
.read_autoconf = &ccwgroup_st_read_autoconf,
.configure_active = &ccwgroup_st_configure_active,
.configure_persistent = &ccwgroup_st_configure_persistent,
.configure_autoconf = &ccwgroup_st_configure_autoconf,
.deconfigure_active = &ccwgroup_st_deconfigure_active,
.deconfigure_persistent = &ccwgroup_st_deconfigure_persistent,
.deconfigure_autoconf = &ccwgroup_st_deconfigure_autoconf,
.online_set = &ccwgroup_st_online_set,
.online_get = &ccwgroup_st_online_get,

View File

@@ -27,6 +27,7 @@
#include "devnode.h"
#include "devtype.h"
#include "export.h"
#include "firmware.h"
#include "inuse.h"
#include "misc.h"
#include "module.h"
@@ -85,6 +86,7 @@ struct options {
config_t config;
unsigned int active:1;
unsigned int persistent:1;
unsigned int auto_conf:1;
struct util_list *remove; /* List of struct strlist_node */
unsigned int remove_all:1;
unsigned int force:1;
@@ -94,6 +96,7 @@ struct options {
struct util_list *base; /* List of struct strlist_node */
unsigned int verbose:1;
unsigned int quiet:1;
unsigned int no_settle:1;
};
/* Makefile converts chzdev_usage.txt into C file which we include here. */
@@ -135,6 +138,8 @@ enum {
OPT_VERSION = 'v',
OPT_VERBOSE = 'V',
OPT_QUIET = 'q',
OPT_NO_SETTLE = (OPT_ANONYMOUS_BASE+__COUNTER__),
OPT_AUTO_CONF = (OPT_ANONYMOUS_BASE+__COUNTER__),
};
static struct opts_conflict conflict_list[] = {
@@ -169,11 +174,13 @@ static struct opts_conflict conflict_list[] = {
OPTS_CONFLICT(OPT_APPLY,
OPT_DECONFIGURE, OPT_LIST_ATTRIBS, OPT_HELP_ATTRIBS,
OPT_LIST_TYPES, OPT_EXPORT, OPT_IMPORT, OPT_REMOVE,
OPT_REMOVE_ALL, OPT_ACTIVE, OPT_PERSISTENT, 0),
OPT_REMOVE_ALL, OPT_ACTIVE, 0),
OPTS_CONFLICT(OPT_ONLINE,
OPT_OFFLINE),
OPTS_CONFLICT(OPT_QUIET,
OPT_VERBOSE),
OPTS_CONFLICT(OPT_AUTO_CONF,
OPT_TYPE, OPT_LIST_ATTRIBS, OPT_LIST_TYPES),
OPTS_CONFLICT(0, 0),
};
@@ -207,6 +214,7 @@ static const struct option opt_list[] = {
/* Options. */
{ "active", no_argument, NULL, OPT_ACTIVE },
{ "persistent", no_argument, NULL, OPT_PERSISTENT },
{ "auto-conf", no_argument, NULL, OPT_AUTO_CONF },
{ "remove", required_argument, NULL, OPT_REMOVE },
{ "remove-all", no_argument, NULL, OPT_REMOVE_ALL },
{ "force", no_argument, NULL, OPT_FORCE },
@@ -216,6 +224,7 @@ static const struct option opt_list[] = {
{ "base", required_argument, NULL, OPT_BASE },
{ "verbose", no_argument, NULL, OPT_VERBOSE },
{ "quiet", no_argument, NULL, OPT_QUIET },
{ "no-settle", no_argument, NULL, OPT_NO_SETTLE },
{ NULL, no_argument, NULL, 0 },
};
@@ -879,6 +888,11 @@ static exit_code_t parse_options(struct options *opts, int argc, char *argv[])
opts->persistent = 1;
break;
case OPT_AUTO_CONF:
/* --auto-conf */
opts->auto_conf = 1;
break;
case OPT_REMOVE:
/* --remove ATTRIB */
strlist_add(opts->remove, "%s", optarg);
@@ -936,6 +950,11 @@ static exit_code_t parse_options(struct options *opts, int argc, char *argv[])
opts->quiet = 1;
break;
case OPT_NO_SETTLE:
/* --no-settle */
opts->no_settle = 1;
break;
case ':':
/* Missing option argument. */
syntax("Option '%s' requires an argument\n",
@@ -968,7 +987,13 @@ static exit_code_t parse_options(struct options *opts, int argc, char *argv[])
goto out;
/* Determine configuration set. */
opts->config = get_config(opts->active, opts->persistent);
if (!opts->active && !opts->persistent && !opts->auto_conf) {
/* Default configuration targets are active + persistent */
opts->config = config_active | config_persistent;
} else {
opts->config = get_config(opts->active, opts->persistent,
opts->auto_conf);
}
/* Handle positional parameters. */
rc = parse_positional(opts, argc, argv, optind);
@@ -1040,13 +1065,15 @@ static void remove_all_settings(struct setting_list *settings, int active)
/* Perform --remove-all operation for specified config on device. */
static exit_code_t device_remove_all(struct device *dev, config_t config)
{
int active, persistent;
int active, persistent, autoconf;
active = SCOPE_ACTIVE(config) ?
count_removable(dev->active.settings, 1) : 0;
persistent = SCOPE_PERSISTENT(config) ?
count_removable(dev->persistent.settings, 0) : 0;
if (active == 0 && persistent == 0) {
autoconf = SCOPE_AUTOCONF(config) ?
count_removable(dev->autoconf.settings, 0) : 0;
if (active == 0 && persistent == 0 && autoconf == 0) {
delayed_err("No removable settings found\n");
return EXIT_SETTING_NOT_FOUND;
}
@@ -1054,6 +1081,8 @@ static exit_code_t device_remove_all(struct device *dev, config_t config)
remove_all_settings(dev->active.settings, 1);
if (persistent)
remove_all_settings(dev->persistent.settings, 0);
if (autoconf)
remove_all_settings(dev->autoconf.settings, 0);
return EXIT_OK;
}
@@ -1123,6 +1152,13 @@ static exit_code_t device_remove_settings(struct device *dev,
goto out;
}
if (SCOPE_AUTOCONF(config)) {
rc = remove_settings(dev->autoconf.settings, names, found,
notfound, 0);
if (rc)
goto out;
}
if (!util_list_is_empty(notfound)) {
flat = strlist_flatten(notfound, " ");
delayed_err("Setting not found: %s\n", flat);
@@ -1190,7 +1226,8 @@ static void print_dev_config_info(struct device *dev, config_t config)
changes = setting_get_changes(
SCOPE_ACTIVE(config) ? dev->active.settings : NULL,
SCOPE_PERSISTENT(config) ? dev->persistent.settings : NULL);
SCOPE_PERSISTENT(config) ? dev->persistent.settings : NULL,
SCOPE_AUTOCONF(config) ? dev->autoconf.settings : NULL);
if (changes)
info(" Changes: %s\n", changes);
free(changes);
@@ -1248,6 +1285,12 @@ static exit_code_t cfg_mod_existence(struct device *dev, config_t config)
dev->persistent.modified = 1;
}
/* Create autoconf config if necessary. */
if (SCOPE_AUTOCONF(config) && !dev->autoconf.exists) {
dev->autoconf.exists = 1;
dev->autoconf.modified = 1;
}
return EXIT_OK;
}
@@ -1287,11 +1330,14 @@ online:
/* Make sure there's an online attribute. */
ensure_online(dev, config_active);
ensure_online(dev, config_persistent);
ensure_online(dev, config_autoconf);
mand:
/* Ensure default values for mandatory attributes. */
setting_list_apply_defaults(dev->persistent.settings,
dev->subtype->dev_attribs, true);
setting_list_apply_defaults(dev->autoconf.settings,
dev->subtype->dev_attribs, true);
return EXIT_OK;
}
@@ -1324,10 +1370,11 @@ static exit_code_t cfg_write(struct device *dev, int prereq, config_t config,
struct subtype *st = dev->subtype;
exit_code_t rc = EXIT_OK;
if (!device_needs_writing(dev, config))
if (!device_needs_writing(dev, config) && !force)
goto out;
if (check_active && config == config_persistent &&
if (check_active && !SCOPE_ACTIVE(config) &&
(SCOPE_PERSISTENT(config) || SCOPE_AUTOCONF(config)) &&
(!dev->active.exists && !dev->active.definable)) {
rc = handle_nonexistent(dev);
if (rc)
@@ -1368,7 +1415,7 @@ static exit_code_t cfg_configure(struct subtype *st, const char *id,
if (proc_ptr)
*proc_ptr = 0;
/* Read current device data. Note that we read data from both
/* Read current device data. Note that we read data from all
* configurations to enable QETH autodetection and subtype
* detection (e.g. dasd -> dasd_fba).*/
dev = NULL;
@@ -1389,23 +1436,17 @@ static exit_code_t cfg_configure(struct subtype *st, const char *id,
/* Exit here if we're only trying and device cannot be configured. */
if (try && !(dev->active.exists || dev->active.definable ||
dev->persistent.exists)) {
dev->persistent.exists || dev->autoconf.exists)) {
return EXIT_DEVICE_NOT_FOUND;
}
if (config == config_persistent) {
/* Abort if a modification action is triggered for a
* non-existing persistent device. */
if (!dev->persistent.exists &&
(!util_list_is_empty(opts->remove) || opts->remove_all))
return EXIT_DEVICE_NOT_FOUND;
/* Create device if needed by action. */
if (opts->enable || !util_list_is_empty(opts->settings)) {
rc = cfg_mod_existence(dev, config);
if (rc)
return rc;
}
/* Apply changes to device existence. */
rc = cfg_mod_existence(dev, config);
if (rc)
return rc;
/* Apply changes to device settings. */
rc = cfg_mod_settings(dev, opts, prereq);
if (rc)
@@ -1417,10 +1458,12 @@ static exit_code_t cfg_configure(struct subtype *st, const char *id,
/* Apply persistent configuration to active configuration. */
static exit_code_t cfg_apply(struct subtype *st, const char *id, int prereq,
struct device **dev_ptr, int *proc_ptr)
struct device **dev_ptr, int *proc_ptr,
bool autoconf)
{
exit_code_t rc;
struct device *dev;
struct device_state *state;
/* Reset processed flag. */
if (proc_ptr)
@@ -1443,8 +1486,9 @@ static exit_code_t cfg_apply(struct subtype *st, const char *id, int prereq,
*proc_ptr = 1;
dev->processed = 1;
state = autoconf ? &dev->autoconf : &dev->persistent;
/* Exit here if there is no persistent configuration. */
if (!dev->persistent.exists)
if (!state->exists)
return EXIT_NO_DATA;
/* Apply changes to device existence. */
@@ -1453,8 +1497,7 @@ static exit_code_t cfg_apply(struct subtype *st, const char *id, int prereq,
return rc;
/* Copy persistent settings to active configuration. */
rc = device_apply_settings(dev, config_active,
&dev->persistent.settings->list);
rc = device_apply_settings(dev, config_active, &state->settings->list);
if (rc)
return rc;
@@ -1468,7 +1511,8 @@ static exit_code_t cfg_import(struct subtype *st, const char *id,
struct device **dev_ptr, int *proc_ptr)
{
exit_code_t rc;
struct setting_list *active = NULL, *persistent = NULL;
struct setting_list *active = NULL, *persistent = NULL,
*autoconf = NULL;
struct device *dev;
/* Reset processed flag. */
@@ -1486,6 +1530,7 @@ static exit_code_t cfg_import(struct subtype *st, const char *id,
return EXIT_OK;
active = setting_list_copy(dev->active.settings);
persistent = setting_list_copy(dev->persistent.settings);
autoconf = setting_list_copy(dev->autoconf.settings);
} else if (!prereq) {
/* Should not happen. */
return EXIT_OK;
@@ -1515,14 +1560,20 @@ static exit_code_t cfg_import(struct subtype *st, const char *id,
&persistent->list);
if (rc)
goto out;
rc = device_apply_settings(dev, config_autoconf,
&autoconf->list);
if (rc)
goto out;
}
ensure_online(dev, config_active);
ensure_online(dev, config_persistent);
ensure_online(dev, config_autoconf);
/* Write resulting device data. */
rc = cfg_write(dev, prereq, config, 0);
out:
setting_list_free(autoconf);
setting_list_free(persistent);
setting_list_free(active);
@@ -1600,11 +1651,13 @@ static exit_code_t print_config_result(struct selected_dev_node *sel,
if (opts->deconfigure) {
op = "deconfigure";
verb = "deconfigured";
if (dev)
if (dev) {
already = !dev->active.modified &&
!dev->persistent.modified;
else if (rc == EXIT_DEVICE_NOT_FOUND &&
config == config_persistent) {
!dev->persistent.modified &&
!dev->autoconf.modified;
} else if (rc == EXIT_DEVICE_NOT_FOUND &&
(!SCOPE_ACTIVE(config) && (SCOPE_PERSISTENT(config) ||
SCOPE_AUTOCONF(config)))) {
rc = EXIT_OK;
already = 1;
}
@@ -1615,6 +1668,10 @@ static exit_code_t print_config_result(struct selected_dev_node *sel,
already = device_needs_writing(dev, config) ? 0 : 1;
}
/* Re-do actions if run with --force */
if (force)
already = 0;
if (dev) {
devname = dev->subtype->devname;
devid = dev->id;
@@ -1672,9 +1729,10 @@ static exit_code_t cfg_prereqs(struct subtype *st, const char *id,
prereqs = selected_dev_list_new();
subtype_add_prereqs(st, id, prereqs);
util_list_iterate(prereqs, sel) {
if (opts->apply)
rc = cfg_apply(sel->st, sel->id, 1, &dev, &proc);
else if (opts->import) {
if (opts->apply) {
rc = cfg_apply(sel->st, sel->id, 1, &dev, &proc,
opts->auto_conf);
} else if (opts->import) {
rc = cfg_import(sel->st, sel->id, config, 1, &dev,
&proc);
} else {
@@ -1747,9 +1805,11 @@ static exit_code_t configure_devices(struct options *opts, int specified,
struct namespace *ns;
const char *param;
struct device *dev;
config_t config = opts->config;
/* Determine list of selected devices. */
if (opts->config == config_persistent ||
if ((!SCOPE_ACTIVE(config) &&
(SCOPE_PERSISTENT(config) || SCOPE_AUTOCONF(config))) ||
(opts->select->subtype && opts->select->subtype->support_definable))
existing = 0;
else
@@ -1795,9 +1855,10 @@ static exit_code_t configure_devices(struct options *opts, int specified,
goto next;
/* Configure actual target device. */
if (opts->apply)
rc = cfg_apply(sel->st, sel->id, 0, &dev, &proc);
else {
if (opts->apply) {
rc = cfg_apply(sel->st, sel->id, 0, &dev, &proc,
opts->auto_conf);
} else {
rc = cfg_configure(sel->st, sel->id, opts, 0,
0, &dev, &proc);
}
@@ -1893,7 +1954,7 @@ static exit_code_t deconfigure_one_device(struct subtype *st, const char *id,
dev->processed = 1;
if (try && !(dev->active.exists || dev->active.definable ||
dev->persistent.exists)) {
dev->persistent.exists || dev->autoconf.exists)) {
/* Attempt to deconfigure this device will fail. */
return EXIT_DEVICE_NOT_FOUND;
}
@@ -1903,7 +1964,8 @@ static exit_code_t deconfigure_one_device(struct subtype *st, const char *id,
* dev. */
if (SCOPE_ACTIVE(config) &&
!(dev->active.exists || dev->active.definable)) {
if (!SCOPE_PERSISTENT(config) || !dev->persistent.exists)
if (!((SCOPE_PERSISTENT(config) && dev->persistent.exists) ||
(SCOPE_AUTOCONF(config) && dev->autoconf.exists)))
return EXIT_DEVICE_NOT_FOUND;
}
@@ -1927,7 +1989,12 @@ static exit_code_t deconfigure_one_device(struct subtype *st, const char *id,
dev->persistent.deconfigured = 1;
dev->persistent.modified = 1;
}
if (!dev->active.modified && !dev->persistent.modified)
if (SCOPE_AUTOCONF(config) && dev->autoconf.exists) {
dev->autoconf.deconfigured = 1;
dev->autoconf.modified = 1;
}
if (!dev->active.modified && !dev->persistent.modified &&
!dev->autoconf.modified)
return EXIT_OK;
/* Pre-write check. */
@@ -2071,7 +2138,8 @@ static void print_type_config_info(struct devtype *dt, const char *title,
changes = setting_get_changes(
SCOPE_ACTIVE(config) ? dt->active_settings : NULL,
SCOPE_PERSISTENT(config) ? dt->persistent_settings : NULL);
SCOPE_PERSISTENT(config) ? dt->persistent_settings : NULL,
NULL);
if (changes)
info(" %s: %s\n", title, changes);
free(changes);
@@ -2485,6 +2553,8 @@ static void action_note(const char *msg, config_t config)
info("%s the active configuration only\n", msg);
else if (config == config_persistent)
info("%s the persistent configuration only\n", msg);
else if (config == config_autoconf)
info("%s the auto-configuration only\n", msg);
}
/* Export configuration of selected devices and/or device type to file. */
@@ -2500,9 +2570,9 @@ static exit_code_t do_export(struct options *opts)
/* Open output stream. */
if (strcmp(opts->export, "-") == 0) {
fd = stdout;
info("Exporting configuration data to standard output\n");
info("Exporting data to standard output\n");
} else {
info("Exporting configuration data to %s\n", opts->export);
info("Exporting data to %s\n", opts->export);
if (!util_path_exists(opts->export)) {
rc = path_create(opts->export);
if (rc)
@@ -2606,7 +2676,7 @@ static exit_code_t import_device(struct device *dev, struct options *opts)
struct subtype *st = dev->subtype;
exit_code_t rc;
config_t config;
int proc = 0, active, persistent;
int proc = 0, active, persistent, autoconf;
if (SCOPE_ACTIVE(opts->config))
active = (dev->active.exists || dev->active.definable);
@@ -2616,7 +2686,16 @@ static exit_code_t import_device(struct device *dev, struct options *opts)
persistent = dev->persistent.exists;
else
persistent = 0;
config = get_config(active, persistent);
if (SCOPE_AUTOCONF(opts->config))
autoconf = dev->autoconf.exists;
else
autoconf = 0;
if (!active && !persistent && !autoconf) {
/* Nothing to import */
return EXIT_OK;
}
config = get_config(active, persistent, autoconf);
/* First check for prerequisite devices that need to be configured. */
rc = cfg_prereqs(st, dev->id, opts, config, 0);
@@ -2643,17 +2722,9 @@ static bool import_device_selected(struct device *dev, struct options *opts)
if (!select_opts_dev_specified(select))
return false;
/* --active */
if (opts->config == config_active) {
if (!dev->active.exists && !dev->active.definable)
return false;
}
/* --persistent */
if (opts->config == config_persistent) {
if (!dev->persistent.exists)
return false;
}
/* Target configuration */
if ((device_get_config(dev) & opts->config) == 0)
return false;
/* Devtype */
if (select->devtype && dt != select->devtype)
@@ -2735,6 +2806,7 @@ static exit_code_t do_import(struct options *opts)
exit_code_t drc = EXIT_OK;
const char *filename;
int found;
bool is_firmware;
/* Open input stream. */
if (strcmp(opts->import, "-") == 0) {
@@ -2744,16 +2816,23 @@ static exit_code_t do_import(struct options *opts)
fd = fopen(opts->import, "r");
filename = opts->import;
}
info("Importing configuration data from %s\n", filename);
if (!fd) {
error("Could not open file %s: %s\n", opts->import,
strerror(errno));
return EXIT_RUNTIME_ERROR;
}
is_firmware = firmware_detect(fd);
info("Importing data from %s%s\n", filename,
is_firmware ? " (firmware format)" : "");
/* Read data. */
objects = ptrlist_new();
rc = export_read(fd, filename, objects);
if (is_firmware)
rc = firmware_read(fd, filename, -1, opts->config, objects);
else
rc = export_read(fd, filename, objects);
if (rc)
goto out;
@@ -2766,8 +2845,8 @@ static exit_code_t do_import(struct options *opts)
"selection\n", filename);
rc = EXIT_EMPTY_SELECTION;
} else {
error("%s: No settings found to import\n", filename);
rc = EXIT_NO_DATA;
info("%s: No settings found to import\n", filename);
rc = EXIT_OK;
}
goto out;
}
@@ -2895,6 +2974,7 @@ int main(int argc, char *argv[])
force = opts.force;
yes = opts.yes;
dryrun = opts.dryrun;
udev_no_settle = opts.no_settle;
path_set_base(opts.base);
if (dryrun)
@@ -2945,8 +3025,8 @@ int main(int argc, char *argv[])
if ((pers_mod_devs || pers_mod_devtypes) && !opts.no_root_check &&
!dryrun) {
/* If the root device/device type has been modified, additional
* work might be necessary. */
/* If the root device/device type or early devices have been
* modified, additional work might be necessary. */
rc = root_check();
if (rc && !drc)
drc = rc;

Some files were not shown because too many files have changed in this diff Show More