diff options
| -rw-r--r-- | arch/arm64/mm/mmu.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index 2dbb2c9f1ec1..493ff75670ff 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c | |||
| @@ -933,13 +933,15 @@ int pud_set_huge(pud_t *pudp, phys_addr_t phys, pgprot_t prot) | |||
| 933 | { | 933 | { |
| 934 | pgprot_t sect_prot = __pgprot(PUD_TYPE_SECT | | 934 | pgprot_t sect_prot = __pgprot(PUD_TYPE_SECT | |
| 935 | pgprot_val(mk_sect_prot(prot))); | 935 | pgprot_val(mk_sect_prot(prot))); |
| 936 | pud_t new_pud = pfn_pud(__phys_to_pfn(phys), sect_prot); | ||
| 936 | 937 | ||
| 937 | /* ioremap_page_range doesn't honour BBM */ | 938 | /* Only allow permission changes for now */ |
| 938 | if (pud_present(READ_ONCE(*pudp))) | 939 | if (!pgattr_change_is_safe(READ_ONCE(pud_val(*pudp)), |
| 940 | pud_val(new_pud))) | ||
| 939 | return 0; | 941 | return 0; |
| 940 | 942 | ||
| 941 | BUG_ON(phys & ~PUD_MASK); | 943 | BUG_ON(phys & ~PUD_MASK); |
| 942 | set_pud(pudp, pfn_pud(__phys_to_pfn(phys), sect_prot)); | 944 | set_pud(pudp, new_pud); |
| 943 | return 1; | 945 | return 1; |
| 944 | } | 946 | } |
| 945 | 947 | ||
| @@ -947,13 +949,15 @@ int pmd_set_huge(pmd_t *pmdp, phys_addr_t phys, pgprot_t prot) | |||
| 947 | { | 949 | { |
| 948 | pgprot_t sect_prot = __pgprot(PMD_TYPE_SECT | | 950 | pgprot_t sect_prot = __pgprot(PMD_TYPE_SECT | |
| 949 | pgprot_val(mk_sect_prot(prot))); | 951 | pgprot_val(mk_sect_prot(prot))); |
| 952 | pmd_t new_pmd = pfn_pmd(__phys_to_pfn(phys), sect_prot); | ||
| 950 | 953 | ||
| 951 | /* ioremap_page_range doesn't honour BBM */ | 954 | /* Only allow permission changes for now */ |
| 952 | if (pmd_present(READ_ONCE(*pmdp))) | 955 | if (!pgattr_change_is_safe(READ_ONCE(pmd_val(*pmdp)), |
| 956 | pmd_val(new_pmd))) | ||
| 953 | return 0; | 957 | return 0; |
| 954 | 958 | ||
| 955 | BUG_ON(phys & ~PMD_MASK); | 959 | BUG_ON(phys & ~PMD_MASK); |
| 956 | set_pmd(pmdp, pfn_pmd(__phys_to_pfn(phys), sect_prot)); | 960 | set_pmd(pmdp, new_pmd); |
| 957 | return 1; | 961 | return 1; |
| 958 | } | 962 | } |
| 959 | 963 | ||
