From 890b15d158d65e818c14d4c2dd5a7229d030ea8f Mon Sep 17 00:00:00 2001 From: Harald Freudenberger Date: Thu, 12 Aug 2021 11:53:59 +0200 Subject: [PATCH] lszcrypt: add support for vfio-ap status field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit lszcrypt now evaluates and displays the 'status' in the 'STATUS' column if the vfio provides this sysfs attribute. Signed-off-by: Harald Freudenberger Signed-off-by: Jan Höppner --- zconf/zcrypt/lszcrypt.8 | 13 ++++++++++--- zconf/zcrypt/lszcrypt.c | 10 ++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/zconf/zcrypt/lszcrypt.8 b/zconf/zcrypt/lszcrypt.8 index e0405155..ca3e7797 100644 --- a/zconf/zcrypt/lszcrypt.8 +++ b/zconf/zcrypt/lszcrypt.8 @@ -117,7 +117,7 @@ of the columns show up in verbose mode only. .TP .B CARD.DOM The crypto card number in hexadecimal for a crypto card line or -the crypto card number and the domain id both in hex seperated by a single +the crypto card number and the domain id both in hex separated by a single dot for a queue line. .TP .B TYPE and HWTYPE @@ -150,9 +150,16 @@ may be adjusted on the HMC or SE. The chzcrypt application can also trigger this state with the --config-on and --config-off options. .br lszcrypt shows 'online' when a card or queue is available for -cryptograhic operations. 'offline' is displayed when a card or queue +cryptographic operations. 'offline' is displayed when a card or queue is switched to (software) offline. If a card is 'deconfigured' via HMC, SE or chzcrypt the field shows 'deconfig'. +.br +If a queue is not bound to a device driver there is no detailed +information available and thus the status shows only '-'. +.br +If a queue is bound to the vfio-ap device driver it is up to this driver +to give some status information and what exactly this means. So lszcrypt +shows the text retrieved from the underlying sysfs attribute here. .TP .B REQUESTS This is the counter value of successful processed requests on card or queue @@ -173,7 +180,7 @@ S - APSC available: card/queue can handle requests with the special bit enabled. .br M - Accelerator card/queue with support for RSA ME with up to 4k key size. -.br +.Sr C - Accelerator card/queue with support for RSA CRT with up to 4k key size. .br D - Card/queue is providing CCA functions (this is the CCA Coprocessor mode). diff --git a/zconf/zcrypt/lszcrypt.c b/zconf/zcrypt/lszcrypt.c index 14297de3..ce70cabe 100644 --- a/zconf/zcrypt/lszcrypt.c +++ b/zconf/zcrypt/lszcrypt.c @@ -397,6 +397,16 @@ static void read_subdev_rec_default(struct util_rec *rec, const char *grp_dev, util_rec_set(rec, "status", "online"); else if (online == 0) util_rec_set(rec, "status", "offline"); + else { + /* no online attribute, maybe use status attribute */ + if (util_path_is_readable("%s/%s/status", + grp_dev, sub_dev)) { + util_file_read_line(buf, sizeof(buf), + "%s/%s/status", + grp_dev, sub_dev); + util_rec_set(rec, "status", buf); + } + } } util_file_read_ul(&facility, 16, "%s/ap_functions", grp_dev);