Commit Graph

1513 Commits

Author SHA1 Message Date
Steffen Eiden
2ef6f64b1d Makefile: fix build for non-390 architectures
The last commit accidentally deleted the TOOLS_DIR for non-s390x
architectures.

Fixes: de013d2f ("Makefile: add genprotimg to non-s390x architectures target list")
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2023-07-11 11:32:26 +02:00
Marc Hartmayer
de013d2f04 Makefile: add genprotimg to non-s390x architectures target list
`genprotimg` can be useful on non-s390x architectures such as x86 or
arm. Therefore add `genprotimg` to the non-s390x target list.

How to build genprotimg on a non-s390x system (s390x cross-compiler
required)

$ # Build and install /usr/bin/genprotimg
$ make -C genprotimg
$ make install -C genprotimg
$ # Build and install the genprotimg bootloaders
$ make -C genprotimg/boot HOST_ARCH=s390x CROSS_COMPILE=s390x-linux-gnu-
$ make install -C genprotimg/boot HOST_ARCH=s390x CROSS_COMPILE=s390x-linux-gnu-

Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2023-07-11 08:24:52 +02:00
Marc Hartmayer
ed94cf9839 genprotimg/boot: compile the bootloaders only if HOST_ARCH is s390x
The genprotimg bootloaders are s390x specific, so only build them if the
`HOST_ARCH' is set to s390x.

On x86 one can cross-compile and install the bootloaders as follows:

$ make -C genprotimg/boot HOST_ARCH=s390x CROSS_COMPILE=s390x-linux-gnu-
$ make -C genprotimg/boot install HOST_ARCH=s390x CROSS_COMPILE=s390x-linux-gnu-

Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2023-07-11 08:22:04 +02:00
Marc Hartmayer
2fec7688b0 genprotimg: move bootloader installation responsibility to boot/Makefile
It's cleaner if the bootloader installation code is located in the
boot/Makefile, rather than the top Makefile.

Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2023-07-11 08:22:04 +02:00
Matthew Rosato
3c1834f0fc ap_tools/ap-check: handle missing 'matrix' and 'control_domains' attrs
Under typical circumstances these sysfs attributes should be available
however if the device happens to be in the process of being removed
without the protection of the ap config file lock, this scenario can
be encountered.  In this case, ignore the device and assume it is in
the process of being removed.

Reviewed-by: Tony Krowiak <akrowiak@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2023-07-11 08:22:04 +02:00
Matthew Rosato
f6e78d3ecd ap_tools/ap-check: hold ap config file lock over get attributes
Since this callout reads sysfs values for the specified mdev, the
ap config file lock should be held to prevent other tools from
making changes to the ap configuration at the same time.

Reviewed-by: Jason J. Herne <jjherne@linux.ibm.com>
Reviewed-by: Tony Krowiak <akrowiak@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2023-07-11 08:22:04 +02:00
Steffen Eiden
dad7fce7a1 zipl/boot: move load_wait_psw() location
`load_wait_psw` is defined in include/boot/s390.h but is implemented in
zipl/boot/libc.c. This results in a dangling definition for s390.h users
other than zipl, due to the missing implementation. Since the function
is only relevant for zipl, move the definition to the corresponding
header file zipl/boot/libc.h

Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2023-07-11 08:21:58 +02:00
Steffen Eiden
8058921f58 Reorganize boot-loader header files
include/boot/s390.h relies on s390 specific kernel headers. However,
some tools used this header for non-s390 code (outside of boot-loaders).
To solve this the PSW and PAGE_SIZE definitions are now in separate
header files. All includes for s390.h which are not in boot-loader code
are replaced with one of psw.h or page.h.

This fixes the compilation failure on ppc64le due to conflicting types
for `__vector128`.

Fixes: https://github.com/ibm-s390-linux/s390-tools/issues/151
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2023-07-11 08:21:48 +02:00
Marc Hartmayer
bb8e0e1047 common.mak: test_linker_flag: use LINK and not CC variable
The check is for linker flags, and the $(LINK) variable is used for
linking, not $(CC).

Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2023-07-11 08:21:48 +02:00
Marc Hartmayer
5dcac6d2e3 common.mak: use a minimal assembly snippet to check for linker flags
Use a minimal assembly snippet to check for linker flags. This has the
advantage that it will work even if only the cross-toolchain is
installed, but not, for example, stdlib.

Using the C snippet, the check runs in a similar error like this:

  /usr/bin/s390x-linux-gnu-ld: cannot find crt1.o: No such file or directory
  /usr/bin/s390x-linux-gnu-ld: cannot find crti.o: No such file or directory
  /usr/bin/s390x-linux-gnu-ld: cannot find -lc: No such file or directory
  /usr/bin/s390x-linux-gnu-ld: cannot find crtn.o: No such file or directory

Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2023-07-11 08:21:48 +02:00
Peter Oberparleiter
552772d2a9 zdev: fix unexpected warning due to non-existent interface
Using option --by-interface with a non-existent network interface name
results in an unexpected duplicate warning message:

  $ lszdev --by-interface xx
  Could not open directory /sys/class/net/xx: No such file or directory
  Could not open directory /sys/class/net/xx: No such file or directory
  lszdev: Could not determine device that provides xx (xx)

Fix this by checking for the existence of the associated /sys/class/net
directory before initiating the associated directory traversal.

Reviewed-by: Vineeth Vijayan <vneethv@linux.ibm.com>
Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2023-07-04 15:41:04 +02:00
Peter Oberparleiter
42611a787d zdev: use consistent exit code for nonexistent device nodes
zdev's --by-node option returns exit code 15 (EXIT_RUNTIME_ERROR) when
the specified device node cannot be found. This is inconsistent with
other selection options --by-path and --by-interface which both return
the more appropriate exit code 3 (EXIT_DEVICE_NOT_FOUND).

Fix this by changing --by-node to also return exit code 3 in case the
specified device node does not exist.

Reviewed-by: Vineeth Vijayan <vneethv@linux.ibm.com>
Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2023-07-04 15:41:03 +02:00
Sven Schnelle
743788d02f zipl/dump: fix ngdump dracut helper script
While changing the helper script to create the ngdump filesystem,
some lines were left in the script which now cause the zipl
installation to fail:

Run /lib/s390-tools/zipl_helper.prepare-ngdump /dev/disk/by-path/ccw-0.0.6a56-part1 0
Couldn't find disk by PARTUUID.
Error: Script could not determine dump parameters

Remove the superfluous lines to fix this.

Fixes: 41108c98aa ("zipl: move mkfs to ngdump prepare script")
Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2023-07-04 15:41:03 +02:00
Marc Hartmayer
6028300366 cpacfstatsd: don't fail if no crypto counters are supported
Do not fail to start the daemon if no crypto counters are supported, as
there is still a use case for the daemon to run, as the user can then
use the 'cpacfstats' tool to evaluate that no counter stats are
available. Previously, the user had to check the syslogs for the reason
why the daemon was not running and the cpacfstats command failed.

Before this change:

$ cpacfstats
cpacfstats: Can't access domain socket file '/run/cpacfstatsd_socket', errno=2 [No such file or directory]
cpacfstats: Maybe cpacfstatsd daemon is not running ???
cpacfstats: Can't connect to daemon

After this change:

$ cpacfstats
 des counter: unsupported
 aes counter: unsupported
 sha counter: unsupported
 rng counter: unsupported
 ecc counter: unsupported
 pai_user   : unsupported
 pai_kernel : unsupported

Also, it's no good practice to let systemd services fail, because
otherwise the system state will be shown as 'degraded':

$ systemctl status
* a46lp59
    State: degraded
     Jobs: 0 queued
   Failed: 1 units

$ systemctl list-units --failed
  UNIT                LOAD   ACTIVE SUB    DESCRIPTION
* cpacfstatsd.service loaded failed failed CPACF statistics collection daemon process for Linux on System z

Reviewed-by: Holger Dengler <dengler@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2023-07-04 15:41:03 +02:00
Marc Hartmayer
70cb25766b cpacfstatsd: manpage: CPU hotplug is recognized by the daemon
Since commit 72b5e8b313 ("cpacfstats: Handle CPU hotplug") CPU
hotplugs are recognized by the daemon.

Fixes: 72b5e8b313 ("cpacfstats: Handle CPU hotplug")
Reviewed-by: Holger Dengler <dengler@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2023-07-04 15:41:03 +02:00
Marc Hartmayer
36eede8f31 cpacfstats: whitespace cleanups and typo fix
Reviewed-by: Holger Dengler <dengler@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2023-07-04 15:41:03 +02:00
Eduard Shishkin
ec0dcdb685 zipl/job.c: Print additional information on error paths
Print the name of the section which specifes non-existing image
and/or ramdisk files.

It allows to quickly identify problems after using non-atomic tools
manipulating with bootloader settings.

Signed-off-by: Eduard Shishkin <edward6@linux.ibm.com>
Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2023-07-04 15:41:03 +02:00
Vineeth Vijayan
2a1a821bb3 zdev: add missing label in the udev-rules
The udev-rules generated with the current version of chzdev command
is missing the configuration label, incase of auto configuration,
resulting in an ineffective configuration logic.
Add the missing configuration start label for autoconfig.

Fixes: 2e89722ef0 ("zdev: make site specific udev-rule for ccw")
Signed-off-by: Vineeth Vijayan <vneethv@linux.ibm.com>
Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2023-07-04 15:41:02 +02:00
Vineeth Vijayan
09c01e580a zdev: use rename-file to avoid any symlinks created
During the boot, the ZDEV_SITE_ID is derived with the help
of loadparm and will be saved in ZDEV_SITE_ID_FILE, which
will be the used by the udev-rules.

ZDEV_SITE_ID_FILE creation can have a surface of symlink attack
as we are directly using the fopen and fprintf on it. To avoid
this, make sure that we are writing the ZDEV_SITE_ID to a temporary
file, which will then be renamed to ZDEV_SITE_ID_FILE, which will
remove all the existing symlinks associated with the target file.

Reported-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Vineeth Vijayan <vneethv@linux.ibm.com>
Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2023-07-04 15:41:02 +02:00
Vineeth Vijayan
27902c9106 zdev: add proper value input for the ZDEV_SITE_ID key
udev does not allow an empty value for keys when importing output
from an external program. Providing an empty value for any key
invokes a warning during the parsing. Currently, ZDEV_SITE_ID for
fallback sites are not assigned any value. Add an empty double
quotes as the value in case of failover sites.

This modification is tested on udevadm version 253 on fedora38.

Also verify that the ZDEV_SITE_ID is properly written, if not log
the error.

Fixes: c8ad5f57d0 ("zdev: modify zdev_id to read the site_id from loadparm")
Reported-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Vineeth Vijayan <vneethv@linux.ibm.com>
Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2023-07-04 15:41:02 +02:00
Thomas Richter
a8d328bba2 cpumf/lshwc: replace memory alloction functions by library counterparts
Replace memory allocation functions malloc() and calloc()
by counterparts provided in libutil.a library. Also remove error
handling when no memory could be allocated as those functions do
not return.

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Acked-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2023-07-04 15:41:02 +02:00
Eduard Shishkin
917d611883 zipl: add/move some definitions to header files
Make the listed changes which are needed to re-use some definitions
by the new zipl-debug(8) tool introduced by the next patch in the
series:

. Add definitions to boot_defs.h:
   . a named union disk_bloclkptr (instead of the anonymous one);
   . a named structure disk_program_table;
. Remove a 'typedef union disk_blockptr_t' from boot/stage2.h
  (cleanup), use the named union in boot_defs.h instead;
. Move the definition of scsi_layout types and the function
  get_scsi_layout() from install.c to install.h;
. Move definition of PROGRAM_TABLE_BLOCK_SIZE from bootmap.c to
  bootmap.h

Signed-off-by: Eduard Shishkin <edward6@linux.ibm.com>
Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2023-07-04 15:41:02 +02:00
Marc Hartmayer
94e0b644a7 cpacfstatsd: use a PIPE to notify the parent that the initialization is done
Use a PIPE to notify the parent that the initialization is complete and
all external communication channels are established. See
https://www.freedesktop.org/software/systemd/man/daemon.html for
details.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2023-07-04 15:41:02 +02:00
Marc Hartmayer
10f8565e32 cpacfstatsd: replace goto cleanups
There are only two users of the `cleanup` label, so let's replace the
goto statements with the label code. This makes the code easier to read.
Especially since another label will be introduced in the next commit.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2023-07-04 15:41:01 +02:00
Marc Hartmayer
22bce41dd7 cpacfstatsd: white-space cleanup and typo fixes
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2023-07-04 15:41:01 +02:00
Harald Freudenberger
e35e73d2a3 chzcrypt: Support for SE bind, unbind and associate
This patch adds support for Secure Execution with AP pass-through
support for chzcrypt.

chzcrypt details:
* new command: --se-associate <secret-id> <queue device>
* new command: --se-bind <queue device>
* new command: --se-unbind <queue device>

Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Reviewed-by: Holger Dengler <dengler@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2023-07-04 15:40:56 +02:00
Harald Freudenberger
f821f31a51 lszcrypt: Support for SE AP pass-through support
This patch adds support for Secure Execution with AP pass-through
support for lszcrypt.

lszcrypt details:
* extension to -b: list AP bus features
* extension to -c: now also valid for queue devices, shows
		   bind and assoicate state in SE environment;
		   shows MK states (only for current MKs).
* extension to -V: new column SESTAT within an SE guest, shows text
		   for the BS bits within an SE environment:
		   "usable", "bond", "avail", "unuse".

Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Reviewed-by: Holger Dengler <dengler@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2023-07-04 15:40:47 +02:00
Stefan Haberland
493af760ed zdev: add support for autoquiesce related sysfs attributes
Autoquiesce is a mechanism that tells Linux to stop issuing I/Os to a
specific DASD after certain events.

Add support for configuring related DASD device attributes
that govern the following aspects of autoquiesce:

aq_mask - Configure which events lead to autoquiesce.
aq_requeue - Configure if autoquiesce will requeue all I/O to blocklayer.
aq_timeouts - Configure the number of timeouts before autoquiesce.

Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2023-05-30 16:55:55 +02:00
Steffen Eiden
3287bb9613 Prepare for next release
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2023-05-30 14:42:12 +02:00
Steffen Eiden
76606802d0 New release s390-tools-2.27.0
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
v2.27.0
2023-05-30 14:42:12 +02:00
Marc Hartmayer
e99b32cacb common.mak: make *clean targets mutually exclusive
The 'clean' build targets can be specified alongside other targets,
which causes an immediate removal of build artifacts. Make 'clean'
targets mutually exclusive to avoid this issue and display an error if
'clean' is used in combination with other targets.

Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2023-05-30 13:31:53 +02:00
Jan Höppner
87a6154de9 Makefile: limit build targets for non-s390x architecture
A subset of s390 tools can be useful on non-s390x architectures such as
x86 or arm. Limit the build targets for these architectures with
'pvattest' and 'libpv' as the first candidates.

A cross compilation on x86 for s390x will still build the entire package
provided that the HOST_ARCH variable is set properly:

$ make HOST_ARCH=s390x CROSS_COMPILE=s390x-linux-gnu-

Cross compilation on s390x for x86 will limit the build targets as
described:

$ make HOST_ARCH=x86_64 CROSS_COMPILE=x86_64-linux-gnu-

Co-developed-by: Jan Höppner <hoeppner@linux.ibm.com>
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2023-05-30 13:31:53 +02:00
Marc Hartmayer
ed4c68e867 common.mak: improve cross compilation support
Introduce `BUILD_ARCH` and `(CC|LINK|...|OBJDUMP)_FOR_BUILD` variables
in order to properly support the build of tools that generate code or
data during the build process. Replace existing variables `HOSTCC` with
`CC_FOR_BUILD` and `HOSTCFLAGS` `CFLAGS_FOR_BUILD`. The Makefile
variables for the `HOST_ARCH` are unchanged.

Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2023-05-30 13:31:53 +02:00
Marc Hartmayer
e2b68b4d9b common.mak: make sure all command variables are getting exported
Export the Makefile variables HOSTCC, LINKXX, PANDOC, and PKG_CONFIG so
they can be used in sub-make calls, too.

Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2023-05-30 13:31:53 +02:00
Marc Hartmayer
686fca1863 Move HOST_ARCH declaration to common.mak
In addition, add the ability that a Makefile that includes `common.mak`
can specify the `HOST_ARCH`. Usage example:

$S390_TOOLS/mytool/Makefile:
``` Makefile
HOST_ARCH := s390x
include ../common.mak
```

Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2023-05-30 13:31:53 +02:00
Marc Hartmayer
0c1a5069d9 Rename ARCH to HOST_ARCH
Use a common naming convention for the variable [1][2][3]. In an
upcoming patch the Makefile variable `BUILD_ARCH` will be introduced.

[1] https://www.gnu.org/software/automake/manual/html_node/Cross_002dCompilation.html
[2] https://docs.yoctoproject.org/ref-manual/variables.html#term-HOST_ARCH
[3] https://mesonbuild.com/Cross-compilation.html#cross-compilation

Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2023-05-30 13:31:53 +02:00
Marc Hartmayer
de88b1c71b common.mak: introduce PKG_CONFIG
Introduce `PKG_CONFIG` Makefile variable. This helps for
cross-compilation.

Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2023-05-30 13:31:51 +02:00
Marc Hartmayer
4bba1058c6 Declare pkg-config as required
`pkg-config` is a well established tool and all of our required
libraries do provide .pc files. Therefore let's declare `pkg-config` as
required and use it. In addition, remove now useless code.

Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2023-05-30 13:31:20 +02:00
Jan Höppner
49937f40a1 zipl: Disable array-bounds warning
Since GCC12 several warnings like the following are produced in
zipl/boot compile targets:

CC      zipl/boot/stage2.o
stage2.c: In function ‘start’:
stage2.c:99:24: warning: array subscript 0 is outside array bounds of ‘struct stage2_descr[0]’ [-Warray-bounds]
   99 |         stage2_descr = *(struct stage2_descr*)STAGE2_DESC;

This is the same issue as reported for the Kernel [1][2]. There is
currently no sane fix available, therefore simply disable the warning
for the zipl/boot/ targets.

[1] https://lore.kernel.org/lkml/yt9dzgkelelc.fsf@linux.ibm.com/
[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578

Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2023-05-30 13:29:57 +02:00
Jan Höppner
d55818a797 dasdfmt: Fall back to full format if space release fails
In certain storage setups the Release Allocated Space (RAS) command to
free up space on the storage server previously allocated for an ESE DASD
might not work. At the moment dasdfmt will error out if RAS is failing.
This however is not ideal for the default case when a user is expecting
dasdfmt to simply format the disk.

One workaround would be to specify --no-discard to disable RAS
completely. However, a sane default handling that tries to work every
time is more reasonable.

Change the default handling as follows: If an ESE is detected default to
QUICK mode and try RAS. If RAS fails, fall back to the FULL format mode
and display a warning accordingly.

If -M (--mode) QUICK is specified explicitly dasdfmt will still error
out on a failing RAS. A combination with --no-discard will still allow
for a QUICK format on an ESE DASD in that case, if desired.

Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2023-05-30 13:29:57 +02:00
Steffen Eiden
96897ee32e pvattest/tools: fix endianness in tools
`od` in contrast to `xxd` uses the system endianness for displying the
hexdump by default which leads to invalid results on little endian
systems.
Use the `--endian=big` option to fix the endianness problem.

Fixes: 3cc0b4cd ("pvattest/tools: remove xxd dependency from scripts")
Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2023-05-26 12:21:04 +02:00
Marc Hartmayer
5522aaedf4 iucvterm/bin/chiucvallow: explicitly use bash
The script uses bashisms (e.g. `local` keyword) therefore make sure that
bash is used by setting the shebang line to `#!/bin/bash`.

Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2023-05-26 12:21:04 +02:00
Joern Siglen
f3b7f4b14b dbginfo.sh: fix icastats for all users
icastats is accounted by user and does cover root only today
adding the --all will collect stats for all users

