History

Merge tag 'hyperv-next-signed-20251207' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux

Pull hyperv updates from Wei Liu: - Enhancements to Linux as the root partition for Microsoft Hypervisor: - Support a new mode called L1VH, which allows Linux to drive the hypervisor running the Azure Host directly - Support for MSHV crash dump collection - Allow Linux's memory management subsystem to better manage guest memory regions - Fix issues that prevented a clean shutdown of the whole system on bare metal and nested configurations - ARM64 support for the MSHV driver - Various other bug fixes and cleanups - Add support for Confidential VMBus for Linux guest on Hyper-V - Secure AVIC support for Linux guests on Hyper-V - Add the mshv_vtl driver to allow Linux to run as the secure kernel in a higher virtual trust level for Hyper-V * tag 'hyperv-next-signed-20251207' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux: (58 commits) mshv: Cleanly shutdown root partition with MSHV mshv: Use reboot notifier to configure sleep state mshv: Add definitions for MSHV sleep state configuration mshv: Add support for movable memory regions mshv: Add refcount and locking to mem regions mshv: Fix huge page handling in memory region traversal mshv: Move region management to mshv_regions.c mshv: Centralize guest memory region destruction mshv: Refactor and rename memory region handling functions mshv: adjust interrupt control structure for ARM64 Drivers: hv: use kmalloc_array() instead of kmalloc() mshv: Add ioctl for self targeted passthrough hvcalls Drivers: hv: Introduce mshv_vtl driver Drivers: hv: Export some symbols for mshv_vtl static_call: allow using STATIC_CALL_TRAMP_STR() from assembly mshv: Extend create partition ioctl to support cpu features mshv: Allow mappings that overlap in uaddr mshv: Fix create memory region overlap check mshv: add WQ_PERCPU to alloc_workqueue users Drivers: hv: Use kmalloc_array() instead of kmalloc() ...

Linus Torvalds committed 11 months ago

Commit feb06d22 parents c2f2b01 615a6e742 files · +5003 −692Browse files

Showing the changes to include/uapi (1 of 42 files). Show all

Unified · Split

