X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=arch%2Fs390%2Fmm%2Fgmap.c;h=d00e4abb559e10b934276a0b36095e2d98536100;hb=5b6c963bcef5c3a857e3f8ba84aa9380069fc95f;hp=4a1434bc2f0e7b7c8499b8f100792328172ca5c8;hpb=4a49443924731823da2e9b3ae9311b74a34e7ed8;p=deliverable%2Flinux.git 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 @@ -1407,6 +1407,26 @@ static struct gmap *gmap_find_shadow(struct gmap *parent, unsigned long asce, return NULL; } +/** + * gmap_shadow_valid - check if a shadow guest address space matches the + * given properties and is still valid + * @sg: pointer to the shadow guest address space structure + * @asce: ASCE for which the shadow table is requested + * @edat_level: edat level to be used for the shadow translation + * + * Returns 1 if the gmap shadow is still valid and matches the given + * properties, the caller can continue using it. Returns 0 otherwise, the + * caller has to request a new shadow gmap in this case. + * + */ +int gmap_shadow_valid(struct gmap *sg, unsigned long asce, int edat_level) +{ + if (sg->removed) + return 0; + return sg->orig_asce == asce && sg->edat_level == edat_level; +} +EXPORT_SYMBOL_GPL(gmap_shadow_valid); + /** * gmap_shadow - create/find a shadow guest address space * @parent: pointer to the parent gmap