csky: Use va_pa_offset instead of phys_offset
The name of phys_offset is so common for global export and it may conflict with some local name. So change phys_offset to va_pa_offset which also used by riscv. Also use __pa() and __va() instead of using phys_offset directly. Signed-off-by: Guo Ren <ren_guo@c-sky.com> Cc: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
parent
205353fa06
commit
683fafebf9
|
@ -85,11 +85,11 @@ static inline void tlb_invalid_indexed(void)
|
|||
|
||||
static inline void setup_pgd(unsigned long pgd, bool kernel)
|
||||
{
|
||||
cpwcr("cpcr29", pgd);
|
||||
cpwcr("cpcr29", pgd | BIT(0));
|
||||
}
|
||||
|
||||
static inline unsigned long get_pgd(void)
|
||||
{
|
||||
return cprcr("cpcr29");
|
||||
return cprcr("cpcr29") & ~BIT(0);
|
||||
}
|
||||
#endif /* __ASM_CSKY_CKMMUV1_H */
|
||||
|
|
|
@ -90,18 +90,16 @@ static inline void tlb_invalid_indexed(void)
|
|||
mtcr("cr<8, 15>", 0x02000000);
|
||||
}
|
||||
|
||||
/* setup hardrefil pgd */
|
||||
static inline unsigned long get_pgd(void)
|
||||
{
|
||||
return mfcr("cr<29, 15>");
|
||||
}
|
||||
|
||||
static inline void setup_pgd(unsigned long pgd, bool kernel)
|
||||
{
|
||||
if (kernel)
|
||||
mtcr("cr<28, 15>", pgd);
|
||||
mtcr("cr<28, 15>", pgd | BIT(0));
|
||||
else
|
||||
mtcr("cr<29, 15>", pgd);
|
||||
mtcr("cr<29, 15>", pgd | BIT(0));
|
||||
}
|
||||
|
||||
static inline unsigned long get_pgd(void)
|
||||
{
|
||||
return mfcr("cr<29, 15>") & ~BIT(0);
|
||||
}
|
||||
#endif /* __ASM_CSKY_CKMMUV2_H */
|
||||
|
|
|
@ -14,23 +14,10 @@
|
|||
#include <linux/sched.h>
|
||||
#include <abi/ckmmu.h>
|
||||
|
||||
static inline void tlbmiss_handler_setup_pgd(unsigned long pgd, bool kernel)
|
||||
{
|
||||
pgd -= PAGE_OFFSET;
|
||||
pgd += phys_offset;
|
||||
pgd |= 1;
|
||||
setup_pgd(pgd, kernel);
|
||||
}
|
||||
|
||||
#define TLBMISS_HANDLER_SETUP_PGD(pgd) \
|
||||
tlbmiss_handler_setup_pgd((unsigned long)pgd, 0)
|
||||
setup_pgd(__pa(pgd), false)
|
||||
#define TLBMISS_HANDLER_SETUP_PGD_KERNEL(pgd) \
|
||||
tlbmiss_handler_setup_pgd((unsigned long)pgd, 1)
|
||||
|
||||
static inline unsigned long tlb_get_pgd(void)
|
||||
{
|
||||
return ((get_pgd() - phys_offset) & ~1) + PAGE_OFFSET;
|
||||
}
|
||||
setup_pgd(__pa(pgd), true)
|
||||
|
||||
#define cpu_context(cpu, mm) ((mm)->context.asid[cpu])
|
||||
#define cpu_asid(cpu, mm) (cpu_context((cpu), (mm)) & ASID_MASK)
|
||||
|
|
|
@ -72,13 +72,13 @@ typedef struct page *pgtable_t;
|
|||
#define __pgd(x) ((pgd_t) { (x) })
|
||||
#define __pgprot(x) ((pgprot_t) { (x) })
|
||||
|
||||
extern unsigned long phys_offset;
|
||||
extern unsigned long va_pa_offset;
|
||||
|
||||
#define ARCH_PFN_OFFSET PFN_DOWN(phys_offset + PHYS_OFFSET_OFFSET)
|
||||
#define ARCH_PFN_OFFSET PFN_DOWN(va_pa_offset + PHYS_OFFSET_OFFSET)
|
||||
|
||||
#define __pa(x) ((unsigned long)(x) - PAGE_OFFSET + va_pa_offset)
|
||||
#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET - va_pa_offset))
|
||||
|
||||
#define __pa(x) ((unsigned long)(x) - PAGE_OFFSET + phys_offset)
|
||||
#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET - \
|
||||
phys_offset))
|
||||
#define __pa_symbol(x) __pa(RELOC_HIDE((unsigned long)(x), 0))
|
||||
|
||||
#define MAP_NR(x) PFN_DOWN((unsigned long)(x) - PAGE_OFFSET - \
|
||||
|
|
|
@ -40,7 +40,7 @@ ENTRY(csky_\name)
|
|||
WR_MCIR a2
|
||||
#endif
|
||||
bclri r6, 0
|
||||
lrw a2, phys_offset
|
||||
lrw a2, va_pa_offset
|
||||
ld.w a2, (a2, 0)
|
||||
subu r6, a2
|
||||
bseti r6, 31
|
||||
|
@ -51,7 +51,7 @@ ENTRY(csky_\name)
|
|||
addu r6, a2
|
||||
ldw r6, (r6)
|
||||
|
||||
lrw a2, phys_offset
|
||||
lrw a2, va_pa_offset
|
||||
ld.w a2, (a2, 0)
|
||||
subu r6, a2
|
||||
bseti r6, 31
|
||||
|
|
|
@ -142,8 +142,8 @@ void __init setup_arch(char **cmdline_p)
|
|||
#endif
|
||||
}
|
||||
|
||||
unsigned long phys_offset;
|
||||
EXPORT_SYMBOL(phys_offset);
|
||||
unsigned long va_pa_offset;
|
||||
EXPORT_SYMBOL(va_pa_offset);
|
||||
|
||||
asmlinkage __visible void __init csky_start(unsigned int unused,
|
||||
void *dtb_start)
|
||||
|
@ -151,7 +151,7 @@ asmlinkage __visible void __init csky_start(unsigned int unused,
|
|||
/* Clean up bss section */
|
||||
memset(__bss_start, 0, __bss_stop - __bss_start);
|
||||
|
||||
phys_offset = read_mmu_msa0() & ~(SSEG_SIZE - 1);
|
||||
va_pa_offset = read_mmu_msa0() & ~(SSEG_SIZE - 1);
|
||||
|
||||
pre_trap_init();
|
||||
pre_mmu_init();
|
||||
|
|
|
@ -81,7 +81,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write,
|
|||
|
||||
unsigned long pgd_base;
|
||||
|
||||
pgd_base = tlb_get_pgd();
|
||||
pgd_base = __va(get_pgd());
|
||||
pgd = (pgd_t *)pgd_base + offset;
|
||||
pgd_k = init_mm.pgd + offset;
|
||||
|
||||
|
|
Loading…
Reference in New Issue