From patchwork Tue Aug 16 23:28:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Douglas Goldstein X-Patchwork-Id: 9284993 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 E52F7607FD for ; Tue, 16 Aug 2016 23:32:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D6864286F5 for ; Tue, 16 Aug 2016 23:32:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CB58828788; Tue, 16 Aug 2016 23:32:19 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID 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 4FE8C286F5 for ; Tue, 16 Aug 2016 23:32:19 +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 1bZnnW-0004cY-Tj; Tue, 16 Aug 2016 23:29:30 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZnnV-0004bz-NN for xen-devel@lists.xen.org; Tue, 16 Aug 2016 23:29:29 +0000 Received: from [193.109.254.147] by server-10.bemta-6.messagelabs.com id 1D/D5-27438-9D1A3B75; Tue, 16 Aug 2016 23:29:29 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrCIsWRWlGSWpSXmKPExsVyMXThId0bCze HGzS28Fss+biYxYHR4+ju30wBjFGsmXlJ+RUJrBnzTq9lLlgrUHFx1nq2BsYbvF2MXBxCAhMZ JY7uPsEC4rAIzGOWWLWkk7GLkZNDQqCfVaLrWhSEHSNx+8QOZgi7WuL51N1MILaQgILE7wmHm CAmrWCSeLBvBViCTUBD4smvGWwgtoiAtMS1z5fBhjILlEjsnf8DzBYWcJRo/7cJbCiLgKrErq XvWEFsXqD403NXgXo5gJbJSSx47wMS5hRwkjj6soEdYq+jRPOa6WwTGAUWMDKsYlQvTi0qSy3 StdRLKspMzyjJTczM0TU0MNPLTS0uTkxPzUlMKtZLzs/dxAgMKwYg2MF4d1PAIUZJDiYlUd6Z EzeGC/El5adUZiQWZ8QXleakFh9ilOHgUJLgrVuwOVxIsCg1PbUiLTMHGOAwaQkOHiUR3iiQN G9xQWJucWY6ROoUozHHlt/X1jJxbJt6by2TEEtefl6qlDjvUZBSAZDSjNI8uEGwyLvEKCslzM sIdJoQT0FqUW5mCar8K0ZxDkYlYd4dIFN4MvNK4Pa9AjqFCegUfekNIKeUJCKkpBoYl61pPmW 49MiMpE6OIk3PztgKh+MHO/+bR5y5sFtmxrPNOR7zNx+c6uU1jfvAhinLDt/6deLio99MXCbc 1c9f965tf6MqKim7e2GlmKFm4pKa1z+yv0wJNt30VOyqyeysWpVFQcK2HyuCZptXr/gtrKT/S 2rPueDmnY4Tb/yb+Ya33/vXZcFwJiWW4oxEQy3mouJEAKr+lUC3AgAA X-Env-Sender: cardoe@cardoe.com X-Msg-Ref: server-3.tower-27.messagelabs.com!1471390167!53933894!1 X-Originating-IP: [209.85.161.194] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 23255 invoked from network); 16 Aug 2016 23:29:28 -0000 Received: from mail-yw0-f194.google.com (HELO mail-yw0-f194.google.com) (209.85.161.194) by server-3.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 16 Aug 2016 23:29:28 -0000 Received: by mail-yw0-f194.google.com with SMTP id j12so4223878ywb.1 for ; Tue, 16 Aug 2016 16:29:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cardoe.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=pAS2ssT2NQurZjk4CUN+aUxTAq8B12F18yAD5XYCDrw=; b=MQvZ/MV6F9igY8fMLXDtTvYZHDa08JFVtnUdbLiGKTlb71p3kPk0c30NS4u3uytR6y f5yztHm8OS+3NMTJZ3TeRumILE6AsvP0RWauLQp593TqwMHccIyjwhkgJcrv+ISjyXes jTXpkB1b7EydH8xg3CudxBnMlkP8+oXWq4ISU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pAS2ssT2NQurZjk4CUN+aUxTAq8B12F18yAD5XYCDrw=; b=GUJUPRmQqNA04nI59f2UPhsONizieD5l4pB+tExJwAnIkIh3YgQtM42IxCE1VjVRlP eBkfc+QgJxydZJ3P+O0pXrbBIob1xWsvru3y90wbW9gnwrG/C+p1Fnh0dzK4TRUH8xEe 8CPgNLVWgVgGryOJQ5skccdi4gIKeLDq+M66Sd+3ZNrwQDkxZRQeqCH0Nyu4c8OkzrQr eWBwdZ/nKVyApHQAB3/+5Y2QW694C6VeQzs2z1AqMf+kA+JNnQP+rKSAZT4P7prvYeot Ln/LtEXe9VuoqxNFWZfy+zJQwo7u+QPZrYRPV88VvuN+HP5pnclmkLcf7gFGJAjlqzB7 oPEA== X-Gm-Message-State: AEkoouszsq39r/0g1Dj0o/Gyy1bdoCyMx0cbpgvAlCDAlzwAFVNlkxVZSkJPW3ZopZ4l7w== X-Received: by 10.13.219.199 with SMTP id d190mr29945634ywe.22.1471390166896; Tue, 16 Aug 2016 16:29:26 -0700 (PDT) Received: from swanson.attlocal.net (104-179-196-18.lightspeed.brhmal.sbcglobal.net. [104.179.196.18]) by smtp.gmail.com with ESMTPSA id p67sm14046603ywe.2.2016.08.16.16.29.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 Aug 2016 16:29:25 -0700 (PDT) From: Doug Goldstein To: xen-devel@lists.xen.org Date: Tue, 16 Aug 2016 18:28:24 -0500 Message-Id: <1471390109-10407-5-git-send-email-cardoe@cardoe.com> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1471390109-10407-1-git-send-email-cardoe@cardoe.com> References: <1471390109-10407-1-git-send-email-cardoe@cardoe.com> Cc: Andrew Cooper , Doug Goldstein , Jan Beulich Subject: [Xen-devel] [PATCH 4/9] x86/mtrr: drop unnecessary use_intel() macro 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 The use_intel() macro always evaluates to true so don't bother using it. Signed-off-by: Doug Goldstein --- xen/arch/x86/cpu/mtrr/main.c | 21 ++++----------------- xen/arch/x86/cpu/mtrr/mtrr.h | 1 - 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/xen/arch/x86/cpu/mtrr/main.c b/xen/arch/x86/cpu/mtrr/main.c index 5dd1f5d..6f0113a 100644 --- a/xen/arch/x86/cpu/mtrr/main.c +++ b/xen/arch/x86/cpu/mtrr/main.c @@ -82,12 +82,7 @@ static void __init set_num_var_ranges(void) { unsigned long config = 0; - if (use_intel()) { - rdmsrl(MSR_MTRRcap, config); - } else if (is_cpu(AMD)) - config = 2; - else if (is_cpu(CYRIX) || is_cpu(CENTAUR)) - config = 8; + rdmsrl(MSR_MTRRcap, config); num_var_ranges = config & 0xff; } @@ -561,13 +556,12 @@ void __init mtrr_bp_init(void) set_num_var_ranges(); init_table(); - if (use_intel()) - get_mtrr_state(); + get_mtrr_state(); } void mtrr_ap_init(void) { - if (!use_intel() || hold_mtrr_updates_on_aps) + if (hold_mtrr_updates_on_aps) return; /* * Ideally we should hold mtrr_mutex here to avoid mtrr entries changed, @@ -596,30 +590,23 @@ void mtrr_save_state(void) void mtrr_aps_sync_begin(void) { - if (!use_intel()) - return; hold_mtrr_updates_on_aps = 1; } void mtrr_aps_sync_end(void) { - if (!use_intel()) - return; set_mtrr(~0U, 0, 0, 0); hold_mtrr_updates_on_aps = 0; } void mtrr_bp_restore(void) { - if (!use_intel()) - return; mtrr_generic_set_all(); } static int __init mtrr_init_finialize(void) { - if (use_intel()) - mtrr_state_warn(); + mtrr_state_warn(); return 0; } __initcall(mtrr_init_finialize); diff --git a/xen/arch/x86/cpu/mtrr/mtrr.h b/xen/arch/x86/cpu/mtrr/mtrr.h index 92b0b11..5e0d832 100644 --- a/xen/arch/x86/cpu/mtrr/mtrr.h +++ b/xen/arch/x86/cpu/mtrr/mtrr.h @@ -64,7 +64,6 @@ extern u64 size_or_mask, size_and_mask; extern const struct mtrr_ops *mtrr_if; #define is_cpu(vnd) (X86_VENDOR_INTEL == X86_VENDOR_##vnd) -#define use_intel() (1) extern unsigned int num_var_ranges;