aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/mm
diff options
context:
space:
mode:
authorDavid Hildenbrand <dahi@linux.vnet.ibm.com>2016-05-27 12:57:33 -0400
committerChristian Borntraeger <borntraeger@de.ibm.com>2016-06-20 03:55:16 -0400
commit5b6c963bcef5c3a857e3f8ba84aa9380069fc95f (patch)
treeea98bc0e529c3e1b7c305e1710f9ae24d1657752 /arch/s390/mm
parent4a49443924731823da2e9b3ae9311b74a34e7ed8 (diff)
s390/mm: allow to check if a gmap shadow is valid
It will be very helpful to have a mechanism to check without any locks if a given gmap shadow is still valid and matches the given properties. Acked-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Diffstat (limited to 'arch/s390/mm')
-rw-r--r--arch/s390/mm/gmap.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c
index 4a1434bc2f0e..d00e4abb559e 100644
--- a/arch/s390/mm/gmap.c
+++ b/arch/s390/mm/gmap.c
@@ -1408,6 +1408,26 @@ static struct gmap *gmap_find_shadow(struct gmap *parent, unsigned long asce,
1408} 1408}
1409 1409
1410/** 1410/**
1411 * gmap_shadow_valid - check if a shadow guest address space matches the
1412 * given properties and is still valid
1413 * @sg: pointer to the shadow guest address space structure
1414 * @asce: ASCE for which the shadow table is requested
1415 * @edat_level: edat level to be used for the shadow translation
1416 *
1417 * Returns 1 if the gmap shadow is still valid and matches the given
1418 * properties, the caller can continue using it. Returns 0 otherwise, the
1419 * caller has to request a new shadow gmap in this case.
1420 *
1421 */
1422int gmap_shadow_valid(struct gmap *sg, unsigned long asce, int edat_level)
1423{
1424 if (sg->removed)
1425 return 0;
1426 return sg->orig_asce == asce && sg->edat_level == edat_level;
1427}
1428EXPORT_SYMBOL_GPL(gmap_shadow_valid);
1429
1430/**
1411 * gmap_shadow - create/find a shadow guest address space 1431 * gmap_shadow - create/find a shadow guest address space
1412 * @parent: pointer to the parent gmap 1432 * @parent: pointer to the parent gmap
1413 * @asce: ASCE for which the shadow table is created 1433 * @asce: ASCE for which the shadow table is created