|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 14/23] x86/mm: put nested p2m code under CONFIG_HVM
These functions are only useful for nested hvm, which isn't enabled
when CONFIG_HVM is false.
Enclose relevant code in CONFIG_HVM. Guard np2m_schedule with
nestedhvm_enabled.
Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
xen/arch/x86/domain.c | 6 ++++--
xen/arch/x86/mm/p2m.c | 6 ++++++
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index eb1e93f..a996741 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1689,7 +1689,8 @@ void context_switch(struct vcpu *prev, struct vcpu *next)
{
_update_runstate_area(prev);
vpmu_switch_from(prev);
- np2m_schedule(NP2M_SCHEDLE_OUT);
+ if ( nestedhvm_enabled(prevd) )
+ np2m_schedule(NP2M_SCHEDLE_OUT);
}
if ( is_hvm_domain(prevd) && !list_empty(&prev->arch.hvm_vcpu.tm_list) )
@@ -1756,7 +1757,8 @@ void context_switch(struct vcpu *prev, struct vcpu *next)
/* Must be done with interrupts enabled */
vpmu_switch_to(next);
- np2m_schedule(NP2M_SCHEDLE_IN);
+ if ( nestedhvm_enabled(nextd) )
+ np2m_schedule(NP2M_SCHEDLE_IN);
}
/* Ensure that the vcpu has an up-to-date time base. */
diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 1089b86..c82db32 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -144,6 +144,7 @@ static void p2m_teardown_hostp2m(struct domain *d)
static void p2m_teardown_nestedp2m(struct domain *d)
{
+#ifdef CONFIG_HVM
unsigned int i;
struct p2m_domain *p2m;
@@ -156,10 +157,12 @@ static void p2m_teardown_nestedp2m(struct domain *d)
p2m_free_one(p2m);
d->arch.nested_p2m[i] = NULL;
}
+#endif
}
static int p2m_init_nestedp2m(struct domain *d)
{
+#ifdef CONFIG_HVM
unsigned int i;
struct p2m_domain *p2m;
@@ -176,6 +179,7 @@ static int p2m_init_nestedp2m(struct domain *d)
p2m->write_p2m_entry = nestedp2m_write_p2m_entry;
list_add(&p2m->np2m_list, &p2m_get_hostp2m(d)->np2m_list);
}
+#endif
return 0;
}
@@ -1714,6 +1718,7 @@ void p2m_altp2m_check(struct vcpu *v, uint16_t idx)
p2m_switch_vcpu_altp2m_by_id(v, idx);
}
+#ifdef CONFIG_HVM
static struct p2m_domain *
p2m_getlru_nestedp2m(struct domain *d, struct p2m_domain *p2m)
{
@@ -1969,6 +1974,7 @@ void np2m_schedule(int dir)
p2m_unlock(p2m);
}
}
+#endif
unsigned long paging_gva_to_gfn(struct vcpu *v,
unsigned long va,
--
git-series 0.9.1
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |