Re: [PATCH v2] hyperv: reduce size of ms_hyperv_info

2023-09-22 Thread Wei Liu
On Fri, Sep 22, 2023 at 09:28:40PM +0200, Olaf Hering wrote: > Use the hole prior shared_gpa_boundary to store the result of get_vtl. > This reduces the size by 8 bytes. > > Signed-off-by: Olaf Hering Applied to hyperv-fixes. Thanks.

Re: [PATCH v3 15/15] Drivers: hv: Add modules to expose /dev/mshv to VMMs running on Hyper-V

2023-09-22 Thread Wei Liu
On Fri, Sep 22, 2023 at 11:38:35AM -0700, Nuno Das Neves wrote: > Add mshv, mshv_root, and mshv_vtl modules: > > Module mshv is the parent module to the other two. It provides /dev/mshv, > plus some common hypercall helper code. When one of the child modules is > loaded, it is registered with the

[PATCH v2] hyperv: reduce size of ms_hyperv_info

2023-09-22 Thread Olaf Hering
Use the hole prior shared_gpa_boundary to store the result of get_vtl. This reduces the size by 8 bytes. Signed-off-by: Olaf Hering --- v2: move vtl up, as suggested by Dexuan Cui include/asm-generic/mshyperv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/asm-gene

Re: [PATCH v3 02/15] mshyperv: Introduce hv_get_hypervisor_version function

2023-09-22 Thread Wei Liu
On Fri, Sep 22, 2023 at 11:38:22AM -0700, Nuno Das Neves wrote: > x86_64 and arm64 implementations to get the hypervisor version > information. Store these in hv_hypervisor_version_info structure to > simplify parsing the fields. > > Replace the existing parsing when printing the version numbers a

Re: [PATCH v3 01/15] hyperv-tlfs: Change shared HV_REGISTER_* defines to HV_MSR_*

2023-09-22 Thread Wei Liu
On Fri, Sep 22, 2023 at 11:38:21AM -0700, Nuno Das Neves wrote: > In x86 hyperv-tlfs, HV_REGISTER_ prefix is used to indicate MSRs > accessed via rdmsrl/wrmsrl. But in ARM64, HV_REGISTER_ instead indicates > VP registers accessed via get/set vp registers hypercall. > > This is due to HV_REGISTER_*

Re: [PATCH v3 12/15] Documentation: Reserve ioctl number for mshv driver

2023-09-22 Thread Wei Liu
On Fri, Sep 22, 2023 at 11:38:32AM -0700, Nuno Das Neves wrote: > Signed-off-by: Nuno Das Neves > Acked-by: Jonathan Corbet Acked-by: Wei Liu

Re: [PATCH v1] hyperv: reduce size of ms_hyperv_info

2023-09-22 Thread Wei Liu
On Tue, Sep 19, 2023 at 06:18:53AM +, Dexuan Cui wrote: > > From: Olaf Hering > > Sent: Monday, September 18, 2023 9:02 AM > > [...] > > Use the hole prior shared_gpa_boundary to store the result of get_vtl. > > This reduces the size by 8 bytes. > > [...] > > --- a/include/asm-generic/mshyper

Re: [PATCH] x86/hyperv: Add common print prefix "Hyper-V" in hv_init

2023-09-22 Thread Wei Liu
On Tue, Sep 19, 2023 at 04:36:01AM -0700, Saurabh Sengar wrote: > Add "#define pr_fmt()" in hv_init.c to use "Hyper-V:" as common > print prefix for all pr_*() statements in this file. > > Remove the "Hyper-V:" already prefixed in couple of prints. > > Signed-off-by: Saurabh Sengar Applied to h

Re: [PATCH v2] x86/hyperv: Remove hv_vtl_early_init initcall

2023-09-22 Thread Wei Liu
On Thu, Sep 21, 2023 at 09:58:40PM -0700, Saurabh Sengar wrote: > There has been cases reported where HYPERV_VTL_MODE is enabled by mistake, > on a non Hyper-V platforms. This causes the hv_vtl_early_init function to > be called in an non Hyper-V/VTL platforms which results the memory > corruption.

Re: [PATCH v3] x86/hyperv: Restrict get_vtl to only VTL platforms

2023-09-22 Thread Wei Liu
On Tue, Sep 19, 2023 at 09:04:35PM -0700, Saurabh Sengar wrote: > When Linux runs in a non-default VTL (CONFIG_HYPERV_VTL_MODE=y), > get_vtl() must never fail as its return value is used in negotiations > with the host. In the more generic case, (CONFIG_HYPERV_VTL_MODE=n) the > VTL is always zero s

[PATCH v3 13/15] uapi: hyperv: Add mshv driver headers defining hypervisor ABIs

2023-09-22 Thread Nuno Das Neves
These must be in uapi because they will be used in the mshv ioctl API. Version numbers for each file: hvhdk.h 25212 hvhdk_mini.h25294 hvgdk.h 25125 hvgdk_mini.h25294 These are unstable interfaces and as such must be compiled independently from published interfaces found in

[PATCH v3 05/15] hyperv: Move hv_connection_id to hyperv-tlfs

2023-09-22 Thread Nuno Das Neves
The definition conflicts with one added in hvgdk.h as part of the mshv driver so must be moved to hyperv-tlfs.h. This structure should be in hyperv-tlfs.h anyway, since it is part of the TLFS document. Signed-off-by: Nuno Das Neves Acked-by: Wei Liu --- include/asm-generic/hyperv-tlfs.h | 9 ++

[PATCH v3 03/15] mshyperv: Introduce numa_node_to_proximity_domain_info

