The p2m lock is only necessary to prevent gvirt_to_maddr failing when
break-before-make sequence is used in the P2M update concurrently on
another pCPU. So reduce the locking section.
Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
if ( v != current )
return NULL;
+ /*
+ * The lock is here to protect us against the break-before-make
+ * sequence used when updating the entry.
+ */
p2m_read_lock(p2m);
-
par = gvirt_to_maddr(va, &maddr, flags);
+ p2m_read_unlock(p2m);
if ( par )
{
}
err:
- p2m_read_unlock(p2m);
-
if ( !page && p2m->mem_access_enabled )
page = p2m_mem_access_check_and_get_page(va, flags, v);