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>
This commit is contained in:
Родитель
0d02ec6b31
Коммит
37564ed834
|
@ -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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче