accel/mshv: Initialize VM partition
Create the MSHV virtual machine by opening a partition and issuing the necessary ioctl to initialize it. This sets up the basic VM structure and initial configuration used by MSHV to manage guest state. Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com> Link: https://lore.kernel.org/r/20250916164847.77883-10-magnuskulke@linux.microsoft.com [Add stubs; fix format strings for trace-events; make mshv_hvcall available only in per-target files; mshv.h/mshv_int.h split. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
5006ea1344
commit
c5f23bccde
14 changed files with 1054 additions and 4 deletions
|
|
@ -31,18 +31,27 @@
|
|||
#define CONFIG_MSHV_IS_POSSIBLE
|
||||
#endif
|
||||
|
||||
#define MSHV_MAX_MSI_ROUTES 4096
|
||||
|
||||
#define MSHV_PAGE_SHIFT 12
|
||||
|
||||
#ifdef CONFIG_MSHV_IS_POSSIBLE
|
||||
extern bool mshv_allowed;
|
||||
#define mshv_enabled() (mshv_allowed)
|
||||
#define mshv_msi_via_irqfd_enabled() mshv_enabled()
|
||||
#else /* CONFIG_MSHV_IS_POSSIBLE */
|
||||
#define mshv_enabled() false
|
||||
#endif
|
||||
#define mshv_msi_via_irqfd_enabled() false
|
||||
#endif
|
||||
|
||||
typedef struct MshvState MshvState;
|
||||
extern MshvState *mshv_state;
|
||||
|
||||
/* interrupt */
|
||||
int mshv_request_interrupt(MshvState *mshv_state, uint32_t interrupt_type, uint32_t vector,
|
||||
uint32_t vp_index, bool logical_destination_mode,
|
||||
bool level_triggered);
|
||||
|
||||
int mshv_irqchip_add_msi_route(int vector, PCIDevice *dev);
|
||||
int mshv_irqchip_update_msi_route(int virq, MSIMessage msg, PCIDevice *dev);
|
||||
void mshv_irqchip_commit_routes(void);
|
||||
|
|
|
|||
|
|
@ -36,10 +36,35 @@ struct MshvState {
|
|||
/* number of listeners */
|
||||
int nr_as;
|
||||
MshvAddressSpace *as;
|
||||
int fd;
|
||||
};
|
||||
|
||||
typedef struct MshvMsiControl {
|
||||
bool updated;
|
||||
GHashTable *gsi_routes;
|
||||
} MshvMsiControl;
|
||||
|
||||
void mshv_arch_amend_proc_features(
|
||||
union hv_partition_synthetic_processor_features *features);
|
||||
int mshv_arch_post_init_vm(int vm_fd);
|
||||
|
||||
#if defined COMPILING_PER_TARGET && defined CONFIG_MSHV_IS_POSSIBLE
|
||||
int mshv_hvcall(int fd, const struct mshv_root_hvcall *args);
|
||||
#endif
|
||||
|
||||
/* memory */
|
||||
typedef struct MshvMemoryRegion {
|
||||
uint64_t guest_phys_addr;
|
||||
uint64_t memory_size;
|
||||
uint64_t userspace_addr;
|
||||
bool readonly;
|
||||
} MshvMemoryRegion;
|
||||
|
||||
void mshv_set_phys_mem(MshvMemoryListener *mml, MemoryRegionSection *section,
|
||||
bool add);
|
||||
|
||||
/* interrupt */
|
||||
void mshv_init_msicontrol(void);
|
||||
int mshv_reserve_ioapic_msi_routes(int vm_fd);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue