mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-19 04:02:05 +00:00
hv: fix dest of IPI for CPU with lapic_pt
With lapic_pt based on vlapic, guest always see vitual apic_id. We need to convert the virtual apic_id from guest to physical apic_id before writing ICR. SMP for VM with lapic_pt is supported with this fix. Tracked-On: #2351 Signed-off-by: Yan, Like <like.yan@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
ea250c5147
commit
17f4cd18a3
@ -2075,7 +2075,7 @@ static inline uint32_t x2apic_msr_to_regoff(uint32_t msr)
|
||||
static int32_t
|
||||
vlapic_x2apic_pt_icr_access(struct acrn_vm *vm, uint64_t val)
|
||||
{
|
||||
uint32_t apic_id = (uint32_t)(val >> 32U);
|
||||
uint32_t papic_id, vapic_id = (uint32_t)(val >> 32U);
|
||||
uint32_t icr_low = (uint32_t)val;
|
||||
uint32_t mode = icr_low & APIC_DELMODE_MASK;
|
||||
uint16_t vcpu_id;
|
||||
@ -2092,7 +2092,7 @@ vlapic_x2apic_pt_icr_access(struct acrn_vm *vm, uint64_t val)
|
||||
not supported in ICR forpartition mode\n");
|
||||
ret = -1;
|
||||
} else {
|
||||
vcpu_id = vm_apicid2vcpu_id(vm, apic_id);
|
||||
vcpu_id = vm_apicid2vcpu_id(vm, vapic_id);
|
||||
target_vcpu = vcpu_from_vid(vm, vcpu_id);
|
||||
|
||||
if (target_vcpu != NULL) {
|
||||
@ -2104,7 +2104,12 @@ vlapic_x2apic_pt_icr_access(struct acrn_vm *vm, uint64_t val)
|
||||
vlapic_process_init_sipi(target_vcpu, mode, icr_low, vcpu_id);
|
||||
break;
|
||||
default:
|
||||
msr_write(MSR_IA32_EXT_APIC_ICR, (((uint64_t)apic_id) << 32U) | icr_low);
|
||||
/* convert the dest from virtual apic_id to physical apic_id */
|
||||
papic_id = per_cpu(lapic_id, target_vcpu->pcpu_id);
|
||||
dev_dbg(ACRN_DBG_LAPICPT,
|
||||
"%s vapic_id: 0x%08lx papic_id: 0x%08lx icr_low:0x%08lx",
|
||||
__func__, vapic_id, papic_id, icr_low);
|
||||
msr_write(MSR_IA32_EXT_APIC_ICR, (((uint64_t)papic_id) << 32U) | icr_low);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -564,6 +564,7 @@ void switch_apicv_mode_x2apic(struct acrn_vcpu *vcpu)
|
||||
{
|
||||
uint32_t value32;
|
||||
if (is_lapic_pt(vcpu->vm)) {
|
||||
dev_dbg(ACRN_DBG_LAPICPT, "%s: switching to x2apic and passthru", __func__);
|
||||
/*
|
||||
* Disable external interrupt exiting and irq ack
|
||||
* Disable posted interrupt processing
|
||||
|
Loading…
Reference in New Issue
Block a user