From patchwork Thu May 18 05:34:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "lan,Tianyu" X-Patchwork-Id: 9733877 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AA6B1601BC for ; Thu, 18 May 2017 11:42:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A80720952 for ; Thu, 18 May 2017 11:42:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8F1A52621D; Thu, 18 May 2017 11:42:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00, DATE_IN_PAST_06_12, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 332B420952 for ; Thu, 18 May 2017 11:42:43 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dBJnp-0005Il-DB; Thu, 18 May 2017 11:41:09 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dBJno-0005G9-1y for xen-devel@lists.xen.org; Thu, 18 May 2017 11:41:08 +0000 Received: from [193.109.254.147] by server-3.bemta-6.messagelabs.com id 66/D2-03058-3588D195; Thu, 18 May 2017 11:41:07 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrFLMWRWlGSWpSXmKPExsVywNykWDeoQzb SYH+XqcWSj4tZHBg9ju7+zRTAGMWamZeUX5HAmrGq/xBLwRzeipYLAg2MC7m6GDk5hASmMUos mpMCYksI8EocWTaDFcL2lzi19QRzFyMXUE0Ho8TT9evAEmwC6hInFk9kBLFFBKQlrn2+zAhSx CzQwygxcdkjFpCEsECcxLvJJ9hBbBYBVYlNZ36zgdi8Aq4Sz2Z3s0BsUJCY8vA9M4jNCRTftv UWC8RFLhKNC3tZJzDyLmBkWMWoUZxaVJZapGtoqJdUlJmeUZKbmJmja2hgppebWlycmJ6ak5h UrJecn7uJERgODECwg/HTsoBDjJIcTEqivIcLZCOF+JLyUyozEosz4otKc1KLDzHKcHAoSfDy tQPlBItS01Mr0jJzgIEJk5bg4FES4dUBSfMWFyTmFmemQ6ROMepyvFv64T2TEEtefl6qlDivF 0iRAEhRRmke3AhYlFxilJUS5mUEOkqIpyC1KDezBFX+FaM4B6OSMC8ryBSezLwSuE2vgI5gAj qi+YE0yBEliQgpqQbGyDXXd3/yVDy+88qKe5Yvm2fExZbytHhf+LA+aupJhrkhh+JiNG73lVi LKQqF8iSs6jN23JnTna8jyhGqlJG+5O/ZWZlXH3XNEpR+K3fX5GandWkDnz+jDcN0jZb+L9+Y Ss6UC38LcH0Sc2/3Nym1Jxu03jx+Vn/rb8w59+uBcje2HGjfslRTiaU4I9FQi7moOBEANnqiq 40CAAA= X-Env-Sender: tianyu.lan@intel.com X-Msg-Ref: server-5.tower-27.messagelabs.com!1495107664!97547739!1 X-Originating-IP: [192.55.52.115] X-SpamReason: No, hits=0.8 required=7.0 tests=DATE_IN_PAST_06_12 X-StarScan-Received: X-StarScan-Version: 9.4.12; banners=-,-,- X-VirusChecked: Checked Received: (qmail 38479 invoked from network); 18 May 2017 11:41:06 -0000 Received: from mga14.intel.com (HELO mga14.intel.com) (192.55.52.115) by server-5.tower-27.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 18 May 2017 11:41:06 -0000 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 May 2017 04:41:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,358,1491289200"; d="scan'208";a="970139022" Received: from sky-ws.sh.intel.com (HELO localhost) ([10.239.48.124]) by orsmga003.jf.intel.com with ESMTP; 18 May 2017 04:41:02 -0700 From: Lan Tianyu To: xen-devel@lists.xen.org Date: Thu, 18 May 2017 01:34:55 -0400 Message-Id: <1495085696-10819-26-git-send-email-tianyu.lan@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1495085696-10819-1-git-send-email-tianyu.lan@intel.com> References: <1495085696-10819-1-git-send-email-tianyu.lan@intel.com> Cc: Lan Tianyu , andrew.cooper3@citrix.com, kevin.tian@intel.com, jbeulich@suse.com, Chao Gao Subject: [Xen-devel] [RFC PATCH V2 25/26] x86/vlapic: drop no longer suitable restriction to set x2apic id X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Chao Gao If vlapic is in x2apic mode in saving process, we should set it's x2apic id when restoring. Just drop the unsuitable restrition as the existing comment says. Signed-off-by: Chao Gao Signed-off-by: Lan Tianyu --- xen/arch/x86/hvm/vlapic.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c index cf8ee50..cc55473 100644 --- a/xen/arch/x86/hvm/vlapic.c +++ b/xen/arch/x86/hvm/vlapic.c @@ -1374,25 +1374,11 @@ static int lapic_save_regs(struct domain *d, hvm_domain_context_t *h) */ static void lapic_load_fixup(struct vlapic *vlapic) { - uint32_t id = vlapic->loaded.id; - - if ( vlapic_x2apic_mode(vlapic) && id && vlapic->loaded.ldr == 1 ) - { - /* - * This is optional: ID != 0 contradicts LDR == 1. It's being added - * to aid in eventual debugging of issues arising from the fixup done - * here, but can be dropped as soon as it is found to conflict with - * other (future) changes. - */ - if ( GET_xAPIC_ID(id) != vlapic_vcpu(vlapic)->vcpu_id * 2 || - id != SET_xAPIC_ID(GET_xAPIC_ID(id)) ) - printk(XENLOG_G_WARNING "%pv: bogus APIC ID %#x loaded\n", - vlapic_vcpu(vlapic), id); + if ( vlapic_x2apic_mode(vlapic) ) set_x2apic_id(vlapic); - } else /* Undo an eventual earlier fixup. */ { - vlapic_set_reg(vlapic, APIC_ID, id); + vlapic_set_reg(vlapic, APIC_ID, vlapic->loaded.id); vlapic_set_reg(vlapic, APIC_LDR, vlapic->loaded.ldr); } }