From patchwork Sat Jan 4 17:59:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 3434241 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 487FCC02DC for ; Sat, 4 Jan 2014 17:59:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8E7412015E for ; Sat, 4 Jan 2014 17:59:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DD2A32015F for ; Sat, 4 Jan 2014 17:59:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754774AbaADR7i (ORCPT ); Sat, 4 Jan 2014 12:59:38 -0500 Received: from mout.web.de ([212.227.15.4]:54326 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754410AbaADR7g (ORCPT ); Sat, 4 Jan 2014 12:59:36 -0500 Received: from mchn199C.home ([95.157.58.223]) by smtp.web.de (mrweb004) with ESMTPSA (Nemesis) id 0MgZLb-1VoBG40ZBX-00NxRj for ; Sat, 04 Jan 2014 18:59:35 +0100 From: Jan Kiszka To: Gleb Natapov , Paolo Bonzini , Marcelo Tosatti Cc: kvm Subject: [PATCH 07/13] lib/x86/apic: Consolidate over MSR_IA32_APICBASE Date: Sat, 4 Jan 2014 18:59:13 +0100 Message-Id: X-Mailer: git-send-email 1.8.1.1.298.ge7eed54 In-Reply-To: References: In-Reply-To: References: X-Provags-ID: V03:K0:pryYDFCNpbcQ7LsSyzS+c21cB0QH52CDwzJIdMlEZQvc9Q2iHio MtQUyvbM0/KAmejPgmBSOQHo+9+sx+Qa6MOAbU2Uhm8RnsXVnetlLCT+leBBLrs1ALzSID4 LWzE60q6sSUeDYuD+PKp9pB4J9Yw36yywJfqdsOm5uzmT7naMsnaBJJ6wKiGTwlm/QKkYES kpYRZDzpLBOFDvT8404ug== Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 From: Jan Kiszka Signed-off-by: Jan Kiszka --- lib/x86/apic.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/x86/apic.c b/lib/x86/apic.c index 7bb98ed..6876d85 100644 --- a/lib/x86/apic.c +++ b/lib/x86/apic.c @@ -1,5 +1,6 @@ #include "libcflat.h" #include "apic.h" +#include "msr.h" static void *g_apic = (void *)0xfee00000; static void *g_ioapic = (void *)0xfec00000; @@ -99,8 +100,6 @@ uint32_t apic_id(void) return apic_ops->id(); } -#define MSR_APIC_BASE 0x0000001b - int enable_x2apic(void) { unsigned a, b, c, d; @@ -108,9 +107,9 @@ int enable_x2apic(void) asm ("cpuid" : "=a"(a), "=b"(b), "=c"(c), "=d"(d) : "0"(1)); if (c & (1 << 21)) { - asm ("rdmsr" : "=a"(a), "=d"(d) : "c"(MSR_APIC_BASE)); + asm ("rdmsr" : "=a"(a), "=d"(d) : "c"(MSR_IA32_APICBASE)); a |= 1 << 10; - asm ("wrmsr" : : "a"(a), "d"(d), "c"(MSR_APIC_BASE)); + asm ("wrmsr" : : "a"(a), "d"(d), "c"(MSR_IA32_APICBASE)); apic_ops = &x2apic_ops; return 1; } else {