Commit 683fafeb authored by Guo Ren's avatar Guo Ren
Browse files

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: default avatarGuo Ren <ren_guo@c-sky.com>
Cc: Arnd Bergmann <arnd@arndb.de>
parent 205353fa
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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 */
+6 −8
Original line number Diff line number Diff line
@@ -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 */
+2 −15
Original line number Diff line number Diff line
@@ -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)
+5 −5
Original line number Diff line number Diff line
@@ -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 - \
+2 −2
Original line number Diff line number Diff line
@@ -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
Loading