hv: add INTx mapping for pre-launched VMs
Add the capability of forwarding specified physical IOAPIC interrupt lines to pre-launched VMs as virtual IOAPIC interrupts. This is for the sake of the certain MMIO pass-thru devices on EHL CRB which can support only INTx interrupts. Tracked-On: #5245 Signed-off-by: Toshiki Nishioka <toshiki.nishioka@intel.com> Reviewed-by: Junjie Mao <junjie.mao@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
871a662a6c
commit
ba99984f69
|
@ -803,3 +803,16 @@ void ptirq_remove_msix_remapping(const struct acrn_vm *vm, uint16_t phys_bdf,
|
||||||
spinlock_release(&ptdev_lock);
|
spinlock_release(&ptdev_lock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @pre vm != NULL
|
||||||
|
*/
|
||||||
|
void ptirq_remove_configured_intx_remappings(const struct acrn_vm *vm)
|
||||||
|
{
|
||||||
|
const struct acrn_vm_config *vm_config = get_vm_config(vm->vm_id);
|
||||||
|
uint32_t i;
|
||||||
|
|
||||||
|
for (i = 0; i < vm_config->pt_intx_num; i++) {
|
||||||
|
ptirq_remove_intx_remapping(vm, vm_config->pt_intx[i].virt_gsi, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include <vacpi.h>
|
#include <vacpi.h>
|
||||||
#include <platform_caps.h>
|
#include <platform_caps.h>
|
||||||
#include <mmio_dev.h>
|
#include <mmio_dev.h>
|
||||||
|
#include <assign.h>
|
||||||
|
|
||||||
vm_sw_loader_t vm_sw_loader;
|
vm_sw_loader_t vm_sw_loader;
|
||||||
|
|
||||||
|
@ -519,6 +520,18 @@ int32_t create_vm(uint16_t vm_id, uint64_t pcpu_bitmap, struct acrn_vm_config *v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (status == 0) {
|
||||||
|
uint32_t i;
|
||||||
|
for (i = 0; i < vm_config->pt_intx_num; i++) {
|
||||||
|
status = ptirq_add_intx_remapping(vm, vm_config->pt_intx[i].virt_gsi,
|
||||||
|
vm_config->pt_intx[i].phys_gsi, false);
|
||||||
|
if (status != 0) {
|
||||||
|
ptirq_remove_configured_intx_remappings(vm);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((status != 0) && (vm->arch_vm.nworld_eptp != NULL)) {
|
if ((status != 0) && (vm->arch_vm.nworld_eptp != NULL)) {
|
||||||
(void)memset(vm->arch_vm.nworld_eptp, 0U, PAGE_SIZE);
|
(void)memset(vm->arch_vm.nworld_eptp, 0U, PAGE_SIZE);
|
||||||
}
|
}
|
||||||
|
@ -604,6 +617,8 @@ int32_t shutdown_vm(struct acrn_vm *vm)
|
||||||
sbuf_reset();
|
sbuf_reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ptirq_remove_configured_intx_remappings(vm);
|
||||||
|
|
||||||
deinit_vuart(vm);
|
deinit_vuart(vm);
|
||||||
|
|
||||||
deinit_vpci(vm);
|
deinit_vpci(vm);
|
||||||
|
|
|
@ -141,6 +141,20 @@ void ptirq_remove_intx_remapping(const struct acrn_vm *vm, uint32_t virt_gsi, bo
|
||||||
*/
|
*/
|
||||||
void ptirq_remove_msix_remapping(const struct acrn_vm *vm, uint16_t phys_bdf, uint32_t vector_count);
|
void ptirq_remove_msix_remapping(const struct acrn_vm *vm, uint16_t phys_bdf, uint32_t vector_count);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Remove all interrupt remappings for INTx which are defined in VM config.
|
||||||
|
*
|
||||||
|
* Deactivate & remove all mapping entries of the virt_gsis defined in VM config for given vm.
|
||||||
|
*
|
||||||
|
* @param[in] vm pointer to acrn_vm
|
||||||
|
*
|
||||||
|
* @return None
|
||||||
|
*
|
||||||
|
* @pre vm != NULL
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void ptirq_remove_configured_intx_remappings(const struct acrn_vm *vm);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue