From patchwork Tue Aug 16 23:28:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Douglas Goldstein X-Patchwork-Id: 9285001 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 1CC57607FD for ; Tue, 16 Aug 2016 23:32:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C55128788 for ; Tue, 16 Aug 2016 23:32:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 012712879D; Tue, 16 Aug 2016 23:32:25 +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 926C928788 for ; Tue, 16 Aug 2016 23:32:25 +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 1bZnnd-0004fl-5l; Tue, 16 Aug 2016 23:29:37 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZnnb-0004f9-Rg for xen-devel@lists.xen.org; Tue, 16 Aug 2016 23:29:35 +0000 Received: from [193.109.254.147] by server-11.bemta-6.messagelabs.com id A1/F7-08498-FD1A3B75; Tue, 16 Aug 2016 23:29:35 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrMIsWRWlGSWpSXmKPExsVyMXThEd17Cze HGzR1CVgs+biYxYHR4+ju30wBjFGsmXlJ+RUJrBmL709gLFgqV/Gv9SBLA2O/ZBcjF4eQwARG iRPzz7KBOCwC85glum62sYA4EgL9rBJ7Wk8zdTFyAjkxEruv32KFsGskNh79CxYXElCQ+D3hE JS9gkli9awQEJtNQEPiya8ZbCC2iIC0xLXPlxlBbGaBEom9838A2RwcwgJOEtfuhoOEWQRUJX 49fssOYvMCha+vPscMUiIhICex4L0PSJgTKHz0ZQM7xCZHieY109kmMAosYGRYxahenFpUllq ka6qXVJSZnlGSm5iZo2toYKaXm1pcnJiempOYVKyXnJ+7iREYVAxAsINx+mX/Q4ySHExKorwz J24MF+JLyk+pzEgszogvKs1JLT7EKMPBoSTBKwwMUiHBotT01Iq0zBxgeMOkJTh4lER4ry0AS vMWFyTmFmemQ6ROMRpzbPl9bS0Tx7ap99YyCbHk5eelSonzHgUpFQApzSjNgxsEi7tLjLJSwr yMQKcJ8RSkFuVmlqDKv2IU52BUEub9BDKFJzOvBG7fK6BTmIBO0ZfeAHJKSSJCSqqB8eCpRbM PvX047bnztZ2zV76qtvQU5gieJzCrVnjOat323Qppm+7cKnqR6rRl7vca6faozNV/rCpvnJPi 9zvk+1//7/Ecx+03DzIJCr04+o6FcUbKxhWzZedsNLrfavFrrUObUm+q63aOI2s1j8lwGU0+o hFn2hxXrcdXv67k1Vv2B52md9ySzZRYijMSDbWYi4oTAVTMQXy2AgAA X-Env-Sender: cardoe@cardoe.com X-Msg-Ref: server-14.tower-27.messagelabs.com!1471390173!41763428!1 X-Originating-IP: [209.85.161.196] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 26072 invoked from network); 16 Aug 2016 23:29:34 -0000 Received: from mail-yw0-f196.google.com (HELO mail-yw0-f196.google.com) (209.85.161.196) by server-14.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 16 Aug 2016 23:29:34 -0000 Received: by mail-yw0-f196.google.com with SMTP id r9so4226376ywg.2 for ; Tue, 16 Aug 2016 16:29:34 -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=i3+tWg3Q5C3hfPphYFnKIrmjoudCLZIaI7cRuyAPdNM=; b=hQrsUb2LhtJdSvqk79y3SL7TUeuqS1G1jWe1dquXEuvBbiLLnS4+4/K/EjreTdtS57 H8uW1w8My/nYTWcrqgpzTKC4pC6re9mzonOGYPw44p/UQuOZ6RDfaPVjkHzq7rGfOPV6 1ooakuuJXc/8ryc+3aUxcOBHOibFLFilEpEZE= 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=i3+tWg3Q5C3hfPphYFnKIrmjoudCLZIaI7cRuyAPdNM=; b=OqmoLPhlcnJAqyY40hmsuRpO5JGXqtKHMQ+cKLZ08ODlZ8q+P5tBbqJy6Rr9zIa6Xv nNJS1wxOsgUwNaSVy88zwq2vrF2fgDn/cUDX+IsZ1IKBSZ7IP0f62+gX4ZszrQNvgfM2 l0EMn7lU4Bb6l85fJvexw3kiaVBHQzdtDqhCaq6Jrn5y0Jpsw+KkR4Bi2zWYacuAfMro 448SgzlNmpKF9ttpdiGVZNrkqtGCBEJg6UrQ6KnZkrjulxiXi68KaRxVk6vRA8MrGvvY jnLJlO5Z8Fq3vsNkm/hMsZ7Afw6LM90wiUik9+nCScVncnP21BoR7zQDIlr9xnbmDxF7 qOJw== X-Gm-Message-State: AEkooushIxDy8YQqQrIv4z84f4glzHIgws/l3THU2S3u3JWzgVoBVdDZRaJMJIfEggu+3g== X-Received: by 10.129.82.130 with SMTP id g124mr27981794ywb.208.1471390172917; Tue, 16 Aug 2016 16:29:32 -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.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 Aug 2016 16:29:31 -0700 (PDT) From: Doug Goldstein To: xen-devel@lists.xen.org Date: Tue, 16 Aug 2016 18:28:29 -0500 Message-Id: <1471390109-10407-10-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 9/9] x86/mtrr: use stdbool instead of int + define 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 Instead of using an int and providing a define for TRUE and FALSE, change the code to use stdbool that Xen provides. Signed-off-by: Doug Goldstein --- xen/arch/x86/cpu/mtrr/generic.c | 21 +++++++++++---------- xen/arch/x86/cpu/mtrr/mtrr.h | 5 ----- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/xen/arch/x86/cpu/mtrr/generic.c b/xen/arch/x86/cpu/mtrr/generic.c index 012aca4..2d2eadc 100644 --- a/xen/arch/x86/cpu/mtrr/generic.c +++ b/xen/arch/x86/cpu/mtrr/generic.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -237,7 +238,7 @@ static void mtrr_wrmsr(unsigned int msr, uint64_t msr_content) * \param changed pointer which indicates whether the MTRR needed to be changed * \param msrwords pointer to the MSR values which the MSR should have */ -static void set_fixed_range(int msr, int * changed, unsigned int * msrwords) +static void set_fixed_range(int msr, bool * changed, unsigned int * msrwords) { uint64_t msr_content, val; @@ -246,7 +247,7 @@ static void set_fixed_range(int msr, int * changed, unsigned int * msrwords) if (msr_content != val) { mtrr_wrmsr(msr, val); - *changed = TRUE; + *changed = true; } } @@ -302,10 +303,10 @@ void mtrr_generic_get(unsigned int reg, unsigned long *base, * Checks and updates the fixed-range MTRRs if they differ from the saved set * \param frs pointer to fixed-range MTRR values, saved by get_fixed_ranges() */ -static int set_fixed_ranges(mtrr_type * frs) +static bool set_fixed_ranges(mtrr_type * frs) { unsigned long long *saved = (unsigned long long *) frs; - int changed = FALSE; + bool changed = false; int block=-1, range; while (fixed_range_blocks[++block].ranges) @@ -316,13 +317,13 @@ static int set_fixed_ranges(mtrr_type * frs) return changed; } -/* Set the MSR pair relating to a var range. Returns TRUE if +/* Set the MSR pair relating to a var range. Returns true if changes are made */ -static int set_mtrr_var_ranges(unsigned int index, struct mtrr_var_range *vr) +static bool set_mtrr_var_ranges(unsigned int index, struct mtrr_var_range *vr) { uint32_t lo, hi, base_lo, base_hi, mask_lo, mask_hi; uint64_t msr_content; - int changed = FALSE; + bool changed = false; rdmsrl(MSR_IA32_MTRR_PHYSBASE(index), msr_content); lo = (uint32_t)msr_content; @@ -337,7 +338,7 @@ static int set_mtrr_var_ranges(unsigned int index, struct mtrr_var_range *vr) if ((base_lo != lo) || (base_hi != hi)) { mtrr_wrmsr(MSR_IA32_MTRR_PHYSBASE(index), vr->base); - changed = TRUE; + changed = true; } rdmsrl(MSR_IA32_MTRR_PHYSMASK(index), msr_content); @@ -353,7 +354,7 @@ static int set_mtrr_var_ranges(unsigned int index, struct mtrr_var_range *vr) if ((mask_lo != lo) || (mask_hi != hi)) { mtrr_wrmsr(MSR_IA32_MTRR_PHYSMASK(index), vr->mask); - changed = TRUE; + changed = true; } return changed; } @@ -478,7 +479,7 @@ void mtrr_generic_set(unsigned int reg, unsigned long base, The base address of the region. The size of the region. If this is 0 the region is disabled. The type of the region. - If TRUE, do the change safely. If FALSE, safety measures should + If true, do the change safely. If false, safety measures should be done externally. [RETURNS] Nothing. */ diff --git a/xen/arch/x86/cpu/mtrr/mtrr.h b/xen/arch/x86/cpu/mtrr/mtrr.h index 1a3b1e5..9d55c68 100644 --- a/xen/arch/x86/cpu/mtrr/mtrr.h +++ b/xen/arch/x86/cpu/mtrr/mtrr.h @@ -2,11 +2,6 @@ * local mtrr defines. */ -#ifndef TRUE -#define TRUE 1 -#define FALSE 0 -#endif - #define MTRR_CHANGE_MASK_FIXED 0x01 #define MTRR_CHANGE_MASK_VARIABLE 0x02 #define MTRR_CHANGE_MASK_DEFTYPE 0x04