Re: [PATCH v3 09/33] nds32: Cache and TLB routines

2017-12-13 Thread Guo Ren
On Wed, Dec 13, 2017 at 01:45:02PM +0800, Greentime Hu wrote: > I think it should be fine if an interruption between mtsr_dsb and > tlbop_rwr because this is a optimization by sw. Fine? When there is an unexpected vaddr in SR_TLB_VPN, tlbop_rwr(*pte) will break that vaddr's pfn in the CPU

Re: [PATCH v3 09/33] nds32: Cache and TLB routines

2017-12-13 Thread Guo Ren
On Wed, Dec 13, 2017 at 04:30:41PM +0800, Greentime Hu wrote: > 2017-12-13 16:19 GMT+08:00 Guo Ren <ren_...@c-sky.com>: > > On Wed, Dec 13, 2017 at 01:45:02PM +0800, Greentime Hu wrote: > > > >> I think it should be fine if an interruption between mtsr_

Re: [PATCH v3 09/33] nds32: Cache and TLB routines

2017-12-13 Thread Guo Ren
PN is in a invalid state, no operation happen on tlbop_rwr. Then they are atomic safe ,no spin_lock_irq need. :) Guo Ren

Re: [PATCH v3 07/33] nds32: MMU initialization

2017-12-18 Thread Guo Ren
map(page1) // Mostly vaddr1 = vaddr0 val = vaddr1; //No tlb-miss and it will get page0's val not page1, because last expired vaddr0's entry is left in CPU-MMU-tlb. Best Regards Guo Ren

Re: [PATCH v3 07/33] nds32: MMU initialization

2017-12-18 Thread Guo Ren
On Mon, Dec 18, 2017 at 07:21:30PM +0800, Greentime Hu wrote: > Hi, Guo Ren: > > 2017-12-18 17:08 GMT+08:00 Guo Ren <ren_...@c-sky.com>: > > Hi Greentime, > > > > On Fri, Dec 08, 2017 at 05:11:50PM +0800, Greentime Hu wrote: > > [...] > >> > >

Re: [PATCH v3 09/33] nds32: Cache and TLB routines

2017-12-12 Thread Guo Ren
rruption between "mtsr_dsb" and "tlbop_rwr" and a update_mmu_cache() is invoked again, then an error page mapping is set up in your tlb-buffer when tlbop_rwr is excuted from interrupt. Because it's another addr in NDS32_SR_TLB_VPN. It seems that tlb-hardrefill can help build tlb-buffer mapping, why you update it in this software way? Guo Ren

Re: [PATCH V2 01/19] csky: Build infrastructure

2018-07-01 Thread Guo Ren
Hi Randy, On Sun, Jul 01, 2018 at 02:01:52PM -0700, Randy Dunlap wrote: > Hi, > Just a few comments... > Thx for your review. I'll fixup all of you mentioned and self-check again. Guo Ren

Re: [PATCH V2 07/19] csky: MMU and page table management

2018-07-02 Thread Guo Ren
... Pkmap: 0xff80 – 0xffc0 (4 MB)PTR_PER_PTE = 1024 Vmalloc : 0xf020 – 0xff00 (238 MB) max: 238MB + 256MB + 1GB Lowmem : 0x8000 – 0xf000 (1G + 768 MB) Guo Ren

Re: [PATCH V2 19/19] irqchip: add C-SKY irqchip drivers

2018-07-03 Thread Guo Ren
On Mon, Jul 02, 2018 at 09:27:13PM -0600, Rob Herring wrote: > Commit message needed. Ok > Do you mean "legacy"? Yes, it's from arch/csky/Kconfig.debug, and I'll correct it in next version patch. > It would be better to make this run-time so you can support multiple > platforms in one build.

Re: [PATCH V2 02/19] csky: defconfig

2018-07-03 Thread Guo Ren
e lots of options enabled that I wouldn't > expect you to need. Start with something more minimal for what you > need to boot and support upstream. Ok, I'll clean them up in next version patch. > For a full config, you can use allmodconfig at least to build test. Thx for the tip. Guo Ren

Re: [PATCH V2 01/19] csky: Build infrastructure

2018-07-03 Thread Guo Ren
ption. We want the BUILTIN_DTB for some boards and they don't need change dtb at all. And I just follow other archs BUILTIN_DTB in their Kconfig. eg: xtensa, h8300, mips, nds32, sh, openrisc, arc ... I just keep this in Kconfig.debug and it's not a recommended method. Guo Ren

[PATCH V2 04/19] csky: Exception handling

2018-07-01 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/abiv1/alignment.c | 332 arch/csky/abiv1/inc/abi/entry.h | 152 +++ arch/csky/abiv2/inc/abi/entry.h | 149 +++ arch/csky/include/asm/traps.h | 39 arch/csky/include/asm/unistd.h | 4

[PATCH V2 14/19] csky: User access

2018-07-01 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/include/asm/uaccess.h | 397 arch/csky/lib/usercopy.c| 271 +++ 2 files changed, 668 insertions(+) create mode 100644 arch/csky/include/asm/uaccess.h create mode 100644 arch/csky/lib

[PATCH V2 09/19] csky: VDSO and rt_sigreturn

2018-07-01 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/abiv1/inc/abi/vdso.h | 17 arch/csky/abiv2/inc/abi/vdso.h | 18 + arch/csky/include/asm/vdso.h | 12 ++ arch/csky/kernel/vdso.c| 89 ++ 4 files changed, 136 insertions(+) create mode

