Skip to content

Commit 9263abc

Browse files
romank-msftliuw
authored andcommitted
hyperv: Enable the hypercall output page for the VTL mode
Due to the hypercall page not being allocated in the VTL mode, the code resorts to using a part of the input page. Allocate the hypercall output page in the VTL mode thus enabling it to use it for output and share code with dom0. Signed-off-by: Roman Kisel <[email protected]> Reviewed-by: Nuno Das Neves <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Wei Liu <[email protected]> Message-ID: <[email protected]>
1 parent 1da602e commit 9263abc

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

drivers/hv/hv_common.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,11 @@ static void hv_kmsg_dump_register(void)
278278
}
279279
}
280280

281+
static inline bool hv_output_page_exists(void)
282+
{
283+
return hv_root_partition || IS_ENABLED(CONFIG_HYPERV_VTL_MODE);
284+
}
285+
281286
int __init hv_common_init(void)
282287
{
283288
int i;
@@ -340,7 +345,7 @@ int __init hv_common_init(void)
340345
BUG_ON(!hyperv_pcpu_input_arg);
341346

342347
/* Allocate the per-CPU state for output arg for root */
343-
if (hv_root_partition) {
348+
if (hv_output_page_exists()) {
344349
hyperv_pcpu_output_arg = alloc_percpu(void *);
345350
BUG_ON(!hyperv_pcpu_output_arg);
346351
}
@@ -435,7 +440,7 @@ int hv_common_cpu_init(unsigned int cpu)
435440
void **inputarg, **outputarg;
436441
u64 msr_vp_index;
437442
gfp_t flags;
438-
int pgcount = hv_root_partition ? 2 : 1;
443+
const int pgcount = hv_output_page_exists() ? 2 : 1;
439444
void *mem;
440445
int ret;
441446

@@ -453,7 +458,7 @@ int hv_common_cpu_init(unsigned int cpu)
453458
if (!mem)
454459
return -ENOMEM;
455460

456-
if (hv_root_partition) {
461+
if (hv_output_page_exists()) {
457462
outputarg = (void **)this_cpu_ptr(hyperv_pcpu_output_arg);
458463
*outputarg = (char *)mem + HV_HYP_PAGE_SIZE;
459464
}

0 commit comments

Comments
 (0)