[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3 26/38] arm/p2m: Introduce helpers managing altp2m entries



Hello Sergej,

On 16/08/2016 23:17, Sergej Proskurin wrote:
This commit introduces the following functions:
* remove_altp2m_entry
* modify_altp2m_entry

These functions are responsible to manage an altp2m view's entries and
their attributes.

Signed-off-by: Sergej Proskurin <proskurin@xxxxxxxxxxxxx>
---
Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>
Cc: Julien Grall <julien.grall@xxxxxxx>
---
v3: Changed the function prototype of "modify_altp2m_entry" and
    "remove_altp2m_entry" to hold arguments of type gfn_t/mfn_t instead
    of addresses.

    Remove the argument of type "struct domain*" from the function's
    prototypes.

    Remove the function "modify_altp2m_range".
---
 xen/arch/arm/p2m.c        | 36 ++++++++++++++++++++++++++++++++++++
 xen/include/asm-arm/p2m.h | 14 ++++++++++++++
 2 files changed, 50 insertions(+)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index ca5ae97..1d3df0f 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -1165,6 +1165,42 @@ void guest_physmap_remove_page(struct domain *d,
     p2m_remove_mapping(p2m_get_hostp2m(d), gfn, (1 << page_order), mfn);
 }

+int remove_altp2m_entry(struct p2m_domain *ap2m,
+                        gfn_t gfn,
+                        mfn_t mfn,
+                        unsigned int page_order)
+{
+    ASSERT(p2m_is_altp2m(ap2m));
+
+    /* Align the gfn and mfn to the given pager order. */
+    gfn = _gfn(gfn_x(gfn) & ~((1UL << page_order)-1));
+    mfn = _mfn(mfn_x(mfn) & ~((1UL << page_order)-1));
+
+    return p2m_remove_mapping(ap2m, gfn, (1UL << page_order), mfn);
+}
+
+int modify_altp2m_entry(struct p2m_domain *ap2m,
+                        gfn_t gfn,
+                        mfn_t mfn,
+                        p2m_type_t t,
+                        p2m_access_t a,
+                        unsigned int page_order)
+{
+    int rc;
+
+    ASSERT(p2m_is_altp2m(ap2m));
+
+    /* Align the gfn and mfn to the given pager order. */
+    gfn = _gfn(gfn_x(gfn) & ~((1UL << page_order)-1));
+    mfn = _mfn(mfn_x(mfn) & ~((1UL << page_order)-1));
+
+    p2m_write_lock(ap2m);
+    rc = p2m_set_entry(ap2m, gfn, (1UL << page_order), mfn, t, a);
+    p2m_write_unlock(ap2m);
+
+    return rc;
+}
+

I don't want to see any altp2m function in p2m.c. The altp2m code should use p2m_set_entry directly with the correct order.

Regards,

--
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.