Re: [PATCH v3 3/7] Drivers: hv: Provide arch-neutral implementation of get_vtl()
From: Wei Liu
Date: Fri Aug 02 2024 - 21:22:41 EST
On Fri, Jul 26, 2024 at 03:59:06PM -0700, Roman Kisel wrote:
> To run in the VTL mode, Hyper-V drivers have to know what
> VTL the system boots in, and the arm64/hyperv code does not
> have the means to compute that.
>
> Refactor the code to hoist the function that detects VTL,
> make it arch-neutral to be able to employ it to get the VTL
> on arm64. Fix the hypercall output address in `get_vtl(void)`
> not to overlap with the hypercall input area to adhere to
> the Hyper-V TLFS.
Can you split the fix out? That potentially can be backported.
>
> Signed-off-by: Roman Kisel <romank@xxxxxxxxxxxxxxxxxxx>
> ---
> +
> +#if IS_ENABLED(CONFIG_HYPERV_VTL_MODE)
> +u8 __init get_vtl(void)
> +{
> + u64 control = HV_HYPERCALL_REP_COMP_1 | HVCALL_GET_VP_REGISTERS;
> + struct hv_get_vp_registers_input *input;
> + struct hv_get_vp_registers_output *output;
> + unsigned long flags;
> + u64 ret;
> +
> + local_irq_save(flags);
> + input = *this_cpu_ptr(hyperv_pcpu_input_arg);
> + output = *this_cpu_ptr(hyperv_pcpu_output_arg);
Hmm... I don't remember why the old code didn't use
hyperv_pcpu_output_arg but instead reused input+OFFSET as output.
Saurabh, can you comment on this?
Thanks,
Wei.