[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

[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 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 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 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

Re: [PATCH 1/2] nds32: To implement these icache invalidation APIs since nds32 cores don't snoop data cache. This issue is found by Guo Ren. Based on the Documentation/core-api/cachetlb.rst and it say

2018-06-29 Thread Guo Ren
K); > + flush_icache_range(_addr, _addr + len); > +} The same as above. Guo Ren

Re: [PATCH 15/19] csky: Build infrastructure

2018-03-28 Thread Guo Ren
ble at the kernel level. Best Regards Guo Ren

Re: [PATCH 17/19] csky: defconfig

2018-03-27 Thread Guo Ren
On Tue, Mar 27, 2018 at 09:48:23AM +0200, Arnd Bergmann wrote: > On Tue, Mar 27, 2018 at 4:21 AM, Guo Ren wrote: > > On Mon, Mar 26, 2018 at 03:16:31PM +0200, Arnd Bergmann wrote: > > >> > +CONFIG_CFG80211=y > >> > +CONFIG_CFG80211_DEBUGFS=y > >> >

Re: [PATCH 15/19] csky: Build infrastructure

2018-03-27 Thread Guo Ren
may I keep current design for abiv1&abiv2? In abiv3, we will take your advice seriously. Best Regards Guo Ren

Re: [PATCH 10/19] csky: Signal handling

2018-03-26 Thread Guo Ren
On Mon, Mar 26, 2018 at 03:04:01PM +0200, Arnd Bergmann wrote: > On Sun, Mar 18, 2018 at 8:51 PM, Guo Ren wrote: > > Signed-off-by: Guo Ren > > --- > > arch/csky/include/uapi/asm/sigcontext.h | 33 +++ > > arch/csky/include/uapi/asm/signal.h | 164 +

Re: [PATCH 15/19] csky: Build infrastructure

2018-03-26 Thread Guo Ren
k. Just make sure that the DT always has this information as well, > so this can be changed in the future when desired, without having to > make incompatible changes to the devicetree binary files. Ok Best Regards Guo Ren

Re: [PATCH 17/19] csky: defconfig

2018-03-26 Thread Guo Ren
CKLIGHT_CLASS_DEVICE is not set > > +# CONFIG_VGA_CONSOLE is not set > > +CONFIG_FRAMEBUFFER_CONSOLE=y > > +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y > > +CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y > > +CONFIG_LOGO=y > > +# CONFIG_LOGO_LINUX_MONO is not set > > +# CONFIG_LOGO_LINUX_VGA16 is not set > > For new platforms, using the DRM subsystem is the recommend > way to do graphics, it mostly replaces the framebuffer subsystem > here. These used by: https://github.com/c-sky/addons-linux/tree/master/addons/drivers/video/fbdev/nationalchip I'll consider the DRM subsystem. > > +CONFIG_STE_MODEM_RPROC=m > > I think this is no longer there. Yes, remove it. > > +CONFIG_EXT2_FS=y > > +CONFIG_EXT2_FS_XATTR=y > > +CONFIG_EXT2_FS_POSIX_ACL=y > > +CONFIG_EXT2_FS_SECURITY=y > > +CONFIG_EXT3_FS=y > > +CONFIG_EXT3_FS_POSIX_ACL=y > > +CONFIG_EXT3_FS_SECURITY=y > > Better use EXT4 for the defconfig instead. OK. Best Regards Guo Ren

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

2018-03-26 Thread Guo Ren
d to > contain only the minimum required additions to the asm-generic version. > > Changing the ABI will obviously get in the way of testing, but this should > be over as soon as the port is merged. I entirely agree with you. After modify the unistd.h, we found a lot of ltp-cases failed. We are dealing with them. Best Regards Guo Ren

Re: [PATCH 15/19] csky: Build infrastructure

2018-03-21 Thread Guo Ren
need the alignement fixups? > > For abiv1 ck610 couldn't handle the unalignment address access, so we > > need soft-alignment exception to fixup. There is no problem in abiv2 cpus. > > Ok. Generally speaking, architectures that don't allow unaligned access > should have all code built in a way that uses aligned access (gcc normally > falls back to byte access when it encounters an unaligned pointer at > compile time), but if this is just for old CPUs that are not used in future > products, having the fixup does sound simpler, as it allows you to still > run new binaries on the old machines. I haven't looked at the implementation > for the fixup here, but I remember the same thing from the nds32 port. > In that case, we ended up keeping the fixup as an option for old > user space, but disabled to softalign fixups for kernel code. Can you do > the same thing here? Ok. I got it, I'll do the same as nds32. Best Regards Guo Ren

