Skip to content

Commit

Permalink
s390/cio: Export information about Endpoint-Security Capability
Browse files Browse the repository at this point in the history
Add a new sysfs attribute 'esc' per chpid. This new attribute exports
the Endpoint-Security-Capability byte of channel-path description block,
which could be 0-None, 1-Authentication, 2 and 3-Encryption.

For example:
$ cat /sys/devices/css0/chp0.34/esc
0

[vneethv@linux.ibm.com: cleaned-up & modified description]

Signed-off-by: Sebastian Ott <sebott@linux.ibm.com>
Signed-off-by: Vineeth Vijayan <vneethv@linux.ibm.com>
Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Sebastian Ott authored and Jens Axboe committed Nov 16, 2020
1 parent e2b6b30 commit 8b8b091
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
15 changes: 15 additions & 0 deletions drivers/s390/cio/chp.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,20 @@ static ssize_t chp_chid_external_show(struct device *dev,
}
static DEVICE_ATTR(chid_external, 0444, chp_chid_external_show, NULL);

static ssize_t chp_esc_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct channel_path *chp = to_channelpath(dev);
ssize_t rc;

mutex_lock(&chp->lock);
rc = sprintf(buf, "%x\n", chp->desc_fmt1.esc);
mutex_unlock(&chp->lock);

return rc;
}
static DEVICE_ATTR(esc, 0444, chp_esc_show, NULL);

static ssize_t util_string_read(struct file *filp, struct kobject *kobj,
struct bin_attribute *attr, char *buf,
loff_t off, size_t count)
Expand Down Expand Up @@ -414,6 +428,7 @@ static struct attribute *chp_attrs[] = {
&dev_attr_shared.attr,
&dev_attr_chid.attr,
&dev_attr_chid_external.attr,
&dev_attr_esc.attr,
NULL,
};
static struct attribute_group chp_attr_group = {
Expand Down
3 changes: 2 additions & 1 deletion drivers/s390/cio/chsc.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ struct channel_path_desc_fmt1 {
u8 lsn;
u8 desc;
u8 chpid;
u32:24;
u32:16;
u8 esc;
u8 chpp;
u32 unused[2];
u16 chid;
Expand Down

0 comments on commit 8b8b091

Please sign in to comment.