@@ -1819,7 +1819,7 @@ static void nvcpu_flush(struct vcpu *v)
}
struct p2m_domain *
-p2m_get_nestedp2m(struct vcpu *v)
+p2m_get_nestedp2m_locked(struct vcpu *v)
{
struct nestedvcpu *nv = &vcpu_nestedhvm(v);
struct domain *d = v->domain;
@@ -1844,7 +1844,6 @@ p2m_get_nestedp2m(struct vcpu *v)
nvcpu_flush(v);
p2m->np2m_base = np2m_base;
assign_np2m(v, p2m);
- p2m_unlock(p2m);
nestedp2m_unlock(d);
return p2m;
@@ -1860,12 +1859,19 @@ p2m_get_nestedp2m(struct vcpu *v)
p2m->np2m_base = np2m_base;
nvcpu_flush(v);
assign_np2m(v, p2m);
- p2m_unlock(p2m);
nestedp2m_unlock(d);
return p2m;
}
+struct p2m_domain *p2m_get_nestedp2m(struct vcpu *v)
+{
+ struct p2m_domain *p2m = p2m_get_nestedp2m_locked(v);
+ p2m_unlock(p2m);
+
+ return p2m;
+}
+
struct p2m_domain *
p2m_get_p2m(struct vcpu *v)
{
@@ -364,6 +364,8 @@ struct p2m_domain {
* Updates vCPU's n2pm to match its np2m_base in VMCX12 and returns that np2m.
*/
struct p2m_domain *p2m_get_nestedp2m(struct vcpu *v);
+/* Similar to the above except that returned p2m is still write-locked */
+struct p2m_domain *p2m_get_nestedp2m_locked(struct vcpu *v);
/* If vcpu is in host mode then behaviour matches p2m_get_hostp2m().
* If vcpu is in guest mode then behaviour matches p2m_get_nestedp2m().
The new function returns still write-locked np2m. Signed-off-by: Sergey Dyasli <sergey.dyasli@citrix.com> --- xen/arch/x86/mm/p2m.c | 12 +++++++++--- xen/include/asm-x86/p2m.h | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-)