Re: [PATCH 19/19] irqchip: add irq-nationalchip.c and irq-csky.c

2018-03-20 Thread Guo Ren
> > + "ff1 %0\n" > > + :"=r"(lo) > > + :"r"(lo) > > + : > > + ); > > So you want to decode the interrupt number from a bitfield. What's wrong > with ffs()? There is no wrong with ffs(). Ok, I will use the ffs(). > > + if( lo != 32 ) > > + result = 31-lo; > > Why is this subtracted? ff1 find from high bit, so we need reverse it to get the right num. > That code makes no sense w/o comments. Sorry, I will add. > > + else if( hi != 32 ) result = 31-hi + 32; > > + else { > > + printk("nc_get_irqno error hi:%x, lo:%x.\n", hi, lo); > > + result = NR_IRQS; > > + } > > Pleas use braces consistently. Ok > > +unsigned int nc_get_irqno(void) > > static? Yes > Same comments as for the other variant. Ok Best Regards Guo Ren

Re: [PATCH 16/19] csky: Device tree

2018-03-20 Thread Guo Ren
ng. Ok, I will add them. > > + ohci0: ohci-hcd0 { > The names here should be "usb@...", not "ehci-hcd" Ok > > + chosen { > > + bootargs = "console=ttyS0,115200 rdinit=/sbin/init > > root=/dev/ram0"; > > + }; > > The bootargs should not be in the dts file normally, they should come from the > boot loader. I want to keep bootargs in dts, because the bootloader only pass the dtb to kernel. > For the console, use the "stdout-path" property. Ok Best Regards Guo Ren

Re: [PATCH 14/19] csky: Misc headers

2018-03-20 Thread Guo Ren
On Tue, Mar 20, 2018 at 03:54:53PM +0800, Arnd Bergmann wrote: > We generally assume that any upstream kernel ABI cannot be changed, so this > has to be changed before the code gets merged upstream. > > You can obviously maintain the old and the new ABI in parallel for a while, > until the libc su

Re: [PATCH 15/19] csky: Build infrastructure

2018-03-20 Thread Guo Ren
will mask some warnings :P, and I will remove it. > -fno-tree-dse? This is from "gcc-4.5 compile linux-4.7" and it will cause wrong code without -fno-tree-dse for list.h. Now we use gcc-6.3, so I will try to remove it. > > +++ b/arch/csky/abiv1/Makefile > > @@ -0,0 +1,8 @@ > > +obj-y += src/bswapdi.o > > +obj-y += src/bswapsi.o > > +obj-y += src/cacheflush.o > > +obj-y += src/memcpy.o > > +obj-y += src/mmap.o > > + > > +obj-$(CONFIG_CPU_NEED_SOFTALIGN) +=src/alignment.o > > Better not use subdirectories like that. Ok, I will change them like this: obj-y += bswapdi.o obj-y += bswapsi.o ... > Can you explain why you need the alignement fixups? For abiv1 ck610 couldn't handle the unalignment address access, so we need soft-alignment exception to fixup. There is no problem in abiv2 cpus. Best Regards Guo Ren

Re: [PATCH 14/19] csky: Misc headers

2018-03-19 Thread Guo Ren
Hi Arnd, On Tue, Mar 20, 2018 at 12:11:24AM +0800, Arnd Bergmann wrote: > On Mon, Mar 19, 2018 at 3:51 AM, Guo Ren wrote: > > +++ b/arch/csky/include/uapi/asm/fcntl.h > > @@ -0,0 +1,13 @@ > > +// SPDX-License-Identifier: GPL-2.0 > > +// Copyright (C) 2018 Hangzhou

Re: [PATCH 06/19] csky: IRQ handling

2018-03-19 Thread Guo Ren
explanation are bad. Yes, you are right. I will fixup them next. PSR is our Processor Status Register and it store the vector number. '10' is our auto-interrupt exception entry and we need get the irqno from the interrupt-controller. The "vector num > 32" is our vector interrupt exception entries, so we can calculate the irq-num by vector-num and no need to access the interrupt-controller's io regs. Best Regards Guo Ren

Re: [PATCH 02/19] csky: Exception handling and syscall

2018-03-19 Thread Guo Ren
next and check the unistd.h again. Best Regards Guo Ren

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

2018-03-19 Thread Guo Ren
Thx Joe, On Sun, Mar 18, 2018 at 01:25:57PM -0700, Joe Perches wrote: > On Mon, 2018-03-19 at 03:51 +0800, Guo Ren wrote: > > This patchset adds architecture support to Linux for C-SKY's 32-bit embedded > > CPU cores and the patches are based on linux-4.16-rc5. > > >

Re: [PATCH 19/19] irqchip: add irq-nationalchip.c and irq-csky.c

2018-03-19 Thread Guo Ren
On Mon, Mar 19, 2018 at 04:26:00AM +, Mark Rutland wrote: > On Mon, Mar 19, 2018 at 03:51:41AM +0800, Guo Ren wrote: > > +static unsigned int intc_reg; > > This should be a void __iomem *ptr; > OK > > +#define CK_VA_INTC_ICR (void *)(intc_reg + 0x00)

Re: [PATCH 18/19] clocksource: add timer-nationalchip.c

2018-03-19 Thread Guo Ren
CKSOURCE_OF_DECLARE(nc_timer, "nationalchip,timer-v1", nc_timer_init); > > This needs a devicetree binding document. Please see > Documentation/devicetree/bindings/submitting-patches.txt. > OK Best Regards Guo Ren

Re: [PATCH 18/19] clocksource: add timer-nationalchip.c

2018-03-19 Thread Guo Ren
gt; OK > > + /* register */ > > + clockevents_config_and_register(&nc_ced, freq, 1, ULONG_MAX); > > + > > + nc_csd_enable(); > > + clocksource_mmio_init(NC_VA_COUNTER_2_VALUE, "nationalchip-clksource", > > freq, 200, 32, clocksource_mmio_readl_up); > > s/nationalchip-clksource/nationalchip/ > > line wrap > OK > > + sched_clock_register(nc_sched_clock_read, 32, freq); > > + > > + return 0; > > +} > > +CLOCKSOURCE_OF_DECLARE(nc_timer, "nationalchip,timer-v1", nc_timer_init); > > s/CLOCKSOURCE_OF_DECLARE/TIMER_OF_DECLARE/ > OK Best Regards Guo Ren

