|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen staging] x86/mm: short-circuit HVM-only mode flags when !HVM
commit b81813dfb36fde9bd47c2e1b806e368cb9d6cbdb
Author: Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Tue May 14 16:18:58 2019 +0200
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue May 14 16:18:58 2019 +0200
x86/mm: short-circuit HVM-only mode flags when !HVM
#define-ing them to zero allows better code generation in this case,
and paves the way for more DCE, allowing to leave certain functions just
declared, but not defined.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Reviewed-by: Wei Liu <wei.liu2@xxxxxxxxxx>
Reviewed-by: George Dunlap <george.dunlap@xxxxxxxxxx>
---
xen/arch/x86/mm/paging.c | 2 ++
xen/include/asm-x86/paging.h | 14 ++++++++++++--
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c
index 9b0f268e74..011089368a 100644
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -837,7 +837,9 @@ int paging_enable(struct domain *d, u32 mode)
switch ( mode & (PG_external | PG_translate | PG_refcounts) )
{
case 0:
+#if PG_external | PG_translate | PG_refcounts
case PG_external | PG_translate | PG_refcounts:
+#endif
break;
default:
return -EINVAL;
diff --git a/xen/include/asm-x86/paging.h b/xen/include/asm-x86/paging.h
index 0d212d352e..cf57ca708d 100644
--- a/xen/include/asm-x86/paging.h
+++ b/xen/include/asm-x86/paging.h
@@ -46,19 +46,29 @@
#define PG_SH_enable 0
#define PG_SH_forced 0
#endif
+#ifdef CONFIG_HVM
#define PG_HAP_enable (1U << PG_HAP_shift)
+#else
+#define PG_HAP_enable 0
+#endif
/* common paging mode bits */
#define PG_mode_shift 10
+#ifdef CONFIG_HVM
/* Refcounts based on shadow tables instead of guest tables */
#define PG_refcounts (XEN_DOMCTL_SHADOW_ENABLE_REFCOUNT << PG_mode_shift)
-/* Enable log dirty mode */
-#define PG_log_dirty (XEN_DOMCTL_SHADOW_ENABLE_LOG_DIRTY << PG_mode_shift)
/* Xen does p2m translation, not guest */
#define PG_translate (XEN_DOMCTL_SHADOW_ENABLE_TRANSLATE << PG_mode_shift)
/* Xen does not steal address space from the domain for its own booking;
* requires VT or similar mechanisms */
#define PG_external (XEN_DOMCTL_SHADOW_ENABLE_EXTERNAL << PG_mode_shift)
+#else
+#define PG_refcounts 0
+#define PG_translate 0
+#define PG_external 0
+#endif
+/* Enable log dirty mode */
+#define PG_log_dirty (XEN_DOMCTL_SHADOW_ENABLE_LOG_DIRTY << PG_mode_shift)
/* All paging modes. */
#define PG_MASK (PG_refcounts | PG_log_dirty | PG_translate | PG_external)
--
generated by git-patchbot for /home/xen/git/xen.git#staging
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |