xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: George Dunlap <george.dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Jan Beulich <JBeulich@suse.com>
Subject: [PATCH 2/2] x86/hvm: Fold opt_hap_{2mb, 1gb} into hap_capabilities
Date: Tue, 22 Sep 2015 18:33:03 +0100	[thread overview]
Message-ID: <1442943183-3529-3-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1442943183-3529-1-git-send-email-andrew.cooper3@citrix.com>

This allows all runtime users to simply check hap_has_{2mb,1gb} rather than
having to check opt_hap_{2mb,1gb} as well.

As a result, opt_hap_{2mb,1gb} can move into __initdata.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: George Dunlap <george.dunlap@eu.citrix.com>
---
 xen/arch/x86/hvm/hvm.c |    8 ++++++++
 xen/arch/x86/mm/p2m.c  |   10 ++++------
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index f082b86..6afc344 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -158,9 +158,17 @@ static int __init hvm_enable(void)
         printk("HVM: Hardware Assisted Paging (HAP) detected\n");
         printk("HVM: HAP page sizes: 4kB");
         if ( fns->hap_capabilities & HVM_HAP_SUPERPAGE_2MB )
+        {
             printk(", 2MB%s", opt_hap_2mb ? "" : " [disabled]");
+            if ( !opt_hap_2mb )
+                hvm_funcs.hap_capabilities &= ~HVM_HAP_SUPERPAGE_2MB;
+        }
         if ( fns->hap_capabilities & HVM_HAP_SUPERPAGE_1GB )
+        {
             printk(", 1GB%s", opt_hap_1gb ? "" : " [disabled]");
+            if ( !opt_hap_1gb )
+                hvm_funcs.hap_capabilities &= ~HVM_HAP_SUPERPAGE_1GB;
+        }
         printk("\n");
     }
 
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 9cf7a71..5d2a532 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -41,11 +41,9 @@
 
 #include "mm-locks.h"
 
-/* turn on/off 1GB host page table support for hap, default on */
-bool_t __read_mostly opt_hap_1gb = 1;
+/* turn on/off host superpage page table support for hap, default on */
+bool_t __initdata opt_hap_1gb = 1, __initdata opt_hap_2mb = 1;
 boolean_param("hap_1gb", opt_hap_1gb);
-
-bool_t __read_mostly opt_hap_2mb = 1;
 boolean_param("hap_2mb", opt_hap_2mb);
 
 
@@ -452,9 +450,9 @@ int p2m_set_entry(struct p2m_domain *p2m, unsigned long gfn, mfn_t mfn,
     {
         if ( hap_enabled(d) )
             order = ( (((gfn | mfn_x(mfn) | todo) & ((1ul << PAGE_ORDER_1G) - 1)) == 0) &&
-                      hap_has_1gb && opt_hap_1gb) ? PAGE_ORDER_1G :
+                      hap_has_1gb) ? PAGE_ORDER_1G :
                       ((((gfn | mfn_x(mfn) | todo) & ((1ul << PAGE_ORDER_2M) - 1)) == 0) &&
-                      hap_has_2mb && opt_hap_2mb) ? PAGE_ORDER_2M : PAGE_ORDER_4K;
+                      hap_has_2mb) ? PAGE_ORDER_2M : PAGE_ORDER_4K;
         else
             order = 0;
 
-- 
1.7.10.4

  parent reply	other threads:[~2015-09-22 17:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-22 17:33 [PATCH 0/2] x86/hvm: Improvements to HAP superpage feature detection Andrew Cooper
2015-09-22 17:33 ` [PATCH 1/2] x86/hvm: Refine hap_has_{2mb,1gb} checks Andrew Cooper
2015-09-23  8:47   ` [PATCH 1/2] x86/hvm: Refine hap_has_{2mb, 1gb} checks George Dunlap
2015-09-22 17:33 ` Andrew Cooper [this message]
2015-09-23  8:49   ` [PATCH 2/2] x86/hvm: Fold opt_hap_{2mb, 1gb} into hap_capabilities George Dunlap
2015-09-23 17:53 ` [PATCH 0/2] x86/hvm: Improvements to HAP superpage feature detection Konrad Rzeszutek Wilk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1442943183-3529-3-git-send-email-andrew.cooper3@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).