Re: [PATCH 02/19] csky: Exception handling and syscall

2018-03-18 Thread Guo Ren
lementing THREAD_INFO_IN_TASK_STRUCT. > Em... I'll think about it. > For consistency, and in case you change your stack size in future, this should > be THREADSIZE_MASK_BIT. > OK > > +if (unlikely(address >= VMALLOC_START && address <= VMALLOC_END)) > > +goto vmalloc_fault; > > You might want to check if this was a user mode fault here, so that users > can't trigger vmalloc faults. Is it necessary to check user mode? If a user-process touch a kernel-addr, it will cause a supervisor exception. Best Regards Guo Ren

[PATCH 08/19] csky: ELF and module probe

2018-03-18 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/include/asm/elf.h | 151 arch/csky/kernel/module.c | 130 ++ 2 files changed, 281 insertions(+) create mode 100644 arch/csky/include/asm/elf.h create mode 100644 arch/csky

[PATCH 10/19] csky: Signal handling

2018-03-18 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/include/uapi/asm/sigcontext.h | 33 +++ arch/csky/include/uapi/asm/signal.h | 164 ++ arch/csky/kernel/signal.c | 379 3 files changed, 576 insertions(+) create mode 100644 arch/csky/include

[PATCH 06/19] csky: IRQ handling

2018-03-18 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/include/asm/irq.h | 12 + arch/csky/include/asm/irqflags.h | 55 arch/csky/kernel/irq.c | 41 ++ 3 files changed, 108 insertions(+) create mode 100644 arch/csky

[PATCH 05/19] csky: Process management

2018-03-18 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/include/asm/mmu_context.h | 140 ++ arch/csky/include/asm/processor.h | 140 ++ arch/csky/include/asm/thread_info.h | 77 +++ arch/csky/kernel/process.c | 147

[PATCH 14/19] csky: Misc headers

2018-03-18 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/abiv1/inc/abi/reg_ops.h | 79 + arch/csky/abiv1/inc/abi/regdef.h | 27 +++ arch/csky/abiv2/inc/abi/fpu.h | 296 + arch/csky/abiv2/inc/abi/reg_ops.h | 86 ++ arch/csky/abiv2/inc/abi

[PATCH 18/19] clocksource: add timer-nationalchip.c

2018-03-18 Thread Guo Ren
Signed-off-by: Guo Ren --- drivers/clocksource/Makefile | 1 + drivers/clocksource/timer-nationalchip.c | 149 +++ 2 files changed, 150 insertions(+) create mode 100644 drivers/clocksource/timer-nationalchip.c diff --git a/drivers/clocksource/Makefile

[PATCH 03/19] csky: Cache and TLB routines

