[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 13/15] xen/arm: p2m: Introduce a new variable removing_mapping in __p2m_set_entry
This is making the code slightly easier to understand. Signed-off-by: Julien Grall <julien.grall@xxxxxxxxxx> --- xen/arch/arm/p2m.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 66d58fabd7..e826f57842 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -792,6 +792,8 @@ static int __p2m_set_entry(struct p2m_domain *p2m, unsigned int target = 3 - (page_order / LPAE_SHIFT); lpae_t *entry, *table, orig_pte; int rc; + /* A mapping is removed if the MFN is invalid. */ + bool removing_mapping = mfn_eq(smfn, INVALID_MFN); /* Convenience aliases */ const unsigned int offsets[4] = { @@ -817,9 +819,9 @@ static int __p2m_set_entry(struct p2m_domain *p2m, { /* * Don't try to allocate intermediate page table if the mapping - * is about to be removed (i.e mfn == INVALID_MFN). + * is about to be removed. */ - rc = p2m_next_level(p2m, mfn_eq(smfn, INVALID_MFN), + rc = p2m_next_level(p2m, removing_mapping, level, &table, offsets[level]); if ( rc == GUEST_TABLE_MAP_FAILED ) { @@ -830,7 +832,7 @@ static int __p2m_set_entry(struct p2m_domain *p2m, * when removing a mapping as it may not exist in the * page table. In this case, just ignore it. */ - rc = mfn_eq(smfn, INVALID_MFN) ? 0 : -ENOENT; + rc = removing_mapping ? 0 : -ENOENT; goto out; } else if ( rc != GUEST_TABLE_NORMAL_PAGE ) @@ -925,7 +927,7 @@ static int __p2m_set_entry(struct p2m_domain *p2m, if ( lpae_is_valid(orig_pte) ) p2m_remove_pte(entry, p2m->clean_pte); - if ( mfn_eq(smfn, INVALID_MFN) ) + if ( removing_mapping ) /* Flush can be deferred if the entry is removed */ p2m->need_flush |= !!lpae_is_valid(orig_pte); else -- 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |