From patchwork Thu Jan 29 21:48:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?= X-Patchwork-Id: 5745421 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 060F09F38B for ; Thu, 29 Jan 2015 21:52:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3DE4620225 for ; Thu, 29 Jan 2015 21:52:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 608FC201CE for ; Thu, 29 Jan 2015 21:52:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758027AbbA2Vvr (ORCPT ); Thu, 29 Jan 2015 16:51:47 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50473 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758548AbbA2Vth (ORCPT ); Thu, 29 Jan 2015 16:49:37 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t0TLnXp7029948 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 29 Jan 2015 16:49:33 -0500 Received: from potion (ovpn-116-155.ams2.redhat.com [10.36.116.155]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id t0TLnVUf002421; Thu, 29 Jan 2015 16:49:31 -0500 Received: by potion (sSMTP sendmail emulation); Thu, 29 Jan 2015 22:49:30 +0100 From: =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= To: linux-kernel@vger.kernel.org Cc: kvm@vger.kernel.org, Paolo Bonzini , Nadav Amit , Gleb Natapov Subject: [PATCH 4/8] KVM: x86: fix x2apic logical address matching Date: Thu, 29 Jan 2015 22:48:51 +0100 Message-Id: <1422568135-28402-5-git-send-email-rkrcmar@redhat.com> In-Reply-To: <1422568135-28402-1-git-send-email-rkrcmar@redhat.com> References: <1422568135-28402-1-git-send-email-rkrcmar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00,HK_RANDOM_FROM, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We cannot hit the bug now, but future patches will expose this path. Signed-off-by: Radim Kr?má? --- arch/x86/kvm/lapic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 0ee743c6b4f1..aae043f38548 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -602,7 +602,8 @@ static bool kvm_apic_match_logical_addr(struct kvm_lapic *apic, u32 mda) logical_id = kvm_apic_get_reg(apic, APIC_LDR); if (apic_x2apic_mode(apic)) - return logical_id & mda; + return ((logical_id >> 16) == (mda >> 16)) + && (logical_id & mda & 0xffff); logical_id = GET_APIC_LOGICAL_ID(logical_id);