From patchwork Tue Aug 16 23:28:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Douglas Goldstein X-Patchwork-Id: 9284991 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 B6115607FD for ; Tue, 16 Aug 2016 23:32:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A7295286F5 for ; Tue, 16 Aug 2016 23:32:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9C38228788; Tue, 16 Aug 2016 23:32:16 +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 3CD16286F5 for ; Tue, 16 Aug 2016 23:32:16 +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 1bZnnU-0004b4-2f; Tue, 16 Aug 2016 23:29:28 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZnnR-0004ab-St for xen-devel@lists.xen.org; Tue, 16 Aug 2016 23:29:25 +0000 Received: from [85.158.139.211] by server-7.bemta-5.messagelabs.com id 1F/78-05127-5D1A3B75; Tue, 16 Aug 2016 23:29:25 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrKIsWRWlGSWpSXmKPExsVyMXThYd0rCze HGzyfL2ix5ONiFgdGj6O7fzMFMEaxZuYl5VcksGasuvCIseCbQsXT5lmMDYzbpLsYuTiEBCYw Shy+9YgdxGERmMcssevhKlYQR0Kgn1Vi/okHTF2MnEBOjMTpxuMsXYwcQHaFxKlOcZCwkICCx O8Jh5ggJq1gkrj+fz0jSIJNQEPiya8ZbCC2iIC0xLXPl8HizAIlEnvn/wCzhQWcJe6tvMsCYr MIqEq8PTQDzOYVcJS4dO4LG8QuOYkF731AwpwCThJHXzawQ+x1lGheM51tAqPAAkaGVYwaxal FZalFukYmeklFmekZJbmJmTm6hgamermpxcWJ6ak5iUnFesn5uZsYgYFVz8DAuIPx5mS/Q4yS HExKorwzJ24MF+JLyk+pzEgszogvKs1JLT7EKMPBoSTBW7dgc7iQYFFqempFWmYOMMRh0hIcP EoivFEgad7igsTc4sx0iNQpRmOOLb+vrWXi2Db13lomIZa8/LxUKXHeeJBSAZDSjNI8uEGw2L vEKCslzMvIwMAgxFOQWpSbWYIq/4pRnINRSZjXHmQKT2ZeCdy+V0CnMAGdoi+9AeSUkkSElFQ DY7qffGGYW/OmW08F1u79p3XGRO/YucPWh1R/SNnpM13isXww7zHz7NmSCSISEXF3zr7Zcefj Ban7iR0r9TjD2Zcu11z25Ff3fP70+/cbz1vs+br28G719BvvY4+susvhvIWHjy13k1tP5le3Z ZMvugt1OQVc3LV8TlM907nZ19/+u+vbJ/TN/oMSS3FGoqEWc1FxIgA2jls0uAIAAA== X-Env-Sender: cardoe@cardoe.com X-Msg-Ref: server-15.tower-206.messagelabs.com!1471390163!42784125!1 X-Originating-IP: [209.85.161.195] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 14380 invoked from network); 16 Aug 2016 23:29:24 -0000 Received: from mail-yw0-f195.google.com (HELO mail-yw0-f195.google.com) (209.85.161.195) by server-15.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 16 Aug 2016 23:29:24 -0000 Received: by mail-yw0-f195.google.com with SMTP id r9so4226209ywg.2 for ; Tue, 16 Aug 2016 16:29:24 -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=syjZv5lc4mYH87lSO+YqbWF9NMclmm3DGgxsSPUansQ=; b=Zn/9OmZUyomdTQwtwSl4gbx3gAYw34xR5mUjiwglS2Isb45hr3/Pac7Hh51rxFTsYd 5CrU+AVbte6oNWHtHxxyhVQJNSRYgI5pL/k4Ofj2CrjQIKaNqavfA8PJC3XOIs0V8hgp r6yXmQ19jjjSlUz/EMIN/lilybgCK/X8h1ovw= 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=syjZv5lc4mYH87lSO+YqbWF9NMclmm3DGgxsSPUansQ=; b=NS2n7uWy4UTyoZG5YOsDSWEpYTwHnN6ElwKFzunsDyyhIrnuVQkhHpmxGGndq311C2 jzMD/h5IRqUpjYGm/DwDyX2B/XISCpIUFHF23kOTNU+CVnWxYJd+C1MiWz6dNqQJsi/x d4NB5dGYzZiEryvK0DFuosQTZMinLuqCAO9aiU6zBGTRUfemauestzHa4uWBk3s53Hxa hjxOwNQ2tri3m28qNg3UFWpLCABwWkRAct/KAJzaz1LLMCjGhPdlqRBUtcsPlv0hi5y2 rvmh936pe0ltXv/vJycuBmUUO94IybMBJOmgYPdLsjRoX0LgP0HEVwfYmwgz5+sw1prz 2M8g== X-Gm-Message-State: AEkoouvZarJHgQuajtYNso6DQ5o+o/OJqkT2rVlXwBpXvQibskIu5513rL7+8aD+2rtURA== X-Received: by 10.129.98.2 with SMTP id w2mr26884468ywb.313.1471390163158; Tue, 16 Aug 2016 16:29:23 -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.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 Aug 2016 16:29:22 -0700 (PDT) From: Doug Goldstein To: xen-devel@lists.xen.org Date: Tue, 16 Aug 2016 18:28:21 -0500 Message-Id: <1471390109-10407-2-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 1/9] x86/mtrr: prefix fns with mtrr and drop static 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 For the functions that make up the interface to the MTRR code, drop the static keyword and prefix them all with mtrr for improved clarity when they're called outside this file. This also required adjusting or providing function prototypes to make them callable. Signed-off-by: Doug Goldstein --- xen/arch/x86/cpu/mtrr/generic.c | 24 ++++++++++++------------ xen/arch/x86/cpu/mtrr/mtrr.h | 14 ++++++++++---- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/xen/arch/x86/cpu/mtrr/generic.c b/xen/arch/x86/cpu/mtrr/generic.c index 234d2ba..224d231 100644 --- a/xen/arch/x86/cpu/mtrr/generic.c +++ b/xen/arch/x86/cpu/mtrr/generic.c @@ -250,7 +250,7 @@ static void set_fixed_range(int msr, int * changed, unsigned int * msrwords) } } -int generic_get_free_region(unsigned long base, unsigned long size, int replace_reg) +int mtrr_generic_get_free_region(unsigned long base, unsigned long size, int replace_reg) /* [SUMMARY] Get a free MTRR. The starting (base) address of the region. The size (in bytes) of the region. @@ -272,7 +272,7 @@ int generic_get_free_region(unsigned long base, unsigned long size, int replace_ return -ENOSPC; } -static void generic_get_mtrr(unsigned int reg, unsigned long *base, +void mtrr_generic_get(unsigned int reg, unsigned long *base, unsigned long *size, mtrr_type *type) { uint64_t _mask, _base; @@ -448,7 +448,7 @@ static void post_set(void) spin_unlock(&set_atomicity_lock); } -static void generic_set_all(void) +void mtrr_generic_set_all(void) { unsigned long mask, count; unsigned long flags; @@ -471,7 +471,7 @@ static void generic_set_all(void) } -static void generic_set_mtrr(unsigned int reg, unsigned long base, +void mtrr_generic_set(unsigned int reg, unsigned long base, unsigned long size, mtrr_type type) /* [SUMMARY] Set variable MTRR register on the local CPU. The register to set. @@ -514,7 +514,7 @@ static void generic_set_mtrr(unsigned int reg, unsigned long base, local_irq_restore(flags); } -int generic_validate_add_page(unsigned long base, unsigned long size, unsigned int type) +int mtrr_generic_validate_add_page(unsigned long base, unsigned long size, unsigned int type) { unsigned long lbase, last; @@ -549,7 +549,7 @@ int generic_validate_add_page(unsigned long base, unsigned long size, unsigned i } -static int generic_have_wrcomb(void) +int mtrr_generic_have_wrcomb(void) { unsigned long config; rdmsrl(MSR_MTRRcap, config); @@ -565,10 +565,10 @@ int positive_have_wrcomb(void) */ const struct mtrr_ops generic_mtrr_ops = { .use_intel_if = 1, - .set_all = generic_set_all, - .get = generic_get_mtrr, - .get_free_region = generic_get_free_region, - .set = generic_set_mtrr, - .validate_add_page = generic_validate_add_page, - .have_wrcomb = generic_have_wrcomb, + .set_all = mtrr_generic_set_all, + .get = mtrr_generic_get, + .get_free_region = mtrr_generic_get_free_region, + .set = mtrr_generic_set, + .validate_add_page = mtrr_generic_validate_add_page, + .have_wrcomb = mtrr_generic_have_wrcomb, }; diff --git a/xen/arch/x86/cpu/mtrr/mtrr.h b/xen/arch/x86/cpu/mtrr/mtrr.h index b41eb58..619575f 100644 --- a/xen/arch/x86/cpu/mtrr/mtrr.h +++ b/xen/arch/x86/cpu/mtrr/mtrr.h @@ -29,10 +29,16 @@ struct mtrr_ops { int (*have_wrcomb)(void); }; -extern int generic_get_free_region(unsigned long base, unsigned long size, - int replace_reg); -extern int generic_validate_add_page(unsigned long base, unsigned long size, - unsigned int type); +void mtrr_generic_get(unsigned int reg, unsigned long *base, + unsigned long *size, mtrr_type *type); +int mtrr_generic_get_free_region(unsigned long base, unsigned long size, + int replace_reg); +int mtrr_generic_validate_add_page(unsigned long base, unsigned long size, + unsigned int type); +void mtrr_generic_set_all(void); +void mtrr_generic_set(unsigned int reg, unsigned long base, + unsigned long size, mtrr_type type); +int mtrr_generic_have_wrcomb(void); extern const struct mtrr_ops generic_mtrr_ops;