include/uapi/linux/mshv.h

Source file repositories/reference/linux-study-clean/include/uapi/linux/mshv.h

File Facts

System
Linux kernel
Corpus path
include/uapi/linux/mshv.h
Extension
.h
Size
11833 bytes
Lines
408
Domain
Core OS
Bucket
Core Kernel Interface
Inferred role
Core OS: implementation source
Status
source implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

struct mshv_create_partition {
	__u64 pt_flags;
	__u64 pt_isolation;
};

#define MSHV_NUM_CPU_FEATURES_BANKS 2

/**
 * struct mshv_create_partition_v2
 *
 * This is extended version of the above initial MSHV_CREATE_PARTITION
 * ioctl and allows for following additional parameters:
 *
 * @pt_num_cpu_fbanks: Must be set to MSHV_NUM_CPU_FEATURES_BANKS.
 * @pt_cpu_fbanks: Disabled processor feature banks array.
 * @pt_disabled_xsave: Disabled xsave feature bits.
 *
 * pt_cpu_fbanks and pt_disabled_xsave are passed through as-is to the create
 * partition hypercall.
 *
 * Returns : same as above original mshv_create_partition
 */
struct mshv_create_partition_v2 {
	__u64 pt_flags;
	__u64 pt_isolation;
	__u16 pt_num_cpu_fbanks;
	__u8  pt_rsvd[6];		/* MBZ */
	__u64 pt_cpu_fbanks[MSHV_NUM_CPU_FEATURES_BANKS];
	__u64 pt_rsvd1[2];		/* MBZ */
#if defined(__x86_64__)
	__u64 pt_disabled_xsave;
#else
	__u64 pt_rsvd2;			/* MBZ */
#endif
} __packed;

/* /dev/mshv */
#define MSHV_CREATE_PARTITION	_IOW(MSHV_IOCTL, 0x00, struct mshv_create_partition)

/*
 ************************
 * Child partition APIs *
 ************************
 */

struct mshv_create_vp {
	__u32 vp_index;
};

enum {
	MSHV_SET_MEM_BIT_WRITABLE,
	MSHV_SET_MEM_BIT_EXECUTABLE,
	MSHV_SET_MEM_BIT_UNMAP,
	MSHV_SET_MEM_BIT_COUNT
};

#define MSHV_SET_MEM_FLAGS_MASK ((1 << MSHV_SET_MEM_BIT_COUNT) - 1)

/* The hypervisor's "native" page size */
#define MSHV_HV_PAGE_SIZE	0x1000

/**
 * struct mshv_user_mem_region - arguments for MSHV_SET_GUEST_MEMORY
 * @size: Size of the memory region (bytes). Must be aligned to
 *        MSHV_HV_PAGE_SIZE
 * @guest_pfn: Base guest page number to map
 * @userspace_addr: Base address of userspace memory. Must be aligned to
 *                  MSHV_HV_PAGE_SIZE
 * @flags: Bitmask of 1 << MSHV_SET_MEM_BIT_*. If (1 << MSHV_SET_MEM_BIT_UNMAP)
 *         is set, ignore other bits.
 * @rsvd: MBZ
 *
 * Map or unmap a region of userspace memory to Guest Physical Addresses (GPA).
 * Mappings can't overlap in GPA space.
 * To unmap, these fields must match an existing mapping.
 */
struct mshv_user_mem_region {
	__u64 size;
	__u64 guest_pfn;
	__u64 userspace_addr;
	__u8 flags;
	__u8 rsvd[7];
};

enum {
	MSHV_IRQFD_BIT_DEASSIGN,
	MSHV_IRQFD_BIT_RESAMPLE,
	MSHV_IRQFD_BIT_COUNT,
};

Annotation

Implementation Notes