]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
sparc64: Save ADI tags on ADI enabled platforms only
authorKhalid Aziz <khalid.aziz@oracle.com>
Thu, 27 Apr 2017 17:40:04 +0000 (11:40 -0600)
committerAllen Pais <allen.pais@oracle.com>
Tue, 16 May 2017 04:30:55 +0000 (10:00 +0530)
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 <khalid.aziz@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
arch/sparc/include/asm/pgtable_64.h

index e823bdbee6a27aa2bcb4d606aee4eb554b7f54e2..aaac7d29a60593787f7a68a3d08f0394b6ebeab4 100644 (file)
@@ -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;