Revert "hv:refine vm & vcpu lock" for release2.2_branch

This reverts commit a67a85c70d.

this revert only for release_2.2 branch to fix WaaG reboot failed
restore memset in create_vm because sub-module use uninitialized data
in vm structure after reboot

Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
Tracked-On: #4958
This commit is contained in:
Mingqiang Chi
2020-09-07 12:42:57 +08:00
committed by wenlingz
parent 8b86714af8
commit 6508d44460
4 changed files with 17 additions and 20 deletions

View File

@@ -82,7 +82,7 @@ struct vm_pm_info {
/* Enumerated type for VM states */
enum vm_state {
VM_POWERED_OFF = 0, /* MUST set 0 because vm_state's initialization depends on clear BSS section */
VM_POWERED_OFF = 0,
VM_CREATED, /* VM created / awaiting start (boot) */
VM_RUNNING, /* VM running */
VM_READY_TO_POWEROFF, /* RTVM only, it is trying to poweroff by itself */
@@ -120,6 +120,10 @@ struct vm_arch {
} __aligned(PAGE_SIZE);
struct acrn_vm {
/* vm_state_lock MUST be the first field in VM structure it will not clear zero when creating VM
* this lock initialization depends on the clear BSS section
*/
spinlock_t vm_state_lock;/* Spin-lock used to protect vm/vcpu state transition for a VM */
struct vm_arch arch_vm; /* Reference to this VM's arch information */
struct vm_hw_info hw; /* Reference to this VM's HW information */
struct vm_sw_info sw; /* Reference to SW associated with this VM */
@@ -131,14 +135,10 @@ struct acrn_vm {
struct acrn_vuart vuart[MAX_VUART_NUM_PER_VM]; /* Virtual UART */
enum vpic_wire_mode wire_mode;
struct iommu_domain *iommu; /* iommu domain of this VM */
/* vm_state_lock used to protect vm/vcpu state transition,
* the initialization depends on the clear BSS section
*/
spinlock_t vm_state_lock;
spinlock_t vlapic_mode_lock; /* Spin-lock used to protect vlapic_mode modifications for a VM */
spinlock_t ept_lock; /* Spin-lock used to protect ept add/modify/remove for a VM */
spinlock_t emul_mmio_lock; /* Used to protect emulation mmio_node concurrent access for a VM */
uint16_t nr_emul_mmio_regions; /* the emulated mmio_region number */
uint16_t max_emul_mmio_regions; /* max index of the emulated mmio_region */
struct mem_io_node emul_mmio[CONFIG_MAX_EMULATED_MMIO_REGIONS];
struct vm_io_handler_desc emul_pio[EMUL_PIO_IDX_MAX];

View File

@@ -286,7 +286,7 @@ void register_mmio_emulation_handler(struct acrn_vm *vm,
*/
void unregister_mmio_emulation_handler(struct acrn_vm *vm,
uint64_t start, uint64_t end);
void deinit_emul_io(struct acrn_vm *vm);
/**
* @}
*/