[PATCH V2 01/19] csky: Build infrastructure

2018-07-01 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/Kconfig | 211 + arch/csky/Kconfig.debug| 29 + arch/csky/Makefile | 92 ++ arch/csky/abiv1/Makefile | 8 ++ arch/csky/abiv2/Makefile

[PATCH V2 08/19] csky: Process management and Signal

2018-07-01 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/abiv2/fpu.c | 242 ++ arch/csky/abiv2/inc/abi/fpu.h | 219 arch/csky/include/asm/mmu_context.h | 158 ++ arch/csky/include/asm/processor.h | 123 +++ arch/csky

[PATCH V2 19/19] irqchip: add C-SKY irqchip drivers

2018-07-01 Thread Guo Ren
Signed-off-by: Guo Ren --- drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-csky-v1.c | 126 drivers/irqchip/irq-csky-v2.c | 191 + drivers/irqchip/irq-nationalchip.c | 131 + 4 files

[PATCH V2 00/19] C-SKY(csky) Linux Kernel Port

2018-07-01 Thread Guo Ren
4fe csky: cleanup unistd.h 5d2985f csky: cleanup Kconfig and Makefile. 423d97e csky: cancel subdirectories cae2af4 csky: use asm-generic/fcntl.h Guo Ren (19): csky: Build infrastructure csky: defconfig csky: Kernel booting csky: Exception handling csky: System Call csky: Cache and TLB routi

[PATCH V2 07/19] csky: MMU and page table management

2018-07-01 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/abiv1/inc/abi/ckmmu.h| 80 + arch/csky/abiv1/inc/abi/page.h | 26 +++ arch/csky/abiv1/inc/abi/pgtable-bits.h | 36 arch/csky/abiv1/mmap.c | 65 +++ arch/csky/abiv2/inc/abi/ckmmu.h| 88

[PATCH V2 11/19] csky: Atomic operations

2018-07-01 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/include/asm/cmpxchg.h| 68 + arch/csky/include/asm/spinlock.h | 174 + arch/csky/include/asm/spinlock_types.h | 20 arch/csky/kernel/atomic.S | 87 + 4 files

[PATCH V2 16/19] csky: SMP support

2018-07-01 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/include/asm/smp.h | 26 + arch/csky/kernel/smp.c | 256 2 files changed, 282 insertions(+) create mode 100644 arch/csky/include/asm/smp.h create mode 100644 arch/csky/kernel/smp.c diff --git a/arch

[PATCH V2 05/19] csky: System Call

2018-07-01 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/include/asm/syscall.h | 69 + arch/csky/include/asm/syscalls.h| 14 arch/csky/include/uapi/asm/unistd.h | 63 + arch/csky/kernel/syscall.c | 63

[PATCH V2 03/19] csky: Kernel booting

2018-07-01 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/kernel/head.S| 81 ++ arch/csky/kernel/setup.c | 148 + arch/csky/kernel/vmlinux.lds.S | 65 ++ 3 files changed, 294 insertions(+) create mode 100644 arch/csky/kernel

[PATCH V2 15/19] csky: Debug and Ptrace GDB

2018-07-01 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/include/uapi/asm/ptrace.h | 105 + arch/csky/kernel/dumpstack.c| 65 arch/csky/kernel/ptrace.c | 288 3 files changed, 458 insertions(+) create mode 100644 arch/csky/include/uapi

[PATCH V2 18/19] clocksource: add C-SKY clocksource drivers

2018-07-01 Thread Guo Ren
Signed-off-by: Guo Ren --- drivers/clocksource/Makefile | 1 + drivers/clocksource/timer-csky-v1.c | 169 +++ drivers/clocksource/timer-nationalchip.c | 165 ++ 3 files changed, 335 insertions(+) create mode 100644

[PATCH V2 02/19] csky: defconfig

2018-07-01 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/configs/gx66xx_defconfig | 549 + arch/csky/configs/qemu_ck807_defconfig | 541 2 files changed, 1090 insertions(+) create mode 100644 arch/csky/configs/gx66xx_defconfig create mode 100644

[PATCH V2 06/19] csky: Cache and TLB routines

2018-07-01 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/abiv1/cacheflush.c | 51 + arch/csky/abiv1/inc/abi/cacheflush.h | 42 +++ arch/csky/abiv1/inc/abi/tlb.h | 11 ++ arch/csky/abiv2/cacheflush.c | 55 + arch/csky/abiv2/inc/abi/cacheflush.h | 38 ++ arch

[PATCH V2 12/19] csky: ELF and module probe

2018-07-01 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/include/asm/elf.h | 149 arch/csky/kernel/module.c | 82 2 files changed, 231 insertions(+) create mode 100644 arch/csky/include/asm/elf.h create mode 100644 arch/csky/kernel/module.c

[PATCH V2 17/19] csky: Misc headers

2018-07-01 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/abiv1/inc/abi/reg_ops.h | 47 ++ arch/csky/abiv1/inc/abi/regdef.h | 15 ++ arch/csky/abiv2/inc/abi/reg_ops.h | 38 + arch/csky/abiv2/inc/abi/regdef.h | 15 ++ arch/csky/include/asm/bitops.h | 277

[PATCH V2 10/19] csky: IRQ handling

