From patchwork Thu Jan 19 05:24:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Douglas Goldstein X-Patchwork-Id: 9525173 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 3FAF46020B for ; Thu, 19 Jan 2017 05:26:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2551028652 for ; Thu, 19 Jan 2017 05:26:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 17D062865C; Thu, 19 Jan 2017 05:26:50 +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=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RCVD_IN_SORBS_SPAM,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 9E01028652 for ; Thu, 19 Jan 2017 05:26:49 +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 1cU5D1-00040R-0H; Thu, 19 Jan 2017 05:24:27 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cU5Cz-0003zW-H3 for xen-devel@lists.xen.org; Thu, 19 Jan 2017 05:24:25 +0000 Received: from [85.158.137.68] by server-8.bemta-3.messagelabs.com id CB/39-31649-88D40885; Thu, 19 Jan 2017 05:24:24 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrDIsWRWlGSWpSXmKPExsVyMfTqEd0O34Y Ig9c7JCyWfFzM4sDocXT3b6YAxijWzLyk/IoE1oyNc1QKFvBULF+0gLmBcRlXFyMXh5DABEaJ HQ1n2EAcFoH9zBKnP81hBnEkBJaxSqw92gzkcAI5MRKbOtexQNgVEvMaF4LZQgIKEr8nHGKCs JczSZw5IQNiswloSDz5NYMNxBYRkJa49vkyI4jNLFAica15BlivsICTxK4X34B6OYA2q0p8f8 8KEuYViJPYNqubCWKVvMTC80fAbE6BVIlNmxayQ6xKkTgw8xU7LvEJjEILGBlWMWoUpxaVpRb pGpnoJRVlpmeU5CZm5ugaGhjr5aYWFyemp+YkJhXrJefnbmIEhmE9AwPjDsZXx/0OMUpyMCmJ 8tpbNkQI8SXlp1RmJBZnxBeV5qQWH2KU4eBQkuBt8AHKCRalpqdWpGXmACMCJi3BwaMkwisEk uYtLkjMLc5Mh0idYjTm6Ok6/ZKJY8+uyy+ZhFjy8vNSpcR5LUFKBUBKM0rz4AbBIvUSo6yUMC 8jAwODEE9BalFuZgmq/CtGcQ5GJWHeSSBTeDLzSuD2vQI6hQnoFCvlepBTShIRUlINjKxc195 Wai6a+WTj7zortrhnwjVtR45J6u52cjY/yX59xST2vrr/NUecbiXsPyPLPX9SVftCj4UeHe5p 2aWntqmau9uIv3zVUrLFQ1cq5UGjvnn2W/9FFaf9tWT0wz6/OvrIsythl595gUVBTaBrMJNzm cP55hn/N3+udHkdFrlkrvP3p7zHlFiKMxINtZiLihMBAy9FUM8CAAA= X-Env-Sender: cardoe@cardoe.com X-Msg-Ref: server-10.tower-31.messagelabs.com!1484803463!80608382!1 X-Originating-IP: [209.85.213.196] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.1.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 37135 invoked from network); 19 Jan 2017 05:24:24 -0000 Received: from mail-yb0-f196.google.com (HELO mail-yb0-f196.google.com) (209.85.213.196) by server-10.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 19 Jan 2017 05:24:24 -0000 Received: by mail-yb0-f196.google.com with SMTP id p3so1398831yba.2 for ; Wed, 18 Jan 2017 21:24:24 -0800 (PST) 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 :in-reply-to:references; bh=CPmIzkb5XAqLGrrBYipfgCt/52HBOAEwuxTAhUWO2R4=; b=UGqWnWLJGsRrPpY2QD3qXhIvgx4dTxPBvgJUv0YmpwVfIDZbL5mmD9GGKc6gFlLllH vTFit5B8eZuk6wforWBWUtB85RDnMj3d4B+EursWTPXuY1MwN4ltwsiFqT5j2DO+Wvx7 A8ly5alRkf/JDIfbA/pMLBqOZP1IwuSNW8kb8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=CPmIzkb5XAqLGrrBYipfgCt/52HBOAEwuxTAhUWO2R4=; b=edkEqrQ9RWAwaLNnf3y4XjAYB/bx3Ex4W3Xuh3x/IoIoykyFHcczjHhncIDTRxWIks VegUqnTDlTxzsSuHs5xOlG3Rqr9pua8GLwYKn3zGLTnyyc/7JVQaW4YOrhi7FtTh4XgL K1U5Irnv4xikelWfzjiUEbYRVSySJxs7gCTFxPiqleZm3+In2ej/g8l/slGkIupvvo/B 81XoMLhMaZmiALowEiJVMt5/Hh9FxEVHkWBoTJbEeE7lTkG4s7GuBZTpMTGeVgFalIZe ZfR5Xn993apsFhQoWQxaK5YTf3Z1yMPdx7+Oovdqgttf4S+5U4iWDmr7BpaAiyRGbvbN m3dw== X-Gm-Message-State: AIkVDXJnMINUHZUBMM7Svorlv9gr2567I/mKa7K0sl1xfaUufiOji5Yt5794uwv2iis0OA== X-Received: by 10.37.162.70 with SMTP id b64mr4914704ybi.18.1484803462902; Wed, 18 Jan 2017 21:24:22 -0800 (PST) Received: from swanson.attlocal.net (104-179-196-18.lightspeed.brhmal.sbcglobal.net. [104.179.196.18]) by smtp.gmail.com with ESMTPSA id a3sm1281164ywe.55.2017.01.18.21.24.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 18 Jan 2017 21:24:22 -0800 (PST) From: Doug Goldstein To: xen-devel@lists.xen.org Date: Wed, 18 Jan 2017 23:24:05 -0600 Message-Id: X-Mailer: git-send-email 2.10.2 In-Reply-To: References: In-Reply-To: References: Cc: Andrew Cooper , Doug Goldstein , Jan Beulich Subject: [Xen-devel] [PATCH v2 3/3] x86/mtrr: convert use_intel_if u32 to bool 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 This field is always only 1 currently but may allow 0 in the future so convert it to a bool to provide proper range checking by the compiler. Signed-off-by: Doug Goldstein Reviewed-by: Jan Beulich --- xen/arch/x86/cpu/mtrr/generic.c | 2 +- xen/arch/x86/cpu/mtrr/mtrr.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/cpu/mtrr/generic.c b/xen/arch/x86/cpu/mtrr/generic.c index 8d4537a..104baf9 100644 --- a/xen/arch/x86/cpu/mtrr/generic.c +++ b/xen/arch/x86/cpu/mtrr/generic.c @@ -560,7 +560,7 @@ static int generic_have_wrcomb(void) /* generic structure... */ const struct mtrr_ops generic_mtrr_ops = { - .use_intel_if = 1, + .use_intel_if = true, .set_all = generic_set_all, .get = generic_get_mtrr, .get_free_region = generic_get_free_region, diff --git a/xen/arch/x86/cpu/mtrr/mtrr.h b/xen/arch/x86/cpu/mtrr/mtrr.h index bb57def..ae4aad9 100644 --- a/xen/arch/x86/cpu/mtrr/mtrr.h +++ b/xen/arch/x86/cpu/mtrr/mtrr.h @@ -9,7 +9,7 @@ struct mtrr_ops { u32 vendor; - u32 use_intel_if; + bool use_intel_if; // void (*init)(void); void (*set)(unsigned int reg, unsigned long base, unsigned long size, mtrr_type type); @@ -39,7 +39,7 @@ extern u64 size_or_mask, size_and_mask; extern const struct mtrr_ops *mtrr_if; #define is_cpu(vnd) (mtrr_if && mtrr_if->vendor == X86_VENDOR_##vnd) -#define use_intel() (mtrr_if && mtrr_if->use_intel_if == 1) +#define use_intel() (mtrr_if && mtrr_if->use_intel_if == true) extern unsigned int num_var_ranges;