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>
This commit is contained in:
Harald Freudenberger
2023-05-17 11:43:08 +02:00
committed by Jan Höppner
parent 493af760ed
commit f821f31a51
4 changed files with 278 additions and 94 deletions
+37 -1
View File
@@ -1,16 +1,20 @@
/*
* Misc - Local helper functions
*
* Copyright IBM Corp. 2016, 2017
* Copyright IBM Corp. 2016, 2023
*
* 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 <regex.h>
#include <string.h>
#include <sys/types.h>
#include "lib/util_base.h"
#include "lib/util_file.h"
#include "lib/util_panic.h"
#include "lib/util_path.h"
#include "misc.h"
/**
@@ -35,3 +39,35 @@ bool misc_regex_match(const char *str, const char *regex)
regfree(&preg);
return rc == 0 ? true : false;
}
/**
* Test if AP bus has SB support available.
*
* @returns true Yes, SB support is available
* false No
*/
bool ap_bus_has_SB_support(void)
{
static int sb_support = -1;
if (sb_support < 0) {
char *ap, buf[256];
ap = util_path_sysfs("bus/ap");
if (!util_path_is_dir(ap)) {
sb_support = 0;
} else {
if (!util_path_is_readable("%s/features", ap)) {
sb_support = 0;
} else {
util_file_read_line(buf, sizeof(buf),
"%s/features", ap);
if (strstr(buf, "APSB"))
sb_support = 1;
}
}
free(ap);
}
return sb_support > 0 ? true : false;
}