2018-03-18 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/abiv1/inc/abi/cacheflush.h | 40 +++ arch/csky/abiv1/src/cacheflush.c | 32 ++ arch/csky/abiv2/inc/abi/cacheflush.h | 9 ++ arch/csky/include/asm/barrier.h | 14 +++ arch/csky/include/asm/cache.h | 32 ++ arch/csky

[PATCH 15/19] csky: Build infrastructure

2018-03-18 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/Kconfig | 203 ++ arch/csky/Kconfig.debug | 22 + arch/csky/Makefile| 92 + arch/csky/abiv1/Makefile | 8 ++ arch/csky/abiv2/Makefile | 3

[PATCH 01/19] csky: Kernel booting

2018-03-18 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/kernel/head.S | 20 ++ arch/csky/kernel/setup.c | 157 +++ 2 files changed, 177 insertions(+) create mode 100644 arch/csky/kernel/head.S create mode 100644 arch/csky/kernel/setup.c diff --git a/arch/csky

[PATCH 16/19] csky: Device tree

2018-03-18 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/boot/dts/gx6605s.dts | 159 + arch/csky/boot/dts/include/dt-bindings | 1 + arch/csky/boot/dts/qemu.dts| 87 ++ 3 files changed, 247 insertions(+) create mode 100644 arch/csky/boot/dts

[PATCH 02/19] csky: Exception handling and syscall

2018-03-18 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/abiv1/inc/abi/entry.h | 171 arch/csky/abiv1/src/alignment.c | 513 arch/csky/abiv2/inc/abi/entry.h | 154 +++ arch/csky/include/asm/syscalls.h| 14 + arch/csky/include/asm/traps.h

[PATCH 11/19] csky: Library functions

2018-03-18 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/abiv1/src/bswapdi.c| 18 ++ arch/csky/abiv1/src/bswapsi.c| 15 ++ arch/csky/abiv1/src/memcpy.S | 344 +++ arch/csky/abiv2/src/fpu.c| 312 +++ arch/csky/abiv2/src

[PATCH 17/19] csky: defconfig

2018-03-18 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 12/19] csky: Debug and Ptrace GDB

2018-03-18 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/include/uapi/asm/ptrace.h | 97 +++ arch/csky/kernel/dumpstack.c| 65 +++ arch/csky/kernel/ptrace.c | 339 3 files changed, 501 insertions(+) create mode 100644 arch/csky/include/uapi/asm

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

2018-03-18 Thread Guo Ren
ream is on going and the source code is here: https://github.com/c-sky It's my first patchset to linux and any feedback is welcome :) Guo Ren (19): csky: Kernel booting csky: Exception handling and syscall csky: Cache and TLB routines csky: MMU and page talbe management csky: Proc

[PATCH 13/19] csky: User access

2018-03-18 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/include/asm/uaccess.h | 408 arch/csky/include/asm/user.h| 102 ++ 2 files changed, 510 insertions(+) create mode 100644 arch/csky/include/asm/uaccess.h create mode 100644 arch/csky/include/asm/user.h

[PATCH 19/19] irqchip: add irq-nationalchip.c and irq-csky.c

2018-03-18 Thread Guo Ren
Signed-off-by: Guo Ren --- drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-csky.c | 151 drivers/irqchip/irq-nationalchip.c | 196 + 3 files changed, 348 insertions(+) create mode 100644 drivers/irqchip/irq

[PATCH 04/19] csky: MMU and page talbe management

2018-03-18 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/abiv1/inc/abi/ckmmu.h| 140 +++ arch/csky/abiv1/inc/abi/page.h | 26 +++ arch/csky/abiv1/inc/abi/pgtable-bits.h | 36 arch/csky/abiv1/src/mmap.c | 65 +++ arch/csky/abiv2/inc/abi/ckmmu.h| 126

[PATCH 07/19] csky: Atomic operations

2018-03-18 Thread Guo Ren
Signed-off-by: Guo Ren --- arch/csky/kernel/atomic.S | 55 +++ 1 file changed, 55 insertions(+) create mode 100644 arch/csky/kernel/atomic.S diff --git a/arch/csky/kernel/atomic.S b/arch/csky/kernel/atomic.S new file mode 100644 index 000

[PATCH 09/19] csky: VDSO and rt_sigreturn

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

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 : > > Hi Greentime, > > > > On Fri, Dec 08, 2017 at 05:11:50PM +0800, Greentime Hu wrote: > > [...] > >> > >> diff --git

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

2017-12-18 Thread Guo Ren
1 = kmap(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 09/33] nds32: Cache and TLB routines

2017-12-13 Thread Guo Ren
s 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 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 : > > 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 bec

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 tlb-bu

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

2017-12-12 Thread Guo Ren
t; 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

<    3   4   5   6   7   8