|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86/hvm: fold opt_hap_{2mb, 1gb} into hap_capabilities
commit 9cc1346f1c578050d274133dc777000247adfc11
Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Wed Sep 23 11:16:51 2015 +0200
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Sep 23 11:16:51 2015 +0200
x86/hvm: fold opt_hap_{2mb,1gb} into hap_capabilities
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@xxxxxxxxxx>
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: George Dunlap <george.dunlap@xxxxxxxxxx>
---
xen/arch/x86/hvm/hvm.c | 8 ++++++++
xen/arch/x86/mm/p2m.c | 17 ++++++++---------
2 files changed, 16 insertions(+), 9 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 1eda2c8..cf8485e 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -41,14 +41,11 @@
#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);
-
/* Override macros from asm/page.h to make them work with mfn_t */
#undef mfn_to_page
#define mfn_to_page(_m) __mfn_to_page(mfn_x(_m))
@@ -451,10 +448,12 @@ int p2m_set_entry(struct p2m_domain *p2m, unsigned long
gfn, mfn_t mfn,
while ( todo )
{
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 :
- ((((gfn | mfn_x(mfn) | todo) & ((1ul << PAGE_ORDER_2M) -
1)) == 0) &&
- hap_has_2mb && opt_hap_2mb) ? PAGE_ORDER_2M :
PAGE_ORDER_4K;
+ order = (!((gfn | mfn_x(mfn) | todo) &
+ ((1ul << PAGE_ORDER_1G) - 1)) &&
+ hap_has_1gb) ? PAGE_ORDER_1G :
+ (!((gfn | mfn_x(mfn) | todo) &
+ ((1ul << PAGE_ORDER_2M) - 1)) &&
+ hap_has_2mb) ? PAGE_ORDER_2M : PAGE_ORDER_4K;
else
order = 0;
--
generated by git-patchbot for /home/xen/git/xen.git#master
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |