mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-21 05:02:24 +00:00
hv: Remove separate interrupt routine for pre-launched VMs
As vector re-mapping is enabled for pre-launched/partition mode VMs, there is no more need for separate interrupt routine i.e. partition_mode_dispatch_interrupt. 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:
parent
5b795a3312
commit
f22347346e
@ -579,8 +579,8 @@ void ptirq_intx_ack(struct acrn_vm *vm, uint32_t virt_pin, uint32_t vpin_src)
|
|||||||
* entry_nr = 0 means first vector
|
* entry_nr = 0 means first vector
|
||||||
* user must provide bdf and entry_nr
|
* user must provide bdf and entry_nr
|
||||||
*/
|
*/
|
||||||
int32_t ptirq_msix_remap(struct acrn_vm *vm, uint16_t virt_bdf,
|
int32_t ptirq_msix_remap(struct acrn_vm *vm, uint16_t virt_bdf, uint16_t phys_bdf,
|
||||||
uint16_t entry_nr, struct ptirq_msi_info *info)
|
uint16_t entry_nr, struct ptirq_msi_info *info)
|
||||||
{
|
{
|
||||||
struct ptirq_remapping_info *entry;
|
struct ptirq_remapping_info *entry;
|
||||||
DEFINE_MSI_SID(virt_sid, virt_bdf, entry_nr);
|
DEFINE_MSI_SID(virt_sid, virt_bdf, entry_nr);
|
||||||
@ -597,8 +597,8 @@ int32_t ptirq_msix_remap(struct acrn_vm *vm, uint16_t virt_bdf,
|
|||||||
entry = ptirq_lookup_entry_by_sid(PTDEV_INTR_MSI, &virt_sid, vm);
|
entry = ptirq_lookup_entry_by_sid(PTDEV_INTR_MSI, &virt_sid, vm);
|
||||||
if (entry == NULL) {
|
if (entry == NULL) {
|
||||||
/* SOS_VM we add mapping dynamically */
|
/* SOS_VM we add mapping dynamically */
|
||||||
if (is_sos_vm(vm)) {
|
if (is_sos_vm(vm) || is_prelaunched_vm(vm)) {
|
||||||
entry = add_msix_remapping(vm, virt_bdf, virt_bdf, entry_nr);
|
entry = add_msix_remapping(vm, virt_bdf, phys_bdf, entry_nr);
|
||||||
if (entry == NULL) {
|
if (entry == NULL) {
|
||||||
pr_err("dev-assign: msi entry exist in others");
|
pr_err("dev-assign: msi entry exist in others");
|
||||||
}
|
}
|
||||||
|
@ -414,11 +414,7 @@ int32_t external_interrupt_vmexit_handler(struct acrn_vcpu *vcpu)
|
|||||||
ctx.rflags = vcpu_get_rflags(vcpu);
|
ctx.rflags = vcpu_get_rflags(vcpu);
|
||||||
ctx.cs = exec_vmread32(VMX_GUEST_CS_SEL);
|
ctx.cs = exec_vmread32(VMX_GUEST_CS_SEL);
|
||||||
|
|
||||||
#ifdef CONFIG_PARTITION_MODE
|
|
||||||
partition_mode_dispatch_interrupt(&ctx);
|
|
||||||
#else
|
|
||||||
dispatch_interrupt(&ctx);
|
dispatch_interrupt(&ctx);
|
||||||
#endif
|
|
||||||
vcpu_retain_rip(vcpu);
|
vcpu_retain_rip(vcpu);
|
||||||
|
|
||||||
TRACE_2L(TRACE_VMEXIT_EXTERNAL_INTERRUPT, ctx.vector, 0UL);
|
TRACE_2L(TRACE_VMEXIT_EXTERNAL_INTERRUPT, ctx.vector, 0UL);
|
||||||
|
@ -380,28 +380,6 @@ void dispatch_exception(struct intr_excp_ctx *ctx)
|
|||||||
cpu_dead();
|
cpu_dead();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_PARTITION_MODE
|
|
||||||
void partition_mode_dispatch_interrupt(struct intr_excp_ctx *ctx)
|
|
||||||
{
|
|
||||||
uint8_t vr = ctx->vector;
|
|
||||||
struct acrn_vcpu *vcpu;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* There is no vector and APIC ID remapping for VMs in
|
|
||||||
* ACRN partition mode. Device interrupts are injected with the same
|
|
||||||
* vector into vLAPIC of vCPU running on the pCPU. Vectors used for
|
|
||||||
* HV services are handled by HV using dispatch_interrupt.
|
|
||||||
*/
|
|
||||||
vcpu = per_cpu(vcpu, get_cpu_id());
|
|
||||||
if (vr < VECTOR_FIXED_START) {
|
|
||||||
send_lapic_eoi();
|
|
||||||
vlapic_set_intr(vcpu, vr, LAPIC_TRIG_EDGE);
|
|
||||||
} else {
|
|
||||||
dispatch_interrupt(ctx);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void init_irq_descs(void)
|
static void init_irq_descs(void)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
@ -93,7 +93,7 @@ static int32_t vmsi_remap(const struct pci_vdev *vdev, bool enable)
|
|||||||
info.vmsi_data.full = 0U;
|
info.vmsi_data.full = 0U;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = ptirq_msix_remap(vm, vdev->vbdf.value, 0U, &info);
|
ret = ptirq_msix_remap(vm, vdev->vbdf.value, pbdf.value, 0U, &info);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
/* Update MSI Capability structure to physical device */
|
/* Update MSI Capability structure to physical device */
|
||||||
pci_pdev_write_cfg(pbdf, capoff + PCIR_MSI_ADDR, 0x4U, (uint32_t)info.pmsi_addr.full);
|
pci_pdev_write_cfg(pbdf, capoff + PCIR_MSI_ADDR, 0x4U, (uint32_t)info.pmsi_addr.full);
|
||||||
|
@ -69,7 +69,7 @@ static int32_t vmsix_remap_entry(const struct pci_vdev *vdev, uint32_t index, bo
|
|||||||
info.vmsi_addr.full = vdev->msix.tables[index].addr;
|
info.vmsi_addr.full = vdev->msix.tables[index].addr;
|
||||||
info.vmsi_data.full = (enable) ? vdev->msix.tables[index].data : 0U;
|
info.vmsi_data.full = (enable) ? vdev->msix.tables[index].data : 0U;
|
||||||
|
|
||||||
ret = ptirq_msix_remap(vdev->vpci->vm, vdev->vbdf.value, (uint16_t)index, &info);
|
ret = ptirq_msix_remap(vdev->vpci->vm, vdev->vbdf.value, vdev->pdev->bdf.value, (uint16_t)index, &info);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
/* Write the table entry to the physical structure */
|
/* Write the table entry to the physical structure */
|
||||||
hva = hpa2hva(vdev->msix.mmio_hpa + vdev->msix.table_offset);
|
hva = hpa2hva(vdev->msix.mmio_hpa + vdev->msix.table_offset);
|
||||||
|
@ -47,6 +47,7 @@ void ptirq_intx_ack(struct acrn_vm *vm, uint32_t virt_pin, uint32_t vpin_src);
|
|||||||
*
|
*
|
||||||
* @param[in] vm pointer to acrn_vm
|
* @param[in] vm pointer to acrn_vm
|
||||||
* @param[in] virt_bdf virtual bdf associated with the passthrough device
|
* @param[in] virt_bdf virtual bdf associated with the passthrough device
|
||||||
|
* @param[in] phys_bdf virtual bdf associated with the passthrough device
|
||||||
* @param[in] entry_nr indicate coming vectors, entry_nr = 0 means first vector
|
* @param[in] entry_nr indicate coming vectors, entry_nr = 0 means first vector
|
||||||
* @param[in] info structure used for MSI/MSI-x remapping
|
* @param[in] info structure used for MSI/MSI-x remapping
|
||||||
*
|
*
|
||||||
@ -60,7 +61,8 @@ void ptirq_intx_ack(struct acrn_vm *vm, uint32_t virt_pin, uint32_t vpin_src);
|
|||||||
* @pre info != NULL
|
* @pre info != NULL
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int32_t ptirq_msix_remap(struct acrn_vm *vm, uint16_t virt_bdf, uint16_t entry_nr, struct ptirq_msi_info *info);
|
int32_t ptirq_msix_remap(struct acrn_vm *vm, uint16_t virt_bdf, uint16_t phys_bdf,
|
||||||
|
uint16_t entry_nr, struct ptirq_msi_info *info);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -91,9 +91,6 @@ void init_default_irqs(uint16_t cpu_id);
|
|||||||
|
|
||||||
void dispatch_exception(struct intr_excp_ctx *ctx);
|
void dispatch_exception(struct intr_excp_ctx *ctx);
|
||||||
void dispatch_interrupt(const struct intr_excp_ctx *ctx);
|
void dispatch_interrupt(const struct intr_excp_ctx *ctx);
|
||||||
#ifdef CONFIG_PARTITION_MODE
|
|
||||||
void partition_mode_dispatch_interrupt(struct intr_excp_ctx *ctx);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void setup_notification(void);
|
void setup_notification(void);
|
||||||
void setup_posted_intr_notification(void);
|
void setup_posted_intr_notification(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user