|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 4/6] xentrace: ARM platform DOMID_XEN mapping support
From: bensanda <ben.sanda@xxxxxxxxxxxxxxx>
Modified xenmem_add_to_physmap_one() to provide support for xentrace on the ARM
platform. Checks for DOMID_XEN added via new function, get_pg_owner, ported
from x86 code base. This provides correct calls to rcu_lock_domain() when
DOMID_XEN is requested. DOMID_XEN checks also adde to skip page to MFN
translation (xentrace sends a MFN dirrectly and so does not need to be
translated).
Signed-off-by: Benjamin Sanda <ben.sanda@xxxxxxxxxxxxxxx>
---
xen/arch/arm/mm.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 54 insertions(+), 2 deletions(-)
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 81f9e2e..b1d834f 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -41,6 +41,7 @@
#include <xen/pfn.h>
struct domain *dom_xen, *dom_io, *dom_cow;
+static struct domain *get_pg_owner(domid_t domid);
/* Static start-of-day pagetables that we use before the allocators
* are up. These are used by all CPUs during bringup before switching
@@ -1099,7 +1100,8 @@ int xenmem_add_to_physmap_one(
{
struct domain *od;
p2m_type_t p2mt;
- od = rcu_lock_domain_by_any_id(foreign_domid);
+ od = get_pg_owner(foreign_domid);
+
if ( od == NULL )
return -ESRCH;
@@ -1132,7 +1134,17 @@ int xenmem_add_to_physmap_one(
return -EINVAL;
}
- mfn = page_to_mfn(page);
+ /* If DOMID_XEN then no page to MFN translation is
+ needed as we already have the MFN directly */
+ if(DOMID_XEN !=od->domain_id)
+ {
+ mfn = page_to_mfn(page);
+ }
+ else
+ {
+ mfn = idx;
+ }
+
t = p2m_map_foreign;
rcu_unlock_domain(od);
@@ -1312,6 +1324,46 @@ void clear_and_clean_page(struct page_info *page)
unmap_domain_page(p);
}
+/* Ported from x86 architecture: checks for special domain requests for
+DOMID_XEN or DOMID_IO which must be handled differently then guest domain
+requests */
+static struct domain *get_pg_owner(domid_t domid)
+{
+ struct domain *pg_owner = NULL, *curr = current->domain;
+
+ if ( likely(domid == DOMID_SELF) )
+ {
+ pg_owner = rcu_lock_current_domain();
+ goto out;
+ }
+
+ if ( unlikely(domid == curr->domain_id) )
+ {
+ goto out;
+ }
+
+ /* check for special domain cases of DOMID_IO or DOMID_XEN which
+ must use rcu_lock_domain() and dom_xen/dom_io as the domid_t */
+ switch ( domid )
+ {
+ case DOMID_IO:
+ pg_owner = rcu_lock_domain(dom_io);
+ break;
+ case DOMID_XEN:
+ pg_owner = rcu_lock_domain(dom_xen);
+ break;
+ default:
+ if ( (pg_owner = rcu_lock_domain_by_id(domid)) == NULL )
+ {
+ break;
+ }
+ break;
+ }
+
+ out:
+ return pg_owner;
+}
+
/*
* Local variables:
* mode: C
--
2.7.2
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |