{
p2m_type_t pt;
unsigned long pfn = domctl->u.set_broken_page_p2m.pfn;
- mfn_t mfn = get_gfn_query(d, pfn, &pt);
- if ( unlikely(!mfn_valid(mfn)) || unlikely(!p2m_is_ram(pt)) )
+ if ( !is_hvm_domain(d) )
+ return -EINVAL;
+
+ if ( unlikely(!mfn_valid(get_gfn_query(d, pfn, &pt))) ||
+ unlikely(!p2m_is_ram(pt)) )
ret = -EINVAL;
else
ret = p2m_change_type_one(d, pfn, pt, p2m_ram_broken);
return rc;
}
+#ifdef CONFIG_HVM
/*
* Mark (via clearing the U flag) as needing P2M type re-calculation all valid
* present entries at the targeted level for the passed in GFN range, which is
return err;
}
+#endif /* CONFIG_HVM */
/*
* Handle possibly necessary P2M type re-calculation (U flag clear for a
return (p2m_is_valid(*t) || p2m_is_any_ram(*t)) ? mfn : INVALID_MFN;
}
+#ifdef CONFIG_HVM
+
static void p2m_pt_change_entry_type_global(struct p2m_domain *p2m,
p2m_type_t ot, p2m_type_t nt)
{
return err;
}
+#endif /* CONFIG_HVM */
+
#if P2M_AUDIT
static long p2m_pt_audit_p2m(struct p2m_domain *p2m)
{
p2m->set_entry = p2m_pt_set_entry;
p2m->get_entry = p2m_pt_get_entry;
p2m->recalc = do_recalc;
+#ifdef CONFIG_HVM
p2m->change_entry_type_global = p2m_pt_change_entry_type_global;
p2m->change_entry_type_range = p2m_pt_change_entry_type_range;
+#endif
/* Still too early to use paging_mode_hap(). */
if ( hap_enabled(p2m->domain) )
return 0;
}
+#ifdef CONFIG_HVM
+
static void change_entry_type_global(struct p2m_domain *p2m,
p2m_type_t ot, p2m_type_t nt)
{
change_entry_type_global(hostp2m, ot, nt);
-#ifdef CONFIG_HVM
if ( unlikely(altp2m_active(d)) )
{
unsigned int i;
p2m_unlock(altp2m);
}
}
-#endif
p2m_unlock(hostp2m);
}
-#ifdef CONFIG_HVM
/* There's already a memory_type_changed() in asm/mtrr.h. */
static void _memory_type_changed(struct p2m_domain *p2m)
{
p2m_unlock(hostp2m);
}
-#endif
+
+#endif /* CONFIG_HVM */
int p2m_set_ioreq_server(struct domain *d,
unsigned int flags,
}
#ifdef CONFIG_HVM
+
int
guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn,
unsigned int page_order, p2m_type_t t)
return rc;
}
-#endif
/*
* Modify the p2m type of a single gfn from ot to nt.
change_type_range(hostp2m, start, end, ot, nt);
-#ifdef CONFIG_HVM
if ( unlikely(altp2m_active(d)) )
{
unsigned int i;
p2m_unlock(altp2m);
}
}
-#endif
hostp2m->defer_nested_flush = 0;
if ( nestedhvm_enabled(d) )
p2m_flush_nestedp2m(d);
p2m_unlock(hostp2m);
}
+#endif /* CONFIG_HVM */
+
/*
* Finish p2m type change for gfns which are marked as need_recalc in a range.
* Uses the current p2m's max_mapped_pfn to further clip the invalidation
return rv;
}
+#ifdef CONFIG_HVM
void paging_log_dirty_range(struct domain *d,
unsigned long begin_pfn,
unsigned long nr,
guest_flush_tlb_mask(d, d->dirty_cpumask);
}
+#endif
/*
* Callers must supply log_dirty_ops for the log dirty code to call. This
void (*enable_hardware_log_dirty)(struct p2m_domain *p2m);
void (*disable_hardware_log_dirty)(struct p2m_domain *p2m);
void (*flush_hardware_cached_dirty)(struct p2m_domain *p2m);
+#ifdef CONFIG_HVM
void (*change_entry_type_global)(struct p2m_domain *p2m,
p2m_type_t ot,
p2m_type_t nt);
unsigned long first_gfn,
unsigned long last_gfn);
void (*memory_type_changed)(struct p2m_domain *p2m);
+#endif
void (*write_p2m_entry_pre)(struct domain *d,
unsigned long gfn,
l1_pgentry_t old,