diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2017-07-06 06:53:08 -0400 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2017-08-21 06:13:11 -0400 |
commit | af29678fe785ad79e7386e97b57093482f0dd7c4 (patch) | |
tree | 73fcfd132e409c592abe2c5e57104d060c9adb27 | |
parent | 64c26841b34957ef8f33f7a9e8663aeee59c3ded (diff) |
arm64: Remove the !CONFIG_ARM64_HW_AFDBM alternative code paths
Since the pte handling for hardware AF/DBM works even when the hardware
feature is not present, make the pte accessors implementation permanent
and remove the corresponding #ifdefs. The Kconfig option is kept as it
can still be used to disable the feature at the hardware level.
Reviewed-by: Will Deacon <will.deacon@arm.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
-rw-r--r-- | arch/arm64/include/asm/pgtable.h | 9 | ||||
-rw-r--r-- | arch/arm64/kvm/hyp/s2-setup.c | 2 | ||||
-rw-r--r-- | arch/arm64/mm/fault.c | 2 |
3 files changed, 2 insertions, 11 deletions
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index 0117cbcd62d4..bc4e92337d16 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h | |||
@@ -85,11 +85,7 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; | |||
85 | (__boundary - 1 < (end) - 1) ? __boundary : (end); \ | 85 | (__boundary - 1 < (end) - 1) ? __boundary : (end); \ |
86 | }) | 86 | }) |
87 | 87 | ||
88 | #ifdef CONFIG_ARM64_HW_AFDBM | ||
89 | #define pte_hw_dirty(pte) (pte_write(pte) && !(pte_val(pte) & PTE_RDONLY)) | 88 | #define pte_hw_dirty(pte) (pte_write(pte) && !(pte_val(pte) & PTE_RDONLY)) |
90 | #else | ||
91 | #define pte_hw_dirty(pte) (0) | ||
92 | #endif | ||
93 | #define pte_sw_dirty(pte) (!!(pte_val(pte) & PTE_DIRTY)) | 89 | #define pte_sw_dirty(pte) (!!(pte_val(pte) & PTE_DIRTY)) |
94 | #define pte_dirty(pte) (pte_sw_dirty(pte) || pte_hw_dirty(pte)) | 90 | #define pte_dirty(pte) (pte_sw_dirty(pte) || pte_hw_dirty(pte)) |
95 | 91 | ||
@@ -228,8 +224,7 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, | |||
228 | * hardware updates of the pte (ptep_set_access_flags safely changes | 224 | * hardware updates of the pte (ptep_set_access_flags safely changes |
229 | * valid ptes without going through an invalid entry). | 225 | * valid ptes without going through an invalid entry). |
230 | */ | 226 | */ |
231 | if (IS_ENABLED(CONFIG_ARM64_HW_AFDBM) && | 227 | if (pte_valid(*ptep) && pte_valid(pte)) { |
232 | pte_valid(*ptep) && pte_valid(pte)) { | ||
233 | VM_WARN_ONCE(!pte_young(pte), | 228 | VM_WARN_ONCE(!pte_young(pte), |
234 | "%s: racy access flag clearing: 0x%016llx -> 0x%016llx", | 229 | "%s: racy access flag clearing: 0x%016llx -> 0x%016llx", |
235 | __func__, pte_val(*ptep), pte_val(pte)); | 230 | __func__, pte_val(*ptep), pte_val(pte)); |
@@ -565,7 +560,6 @@ static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot) | |||
565 | return pte_pmd(pte_modify(pmd_pte(pmd), newprot)); | 560 | return pte_pmd(pte_modify(pmd_pte(pmd), newprot)); |
566 | } | 561 | } |
567 | 562 | ||
568 | #ifdef CONFIG_ARM64_HW_AFDBM | ||
569 | #define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS | 563 | #define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS |
570 | extern int ptep_set_access_flags(struct vm_area_struct *vma, | 564 | extern int ptep_set_access_flags(struct vm_area_struct *vma, |
571 | unsigned long address, pte_t *ptep, | 565 | unsigned long address, pte_t *ptep, |
@@ -670,7 +664,6 @@ static inline void pmdp_set_wrprotect(struct mm_struct *mm, | |||
670 | ptep_set_wrprotect(mm, address, (pte_t *)pmdp); | 664 | ptep_set_wrprotect(mm, address, (pte_t *)pmdp); |
671 | } | 665 | } |
672 | #endif | 666 | #endif |
673 | #endif /* CONFIG_ARM64_HW_AFDBM */ | ||
674 | 667 | ||
675 | extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; | 668 | extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; |
676 | extern pgd_t idmap_pg_dir[PTRS_PER_PGD]; | 669 | extern pgd_t idmap_pg_dir[PTRS_PER_PGD]; |
diff --git a/arch/arm64/kvm/hyp/s2-setup.c b/arch/arm64/kvm/hyp/s2-setup.c index b81f4091c909..a81f5e10fc8c 100644 --- a/arch/arm64/kvm/hyp/s2-setup.c +++ b/arch/arm64/kvm/hyp/s2-setup.c | |||
@@ -70,7 +70,7 @@ u32 __hyp_text __init_stage2_translation(void) | |||
70 | * Management in ID_AA64MMFR1_EL1 and enable the feature in VTCR_EL2. | 70 | * Management in ID_AA64MMFR1_EL1 and enable the feature in VTCR_EL2. |
71 | */ | 71 | */ |
72 | tmp = (read_sysreg(id_aa64mmfr1_el1) >> ID_AA64MMFR1_HADBS_SHIFT) & 0xf; | 72 | tmp = (read_sysreg(id_aa64mmfr1_el1) >> ID_AA64MMFR1_HADBS_SHIFT) & 0xf; |
73 | if (IS_ENABLED(CONFIG_ARM64_HW_AFDBM) && tmp) | 73 | if (tmp) |
74 | val |= VTCR_EL2_HA; | 74 | val |= VTCR_EL2_HA; |
75 | 75 | ||
76 | /* | 76 | /* |
diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c index f75ed5c4b994..778d0bb89551 100644 --- a/arch/arm64/mm/fault.c +++ b/arch/arm64/mm/fault.c | |||
@@ -183,7 +183,6 @@ void show_pte(unsigned long addr) | |||
183 | pr_cont("\n"); | 183 | pr_cont("\n"); |
184 | } | 184 | } |
185 | 185 | ||
186 | #ifdef CONFIG_ARM64_HW_AFDBM | ||
187 | /* | 186 | /* |
188 | * This function sets the access flags (dirty, accessed), as well as write | 187 | * This function sets the access flags (dirty, accessed), as well as write |
189 | * permission, and only to a more permissive setting. | 188 | * permission, and only to a more permissive setting. |
@@ -225,7 +224,6 @@ int ptep_set_access_flags(struct vm_area_struct *vma, | |||
225 | flush_tlb_fix_spurious_fault(vma, address); | 224 | flush_tlb_fix_spurious_fault(vma, address); |
226 | return 1; | 225 | return 1; |
227 | } | 226 | } |
228 | #endif | ||
229 | 227 | ||
230 | static bool is_el1_instruction_abort(unsigned int esr) | 228 | static bool is_el1_instruction_abort(unsigned int esr) |
231 | { | 229 | { |