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

2023-09-22 Thread Nuno Das Neves
for clarity Changes since v1: * Clean up formatting, capitalization in commit messages * Add detail to commit message for patch 15 * Remove errant lines in Makefile and Kconfig in patch 15 * Move a reference to CONFIG_MSHV_VTL from patch 9 to 15 Nuno Das Neves (15): hyperv

[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

[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

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

2023-09-22 Thread Nuno Das Neves
can be reserved for VP registers. 2. Change the non-arch-specific alias used by hv_set/get_register to HV_MSR_. This is also happens to be the same name HyperV uses for this purpose. Signed-off-by: Nuno Das Neves --- arch/arm64/include/asm/hyperv-tlfs.h | 25 + arch/x86/include/asm

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

2023-09-22 Thread Nuno Das Neves
driver, even via indirect includes. Signed-off-by: Nuno Das Neves Acked-by: Wei Liu --- arch/arm64/include/asm/mshyperv.h | 2 +- arch/x86/include/asm/mshyperv.h | 3 +-- drivers/hv/hyperv_vmbus.h | 1 - include/asm-generic/hyperv-defs.h | 26 ++ include/asm

[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 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

[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 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

[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

[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 13/15] uapi: hyperv: Add mshv driver headers defining hypervisor ABIs

2023-09-22 Thread Nuno Das Neves
in hyperv-tlfs.h. Signed-off-by: Nuno Das Neves Acked-by: Wei Liu --- include/uapi/hyperv/hvgdk.h | 41 + include/uapi/hyperv/hvgdk_mini.h | 1076 include/uapi/hyperv/hvhdk.h | 1342 ++ include/uapi/hyperv/hvhdk_mini.h | 160

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

2023-09-25 Thread Nuno Das Neves
Resend in plain text instead of HTML - oops! On 9/23/2023 12:58 AM, Greg KH wrote: On Fri, Sep 22, 2023 at 11:38:35AM -0700, Nuno Das Neves wrote: +static int mshv_vtl_get_vsm_regs(void) +{ + struct hv_register_assoc registers[2]; + union hv_input_vtl input_vtl; + int ret

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

2023-09-26 Thread Nuno Das Neves
:07:24PM -0700, Nuno Das Neves wrote: On 9/23/2023 12:58 AM, Greg KH wrote: Also, drivers should never call pr_*() calls, always use the proper dev_*() calls instead. We only use struct device in one place in this driver, I think that is the only place it makes sense to use dev_*() over pr_

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

2023-09-27 Thread Nuno Das Neves
On 9/27/2023 1:33 AM, Greg KH wrote: On Wed, Sep 27, 2023 at 08:04:42AM +, Wei Liu wrote: So, the driver is supposed to stash a pointer to struct device in private_data. That's what I alluded to in my previous reply. The core driver framework or the VFS doesn't give us a reference to struct

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

2023-09-29 Thread Nuno Das Neves
n to struct for clarity Changes since v1: * Clean up formatting, capitalization in commit messages * Add detail to commit message for patch 15 * Remove errant lines in Makefile and Kconfig in patch 15 * Move a reference to CONFIG_MSHV_VTL from patch 9 to 15 Nuno Das Neves (15

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

2023-09-29 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 v4 03/15] mshyperv: Introduce numa_node_to_proximity_domain_info

2023-09-29 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 v4 08/15] Drivers: hv: Introduce per-cpu event ring tail

2023-09-29 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 v4 11/15] Drivers: hv: export vmbus_isr, hv_context and hv_post_message

2023-09-29 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

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

2023-09-29 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

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

2023-09-29 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 v4 01/15] hyperv-tlfs: Change shared HV_REGISTER_* defines to HV_MSR_*

2023-09-29 Thread Nuno Das Neves
can be reserved for VP registers. 2. Change the non-arch-specific alias used by hv_set/get_register to HV_MSR_. This is also happens to be the same name Hyper-V uses for this purpose. Signed-off-by: Nuno Das Neves Reviewed-by: Wei Liu --- arch/arm64/include/asm/hyperv-tlfs.h | 25

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

2023-09-29 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 v4 14/15] asm-generic: hyperv: Use new Hyper-V headers conditionally.

2023-09-29 Thread Nuno Das Neves
driver, even via indirect includes. Signed-off-by: Nuno Das Neves Acked-by: Wei Liu --- arch/arm64/include/asm/mshyperv.h | 2 +- arch/x86/include/asm/mshyperv.h | 3 +-- drivers/hv/hyperv_vmbus.h | 1 - include/asm-generic/hyperv-defs.h | 26 ++ include/asm

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

2023-09-29 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 Acked-by: Wei Liu --- arch

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

2023-09-29 Thread Nuno Das Neves
Signed-off-by: Nuno Das Neves Acked-by: Jonathan Corbet Acked-by: Wei Liu --- 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

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

2023-09-29 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

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

2023-09-29 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 v4 13/15] uapi: hyperv: Add mshv driver headers defining hypervisor ABIs

2023-09-29 Thread Nuno Das Neves
in hyperv-tlfs.h. Signed-off-by: Nuno Das Neves Acked-by: Wei Liu --- include/uapi/hyperv/hvgdk.h | 41 + include/uapi/hyperv/hvgdk_mini.h | 1076 include/uapi/hyperv/hvhdk.h | 1342 ++ include/uapi/hyperv/hvhdk_mini.h | 160

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

2023-10-02 Thread Nuno Das Neves
ly duplicate, but also MODIFY some structures in hyperv-tlfs.h. e.g., The struct is in hyperv-tlfs.h, but a particular field or bitfield is not. Thanks, Nuno Thank you for your consideration. Best regards, Alex Ionescu On Fri, Sep 29, 2023 at 2:02 PM Nuno Das Neves wrote: Add asm-generic/h

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

2023-10-03 Thread Nuno Das Neves
On 9/30/2023 11:19 PM, Greg KH wrote: On Sat, Sep 30, 2023 at 10:01:58PM +, Wei Liu wrote: On Sat, Sep 30, 2023 at 08:09:19AM +0200, Greg KH wrote: On Fri, Sep 29, 2023 at 11:01:39AM -0700, Nuno Das Neves wrote: +/* Define connection identifier type. */ +union hv_connection_id

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

2023-10-04 Thread Nuno Das Neves
On 10/4/2023 10:50 AM, Greg KH wrote: On Wed, Oct 04, 2023 at 05:36:32PM +, Dexuan Cui wrote: From: Greg KH Sent: Tuesday, October 3, 2023 11:10 PM [...] On Tue, Oct 03, 2023 at 04:37:01PM -0700, Nuno Das Neves wrote: On 9/30/2023 11:19 PM, Greg KH wrote: On Sat, Sep 30, 2023 at 10:01

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

2023-10-04 Thread Nuno Das Neves
hat do you think? Thanks, Nuno Best regards, Alex Ionescu On Fri, Sep 29, 2023 at 2:02 PM Nuno Das Neves wrote: 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_com

Re: [PATCH v2 13/15] uapi: hyperv: Add mshv driver headers hvhdk.h, hvhdk_mini.h, hvgdk.h, hvgdk_mini.h

2023-10-10 Thread Nuno Das Neves
On 8/25/2023 11:24 AM, Nuno Das Neves wrote: On 8/19/2023 3:26 AM, Greg KH wrote: My "strong" opinion is the one kernel development rule that we have, "you can not break userspace". So, if you change these values/structures/whatever in the future, and userspace tools brea

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

2023-10-11 Thread Nuno Das Neves
On 10/5/2023 12:52 PM, Alex Ionescu wrote: 3) Truly making hypertv-tlfs the "documented" header, and then > removing any duplication from HDK so that it remains the "undocumented" header file. In this manner, one would include hyperv-tlfs to use the stable ABI, and they would include HDK (which

Re: [PATCH v2 13/15] uapi: hyperv: Add mshv driver headers hvhdk.h, hvhdk_mini.h, hvgdk.h, hvgdk_mini.h

2023-10-11 Thread Nuno Das Neves
On 10/10/2023 11:42 PM, Greg KH wrote: On Tue, Oct 10, 2023 at 03:49:48PM -0700, Nuno Das Neves wrote: On 8/25/2023 11:24 AM, Nuno Das Neves wrote: On 8/19/2023 3:26 AM, Greg KH wrote: My "strong" opinion is the one kernel development rule that we have, "you can not break user

Re: Incorrect definition of hv_enable_vp_vtl in hyperv-tlfs.h

2023-10-19 Thread Nuno Das Neves
On 10/16/2023 4:49 AM, Alex Ionescu wrote: Hi, In arch/x86/include/asm/hyperv-tlfs.h, the following definition at line 786 (in Linus' tree), I believe to be incorrect. struct hv_enable_vp_vtl { u64partition_id; u32vp_index; union hv_input_vtl

[PATCH] hyperv-tlfs: Change prefix of generic HV_REGISTER_* MSRs to HV_MSR_*

2024-02-08 Thread Nuno Das Neves
(), hv_get/set_nested_msr(), etc. These are only used for Hyper-V MSRs and this naming makes that clear. Signed-off-by: Nuno Das Neves Reviewed-by: Wei Liu --- arch/arm64/include/asm/hyperv-tlfs.h | 45 - arch/arm64/include/asm/mshyperv.h| 4 +- arch/x86/hyperv/hv_init.c| 8 +-

Re: [PATCH] hyperv-tlfs: Change prefix of generic HV_REGISTER_* MSRs to HV_MSR_*

2024-02-18 Thread Nuno Das Neves
On 2/10/2024 2:37 AM, Michael Kelley wrote: > > Overall, this looks good to me. It cleans up the mess I made five > years ago when first separating x86 from ARM64. :-( > > See one comment below, but otherwise, > > Reviewed-by: Michael Kelley > Thanks! Responded to your comment below. >> #i

[PATCH v2] hyperv-tlfs: Change prefix of generic HV_REGISTER_* MSRs to HV_MSR_*

2024-02-20 Thread Nuno Das Neves
(), hv_get/set_nested_msr(), etc. These are only used for Hyper-V MSRs and this naming makes that clear. Signed-off-by: Nuno Das Neves Reviewed-by: Wei Liu Reviewed-by: Michael Kelley --- Changes in v2: * Use HV_X64_MSR_ instead of HV_MSR_ in arch/x86/kernel/cpu/mshyperv.c --- arch/arm64/include/asm/hyp

[PATCH] mshyperv: Introduce hv_get_hypervisor_version function

2024-03-06 Thread Nuno Das Neves
code to hv_common_init() so it is not duplicated. Signed-off-by: Nuno Das Neves Acked-by: Wei Liu --- arch/arm64/hyperv/mshyperv.c | 19 - arch/x86/kernel/cpu/mshyperv.c| 35 ++- drivers/hv/hv_common.c| 9 include/asm

Re: [PATCH] mshyperv: Introduce hv_get_hypervisor_version function

2024-03-07 Thread Nuno Das Neves
On 3/7/2024 11:22 AM, Michael Kelley wrote: > From: Nuno Das Neves Sent: Wednesday, > March 6, 2024 4:48 PM >> >> Introduce x86_64 and arm64 functions for getting the hypervisor version >> information and storing it in a structure for simpler parsing. >> >> U

[PATCH v2] mshyperv: Introduce hv_get_hypervisor_version function

2024-03-07 Thread Nuno Das Neves
Introduce x86_64 and arm64 functions to get the hypervisor version information and store it in a structure for simpler parsing. Use the new function to get and parse the version at boot time. While at it, move the printing code to hv_common_init() so it is not duplicated. Signed-off-by: Nuno Das

Re: [PATCH v2] mshyperv: Introduce hv_get_hypervisor_version function

2024-03-11 Thread Nuno Das Neves
On 3/7/2024 3:03 PM, Nuno Das Neves wrote: > Introduce x86_64 and arm64 functions to get the hypervisor version > information and store it in a structure for simpler parsing. > > Use the new function to get and parse the version at boot time. While at > it, move the p

[PATCH] hyperv-tlfs: Rename some HV_REGISTER_* defines for consistency

2024-03-12 Thread Nuno Das Neves
document more accurately, i.e. HvRegisterGuestCrash*. Signed-off-by: Nuno Das Neves --- arch/arm64/hyperv/hv_core.c | 14 +++--- arch/arm64/hyperv/mshyperv.c | 2 +- arch/arm64/include/asm/hyperv-tlfs.h | 12 ++-- arch/x86/kernel/cpu/mshyperv.c | 2

Re: [PATCH v3 1/1] x86/hyperv: Use Hyper-V entropy to seed guest random number generator

2024-03-18 Thread Nuno Das Neves
On 3/18/2024 8:54 AM, mhkelle...@gmail.com wrote: > From: Michael Kelley > > A Hyper-V host provides its guest VMs with entropy in a custom ACPI > table named "OEM0". The entropy bits are updated each time Hyper-V > boots the VM, and are suitable for seeding the Linux guest random > number gener

[PATCH v3] mshyperv: Introduce hv_numa_node_to_pxm_info()

2024-03-22 Thread Nuno Das Neves
not present in the ABI. Signed-off-by: Nuno Das Neves Reviewed-by: Wei Liu --- Changes in v3: * Shorten function name to hv_numa_node_to_pxm_info() * Correct hv_add_logical_processor_* naming, and remove flags Changes in v2: * Change hv_proximity_domain_info from union to struct to improve

Re: [PATCH] Drivers: hv: vmbus: Deferring per cpu tasks

2024-07-25 Thread Nuno Das Neves
urabh Sengar > --- > drivers/hv/vmbus_drv.c | 33 ++--- > 1 file changed, 30 insertions(+), 3 deletions(-) > LGTM otherwise. Reviewed-by: Nuno Das Neves

Re: [PATCH 5/5] hyperv: Use hvhdk.h instead of hyperv-tlfs.h in Hyper-V code

2024-10-04 Thread Nuno Das Neves
On 10/4/2024 8:58 AM, Stanislav Kinsburskii wrote: > Hi Nuno, > > On Thu, Oct 03, 2024 at 12:51:04PM -0700, Nuno Das Neves wrote: >> diff --git a/arch/arm64/hyperv/hv_core.c b/arch/arm64/hyperv/hv_core.c >> index 9d1969b875e9..bb7f28f74bf4 100644 >> --- a/arch/arm64/hyp

Re: [PATCH 5/5] hyperv: Use hvhdk.h instead of hyperv-tlfs.h in Hyper-V code

2024-10-04 Thread Nuno Das Neves
On 10/4/2024 12:11 PM, Simon Horman wrote: > Hi, > > With this change in place I see allmodconfig x86_64 builds reporting that > HV_REGISTER_FEATURES is undeclared. > > arch/arm64/hyperv/mshyperv.c: In function 'hyperv_init': > arch/arm64/hyperv/mshyperv.c:53:26: error: 'HV_REGISTER_FEATURES' und

[PATCH 4/5] hyperv: Add hv_defs.h to conditionally include hyperv-tlfs.h or hvhdk.h

2024-10-03 Thread Nuno Das Neves
between Hyper-V code and non-Hyper-V code (KVM for example). This will allow switching to the new headers in Hyper-V code only. Signed-off-by: Nuno Das Neves --- arch/arm64/include/asm/mshyperv.h | 2 +- arch/x86/include/asm/mshyperv.h| 2 +- arch/x86/include/asm/svm.h | 2

[PATCH 1/5] hyperv: Move hv_connection_id to hyperv-tlfs.h

2024-10-03 Thread Nuno Das Neves
This definition is in the wrong file; it is part of the TLFS doc. Signed-off-by: Nuno Das Neves --- include/asm-generic/hyperv-tlfs.h | 9 + include/linux/hyperv.h| 9 - 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/asm-generic/hyperv-tlfs.h

[PATCH 0/5] Add new headers for Hyper-V Dom0

2024-10-03 Thread Nuno Das Neves
ew headers (hvhdk.h, etc..) in include/hyperv/ Patch 4: Add hv_defs.h and use it in mshyperv.h, svm.h, hyperv_timer.h Patch 5: Switch to the new headers, only in Hyper-V code Nuno Das Neves (5): hyperv: Move hv_connection_id to hyperv-tlfs.h hyperv: Remove unnecessary #includes hyper

[PATCH 2/5] hyperv: Remove unnecessary #includes

2024-10-03 Thread Nuno Das Neves
asm/hyperv-tlfs.h is already included implicitly wherever mshyperv.h or linux/hyperv.h is included. Remove those redundancies. Remove includes of linux/hyperv.h and mshyperv.h where they are not needed. Signed-off-by: Nuno Das Neves --- arch/arm64/hyperv/hv_core.c| 2 -- arch/x86

[PATCH 3/5] hyperv: Add new Hyper-V headers

2024-10-03 Thread Nuno Das Neves
Add definitions needed for privileged Hyper-V partitions. These files are derived from headers exported from the hypervisor code. This is a step toward importing headers directly, similar to Xen public files in include/xen/interface/. Signed-off-by: Nuno Das Neves --- include/hyperv/hvgdk.h

[PATCH 5/5] hyperv: Use hvhdk.h instead of hyperv-tlfs.h in Hyper-V code

2024-10-03 Thread Nuno Das Neves
. Replace hyperv-tlfs.h with hvhdk.h directly in linux/hyperv.h, and define HYPERV_NONTLFS_HEADERS there, since it is only used in Hyper-V device code. Update a couple of definitions to updated names found in the new headers: HV_EXT_MEM_HEAT_HINT, HV_SUBNODE_TYPE_ANY. Signed-off-by: Nuno Das Neves

Re: [EXTERNAL] RE: [PATCH 0/5] Add new headers for Hyper-V Dom0

2024-10-22 Thread Nuno Das Neves
Michael - sorry for the delay, I just got back from vacation. On 10/10/2024 6:34 PM, MUKESH RATHOR wrote: > > > On 10/10/24 11:21, Michael Kelley wrote: > > From: Nuno Das Neves Sent: > Thursday, October 3, 2024 12:51 PM > >> > >> To support Hyper-V Dom0

Re: [PATCH 0/5] Add new headers for Hyper-V Dom0

2024-10-22 Thread Nuno Das Neves
On 10/10/2024 11:21 AM, Michael Kelley wrote: > From: Nuno Das Neves Sent: Thursday, > October 3, 2024 12:51 PM >>>> An intermediary header "hv_defs.h" is introduced to conditionally >> include either hyperv-tlfs.h or hvhdk.h. This is required because >

Re: [PATCH 2/5] hyperv: Remove unnecessary #includes

2024-10-31 Thread Nuno Das Neves
On 10/10/2024 11:21 AM, Michael Kelley wrote: > From: Nuno Das Neves Sent: Thursday, > October 3, 2024 12:51 PM >> >> asm/hyperv-tlfs.h is already included implicitly wherever mshyperv.h >> or linux/hyperv.h is included. Remove those redundancies. > > I've b

Re: [PATCH v2 3/4] hyperv: Add new Hyper-V headers in include/hyperv

2024-11-11 Thread Nuno Das Neves
On 11/10/2024 8:13 PM, Michael Kelley wrote: > From: Nuno Das Neves Sent: Thursday, > November 7, 2024 2:32 PM >> >> These headers contain definitions for regular Hyper-V guests (as in >> hyperv-tlfs.h), as well as interfaces for more privileged guests like >> Dom0

Re: [PATCH v2 3/4] hyperv: Add new Hyper-V headers in include/hyperv

2024-11-11 Thread Nuno Das Neves
On 11/7/2024 9:59 PM, Naman Jain wrote: > > > On 11/8/2024 4:02 AM, Nuno Das Neves wrote: >> These headers contain definitions for regular Hyper-V guests (as in >> hyperv-tlfs.h), as well as interfaces for more privileged guests like >> Dom0. >> >> These

Re: [PATCH v2 0/4] Add new headers for Hyper-V Dom0

2024-11-11 Thread Nuno Das Neves
On 11/10/2024 8:12 PM, Michael Kelley wrote: > From: Nuno Das Neves Sent: Thursday, > November 7, 2024 2:32 PM >> >> To support Hyper-V Dom0 (aka Linux as root partition), many new >> definitions are required. > > Using "dom0" terminology here an

Re: [PATCH 0/5] Add new headers for Hyper-V Dom0

2024-10-31 Thread Nuno Das Neves
On 10/31/2024 12:05 PM, Easwar Hariharan wrote: > On 10/3/2024 12:50 PM, Nuno Das Neves wrote: >> To support Hyper-V Dom0 (aka Linux as root partition), many new >> definitions are required. >> >> The plan going forward is to directly import headers from >> Hyper-V

[PATCH v2 3/4] hyperv: Add new Hyper-V headers in include/hyperv

2024-11-07 Thread Nuno Das Neves
milar to Xen public files in include/xen/interface/. Signed-off-by: Nuno Das Neves --- include/hyperv/hvgdk.h | 303 include/hyperv/hvgdk_ext.h | 46 ++ include/hyperv/hvgdk_mini.h | 1295 +++ include/hyperv/hvhdk.h | 733

[PATCH v2 0/4] Add new headers for Hyper-V Dom0

2024-11-07 Thread Nuno Das Neves
functional change is expected. Summary: Patch 1-2: Minor cleanup patches Patch 3: Add the new headers (hvhdk.h, etc..) in include/hyperv/ Patch 4: Switch to the new headers Signed-off-by: Nuno Das Neves --- Changelog: v2: - Rework the series to simply use the new headers everywhere instead of

[PATCH v2 4/4] hyperv: Switch from hyperv-tlfs.h to hyperv/hvhdk.h

2024-11-07 Thread Nuno Das Neves
: Nuno Das Neves --- arch/arm64/hyperv/hv_core.c| 2 +- arch/arm64/hyperv/mshyperv.c | 4 ++-- arch/arm64/include/asm/mshyperv.h | 2 +- arch/x86/hyperv/hv_init.c | 20 ++-- arch/x86/hyperv/hv_proc.c | 2 +- arch/x86/hyperv/nested.c | 2

[PATCH v2 1/4] hyperv: Move hv_connection_id to hyperv-tlfs.h

2024-11-07 Thread Nuno Das Neves
This definition is in the wrong file; it is part of the TLFS doc. Acked-by: Wei Liu Signed-off-by: Nuno Das Neves --- include/asm-generic/hyperv-tlfs.h | 9 + include/linux/hyperv.h| 9 - 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/asm

[PATCH v2 2/4] hyperv: Clean up unnecessary #includes

2024-11-07 Thread Nuno Das Neves
Remove includes of linux/hyperv.h, mshyperv.h, and hyperv-tlfs.h where they are not used. Acked-by: Wei Liu Signed-off-by: Nuno Das Neves --- arch/arm64/hyperv/hv_core.c | 1 - arch/x86/hyperv/hv_apic.c | 1 - arch/x86/hyperv/hv_init.c | 1 - arch/x86/hyperv/hv_proc.c | 1

Re: [PATCH v2 4/4] hyperv: Switch from hyperv-tlfs.h to hyperv/hvhdk.h

2024-11-15 Thread Nuno Das Neves
On 11/10/2024 8:13 PM, Michael Kelley wrote: > From: Nuno Das Neves Sent: Thursday, > November 7, 2024 2:32 PM >> >> Switch to using hvhdk.h everywhere in the kernel. This header includes >> all the new Hyper-V headers in include/hyperv, which form a superset of >

Re: [PATCH v2 3/4] hyperv: Add new Hyper-V headers in include/hyperv

2024-11-13 Thread Nuno Das Neves
On 11/11/2024 11:31 AM, Michael Kelley wrote: > From: Nuno Das Neves Sent: Monday, > November 11, 2024 10:45 AM >> >> On 11/10/2024 8:13 PM, Michael Kelley wrote: >>> From: Nuno Das Neves Sent: Thursday, >> November 7, 2024 2:32 PM >>>> >>>&

Re: [PATCH v3 5/5] hyperv: Remove the now unused hyperv-tlfs.h files

2024-11-26 Thread Nuno Das Neves
On 11/25/2024 9:59 PM, Michael Kelley wrote: > From: Nuno Das Neves Sent: Monday, > November 25, 2024 3:25 PM >> >> Remove all hyperv-tlfs.h files. These are no longer included >> anywhere. hyperv/hvhdk.h serves the same role, but with an easier >> path for adding

[PATCH v3 2/5] hyperv: Clean up unnecessary #includes

2024-11-25 Thread Nuno Das Neves
Remove includes of linux/hyperv.h, mshyperv.h, and hyperv-tlfs.h where they are not used. Acked-by: Wei Liu Reviewed-by: Michael Kelley Reviewed-by: Easwar Hariharan Signed-off-by: Nuno Das Neves --- arch/arm64/hyperv/hv_core.c | 1 - arch/x86/hyperv/hv_apic.c | 1 - arch/x86

[PATCH v3 1/5] hyperv: Move hv_connection_id to hyperv-tlfs.h

2024-11-25 Thread Nuno Das Neves
This definition is in the wrong file; it is part of the TLFS doc. Acked-by: Wei Liu Reviewed-by: Easwar Hariharan Reviewed-by: Michael Kelley Signed-off-by: Nuno Das Neves --- include/asm-generic/hyperv-tlfs.h | 9 + include/linux/hyperv.h| 9 - 2 files changed, 9

[PATCH v3 0/5] Introduce new headers for Hyper-V

2024-11-25 Thread Nuno Das Neves
functional change is expected. Summary: Patch 1-2: Minor cleanup patches Patch 3: Add the new headers (hvhdk.h, etc..) in include/hyperv/ Patch 4: Switch to the new headers Patch 5: Delete hyperv-tlfs.h files Signed-off-by: Nuno Das Neves --- Changelog: v3: - Add patch (#5) to delete the hyperv

[PATCH v3 3/5] hyperv: Add new Hyper-V headers in include/hyperv

2024-11-25 Thread Nuno Das Neves
to their own files in arch/x86/ and arch/arm64/. These headers are a step toward importing headers directly from Hyper-V in the future, similar to Xen public files in include/xen/interface/. Signed-off-by: Nuno Das Neves --- MAINTAINERS |5 + include/hyperv/hvgdk.h | 3

[PATCH v3 5/5] hyperv: Remove the now unused hyperv-tlfs.h files

2024-11-25 Thread Nuno Das Neves
Remove all hyperv-tlfs.h files. These are no longer included anywhere. hyperv/hvhdk.h serves the same role, but with an easier path for adding new definitions. Remove the relevant lines in MAINTAINERS. Signed-off-by: Nuno Das Neves --- MAINTAINERS | 3 - arch/arm64

[PATCH v3 4/5] hyperv: Switch from hyperv-tlfs.h to hyperv/hvhdk.h

2024-11-25 Thread Nuno Das Neves
hyperv-tlfs.h). To be more consistent with the original Hyper-V code, the names of some definitions are changed slightly. Update those where needed. Update comments in mshyperv.h files to point to include/hyperv for adding new definitions. Signed-off-by: Nuno Das Neves --- arch/arm64/hyperv

Re: [PATCH 0/2] hyperv: Move some features to common code

2024-12-09 Thread Nuno Das Neves
On 12/7/2024 6:59 PM, Michael Kelley wrote: > From: Nuno Das Neves Sent: Friday, > December 6, 2024 2:22 PM >> >> There are several bits of Hyper-V-related code that today live in >> arch/x86 but are not really specific to x86_64 and will work on arm64 >> too. >

Re: [PATCH v3 1/5] hyperv: Move hv_connection_id to hyperv-tlfs.h

2024-12-09 Thread Nuno Das Neves
On 12/8/2024 4:07 PM, Wei Liu wrote: > On Mon, Nov 25, 2024 at 03:24:40PM -0800, Nuno Das Neves wrote: >> This definition is in the wrong file; it is part of the TLFS doc. >> >> Acked-by: Wei Liu >> Reviewed-by: Easwar Hariharan >> Reviewed-by: Michael Kelley

[PATCH v3 1/2] hyperv: Move hv_current_partition_id to arch-generic code

2025-02-07 Thread Nuno Das Neves
id to hv_output_get_partition_id, to make it distinct from the function hv_get_partition_id(), and match the original Hyper-V struct name. Remove the BUG()s. Failing to get the id need not crash the machine. Signed-off-by: Nuno Das Neves --- arch/arm64/hyperv/mshyperv.c| 3 +++ arch/x86/h

[PATCH v3 2/2] hyperv: Move arch/x86/hyperv/hv_proc.c to drivers/hv

2025-02-07 Thread Nuno Das Neves
These helpers are not specific to x86_64 and will be needed by common code. Remove some unnecessary #includes. Reviewed-by: Michael Kelley Signed-off-by: Nuno Das Neves --- arch/x86/hyperv/Makefile | 2 +- arch/x86/include/asm/mshyperv.h | 4 drivers/hv/Makefile

[PATCH v3 0/2] hyperv: Move some features to common code

2025-02-07 Thread Nuno Das Neves
. Signed-off-by: Nuno Das Neves --- Changes in v3: * Just use percpu input page for the hypercall [Michael Kelley] * Move the calls to hv_get_partition_id() back to arch code [Michael Kelley] * Rename struct hv_get_partition_id to hv_output_get_partition_id [Michael Kelley] Changes in v2: * Fix

[PATCH] hyperv: Add CONFIG_MSHV_ROOT to gate hv_root_partition checks

2025-02-11 Thread Nuno Das Neves
kinds in future), and hv_identify_partition_type() to it up early in Hyper-V initialization. Signed-off-by: Nuno Das Neves --- Depends on https://lore.kernel.org/linux-hyperv/1738955002-20821-3-git-send-email-nunodasne...@linux.microsoft.com/ arch/arm64/hyperv/mshyperv.c | 2 ++ arch/x86

Re: [PATCH 1/2] hyperv: Move hv_current_partition_id to arch-generic code

2024-12-10 Thread Nuno Das Neves
On 12/7/2024 7:01 PM, Michael Kelley wrote: > From: Nuno Das Neves Sent: Friday, > December 6, 2024 2:22 PM >> >> Make hv_current_partition_id available in both x86_64 and arm64. >> This feature isn't specific to x86_64 and will be needed by common >> code. &g

Re: [PATCH 1/2] hyperv: Fix pointer type for the output of the hypercall in get_vtl(void)

2024-12-19 Thread Nuno Das Neves
On 12/18/2024 12:54 PM, Roman Kisel wrote: > Commit bc905fa8b633 ("hyperv: Switch from hyperv-tlfs.h to hyperv/hvhdk.h") > changed the type of the output pointer to `struct hv_register_assoc` from > `struct hv_get_vp_registers_output`. That leads to an incorrect computation, > and leaves the system

Re: [PATCH 1/2] hyperv: Fix pointer type for the output of the hypercall in get_vtl(void)

2024-12-19 Thread Nuno Das Neves
On 12/19/2024 11:13 AM, Easwar Hariharan wrote: > On 12/19/2024 10:40 AM, Nuno Das Neves wrote: >> On 12/18/2024 12:54 PM, Roman Kisel wrote: >>> Commit bc905fa8b633 ("hyperv: Switch from hyperv-tlfs.h to hyperv/hvhdk.h") >>> changed the type of the output

[PATCH 2/2] hyperv: Move create_vp and deposit_pages hvcalls to hv_common.c

2024-12-06 Thread Nuno Das Neves
From: Nuno Das Neves These are not specific to x86_64 and will be needed by common code. Signed-off-by: Nuno Das Neves --- arch/x86/hyperv/hv_proc.c | 144 --- arch/x86/include/asm/mshyperv.h | 2 - drivers/hv/hv_common.c | 145

[PATCH 1/2] hyperv: Move hv_current_partition_id to arch-generic code

2024-12-06 Thread Nuno Das Neves
From: Nuno Das Neves Make hv_current_partition_id available in both x86_64 and arm64. This feature isn't specific to x86_64 and will be needed by common code. While at it, replace the BUG()s with WARN()s. Failing to get the id need not crash the machine (although it is a very bad sign). S

[PATCH 0/2] hyperv: Move some features to common code

2024-12-06 Thread Nuno Das Neves
. Signed-off-by: Nuno Das Neves Nuno Das Neves (2): hyperv: Move hv_current_partition_id to arch-generic code hyperv: Move create_vp and deposit_pages hvcalls to hv_common.c arch/arm64/hyperv/mshyperv.c| 3 + arch/x86/hyperv/hv_init.c | 25 + arch/x86/hyperv/hv_proc.c

Re: [PATCH v5 2/5] hyperv: Fix pointer type in get_vtl(void)

2025-01-08 Thread Nuno Das Neves
_init get_vtl(void) > > ret = hv_do_hypercall(control, input, output); > if (hv_result_success(ret)) { > - ret = output->value.reg8 & HV_X64_VTL_MASK; > + ret = output->values[0].reg8 & HV_X64_VTL_MASK; > } else { > pr_err("Failed to get VTL(error: %lld) exiting...\n", ret); > BUG(); Reviewed-by: Nuno Das Neves

Re: [PATCH v5 1/5] hyperv: Define struct hv_output_get_vp_registers

2025-01-08 Thread Nuno Das Neves
On 1/6/2025 9:37 AM, Michael Kelley wrote: > From: Roman Kisel Sent: Monday, December 30, > 2024 10:10 AM >> >> There is no definition of the output structure for the >> GetVpRegisters hypercall. Hence, using the hypercall >> is not possible when the output value has some structure >> to it. Even

Re: [PATCH 1/2] hyperv: Move hv_current_partition_id to arch-generic code

2025-01-22 Thread Nuno Das Neves
On 12/6/2024 11:36 PM, Wei Liu wrote: > On Fri, Dec 06, 2024 at 02:21:46PM -0800, Nuno Das Neves wrote: >> From: Nuno Das Neves >> >> Make hv_current_partition_id available in both x86_64 and arm64. >> This feature isn't specific to x86_64 and will be needed by c

Re: [PATCH 0/2] hyperv: Move some features to common code

2025-01-22 Thread Nuno Das Neves
On 12/17/2024 9:48 AM, Michael Kelley wrote: > From: Nuno Das Neves Sent: Monday, > December 9, 2024 12:20 PM >> >> On 12/7/2024 6:59 PM, Michael Kelley wrote: >>> From: Nuno Das Neves Sent: Friday, >>> December 6, 2024 2:22 PM >>>> >>

[PATCH v2 2/2] hyperv: Move arch/x86/hyperv/hv_proc.c to drivers/hv

2025-01-22 Thread Nuno Das Neves
These helpers are not specific to x86_64 and will be needed by common code. Remove some unnecessary #includes. Signed-off-by: Nuno Das Neves --- arch/x86/hyperv/Makefile | 2 +- arch/x86/include/asm/mshyperv.h | 4 drivers/hv/Makefile | 2

[PATCH v2 0/2] hyperv: Move some features to common code

2025-01-22 Thread Nuno Das Neves
. Signed-off-by: Nuno Das Neves --- Changes in v2: * Fix dependence on percpu output page by using a stack variable for the hypercall output [Michael Kelley] * Remove unnecessary WARN()s [Michael Kelley] * Define hv_current_partition_id in hv_common.c [Michael Kelley] * Move entire hv_proc.c to

[PATCH v2 1/2] hyperv: Move hv_current_partition_id to arch-generic code

2025-01-22 Thread Nuno Das Neves
From: Nuno Das Neves Move hv_current_partition_id and hv_get_partition_id() to hv_common.c. These aren't specific to x86_64 and will be needed by common code. Set hv_current_partition_id to HV_PARTITION_ID_SELF by default. Use a stack variable for the output of the hypercall. This a

  1   2   >