2018-07-01 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/include/asm/irq.h | 10 arch/csky/include/asm/irqflags.h | 49 arch/csky/kernel/irq.c | 31 + 3 files changed, 90 insertions(+) create mode 100644 arch/csky/include/asm

[PATCH V2 13/19] csky: Library functions

2018-07-01 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/abiv1/bswapdi.c | 18 +++ arch/csky/abiv1/bswapsi.c | 15 ++ arch/csky/abiv1/memcpy.S | 344 + arch/csky/abiv2/memcpy.c | 43 ++ arch/csky/include/asm/string.h | 19 +++ arch/csky/kernel

Re: [PATCH V2 19/19] irqchip: add C-SKY irqchip drivers

2018-07-03 Thread Guo Ren
amp; Technology Co.,Ltd. > > See above Ok, stick an empty newline > > + writel_relaxed(expand_byte_to_word(i) + 0x03020100, > > This magic number is the reverse of the above magic. Is that intentional. > > > + reg_base + INTC_SOURCE + i); > > + } > > See above. No magic number and use inline func. > > +static int __init > > +intc_init(struct device_node *node, struct device_node *parent) > > +{ > > + u32 clr = IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN; > > + int ret; > > Aside of that the whole thing might share the code with the other one, but > it might not be worth it. At least this wants to be documented in the > changelog why sharing the code is not useful... Do you mean merge irq-csky-v1.c irq-csky-v2.c irq-nationalchip.c into one file eg: irq-csky.c? Guo Ren

Re: [PATCH V3 22/26] dt-bindings: interrupt-controller: C-SKY SMP intc

2018-09-05 Thread Guo Ren
On Wed, Sep 05, 2018 at 07:45:12PM -0500, Rob Herring wrote: > On Wed, Sep 5, 2018 at 7:09 AM Guo Ren wrote: > > > > Signed-off-by: Guo Ren > > --- > > .../bindings/interrupt-controller/csky,mpintc.txt | 40 > > ++ > > 1 file cha

Re: [PATCH V3 21/26] dt-bindings: interrupt-controller: C-SKY APB intc

2018-09-05 Thread Guo Ren
On Wed, Sep 05, 2018 at 07:43:10PM -0500, Rob Herring wrote: > On Wed, Sep 5, 2018 at 7:10 AM Guo Ren wrote: > > > > Signed-off-by: Guo Ren > > --- > > .../interrupt-controller/csky,apb-intc.txt | 45 > > ++ > > 1 file cha

Re: [PATCH V3 18/26] dt-bindings: csky CPU Bindings

2018-09-05 Thread Guo Ren
On Wed, Sep 05, 2018 at 07:37:50PM -0500, Rob Herring wrote: > On Wed, Sep 5, 2018 at 7:08 AM Guo Ren wrote: > > > > Signed-off-by: Guo Ren > > --- > > Documentation/devicetree/bindings/csky/cpus.txt | 70 > > + > > 1 file cha

Re: [PATCH V3 19/26] dt-bindings: timer: gx6605s SOC timer

2018-09-05 Thread Guo Ren
On Wed, Sep 05, 2018 at 07:47:29PM -0500, Rob Herring wrote: > On Wed, Sep 5, 2018 at 7:09 AM Guo Ren wrote: > > > > Signed-off-by: Guo Ren > > --- > > .../bindings/timer/csky,gx6605s-timer.txt | 46 > > ++ > > 1 file cha

Re: [PATCH V3 06/26] csky: Cache and TLB routines

2018-09-06 Thread Guo Ren
On Thu, Sep 06, 2018 at 04:31:16PM +0200, Arnd Bergmann wrote: > On Wed, Sep 5, 2018 at 2:08 PM Guo Ren wrote: > > > diff --git a/arch/csky/include/asm/io.h b/arch/csky/include/asm/io.h > > new file mode 100644 > > index 000..fcb2142 > > --- /dev/null > &

Re: [PATCH V3 09/26] csky: VDSO and rt_sigreturn

2018-09-06 Thread Guo Ren
On Thu, Sep 06, 2018 at 04:02:42PM +0200, Arnd Bergmann wrote: > On Wed, Sep 5, 2018 at 2:08 PM Guo Ren wrote: > > > + > > + /* > > +* __NR_rt_sigreturn must be 173 > > +* Because gcc/config/csky/linux-unwind.h use hard

Re: [PATCH V3 02/26] csky: defconfig

2018-09-06 Thread Guo Ren
On Thu, Sep 06, 2018 at 03:58:51PM +0200, Arnd Bergmann wrote: > On Wed, Sep 5, 2018 at 2:08 PM Guo Ren wrote: > > > > Signed-off-by: Guo Ren > > --- > > arch/csky/configs/defconfig | 76 > > + > > +CONFIG_USEL

Re: [PATCH V3 05/26] csky: System Call

2018-09-06 Thread Guo Ren
On Thu, Sep 06, 2018 at 04:10:49PM +0200, Arnd Bergmann wrote: > On Wed, Sep 5, 2018 at 2:08 PM Guo Ren wrote: > > > +SYSCALL_DEFINE6(mmap2, > > + unsigned long, addr, > > + unsigned long, len, > > + unsigned long, prot, > > + unsign

Re: [PATCH V3 00/26] C-SKY(csky) Linux Kernel Port

2018-09-07 Thread Guo Ren
On Thu, Sep 06, 2018 at 07:08:18PM -0700, Guenter Roeck wrote: > Hi, > > On Wed, Sep 05, 2018 at 08:07:39PM +0800, Guo Ren wrote: > > This is the 3th version patchset to add the Linux kernel port for > > C-SKY(csky). > > Thanks to everyone who provided feedb

Re: [PATCH V3 19/26] dt-bindings: timer: gx6605s SOC timer

2018-09-07 Thread Guo Ren
On Thu, Sep 06, 2018 at 10:02:29AM +0800, Guo Ren wrote: > On Wed, Sep 05, 2018 at 07:47:29PM -0500, Rob Herring wrote: > > On Wed, Sep 5, 2018 at 7:09 AM Guo Ren wrote: > > > > > > Signed-off-by: Guo Ren > > > --- > > > .../bindin

Re: [PATCH V3 06/26] csky: Cache and TLB routines

2018-09-07 Thread Guo Ren
On Fri, Sep 07, 2018 at 10:14:38AM +0200, Arnd Bergmann wrote: > On Fri, Sep 7, 2018 at 5:04 AM Guo Ren wrote: > > > > On Thu, Sep 06, 2018 at 04:31:16PM +0200, Arnd Bergmann wrote: > > > On Wed, Sep 5, 2018 at 2:08 PM Guo Ren wrote: > > > > > > Can

Re: [PATCH V3 17/26] csky: Misc headers

2018-09-07 Thread Guo Ren
On Fri, Sep 07, 2018 at 10:01:03AM +0200, Arnd Bergmann wrote: > On Fri, Sep 7, 2018 at 7:17 AM Guo Ren wrote: > > > > On Thu, Sep 06, 2018 at 04:16:30PM +0200, Arnd Bergmann wrote: > > > On Wed, Sep 5, 2018 at 2:08 PM Guo Ren wrote: > > > > > > > di

Re: [PATCH V3 13/26] csky: Library functions

2018-09-06 Thread Guo Ren
On Thu, Sep 06, 2018 at 04:24:59PM +0200, Arnd Bergmann wrote: > On Wed, Sep 5, 2018 at 2:08 PM Guo Ren wrote: > > > --- /dev/null > > +++ b/arch/csky/abiv1/memset.c > > @@ -0,0 +1,38 @@ > > +// SPDX-License-Identifier: GPL-2.0 > > +// Copyright (C) 2018

Re: [PATCH V3 13/26] csky: Library functions

2018-09-06 Thread Guo Ren
On Thu, Sep 06, 2018 at 05:50:02PM +0200, Geert Uytterhoeven wrote: > On Thu, Sep 6, 2018 at 4:25 PM Arnd Bergmann wrote: > > On Wed, Sep 5, 2018 at 2:08 PM Guo Ren wrote: > > > --- /dev/null > > > +++ b/arch/csky/abiv1/memset.c > > > @@ -0,0 +1,38

Re: [PATCH V3 17/26] csky: Misc headers

2018-09-06 Thread Guo Ren
On Thu, Sep 06, 2018 at 04:16:30PM +0200, Arnd Bergmann wrote: > On Wed, Sep 5, 2018 at 2:08 PM Guo Ren wrote: > > > diff --git a/arch/csky/boot/dts/qemu.dts b/arch/csky/boot/dts/qemu.dts > > new file mode 100644 > > index 000..d36e4cd > > --- /dev/null > &g

Re: [PATCH V3 21/26] dt-bindings: interrupt-controller: C-SKY APB intc

2018-09-06 Thread Guo Ren
On Thu, Sep 06, 2018 at 03:05:38PM +0200, Arnd Bergmann wrote: > On Thu, Sep 6, 2018 at 4:13 AM Guo Ren wrote: > > > > On Wed, Sep 05, 2018 at 07:43:10PM -0500, Rob Herring wrote: > > > On Wed, Sep 5, 2018 at 7:10 AM Guo Ren wrote: > > >

Re: [PATCH V3 22/26] dt-bindings: interrupt-controller: C-SKY SMP intc

2018-09-07 Thread Guo Ren
er, but in some > cases the SoC integrator put the wrong address in there, so we need to > look up the address in DT anyway. Yes, it's reliable. This interrupt is combined with CPU and not on AXI or APB. Soc just give a hole in the address space and tell the CPU where the address is with 20 wire-signals. Guo Ren

Re: [PATCH V3 10/26] csky: IRQ handling

2018-09-10 Thread Guo Ren
On Thu, Sep 06, 2018 at 03:39:01PM +0200, Thomas Gleixner wrote: > On Wed, 5 Sep 2018, Guo Ren wrote: > > > +static void (*handle_arch_irq)(struct pt_regs *regs) = NULL; > > + > > +void __init set_handle_irq(void (*handle_irq)(struct pt_regs *)) > >

Re: [PATCH V3 21/26] dt-bindings: interrupt-controller: C-SKY APB intc

2018-09-07 Thread Guo Ren
On Fri, Sep 07, 2018 at 10:13:13AM -0500, Rob Herring wrote: > On Thu, Sep 6, 2018 at 8:05 AM Arnd Bergmann wrote: > > > > On Thu, Sep 6, 2018 at 4:13 AM Guo Ren wrote: > > > > > > On Wed, Sep 05, 2018 at 07:43:10PM -0500, Rob Herring wrote: > > > >

Re: [PATCH V3 06/26] csky: Cache and TLB routines

2018-09-07 Thread Guo Ren
On Fri, Sep 07, 2018 at 04:13:35PM +0200, Arnd Bergmann wrote: > On Fri, Sep 7, 2018 at 2:55 PM Guo Ren wrote: > > > > On Fri, Sep 07, 2018 at 10:14:38AM +0200, Arnd Bergmann wrote: > > > On Fri, Sep 7, 2018 at 5:04 AM Guo Ren wrote: > > > > On Thu, Se

[PATCH V3 18/26] dt-bindings: csky CPU Bindings

2018-09-05 Thread Guo Ren
Signed-off-by: Guo Ren --- Documentation/devicetree/bindings/csky/cpus.txt | 70 + 1 file changed, 70 insertions(+) create mode 100644 Documentation/devicetree/bindings/csky/cpus.txt diff --git a/Documentation/devicetree/bindings/csky/cpus.txt b/Documentation

[PATCH V3 01/26] csky: Build infrastructure

2018-09-05 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/Kconfig | 230 + arch/csky/Kconfig.debug| 14 ++ arch/csky/Makefile | 93 + arch/csky/abiv1/Makefile | 8 ++ arch/csky/abiv2/Makefile

[PATCH V3 08/26] csky: Process management and Signal

2018-09-05 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/abiv2/fpu.c | 281 + arch/csky/abiv2/inc/abi/fpu.h | 66 ++ arch/csky/include/asm/mmu_context.h | 148 ++ arch/csky/include/asm/processor.h | 120 +++ arch/csky/include/asm

[PATCH V3 03/26] csky: Kernel booting

2018-09-05 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/kernel/head.S| 78 + arch/csky/kernel/setup.c | 150 + arch/csky/kernel/vmlinux.lds.S | 64 ++ 3 files changed, 292 insertions(+) create mode 100644 arch/csky/kernel

[PATCH V3 02/26] csky: defconfig

2018-09-05 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/configs/defconfig | 76 + 1 file changed, 76 insertions(+) create mode 100644 arch/csky/configs/defconfig diff --git a/arch/csky/configs/defconfig b/arch/csky/configs/defconfig new file mode 100644 index 000

[PATCH V3 24/26] clocksource: add C-SKY SMP timer

2018-09-05 Thread Guo Ren
This timer is used by SMP system and use mfcr/mtcr instruction to access the regs. Changelog: - Support csky mp timer alpha version. - Just use low-counter with 32bit width as clocksource. - Coding convention with upstream feed-back. Signed-off-by: Guo Ren --- drivers/clocksource

[PATCH V3 16/26] csky: SMP support

2018-09-05 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/include/asm/smp.h | 26 + arch/csky/kernel/smp.c | 234 2 files changed, 260 insertions(+) create mode 100644 arch/csky/include/asm/smp.h create mode 100644 arch/csky/kernel/smp.c diff --git a/arch

[PATCH V3 19/26] dt-bindings: timer: gx6605s SOC timer

2018-09-05 Thread Guo Ren
Signed-off-by: Guo Ren --- .../bindings/timer/csky,gx6605s-timer.txt | 46 ++ 1 file changed, 46 insertions(+) create mode 100644 Documentation/devicetree/bindings/timer/csky,gx6605s-timer.txt diff --git a/Documentation/devicetree/bindings/timer/csky,gx6605s

[PATCH V3 26/26] irqchip: add C-SKY irqchip drivers

2018-09-05 Thread Guo Ren
instead of leagcy. - add set_handle_irq(), ref from openrisc & arm. Signed-off-by: Guo Ren --- drivers/irqchip/Makefile| 1 + drivers/irqchip/irq-csky-apb-intc.c | 243 drivers/irqchip/irq-csky-mpintc.c | 191 +++

[PATCH V3 25/26] clocksource: add C-SKY timers' build infrastructure

2018-09-05 Thread Guo Ren
Signed-off-by: Guo Ren --- drivers/clocksource/Kconfig | 15 +++ drivers/clocksource/Makefile | 2 ++ 2 files changed, 17 insertions(+) diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index dec0dd8..6ff0a25 100644 --- a/drivers/clocksource/Kconfig +++ b

[PATCH V3 09/26] csky: VDSO and rt_sigreturn

2018-09-05 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/abiv1/inc/abi/vdso.h | 17 arch/csky/abiv2/inc/abi/vdso.h | 24 arch/csky/include/asm/vdso.h | 12 ++ arch/csky/kernel/vdso.c| 88 ++ 4 files changed, 141 insertions(+) create mode

[PATCH V3 14/26] csky: User access

2018-09-05 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/include/asm/uaccess.h | 396 arch/csky/lib/usercopy.c| 271 +++ 2 files changed, 667 insertions(+) create mode 100644 arch/csky/include/asm/uaccess.h create mode 100644 arch/csky/lib

[PATCH V3 00/26] C-SKY(csky) Linux Kernel Port

2018-09-05 Thread Guo Ren
k Kconfig select. 590c7e6 csky: bugfix compile error with CONFIG_AUDIT 1989292 csky: revert some back with cleanup unistd.h f1454fe csky: cleanup unistd.h 5d2985f csky: cleanup Kconfig and Makefile. 423d97e csky: cancel subdirectories cae2af4 csky: use asm-generic/fcntl.h Guo Ren (26): csky: Build i

[PATCH V3 20/26] dt-bindings: timer: C-SKY Multi-processor timer

2018-09-05 Thread Guo Ren
Signed-off-by: Guo Ren --- .../devicetree/bindings/timer/csky,mptimer.txt | 46 ++ 1 file changed, 46 insertions(+) create mode 100644 Documentation/devicetree/bindings/timer/csky,mptimer.txt diff --git a/Documentation/devicetree/bindings/timer/csky,mptimer.txt b

[PATCH V3 11/26] csky: Atomic operations

2018-09-05 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/include/asm/atomic.h | 215 + arch/csky/include/asm/cmpxchg.h| 70 arch/csky/include/asm/spinlock.h | 286 + arch/csky/include/asm/spinlock_types.h | 35 arch/csky

[PATCH V3 15/26] csky: Debug and Ptrace GDB

2018-09-05 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/include/asm/bug.h | 26 +++ arch/csky/include/uapi/asm/ptrace.h | 103 arch/csky/kernel/dumpstack.c| 64 arch/csky/kernel/ptrace.c | 317 4 files changed, 510 insertions

[PATCH V3 12/26] csky: ELF and module probe

2018-09-05 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/include/asm/elf.h | 149 arch/csky/kernel/module.c | 82 2 files changed, 231 insertions(+) create mode 100644 arch/csky/include/asm/elf.h create mode 100644 arch/csky/kernel/module.c

[PATCH V3 22/26] dt-bindings: interrupt-controller: C-SKY SMP intc

2018-09-05 Thread Guo Ren
Signed-off-by: Guo Ren --- .../bindings/interrupt-controller/csky,mpintc.txt | 40 ++ 1 file changed, 40 insertions(+) create mode 100644 Documentation/devicetree/bindings/interrupt-controller/csky,mpintc.txt diff --git a/Documentation/devicetree/bindings/interrupt

[PATCH V3 17/26] csky: Misc headers

2018-09-05 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/abiv1/inc/abi/reg_ops.h | 26 +++ arch/csky/abiv1/inc/abi/regdef.h | 25 +++ arch/csky/abiv2/inc/abi/reg_ops.h | 17 ++ arch/csky/abiv2/inc/abi/regdef.h | 26 +++ arch/csky/boot/dts/qemu.dts| 77 + arch/csky

[PATCH V3 05/26] csky: System Call

2018-09-05 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/include/asm/syscall.h | 69 + arch/csky/include/asm/syscalls.h| 14 arch/csky/include/uapi/asm/unistd.h | 10 ++ arch/csky/kernel/syscall.c | 63 + arch/csky

[PATCH V3 23/26] clocksource: add gx6605s SOC system timer

2018-09-05 Thread Guo Ren
Changelog: - Add License and Copyright - Use timer-of framework - Change name with upstream feedback - Use clksource_mmio framework Signed-off-by: Guo Ren --- drivers/clocksource/timer-gx6605s.c | 150 1 file changed, 150 insertions(+) create mode

[PATCH V3 10/26] csky: IRQ handling

2018-09-05 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/include/asm/irq.h | 10 arch/csky/include/asm/irqflags.h | 49 arch/csky/kernel/irq.c | 31 + 3 files changed, 90 insertions(+) create mode 100644 arch/csky/include/asm

[PATCH V3 04/26] csky: Exception handling

2018-09-05 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/abiv1/alignment.c | 331 + arch/csky/abiv1/inc/abi/entry.h | 159 arch/csky/abiv2/inc/abi/entry.h | 157 arch/csky/include/asm/traps.h | 39 arch/csky/include/asm/unistd.h | 3

[PATCH V3 07/26] csky: MMU and page table management

2018-09-05 Thread Guo Ren
: 0xf020 – 0xff00 (238 MB) Lowmem : 0x8000 – 0xc000 (1GB) Lowmem is directly mapped by msa0 & msa1 reg, and we needn't setup page-table for it. Signed-off-by: Guo Ren --- arch/csky/abiv1/inc/abi/ckmmu.h| 74 arch/csky/abiv1/inc/abi/pa

[PATCH V3 13/26] csky: Library functions

2018-09-05 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/abiv1/bswapdi.c| 18 ++ arch/csky/abiv1/bswapsi.c| 14 ++ arch/csky/abiv1/inc/abi/string.h | 13 ++ arch/csky/abiv1/memcpy.S | 344 +++ arch/csky/abiv1/memset.c | 38 + arch/csky

[PATCH V3 06/26] csky: Cache and TLB routines

2018-09-05 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/abiv1/cacheflush.c | 50 arch/csky/abiv1/inc/abi/cacheflush.h | 41 +++ arch/csky/abiv1/inc/abi/tlb.h | 11 ++ arch/csky/abiv2/cacheflush.c | 54 + arch/csky/abiv2/inc/abi/cacheflush.h | 38 ++ arch

[PATCH V3 21/26] dt-bindings: interrupt-controller: C-SKY APB intc

2018-09-05 Thread Guo Ren
Signed-off-by: Guo Ren --- .../interrupt-controller/csky,apb-intc.txt | 45 ++ 1 file changed, 45 insertions(+) create mode 100644 Documentation/devicetree/bindings/interrupt-controller/csky,apb-intc.txt diff --git a/Documentation/devicetree/bindings/interrupt

Re: [PATCH V2 18/19] clocksource: add C-SKY clocksource drivers

2018-07-04 Thread Guo Ren
On Wed, Jul 04, 2018 at 04:35:43PM +0200, Thomas Gleixner wrote: > On Wed, 4 Jul 2018, Guo Ren wrote: > > On Tue, Jul 03, 2018 at 11:39:05AM +0200, Thomas Gleixner wrote: > > > > +static inline u64 get_ccvr(void) > > > > +{ > > > > +

Re: [PATCH V2 05/19] csky: System Call

2018-07-04 Thread Guo Ren
call_table.c: > > #define sys_fadvise64_64 csky_fadvise64_64 Thx for the tip :) Guo Ren

Re: [PATCH V2 18/19] clocksource: add C-SKY clocksource drivers

2018-07-04 Thread Guo Ren
+ > > +static u64 notrace nc_sched_clock_read(void) > > +{ > > + void __iomem *base; > > + > > + base = timer_of_base() + CLKSRC_OFFSET; > > + > > + return (u64) readl_relaxed(base + TIMER_VALUE); > > +} > > + > > +static void nc_timer_set_div(void __iomem *base) > > +{ > > + unsigned int div; > > + > > + div = timer_of_rate()/TIMER_FREQ - 1; > > space ' / ' > > Is it > (timer_of_rate() / TIMER_FREQ) - 1 > or > timer_of_rate() / (TIMER_FREQ - 1) > > ? Thx, I'll modify it like this: div = (timer_of_rate() / TIMER_FREQ) - 1; > > + clocksource_mmio_init(base + TIMER_VALUE, "nationalchip", TIMER_FREQ, > > 200, 32, > > + clocksource_mmio_readl_up); > > return code check ? Ok, add return code check. > > +TIMER_OF_DECLARE(nc_timer, "nationalchip,timer-v1", nc_timer_init); > > same comment than cksy timer. Ok. Guo Ren

Re: [PATCH V2 19/19] irqchip: add C-SKY irqchip drivers

2018-07-04 Thread Guo Ren
On Wed, Jul 04, 2018 at 08:43:29AM +0200, Thomas Gleixner wrote: > > Do you mean merge irq-csky-v1.c irq-csky-v2.c irq-nationalchip.c into > > one file eg: irq-csky.c? > > Yes, but only if there is enough code to share without creating an ifdef > mess. But that looks doabl

Re: [PATCH V2 13/19] csky: Library functions

2018-07-04 Thread Guo Ren
On Tue, Jul 03, 2018 at 10:04:57PM +0200, Arnd Bergmann wrote: > It's better to avoid relying on libgcc here. Please use the > CONFIG_GENERIC_LIB_ASHLDI3/ASHRDI3/LSHRDI3/etc > helpers that we already have in the kernel. Ok, I'll try Guo Ren

Re: [PATCH V2 05/19] csky: System Call

2018-07-04 Thread Guo Ren
g_struct { > > + unsigned long addr; > > + unsigned long len; > > + unsigned long prot; > > + unsigned long flags; > > + unsigned long fd; > > + unsigned long offset; > > +}; > > + > > +SYSCALL_DEFINE1(mmap, > > + struct mmap_arg_struct *, arg) > > +{ > > + struct mmap_arg_struct a; > > + > > + if (copy_from_user(, arg, sizeof(a))) > > + return -EINVAL; > > + > > + if (unlikely(a.offset & ~PAGE_MASK)) > > + return -EINVAL; > > + > > + return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, > > a.offset >> PAGE_SHIFT); > > +} > > This can be removed since there is mmap2() Ok. Guo Ren

Re: [PATCH V2 01/19] csky: Build infrastructure

2018-07-04 Thread Guo Ren
; > +generic-y += auxvec.h > > You should not need asm/auxvec.h or uapi/asm/auxvec.h Ok. > > +generic-y += bug.h > > providing your own bug.h might be helpful too. > Have a look Ok. > > +generic-y += cputime.h > > asm-generic/cputime.h no loinger exists Ok, remove it. > > +generic-y += kvm_para.h > > Do you support KVM? No, remove it, thx. > > +generic-y += sizes.h > > Deprecated and should not be needed Ok, remove it. Guo Ren

Re: [PATCH V2 18/19] clocksource: add C-SKY clocksource drivers

2018-07-04 Thread Guo Ren
csky_timer_dying_cpu); > > Oh no. Just picking a random hotplug event is not how it works. Add your > own please and make sure it's at the proper place. like this? include/linux/cpuhotplug.h: CPUHP_AP_KVM_ARM_TIMER_STARTING, + CPUHP_AP_CSKY_TIMER_STARTING, /* Must be the last timer callback */ CPUHP_AP_DUMMY_TIMER_STARTING, > > + struct clock_event_device *ce = (struct clock_event_device *) dev; > > Pointless type cast. Ok. struct clock_event_device *ce = dev; > > + .flags = IRQF_TIMER | IRQF_IRQPOLL, > > + }, > > See above Ok, tabular Guo Ren

