mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-22 17:27:53 +00:00
hv: add the support of vector remapping for pre-launched VMs
For pre-launched VMs MSI/MSI-x configuration writes are not intercepted by ACRN. It is pass-thru and interrupts land in ACRN and the guest vector is injected into the VM's vLAPIC. With this patch, ACRN intercepts MSI/MSI-x config writes and take the code path to remap interrupt vector/APIC ID as it does for SOS/UOS. Tracked-On: #2879 Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com> Reviewed-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
committed by
Eddie Dong
parent
c4ec7ac358
commit
5b795a3312
@@ -592,7 +592,8 @@ void register_pio_emulation_handler(struct acrn_vm *vm, uint32_t pio_idx,
|
||||
/**
|
||||
* @brief Register a MMIO handler
|
||||
*
|
||||
* This API registers a MMIO handler to \p vm before it is launched.
|
||||
* This API registers a MMIO handler to \p vm before it is Started
|
||||
* For Pre-launched VMs, this API can be called after it is Started
|
||||
*
|
||||
* @param vm The VM to which the MMIO handler is registered
|
||||
* @param read_write The handler for emulating accesses to the given range
|
||||
@@ -610,9 +611,7 @@ int32_t register_mmio_emulation_handler(struct acrn_vm *vm,
|
||||
int32_t status = -EINVAL;
|
||||
struct mem_io_node *mmio_node;
|
||||
|
||||
if ((vm->hw.created_vcpus > 0U) && (vm->hw.vcpu_array[0].launched)) {
|
||||
pr_err("register mmio handler after vm launched");
|
||||
} else {
|
||||
if (is_prelaunched_vm(vm) || (vm->state != VM_STARTED)) {
|
||||
/* Ensure both a read/write handler and range check function exist */
|
||||
if ((read_write != NULL) && (end > start)) {
|
||||
if (vm->emul_mmio_regions >= CONFIG_MAX_EMULATED_MMIO_REGIONS) {
|
||||
@@ -640,6 +639,8 @@ int32_t register_mmio_emulation_handler(struct acrn_vm *vm,
|
||||
status = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pr_err("register mmio handler after VM is Started");
|
||||
}
|
||||
|
||||
/* Return status to caller */
|
||||
|
@@ -68,6 +68,18 @@ bool is_sos_vm(const struct acrn_vm *vm)
|
||||
return (vm != NULL) && (get_vm_config(vm->vm_id)->type == SOS_VM);
|
||||
}
|
||||
|
||||
/**
|
||||
* @pre vm != NULL
|
||||
* @pre vm->vmid < CONFIG_MAX_VM_NUM
|
||||
*/
|
||||
bool is_prelaunched_vm(const struct acrn_vm *vm)
|
||||
{
|
||||
struct acrn_vm_config *vm_config;
|
||||
|
||||
vm_config = get_vm_config(vm->vm_id);
|
||||
return (vm_config->type == PRE_LAUNCHED_VM);
|
||||
}
|
||||
|
||||
/**
|
||||
* @pre vm != NULL && vm_config != NULL && vm->vmid < CONFIG_MAX_VM_NUM
|
||||
*/
|
||||
|
Reference in New Issue
Block a user