Message ID | cover.1513577007.git.green.hu@gmail.com |
---|---|
Headers | show |
Series | Andes(nds32) Linux Kernel | expand |
On Mon, Dec 18, 2017 at 7:46 AM, Greentime Hu <green.hu@gmail.com> wrote: > From: Greentime Hu <greentime@andestech.com> > > This patch introduces some miscellaneous header files. > +static inline void __delay(unsigned long loops) > +{ > + __asm__ __volatile__(".align 2\n" > + "1:\n" > + "\taddi\t%0, %0, -1\n" > + "\tbgtz\t%0, 1b\n" > + :"=r"(loops) > + :"0"(loops)); > +} > + > +static inline void __udelay(unsigned long usecs, unsigned long lpj) > +{ > + usecs *= (unsigned long)(((0x8000000000000000ULL / (500000 / HZ)) + > + 0x80000000ULL) >> 32); > + usecs = (unsigned long)(((unsigned long long)usecs * lpj) >> 32); > + __delay(usecs); > +} Do you have a reliable clocksource that you can read here instead of doing the loop? It's generally preferred to have an accurate delay if at all possible, the delay loop calibration is only for those architectures that don't have any way to observe how much time has passed accurately. Arnd -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, Dec 18, 2017 at 7:46 AM, Greentime Hu <green.hu@gmail.com> wrote: > new file mode 100644 > index 0000000..90da745 > --- /dev/null > +++ b/arch/nds32/include/uapi/asm/unistd.h > @@ -0,0 +1,12 @@ > +// SPDX-License-Identifier: GPL-2.0 > +// Copyright (C) 2005-2017 Andes Technology Corporation > + > +#define __ARCH_WANT_SYNC_FILE_RANGE2 > + > +/* Use the standard ABI for syscalls */ > +#include <asm-generic/unistd.h> > + > +/* Additional NDS32 specific syscalls. */ > +#define __NR_cacheflush (__NR_arch_specific_syscall) > +#define __NR__llseek __NR_llseek > +__SYSCALL(__NR_cacheflush, sys_cacheflush) I'm still confused by __NR__llseek here, why do you need that one? > +SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len, > + unsigned long, prot, unsigned long, flags, > + unsigned long, fd, unsigned long, pgoff) > +{ > + if (pgoff & (~PAGE_MASK >> 12)) > + return -EINVAL; > + > + return sys_mmap_pgoff(addr, len, prot, flags, fd, > + pgoff >> (PAGE_SHIFT - 12)); > +} > + > +SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len, > + unsigned long, prot, unsigned long, flags, > + unsigned long, fd, unsigned long, pgoff) > +{ > + if (unlikely(pgoff & ~PAGE_MASK)) > + return -EINVAL; > + > + return sys_mmap_pgoff(addr, len, prot, flags, fd, > + pgoff >> PAGE_SHIFT); > +} And I don't see why you define sys_mmap() in addition to sys_mmap2(). The rest of the syscall handling looks good now. Arnd -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, Dec 18, 2017 at 7:46 AM, Greentime Hu <green.hu@gmail.com> wrote: > +#define __ASM_NDS32_IO_H > + > +extern void iounmap(void __iomem *addr); The prototype here should probably include 'volatile' to avoid warnings in an allmodconfig build. Arnd -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
2017-12-18 19:26 GMT+08:00 Arnd Bergmann <arnd@arndb.de>: > On Mon, Dec 18, 2017 at 7:46 AM, Greentime Hu <green.hu@gmail.com> wrote: > >> +#define __ASM_NDS32_IO_H >> + >> +extern void iounmap(void __iomem *addr); > > The prototype here should probably include 'volatile' to avoid warnings in an > allmodconfig build. > Thanks. I will update it like this. extern void iounmap(volatile void __iomem *addr); -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
2017-12-18 19:19 GMT+08:00 Arnd Bergmann <arnd@arndb.de>: > On Mon, Dec 18, 2017 at 7:46 AM, Greentime Hu <green.hu@gmail.com> wrote: > > >> new file mode 100644 >> index 0000000..90da745 >> --- /dev/null >> +++ b/arch/nds32/include/uapi/asm/unistd.h >> @@ -0,0 +1,12 @@ >> +// SPDX-License-Identifier: GPL-2.0 >> +// Copyright (C) 2005-2017 Andes Technology Corporation >> + >> +#define __ARCH_WANT_SYNC_FILE_RANGE2 >> + >> +/* Use the standard ABI for syscalls */ >> +#include <asm-generic/unistd.h> >> + >> +/* Additional NDS32 specific syscalls. */ >> +#define __NR_cacheflush (__NR_arch_specific_syscall) >> +#define __NR__llseek __NR_llseek >> +__SYSCALL(__NR_cacheflush, sys_cacheflush) > > I'm still confused by __NR__llseek here, why do you need that one? > Dear Arnd: We hoped to solve ABI register alignment problem for llseek in glibc by __NR__llseek. After checking glibc again, I find glibc has same __NR__llseek macro and It's better to solve this problem. So, I will remove this definition in the next version patch. >> +SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len, >> + unsigned long, prot, unsigned long, flags, >> + unsigned long, fd, unsigned long, pgoff) >> +{ >> + if (pgoff & (~PAGE_MASK >> 12)) >> + return -EINVAL; >> + >> + return sys_mmap_pgoff(addr, len, prot, flags, fd, >> + pgoff >> (PAGE_SHIFT - 12)); >> +} >> + >> +SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len, >> + unsigned long, prot, unsigned long, flags, >> + unsigned long, fd, unsigned long, pgoff) >> +{ >> + if (unlikely(pgoff & ~PAGE_MASK)) >> + return -EINVAL; >> + >> + return sys_mmap_pgoff(addr, len, prot, flags, fd, >> + pgoff >> PAGE_SHIFT); >> +} > > And I don't see why you define sys_mmap() in addition to sys_mmap2(). > This is my mistake. I will remove it in the next version patch. > The rest of the syscall handling looks good now. > > Arnd Thanks Vincent -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi, Arnd: 2017-12-18 19:13 GMT+08:00 Arnd Bergmann <arnd@arndb.de>: > On Mon, Dec 18, 2017 at 7:46 AM, Greentime Hu <green.hu@gmail.com> wrote: >> From: Greentime Hu <greentime@andestech.com> >> >> This patch introduces some miscellaneous header files. > >> +static inline void __delay(unsigned long loops) >> +{ >> + __asm__ __volatile__(".align 2\n" >> + "1:\n" >> + "\taddi\t%0, %0, -1\n" >> + "\tbgtz\t%0, 1b\n" >> + :"=r"(loops) >> + :"0"(loops)); >> +} >> + >> +static inline void __udelay(unsigned long usecs, unsigned long lpj) >> +{ >> + usecs *= (unsigned long)(((0x8000000000000000ULL / (500000 / HZ)) + >> + 0x80000000ULL) >> 32); >> + usecs = (unsigned long)(((unsigned long long)usecs * lpj) >> 32); >> + __delay(usecs); >> +} > > Do you have a reliable clocksource that you can read here instead of doing the > loop? It's generally preferred to have an accurate delay if at all possible, the > delay loop calibration is only for those architectures that don't have any > way to observe how much time has passed accurately. > We currently only have atcpit100 as clocksource but it is an IP of SoC. These delay API will be unavailable if we changed to another SoC unless all these timer driver provided the same APIs. It may suffer our customers if they forget to port these APIs in their timer drivers when they try to use nds32 in the first beginning. Or maybe I can use a CONFIG_USE_ACCURATE_DELAY to keep these 2 implementions for these purposes? -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Dec 19, 2017 at 6:34 AM, Greentime Hu <green.hu@gmail.com> wrote: > Hi, Arnd: > > 2017-12-18 19:13 GMT+08:00 Arnd Bergmann <arnd@arndb.de>: >> On Mon, Dec 18, 2017 at 7:46 AM, Greentime Hu <green.hu@gmail.com> wrote: >>> From: Greentime Hu <greentime@andestech.com> >>> >>> This patch introduces some miscellaneous header files. >> >>> +static inline void __delay(unsigned long loops) >>> +{ >>> + __asm__ __volatile__(".align 2\n" >>> + "1:\n" >>> + "\taddi\t%0, %0, -1\n" >>> + "\tbgtz\t%0, 1b\n" >>> + :"=r"(loops) >>> + :"0"(loops)); >>> +} >>> + >>> +static inline void __udelay(unsigned long usecs, unsigned long lpj) >>> +{ >>> + usecs *= (unsigned long)(((0x8000000000000000ULL / (500000 / HZ)) + >>> + 0x80000000ULL) >> 32); >>> + usecs = (unsigned long)(((unsigned long long)usecs * lpj) >> 32); >>> + __delay(usecs); >>> +} >> >> Do you have a reliable clocksource that you can read here instead of doing the >> loop? It's generally preferred to have an accurate delay if at all possible, the >> delay loop calibration is only for those architectures that don't have any >> way to observe how much time has passed accurately. >> > > We currently only have atcpit100 as clocksource but it is an IP of SoC. > These delay API will be unavailable if we changed to another SoC > unless all these timer driver provided the same APIs. > It may suffer our customers if they forget to port these APIs in their > timer drivers when they try to use nds32 in the first beginning. Ok, thanks for the clarification. > Or maybe I can use a CONFIG_USE_ACCURATE_DELAY to keep these 2 > implementions for these purposes? I'd just add a one-line comment in delay.h to explain that there is no cycle counter in the CPU. Arnd -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 12/17/2017 10:46 PM, Greentime Hu wrote: > From: Greentime Hu <greentime@andestech.com> > > This patch includes the kernel startup code. It can get dtb pointer > passed from bootloader. It will create a temp mapping by tlb > instructions at beginning and goto start_kernel. > > Signed-off-by: Vincent Chen <vincentc@andestech.com> > Signed-off-by: Greentime Hu <greentime@andestech.com> > --- > arch/nds32/kernel/head.S | 189 ++++++++++++++++++++++ > arch/nds32/kernel/setup.c | 383 +++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 572 insertions(+) > create mode 100644 arch/nds32/kernel/head.S > create mode 100644 arch/nds32/kernel/setup.c > > diff --git a/arch/nds32/kernel/setup.c b/arch/nds32/kernel/setup.c > new file mode 100644 > index 0000000..7718c58 > --- /dev/null > +++ b/arch/nds32/kernel/setup.c > @@ -0,0 +1,383 @@ > +// SPDX-License-Identifier: GPL-2.0 > +// Copyright (C) 2005-2017 Andes Technology Corporation > + [snip] > +struct cache_info L1_cache_info[2]; > +static void __init dump_cpu_info(int cpu) > +{ > + int i, p = 0; > + char str[sizeof(hwcap_str) + 16]; > + > + for (i = 0; hwcap_str[i]; i++) { > + if (elf_hwcap & (1 << i)) { > + sprintf(str + p, "%s ", hwcap_str[i]); > + p += strlen(hwcap_str[i]) + 1; > + } > + } > + > + pr_info("CPU%d Featuretures: %s\n", cpu, str); Features:
2017-12-19 17:54 GMT+08:00 Arnd Bergmann <arnd@arndb.de>: > On Tue, Dec 19, 2017 at 6:34 AM, Greentime Hu <green.hu@gmail.com> wrote: >> Hi, Arnd: >> >> 2017-12-18 19:13 GMT+08:00 Arnd Bergmann <arnd@arndb.de>: >>> On Mon, Dec 18, 2017 at 7:46 AM, Greentime Hu <green.hu@gmail.com> wrote: >>>> From: Greentime Hu <greentime@andestech.com> >>>> >>>> This patch introduces some miscellaneous header files. >>> >>>> +static inline void __delay(unsigned long loops) >>>> +{ >>>> + __asm__ __volatile__(".align 2\n" >>>> + "1:\n" >>>> + "\taddi\t%0, %0, -1\n" >>>> + "\tbgtz\t%0, 1b\n" >>>> + :"=r"(loops) >>>> + :"0"(loops)); >>>> +} >>>> + >>>> +static inline void __udelay(unsigned long usecs, unsigned long lpj) >>>> +{ >>>> + usecs *= (unsigned long)(((0x8000000000000000ULL / (500000 / HZ)) + >>>> + 0x80000000ULL) >> 32); >>>> + usecs = (unsigned long)(((unsigned long long)usecs * lpj) >> 32); >>>> + __delay(usecs); >>>> +} >>> >>> Do you have a reliable clocksource that you can read here instead of doing the >>> loop? It's generally preferred to have an accurate delay if at all possible, the >>> delay loop calibration is only for those architectures that don't have any >>> way to observe how much time has passed accurately. >>> >> >> We currently only have atcpit100 as clocksource but it is an IP of SoC. >> These delay API will be unavailable if we changed to another SoC >> unless all these timer driver provided the same APIs. >> It may suffer our customers if they forget to port these APIs in their >> timer drivers when they try to use nds32 in the first beginning. > > Ok, thanks for the clarification. > >> Or maybe I can use a CONFIG_USE_ACCURATE_DELAY to keep these 2 >> implementions for these purposes? > > I'd just add a one-line comment in delay.h to explain that there is no > cycle counter in the CPU. > Thanks. Got it. I will add a one-line comment in delay.h -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
2017-12-20 6:01 GMT+08:00 Randy Dunlap <rdunlap@infradead.org>: > On 12/17/2017 10:46 PM, Greentime Hu wrote: >> From: Greentime Hu <greentime@andestech.com> >> >> This patch includes the kernel startup code. It can get dtb pointer >> passed from bootloader. It will create a temp mapping by tlb >> instructions at beginning and goto start_kernel. >> >> Signed-off-by: Vincent Chen <vincentc@andestech.com> >> Signed-off-by: Greentime Hu <greentime@andestech.com> >> --- >> arch/nds32/kernel/head.S | 189 ++++++++++++++++++++++ >> arch/nds32/kernel/setup.c | 383 +++++++++++++++++++++++++++++++++++++++++++++ >> 2 files changed, 572 insertions(+) >> create mode 100644 arch/nds32/kernel/head.S >> create mode 100644 arch/nds32/kernel/setup.c >> > >> diff --git a/arch/nds32/kernel/setup.c b/arch/nds32/kernel/setup.c >> new file mode 100644 >> index 0000000..7718c58 >> --- /dev/null >> +++ b/arch/nds32/kernel/setup.c >> @@ -0,0 +1,383 @@ >> +// SPDX-License-Identifier: GPL-2.0 >> +// Copyright (C) 2005-2017 Andes Technology Corporation >> + > > [snip] > >> +struct cache_info L1_cache_info[2]; >> +static void __init dump_cpu_info(int cpu) >> +{ >> + int i, p = 0; >> + char str[sizeof(hwcap_str) + 16]; >> + >> + for (i = 0; hwcap_str[i]; i++) { >> + if (elf_hwcap & (1 << i)) { >> + sprintf(str + p, "%s ", hwcap_str[i]); >> + p += strlen(hwcap_str[i]) + 1; >> + } >> + } >> + >> + pr_info("CPU%d Featuretures: %s\n", cpu, str); > > Features: > Thanks Randy. I will fix this typo. -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, Dec 18, 2017 at 7:46 AM, Greentime Hu <green.hu@gmail.com> wrote: > This is the 4th version patchset to add the Linux kernel port for Andes(nds32) > processors. Almost all of the feedbacks from v3 patchseries has been addressed. > Thanks to everyone who provided feedback on the previous version. > > > This patchset adds core architecture support to Linux for Andestech's > N13, N15, D15, N10, D10 processor cores. > > Based on the 16/32-bit AndeStar RISC-like architecture, we designed the > configurable AndesCore series of embedded processor families. AndesCores > range from highly performance-efficient small-footprint cores for > microcontrollers and deeply-embedded applications to 1GHz+ cores running > Linux, covering general-purpose N-series cores for a wide range of computing > need, DSP-capable D-series cores for digital signal control, > instruction-extensible E-series cores for application-specific acceleration, > and secure S-series cores for best protection of the most valuable. > > The patches are based on v4.14-rc8, and can also be found in the > following git tree: > https://github.com/andestech/linux.git nds32-4.14-rc8-v4 > > The build script and toolchain repositories are able to be found here: > https://github.com/andestech/build_script.git > > Freely available instruction set and architecture overview documents can > be found on the following page: > http://www.andestech.com/product.php?cls=9 > > > Vincent Ren-Wei Chen and I will maintain this port. Thanks to everyone who > helped us and contributed to it. :) Any feedback is welcome. Aside from the missing Ack on the sparc patch, everything looks good to get merged from my side this time. I would suggest as next steps: - ask Daniel to include the clocksource driver patches in his tree - Provide a git tree with all the patches you plan to send for inclusion, based on v4.16-rc1. - Add any further changes on top of that branch, without rebasing any further. - give Stephen the git URL for inclusion in linux-next Arnd -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html