Re: [PATCH V2 16/19] csky: SMP support

2018-07-06 Thread Guo Ren
gt;"); > > + tmp |= 1 << cpu; > > + mtcr("cr<29, 0>", tmp); > > + > > + while (!cpu_online(cpu)); > > + > > + secondary_stack = 0; > > + > > + return 0; > > +} > > I don't see a start address being setup here, so I assume that CPUs branch to > a > fixed address out-of-reset. Does that mean that the kernel has to be loaded at > a particular physical address on a given platform? No, not a fixed address. I put it arch/csky/kernel/traps.c:79-83 trap_init() #ifdef CONFIG_SMP mtcr("cr<28, 0>", virt_to_phys(vec_base)); VEC_INIT(VEC_RESET, (void *)virt_to_phys(_start_smp_secondary)); #endi Guo Ren

Re: [PATCH V2 11/19] csky: Atomic operations

2018-07-06 Thread Guo Ren
On Thu, Jul 05, 2018 at 08:00:08PM +0200, Peter Zijlstra wrote: > On Mon, Jul 02, 2018 at 01:30:14AM +0800, Guo Ren wrote: > > +#ifdef CONFIG_CPU_HAS_LDSTEX > > +ENTRY(csky_cmpxchg) > > + USPTOKSP > > + mfcra3, epc > > + INCTRAP a3 > > + > >

