[PW_SID:1084702] Add arm64 support in MSHV_VTL#1807
Conversation
mshv_vtl_main.c calls smp_send_reschedule() which expands to arch_smp_send_reschedule(). When CONFIG_MSHV_VTL=m, the module cannot access this symbol since it is not exported on arm64. smp_send_reschedule() is used in mshv_vtl_cancel() to interrupt a vCPU thread running on another CPU. When a vCPU is looping in mshv_vtl_ioctl_return_to_lower_vtl(), it checks a per-CPU cancel flag before each VTL0 entry. Setting cancel=1 alone is not enough if the target CPU thread is sleeping - the IPI from smp_send_reschedule() kicks the remote CPU out of idle/sleep so it re-checks the cancel flag and exits the loop promptly. Other architectures (riscv, loongarch, powerpc) already export this symbol. Add the same EXPORT_SYMBOL_GPL for arm64. This is required for adding arm64 support in MSHV_VTL. Reviewed-by: Michael Kelley <mhklinux@outlook.com> Reviewed-by: Roman Kisel <vdso@mailbox.org> Signed-off-by: Naman Jain <namjain@linux.microsoft.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Move the logic to initialize and export hv_vp_assist_page from x86 architecture code to Hyper-V common code to allow it to be used for upcoming arm64 support in MSHV_VTL driver. Note: This change also improves error handling - if VP assist page allocation fails, hyperv_init() now returns early instead of continuing with partial initialization. Signed-off-by: Roman Kisel <romank@linux.microsoft.com> Reviewed-by: Roman Kisel <vdso@mailbox.org> Signed-off-by: Naman Jain <namjain@linux.microsoft.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Move the vmbus_handler global variable and hv_setup_vmbus_handler()/ hv_remove_vmbus_handler() from arch/x86 to drivers/hv/hv_common.c. hv_setup_vmbus_handler() is called unconditionally in vmbus_bus_init() and works for both x86 (sysvec handler) and arm64 (vmbus_percpu_isr). This eliminates the need for separate percpu vmbus handler setup functions and __weak stubs, that are needed for adding ARM64 support in MSHV_VTL driver where we need to set a custom per-cpu vmbus handler. Signed-off-by: Naman Jain <namjain@linux.microsoft.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Refactor MSHV_VTL driver to move some of the x86 specific code to arch specific files, and add corresponding functions for arm64. Signed-off-by: Roman Kisel <romank@linux.microsoft.com> Reviewed-by: Roman Kisel <vdso@mailbox.org> Signed-off-by: Naman Jain <namjain@linux.microsoft.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
vmbus_interrupt is used in mshv_vtl_main.c to set the SINT vector. When CONFIG_MSHV_VTL=m and CONFIG_HYPERV_VMBUS=y (built-in), the module cannot access vmbus_interrupt at load time since it is not exported. Export it using EXPORT_SYMBOL_FOR_MODULES consistent with the existing pattern used for vmbus_isr. Reviewed-by: Michael Kelley <mhklinux@outlook.com> Reviewed-by: Roman Kisel <vdso@mailbox.org> Signed-off-by: Naman Jain <namjain@linux.microsoft.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Generalize Synthetic interrupt source vector (sint) to use vmbus_interrupt variable instead, which automatically takes care of architectures where HYPERVISOR_CALLBACK_VECTOR is not present (arm64). Signed-off-by: Roman Kisel <romank@linux.microsoft.com> Reviewed-by: Michael Kelley <mhklinux@outlook.com> Reviewed-by: Roman Kisel <vdso@mailbox.org> Signed-off-by: Naman Jain <namjain@linux.microsoft.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Add the arm64 variant of mshv_vtl_return_call() to support the MSHV_VTL driver on arm64. This function enables the transition between Virtual Trust Levels (VTLs) in MSHV_VTL when the kernel acts as a paravisor. Signed-off-by: Roman Kisel <romank@linux.microsoft.com> Reviewed-by: Roman Kisel <vdso@mailbox.org> Signed-off-by: Naman Jain <namjain@linux.microsoft.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Move hv_call_get_vp_registers() and hv_call_set_vp_registers() declarations from drivers/hv/mshv.h to include/asm-generic/mshyperv.h. These functions are defined in mshv_common.c and are going to be called from both drivers/hv/ and arch/x86/hyperv/hv_vtl.c. The latter never included mshv.h, relying on implicit declaration visibility. Moving the declarations to the arch-generic Hyper-V header makes them properly visible to all architecture-specific callers. Provide static inline stubs returning -EOPNOTSUPP when neither CONFIG_MSHV_ROOT nor CONFIG_MSHV_VTL is enabled. Signed-off-by: Naman Jain <namjain@linux.microsoft.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Move hv_vtl_configure_reg_page() from drivers/hv/mshv_vtl_main.c to arch/x86/hyperv/hv_vtl.c. The register page overlay is an x86-specific feature that uses HV_X64_REGISTER_REG_PAGE, so its configuration belongs in architecture-specific code. Move struct mshv_vtl_per_cpu and union hv_synic_overlay_page_msr to include/asm-generic/mshyperv.h so they are visible to both arch and driver code. Change the return type from void to bool so the caller can determine whether the register page was successfully configured and set mshv_has_reg_page accordingly. Signed-off-by: Naman Jain <namjain@linux.microsoft.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
ARM64 does not support the register page overlay, so provide a stub that returns false. This pairs with the preceding commit that moved hv_vtl_configure_reg_page() out of common code into architecture- specific files. Signed-off-by: Naman Jain <namjain@linux.microsoft.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The kernel currently sets the VSM configuration register, thereby imposing certain VSM configuration on the userspace (OpenVMM). The userspace (OpenVMM) has the capability to configure this register, and it is already doing it using the generic hypercall interface. The configuration can vary based on the use case or architectures, so let userspace take care of configuring it and remove this logic in the kernel driver. Signed-off-by: Roman Kisel <romank@linux.microsoft.com> Reviewed-by: Michael Kelley <mhklinux@outlook.com> Reviewed-by: Roman Kisel <vdso@mailbox.org> Signed-off-by: Naman Jain <namjain@linux.microsoft.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The VSM code page offset register (HV_REGISTER_VSM_CODE_PAGE_OFFSETS) is x86 specific, its value configures the static call used to return to VTL0 via the hypercall page. Move the register read from the common mshv_vtl_get_vsm_regs() into the x86 mshv_vtl_return_call_init(), which is the sole consumer of the offset. Change mshv_vtl_return_call_init() from taking a u64 parameter to taking no arguments, and rename mshv_vtl_get_vsm_regs() to mshv_vtl_get_vsm_cap_reg() since it now only fetches HV_REGISTER_VSM_CAPABILITIES. No functional change on x86. This prepares the common driver code for ARM64 where VSM code page offsets do not apply. Signed-off-by: Naman Jain <namjain@linux.microsoft.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Add necessary support to make MSHV_VTL work for arm64 architecture. * Add stub implementation for mshv_vtl_return_call_init() as it's not required for arm64 * Handle hugepage functions by config checks, as it's x86 specific * fpu/legacy.h header inclusion was required when x86 assembly code was present here, it got left when the code was moved to arch files. Remove it now (unrelated to arm64) Signed-off-by: Roman Kisel <romank@linux.microsoft.com> Signed-off-by: Naman Jain <namjain@linux.microsoft.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Add a dependency on 4K page size in Kconfig of MSHV_VTL to support any assumptions that may be present in the code. x86 anyways supports 4K page size only, and for arm64, higher page size support is not validated. Remove this dependency as and when this feature is supported. Signed-off-by: Naman Jain <namjain@linux.microsoft.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Enable ARM64 support in MSHV_VTL Kconfig now that all the necessary support is present. Signed-off-by: Roman Kisel <romank@linux.microsoft.com> Reviewed-by: Michael Kelley <mhklinux@outlook.com> Reviewed-by: Roman Kisel <vdso@mailbox.org> Signed-off-by: Naman Jain <namjain@linux.microsoft.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
|
Patch 1: "[v2,01/15] arm64: smp: Export arch_smp_send_reschedule for mshv_vtl module" |
|
Patch 1: "[v2,01/15] arm64: smp: Export arch_smp_send_reschedule for mshv_vtl module" |
|
Patch 1: "[v2,01/15] arm64: smp: Export arch_smp_send_reschedule for mshv_vtl module" |
|
Patch 1: "[v2,01/15] arm64: smp: Export arch_smp_send_reschedule for mshv_vtl module" |
|
Patch 1: "[v2,01/15] arm64: smp: Export arch_smp_send_reschedule for mshv_vtl module" |
|
Patch 1: "[v2,01/15] arm64: smp: Export arch_smp_send_reschedule for mshv_vtl module" |
|
Patch 1: "[v2,01/15] arm64: smp: Export arch_smp_send_reschedule for mshv_vtl module" |
|
Patch 1: "[v2,01/15] arm64: smp: Export arch_smp_send_reschedule for mshv_vtl module" |
|
Patch 1: "[v2,01/15] arm64: smp: Export arch_smp_send_reschedule for mshv_vtl module" |
|
Patch 1: "[v2,01/15] arm64: smp: Export arch_smp_send_reschedule for mshv_vtl module" |
|
Patch 1: "[v2,01/15] arm64: smp: Export arch_smp_send_reschedule for mshv_vtl module" |
|
Patch 1: "[v2,01/15] arm64: smp: Export arch_smp_send_reschedule for mshv_vtl module" |
|
Patch 2: "[v2,02/15] Drivers: hv: Move hv_vp_assist_page to common files" |
|
Patch 2: "[v2,02/15] Drivers: hv: Move hv_vp_assist_page to common files" |
|
Patch 13: "[v2,13/15] mshv_vtl: Add remaining support for arm64" |
|
Patch 14: "[v2,14/15] Drivers: hv: Add 4K page dependency in MSHV_VTL" |
|
Patch 14: "[v2,14/15] Drivers: hv: Add 4K page dependency in MSHV_VTL" |
|
Patch 14: "[v2,14/15] Drivers: hv: Add 4K page dependency in MSHV_VTL" |
|
Patch 14: "[v2,14/15] Drivers: hv: Add 4K page dependency in MSHV_VTL" |
|
Patch 14: "[v2,14/15] Drivers: hv: Add 4K page dependency in MSHV_VTL" |
|
Patch 14: "[v2,14/15] Drivers: hv: Add 4K page dependency in MSHV_VTL" |
|
Patch 14: "[v2,14/15] Drivers: hv: Add 4K page dependency in MSHV_VTL" |
|
Patch 14: "[v2,14/15] Drivers: hv: Add 4K page dependency in MSHV_VTL" |
|
Patch 14: "[v2,14/15] Drivers: hv: Add 4K page dependency in MSHV_VTL" |
|
Patch 14: "[v2,14/15] Drivers: hv: Add 4K page dependency in MSHV_VTL" |
|
Patch 14: "[v2,14/15] Drivers: hv: Add 4K page dependency in MSHV_VTL" |
|
Patch 14: "[v2,14/15] Drivers: hv: Add 4K page dependency in MSHV_VTL" |
|
Patch 15: "[v2,15/15] Drivers: hv: Add ARM64 support for MSHV_VTL in Kconfig" |
|
Patch 15: "[v2,15/15] Drivers: hv: Add ARM64 support for MSHV_VTL in Kconfig" |
|
Patch 15: "[v2,15/15] Drivers: hv: Add ARM64 support for MSHV_VTL in Kconfig" |
|
Patch 15: "[v2,15/15] Drivers: hv: Add ARM64 support for MSHV_VTL in Kconfig" |
|
Patch 15: "[v2,15/15] Drivers: hv: Add ARM64 support for MSHV_VTL in Kconfig" |
|
Patch 15: "[v2,15/15] Drivers: hv: Add ARM64 support for MSHV_VTL in Kconfig" |
|
Patch 15: "[v2,15/15] Drivers: hv: Add ARM64 support for MSHV_VTL in Kconfig" |
|
Patch 15: "[v2,15/15] Drivers: hv: Add ARM64 support for MSHV_VTL in Kconfig" |
|
Patch 15: "[v2,15/15] Drivers: hv: Add ARM64 support for MSHV_VTL in Kconfig" |
|
Patch 15: "[v2,15/15] Drivers: hv: Add ARM64 support for MSHV_VTL in Kconfig" |
|
Patch 15: "[v2,15/15] Drivers: hv: Add ARM64 support for MSHV_VTL in Kconfig" |
|
Patch 15: "[v2,15/15] Drivers: hv: Add ARM64 support for MSHV_VTL in Kconfig" |
94a07a2 to
f190ec6
Compare
PR for series 1084702 applied to workflow__riscv__fixes
Name: Add arm64 support in MSHV_VTL
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1084702
Version: 2