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

2023-09-29 Thread Greg KH
On Fri, Sep 29, 2023 at 11:01:41AM -0700, Nuno Das Neves wrote: > --- /dev/null > +++ b/include/uapi/linux/mshv.h > @@ -0,0 +1,306 @@ > +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ Much better. > +#ifndef _UAPI_LINUX_MSHV_H > +#define _UAPI_LINUX_MSHV_H > + > +/* > + * Userspac

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

2023-09-29 Thread Greg KH
On Fri, Sep 29, 2023 at 11:01:39AM -0700, Nuno Das Neves wrote: > 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.h 25294 > hvgdk.h 25125 > hvgdk_mini.h 25294 what are version numb

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

2023-09-29 Thread kernel test robot
Hi Nuno, kernel test robot noticed the following build warnings: [auto build test WARNING on arnd-asm-generic/master] [also build test WARNING on arm64/for-next/core linus/master v6.6-rc3 next-20230929] [cannot apply to tip/x86/core] [If your patch is applied to the wrong git tree, kindly drop

[PATCH] hyperv: rndis_filter needs to select NLS

2023-09-29 Thread Randy Dunlap
rndis_filter uses utf8s_to_utf16s() which is provided by setting NLS, so select NLS to fix the build error: ERROR: modpost: "utf8s_to_utf16s" [drivers/net/hyperv/hv_netvsc.ko] undefined! Fixes: 1ce09e899d28 ("hyperv: Add support for setting MAC from within guests") Signed-off-by: Randy Dunlap Cc

Re: [PATCH 3/5] x86/mm: Mark CoCo VM pages not present while changing encrypted state

2023-09-29 Thread kernel test robot
Hi Michael, kernel test robot noticed the following build errors: [auto build test ERROR on tip/master] [also build test ERROR on tip/auto-latest linus/master v6.6-rc3 next-20230929] [cannot apply to tip/x86/mm tip/x86/core] [If your patch is applied to the wrong git tree, kindly drop us a note

[PATCH net,v2, 3/3] net: mana: Fix oversized sge0 for GSO packets

2023-09-29 Thread Haiyang Zhang
Handle the case when GSO SKB linear length is too large. MANA NIC requires GSO packets to put only the header part to SGE0, otherwise the TX queue may stop at the HW level. So, use 2 SGEs for the skb linear part which contains more than the packet header. Fixes: ca9c54d2d6a5 ("net: mana: Add a d

[PATCH net,v2, 2/3] net: mana: Fix the tso_bytes calculation

2023-09-29 Thread Haiyang Zhang
sizeof(struct hop_jumbo_hdr) is not part of tso_bytes, so remove the subtraction from header size. Cc: sta...@vger.kernel.org Fixes: bd7fc6e1957c ("net: mana: Add new MANA VF performance counters for easier troubleshooting") Signed-off-by: Haiyang Zhang Reviewed-by: Simon Horman --- drivers/ne

[PATCH net,v2, 1/3] net: mana: Fix TX CQE error handling

2023-09-29 Thread Haiyang Zhang
For an unknown TX CQE error type (probably from a newer hardware), still free the SKB, update the queue tail, etc., otherwise the accounting will be wrong. Also, TX errors can be triggered by injecting corrupted packets, so replace the WARN_ONCE to ratelimited error logging. Cc: sta...@vger.kerne

[PATCH net,v2, 0/3] net: mana: Fix some TX processing bugs

2023-09-29 Thread Haiyang Zhang
Fix TX processing bugs on error handling, tso_bytes calculation, and sge0 size. Haiyang Zhang (3): net: mana: Fix TX CQE error handling net: mana: Fix the tso_bytes calculation net: mana: Fix oversized sge0 for GSO packets drivers/net/ethernet/microsoft/mana/mana_en.c | 211 ---

[PATCH 3/5] x86/mm: Mark CoCo VM pages not present while changing encrypted state

2023-09-29 Thread Michael Kelley
In a CoCo VM when a page transitions from encrypted to decrypted, or vice versa, attributes in the PTE must be updated *and* the hypervisor must be notified of the change. Because there are two separate steps, there's a window where the settings are inconsistent. Normally the code that initiates t

[PATCH 4/5] x86/mm: Remove unnecessary call layer for __set_memory_enc_pgtable()

2023-09-29 Thread Michael Kelley
__set_memory_enc_pgtable() is only called from __set_memory_enc_dec() after doing a simple validation check. Prior to commit 812b0597fb40, __set_memory_enc_dec() did more complex checking, but now the code can be simplified by collapsing the two functions. No functional change. Signed-off-by: Mic

[PATCH 5/5] x86/mm: Add comments about errors in set_memory_decrypted()/encrypted()

2023-09-29 Thread Michael Kelley
The functions set_memory_decrypted()/encrypted() may leave the input memory range in an inconsistent state if an error occurs. Add comments describing the situation and what callers must be aware of. Also add comments in __set_memory_enc_dec() with more details on the issues and why further inves

[PATCH 2/5] x86/mm: Don't do a TLB flush if changing a PTE that isn't marked present

2023-09-29 Thread Michael Kelley
The core function __change_page_attr() currently sets up a TLB flush if a PTE is changed. But if the old value of the PTE doesn't include the PRESENT flag, the PTE won't be in the TLB, so a flush isn't needed. Avoid an unnecessary TLB flush by conditioning the flush on the old PTE value including

[PATCH 1/5] x86/coco: Use slow_virt_to_phys() in page transition hypervisor callbacks

2023-09-29 Thread Michael Kelley
In preparation for temporarily marking pages not present during a transition between encrypted and decrypted, use slow_virt_to_phys() in the hypervisor callbacks. As long as the PFN is correct, slow_virt_to_phys() works even if the leaf PTE is not present. The existing functions that depends on vma

[PATCH 0/5] x86/coco: Mark CoCo VM pages not present when changing encrypted state

2023-09-29 Thread Michael Kelley
In a CoCo VM when a page transitions from encrypted to decrypted, or vice versa, attributes in the PTE must be updated *and* the hypervisor must be notified of the change. Because there are two separate steps, there's a window where the settings are inconsistent. Normally the code that initiates t

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

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

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

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

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

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

[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(-) d

[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 00/15] Introduce /dev/mshv drivers

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

RE: [PATCH net, 3/3] net: mana: Fix oversized sge0 for GSO packets

2023-09-29 Thread Haiyang Zhang
> -Original Message- > From: Simon Horman > Sent: Friday, September 29, 2023 4:57 AM > To: Haiyang Zhang > Cc: linux-hyperv@vger.kernel.org; net...@vger.kernel.org; Dexuan Cui > ; KY Srinivasan ; Paul Rosswurm > ; o...@aepfle.de; vkuznets ; > da...@davemloft.net; wei@kernel.org; ed

RE: [PATCH net, 1/3] net: mana: Fix TX CQE error handling

2023-09-29 Thread Haiyang Zhang
> -Original Message- > From: Simon Horman > Sent: Friday, September 29, 2023 1:51 AM > To: Haiyang Zhang > Cc: linux-hyperv@vger.kernel.org; net...@vger.kernel.org; Dexuan Cui > ; KY Srinivasan ; Paul Rosswurm > ; o...@aepfle.de; vkuznets > ; da...@davemloft.net; wei@kernel.org; >

Re: [PATCH net, 3/3] net: mana: Fix oversized sge0 for GSO packets

2023-09-29 Thread Simon Horman
On Sat, Sep 23, 2023 at 06:31:47PM -0700, Haiyang Zhang wrote: > Handle the case when GSO SKB linear length is too large. > > MANA NIC requires GSO packets to put only the header part to SGE0, > otherwise the TX queue may stop at the HW level. > > So, use 2 SGEs for the skb linear part which cont