Skip to content

Commit

Permalink
hyperv: Enable the hypercall output page for the VTL mode
Browse files Browse the repository at this point in the history
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 <romank@linux.microsoft.com>
Reviewed-by: Nuno Das Neves <nunodasneves@linux.microsoft.com>
Link: https://lore.kernel.org/r/20250108222138.1623703-4-romank@linux.microsoft.com
Signed-off-by: Wei Liu <wei.liu@kernel.org>
Message-ID: <20250108222138.1623703-4-romank@linux.microsoft.com>
  • Loading branch information
Roman Kisel authored and Wei Liu committed Jan 10, 2025
1 parent 1da602e commit 9263abc
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions drivers/hv/hv_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,11 @@ static void hv_kmsg_dump_register(void)
}
}

static inline bool hv_output_page_exists(void)
{
return hv_root_partition || IS_ENABLED(CONFIG_HYPERV_VTL_MODE);
}

int __init hv_common_init(void)
{
int i;
Expand Down Expand Up @@ -340,7 +345,7 @@ int __init hv_common_init(void)
BUG_ON(!hyperv_pcpu_input_arg);

/* Allocate the per-CPU state for output arg for root */
if (hv_root_partition) {
if (hv_output_page_exists()) {
hyperv_pcpu_output_arg = alloc_percpu(void *);
BUG_ON(!hyperv_pcpu_output_arg);
}
Expand Down Expand Up @@ -435,7 +440,7 @@ int hv_common_cpu_init(unsigned int cpu)
void **inputarg, **outputarg;
u64 msr_vp_index;
gfp_t flags;
int pgcount = hv_root_partition ? 2 : 1;
const int pgcount = hv_output_page_exists() ? 2 : 1;
void *mem;
int ret;

Expand All @@ -453,7 +458,7 @@ int hv_common_cpu_init(unsigned int cpu)
if (!mem)
return -ENOMEM;

if (hv_root_partition) {
if (hv_output_page_exists()) {
outputarg = (void **)this_cpu_ptr(hyperv_pcpu_output_arg);
*outputarg = (char *)mem + HV_HYP_PAGE_SIZE;
}
Expand Down

0 comments on commit 9263abc

Please sign in to comment.