Thread (53 messages) 53 messages, 6 authors, 2024-08-05

Re: [PATCH v3 3/7] Drivers: hv: Provide arch-neutral implementation of get_vtl()

From: Saurabh Singh Sengar <ssengar@linux.microsoft.com>
Date: 2024-08-05 05:45:14
Also in: linux-acpi, linux-arch, linux-hyperv, linux-pci, lkml

On Sat, Aug 03, 2024 at 01:21:52AM +0000, Wei Liu wrote:
On Fri, Jul 26, 2024 at 03:59:06PM -0700, Roman Kisel wrote:
quoted
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.
quoted
Signed-off-by: Roman Kisel <redacted>
---
+
+#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?
This was done to optimize memory usage. Michael has provided more
details on this in his review of the patch today.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help