From d803124405755dacaddf9b2bdfd2b32b8fd01b5b Mon Sep 17 00:00:00 2001 From: Khalid Aziz Date: Thu, 27 Apr 2017 11:40:04 -0600 Subject: [PATCH] sparc64: Save ADI tags on ADI enabled platforms only When a page is ready to be swapped out or migrated, kernel saves the ADI tags associated with it. To determine if ADI tags need to be saved for a page, it checks if TTE.MCD bit is set for the page. M7 and newer processors chose to reuse the TTE.CV bit from older processors for TTE.MCD. When the kernel is running on non-ADI capable processors, TTE.MCD bit is actually TTE.CV and it is set on older processors by default for older processors by kernel. This causes kernel to attempt to save the ADI tags for the page using MCD ASIs which are not available on older processors. This causes a data access exception. This patch adds a conditional to save ADI tags only on ADI capable platforms. Orabug: 25961592 Signed-off-by: Khalid Aziz Signed-off-by: Allen Pais --- arch/sparc/include/asm/pgtable_64.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h index e823bdbee6a2..aaac7d29a605 100644 --- a/arch/sparc/include/asm/pgtable_64.h +++ b/arch/sparc/include/asm/pgtable_64.h @@ -1031,7 +1031,7 @@ int remap_pfn_range(struct vm_area_struct *, unsigned long, unsigned long, static inline void arch_do_swap_page(struct mm_struct *mm, unsigned long addr, pte_t pte, pte_t oldpte) { - if (pte_val(pte) & _PAGE_MCD_4V) { + if (adi_state.enabled && (pte_val(pte) & _PAGE_MCD_4V)) { swp_entry_t tmp; pgoff_t swap_off; unsigned long swap_type, version; @@ -1062,7 +1062,7 @@ static inline void arch_do_swap_page(struct mm_struct *mm, unsigned long addr, static inline void arch_unmap_one(struct mm_struct *mm, unsigned long addr, pte_t pte, pte_t oldpte) { - if (pte_val(oldpte) & _PAGE_MCD_4V) { + if (adi_state.enabled & (pte_val(oldpte) & _PAGE_MCD_4V)) { unsigned long version, paddr; paddr = pte_val(oldpte) & _PAGE_PADDR_4V; -- 2.50.1