include/uapi/linux/mshv.h+115−1
@@ -26,6 +26,7 @@ enum { · 25 unmodified lines
2626 MSHV_PT_BIT_LAPIC,
2727 MSHV_PT_BIT_X2APIC,
2828 MSHV_PT_BIT_GPA_SUPER_PAGES,
29+ MSHV_PT_BIT_CPU_AND_XSAVE_FEATURES,
2930 MSHV_PT_BIT_COUNT,
3031 };
3132
@@ -41,6 +42,8 @@ enum { · 9 unmodified lines
4142 * @pt_flags: Bitmask of 1 << MSHV_PT_BIT_*
4243 * @pt_isolation: MSHV_PT_ISOLATION_*
4344 *
45+ * This is the initial/v1 version for backward compatibility.
46+ *
4447 * Returns a file descriptor to act as a handle to a guest partition.
4548 * At this point the partition is not yet initialized in the hypervisor.
4649 * Some operations must be done with the partition in this state, e.g. setting
@@ -52,6 +55,37 @@ struct mshv_create_partition { · 5 unmodified lines
5255 __u64 pt_isolation;
5356 };
5457
58+#define MSHV_NUM_CPU_FEATURES_BANKS 2
59+
60+/**
61+ * struct mshv_create_partition_v2
62+ *
63+ * This is extended version of the above initial MSHV_CREATE_PARTITION
64+ * ioctl and allows for following additional parameters:
65+ *
66+ * @pt_num_cpu_fbanks: Must be set to MSHV_NUM_CPU_FEATURES_BANKS.
67+ * @pt_cpu_fbanks: Disabled processor feature banks array.
68+ * @pt_disabled_xsave: Disabled xsave feature bits.
69+ *
70+ * pt_cpu_fbanks and pt_disabled_xsave are passed through as-is to the create
71+ * partition hypercall.
72+ *
73+ * Returns : same as above original mshv_create_partition
74+ */
75+struct mshv_create_partition_v2 {
76+ __u64 pt_flags;
77+ __u64 pt_isolation;
78+ __u16 pt_num_cpu_fbanks;
79+ __u8 pt_rsvd[6]; /* MBZ */
80+ __u64 pt_cpu_fbanks[MSHV_NUM_CPU_FEATURES_BANKS];
81+ __u64 pt_rsvd1[2]; /* MBZ */
82+#if defined(__x86_64__)
83+ __u64 pt_disabled_xsave;
84+#else
85+ __u64 pt_rsvd2; /* MBZ */
86+#endif
87+} __packed;
88+
5589 /* /dev/mshv */
5690 #define MSHV_CREATE_PARTITION _IOW(MSHV_IOCTL, 0x00, struct mshv_create_partition)
5791
@@ -89,7 +123,7 @@ enum { · 31 unmodified lines
89123 * @rsvd: MBZ
90124 *
91125 * Map or unmap a region of userspace memory to Guest Physical Addresses (GPA).
92− * Mappings can't overlap in GPA space or userspace.
126+ * Mappings can't overlap in GPA space.
93127 * To unmap, these fields must match an existing mapping.
94128 */
95129 struct mshv_user_mem_region {
@@ -288,4 +322,84 @@ struct mshv_get_set_vp_state { · 192 unmodified lines
288322 * #define MSHV_ROOT_HVCALL _IOWR(MSHV_IOCTL, 0x07, struct mshv_root_hvcall)
289323 */
290324
325+/* Structure definitions, macros and IOCTLs for mshv_vtl */
326+
327+#define MSHV_CAP_CORE_API_STABLE 0x0
328+#define MSHV_CAP_REGISTER_PAGE 0x1
329+#define MSHV_CAP_VTL_RETURN_ACTION 0x2
330+#define MSHV_CAP_DR6_SHARED 0x3
331+#define MSHV_MAX_RUN_MSG_SIZE 256
332+
333+struct mshv_vp_registers {
334+ __u32 count; /* supports only 1 register at a time */
335+ __u32 reserved; /* Reserved for alignment or future use */
336+ __u64 regs_ptr; /* pointer to struct hv_register_assoc */
337+};
338+
339+struct mshv_vtl_set_eventfd {
340+ __s32 fd;
341+ __u32 flag;
342+};
343+
344+struct mshv_vtl_signal_event {
345+ __u32 connection_id;
346+ __u32 flag;
347+};
348+
349+struct mshv_vtl_sint_post_msg {
350+ __u64 message_type;
351+ __u32 connection_id;
352+ __u32 payload_size; /* Must not exceed HV_MESSAGE_PAYLOAD_BYTE_COUNT */
353+ __u64 payload_ptr; /* pointer to message payload (bytes) */
354+};
355+
356+struct mshv_vtl_ram_disposition {
357+ __u64 start_pfn;
358+ __u64 last_pfn;
359+};
360+
361+struct mshv_vtl_set_poll_file {
362+ __u32 cpu;
363+ __u32 fd;
364+};
365+
366+struct mshv_vtl_hvcall_setup {
367+ __u64 bitmap_array_size; /* stores number of bytes */
368+ __u64 allow_bitmap_ptr;
369+};
370+
371+struct mshv_vtl_hvcall {
372+ __u64 control; /* Hypercall control code */
373+ __u64 input_size; /* Size of the input data */
374+ __u64 input_ptr; /* Pointer to the input struct */
375+ __u64 status; /* Status of the hypercall (output) */
376+ __u64 output_size; /* Size of the output data */
377+ __u64 output_ptr; /* Pointer to the output struct */
378+};
379+
380+struct mshv_sint_mask {
381+ __u8 mask;
382+ __u8 reserved[7];
383+};
384+
385+/* /dev/mshv device IOCTL */
386+#define MSHV_CHECK_EXTENSION _IOW(MSHV_IOCTL, 0x00, __u32)
387+
388+/* vtl device */
389+#define MSHV_CREATE_VTL _IOR(MSHV_IOCTL, 0x1D, char)
390+#define MSHV_ADD_VTL0_MEMORY _IOW(MSHV_IOCTL, 0x21, struct mshv_vtl_ram_disposition)
391+#define MSHV_SET_POLL_FILE _IOW(MSHV_IOCTL, 0x25, struct mshv_vtl_set_poll_file)
392+#define MSHV_RETURN_TO_LOWER_VTL _IO(MSHV_IOCTL, 0x27)
393+#define MSHV_GET_VP_REGISTERS _IOWR(MSHV_IOCTL, 0x05, struct mshv_vp_registers)
394+#define MSHV_SET_VP_REGISTERS _IOW(MSHV_IOCTL, 0x06, struct mshv_vp_registers)
395+
396+/* VMBus device IOCTLs */
397+#define MSHV_SINT_SIGNAL_EVENT _IOW(MSHV_IOCTL, 0x22, struct mshv_vtl_signal_event)
398+#define MSHV_SINT_POST_MESSAGE _IOW(MSHV_IOCTL, 0x23, struct mshv_vtl_sint_post_msg)
399+#define MSHV_SINT_SET_EVENTFD _IOW(MSHV_IOCTL, 0x24, struct mshv_vtl_set_eventfd)
400+#define MSHV_SINT_PAUSE_MESSAGE_STREAM _IOW(MSHV_IOCTL, 0x25, struct mshv_sint_mask)
401+
402+/* hv_hvcall device */
403+#define MSHV_HVCALL_SETUP _IOW(MSHV_IOCTL, 0x1E, struct mshv_vtl_hvcall_setup)
404+#define MSHV_HVCALL _IOWR(MSHV_IOCTL, 0x1F, struct mshv_vtl_hvcall)
291405 #endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t