mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-27 13:05:03 +08:00
ecdc5d842b
Add "prot_virt" command line option which controls if the kernel protected VMs support is enabled at early boot time. This has to be done early, because it needs large amounts of memory and will disable some features like STP time sync for the lpar. Extend ultravisor info definitions and expose it via uv_info struct filled in during startup. Signed-off-by: Vasily Gorbik <gor@linux.ibm.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Acked-by: David Hildenbrand <david@redhat.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> [borntraeger@de.ibm.com: patch merging, splitting, fixing] Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
53 lines
1.2 KiB
C
53 lines
1.2 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Common Ultravisor functions and initialization
|
|
*
|
|
* Copyright IBM Corp. 2019, 2020
|
|
*/
|
|
#define KMSG_COMPONENT "prot_virt"
|
|
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/types.h>
|
|
#include <linux/sizes.h>
|
|
#include <linux/bitmap.h>
|
|
#include <linux/memblock.h>
|
|
#include <asm/facility.h>
|
|
#include <asm/sections.h>
|
|
#include <asm/uv.h>
|
|
|
|
/* the bootdata_preserved fields come from ones in arch/s390/boot/uv.c */
|
|
#ifdef CONFIG_PROTECTED_VIRTUALIZATION_GUEST
|
|
int __bootdata_preserved(prot_virt_guest);
|
|
#endif
|
|
|
|
#if IS_ENABLED(CONFIG_KVM)
|
|
int prot_virt_host;
|
|
EXPORT_SYMBOL(prot_virt_host);
|
|
struct uv_info __bootdata_preserved(uv_info);
|
|
EXPORT_SYMBOL(uv_info);
|
|
|
|
static int __init prot_virt_setup(char *val)
|
|
{
|
|
bool enabled;
|
|
int rc;
|
|
|
|
rc = kstrtobool(val, &enabled);
|
|
if (!rc && enabled)
|
|
prot_virt_host = 1;
|
|
|
|
if (is_prot_virt_guest() && prot_virt_host) {
|
|
prot_virt_host = 0;
|
|
pr_warn("Protected virtualization not available in protected guests.");
|
|
}
|
|
|
|
if (prot_virt_host && !test_facility(158)) {
|
|
prot_virt_host = 0;
|
|
pr_warn("Protected virtualization not supported by the hardware.");
|
|
}
|
|
|
|
return rc;
|
|
}
|
|
early_param("prot_virt", prot_virt_setup);
|
|
#endif
|