I'd squash this into the emulation patch. Signed-off-by: Janosch Frank <frankja@xxxxxxxxxxxxx> --- arch/s390/mm/pgtable.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c index fe733c763c99..b6402fdae037 100644 --- a/arch/s390/mm/pgtable.c +++ b/arch/s390/mm/pgtable.c @@ -411,6 +411,24 @@ static inline pmd_t pmdp_flush_lazy(struct mm_struct *mm, return old; } +static pmd_t *pmd_alloc_map(struct mm_struct *mm, unsigned long addr) +{ + pgd_t *pgd; + p4d_t *p4d; + pud_t *pud; + pmd_t *pmd; + + pgd = pgd_offset(mm, addr); + p4d = p4d_alloc(mm, pgd, addr); + if (!p4d) + return NULL; + pud = pud_alloc(mm, p4d, addr); + if (!pud) + return NULL; + pmd = pmd_alloc(mm, pud, addr); + return pmd; +} + pmd_t pmdp_xchg_direct(struct mm_struct *mm, unsigned long addr, pmd_t *pmdp, pmd_t new) { @@ -741,7 +759,7 @@ int set_guest_storage_key(struct mm_struct *mm, unsigned long addr, pmd_t *pmdp; pte_t *ptep; - pmdp = (pmd_t *)huge_pte_alloc(mm, addr, HPAGE_SIZE); + pmdp = pmd_alloc_map(mm, addr); if (unlikely(!pmdp)) return -EFAULT; @@ -844,7 +862,7 @@ int reset_guest_reference_bit(struct mm_struct *mm, unsigned long addr) pte_t *ptep; int cc = 0; - pmdp = (pmd_t *)huge_pte_alloc(mm, addr, HPAGE_SIZE); + pmdp = pmd_alloc_map(mm, addr); if (unlikely(!pmdp)) return -EFAULT; @@ -898,7 +916,7 @@ int get_guest_storage_key(struct mm_struct *mm, unsigned long addr, pmd_t *pmdp; pte_t *ptep; - pmdp = (pmd_t *)huge_pte_alloc(mm, addr, HPAGE_SIZE); + pmdp = pmd_alloc_map(mm, addr); if (unlikely(!pmdp)) return -EFAULT; -- 2.14.3 -- To unsubscribe from this list: send the line "unsubscribe linux-s390" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html