Skip to content

Commit a154b5e

Browse files
Vladimir IsaevVVIsaev
authored andcommitted
ARC: Restore PAE40 support
Changes related to commit: ocommit 39cac19 Author: Thomas Gleixner <tglx@linutronix.de> Date: Tue Nov 3 10:27:21 2020 +0100 arc/mm/highmem: Use generic kmap atomic implementation ... are missed from arc64 tree. Restore it. Also introduce ARC_PADDR_BITS to use as a mask in pfn-related macro, because for PAE case PADDR_BITS != VADDR_BITS. Signed-off-by: Vladimir Isaev <isaev@synopsys.com>
1 parent 28c0299 commit a154b5e

File tree

4 files changed

+22
-13
lines changed

4 files changed

+22
-13
lines changed

arch/arc/include/asm/fixmap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ extern void __set_fixmap(enum fixed_addresses idx, phys_addr_t phys,
3434
#else
3535

3636
#define FIXADDR_SIZE PGDIR_SIZE
37-
#define FIXMAP_ADDR(nr) (FIXMAP_BASE + ((nr) << PAGE_SHIFT))
37+
#define FIXADDR_TOP (FIXADDR_START + (FIX_KMAP_END << PAGE_SHIFT))
3838

3939
#endif /* CONFIG_ISA_ARCV3 */
4040

arch/arc/include/asm/highmem.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@
1212
#include <asm/kmap_size.h>
1313
#include <asm/fixmap.h>
1414

15-
#define KM_TYPE_NR ((FIXADDR_SIZE >> PAGE_SHIFT)/NR_CPUS)
15+
16+
#define PKMAP_BASE (FIXADDR_START + FIXADDR_SIZE)
17+
18+
#define FIX_KMAP_SLOTS (KM_MAX_IDX * NR_CPUS)
19+
#define FIX_KMAP_BEGIN (0UL)
20+
#define FIX_KMAP_END ((FIX_KMAP_BEGIN + FIX_KMAP_SLOTS) - 1)
1621

1722
/*
1823
* This should be converted to the asm-generic version, but of course this
@@ -22,7 +27,6 @@
2227
#define __virt_to_fix(x) (((FIXADDR_TOP - ((x) & PAGE_MASK))) >> PAGE_SHIFT)
2328

2429
/* start after fixmap area */
25-
#define PKMAP_BASE (FIXADDR_START + FIXADDR_SIZE)
2630
#define PKMAP_SIZE PGDIR_SIZE
2731
#define LAST_PKMAP (PKMAP_SIZE >> PAGE_SHIFT)
2832
#define LAST_PKMAP_MASK (LAST_PKMAP - 1)

arch/arc/include/asm/pgtable-levels.h

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,18 @@
136136
#define ARC_VADDR_BITS 32
137137
#endif
138138

139+
#if defined(CONFIG_ARC_HAS_PAE40)
140+
#define ARC_PADDR_BITS 40
141+
#elif defined(CONFIG_ARC_MMU_V6_52)
142+
/*
143+
* FIXME: Only 48-bit phy addresses supported for MMUv52 for now.
144+
* Bits 51:48 of address are mapped to 15:12 of entry.
145+
*/
146+
#define ARC_PADDR_BITS 48
147+
#else
148+
#define ARC_PADDR_BITS ARC_VADDR_BITS
149+
#endif
150+
139151
#define PGDIR_SIZE BIT(PGDIR_SHIFT)
140152
#define PGDIR_MASK (~(PGDIR_SIZE - 1))
141153
#define PTRS_PER_PGD BIT(ARC_VADDR_BITS - PGDIR_SHIFT)
@@ -258,15 +270,7 @@ extern void ptw_flush(void *pxx);
258270
#define pte_page(pte) pfn_to_page(pte_pfn(pte))
259271
#define set_pte(ptep, pte) do { (*(ptep)) = (pte); ptw_flush(ptep); } while (0)
260272

261-
#ifdef CONFIG_ARC_MMU_V6_52
262-
/*
263-
* FIXME: Only 48-bit phy addresses supported for MMUv52 for now.
264-
* Bits 51:48 of address are mapped to 15:12 of entry.
265-
*/
266-
#define pte_pfn(pte) ((pte_val(pte) >> PAGE_SHIFT) & ((1UL << (48 - PAGE_SHIFT)) - 1))
267-
#else
268-
#define pte_pfn(pte) ((pte_val(pte) >> PAGE_SHIFT) & ((1UL << (ARC_VADDR_BITS - PAGE_SHIFT)) - 1))
269-
#endif
273+
#define pte_pfn(pte) ((pte_val(pte) >> PAGE_SHIFT) & ((1UL << (ARC_PADDR_BITS - PAGE_SHIFT)) - 1))
270274

271275
#define pfn_pte(pfn, prot) __pte(__pfn_to_phys(pfn) | pgprot_val(prot))
272276
#define mk_pte(page, prot) pfn_pte(page_to_pfn(page), prot)

arch/arc/include/asm/processor.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ extern unsigned long __get_wchan(struct task_struct *p);
141141
#define VMALLOC_SIZE ((CONFIG_ARC_KVADDR_SIZE << 20) - PMD_SIZE * 4)
142142
#define VMALLOC_END (VMALLOC_START + VMALLOC_SIZE)
143143

144-
#define FIXADDR_START (PAGE_OFFSET - FIXMAP_SIZE - PKMAP_SIZE)
144+
#define FIXADDR_START (PAGE_OFFSET - FIXADDR_SIZE - PKMAP_SIZE)
145+
#define PKMAP_BASE (FIXADDR_START + FIXADDR_SIZE)
145146

146147
#endif /* CONFIG_ARC_MMU_V6_* */
147148

0 commit comments

Comments
 (0)