Skip to content

Commit 7d72410

Browse files
committed
Merge: HyperV rebase to kernel 6.16-rc1
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/6941 Rebase x86 and common hyperv code to kernel 6.16-rc1 JIRA: https://issues.redhat.com/browse/RHEL-80096 This includes the new driver for HyperV root partition, but it is not enabled in Kconfig and the code doesn't build, however I still included it to reduce the conflicts. Tested: smoke tested on an Azure VM. This pull request also contains updates to the MANA driver and MANA RDMA driver. Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com> Approved-by: Vitaly Kuznetsov <vkuznets@redhat.com> Approved-by: Rafael Aquini <raquini@redhat.com> Approved-by: Jerry Snitselaar <jsnitsel@redhat.com> Approved-by: Kamal Heib <kheib@redhat.com> Approved-by: Steve Best <sbest@redhat.com> Approved-by: Robert Foss <rfoss@kernel.org> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Augusto Caringi <acaringi@redhat.com>
2 parents f9e85b8 + 182c95a commit 7d72410

File tree

103 files changed

+12117
-2784
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+12117
-2784
lines changed

Documentation/userspace-api/ioctl/ioctl-number.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,8 @@ Code Seq# Include File Comments
356356
0xB6 all linux/fpga-dfl.h
357357
0xB7 all uapi/linux/remoteproc_cdev.h <mailto:linux-remoteproc@vger.kernel.org>
358358
0xB7 all uapi/linux/nsfs.h <mailto:Andrei Vagin <avagin@openvz.org>>
359+
0xB8 all uapi/linux/mshv.h Microsoft Hyper-V /dev/mshv driver
360+
359361
0xC0 00-0F linux/usb/iowarrior.h
360362
0xCA 00-0F uapi/misc/cxl.h
361363
0xCA 10-2F uapi/misc/ocxl.h

MAINTAINERS

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9022,10 +9022,8 @@ F: Documentation/devicetree/bindings/bus/microsoft,vmbus.yaml
90229022
F: Documentation/virt/hyperv
90239023
F: Documentation/networking/device_drivers/ethernet/microsoft/netvsc.rst
90249024
F: arch/arm64/hyperv
9025-
F: arch/arm64/include/asm/hyperv-tlfs.h
90269025
F: arch/arm64/include/asm/mshyperv.h
90279026
F: arch/x86/hyperv
9028-
F: arch/x86/include/asm/hyperv-tlfs.h
90299027
F: arch/x86/include/asm/mshyperv.h
90309028
F: arch/x86/include/asm/trace/hyperv.h
90319029
F: arch/x86/kernel/cpu/mshyperv.c
@@ -9041,9 +9039,13 @@ F: drivers/pci/controller/pci-hyperv.c
90419039
F: drivers/scsi/storvsc_drv.c
90429040
F: drivers/uio/uio_hv_generic.c
90439041
F: drivers/video/fbdev/hyperv_fb.c
9044-
F: include/asm-generic/hyperv-tlfs.h
90459042
F: include/asm-generic/mshyperv.h
90469043
F: include/clocksource/hyperv_timer.h
9044+
F: include/hyperv/hvgdk.h
9045+
F: include/hyperv/hvgdk_ext.h
9046+
F: include/hyperv/hvgdk_mini.h
9047+
F: include/hyperv/hvhdk.h
9048+
F: include/hyperv/hvhdk_mini.h
90479049
F: include/linux/hyperv.h
90489050
F: include/net/mana
90499051
F: include/uapi/linux/hyperv.h

arch/arm64/hyperv/hv_core.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@
1111
#include <linux/types.h>
1212
#include <linux/export.h>
1313
#include <linux/mm.h>
14-
#include <linux/hyperv.h>
1514
#include <linux/arm-smccc.h>
1615
#include <linux/module.h>
1716
#include <asm-generic/bug.h>
18-
#include <asm/hyperv-tlfs.h>
17+
#include <hyperv/hvhdk.h>
1918
#include <asm/mshyperv.h>
2019

2120
/*
@@ -54,6 +53,23 @@ u64 hv_do_fast_hypercall8(u16 code, u64 input)
5453
}
5554
EXPORT_SYMBOL_GPL(hv_do_fast_hypercall8);
5655

56+
/*
57+
* hv_do_fast_hypercall16 -- Invoke the specified hypercall
58+
* with arguments in registers instead of physical memory.
59+
* Avoids the overhead of virt_to_phys for simple hypercalls.
60+
*/
61+
u64 hv_do_fast_hypercall16(u16 code, u64 input1, u64 input2)
62+
{
63+
struct arm_smccc_res res;
64+
u64 control;
65+
66+
control = (u64)code | HV_HYPERCALL_FAST_BIT;
67+
68+
arm_smccc_1_1_hvc(HV_FUNC_ID, control, input1, input2, &res);
69+
return res.a0;
70+
}
71+
EXPORT_SYMBOL_GPL(hv_do_fast_hypercall16);
72+
5773
/*
5874
* Set a single VP register to a 64-bit value.
5975
*/

arch/arm64/hyperv/mshyperv.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ int hv_get_hypervisor_version(union hv_hypervisor_version_info *info)
2626

2727
return 0;
2828
}
29+
EXPORT_SYMBOL_GPL(hv_get_hypervisor_version);
2930

