mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
x86/mm: don't open-code p2m_is_pod()
Replace all comparisons against p2m_populate_on_demand (outside of switch() statements) with the designated predicate. Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Tim Deegan <tim@xen.org>
This commit is contained in:
1 parent
8553b17cc2
commit
c80878c320
5 files changed
+15
-16
No files matched your search
@@ -344,7 +344,7 @@ static int ept_next_level(struct p2m_domain *p2m, bool_t read_only,
|
||||
{
|
||||
int rc;
|
||||
|
||||
if ( e.sa_p2mt == p2m_populate_on_demand )
|
||||
if ( p2m_is_pod(e.sa_p2mt) )
|
||||
return GUEST_TABLE_POD_PAGE;
|
||||
|
||||
if ( read_only )
|
||||
@@ -1071,7 +1071,7 @@ static mfn_t ept_get_entry(struct p2m_domain *p2m,
|
||||
index = gfn_remainder >> (i * EPT_TABLE_ORDER);
|
||||
ept_entry = table + index;
|
||||
|
||||
if ( ept_entry->sa_p2mt == p2m_populate_on_demand )
|
||||
if ( p2m_is_pod(ept_entry->sa_p2mt) )
|
||||
{
|
||||
if ( !(q & P2M_ALLOC) )
|
||||
{
|
||||
@@ -1478,7 +1478,7 @@ static void ept_dump_p2m_table(unsigned char key)
|
||||
ept_entry = table + (gfn_remainder >> order);
|
||||
if ( ret != GUEST_TABLE_MAP_FAILED && is_epte_valid(ept_entry) )
|
||||
{
|
||||
if ( ept_entry->sa_p2mt == p2m_populate_on_demand )
|
||||
if ( p2m_is_pod(ept_entry->sa_p2mt) )
|
||||
printk("gfn: %13lx order: %2d PoD\n", gfn, order);
|
||||
else
|
||||
printk("gfn: %13lx order: %2d mfn: %13lx %c%c%c %c%c%c\n",
|
||||
|
||||
@@ -540,7 +540,7 @@ decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
|
||||
|
||||
p2m->get_entry(p2m, gfn_add(gfn, i), &t, &a, 0, &cur_order, NULL);
|
||||
n = 1UL << min(order, cur_order);
|
||||
if ( t == p2m_populate_on_demand )
|
||||
if ( p2m_is_pod(t) )
|
||||
pod += n;
|
||||
else if ( p2m_is_ram(t) )
|
||||
ram += n;
|
||||
@@ -615,7 +615,7 @@ decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order)
|
||||
if ( order < cur_order )
|
||||
cur_order = order;
|
||||
n = 1UL << cur_order;
|
||||
if ( t == p2m_populate_on_demand )
|
||||
if ( p2m_is_pod(t) )
|
||||
{
|
||||
/* This shouldn't be able to fail */
|
||||
if ( p2m_set_entry(p2m, gfn_add(gfn, i), INVALID_MFN, cur_order,
|
||||
@@ -1329,7 +1329,7 @@ mark_populate_on_demand(struct domain *d, unsigned long gfn_l,
|
||||
|
||||
p2m->get_entry(p2m, gfn_add(gfn, i), &ot, &a, 0, &cur_order, NULL);
|
||||
n = 1UL << min(order, cur_order);
|
||||
if ( ot == p2m_populate_on_demand )
|
||||
if ( p2m_is_pod(ot) )
|
||||
{
|
||||
/* Count how many PoD entries we'll be replacing if successful */
|
||||
pod_count += n;
|
||||
|
||||
@@ -841,7 +841,7 @@ pod_retry_l3:
|
||||
flags = l3e_get_flags(*l3e);
|
||||
if ( !(flags & _PAGE_PRESENT) )
|
||||
{
|
||||
if ( p2m_flags_to_type(flags) == p2m_populate_on_demand )
|
||||
if ( p2m_is_pod(p2m_flags_to_type(flags)) )
|
||||
{
|
||||
if ( q & P2M_ALLOC )
|
||||
{
|
||||
@@ -884,7 +884,7 @@ pod_retry_l2:
|
||||
if ( !(flags & _PAGE_PRESENT) )
|
||||
{
|
||||
/* PoD: Try to populate a 2-meg chunk */
|
||||
if ( p2m_flags_to_type(flags) == p2m_populate_on_demand )
|
||||
if ( p2m_is_pod(p2m_flags_to_type(flags)) )
|
||||
{
|
||||
if ( q & P2M_ALLOC ) {
|
||||
if ( p2m_pod_demand_populate(p2m, gfn_, PAGE_ORDER_2M) )
|
||||
@@ -923,7 +923,7 @@ pod_retry_l1:
|
||||
if ( !(flags & _PAGE_PRESENT) && !p2m_is_paging(l1t) )
|
||||
{
|
||||
/* PoD: Try to populate */
|
||||
if ( l1t == p2m_populate_on_demand )
|
||||
if ( p2m_is_pod(l1t) )
|
||||
{
|
||||
if ( q & P2M_ALLOC ) {
|
||||
if ( p2m_pod_demand_populate(p2m, gfn_, PAGE_ORDER_4K) )
|
||||
@@ -1094,8 +1094,7 @@ static long p2m_pt_audit_p2m(struct p2m_domain *p2m)
|
||||
if ( !(l2e_get_flags(l2e[i2]) & _PAGE_PRESENT) )
|
||||
{
|
||||
if ( (l2e_get_flags(l2e[i2]) & _PAGE_PSE)
|
||||
&& ( p2m_flags_to_type(l2e_get_flags(l2e[i2]))
|
||||
== p2m_populate_on_demand ) )
|
||||
&& p2m_is_pod(p2m_flags_to_type(l2e_get_flags(l2e[i2]))) )
|
||||
entry_count+=SUPERPAGE_PAGES;
|
||||
gfn += 1 << (L2_PAGETABLE_SHIFT - PAGE_SHIFT);
|
||||
continue;
|
||||
@@ -1132,7 +1131,7 @@ static long p2m_pt_audit_p2m(struct p2m_domain *p2m)
|
||||
type = p2m_flags_to_type(l1e_get_flags(l1e[i1]));
|
||||
if ( !(l1e_get_flags(l1e[i1]) & _PAGE_PRESENT) )
|
||||
{
|
||||
if ( type == p2m_populate_on_demand )
|
||||
if ( p2m_is_pod(type) )
|
||||
entry_count++;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -992,7 +992,7 @@ guest_physmap_add_entry(struct domain *d, gfn_t gfn, mfn_t mfn,
|
||||
ASSERT(mfn_valid(omfn));
|
||||
set_gpfn_from_mfn(mfn_x(omfn), INVALID_M2P_ENTRY);
|
||||
}
|
||||
else if ( ot == p2m_populate_on_demand )
|
||||
else if ( p2m_is_pod(ot) )
|
||||
{
|
||||
/* Count how man PoD entries we'll be replacing if successful */
|
||||
pod_count++;
|
||||
|
||||
@@ -1478,7 +1478,7 @@ static int validate_gl4e(struct vcpu *v, void *new_ge, mfn_t sl4mfn, void *se)
|
||||
mfn_t gl3mfn = get_gfn_query_unlocked(d, gfn_x(gl3gfn), &p2mt);
|
||||
if ( p2m_is_ram(p2mt) )
|
||||
sl3mfn = get_shadow_status(d, gl3mfn, SH_type_l3_shadow);
|
||||
else if ( p2mt != p2m_populate_on_demand )
|
||||
else if ( !p2m_is_pod(p2mt) )
|
||||
result |= SHADOW_SET_ERROR;
|
||||
|
||||
#if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC )
|
||||
@@ -1537,7 +1537,7 @@ static int validate_gl3e(struct vcpu *v, void *new_ge, mfn_t sl3mfn, void *se)
|
||||
mfn_t gl2mfn = get_gfn_query_unlocked(d, gfn_x(gl2gfn), &p2mt);
|
||||
if ( p2m_is_ram(p2mt) )
|
||||
sl2mfn = get_shadow_status(d, gl2mfn, SH_type_l2_shadow);
|
||||
else if ( p2mt != p2m_populate_on_demand )
|
||||
else if ( !p2m_is_pod(p2mt) )
|
||||
result |= SHADOW_SET_ERROR;
|
||||
|
||||
#if (SHADOW_OPTIMIZATIONS & SHOPT_OUT_OF_SYNC )
|
||||
@@ -1588,7 +1588,7 @@ static int validate_gl2e(struct vcpu *v, void *new_ge, mfn_t sl2mfn, void *se)
|
||||
mfn_t gl1mfn = get_gfn_query_unlocked(d, gfn_x(gl1gfn), &p2mt);
|
||||
if ( p2m_is_ram(p2mt) )
|
||||
sl1mfn = get_shadow_status(d, gl1mfn, SH_type_l1_shadow);
|
||||
else if ( p2mt != p2m_populate_on_demand )
|
||||
else if ( !p2m_is_pod(p2mt) )
|
||||
result |= SHADOW_SET_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||