summary refs log tree commit diff
path: root/arch/s390/kernel/uv.c
diff options
context:
space:
mode:
authorJanosch Frank <frankja@linux.ibm.com>2021-03-23 10:09:50 +0000
committerHeiko Carstens <hca@linux.ibm.com>2021-03-24 16:06:19 +0100
commitdf2e400e07ad53a582ee934ce8384479d5ddf48b (patch)
treec96eb2c56a8dbc43047661ca4bf81ed191638955 /arch/s390/kernel/uv.c
parent5671d9718faf8c8520228c2acb91f3c0cc64192b (diff)
downloadlinux-df2e400e07ad53a582ee934ce8384479d5ddf48b.tar.gz
s390/uv: fix prot virt host indication compilation
prot_virt_host is only available if CONFIG_KVM is enabled. So lets use
a variable initialized to zero and overwrite it when that config
option is set with prot_virt_host.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Fixes: 37564ed834ac ("s390/uv: add prot virt guest/host indication files")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Diffstat (limited to 'arch/s390/kernel/uv.c')
-rw-r--r--arch/s390/kernel/uv.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/arch/s390/kernel/uv.c b/arch/s390/kernel/uv.c
index 04b6463d8f9f..cbfbeab57c3b 100644
--- a/arch/s390/kernel/uv.c
+++ b/arch/s390/kernel/uv.c
@@ -420,7 +420,13 @@ static ssize_t uv_is_prot_virt_guest(struct kobject *kobj,
 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);
+	int val = 0;
+
+#if IS_ENABLED(CONFIG_KVM)
+	val = prot_virt_host;
+#endif
+
+	return scnprintf(page, PAGE_SIZE, "%d\n", val);
 }
 
 static struct kobj_attribute uv_prot_virt_guest =