2023-09-22 Thread Nuno Das Neves
Factor out logic for converting numa node to proximity domain info into a helper function, and export it. Change hv_proximity_domain_info to a struct to simplify the code. Signed-off-by: Nuno Das Neves Reviewed-by: Wei Liu --- arch/x86/hyperv/hv_proc.c | 8 ++-- drivers/acpi/numa/

[PATCH v3 09/15] Drivers: hv: Introduce hv_output_arg_exists in hv_common.c

2023-09-22 Thread Nuno Das Neves
This is a more flexible approach for determining whether to allocate the output page. Signed-off-by: Nuno Das Neves Acked-by: Wei Liu --- drivers/hv/hv_common.c | 21 + 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/hv/hv_common.c b/drivers/hv/hv_comm

[PATCH v3 12/15] Documentation: Reserve ioctl number for mshv driver

2023-09-22 Thread Nuno Das Neves
Signed-off-by: Nuno Das Neves Acked-by: Jonathan Corbet --- Documentation/userspace-api/ioctl/ioctl-number.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/userspace-api/ioctl/ioctl-number.rst b/Documentation/userspace-api/ioctl/ioctl-number.rst index 4ea5b837399a..71e6d2

[PATCH v3 07/15] Drivers: hv: Move hv_call_deposit_pages and hv_call_create_vp to common code

2023-09-22 Thread Nuno Das Neves
These hypercalls are not arch-specific. Move them to common code. Signed-off-by: Nuno Das Neves Acked-by: Wei Liu --- arch/x86/hyperv/hv_proc.c | 152 arch/x86/include/asm/mshyperv.h | 1 - drivers/hv/hv_common.c | 147 ++

[PATCH v3 10/15] x86: hyperv: Add mshv_handler irq handler and setup function

2023-09-22 Thread Nuno Das Neves
This will handle SYNIC interrupts such as intercepts, doorbells, and scheduling messages intended for the mshv driver. Signed-off-by: Nuno Das Neves Reviewed-by: Wei Liu Reviewed-by: Tianyu Lan --- arch/x86/kernel/cpu/mshyperv.c | 9 + drivers/hv/hv_common.c | 5 + include/

[PATCH v3 08/15] Drivers: hv: Introduce per-cpu event ring tail

2023-09-22 Thread Nuno Das Neves
Add a pointer hv_synic_eventring_tail to track the tail pointer for the SynIC event ring buffer for each SINT. This will be used by the mshv driver, but must be tracked independently since the driver module could be removed and re-inserted. Signed-off-by: Nuno Das Neves Reviewed-by: Wei Liu ---

[PATCH v3 11/15] Drivers: hv: export vmbus_isr, hv_context and hv_post_message

2023-09-22 Thread Nuno Das Neves
These will be used by the mshv_vtl driver. Signed-off-by: Nuno Das Neves Acked-by: Wei Liu --- drivers/hv/hv.c | 2 ++ drivers/hv/hyperv_vmbus.h | 1 + drivers/hv/vmbus_drv.c| 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c in

[PATCH v3 14/15] asm-generic: hyperv: Use new Hyper-V headers conditionally.

2023-09-22 Thread Nuno Das Neves
Add asm-generic/hyperv-defs.h. It includes hyperv-tlfs.h or hvhdk.h depending on compile-time constant HV_HYPERV_DEFS which will be defined in the mshv driver. This is needed to keep unstable Hyper-V interfaces independent of hyperv-tlfs.h. This ensures hvhdk.h replaces hyperv-tlfs.h in the mshv d

[PATCH v3 06/15] hyperv-tlfs: Introduce hv_status_to_string and hv_status_to_errno

2023-09-22 Thread Nuno Das Neves
hv_status_to_errno translates hyperv statuses to linux error codes. This is useful for returning something linux-friendly from a hypercall helper function. hv_status_to_string improves clarity of error messages. Signed-off-by: Nuno Das Neves Acked-by: Wei Liu --- arch/x86/hyperv/hv_init.c

[PATCH v3 01/15] hyperv-tlfs: Change shared HV_REGISTER_* defines to HV_MSR_*

2023-09-22 Thread Nuno Das Neves
In x86 hyperv-tlfs, HV_REGISTER_ prefix is used to indicate MSRs accessed via rdmsrl/wrmsrl. But in ARM64, HV_REGISTER_ instead indicates VP registers accessed via get/set vp registers hypercall. This is due to HV_REGISTER_* names being used by hv_set/get_register, with the arch-specific version d

[PATCH v3 04/15] asm-generic/mshyperv: Introduce hv_recommend_using_aeoi()

2023-09-22 Thread Nuno Das Neves
Factor out logic for determining if we should set the auto eoi flag in SINT register. Signed-off-by: Nuno Das Neves Reviewed-by: Wei Liu --- drivers/hv/hv.c| 12 +--- include/asm-generic/mshyperv.h | 13 + 2 files changed, 14 insertions(+), 11 deletions(-) d

[PATCH v3 00/15] Introduce /dev/mshv drivers

2023-09-22 Thread Nuno Das Neves
This series introduces support for creating and running guest machines while running on the Microsoft Hypervisor. [0] This is done via an IOCTL interface accessed through /dev/mshv, similar to /dev/kvm. Another series introducing this support was previously posted. [1] These interfaces support VMM

[PATCH v3 02/15] mshyperv: Introduce hv_get_hypervisor_version function

2023-09-22 Thread Nuno Das Neves
x86_64 and arm64 implementations to get the hypervisor version information. Store these in hv_hypervisor_version_info structure to simplify parsing the fields. Replace the existing parsing when printing the version numbers at boot. Signed-off-by: Nuno Das Neves --- arch/arm64/hyperv/mshyperv.c