From 0d5f12e28158634cd335e5cdb2209b7c0e858803 Mon Sep 17 00:00:00 2001 From: Li Fei1 Date: Wed, 26 May 2021 11:55:28 +0800 Subject: [PATCH] hv: vlapic: a minor refine about vlapic_x2apic_pt_icr_access In physical destination mode, the destination processor is specified by its local APIC ID. When a CPU switch xAPIC Mode to x2APIC Mode or vice versa, the local APIC ID is not changed. So a vcpu in x2APIC Mode could use physical Destination Mode to send an IPI to another vcpu in xAPIC Mode by writing ICR. This patch adds support for a vCPU A could write ICR to send IPI to another vCPU B which is in different APIC mode. Tracked-On: #5923 Signed-off-by: Li Fei1 --- hypervisor/arch/x86/guest/vlapic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hypervisor/arch/x86/guest/vlapic.c b/hypervisor/arch/x86/guest/vlapic.c index 870f4f0b0..7b6561b63 100644 --- a/hypervisor/arch/x86/guest/vlapic.c +++ b/hypervisor/arch/x86/guest/vlapic.c @@ -2054,8 +2054,8 @@ vlapic_x2apic_pt_icr_access(struct acrn_vcpu *vcpu, uint64_t val) phys = ((icr_low & APIC_DESTMODE_LOG) == 0UL); shorthand = icr_low & APIC_DEST_MASK; - if (vlapic_mode != VM_VLAPIC_X2APIC) { - pr_err("Only works on VM_VLAPIC_X2APIC mode\n"); + if ((vlapic_mode != VM_VLAPIC_X2APIC) && !phys) { + pr_err("Only Physical Destination Mode could work on non-VM_VLAPIC_X2APIC mode\n"); ret = -1; } else { dmask = vlapic_calc_dest(vcpu, shorthand, (dest == 0xffffffffU), dest, phys, false);