mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-01 06:33:07 +00:00
s390/protvirt: parse prot_virt option in the decompressor
To make early kernel address space layout definition possible parse prot_virt option in the decompressor and pass it to the uncompressed kernel. This enables kasan to take ultravisor secure storage limit into consideration and pre-define vmalloc position correctly. Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
This commit is contained in:
parent
8f78657c29
commit
1d6671ae46
4 changed files with 28 additions and 26 deletions
|
@ -254,6 +254,14 @@ void parse_boot_command_line(void)
|
||||||
|
|
||||||
if (!strcmp(param, "nokaslr"))
|
if (!strcmp(param, "nokaslr"))
|
||||||
kaslr_enabled = 0;
|
kaslr_enabled = 0;
|
||||||
|
|
||||||
|
#if IS_ENABLED(CONFIG_KVM)
|
||||||
|
if (!strcmp(param, "prot_virt")) {
|
||||||
|
rc = kstrtobool(val, &enabled);
|
||||||
|
if (!rc && enabled)
|
||||||
|
prot_virt_host = 1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,9 @@
|
||||||
#ifdef CONFIG_PROTECTED_VIRTUALIZATION_GUEST
|
#ifdef CONFIG_PROTECTED_VIRTUALIZATION_GUEST
|
||||||
int __bootdata_preserved(prot_virt_guest);
|
int __bootdata_preserved(prot_virt_guest);
|
||||||
#endif
|
#endif
|
||||||
|
#if IS_ENABLED(CONFIG_KVM)
|
||||||
|
int __bootdata_preserved(prot_virt_host);
|
||||||
|
#endif
|
||||||
struct uv_info __bootdata_preserved(uv_info);
|
struct uv_info __bootdata_preserved(uv_info);
|
||||||
|
|
||||||
void uv_query_info(void)
|
void uv_query_info(void)
|
||||||
|
|
|
@ -1137,8 +1137,7 @@ void __init setup_arch(char **cmdline_p)
|
||||||
free_mem_detect_info();
|
free_mem_detect_info();
|
||||||
remove_oldmem();
|
remove_oldmem();
|
||||||
|
|
||||||
if (is_prot_virt_host())
|
setup_uv();
|
||||||
setup_uv();
|
|
||||||
setup_memory_end();
|
setup_memory_end();
|
||||||
setup_memory();
|
setup_memory();
|
||||||
dma_contiguous_reserve(memory_end);
|
dma_contiguous_reserve(memory_end);
|
||||||
|
|
|
@ -26,33 +26,10 @@ int __bootdata_preserved(prot_virt_guest);
|
||||||
struct uv_info __bootdata_preserved(uv_info);
|
struct uv_info __bootdata_preserved(uv_info);
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_KVM)
|
#if IS_ENABLED(CONFIG_KVM)
|
||||||
int prot_virt_host;
|
int __bootdata_preserved(prot_virt_host);
|
||||||
EXPORT_SYMBOL(prot_virt_host);
|
EXPORT_SYMBOL(prot_virt_host);
|
||||||
EXPORT_SYMBOL(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);
|
|
||||||
|
|
||||||
static int __init uv_init(unsigned long stor_base, unsigned long stor_len)
|
static int __init uv_init(unsigned long stor_base, unsigned long stor_len)
|
||||||
{
|
{
|
||||||
struct uv_cb_init uvcb = {
|
struct uv_cb_init uvcb = {
|
||||||
|
@ -74,6 +51,21 @@ void __init setup_uv(void)
|
||||||
{
|
{
|
||||||
unsigned long uv_stor_base;
|
unsigned long uv_stor_base;
|
||||||
|
|
||||||
|
if (!is_prot_virt_host())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (is_prot_virt_guest()) {
|
||||||
|
prot_virt_host = 0;
|
||||||
|
pr_warn("Protected virtualization not available in protected guests.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!test_facility(158)) {
|
||||||
|
prot_virt_host = 0;
|
||||||
|
pr_warn("Protected virtualization not supported by the hardware.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uv_stor_base = (unsigned long)memblock_alloc_try_nid(
|
uv_stor_base = (unsigned long)memblock_alloc_try_nid(
|
||||||
uv_info.uv_base_stor_len, SZ_1M, SZ_2G,
|
uv_info.uv_base_stor_len, SZ_1M, SZ_2G,
|
||||||
MEMBLOCK_ALLOC_ACCESSIBLE, NUMA_NO_NODE);
|
MEMBLOCK_ALLOC_ACCESSIBLE, NUMA_NO_NODE);
|
||||||
|
|
Loading…
Reference in a new issue