@@ -40,6 +40,11 @@ struct domain;
extern void memory_type_changed(struct domain *);
+typedef enum {
+ p2m_host,
+ p2m_alternate,
+} p2m_class_t;
+
/* Per-p2m-table state */
struct p2m_domain {
/*
@@ -126,6 +131,9 @@ struct p2m_domain {
/* Keeping track on which CPU this p2m was used and for which vCPU */
uint8_t last_vcpu_ran[NR_CPUS];
+
+ /* Choose between: host/alternate. */
+ p2m_class_t p2m_class;
};
/*
@@ -359,6 +367,16 @@ static inline int get_page_and_type(struct page_info *page,
/* get host p2m table */
#define p2m_get_hostp2m(d) (&(d)->arch.p2m)
+static inline bool p2m_is_hostp2m(const struct p2m_domain *p2m)
+{
+ return p2m->p2m_class == p2m_host;
+}
+
+static inline bool p2m_is_altp2m(const struct p2m_domain *p2m)
+{
+ return p2m->p2m_class == p2m_alternate;
+}
+
static inline bool_t p2m_vm_event_sanity_check(struct domain *d)
{
return 1;
This commit adds a p2m class to the struct p2m_domain to distinguish between the host's original p2m and alternate p2m's. The need for this functionality will be shown in the following commits. Signed-off-by: Sergej Proskurin <proskurin@sec.in.tum.de> --- Cc: Stefano Stabellini <sstabellini@kernel.org> Cc: Julien Grall <julien.grall@arm.com> --- v4: Change return type of p2m_is_(hostp2m|altp2m) from bool_t to bool. --- xen/include/asm-arm/p2m.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)