Skip to content

Commit

Permalink
s390/uv: fix prot virt host indication compilation
Browse files Browse the repository at this point in the history
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 <[email protected]>
Fixes: 37564ed ("s390/uv: add prot virt guest/host indication files")
Reported-by: kernel test robot <[email protected]>
Signed-off-by: Heiko Carstens <[email protected]>
  • Loading branch information
frankjaa authored and hcahca committed Mar 24, 2021
1 parent 5671d97 commit df2e400
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion arch/s390/kernel/uv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit df2e400

Please sign in to comment.