Re: [PATCH] KVM: SVM: fix calculate dest mask incorrectly in x2apic mode.

From: Sean Christopherson
Date: Thu Feb 02 2023 - 11:03:31 EST


On Thu, Feb 02, 2023, Yuan ZhaoXiong wrote:
> ICRH bits 31:16 is cluster id and bits 15:0 is dest mask when x2apic is
> enabled.
>
> Fixes: 603ccef42ce9 ("KVM: x86: SVM: fix avic_kick_target_vcpus_fast")
>
> Signed-off-by: Yuan ZhaoXiong <yuanzhaoxiong@xxxxxxxxx>
> ---
> arch/x86/kvm/svm/avic.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/svm/avic.c b/arch/x86/kvm/svm/avic.c
> index 6919dee..03b1e27 100644
> --- a/arch/x86/kvm/svm/avic.c
> +++ b/arch/x86/kvm/svm/avic.c
> @@ -378,7 +378,7 @@ static int avic_kick_target_vcpus_fast(struct kvm *kvm, struct kvm_lapic *source
>
> if (apic_x2apic_mode(source)) {
> /* 16 bit dest mask, 16 bit cluster id */
> - bitmap = dest & 0xFFFF0000;
> + bitmap = dest & 0xFFFF;

Already fixed in the Paolo's tree, commit da3fb46d226a ("KVM: SVM: Fix x2APIC
Logical ID calculation for avic_kick_target_vcpus_fast").

In case you have more APIC/AVIC related fixes/bugs, a big pile of fixes are queued
for 6.3, see commit f15a87c00690 ("Merge branch 'kvm-lapic-fix-and-cleanup' into HEAD").

Thanks!