3031
static int __init hyperv_init(void)
3132
{
@@ -49,18 +50,20 @@ static int __init hyperv_init(void)
4950
hv_set_vpreg(HV_REGISTER_GUEST_OS_ID, guest_id);
5051

5152
/* Get the features and hints from Hyper-V */
52-
hv_get_vpreg_128(HV_REGISTER_FEATURES, &result);
53+
hv_get_vpreg_128(HV_REGISTER_PRIVILEGES_AND_FEATURES_INFO, &result);
5354
ms_hyperv.features = result.as32.a;
5455
ms_hyperv.priv_high = result.as32.b;
5556
ms_hyperv.misc_features = result.as32.c;
5657

57-
hv_get_vpreg_128(HV_REGISTER_ENLIGHTENMENTS, &result);
58+
hv_get_vpreg_128(HV_REGISTER_FEATURES_INFO, &result);
5859
ms_hyperv.hints = result.as32.a;
5960

6061
pr_info("Hyper-V: privilege flags low 0x%x, high 0x%x, hints 0x%x, misc 0x%x\n",
6162
ms_hyperv.features, ms_hyperv.priv_high, ms_hyperv.hints,
6263
ms_hyperv.misc_features);
6364

65+
hv_identify_partition_type();
66+
6467
ret = hv_common_init();
6568
if (ret)
6669
return ret;
@@ -72,6 +75,9 @@ static int __init hyperv_init(void)
7275
return ret;
7376
}
7477

78+
if (ms_hyperv.priv_high & HV_ACCESS_PARTITION_ID)
79+
hv_get_partition_id();
80+
7581
ms_hyperv_late_init();
7682

7783
hyperv_initialized = true;

arch/arm64/include/asm/hyperv-tlfs.h

Lines changed: 0 additions & 71 deletions
This file was deleted.

arch/arm64/include/asm/mshyperv.h

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
* the ARM64 architecture. See include/asm-generic/mshyperv.h for
77
* definitions are that architecture independent.
88
*
9-
* Definitions that are specified in the Hyper-V Top Level Functional
10-
* Spec (TLFS) should not go in this file, but should instead go in
11-
* hyperv-tlfs.h.
9+
* Definitions that are derived from Hyper-V code or headers should not go in
10+
* this file, but should instead go in the relevant files in include/hyperv.
1211
*
1312
* Copyright (C) 2021, Microsoft, Inc.
1413
*
@@ -20,7 +19,7 @@
2019

2120
#include <linux/types.h>
2221
#include <linux/arm-smccc.h>
23-
#include <asm/hyperv-tlfs.h>
22+
#include <hyperv/hvhdk.h>
2423

2524
/*
2625
* Declare calls to get and set Hyper-V VP register values on ARM64, which
@@ -41,6 +40,19 @@ static inline u64 hv_get_msr(unsigned int reg)
4140
return hv_get_vpreg(reg);
4241
}
4342

43+
/*
44+
* Nested is not supported on arm64
45+
*/
46+
static inline void hv_set_non_nested_msr(unsigned int reg, u64 value)
47+
{
48+
hv_set_msr(reg, value);
49+
}
50+
51+
static inline u64 hv_get_non_nested_msr(unsigned int reg)
52+
{
53+
return hv_get_msr(reg);
54+
}
55+
4456
/* SMCCC hypercall parameters */
4557
#define HV_SMCCC_FUNC_NUMBER 1
4658
#define HV_FUNC_ID ARM_SMCCC_CALL_VAL( \

arch/x86/coco/sev/core.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1228,15 +1228,15 @@ static void snp_cleanup_vmsa(struct sev_es_save_area *vmsa, int apic_id)
12281228
free_page((unsigned long)vmsa);
12291229
}
12301230

1231-
static int wakeup_cpu_via_vmgexit(u32 apic_id, unsigned long start_ip)
1231+
static int wakeup_cpu_via_vmgexit(u32 apic_id, unsigned long start_ip, unsigned int cpu)
12321232
{
12331233
struct sev_es_save_area *cur_vmsa, *vmsa;
12341234
struct ghcb_state state;
12351235
struct svsm_ca *caa;
12361236
unsigned long flags;
12371237
struct ghcb *ghcb;
12381238
u8 sipi_vector;
1239-
int cpu, ret;
1239+
int ret;
12401240
u64 cr4;
12411241

12421242
/*
@@ -1257,15 +1257,6 @@ static int wakeup_cpu_via_vmgexit(u32 apic_id, unsigned long start_ip)
12571257

12581258
/* Override start_ip with known protected guest start IP */
12591259
start_ip = real_mode_header->sev_es_trampoline_start;
1260-
1261-
/* Find the logical CPU for the APIC ID */
1262-
for_each_present_cpu(cpu) {
1263-
if (arch_match_cpu_phys_id(cpu, apic_id))
1264-
break;
1265-
}
1266-
if (cpu >= nr_cpu_ids)
1267-
return -EINVAL;
1268-
12691260
cur_vmsa = per_cpu(sev_vmsa, cpu);
12701261

12711262
/*

arch/x86/hyperv/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22
obj-y := hv_init.o mmu.o nested.o irqdomain.o ivm.o
3-
obj-$(CONFIG_X86_64) += hv_apic.o hv_proc.o
3+
obj-$(CONFIG_X86_64) += hv_apic.o
44
obj-$(CONFIG_HYPERV_VTL_MODE) += hv_vtl.o
55

66
ifdef CONFIG_X86_64

arch/x86/hyperv/hv_apic.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include <linux/vmalloc.h>
2424
#include <linux/mm.h>
2525
#include <linux/clockchips.h>
26-
#include <linux/hyperv.h>
2726
#include <linux/slab.h>
2827
#include <linux/cpuhotplug.h>
2928
#include <asm/hypervisor.h>

0 commit comments

Comments
 (0)