Reported-by: Ingo Franzki <ifranzki@de.ibm.com>
Reviewed-by: Ingo Franzki <ifranzki@de.ibm.com>
Signed-off-by: Joern Siglen <siglen@de.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2023-05-26 12:21:04 +02:00
Sven Schnelle
01f74c75f5 zipl/dump: add dasd device to ngdump parmline
For dasd devices, we need to enable the device before we can use it.
Add the required dasd device to the kernel commandline when installing
ngdump to a dasd device.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2023-05-26 12:21:04 +02:00
Sven Schnelle
24bcc3141d zipl: add support for ldipl dump from ECKD DASD
Add the required code to install ngdump on DASDs.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2023-05-26 12:21:04 +02:00
Sven Schnelle
41108c98aa zipl: move mkfs to ngdump prepare script
The current code first assembles the ngdump init ramdisk, and creates
the filesystem on the dump disk afterwards. ngdump uses uuids to mount
the dump device. Because the filesystem uuid is changing with the final
mkfs, ngdump has to use the partuuid of the device. This does work for
nvme, but not for dasds. Another problem is that dryrun likely wouldn't
work if there's no partition table on the dump device. To fix these
issues, move the mkfs to the ngdump helper script so we can use the
filesystem uuid. When --dryrun is specified the script passes /dev/null
as ngdump device to make mkinitramfs happy. As the initramdisk is never
used in this case, this shouldn't be a problem.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2023-05-26 12:21:04 +02:00
Sven Schnelle
f5aa1d4406 zipl: add ldipl-dump option
CCW and LD-IPL records cannot be used at the same time for dumps because
CCW dump uses the standalone dumper, while LD-IPL uses ngdump. The first
one writes data to the raw disk without any filesystem, while the second
one uses an ext filesystem. Therefore we need a way to tell zipl which
kind of dumper it should install, as both cannot be installed at the
same time. The device given is the same for both types, so we cannot use
this to decide which type to install. Therefore add a '--ldipl-dump' option
so the user can decide which type of dump to use.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Eduard Shishkin <edward6@linux.ibm.com>
Acked-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2023-05-26 12:21:04 +02:00
Sven Schnelle
ee4f503ec0 zipl: pass job to is_ngdump_enabled()
No functional change, only preparation for the next patches.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Eduard Shishkin <edward6@linux.ibm.com>
Acked-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2023-05-26 12:21:04 +02:00
Sven Schnelle
7095da9f9d dumpconf: add options for ldipl ECKD devices
Add the following options to dumpconf so that LDIPL ECKD devices
can be configured for dumping:

br_chr: (optional) location of boot record
device: ccw device
bootprog: boot program selector

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Acked-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2023-05-26 12:21:03 +02:00
Eduard Shishkin
7c656faa36 zipl: remove last table / number of tables logic
In order to allow installing only a list-directed ipl entry, remove
the last-table/number-of-tables logic which always required a legacy
program table. With the new code there's no longer a loop in
prepare_bootloader() which requires a certain start index or order
of tables.

Signed-off-by: Eduard Shishkin <edward6@linux.ibm.com>
Acked-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2023-05-26 12:21:03 +02:00