Re: [PATCH V2 11/19] csky: Atomic operations

2018-07-06 Thread Guo Ren
On Thu, Jul 05, 2018 at 07:50:59PM +0200, Peter Zijlstra wrote: > On Mon, Jul 02, 2018 at 01:30:14AM +0800, Guo Ren wrote: > > > +#include > > + > > +#defi

Re: [PATCH V2 11/19] csky: Atomic operations

2018-07-06 Thread Guo Ren
On Thu, Jul 05, 2018 at 07:59:02PM +0200, Peter Zijlstra wrote: > On Mon, Jul 02, 2018 at 01:30:14AM +0800, Guo Ren wrote: > > > +static inline void arch_spin_lock(arch_spinlock_t *lock) > > +{ > > + unsigned int *p = >lock; > > + unsigned in

Re: [PATCH V2 16/19] csky: SMP support

2018-07-06 Thread Guo Ren
On Fri, Jul 06, 2018 at 11:39:32AM +0200, Peter Zijlstra wrote: > On Fri, Jul 06, 2018 at 02:07:40PM +0800, Guo Ren wrote: > > > > Please explain those mb()'s... I'm thinking you meant to use smp_mb(). > > Yes, smp_mb(). Current smp_mb()() is the same: sync.is. > >

Re: [PATCH V2 11/19] csky: Atomic operations

2018-07-06 Thread Guo Ren
On Fri, Jul 06, 2018 at 02:05:32PM +0200, Peter Zijlstra wrote: > On Fri, Jul 06, 2018 at 07:48:12PM +0800, Guo Ren wrote: > > On Thu, Jul 05, 2018 at 08:00:08PM +0200, Peter Zijlstra wrote: > > > On Mon, Jul 02, 2018 at 01:30:14AM +0800, Guo Ren wrote: > > > >

Re: [PATCH V2 11/19] csky: Atomic operations

2018-07-06 Thread Guo Ren
tch. > > If you need inspiration, look at: > arch/arm/include/asm/spinlock.h > > Or look at the current version of that file and ignore the LSE version. > > Note that unlock is a store half-word (u16), not having seen your arch > manual yet I don't know if you even have that. Nice tips, thank you very much. Guo Ren

Re: [PATCH V2 16/19] csky: SMP support

2018-07-06 Thread Guo Ren
anism architectual for C-SKY SMP. There is no another way in future and SOC vendor couldn't change it. > You probably want to use an enable-method property to describe this. No, thx. Guo Ren

Re: [PATCH V2 11/19] csky: Atomic operations

2018-07-07 Thread Guo Ren
(x); WRITE_ONCE(y, 1); > r2 = xchg(, 2); smp_store_release(, 1); > > must not allow: r1==1 && r2==0 CPU1 smp_store_release could be finished before WRITE_ONCE, so r1=1 && r2=0? > > > The above implementation suggests LDEX implies a SYNC.IS, is this > > > correct? > > No, ldex doesn't imply a sync.is. > > Right, as per the spinlock emails, then your proposed primitives are > incorrect. Yes, approve. Guo Ren

Re: [PATCH V2 11/19] csky: Atomic operations

2018-07-07 Thread Guo Ren
the smp_mb(); r = READ_ONCE(); with r = xchg() to > again see why you need that first smp_mb()). CPU0CPU1 WRITE_ONCE(x, 1)WRITE_ONCE(y, 1) r0 = xchg(, 2)r1 = xchg(, 2) must not allow: r0==0 && r1==0 So we must add a smp_mb between WRITE_ONCE() and xchg(), right? Guo Ren

