Skip to content

Commit 0513ebc

Browse files
committed
Merge tag 'csky-for-linus-5.0-rc6' of git://github.com/c-sky/csky-linux
Pull arch/csky fixes from Guo Ren: "Here are some fixup patches for 5.0-rc6" * tag 'csky-for-linus-5.0-rc6' of git://github.com/c-sky/csky-linux: csky: Fixup dead loop in show_stack csky: Fixup io-range page attribute for mmap("/dev/mem") csky: coding convention: Use task_stack_page csky: Fixup wrong pt_regs size csky: Fixup _PAGE_GLOBAL bit for 610 tlb entry
2 parents 1653c2f + 131aee8 commit 0513ebc

File tree

6 files changed

+31
-6
lines changed

6 files changed

+31
-6
lines changed

arch/csky/include/asm/pgtable.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset_t(address))
4646
#define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT))
4747
#define pte_clear(mm, addr, ptep) set_pte((ptep), \
48-
(((unsigned int)addr&0x80000000)?__pte(1):__pte(0)))
49-
#define pte_none(pte) (!(pte_val(pte)&0xfffffffe))
48+
(((unsigned int) addr & PAGE_OFFSET) ? __pte(_PAGE_GLOBAL) : __pte(0)))
49+
#define pte_none(pte) (!(pte_val(pte) & ~_PAGE_GLOBAL))
5050
#define pte_present(pte) (pte_val(pte) & _PAGE_PRESENT)
5151
#define pte_pfn(x) ((unsigned long)((x).pte_low >> PAGE_SHIFT))
5252
#define pfn_pte(pfn, prot) __pte(((unsigned long long)(pfn) << PAGE_SHIFT) \
@@ -241,6 +241,11 @@ static inline pte_t pte_mkyoung(pte_t pte)
241241

242242
#define pgd_index(address) ((address) >> PGDIR_SHIFT)
243243

244+
#define __HAVE_PHYS_MEM_ACCESS_PROT
245+
struct file;
246+
extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
247+
unsigned long size, pgprot_t vma_prot);
248+
244249
/*
245250
* Macro to make mark a page protection value as "uncacheable". Note
246251
* that "protection" is really a misnomer here as the protection value

arch/csky/include/asm/processor.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ struct thread_struct {
4949
};
5050

5151
#define INIT_THREAD { \
52-
.ksp = (unsigned long) init_thread_union.stack + THREAD_SIZE, \
52+
.ksp = sizeof(init_stack) + (unsigned long) &init_stack, \
5353
.sr = DEFAULT_PSR_VALUE, \
5454
}
5555

@@ -95,7 +95,7 @@ unsigned long get_wchan(struct task_struct *p);
9595
#define KSTK_ESP(tsk) (task_pt_regs(tsk)->usp)
9696

9797
#define task_pt_regs(p) \
98-
((struct pt_regs *)(THREAD_SIZE + p->stack) - 1)
98+
((struct pt_regs *)(THREAD_SIZE + task_stack_page(p)) - 1)
9999

100100
#define cpu_relax() barrier()
101101

arch/csky/kernel/dumpstack.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ void show_stack(struct task_struct *task, unsigned long *stack)
3838
if (task)
3939
stack = (unsigned long *)thread_saved_fp(task);
4040
else
41+
#ifdef CONFIG_STACKTRACE
42+
asm volatile("mov %0, r8\n":"=r"(stack)::"memory");
43+
#else
4144
stack = (unsigned long *)&stack;
45+
#endif
4246
}
4347

4448
show_trace(stack);

arch/csky/kernel/ptrace.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <linux/ptrace.h>
99
#include <linux/regset.h>
1010
#include <linux/sched.h>
11+
#include <linux/sched/task_stack.h>
1112
#include <linux/signal.h>
1213
#include <linux/smp.h>
1314
#include <linux/uaccess.h>
@@ -159,7 +160,7 @@ static int fpr_set(struct task_struct *target,
159160
static const struct user_regset csky_regsets[] = {
160161
[REGSET_GPR] = {
161162
.core_note_type = NT_PRSTATUS,
162-
.n = ELF_NGREG,
163+
.n = sizeof(struct pt_regs) / sizeof(u32),
163164
.size = sizeof(u32),
164165
.align = sizeof(u32),
165166
.get = &gpr_get,

arch/csky/kernel/smp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle)
160160
{
161161
unsigned long mask = 1 << cpu;
162162

163-
secondary_stack = (unsigned int)tidle->stack + THREAD_SIZE - 8;
163+
secondary_stack =
164+
(unsigned int) task_stack_page(tidle) + THREAD_SIZE - 8;
164165
secondary_hint = mfcr("cr31");
165166
secondary_ccr = mfcr("cr18");
166167

arch/csky/mm/ioremap.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,17 @@ void iounmap(void __iomem *addr)
4646
vunmap((void *)((unsigned long)addr & PAGE_MASK));
4747
}
4848
EXPORT_SYMBOL(iounmap);
49+
50+
pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
51+
unsigned long size, pgprot_t vma_prot)
52+
{
53+
if (!pfn_valid(pfn)) {
54+
vma_prot.pgprot |= _PAGE_SO;
55+
return pgprot_noncached(vma_prot);
56+
} else if (file->f_flags & O_SYNC) {
57+
return pgprot_noncached(vma_prot);
58+
}
59+
60+
return vma_prot;
61+
}
62+
EXPORT_SYMBOL(phys_mem_access_prot);

0 commit comments

Comments
 (0)