summaryrefslogtreecommitdiff
path: root/arch/s390
diff options
context:
space:
mode:
authorJanosch Frank <frankja@linux.ibm.com>2021-02-09 09:33:12 -0500
committerHeiko Carstens <hca@linux.ibm.com>2021-03-22 11:36:03 +0100
commit37564ed834aca26993b77b9b2a0119ec1ba6e00c (patch)
treefb8ab9497342db335a9c37a7f1ba607cce9efa8a /arch/s390
parent0d02ec6b3136c73c09e7859f0d0e4e2c4c07b49b (diff)
s390/uv: add prot virt guest/host indication files
Let's export the prot_virt_guest and prot_virt_host variables into the UV sysfs firmware interface to make them easily consumable by administrators. prot_virt_host being 1 indicates that we did the UV initialization (opt-in) prot_virt_guest being 1 indicates that the UV indicates the share and unshare ultravisor calls which is an indication that we are running as a protected guest. Signed-off-by: Janosch Frank <frankja@linux.ibm.com> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/kernel/uv.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/arch/s390/kernel/uv.c b/arch/s390/kernel/uv.c
index b2d2ad153067..04b6463d8f9f 100644
--- a/arch/s390/kernel/uv.c
+++ b/arch/s390/kernel/uv.c
@@ -406,6 +406,35 @@ static struct attribute_group uv_query_attr_group = {
.attrs = uv_query_attrs,
};
+static ssize_t uv_is_prot_virt_guest(struct kobject *kobj,
+ struct kobj_attribute *attr, char *page)
+{
+ int val = 0;
+
+#ifdef CONFIG_PROTECTED_VIRTUALIZATION_GUEST
+ val = prot_virt_guest;
+#endif
+ return scnprintf(page, PAGE_SIZE, "%d\n", val);
+}
+
+static ssize_t uv_is_prot_virt_host(struct kobject *kobj,
+ struct kobj_attribute *attr, char *page)
+{
+ return scnprintf(page, PAGE_SIZE, "%d\n", prot_virt_host);
+}
+
+static struct kobj_attribute uv_prot_virt_guest =
+ __ATTR(prot_virt_guest, 0444, uv_is_prot_virt_guest, NULL);
+
+static struct kobj_attribute uv_prot_virt_host =
+ __ATTR(prot_virt_host, 0444, uv_is_prot_virt_host, NULL);
+
+static const struct attribute *uv_prot_virt_attrs[] = {
+ &uv_prot_virt_guest.attr,
+ &uv_prot_virt_host.attr,
+ NULL,
+};
+
static struct kset *uv_query_kset;
static struct kobject *uv_kobj;
@@ -420,15 +449,21 @@ static int __init uv_info_init(void)
if (!uv_kobj)
return -ENOMEM;
+ rc = sysfs_create_files(uv_kobj, uv_prot_virt_attrs);
+ if (rc)
+ goto out_kobj;
+
uv_query_kset = kset_create_and_add("query", NULL, uv_kobj);
if (!uv_query_kset)
- goto out_kobj;
+ goto out_ind_files;
rc = sysfs_create_group(&uv_query_kset->kobj, &uv_query_attr_group);
if (!rc)
return 0;
kset_unregister(uv_query_kset);
+out_ind_files:
+ sysfs_remove_files(uv_kobj, uv_prot_virt_attrs);
out_kobj:
kobject_del(uv_kobj);
kobject_put(uv_kobj);