Re: [PATCH V2 16/19] csky: SMP support

2018-07-07 Thread Guo Ren
vailable. > > You probably also want a mapping from Linux logical CPU id to your > physical CPU id, and a sanity check on this. See arm64 for an example. Yes, you are right. Reg property could determine which bit of CPU in cr<0, 29> could be booted. Thx for the tips. Guo Ren

Re: [PATCH V2 06/19] csky: Cache and TLB routines

2018-07-07 Thread Guo Ren
On Thu, Jul 05, 2018 at 07:40:25PM +0200, Peter Zijlstra wrote: > > +#ifdef CONFIG_SMP > > +#define mb() asm volatile ("sync.is":::"memory") > > +#else > > +#define mb() asm volatile ("sync":::"memory") > > +#endif > > This is very suspect, please elaborate. > > What I would've

Re: [PATCH V2 18/19] clocksource: add C-SKY clocksource drivers

2018-07-05 Thread Guo Ren
c ops is set. Got it, add set_oneshot. > > Thx, I'll modify it like this: > > div = (timer_of_rate() / TIMER_FREQ) - 1; > > I wanted to be sure it wasn't the latter. In this case, you don't need > parenthesis, so just add the spaces around the '/' operator. Ok Guo Ren

  1   2   3   4   5   6   7   8   9   10   >