Andes(nds32) Linux Kernel
Subsystems (12)
v4 cover Andes(nds32) Linux Kernel
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.
Changes in v4:
- Add atcpit100 timer driver due to it include vdso implementations and sent them together with nds32 may help reviewer to review.
- Update ae3xx.dts for atcpit100 clock setting and remove vdso settings.
- To get cycle counter register by timer driver instead of dts.
- Use "depends on NDS32 || COMPILE_TEST" in atcpit100 driver because it is needed for nds32 vdso
- Update defconfig becasue kconfig rename from CONFIG_CLKSRC_ATCPIT100 to CONFIG_TIMER_ATCPIT100
- Remove ag101p.dts because we are not yet ready for ag101p platform.
- Update copyright style to SPDX-License-Identifier
- Include <linux/uaccess.h> instead of <asm/uaccess.h>
- Add local_irq_save()/local_irq_restore() to protect SR_TLB_VPN in update_mmu_cache().
- Update cpu_dcache_inval_all implementation to make sure all level cache are writeback.
Changes in v3:
- Use arch's io.h instead of generic one
- Add andestech-boards binding document
- Update nds32/cpus.txt binding document
- Remove atcpit100 timer drivers
- Select NO_BOOTMEM and delete HAVE_MEMBLOCK_NODE_MAP
- make CPU_BIG_ENDIAN and CPU_LITTLE_ENDIAN are dependent
- Add cpu type to select HWZOL/CPU_CACHE_ALIASING
- Change CPU_CACHE_NONALIASING to CPU_CACHE_ALIASING
- Remove bootarg from device tree script
- Update ag101p.dts and ae3xx.dts for correct board name.
- Clear and simplify defconfig
- Implement L2C_R_REG/ L2C_W_REG with readl/writel instead of __raw_readl/__raw_writel for endian save
- Remove early_init_dt_add_memory_arch/early_init_dt_alloc_memory_arch to use the generic ones
- Refine devicetree.c
- Fix bug https://lkml.kernel.org/r/1499782590-31366-1-git-send-email-mark.rutland-5wv7dgnIgG8@public.gmane.org
- Refine irqchip/irq-ativic32.c implementations
- Add COMPILE_TEST in drivers/net/ethernet/faraday/Kconfig
- Refine cache operations
- Add CONFIG_HW_SUPPORT_UNALIGNMENT_ACCESS
- Fix ZERO_PAGE define
- Remove SA_RESTORER
- Remove uapi/asm/signal.h
- Redefine user_pt_regs
- Remove spinlock.h
- Remove __ARCH_WANT_RENAMEAT and __ARCH_WANT_SYSCALL_OFF_T from unistd.h
- Remove set_fs(USER_DS) because flush_old_exec() will do this setting
- Replace in_atomic() with faulthandler_disabled()
- Add barrier.h
- Select COMMON_CLK
- Add clk_pll in dts
- Add of_clk_init() in arch/nds32/kernel/time.c
Changes in v2:
- Set GENERIC_CALIBRATE_DELAY default n
- Add earlycon support
- Remove earlyprintk
- Add CPU_BIG_ENDIAN, CPU_LITTLE_ENDIAN support
- Refine unalignment access exception handler
- Add VMSPLIT support
- Use only one defconfig
- Change interrupt-cells from 2 to 1
- Refine andestech cpu names in bindings/nds32/cpus.txt
- Get clock frequency in dts because fpga bitmap doesn't include this feature
- Update MAINTAINERS for bindings
- Remove unused configs in Kconfig
- Refine device tree scripts
- Refine coding style
- Use generic ioremap_nocache
- Remove L2CC_PA_BASE define and its codes in head.S. It will be moved to bootloader.
- Set PHYS_OFFSET to 0x0 instead of CONFIG_MEMORY_START
- Remove unused macros
- Simplify cpu_cache_* API
- Change __asm__ __volatile__ to asm volatile
- Refine uaccess.h
- Remove unused/deprecated syscall
- Use generic posix_types.h
- Remove arch_trace_hardirqs_on/arch_trace_hardirqs_off
- Fix bug of restart syscall
- Refine syscall implementations
- Use IS_ENABLED to replace ifdef as possible
- Remove device_initcall(nds32_device_probe)
- Refine vdso implementations
- Refine copy_from_user()/copy_to_user()/clear_user()/get_user()/memmove()/memcpy()
- Refine ioremap.c
- Refine irq-ativic32.c
- Fix a bug of earlycon.c
- Export ioremap_nocache/ioremap_uc/ioremap_wc/ioremap_wt
- Add atcpit100 driver
Greentime Hu (33):
asm-generic/io.h: move
ioremap_nocache/ioremap_uc/ioremap_wc/ioremap_wt out of ifndef
CONFIG_MMU
earlycon: add reg-offset to physical address before mapping
nds32: Assembly macros and definitions
nds32: Kernel booting and initialization
nds32: Exception handling
nds32: MMU definitions
nds32: MMU initialization
nds32: MMU fault handling and page table management
nds32: Cache and TLB routines
nds32: Process management
nds32: IRQ handling
nds32: Atomic operations
nds32: Device specific operations
nds32: DMA mapping API
nds32: ELF definitions
nds32: System calls handling
nds32: VDSO support
nds32: Signal handling support
nds32: Library functions
nds32: Debugging support
nds32: L2 cache support
nds32: Loadable modules
nds32: Generic timers support
nds32: Device tree support
nds32: Miscellaneous header files
nds32: defconfig
nds32: Build infrastructure
MAINTAINERS: Add nds32
dt-bindings: nds32 CPU Bindings
dt-bindings: nds32 SoC Bindings
dt-bindings: interrupt-controller: Andestech Internal Vector
Interrupt Controller
irqchip: Andestech Internal Vector Interrupt Controller driver
net: faraday add nds32 support.
Rick Chen (3):
clocksource/drivers/atcpit100: Add andestech atcpit100 timer clocksource/drivers/atcpit100: VDSO support
dt-bindings: timer: Add andestech atcpit100 timer binding doc
.../interrupt-controller/andestech,ativic32.txt | 19 + .../devicetree/bindings/nds32/andestech-boards | 40 + Documentation/devicetree/bindings/nds32/cpus.txt | 37 + .../bindings/timer/andestech,atcpit100-timer.txt | 33 + MAINTAINERS | 11 + arch/nds32/Kconfig | 108 +++ arch/nds32/Kconfig.cpu | 161 ++++ arch/nds32/Makefile | 66 ++ arch/nds32/boot/Makefile | 15 + arch/nds32/boot/dts/Makefile | 8 + arch/nds32/boot/dts/ae3xx.dts | 65 ++ arch/nds32/configs/defconfig | 108 +++ arch/nds32/include/asm/Kbuild | 53 ++ arch/nds32/include/asm/assembler.h | 39 + arch/nds32/include/asm/barrier.h | 15 + arch/nds32/include/asm/bitfield.h | 963 ++++++++++++++++++++ arch/nds32/include/asm/cache.h | 12 + arch/nds32/include/asm/cache_info.h | 13 + arch/nds32/include/asm/cacheflush.h | 44 + arch/nds32/include/asm/current.h | 12 + arch/nds32/include/asm/delay.h | 38 + arch/nds32/include/asm/dma-mapping.h | 14 + arch/nds32/include/asm/elf.h | 179 ++++ arch/nds32/include/asm/fixmap.h | 29 + arch/nds32/include/asm/futex.h | 103 +++ arch/nds32/include/asm/highmem.h | 65 ++ arch/nds32/include/asm/io.h | 83 ++ arch/nds32/include/asm/irqflags.h | 36 + arch/nds32/include/asm/l2_cache.h | 142 +++ arch/nds32/include/asm/linkage.h | 11 + arch/nds32/include/asm/memory.h | 105 +++ arch/nds32/include/asm/mmu.h | 12 + arch/nds32/include/asm/mmu_context.h | 68 ++ arch/nds32/include/asm/module.h | 11 + arch/nds32/include/asm/nds32.h | 83 ++ arch/nds32/include/asm/page.h | 67 ++ arch/nds32/include/asm/pgalloc.h | 96 ++ arch/nds32/include/asm/pgtable.h | 413 +++++++++ arch/nds32/include/asm/proc-fns.h | 44 + arch/nds32/include/asm/processor.h | 102 +++ arch/nds32/include/asm/ptrace.h | 66 ++ arch/nds32/include/asm/shmparam.h | 19 + arch/nds32/include/asm/string.h | 17 + arch/nds32/include/asm/swab.h | 35 + arch/nds32/include/asm/syscall.h | 188 ++++ arch/nds32/include/asm/syscalls.h | 13 + arch/nds32/include/asm/thread_info.h | 78 ++ arch/nds32/include/asm/tlb.h | 28 + arch/nds32/include/asm/tlbflush.h | 47 + arch/nds32/include/asm/uaccess.h | 283 ++++++ arch/nds32/include/asm/unistd.h | 6 + arch/nds32/include/asm/vdso.h | 24 + arch/nds32/include/asm/vdso_datapage.h | 36 + arch/nds32/include/asm/vdso_timer_info.h | 14 + arch/nds32/include/uapi/asm/Kbuild | 28 + arch/nds32/include/uapi/asm/auxvec.h | 12 + arch/nds32/include/uapi/asm/byteorder.h | 13 + arch/nds32/include/uapi/asm/cachectl.h | 14 + arch/nds32/include/uapi/asm/param.h | 11 + arch/nds32/include/uapi/asm/ptrace.h | 25 + arch/nds32/include/uapi/asm/sigcontext.h | 60 ++ arch/nds32/include/uapi/asm/unistd.h | 12 + arch/nds32/kernel/Makefile | 23 + arch/nds32/kernel/asm-offsets.c | 28 + arch/nds32/kernel/atl2c.c | 64 ++ arch/nds32/kernel/cacheinfo.c | 49 + arch/nds32/kernel/devtree.c | 19 + arch/nds32/kernel/dma.c | 459 ++++++++++ arch/nds32/kernel/ex-entry.S | 157 ++++ arch/nds32/kernel/ex-exit.S | 193 ++++ arch/nds32/kernel/ex-scall.S | 106 +++ arch/nds32/kernel/head.S | 189 ++++ arch/nds32/kernel/irq.c | 9 + arch/nds32/kernel/module.c | 286 ++++++ arch/nds32/kernel/nds32_ksyms.c | 31 + arch/nds32/kernel/process.c | 204 +++++ arch/nds32/kernel/ptrace.c | 311 +++++++ arch/nds32/kernel/setup.c | 383 ++++++++ arch/nds32/kernel/signal.c | 337 +++++++ arch/nds32/kernel/stacktrace.c | 47 + arch/nds32/kernel/sys_nds32.c | 61 ++ arch/nds32/kernel/syscall_table.c | 17 + arch/nds32/kernel/time.c | 11 + arch/nds32/kernel/traps.c | 428 +++++++++ arch/nds32/kernel/vdso.c | 233 +++++ arch/nds32/kernel/vdso/Makefile | 82 ++ arch/nds32/kernel/vdso/datapage.S | 21 + arch/nds32/kernel/vdso/gen_vdso_offsets.sh | 15 + arch/nds32/kernel/vdso/gettimeofday.c | 271 ++++++ arch/nds32/kernel/vdso/note.S | 11 + arch/nds32/kernel/vdso/sigreturn.S | 19 + arch/nds32/kernel/vdso/vdso.S | 18 + arch/nds32/kernel/vdso/vdso.lds.S | 76 ++ arch/nds32/kernel/vmlinux.lds.S | 57 ++ arch/nds32/lib/Makefile | 3 + arch/nds32/lib/clear_user.S | 42 + arch/nds32/lib/copy_from_user.S | 45 + arch/nds32/lib/copy_page.S | 37 + arch/nds32/lib/copy_template.S | 70 ++ arch/nds32/lib/copy_to_user.S | 45 + arch/nds32/lib/memcpy.S | 30 + arch/nds32/lib/memmove.S | 70 ++ arch/nds32/lib/memset.S | 33 + arch/nds32/lib/memzero.S | 18 + arch/nds32/mm/Makefile | 7 + arch/nds32/mm/alignment.c | 609 +++++++++++++ arch/nds32/mm/cacheflush.c | 322 +++++++ arch/nds32/mm/extable.c | 16 + arch/nds32/mm/fault.c | 410 +++++++++ arch/nds32/mm/highmem.c | 79 ++ arch/nds32/mm/init.c | 277 ++++++ arch/nds32/mm/ioremap.c | 62 ++ arch/nds32/mm/mm-nds32.c | 90 ++ arch/nds32/mm/mmap.c | 73 ++ arch/nds32/mm/proc.c | 540 +++++++++++ arch/nds32/mm/tlb.c | 50 + drivers/clocksource/Kconfig | 7 + drivers/clocksource/Makefile | 1 + drivers/clocksource/timer-atcpit100.c | 273 ++++++ drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-ativic32.c | 107 +++ drivers/net/ethernet/faraday/Kconfig | 6 +- drivers/tty/serial/earlycon.c | 3 +- include/asm-generic/io.h | 18 +- 124 files changed, 12098 insertions(+), 13 deletions(-) create mode 100644 Documentation/devicetree/bindings/interrupt-controller/andestech,ativic32.txt create mode 100644 Documentation/devicetree/bindings/nds32/andestech-boards create mode 100644 Documentation/devicetree/bindings/nds32/cpus.txt create mode 100644 Documentation/devicetree/bindings/timer/andestech,atcpit100-timer.txt create mode 100644 arch/nds32/Kconfig create mode 100644 arch/nds32/Kconfig.cpu create mode 100644 arch/nds32/Makefile create mode 100644 arch/nds32/boot/Makefile create mode 100644 arch/nds32/boot/dts/Makefile create mode 100644 arch/nds32/boot/dts/ae3xx.dts create mode 100644 arch/nds32/configs/defconfig create mode 100644 arch/nds32/include/asm/Kbuild create mode 100644 arch/nds32/include/asm/assembler.h create mode 100644 arch/nds32/include/asm/barrier.h create mode 100644 arch/nds32/include/asm/bitfield.h create mode 100644 arch/nds32/include/asm/cache.h create mode 100644 arch/nds32/include/asm/cache_info.h create mode 100644 arch/nds32/include/asm/cacheflush.h create mode 100644 arch/nds32/include/asm/current.h create mode 100644 arch/nds32/include/asm/delay.h create mode 100644 arch/nds32/include/asm/dma-mapping.h create mode 100644 arch/nds32/include/asm/elf.h create mode 100644 arch/nds32/include/asm/fixmap.h create mode 100644 arch/nds32/include/asm/futex.h create mode 100644 arch/nds32/include/asm/highmem.h create mode 100644 arch/nds32/include/asm/io.h create mode 100644 arch/nds32/include/asm/irqflags.h create mode 100644 arch/nds32/include/asm/l2_cache.h create mode 100644 arch/nds32/include/asm/linkage.h create mode 100644 arch/nds32/include/asm/memory.h create mode 100644 arch/nds32/include/asm/mmu.h create mode 100644 arch/nds32/include/asm/mmu_context.h create mode 100644 arch/nds32/include/asm/module.h create mode 100644 arch/nds32/include/asm/nds32.h create mode 100644 arch/nds32/include/asm/page.h create mode 100644 arch/nds32/include/asm/pgalloc.h create mode 100644 arch/nds32/include/asm/pgtable.h create mode 100644 arch/nds32/include/asm/proc-fns.h create mode 100644 arch/nds32/include/asm/processor.h create mode 100644 arch/nds32/include/asm/ptrace.h create mode 100644 arch/nds32/include/asm/shmparam.h create mode 100644 arch/nds32/include/asm/string.h create mode 100644 arch/nds32/include/asm/swab.h create mode 100644 arch/nds32/include/asm/syscall.h create mode 100644 arch/nds32/include/asm/syscalls.h create mode 100644 arch/nds32/include/asm/thread_info.h create mode 100644 arch/nds32/include/asm/tlb.h create mode 100644 arch/nds32/include/asm/tlbflush.h create mode 100644 arch/nds32/include/asm/uaccess.h create mode 100644 arch/nds32/include/asm/unistd.h create mode 100644 arch/nds32/include/asm/vdso.h create mode 100644 arch/nds32/include/asm/vdso_datapage.h create mode 100644 arch/nds32/include/asm/vdso_timer_info.h create mode 100644 arch/nds32/include/uapi/asm/Kbuild create mode 100644 arch/nds32/include/uapi/asm/auxvec.h create mode 100644 arch/nds32/include/uapi/asm/byteorder.h create mode 100644 arch/nds32/include/uapi/asm/cachectl.h create mode 100644 arch/nds32/include/uapi/asm/param.h create mode 100644 arch/nds32/include/uapi/asm/ptrace.h create mode 100644 arch/nds32/include/uapi/asm/sigcontext.h create mode 100644 arch/nds32/include/uapi/asm/unistd.h create mode 100644 arch/nds32/kernel/Makefile create mode 100644 arch/nds32/kernel/asm-offsets.c create mode 100644 arch/nds32/kernel/atl2c.c create mode 100644 arch/nds32/kernel/cacheinfo.c create mode 100644 arch/nds32/kernel/devtree.c create mode 100644 arch/nds32/kernel/dma.c create mode 100644 arch/nds32/kernel/ex-entry.S create mode 100644 arch/nds32/kernel/ex-exit.S create mode 100644 arch/nds32/kernel/ex-scall.S create mode 100644 arch/nds32/kernel/head.S create mode 100644 arch/nds32/kernel/irq.c create mode 100644 arch/nds32/kernel/module.c create mode 100644 arch/nds32/kernel/nds32_ksyms.c create mode 100644 arch/nds32/kernel/process.c create mode 100644 arch/nds32/kernel/ptrace.c create mode 100644 arch/nds32/kernel/setup.c create mode 100644 arch/nds32/kernel/signal.c create mode 100644 arch/nds32/kernel/stacktrace.c create mode 100644 arch/nds32/kernel/sys_nds32.c create mode 100644 arch/nds32/kernel/syscall_table.c create mode 100644 arch/nds32/kernel/time.c create mode 100644 arch/nds32/kernel/traps.c create mode 100644 arch/nds32/kernel/vdso.c create mode 100644 arch/nds32/kernel/vdso/Makefile create mode 100644 arch/nds32/kernel/vdso/datapage.S create mode 100755 arch/nds32/kernel/vdso/gen_vdso_offsets.sh create mode 100644 arch/nds32/kernel/vdso/gettimeofday.c create mode 100644 arch/nds32/kernel/vdso/note.S create mode 100644 arch/nds32/kernel/vdso/sigreturn.S create mode 100644 arch/nds32/kernel/vdso/vdso.S create mode 100644 arch/nds32/kernel/vdso/vdso.lds.S create mode 100644 arch/nds32/kernel/vmlinux.lds.S create mode 100644 arch/nds32/lib/Makefile create mode 100644 arch/nds32/lib/clear_user.S create mode 100644 arch/nds32/lib/copy_from_user.S create mode 100644 arch/nds32/lib/copy_page.S create mode 100644 arch/nds32/lib/copy_template.S create mode 100644 arch/nds32/lib/copy_to_user.S create mode 100644 arch/nds32/lib/memcpy.S create mode 100644 arch/nds32/lib/memmove.S create mode 100644 arch/nds32/lib/memset.S create mode 100644 arch/nds32/lib/memzero.S create mode 100644 arch/nds32/mm/Makefile create mode 100644 arch/nds32/mm/alignment.c create mode 100644 arch/nds32/mm/cacheflush.c create mode 100644 arch/nds32/mm/extable.c create mode 100644 arch/nds32/mm/fault.c create mode 100644 arch/nds32/mm/highmem.c create mode 100644 arch/nds32/mm/init.c create mode 100644 arch/nds32/mm/ioremap.c create mode 100644 arch/nds32/mm/mm-nds32.c create mode 100644 arch/nds32/mm/mmap.c create mode 100644 arch/nds32/mm/proc.c create mode 100644 arch/nds32/mm/tlb.c create mode 100644 drivers/clocksource/timer-atcpit100.c create mode 100644 drivers/irqchip/irq-ativic32.c
Signature · 6 lines
1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v4 1/36 asm-generic/io.h: move ioremap_nocache/ioremap_uc/ioremap_wc/ioremap_wt out of ifndef CONFIG_MMU
From: Greentime Hu <[email protected]>
It allows some architectures to use this generic macro instead of defining theirs.
--- include/asm-generic/io.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
include/asm-generic/io.h +9 -9
@@ -852,7 +852,16 @@ static inline void __iomem *__ioremap(phys_addr_t offset, size_t size, }#endif +#ifndef iounmap +#define iounmap iounmap + +static inline void iounmap (void __iomem *addr) +{ +} +#endif +#endif /* CONFIG_MMU */ #ifndef ioremap_nocache +void __iomem *ioremap (phys_addr_t phys_addr,size_t size);#define ioremap_nocache ioremap_nocachestatic inline void __iomem *ioremap_nocache (phys_addr_t offset,size_t size) {
@@ -884,15 +893,6 @@ static inline void __iomem *ioremap_wt(phys_addr_t offset, size_t size) }#endif -#ifndef iounmap -#define iounmap iounmap - -static inline void iounmap (void __iomem *addr) -{ -} -#endif -#endif /* CONFIG_MMU */ -#ifdef CONFIG_HAS_IOPORT_MAP #ifndef CONFIG_GENERIC_IOMAP #ifndef ioport_map
Signature · 1 line
1.7.9.5
kbuild test robot
build botRe: [PATCH v4 01/36] asm-generic/io.h: move ioremap_nocache/ioremap_uc/ioremap_wc/ioremap_wt out of ifndef CONFIG_MMU
Thank you for the patch! Yet something to improve:
Hi Greentime,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on tip/timers/core]
[also build test ERROR on v4.15-rc4 next-20171220]
[cannot apply to linus/master]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Greentime-Hu/Andes-nds32-Linux-Kernel/20171220-155937
config: sparc-defconfig (attached as .config)
compiler: sparc-linux-gcc (GCC) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sparc
All error/warnings (new ones prefixed by >>):
In file included from arch/sparc/include/asm/io.h:6:0,
from include/linux/io.h:25,
from include/linux/irq.h:24,
from include/asm-generic/hardirq.h:12,
from arch/sparc/include/asm/hardirq_32.h:10,
from arch/sparc/include/asm/hardirq.h:6,
from include/linux/hardirq.h:8,
from include/linux/interrupt.h:12,
from arch/sparc/kernel/kernel.h:4,
from arch/sparc/kernel/traps_32.c:30:
>> arch/sparc/include/asm/io_32.h:129:15: error: conflicting types for 'ioremap'
void __iomem *ioremap(unsigned long offset, unsigned long size);
^~~~~~~
In file included from arch/sparc/include/asm/io_32.h:13:0,
from arch/sparc/include/asm/io.h:6,
from include/linux/io.h:25,
from include/linux/irq.h:24,
from include/asm-generic/hardirq.h:12,
from arch/sparc/include/asm/hardirq_32.h:10,
from arch/sparc/include/asm/hardirq.h:6,
from include/linux/hardirq.h:8,
from include/linux/interrupt.h:12,
from arch/sparc/kernel/kernel.h:4,
from arch/sparc/kernel/traps_32.c:30:
include/asm-generic/io.h:864:15: note: previous declaration of 'ioremap' was here
void __iomem *ioremap(phys_addr_t phys_addr, size_t size);
^~~~~~~
In file included from arch/sparc/include/asm/io.h:6:0,
from include/linux/io.h:25,
from include/linux/irq.h:24,
from include/asm-generic/hardirq.h:12,
from arch/sparc/include/asm/hardirq_32.h:10,
from arch/sparc/include/asm/hardirq.h:6,
from include/linux/hardirq.h:8,
from include/linux/interrupt.h:12,
from arch/sparc/kernel/kernel.h:4,
from arch/sparc/kernel/traps_32.c:30:
arch/sparc/include/asm/io_32.h:130:0: error: "ioremap_nocache" redefined [-Werror]
#define ioremap_nocache(X,Y) ioremap((X),(Y)) In file included from arch/sparc/include/asm/io_32.h:13:0,
from arch/sparc/include/asm/io.h:6,
from include/linux/io.h:25,
from include/linux/irq.h:24,
from include/asm-generic/hardirq.h:12,
from arch/sparc/include/asm/hardirq_32.h:10,
from arch/sparc/include/asm/hardirq.h:6,
from include/linux/hardirq.h:8,
from include/linux/interrupt.h:12,
from arch/sparc/kernel/kernel.h:4,
from arch/sparc/kernel/traps_32.c:30:
include/asm-generic/io.h:865:0: note: this is the location of the previous definition
#define ioremap_nocache ioremap_nocache In file included from arch/sparc/include/asm/io.h:6:0,
from include/linux/io.h:25,
from include/linux/irq.h:24,
from include/asm-generic/hardirq.h:12,
from arch/sparc/include/asm/hardirq_32.h:10,
from arch/sparc/include/asm/hardirq.h:6,
from include/linux/hardirq.h:8,
from include/linux/interrupt.h:12,
from arch/sparc/kernel/kernel.h:4,
from arch/sparc/kernel/traps_32.c:30:
arch/sparc/include/asm/io_32.h:131:0: error: "ioremap_wc" redefined [-Werror]
#define ioremap_wc(X,Y) ioremap((X),(Y)) In file included from arch/sparc/include/asm/io_32.h:13:0,
from arch/sparc/include/asm/io.h:6,
from include/linux/io.h:25,
from include/linux/irq.h:24,
from include/asm-generic/hardirq.h:12,
from arch/sparc/include/asm/hardirq_32.h:10,
from arch/sparc/include/asm/hardirq.h:6,
from include/linux/hardirq.h:8,
from include/linux/interrupt.h:12,
from arch/sparc/kernel/kernel.h:4,
from arch/sparc/kernel/traps_32.c:30:
include/asm-generic/io.h:881:0: note: this is the location of the previous definition
#define ioremap_wc ioremap_wc In file included from arch/sparc/include/asm/io.h:6:0,
from include/linux/io.h:25,
from include/linux/irq.h:24,
from include/asm-generic/hardirq.h:12,
from arch/sparc/include/asm/hardirq_32.h:10,
from arch/sparc/include/asm/hardirq.h:6,
from include/linux/hardirq.h:8,
from include/linux/interrupt.h:12,
from arch/sparc/kernel/kernel.h:4,
from arch/sparc/kernel/traps_32.c:30:
arch/sparc/include/asm/io_32.h:132:0: error: "ioremap_wt" redefined [-Werror]
#define ioremap_wt(X,Y) ioremap((X),(Y)) In file included from arch/sparc/include/asm/io_32.h:13:0,
from arch/sparc/include/asm/io.h:6,
from include/linux/io.h:25,
from include/linux/irq.h:24,
from include/asm-generic/hardirq.h:12,
from arch/sparc/include/asm/hardirq_32.h:10,
from arch/sparc/include/asm/hardirq.h:6,
from include/linux/hardirq.h:8,
from include/linux/interrupt.h:12,
from arch/sparc/kernel/kernel.h:4,
from arch/sparc/kernel/traps_32.c:30:
include/asm-generic/io.h:889:0: note: this is the location of the previous definition
#define ioremap_wt ioremap_wt cc1: all warnings being treated as errors
--
In file included from arch/sparc/include/asm/io.h:6:0,
from include/linux/io.h:25,
from include/linux/irq.h:24,
from include/asm-generic/hardirq.h:12,
from arch/sparc/include/asm/hardirq_32.h:10,
from arch/sparc/include/asm/hardirq.h:6,
from include/linux/hardirq.h:8,
from include/linux/interrupt.h:12,
from include/linux/pci.h:31,
from arch/sparc/kernel/ioport.c:36:
>> arch/sparc/include/asm/io_32.h:129:15: error: conflicting types for 'ioremap'
void __iomem *ioremap(unsigned long offset, unsigned long size);
^~~~~~~
In file included from arch/sparc/include/asm/io_32.h:13:0,
from arch/sparc/include/asm/io.h:6,
from include/linux/io.h:25,
from include/linux/irq.h:24,
from include/asm-generic/hardirq.h:12,
from arch/sparc/include/asm/hardirq_32.h:10,
from arch/sparc/include/asm/hardirq.h:6,
from include/linux/hardirq.h:8,
from include/linux/interrupt.h:12,
from include/linux/pci.h:31,
from arch/sparc/kernel/ioport.c:36:
include/asm-generic/io.h:864:15: note: previous declaration of 'ioremap' was here
void __iomem *ioremap(phys_addr_t phys_addr, size_t size);
^~~~~~~
In file included from arch/sparc/include/asm/io.h:6:0,
from include/linux/io.h:25,
from include/linux/irq.h:24,
from include/asm-generic/hardirq.h:12,
from arch/sparc/include/asm/hardirq_32.h:10,
from arch/sparc/include/asm/hardirq.h:6,
from include/linux/hardirq.h:8,
from include/linux/interrupt.h:12,
from include/linux/pci.h:31,
from arch/sparc/kernel/ioport.c:36:
arch/sparc/include/asm/io_32.h:130:0: error: "ioremap_nocache" redefined [-Werror]
#define ioremap_nocache(X,Y) ioremap((X),(Y)) In file included from arch/sparc/include/asm/io_32.h:13:0,
from arch/sparc/include/asm/io.h:6,
from include/linux/io.h:25,
from include/linux/irq.h:24,
from include/asm-generic/hardirq.h:12,
from arch/sparc/include/asm/hardirq_32.h:10,
from arch/sparc/include/asm/hardirq.h:6,
from include/linux/hardirq.h:8,
from include/linux/interrupt.h:12,
from include/linux/pci.h:31,
from arch/sparc/kernel/ioport.c:36:
include/asm-generic/io.h:865:0: note: this is the location of the previous definition
#define ioremap_nocache ioremap_nocache In file included from arch/sparc/include/asm/io.h:6:0,
from include/linux/io.h:25,
from include/linux/irq.h:24,
from include/asm-generic/hardirq.h:12,
from arch/sparc/include/asm/hardirq_32.h:10,
from arch/sparc/include/asm/hardirq.h:6,
from include/linux/hardirq.h:8,
from include/linux/interrupt.h:12,
from include/linux/pci.h:31,
from arch/sparc/kernel/ioport.c:36:
arch/sparc/include/asm/io_32.h:131:0: error: "ioremap_wc" redefined [-Werror]
#define ioremap_wc(X,Y) ioremap((X),(Y)) In file included from arch/sparc/include/asm/io_32.h:13:0,
from arch/sparc/include/asm/io.h:6,
from include/linux/io.h:25,
from include/linux/irq.h:24,
from include/asm-generic/hardirq.h:12,
from arch/sparc/include/asm/hardirq_32.h:10,
from arch/sparc/include/asm/hardirq.h:6,
from include/linux/hardirq.h:8,
from include/linux/interrupt.h:12,
from include/linux/pci.h:31,
from arch/sparc/kernel/ioport.c:36:
include/asm-generic/io.h:881:0: note: this is the location of the previous definition
#define ioremap_wc ioremap_wc In file included from arch/sparc/include/asm/io.h:6:0,
from include/linux/io.h:25,
from include/linux/irq.h:24,
from include/asm-generic/hardirq.h:12,
from arch/sparc/include/asm/hardirq_32.h:10,
from arch/sparc/include/asm/hardirq.h:6,
from include/linux/hardirq.h:8,
from include/linux/interrupt.h:12,
from include/linux/pci.h:31,
from arch/sparc/kernel/ioport.c:36:
arch/sparc/include/asm/io_32.h:132:0: error: "ioremap_wt" redefined [-Werror]
#define ioremap_wt(X,Y) ioremap((X),(Y)) In file included from arch/sparc/include/asm/io_32.h:13:0,
from arch/sparc/include/asm/io.h:6,
from include/linux/io.h:25,
from include/linux/irq.h:24,
from include/asm-generic/hardirq.h:12,
from arch/sparc/include/asm/hardirq_32.h:10,
from arch/sparc/include/asm/hardirq.h:6,
from include/linux/hardirq.h:8,
from include/linux/interrupt.h:12,
from include/linux/pci.h:31,
from arch/sparc/kernel/ioport.c:36:
include/asm-generic/io.h:889:0: note: this is the location of the previous definition
#define ioremap_wt ioremap_wt>> arch/sparc/kernel/ioport.c:124:15: error: conflicting types for 'ioremap'
void __iomem *ioremap(unsigned long offset, unsigned long size)
^~~~~~~
In file included from arch/sparc/include/asm/io_32.h:13:0,
from arch/sparc/include/asm/io.h:6,
from include/linux/io.h:25,
from include/linux/irq.h:24,
from include/asm-generic/hardirq.h:12,
from arch/sparc/include/asm/hardirq_32.h:10,
from arch/sparc/include/asm/hardirq.h:6,
from include/linux/hardirq.h:8,
from include/linux/interrupt.h:12,
from include/linux/pci.h:31,
from arch/sparc/kernel/ioport.c:36:
include/asm-generic/io.h:864:15: note: previous declaration of 'ioremap' was here
void __iomem *ioremap(phys_addr_t phys_addr, size_t size);
^~~~~~~
In file included from include/linux/linkage.h:6:0,
from include/linux/kernel.h:6,
from include/linux/list.h:8,
from include/linux/module.h:9,
from arch/sparc/kernel/ioport.c:28:
arch/sparc/kernel/ioport.c:131:15: error: conflicting types for 'ioremap'
EXPORT_SYMBOL(ioremap);
^
include/linux/export.h:65:21: note: in definition of macro '___EXPORT_SYMBOL'
extern typeof(sym) sym; \
^~~
>> arch/sparc/kernel/ioport.c:131:1: note: in expansion of macro 'EXPORT_SYMBOL'
EXPORT_SYMBOL(ioremap);
^~~~~~~~~~~~~
In file included from arch/sparc/include/asm/io_32.h:13:0,
from arch/sparc/include/asm/io.h:6,
from include/linux/io.h:25,
from include/linux/irq.h:24,
from include/asm-generic/hardirq.h:12,
from arch/sparc/include/asm/hardirq_32.h:10,
from arch/sparc/include/asm/hardirq.h:6,
from include/linux/hardirq.h:8,
from include/linux/interrupt.h:12,
from include/linux/pci.h:31,
from arch/sparc/kernel/ioport.c:36:
include/asm-generic/io.h:864:15: note: previous declaration of 'ioremap' was here
void __iomem *ioremap(phys_addr_t phys_addr, size_t size);
^~~~~~~
cc1: all warnings being treated as errors
--
In file included from arch/sparc/include/asm/io.h:6:0,
from include/linux/io.h:25,
from include/linux/irq.h:24,
from include/asm-generic/hardirq.h:12,
from arch/sparc/include/asm/hardirq_32.h:10,
from arch/sparc/include/asm/hardirq.h:6,
from include/linux/hardirq.h:8,
from include/linux/interrupt.h:12,
from include/linux/pci.h:31,
from arch/sparc//kernel/ioport.c:36:
>> arch/sparc/include/asm/io_32.h:129:15: error: conflicting types for 'ioremap'
void __iomem *ioremap(unsigned long offset, unsigned long size);
^~~~~~~
In file included from arch/sparc/include/asm/io_32.h:13:0,
from arch/sparc/include/asm/io.h:6,
from include/linux/io.h:25,
from include/linux/irq.h:24,
from include/asm-generic/hardirq.h:12,
from arch/sparc/include/asm/hardirq_32.h:10,
from arch/sparc/include/asm/hardirq.h:6,
from include/linux/hardirq.h:8,
from include/linux/interrupt.h:12,
from include/linux/pci.h:31,
from arch/sparc//kernel/ioport.c:36:
include/asm-generic/io.h:864:15: note: previous declaration of 'ioremap' was here
void __iomem *ioremap(phys_addr_t phys_addr, size_t size);
^~~~~~~
In file included from arch/sparc/include/asm/io.h:6:0,
from include/linux/io.h:25,
from include/linux/irq.h:24,
from include/asm-generic/hardirq.h:12,
from arch/sparc/include/asm/hardirq_32.h:10,
from arch/sparc/include/asm/hardirq.h:6,
from include/linux/hardirq.h:8,
from include/linux/interrupt.h:12,
from include/linux/pci.h:31,
from arch/sparc//kernel/ioport.c:36:
arch/sparc/include/asm/io_32.h:130:0: error: "ioremap_nocache" redefined [-Werror]
#define ioremap_nocache(X,Y) ioremap((X),(Y)) In file included from arch/sparc/include/asm/io_32.h:13:0,
from arch/sparc/include/asm/io.h:6,
from include/linux/io.h:25,
from include/linux/irq.h:24,
from include/asm-generic/hardirq.h:12,
from arch/sparc/include/asm/hardirq_32.h:10,
from arch/sparc/include/asm/hardirq.h:6,
from include/linux/hardirq.h:8,
from include/linux/interrupt.h:12,
from include/linux/pci.h:31,
from arch/sparc//kernel/ioport.c:36:
include/asm-generic/io.h:865:0: note: this is the location of the previous definition
#define ioremap_nocache ioremap_nocache In file included from arch/sparc/include/asm/io.h:6:0,
from include/linux/io.h:25,
from include/linux/irq.h:24,
from include/asm-generic/hardirq.h:12,
from arch/sparc/include/asm/hardirq_32.h:10,
from arch/sparc/include/asm/hardirq.h:6,
from include/linux/hardirq.h:8,
from include/linux/interrupt.h:12,
from include/linux/pci.h:31,
from arch/sparc//kernel/ioport.c:36:
arch/sparc/include/asm/io_32.h:131:0: error: "ioremap_wc" redefined [-Werror]
#define ioremap_wc(X,Y) ioremap((X),(Y)) In file included from arch/sparc/include/asm/io_32.h:13:0,
from arch/sparc/include/asm/io.h:6,
from include/linux/io.h:25,
from include/linux/irq.h:24,
from include/asm-generic/hardirq.h:12,
from arch/sparc/include/asm/hardirq_32.h:10,
from arch/sparc/include/asm/hardirq.h:6,
from include/linux/hardirq.h:8,
from include/linux/interrupt.h:12,
from include/linux/pci.h:31,
from arch/sparc//kernel/ioport.c:36:
include/asm-generic/io.h:881:0: note: this is the location of the previous definition
#define ioremap_wc ioremap_wc In file included from arch/sparc/include/asm/io.h:6:0,
from include/linux/io.h:25,
from include/linux/irq.h:24,
from include/asm-generic/hardirq.h:12,
from arch/sparc/include/asm/hardirq_32.h:10,
from arch/sparc/include/asm/hardirq.h:6,
from include/linux/hardirq.h:8,
from include/linux/interrupt.h:12,
from include/linux/pci.h:31,
from arch/sparc//kernel/ioport.c:36:
arch/sparc/include/asm/io_32.h:132:0: error: "ioremap_wt" redefined [-Werror]
#define ioremap_wt(X,Y) ioremap((X),(Y)) In file included from arch/sparc/include/asm/io_32.h:13:0,
from arch/sparc/include/asm/io.h:6,
from include/linux/io.h:25,
from include/linux/irq.h:24,
from include/asm-generic/hardirq.h:12,
from arch/sparc/include/asm/hardirq_32.h:10,
from arch/sparc/include/asm/hardirq.h:6,
from include/linux/hardirq.h:8,
from include/linux/interrupt.h:12,
from include/linux/pci.h:31,
from arch/sparc//kernel/ioport.c:36:
include/asm-generic/io.h:889:0: note: this is the location of the previous definition
#define ioremap_wt ioremap_wt arch/sparc//kernel/ioport.c:124:15: error: conflicting types for 'ioremap'
void __iomem *ioremap(unsigned long offset, unsigned long size)
^~~~~~~
vim +/ioremap +129 arch/sparc/include/asm/io_32.h
f5e706ad include/asm-sparc/io_32.h Sam Ravnborg 2008-07-17 124 f5e706ad include/asm-sparc/io_32.h Sam Ravnborg 2008-07-17 125 /* f5e706ad include/asm-sparc/io_32.h Sam Ravnborg 2008-07-17 126 * Bus number may be embedded in the higher bits of the physical address. f5e706ad include/asm-sparc/io_32.h Sam Ravnborg 2008-07-17 127 * This is why we have no bus number argument to ioremap(). f5e706ad include/asm-sparc/io_32.h Sam Ravnborg 2008-07-17 128 */ f05a6865 arch/sparc/include/asm/io_32.h Sam Ravnborg 2014-05-16 @129 void __iomem *ioremap(unsigned long offset, unsigned long size); f5e706ad include/asm-sparc/io_32.h Sam Ravnborg 2008-07-17 130 #define ioremap_nocache(X,Y) ioremap((X),(Y)) 428695b8 include/asm-sparc/io_32.h David S. Miller 2008-07-22 131 #define ioremap_wc(X,Y) ioremap((X),(Y)) 556269c1 arch/sparc/include/asm/io_32.h Toshi Kani 2015-06-04 132 #define ioremap_wt(X,Y) ioremap((X),(Y)) f05a6865 arch/sparc/include/asm/io_32.h Sam Ravnborg 2014-05-16 133 void iounmap(volatile void __iomem *addr); f5e706ad include/asm-sparc/io_32.h Sam Ravnborg 2008-07-17 134
:::::: The code at line 129 was first introduced by commit
:::::: f05a68653e56ca2f23bccf7e50be69486886f052 sparc: drop use of extern for prototypes in arch/sparc/include/asm
:::::: TO: Sam Ravnborg <[email protected]> :::::: CC: David S. Miller <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Re: [PATCH v4 01/36] asm-generic/io.h: move ioremap_nocache/ioremap_uc/ioremap_wc/ioremap_wt out of ifndef CONFIG_MMU
2017-12-20 18:09 GMT+08:00 kbuild test robot <[email protected]>:
Quoted 388 lines
Hi Greentime,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on tip/timers/core]
[also build test ERROR on v4.15-rc4 next-20171220]
[cannot apply to linus/master]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]url: https://github.com/0day-ci/linux/commits/Greentime-Hu/Andes-nds32-Linux-Kernel/20171220-155937
config: sparc-defconfig (attached as .config)
compiler: sparc-linux-gcc (GCC) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sparcAll error/warnings (new ones prefixed by >>):
In file included from arch/sparc/include/asm/io.h:6:0, from include/linux/io.h:25, from include/linux/irq.h:24, from include/asm-generic/hardirq.h:12, from arch/sparc/include/asm/hardirq_32.h:10, from arch/sparc/include/asm/hardirq.h:6, from include/linux/hardirq.h:8, from include/linux/interrupt.h:12, from arch/sparc/kernel/kernel.h:4, from arch/sparc/kernel/traps_32.c:30:Quoted 1 line
Quoted 1 line
arch/sparc/include/asm/io_32.h:129:15: error: conflicting types for 'ioremap'void __iomem *ioremap(unsigned long offset, unsigned long size); ^~~~~~~ In file included from arch/sparc/include/asm/io_32.h:13:0, from arch/sparc/include/asm/io.h:6, from include/linux/io.h:25, from include/linux/irq.h:24, from include/asm-generic/hardirq.h:12, from arch/sparc/include/asm/hardirq_32.h:10, from arch/sparc/include/asm/hardirq.h:6, from include/linux/hardirq.h:8, from include/linux/interrupt.h:12, from arch/sparc/kernel/kernel.h:4, from arch/sparc/kernel/traps_32.c:30: include/asm-generic/io.h:864:15: note: previous declaration of 'ioremap' was here void __iomem *ioremap(phys_addr_t phys_addr, size_t size); ^~~~~~~ In file included from arch/sparc/include/asm/io.h:6:0, from include/linux/io.h:25, from include/linux/irq.h:24, from include/asm-generic/hardirq.h:12, from arch/sparc/include/asm/hardirq_32.h:10, from arch/sparc/include/asm/hardirq.h:6, from include/linux/hardirq.h:8, from include/linux/interrupt.h:12, from arch/sparc/kernel/kernel.h:4, from arch/sparc/kernel/traps_32.c:30: arch/sparc/include/asm/io_32.h:130:0: error: "ioremap_nocache" redefined [-Werror] #define ioremap_nocache(X,Y) ioremap((X),(Y)) In file included from arch/sparc/include/asm/io_32.h:13:0, from arch/sparc/include/asm/io.h:6, from include/linux/io.h:25, from include/linux/irq.h:24, from include/asm-generic/hardirq.h:12, from arch/sparc/include/asm/hardirq_32.h:10, from arch/sparc/include/asm/hardirq.h:6, from include/linux/hardirq.h:8, from include/linux/interrupt.h:12, from arch/sparc/kernel/kernel.h:4, from arch/sparc/kernel/traps_32.c:30: include/asm-generic/io.h:865:0: note: this is the location of the previous definition #define ioremap_nocache ioremap_nocache In file included from arch/sparc/include/asm/io.h:6:0, from include/linux/io.h:25, from include/linux/irq.h:24, from include/asm-generic/hardirq.h:12, from arch/sparc/include/asm/hardirq_32.h:10, from arch/sparc/include/asm/hardirq.h:6, from include/linux/hardirq.h:8, from include/linux/interrupt.h:12, from arch/sparc/kernel/kernel.h:4, from arch/sparc/kernel/traps_32.c:30: arch/sparc/include/asm/io_32.h:131:0: error: "ioremap_wc" redefined [-Werror] #define ioremap_wc(X,Y) ioremap((X),(Y)) In file included from arch/sparc/include/asm/io_32.h:13:0, from arch/sparc/include/asm/io.h:6, from include/linux/io.h:25, from include/linux/irq.h:24, from include/asm-generic/hardirq.h:12, from arch/sparc/include/asm/hardirq_32.h:10, from arch/sparc/include/asm/hardirq.h:6, from include/linux/hardirq.h:8, from include/linux/interrupt.h:12, from arch/sparc/kernel/kernel.h:4, from arch/sparc/kernel/traps_32.c:30: include/asm-generic/io.h:881:0: note: this is the location of the previous definition #define ioremap_wc ioremap_wc In file included from arch/sparc/include/asm/io.h:6:0, from include/linux/io.h:25, from include/linux/irq.h:24, from include/asm-generic/hardirq.h:12, from arch/sparc/include/asm/hardirq_32.h:10, from arch/sparc/include/asm/hardirq.h:6, from include/linux/hardirq.h:8, from include/linux/interrupt.h:12, from arch/sparc/kernel/kernel.h:4, from arch/sparc/kernel/traps_32.c:30: arch/sparc/include/asm/io_32.h:132:0: error: "ioremap_wt" redefined [-Werror] #define ioremap_wt(X,Y) ioremap((X),(Y)) In file included from arch/sparc/include/asm/io_32.h:13:0, from arch/sparc/include/asm/io.h:6, from include/linux/io.h:25, from include/linux/irq.h:24, from include/asm-generic/hardirq.h:12, from arch/sparc/include/asm/hardirq_32.h:10, from arch/sparc/include/asm/hardirq.h:6, from include/linux/hardirq.h:8, from include/linux/interrupt.h:12, from arch/sparc/kernel/kernel.h:4, from arch/sparc/kernel/traps_32.c:30: include/asm-generic/io.h:889:0: note: this is the location of the previous definition #define ioremap_wt ioremap_wt cc1: all warnings being treated as errors -- In file included from arch/sparc/include/asm/io.h:6:0, from include/linux/io.h:25, from include/linux/irq.h:24, from include/asm-generic/hardirq.h:12, from arch/sparc/include/asm/hardirq_32.h:10, from arch/sparc/include/asm/hardirq.h:6, from include/linux/hardirq.h:8, from include/linux/interrupt.h:12, from include/linux/pci.h:31, from arch/sparc/kernel/ioport.c:36:Quoted 1 line
Quoted 1 line
arch/sparc/include/asm/io_32.h:129:15: error: conflicting types for 'ioremap'void __iomem *ioremap(unsigned long offset, unsigned long size); ^~~~~~~ In file included from arch/sparc/include/asm/io_32.h:13:0, from arch/sparc/include/asm/io.h:6, from include/linux/io.h:25, from include/linux/irq.h:24, from include/asm-generic/hardirq.h:12, from arch/sparc/include/asm/hardirq_32.h:10, from arch/sparc/include/asm/hardirq.h:6, from include/linux/hardirq.h:8, from include/linux/interrupt.h:12, from include/linux/pci.h:31, from arch/sparc/kernel/ioport.c:36: include/asm-generic/io.h:864:15: note: previous declaration of 'ioremap' was here void __iomem *ioremap(phys_addr_t phys_addr, size_t size); ^~~~~~~ In file included from arch/sparc/include/asm/io.h:6:0, from include/linux/io.h:25, from include/linux/irq.h:24, from include/asm-generic/hardirq.h:12, from arch/sparc/include/asm/hardirq_32.h:10, from arch/sparc/include/asm/hardirq.h:6, from include/linux/hardirq.h:8, from include/linux/interrupt.h:12, from include/linux/pci.h:31, from arch/sparc/kernel/ioport.c:36: arch/sparc/include/asm/io_32.h:130:0: error: "ioremap_nocache" redefined [-Werror] #define ioremap_nocache(X,Y) ioremap((X),(Y)) In file included from arch/sparc/include/asm/io_32.h:13:0, from arch/sparc/include/asm/io.h:6, from include/linux/io.h:25, from include/linux/irq.h:24, from include/asm-generic/hardirq.h:12, from arch/sparc/include/asm/hardirq_32.h:10, from arch/sparc/include/asm/hardirq.h:6, from include/linux/hardirq.h:8, from include/linux/interrupt.h:12, from include/linux/pci.h:31, from arch/sparc/kernel/ioport.c:36: include/asm-generic/io.h:865:0: note: this is the location of the previous definition #define ioremap_nocache ioremap_nocache In file included from arch/sparc/include/asm/io.h:6:0, from include/linux/io.h:25, from include/linux/irq.h:24, from include/asm-generic/hardirq.h:12, from arch/sparc/include/asm/hardirq_32.h:10, from arch/sparc/include/asm/hardirq.h:6, from include/linux/hardirq.h:8, from include/linux/interrupt.h:12, from include/linux/pci.h:31, from arch/sparc/kernel/ioport.c:36: arch/sparc/include/asm/io_32.h:131:0: error: "ioremap_wc" redefined [-Werror] #define ioremap_wc(X,Y) ioremap((X),(Y)) In file included from arch/sparc/include/asm/io_32.h:13:0, from arch/sparc/include/asm/io.h:6, from include/linux/io.h:25, from include/linux/irq.h:24, from include/asm-generic/hardirq.h:12, from arch/sparc/include/asm/hardirq_32.h:10, from arch/sparc/include/asm/hardirq.h:6, from include/linux/hardirq.h:8, from include/linux/interrupt.h:12, from include/linux/pci.h:31, from arch/sparc/kernel/ioport.c:36: include/asm-generic/io.h:881:0: note: this is the location of the previous definition #define ioremap_wc ioremap_wc In file included from arch/sparc/include/asm/io.h:6:0, from include/linux/io.h:25, from include/linux/irq.h:24, from include/asm-generic/hardirq.h:12, from arch/sparc/include/asm/hardirq_32.h:10, from arch/sparc/include/asm/hardirq.h:6, from include/linux/hardirq.h:8, from include/linux/interrupt.h:12, from include/linux/pci.h:31, from arch/sparc/kernel/ioport.c:36: arch/sparc/include/asm/io_32.h:132:0: error: "ioremap_wt" redefined [-Werror] #define ioremap_wt(X,Y) ioremap((X),(Y)) In file included from arch/sparc/include/asm/io_32.h:13:0, from arch/sparc/include/asm/io.h:6, from include/linux/io.h:25, from include/linux/irq.h:24, from include/asm-generic/hardirq.h:12, from arch/sparc/include/asm/hardirq_32.h:10, from arch/sparc/include/asm/hardirq.h:6, from include/linux/hardirq.h:8, from include/linux/interrupt.h:12, from include/linux/pci.h:31, from arch/sparc/kernel/ioport.c:36: include/asm-generic/io.h:889:0: note: this is the location of the previous definition #define ioremap_wt ioremap_wtQuoted 1 line
Quoted 1 line
arch/sparc/kernel/ioport.c:124:15: error: conflicting types for 'ioremap'void
__iomem*ioremap(unsigned long offset, unsigned long size)
^~~~~~~
In file included fromarch/sparc/include/asm/io_32.h:13:0,from arch/sparc/include/asm/io.h:6, from include/linux/io.h:25, from include/linux/irq.h:24, from include/asm-generic/hardirq.h:12, from arch/sparc/include/asm/hardirq_32.h:10, from arch/sparc/include/asm/hardirq.h:6, from include/linux/hardirq.h:8, from include/linux/interrupt.h:12, from include/linux/pci.h:31, from arch/sparc/kernel/ioport.c:36: include/asm-generic/io.h:864:15: note: previous declaration of 'ioremap' was here void __iomem *ioremap(phys_addr_t phys_addr, size_t size); ^~~~~~~ In file included from include/linux/linkage.h:6:0, from include/linux/kernel.h:6, from include/linux/list.h:8, from include/linux/module.h:9, from arch/sparc/kernel/ioport.c:28: arch/sparc/kernel/ioport.c:131:15: error: conflicting types for 'ioremap' EXPORT_SYMBOL(ioremap); ^ include/linux/export.h:65:21: note: in definition of macro '___EXPORT_SYMBOL' extern typeof(sym) sym; \ ^~~Quoted 1 line
Quoted 1 line
arch/sparc/kernel/ioport.c:131:1: note: in expansion of macro 'EXPORT_SYMBOL'EXPORT_SYMBOL(ioremap); ^~~~~~~~~~~~~ In file included from arch/sparc/include/asm/io_32.h:13:0, from arch/sparc/include/asm/io.h:6, from include/linux/io.h:25, from include/linux/irq.h:24, from include/asm-generic/hardirq.h:12, from arch/sparc/include/asm/hardirq_32.h:10, from arch/sparc/include/asm/hardirq.h:6, from include/linux/hardirq.h:8, from include/linux/interrupt.h:12, from include/linux/pci.h:31, from arch/sparc/kernel/ioport.c:36: include/asm-generic/io.h:864:15: note: previous declaration of 'ioremap' was here void __iomem *ioremap(phys_addr_t phys_addr, size_t size); ^~~~~~~ cc1: all warnings being treated as errors -- In file included from arch/sparc/include/asm/io.h:6:0, from include/linux/io.h:25, from include/linux/irq.h:24, from include/asm-generic/hardirq.h:12, from arch/sparc/include/asm/hardirq_32.h:10, from arch/sparc/include/asm/hardirq.h:6, from include/linux/hardirq.h:8, from include/linux/interrupt.h:12, from include/linux/pci.h:31, from arch/sparc//kernel/ioport.c:36:Quoted 1 line
Quoted 1 line
arch/sparc/include/asm/io_32.h:129:15: error: conflicting types for 'ioremap'void __iomem *ioremap(unsigned long offset, unsigned long size); ^~~~~~~ In file included from arch/sparc/include/asm/io_32.h:13:0, from arch/sparc/include/asm/io.h:6, from include/linux/io.h:25, from include/linux/irq.h:24, from include/asm-generic/hardirq.h:12, from arch/sparc/include/asm/hardirq_32.h:10, from arch/sparc/include/asm/hardirq.h:6, from include/linux/hardirq.h:8, from include/linux/interrupt.h:12, from include/linux/pci.h:31, from arch/sparc//kernel/ioport.c:36: include/asm-generic/io.h:864:15: note: previous declaration of 'ioremap' was here void __iomem *ioremap(phys_addr_t phys_addr, size_t size); ^~~~~~~ In file included from arch/sparc/include/asm/io.h:6:0, from include/linux/io.h:25, from include/linux/irq.h:24, from include/asm-generic/hardirq.h:12, from arch/sparc/include/asm/hardirq_32.h:10, from arch/sparc/include/asm/hardirq.h:6, from include/linux/hardirq.h:8, from include/linux/interrupt.h:12, from include/linux/pci.h:31, from arch/sparc//kernel/ioport.c:36: arch/sparc/include/asm/io_32.h:130:0: error: "ioremap_nocache" redefined [-Werror] #define ioremap_nocache(X,Y) ioremap((X),(Y)) In file included from arch/sparc/include/asm/io_32.h:13:0, from arch/sparc/include/asm/io.h:6, from include/linux/io.h:25, from include/linux/irq.h:24, from include/asm-generic/hardirq.h:12, from arch/sparc/include/asm/hardirq_32.h:10, from arch/sparc/include/asm/hardirq.h:6, from include/linux/hardirq.h:8, from include/linux/interrupt.h:12, from include/linux/pci.h:31, from arch/sparc//kernel/ioport.c:36: include/asm-generic/io.h:865:0: note: this is the location of the previous definition #define ioremap_nocache ioremap_nocache In file included from arch/sparc/include/asm/io.h:6:0, from include/linux/io.h:25, from include/linux/irq.h:24, from include/asm-generic/hardirq.h:12, from arch/sparc/include/asm/hardirq_32.h:10, from arch/sparc/include/asm/hardirq.h:6, from include/linux/hardirq.h:8, from include/linux/interrupt.h:12, from include/linux/pci.h:31, from arch/sparc//kernel/ioport.c:36: arch/sparc/include/asm/io_32.h:131:0: error: "ioremap_wc" redefined [-Werror] #define ioremap_wc(X,Y) ioremap((X),(Y)) In file included from arch/sparc/include/asm/io_32.h:13:0, from arch/sparc/include/asm/io.h:6, from include/linux/io.h:25, from include/linux/irq.h:24, from include/asm-generic/hardirq.h:12, from arch/sparc/include/asm/hardirq_32.h:10, from arch/sparc/include/asm/hardirq.h:6, from include/linux/hardirq.h:8, from include/linux/interrupt.h:12, from include/linux/pci.h:31, from arch/sparc//kernel/ioport.c:36: include/asm-generic/io.h:881:0: note: this is the location of the previous definition #define ioremap_wc ioremap_wc In file included from arch/sparc/include/asm/io.h:6:0, from include/linux/io.h:25, from include/linux/irq.h:24, from include/asm-generic/hardirq.h:12, from arch/sparc/include/asm/hardirq_32.h:10, from arch/sparc/include/asm/hardirq.h:6, from include/linux/hardirq.h:8, from include/linux/interrupt.h:12, from include/linux/pci.h:31, from arch/sparc//kernel/ioport.c:36: arch/sparc/include/asm/io_32.h:132:0: error: "ioremap_wt" redefined [-Werror] #define ioremap_wt(X,Y) ioremap((X),(Y)) In file included from arch/sparc/include/asm/io_32.h:13:0, from arch/sparc/include/asm/io.h:6, from include/linux/io.h:25, from include/linux/irq.h:24, from include/asm-generic/hardirq.h:12, from arch/sparc/include/asm/hardirq_32.h:10, from arch/sparc/include/asm/hardirq.h:6, from include/linux/hardirq.h:8, from include/linux/interrupt.h:12,
Quoted 9 lines
from include/linux/pci.h:31,
from arch/sparc//kernel/ioport.c:36:
include/asm-generic/io.h:889:0: note: this is the location of the previous definition
#define ioremap_wt ioremap_wt
arch/sparc//kernel/ioport.c:124:15: error: conflicting types for 'ioremap'
void __iomem *ioremap(unsigned long offset, unsigned long size)
^~~~~~~Hi, all:
I just tried to fix this build error.
Should I send this patch next time with nds32 patchset?
arch/sparc/include/asm/io_32.h +0 -0
@@ -126,12 +126,7 @@ static inline void sbus_memcpy_toio(volatile void
__iomem *dst,
* Bus number may be embedded in the higher bits of the physical address.
* This is why we have no bus number argument to ioremap(). */
-void __iomem *ioremap(unsigned long offset, unsigned long size);
-#define ioremap_nocache(X,Y) ioremap((X),(Y))
-#define ioremap_wc(X,Y) ioremap((X),(Y))
-#define ioremap_wt(X,Y) ioremap((X),(Y))
void iounmap(volatile void __iomem *addr);
-
/* Create a virtual mapping cookie for an IO port range */ void __iomem *ioport_map(unsigned long port, unsigned int nr); void ioport_unmap(void __iomem *);
arch/sparc/kernel/ioport.c +2 -2
@@ -121,12 +121,12 @@ static void xres_free(struct xresource *xrp) {* * Bus type is always zero on IIep. */ -void __iomem *ioremap (unsigned long offset,unsigned long size) +void __iomem *ioremap (phys_addr_t offset,size_t size) {char name[14 ];sprintf (name,"phys_%08x" , (u32 )offset); -return _sparc_alloc_io (0 , offset, size, name); +return _sparc_alloc_io (0 , (unsigned long )offset, size, name); }EXPORT_SYMBOL (ioremap);
kbuild test robot
build botRe: [PATCH v4 01/36] asm-generic/io.h: move ioremap_nocache/ioremap_uc/ioremap_wc/ioremap_wt out of ifndef CONFIG_MMU
In reply to Greentime HuThank you for the patch! Yet something to improve:
Hi Greentime,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on tip/timers/core]
[also build test ERROR on v4.15-rc4 next-20171220]
[cannot apply to linus/master]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Greentime-Hu/Andes-nds32-Linux-Kernel/20171220-155937
config: openrisc-or1ksim_defconfig (attached as .config)
compiler: or1k-linux-gcc (GCC) 6.0.0 20160327 (experimental)
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=openrisc
All error/warnings (new ones prefixed by >>):
In file included from include/linux/io.h:25:0,
from arch/openrisc/kernel/asm-offsets.c:35:
>> arch/openrisc/include/asm/io.h:38:29: error: conflicting types for 'ioremap'
static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size)
^~~~~~~
In file included from arch/openrisc/include/asm/io.h:32:0,
from include/linux/io.h:25,
from arch/openrisc/kernel/asm-offsets.c:35:
include/asm-generic/io.h:864:15: note: previous declaration of 'ioremap' was here
void __iomem *ioremap(phys_addr_t phys_addr, size_t size);
^~~~~~~
include/asm-generic/io.h:865:25: error: conflicting types for 'ioremap_nocache'
#define ioremap_nocache ioremap_nocache
^
>> arch/openrisc/include/asm/io.h:44:29: note: in expansion of macro 'ioremap_nocache'
static inline void __iomem *ioremap_nocache(phys_addr_t offset,
^~~~~~~~~~~~~~~
include/asm-generic/io.h:865:25: note: previous definition of 'ioremap_nocache' was here
#define ioremap_nocache ioremap_nocache
^ include/asm-generic/io.h:866:29: note: in expansion of macro 'ioremap_nocache'
static inline void __iomem *ioremap_nocache(phys_addr_t offset, size_t size)
^~~~~~~~~~~~~~~
make[2]: *** [arch/openrisc/kernel/asm-offsets.s] Error 1 make[2]: Target '__build' not remade because of errors.
make[1]: *** [prepare0] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [sub-make] Error 2
vim +/ioremap +38 arch/openrisc/include/asm/io.h
58e0166a Jonas Bonn 2011-06-04 3158e0166a Jonas Bonn 2011-06-04 @32 #include <asm-generic/io.h>
9b04ebd1 James Hogan 2012-10-23 33 #include <asm/pgtable.h>
58e0166a Jonas Bonn 2011-06-04 34
58e0166a Jonas Bonn 2011-06-04 35 extern void __iomem *__ioremap(phys_addr_t offset, unsigned long size,
58e0166a Jonas Bonn 2011-06-04 36 pgprot_t prot);
58e0166a Jonas Bonn 2011-06-04 37
58e0166a Jonas Bonn 2011-06-04 @38 static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size)
58e0166a Jonas Bonn 2011-06-04 39 {
58e0166a Jonas Bonn 2011-06-04 40 return __ioremap(offset, size, PAGE_KERNEL);
58e0166a Jonas Bonn 2011-06-04 41 }
58e0166a Jonas Bonn 2011-06-04 42
58e0166a Jonas Bonn 2011-06-04 43 /* #define _PAGE_CI 0x002 */
58e0166a Jonas Bonn 2011-06-04 @44 static inline void __iomem *ioremap_nocache(phys_addr_t offset,
58e0166a Jonas Bonn 2011-06-04 45 unsigned long size)
58e0166a Jonas Bonn 2011-06-04 46 {
58e0166a Jonas Bonn 2011-06-04 47 return __ioremap(offset, size,
58e0166a Jonas Bonn 2011-06-04 48 __pgprot(pgprot_val(PAGE_KERNEL) | _PAGE_CI));
58e0166a Jonas Bonn 2011-06-04 49 }
58e0166a Jonas Bonn 2011-06-04 50 :::::: The code at line 38 was first introduced by commit :::::: 58e0166a4772aaeb10c9b0f6d59f19099d2047df OpenRISC: Headers
:::::: TO: Jonas Bonn <[email protected]>
:::::: CC: Jonas Bonn <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Re: [PATCH v4 01/36] asm-generic/io.h: move ioremap_nocache/ioremap_uc/ioremap_wc/ioremap_wt out of ifndef CONFIG_MMU
2017-12-20 18:10 GMT+08:00 kbuild test robot <[email protected]>:
Quoted 75 lines
Hi Greentime,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on tip/timers/core]
[also build test ERROR on v4.15-rc4 next-20171220]
[cannot apply to linus/master]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]url: https://github.com/0day-ci/linux/commits/Greentime-Hu/Andes-nds32-Linux-Kernel/20171220-155937
config: openrisc-or1ksim_defconfig (attached as .config)
compiler: or1k-linux-gcc (GCC) 6.0.0 20160327 (experimental)
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=openriscAll error/warnings (new ones prefixed by >>):
In file included from
include/linux/io.h:25:0,
fromarch/openrisc/kernel/asm-offsets.c:35:Quoted 1 line
Quoted 1 line
arch/openrisc/include/asm/io.h:38:29: error: conflicting types for 'ioremap'static inline void
__iomem*ioremap(phys_addr_t offset, unsigned long size)
^~~~~~~
In file included fromarch/openrisc/include/asm/io.h:32:0,from include/linux/io.h:25, from arch/openrisc/kernel/asm-offsets.c:35: include/asm-generic/io.h:864:15: note: previous declaration of 'ioremap' was here void __iomem *ioremap(phys_addr_t phys_addr, size_t size); ^~~~~~~ include/asm-generic/io.h:865:25: error: conflicting types for 'ioremap_nocache' #define ioremap_nocache ioremap_nocache ^Quoted 1 line
Quoted 1 line
arch/openrisc/include/asm/io.h:44:29: note: in expansion of macro 'ioremap_nocache'static inline void
__iomem*ioremap_nocache(phys_addr_t offset,
^~~~~~~~~~~~~~~
include/asm-generic/io.h:865:25: note: previous definition of 'ioremap_nocache' was here#define ioremap_nocache ioremap_nocache ^
include/asm-generic/io.h:866:29: note: in expansion of macro 'ioremap_nocache'
static inline void__iomem*ioremap_nocache(phys_addr_t offset,size_tsize)
^~~~~~~~~~~~~~~
make[2]: *** [arch/openrisc/kernel/asm-offsets.s] Error 1 make[2]: Target '__build' not remade because of errors.
make[1]: *** [prepare0] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [sub-make] Error 2vim +/ioremap +38
arch/openrisc/include/asm/io.h
58e0166aJonas Bonn 2011-06-04 3158e0166aJonas Bonn 2011-06-04 @32 #include <asm-generic/io.h>9b04ebd1 James Hogan 2012-10-23 33 #include <asm/pgtable.h> 58e0166a Jonas Bonn 2011-06-04 34 58e0166a Jonas Bonn 2011-06-04 35 extern void __iomem *__ioremap(phys_addr_t offset, unsigned long size, 58e0166a Jonas Bonn 2011-06-04 36 pgprot_t prot); 58e0166a Jonas Bonn 2011-06-04 37 58e0166a Jonas Bonn 2011-06-04 @38 static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size) 58e0166a Jonas Bonn 2011-06-04 39 { 58e0166a Jonas Bonn 2011-06-04 40 return __ioremap(offset, size, PAGE_KERNEL); 58e0166a Jonas Bonn 2011-06-04 41 } 58e0166a Jonas Bonn 2011-06-04 42 58e0166a Jonas Bonn 2011-06-04 43 /* #define _PAGE_CI 0x002 */ 58e0166a Jonas Bonn 2011-06-04 @44 static inline void __iomem *ioremap_nocache(phys_addr_t offset, 58e0166a Jonas Bonn 2011-06-04 45 unsigned long size) 58e0166a Jonas Bonn 2011-06-04 46 { 58e0166a Jonas Bonn 2011-06-04 47 return __ioremap(offset, size, 58e0166a Jonas Bonn 2011-06-04 48 __pgprot(pgprot_val(PAGE_KERNEL) | _PAGE_CI)); 58e0166a Jonas Bonn 2011-06-04 49 } 58e0166a Jonas Bonn 2011-06-04 50:::::: The code at line 38 was first introduced by commit ::::::
58e0166a4772aaeb10c9b0f6d59f19099d2047dfOpenRISC: Headers
Quoted 6 lines
:::::: TO: Jonas Bonn <[email protected]>
:::::: CC: Jonas Bonn <[email protected]>---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Hi, all:
I just tried to fix this build error.
Should I send this patch next time with nds32 patchset?
arch/openrisc/include/asm/io.h +2 -1
@@ -29,13 +29,14 @@#define PIO_OFFSET 0#define PIO_MASK 0 +#define ioremap_nocache ioremap_nocache#include <asm-generic/io.h> #include <asm/pgtable.h> extern void __iomem *__ioremap (phys_addr_t offset,unsigned long size,pgprot_t prot); -static inline void __iomem *ioremap (phys_addr_t offset,unsigned long size) +static inline void __iomem *ioremap (phys_addr_t offset,size_t size) {return __ioremap (offset, size,PAGE_KERNEL ); }
PATCH v4 2/36 earlycon: add reg-offset to physical address before mapping
In reply to Greentime HuFrom: Greentime Hu <[email protected]>
It will get the wrong virtual address because port->mapbase is not added the correct reg-offset yet. We have to update it before earlycon_map() is called
--- drivers/tty/serial/earlycon.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/tty/serial/earlycon.c +2 -1
@@ -253,11 +253,12 @@ int __init of_setup_earlycon(const struct earlycon_id *match, } port->mapbase = addr; port->uartclk =BASE_BAUD *16 ; - port->membase =earlycon_map (port->mapbase,SZ_4K ); val =of_get_flat_dt_prop (node,"reg-offset" ,NULL );if (val) port->mapbase +=be32_to_cpu (*val); + port->membase =earlycon_map (port->mapbase,SZ_4K ); + val =of_get_flat_dt_prop (node,"reg-shift" ,NULL );if (val) port->regshift =be32_to_cpu (*val);
Signature · 1 line
1.7.9.5
PATCH v4 3/36 nds32: Assembly macros and definitions
In reply to Greentime HuFrom: Greentime Hu <[email protected]>
This patch includes assembly macros, bit field definitions used in .S files across arch/nds32/.
--- arch/nds32/include/asm/assembler.h | 39 ++ arch/nds32/include/asm/bitfield.h | 963 ++++++++++++++++++++++++++++++++++++ arch/nds32/include/asm/nds32.h | 83 ++++ arch/nds32/kernel/asm-offsets.c | 28 ++ 4 files changed, 1113 insertions(+) create mode 100644 arch/nds32/include/asm/assembler.h create mode 100644 arch/nds32/include/asm/bitfield.h create mode 100644 arch/nds32/include/asm/nds32.h create mode 100644 arch/nds32/kernel/asm-offsets.c
arch/nds32/include/asm/assembler.h new file +39 -0
@@ -0,0 +1,39 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#ifndef __NDS32_ASSEMBLER_H__ +#define __NDS32_ASSEMBLER_H__ + +.macro gie_disable + setgie.d + dsb +.endm + +.macro gie_enable + setgie.e + dsb +.endm + +.macro gie_save oldpsw + mfsr \oldpsw, $ir0 + setgie.d + dsb +.endm + +.macro gie_restore oldpsw + andi \oldpsw, \oldpsw, #0x1 + beqz \oldpsw, 7001f + setgie.e + dsb +7001: +.endm + + +#define USER(insn, reg, addr, opr) \ +9999: insn reg, addr, opr; \ + .section __ex_table,"a"; \ + .align 3; \ + .long 9999b, 9001f; \ + .previous + +#endif /* __NDS32_ASSEMBLER_H__ */
arch/nds32/include/asm/bitfield.h new file +963 -0
963 lines not on this page · raw message
arch/nds32/include/asm/nds32.h new file +83 -0
83 lines not on this page · raw message
arch/nds32/kernel/asm-offsets.c new file +28 -0
@@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#include <linux/sched.h> +#include <linux/sched/task_stack.h> +#include <linux/kbuild.h> +#include <asm/thread_info.h> +#include <asm/ptrace.h> + +int main (void ) +{ + DEFINE(TSK_TI_FLAGS, offsetof(struct task_struct, thread_info.flags)); +DEFINE (TSK_TI_PREEMPT , + offsetof(struct task_struct, thread_info.preempt_count)); +DEFINE (THREAD_CPU_CONTEXT , + offsetof(struct task_struct, thread.cpu_context)); +DEFINE (OSP_OFFSET , offsetof(struct pt_regs , osp)); +DEFINE (SP_OFFSET , offsetof(struct pt_regs , sp)); +DEFINE (FUCOP_CTL_OFFSET , offsetof(struct pt_regs , fucop_ctl)); +DEFINE (IPSW_OFFSET , offsetof(struct pt_regs , ipsw)); +DEFINE (SYSCALLNO_OFFSET , offsetof(struct pt_regs , syscallno)); +DEFINE (IPC_OFFSET , offsetof(struct pt_regs , ipc)); + DEFINE(R0_OFFSET, offsetof(struct pt_regs, uregs[0])); + DEFINE(R15_OFFSET, offsetof(struct pt_regs, uregs[15])); +DEFINE (CLOCK_REALTIME_RES ,MONOTONIC_RES_NSEC ); +DEFINE (CLOCK_COARSE_RES ,LOW_RES_NSEC ); +return 0 ; +}
Signature · 1 line
1.7.9.5
PATCH v4 4/36 nds32: Kernel booting and initialization
In reply to Greentime HuFrom: Greentime Hu <[email protected]>
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.
--- 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
arch/nds32/kernel/head.S new file +189 -0
@@ -0,0 +1,189 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#include <linux/linkage.h> +#include <linux/init.h> +#include <asm/ptrace.h> +#include <asm/asm-offsets.h> +#include <asm/page.h> +#include <asm/pgtable.h> +#include <asm/l2_cache.h> +#include <asm/sizes.h> +#include <asm/thread_info.h> + +#ifdef CONFIG_CPU_BIG_ENDIAN +#define OF_DT_MAGIC 0xd00dfeed +#else +#define OF_DT_MAGIC 0xedfe0dd0 +#endif + + .globl swapper_pg_dir + .equ swapper_pg_dir, TEXTADDR - 0x4000 + +/* + * Kernel startup entry point. + */ + .section ".head.text", "ax" + .type _stext, %function +ENTRY(_stext) + setgie.d ! Disable interrupt + isb +/* + * Disable I/D-cache and enable it at a proper time + */ + mfsr $r0, $mr8 + li $r1, #~(CACHE_CTL_mskIC_EN|CACHE_CTL_mskDC_EN) + and $r0, $r0, $r1 + mtsr $r0, $mr8 + +/* + * Process device tree blob + */ + andi $r0,$r2,#0x3 + li $r10, 0 + bne $r0, $r10, _nodtb + lwi $r0, [$r2] + li $r1, OF_DT_MAGIC + bne $r0, $r1, _nodtb + move $r10, $r2 +_nodtb: + +/* + * Create a temporary mapping area for booting, before start_kernel + */ + sethi $r4, hi20(swapper_pg_dir) + li $p0, (PAGE_OFFSET - PHYS_OFFSET) + sub $r4, $r4, $p0 + tlbop FlushAll ! invalidate TLB\n" + isb + mtsr $r4, $L1_PPTB ! load page table pointer\n" + +/* set NTC0 cacheable/writeback, mutliple page size in use */ + mfsr $r3, $MMU_CTL + li $r0, #~MMU_CTL_mskNTC0 + and $r3, $r3, $r0 +#ifdef CONFIG_ANDES_PAGE_SIZE_4KB + ori $r3, $r3, #(MMU_CTL_mskMPZIU|(MMU_CTL_CACHEABLE_WB << MMU_CTL_offNTC0)) +#else + ori $r3, $r3, #(MMU_CTL_mskMPZIU|(MMU_CTL_CACHEABLE_WB << MMU_CTL_offNTC0)|MMU_CTL_D8KB) +#endif +#ifdef CONFIG_HW_SUPPORT_UNALIGNMENT_ACCESS + li $r0, #MMU_CTL_UNA + or $r3, $r3, $r0 +#endif + mtsr $r3, $MMU_CTL + isb + +/* set page size and size of kernel image */ + mfsr $r0, $MMU_CFG + srli $r3, $r0, MMU_CFG_offfEPSZ + zeb $r3, $r3 + bnez $r3, _extra_page_size_support +#ifdef CONFIG_ANDES_PAGE_SIZE_4KB + li $r5, #SZ_4K ! Use 4KB page size +#else + li $r5, #SZ_8K ! Use 8KB page size + li $r3, #1 +#endif + mtsr $r3, $TLB_MISC + b _image_size_check + +_extra_page_size_support: ! Use epzs pages size + clz $r6, $r3 + subri $r2, $r6, #31 + li $r3, #1 + sll $r3, $r3, $r2 + /* MMU_CFG.EPSZ value -> meaning */ + mul $r5, $r3, $r3 + slli $r5, $r5, #14 + /* MMU_CFG.EPSZ -> TLB_MISC.ACC_PSZ */ + addi $r3, $r2, #0x2 + mtsr $r3, $TLB_MISC + +_image_size_check: + /* calculate the image maximum size accepted by TLB config */ + andi $r6, $r0, MMU_CFG_mskTBW + andi $r0, $r0, MMU_CFG_mskTBS + srli $r6, $r6, MMU_CFG_offTBW + srli $r0, $r0, MMU_CFG_offTBS + /* + * we just map the kernel to the maximum way - 1 of tlb + * reserver one way for UART VA mapping + * it will cause page fault if UART mapping cover the kernel mapping + * + * direct mapping is not supported now. + */ + li $r2, 't' + beqz $r6, __error ! MMU_CFG.TBW = 0 is direct mappin + addi $r0, $r0, #0x2 ! MMU_CFG.TBS value -> meaning + sll $r0, $r6, $r0 ! entries = k-way * n-set + mul $r6, $r0, $r5 ! max size = entries * page size + /* check kernel image size */ + la $r3, (_end - PAGE_OFFSET) + li $r2, 's' + bgt $r3, $r6, __error + + li $r2, #(PHYS_OFFSET + TLB_DATA_kernel_text_attr) + li $r3, PAGE_OFFSET + add $r6, $r6, $r3 + +_tlb: + mtsr $r3, $TLB_VPN + dsb + tlbop $r2, RWR + isb + add $r3, $r3, $r5 + add $r2, $r2, $r5 + bgt $r6, $r3, _tlb + mfsr $r3, $TLB_MISC ! setup access page size + li $r2, #~0xf + and $r3, $r3, $r2 +#ifdef CONFIG_ANDES_PAGE_SIZE_8KB + ori $r3, $r3, #0x1 +#endif + mtsr $r3, $TLB_MISC + + mfsr $r0, $MISC_CTL ! Enable BTB and RTP and shadow sp + ori $r0, $r0, #MISC_init + mtsr $r0, $MISC_CTL + + mfsr $p1, $PSW + li $r15, #~PSW_clr ! clear WBNA|DME|IME|DT|IT|POM|INTL|GIE + and $p1, $p1, $r15 + ori $p1, $p1, #PSW_init + mtsr $p1, $IPSW ! when iret, it will automatically enable MMU + la $lp, __mmap_switched + mtsr $lp, $IPC + iret + nop + + .type __switch_data, %object +__switch_data: + .long __bss_start ! $r6 + .long _end ! $r7 + .long __atags_pointer ! $atag_pointer + .long init_task ! $r9, move to $r25 + .long init_thread_union + THREAD_SIZE ! $sp + + +/* + * The following fragment of code is executed with the MMU on in MMU mode, + * and uses absolute addresses; this is not position independent. + */ + .align + .type __mmap_switched, %function +__mmap_switched: + la $r3, __switch_data + lmw.bim $r6, [$r3], $r9, #0b0001 + move $r25, $r9 + move $fp, #0 ! Clear BSS (and zero $fp) + beq $r7, $r6, _RRT +1: swi.bi $fp, [$r6], #4 + bne $r7, $r6, 1b + swi $r10, [$r8] + +_RRT: + b start_kernel + +__error: + b __error
arch/nds32/kernel/setup.c new file +383 -0
383 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Re: [PATCH v4 04/36] nds32: Kernel booting and initialization
Quoted 25 lines · Greentime Hu
From: Greentime Hu <greentime-MUIXKm3Oiri1Z/[email protected]>
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-MUIXKm3Oiri1Z/[email protected]>Signed-off-by Greentime Hu <greentime-MUIXKm3Oiri1Z/[email protected]>--- 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.carch/nds32/kernel/setup.c new file +3
-0@@ -0,0 +1,383 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation +
[snip]
Quoted 4 lines
arch/nds32/kernel/setup.c new file +4
-0+struct cache_info L1_cache_info[2 ]; +static void __init dump_cpu_info (int cpu) +{ +int i, p =0 ;
arch/nds32/kernel/setup.c line 101
Quoted 10 lines
arch/nds32/kernel/setup.c new file +10
-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:
Signature · 5 lines
~Randy -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 04/36] nds32: Kernel booting and initialization
2017-12-20 6:01 GMT+08:00 Randy Dunlap <[email protected]>:
Quoted 29 lines · Greentime Hu
Quoted 25 lines
From: Greentime Hu <[email protected]>
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 <[email protected]>Signed-off-by Greentime Hu <[email protected]>--- 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.carch/nds32/kernel/setup.c new file +3
-0@@ -0,0 +1,383 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation +[snip]
Quoted 17 lines
Quoted 4 lines
arch/nds32/kernel/setup.c new file +4
-0+struct cache_info L1_cache_info[2 ]; +static void __init dump_cpu_info (int cpu) +{ +int i, p =0 ;arch/nds32/kernel/setup.c line 101
Quoted 10 lines
arch/nds32/kernel/setup.c new file +10
-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.
PATCH v4 5/36 nds32: Exception handling
In reply to Greentime HuFrom: Greentime Hu <[email protected]>
This patch includes the exception/interrupt entries, pt_reg structure and related accessors.
--- arch/nds32/include/asm/ptrace.h | 66 +++++ arch/nds32/kernel/ex-entry.S | 157 ++++++++++ arch/nds32/kernel/ex-exit.S | 193 +++++++++++++ arch/nds32/kernel/stacktrace.c | 47 +++ arch/nds32/kernel/traps.c | 428 +++++++++++++++++++++++++++ arch/nds32/mm/alignment.c | 609 +++++++++++++++++++++++++++++++++++++++ 6 files changed, 1500 insertions(+) create mode 100644 arch/nds32/include/asm/ptrace.h create mode 100644 arch/nds32/kernel/ex-entry.S create mode 100644 arch/nds32/kernel/ex-exit.S create mode 100644 arch/nds32/kernel/stacktrace.c create mode 100644 arch/nds32/kernel/traps.c create mode 100644 arch/nds32/mm/alignment.c
arch/nds32/include/asm/ptrace.h new file +66 -0
@@ -0,0 +1,66 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#ifndef __ASM_NDS32_PTRACE_H +#define __ASM_NDS32_PTRACE_H + +#define PTRACE_GETREGS 12 +#define PTRACE_SETREGS 13 +#define PTRACE_GETFPREGS 14 +#define PTRACE_SETFPREGS 15 + +#include <uapi/asm/ptrace.h> + +#ifndef __ASSEMBLY__ + +struct pt_regs { +union { +struct user_pt_regs user_regs; +struct { +long uregs[26 ]; +long fp; +long gp; +long lp; +long sp; +long ipc; +#if defined(CONFIG_HWZOL ) +long lb; +long le; +long lc; +#else +long dummy[3 ]; +#endif +long syscallno; + }; + }; +long orig_r0; +long ir0; +long ipsw; +long pipsw; +long pipc; +long pp0; +long pp1; +long fucop_ctl; +long osp; +}; + +#include <asm/bitfield.h> +extern void show_regs (struct pt_regs *); +/* Avoid circular header include via sched.h */ +struct task_struct ; +extern void send_sigtrap (struct task_struct *tsk,struct pt_regs *regs, +int error_code,int si_code); + +#define arch_has_single_step () (1) +#define user_mode (regs) (((regs)->ipsw & PSW_mskPOM) == 0) +#define interrupts_enabled (regs) (!!((regs)->ipsw & PSW_mskGIE)) +#define valid_user_regs (regs) (user_mode(regs) && interrupts_enabled(regs)) +#define regs_return_value (regs) ((regs)->uregs[0]) +#define instruction_pointer (regs) ((regs)->ipc) +#define user_stack_pointer (regs) ((regs)->sp) +#define profile_pc (regs) instruction_pointer(regs) + +#define ARCH_HAS_USER_SINGLE_STEP_INFO + +#endif /* __ASSEMBLY__ */ +#endif
arch/nds32/kernel/ex-entry.S new file +157 -0
157 lines not on this page · raw message
arch/nds32/kernel/ex-exit.S new file +193 -0
193 lines not on this page · raw message
arch/nds32/kernel/stacktrace.c new file +47 -0
47 lines not on this page · raw message
arch/nds32/kernel/traps.c new file +428 -0
428 lines not on this page · raw message
arch/nds32/mm/alignment.c new file +609 -0
609 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v4 6/36 nds32: MMU definitions
In reply to Greentime HuFrom: Greentime Hu <greentime-MUIXKm3Oiri1Z/[email protected]>
This patch includes virtual memory layout, PHYS_OFFSET is defined as 0x0. It also includes the 4KB/8KB page size configurations and pte operations.
--- arch/nds32/include/asm/fixmap.h | 29 +++ arch/nds32/include/asm/highmem.h | 65 ++++++ arch/nds32/include/asm/memory.h | 105 ++++++++++ arch/nds32/include/asm/mmu.h | 12 ++ arch/nds32/include/asm/page.h | 67 ++++++ arch/nds32/include/asm/pgalloc.h | 96 +++++++++ arch/nds32/include/asm/pgtable.h | 413 +++++++++++++++++++++++++++++++++++++ arch/nds32/include/asm/shmparam.h | 19 ++ 8 files changed, 806 insertions(+) create mode 100644 arch/nds32/include/asm/fixmap.h create mode 100644 arch/nds32/include/asm/highmem.h create mode 100644 arch/nds32/include/asm/memory.h create mode 100644 arch/nds32/include/asm/mmu.h create mode 100644 arch/nds32/include/asm/page.h create mode 100644 arch/nds32/include/asm/pgalloc.h create mode 100644 arch/nds32/include/asm/pgtable.h create mode 100644 arch/nds32/include/asm/shmparam.h
arch/nds32/include/asm/fixmap.h new file +29 -0
@@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#ifndef __ASM_NDS32_FIXMAP_H +#define __ASM_NDS32_FIXMAP_H + +#ifdef CONFIG_HIGHMEM +#include <linux/threads.h> +#include <asm/kmap_types.h> +#endif + +enum fixed_addresses { +FIX_HOLE , +FIX_KMAP_RESERVED , +FIX_KMAP_BEGIN , +#ifdef CONFIG_HIGHMEM +FIX_KMAP_END =FIX_KMAP_BEGIN + (KM_TYPE_NR *NR_CPUS ), +#endif +FIX_EARLYCON_MEM_BASE , + __end_of_fixed_addresses +}; +#define FIXADDR_TOP ((unsigned long) (-(16 * PAGE_SIZE))) +#define FIXADDR_SIZE ((__end_of_fixed_addresses) << PAGE_SHIFT) +#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) +#define FIXMAP_PAGE_IO __pgprot(PAGE_DEVICE) +void __set_fixmap (enum fixed_addresses idx,phys_addr_t phys,pgprot_t prot); + +#include <asm-generic/fixmap.h> +#endif /* __ASM_NDS32_FIXMAP_H */
arch/nds32/include/asm/highmem.h new file +65 -0
65 lines not on this page · raw message
arch/nds32/include/asm/memory.h new file +105 -0
105 lines not on this page · raw message
arch/nds32/include/asm/mmu.h new file +12 -0
@@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#ifndef __NDS32_MMU_H +#define __NDS32_MMU_H + +typedef struct { +unsigned int id; +void *vdso; +}mm_context_t ; + +#endif
arch/nds32/include/asm/page.h new file +67 -0
67 lines not on this page · raw message
arch/nds32/include/asm/pgalloc.h new file +96 -0
96 lines not on this page · raw message
arch/nds32/include/asm/pgtable.h new file +413 -0
413 lines not on this page · raw message
arch/nds32/include/asm/shmparam.h new file +19 -0
@@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#ifndef _ASMNDS32_SHMPARAM_H +#define _ASMNDS32_SHMPARAM_H + +/* +* This should be the size of the virtually indexed cache/ways, +* whichever is greater since the cache aliases every size/ways +* bytes. +*/ +#define SHMLBA (4 * SZ_8K)/* attach addr a multiple of this */ + +/* +* Enforce SHMLBA in shmat +*/ +#define __ARCH_FORCE_SHMLBA + +#endif /* _ASMNDS32_SHMPARAM_H */
Signature · 6 lines
1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v4 7/36 nds32: MMU initialization
In reply to Greentime HuFrom: Greentime Hu <[email protected]>
This patch includes memory initializations and highmem supporting.
--- arch/nds32/mm/highmem.c | 79 +++++++++++++ arch/nds32/mm/init.c | 277 ++++++++++++++++++++++++++++++++++++++++++++++ arch/nds32/mm/mm-nds32.c | 90 +++++++++++++++ 3 files changed, 446 insertions(+) create mode 100644 arch/nds32/mm/highmem.c create mode 100644 arch/nds32/mm/init.c create mode 100644 arch/nds32/mm/mm-nds32.c
arch/nds32/mm/highmem.c new file +79 -0
@@ -0,0 +1,79 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#include <linux/export.h> +#include <linux/highmem.h> +#include <linux/sched.h> +#include <linux/smp.h> +#include <linux/interrupt.h> +#include <linux/bootmem.h> +#include <asm/fixmap.h> +#include <asm/tlbflush.h> + +void *kmap (struct page *page) +{ +unsigned long vaddr; +might_sleep (); +if (!PageHighMem (page)) +return page_address (page); + vaddr = (unsigned long )kmap_high (page); +return (void *)vaddr; +} + +EXPORT_SYMBOL (kmap); + +void kunmap (struct page *page) +{ +BUG_ON (in_interrupt ()); +if (!PageHighMem (page)) +return ; +kunmap_high (page); +} + +EXPORT_SYMBOL (kunmap); + +void *kmap_atomic (struct page *page) +{ +unsigned int idx; +unsigned long vaddr, pte; +int type; +pte_t *ptep; + +preempt_disable (); +pagefault_disable (); +if (!PageHighMem (page)) +return page_address (page); + + type =kmap_atomic_idx_push (); + + idx = type +KM_TYPE_NR *smp_processor_id (); + vaddr =__fix_to_virt (FIX_KMAP_BEGIN + idx); + pte = (page_to_pfn (page) <<PAGE_SHIFT ) | (PAGE_KERNEL ); + ptep =pte_offset_kernel (pmd_off_k (vaddr), vaddr); +set_pte (ptep, pte); + +__nds32__tlbop_inv (vaddr); +__nds32__mtsr_dsb (vaddr,NDS32_SR_TLB_VPN ); +__nds32__tlbop_rwr (pte); +__nds32__isb (); +return (void *)vaddr; +} + +EXPORT_SYMBOL (kmap_atomic); + +void __kunmap_atomic (void *kvaddr) +{ +if (kvaddr >= (void *)FIXADDR_START ) { +unsigned long vaddr = (unsigned long )kvaddr; +pte_t *ptep; +kmap_atomic_idx_pop (); +__nds32__tlbop_inv (vaddr); +__nds32__isb (); + ptep =pte_offset_kernel (pmd_off_k (vaddr), vaddr); +set_pte (ptep,0 ); + } +pagefault_enable (); +preempt_enable (); +} + +EXPORT_SYMBOL (__kunmap_atomic);
arch/nds32/mm/init.c new file +277 -0
277 lines not on this page · raw message
arch/nds32/mm/mm-nds32.c new file +90 -0
90 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v4 8/36 nds32: MMU fault handling and page table management
In reply to Greentime HuFrom: Greentime Hu <[email protected]>
This patch includes page fault handler, mmap and fixup implementations.
--- arch/nds32/lib/copy_page.S | 37 ++++ arch/nds32/mm/extable.c | 16 ++ arch/nds32/mm/fault.c | 410 ++++++++++++++++++++++++++++++++++++++++++++ arch/nds32/mm/mmap.c | 73 ++++++++ 4 files changed, 536 insertions(+) create mode 100644 arch/nds32/lib/copy_page.S create mode 100644 arch/nds32/mm/extable.c create mode 100644 arch/nds32/mm/fault.c create mode 100644 arch/nds32/mm/mmap.c
arch/nds32/lib/copy_page.S new file +37 -0
@@ -0,0 +1,37 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#include <linux/linkage.h> +#include <asm/page.h> + + .text +ENTRY(copy_page) + pushm $r2, $r10 + movi $r2, PAGE_SIZE >> 5 +.Lcopy_loop: + lmw.bim $r3, [$r1], $r10 + smw.bim $r3, [$r0], $r10 + subi45 $r2, #1 + bnez38 $r2, .Lcopy_loop + popm $r2, $r10 + ret +ENDPROC(copy_page) + +ENTRY(clear_page) + pushm $r1, $r9 + movi $r1, PAGE_SIZE >> 5 + movi55 $r2, #0 + movi55 $r3, #0 + movi55 $r4, #0 + movi55 $r5, #0 + movi55 $r6, #0 + movi55 $r7, #0 + movi55 $r8, #0 + movi55 $r9, #0 +.Lclear_loop: + smw.bim $r2, [$r0], $r9 + subi45 $r1, #1 + bnez38 $r1, .Lclear_loop + popm $r1, $r9 + ret +ENDPROC(clear_page)
arch/nds32/mm/extable.c new file +16 -0
@@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#include <linux/extable.h> +#include <linux/uaccess.h> + +int fixup_exception (struct pt_regs *regs) +{ +const struct exception_table_entry *fixup; + + fixup =search_exception_tables (instruction_pointer (regs)); +if (fixup) + regs->ipc = fixup->fixup; + +return fixup !=NULL ; +}
arch/nds32/mm/fault.c new file +410 -0
410 lines not on this page · raw message
arch/nds32/mm/mmap.c new file +73 -0
73 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v4 9/36 nds32: Cache and TLB routines
In reply to Greentime HuFrom: Greentime Hu <[email protected]>
This patch contains cache and TLB maintenance functions.
--- arch/nds32/include/asm/cache.h | 12 + arch/nds32/include/asm/cache_info.h | 13 + arch/nds32/include/asm/cacheflush.h | 44 +++ arch/nds32/include/asm/mmu_context.h | 68 ++++ arch/nds32/include/asm/proc-fns.h | 44 +++ arch/nds32/include/asm/tlb.h | 28 ++ arch/nds32/include/asm/tlbflush.h | 47 +++ arch/nds32/include/uapi/asm/cachectl.h | 14 + arch/nds32/kernel/cacheinfo.c | 49 +++ arch/nds32/mm/cacheflush.c | 322 +++++++++++++++++++ arch/nds32/mm/proc.c | 540 ++++++++++++++++++++++++++++++++ arch/nds32/mm/tlb.c | 50 +++ 12 files changed, 1231 insertions(+) create mode 100644 arch/nds32/include/asm/cache.h create mode 100644 arch/nds32/include/asm/cache_info.h create mode 100644 arch/nds32/include/asm/cacheflush.h create mode 100644 arch/nds32/include/asm/mmu_context.h create mode 100644 arch/nds32/include/asm/proc-fns.h create mode 100644 arch/nds32/include/asm/tlb.h create mode 100644 arch/nds32/include/asm/tlbflush.h create mode 100644 arch/nds32/include/uapi/asm/cachectl.h create mode 100644 arch/nds32/kernel/cacheinfo.c create mode 100644 arch/nds32/mm/cacheflush.c create mode 100644 arch/nds32/mm/proc.c create mode 100644 arch/nds32/mm/tlb.c
arch/nds32/include/asm/cache.h new file +12 -0
@@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#ifndef __NDS32_CACHE_H__ +#define __NDS32_CACHE_H__ + +#define L1_CACHE_BYTES 32 +#define L1_CACHE_SHIFT 5 + +#define ARCH_DMA_MINALIGN L1_CACHE_BYTES + +#endif /* __NDS32_CACHE_H__ */
arch/nds32/include/asm/cache_info.h new file +13 -0
@@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +struct cache_info { +unsigned char ways; +unsigned char line_size; +unsigned short sets; +unsigned short size; +#if defined(CONFIG_CPU_CACHE_ALIASING ) +unsigned short aliasing_num; +unsigned int aliasing_mask; +#endif +};
arch/nds32/include/asm/cacheflush.h new file +44 -0
44 lines not on this page · raw message
arch/nds32/include/asm/mmu_context.h new file +68 -0
68 lines not on this page · raw message
arch/nds32/include/asm/proc-fns.h new file +44 -0
44 lines not on this page · raw message
arch/nds32/include/asm/tlb.h new file +28 -0
@@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#ifndef __ASMNDS32_TLB_H +#define __ASMNDS32_TLB_H + +#define tlb_start_vma (tlb,vma) \ + do { \ + if (!tlb->fullmm) \ + flush_cache_range(vma, vma->vm_start, vma->vm_end); \ + } while (0) + +#define tlb_end_vma (tlb,vma) \ + do { \ + if(!tlb->fullmm) \ + flush_tlb_range(vma, vma->vm_start, vma->vm_end); \ + } while (0) + +#define __tlb_remove_tlb_entry (tlb, pte, addr) do { } while (0) + +#define tlb_flush (tlb) flush_tlb_mm((tlb)->mm) + +#include <asm-generic/tlb.h> + +#define __pte_free_tlb (tlb, pte, addr) pte_free((tlb)->mm, pte) +#define __pmd_free_tlb (tlb, pmd, addr) pmd_free((tln)->mm, pmd) + +#endif
arch/nds32/include/asm/tlbflush.h new file +47 -0
47 lines not on this page · raw message
arch/nds32/include/uapi/asm/cachectl.h new file +14 -0
@@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 1994, 1995, 1996 by Ralf Baechle +// Copyright (C) 2005-2017 Andes Technology Corporation +#ifndef _ASM_CACHECTL +#define _ASM_CACHECTL + +/* +* Options for cacheflush system call +*/ +#define ICACHE 0/* flush instruction cache */ +#define DCACHE 1/* writeback and flush data cache */ +#define BCACHE 2/* flush instruction cache + writeback and flush data cache */ + +#endif /* _ASM_CACHECTL */
arch/nds32/kernel/cacheinfo.c new file +49 -0
49 lines not on this page · raw message
arch/nds32/mm/cacheflush.c new file +322 -0
322 lines not on this page · raw message
arch/nds32/mm/proc.c new file +540 -0
540 lines not on this page · raw message
arch/nds32/mm/tlb.c new file +50 -0
50 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v4 10/36 nds32: Process management
In reply to Greentime HuFrom: Greentime Hu <[email protected]>
This patch includes copy_thread(), start_thread() implementation and cpu_context structure definition. nds32 uses $r25 to get current task_struct.
--- arch/nds32/include/asm/current.h | 12 ++ arch/nds32/include/asm/processor.h | 102 +++++++++++++++++ arch/nds32/include/asm/thread_info.h | 78 +++++++++++++ arch/nds32/kernel/process.c | 204 ++++++++++++++++++++++++++++++++++ 4 files changed, 396 insertions(+) create mode 100644 arch/nds32/include/asm/current.h create mode 100644 arch/nds32/include/asm/processor.h create mode 100644 arch/nds32/include/asm/thread_info.h create mode 100644 arch/nds32/kernel/process.c
arch/nds32/include/asm/current.h new file +12 -0
@@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#ifndef _ASM_NDS32_CURRENT_H +#define _ASM_NDS32_CURRENT_H + +#ifndef __ASSEMBLY__ +registerstruct task_struct *current asm("$r25" ); +#endif /* __ASSEMBLY__ */ +#define tsk $r25 + +#endif /* _ASM_NDS32_CURRENT_H */
arch/nds32/include/asm/processor.h new file +102 -0
102 lines not on this page · raw message
arch/nds32/include/asm/thread_info.h new file +78 -0
78 lines not on this page · raw message
arch/nds32/kernel/process.c new file +204 -0
204 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v4 11/36 nds32: IRQ handling
In reply to Greentime HuFrom: Greentime Hu <[email protected]>
This patch includes irq related functions and irqchip_init().
--- arch/nds32/include/asm/irqflags.h | 36 ++++++++++++++++++++++++++++++++++++ arch/nds32/kernel/irq.c | 9 +++++++++ 2 files changed, 45 insertions(+) create mode 100644 arch/nds32/include/asm/irqflags.h create mode 100644 arch/nds32/kernel/irq.c
arch/nds32/include/asm/irqflags.h new file +36 -0
@@ -0,0 +1,36 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#include <asm/nds32.h> +#include <nds32_intrinsic.h> + +#define arch_local_irq_disable () \ + GIE_DISABLE(); + +#define arch_local_irq_enable () \ + GIE_ENABLE(); +static inline unsigned long arch_local_irq_save (void ) +{ +unsigned long flags; + flags =__nds32__mfsr (NDS32_SR_PSW ) & PSW_mskGIE; +GIE_DISABLE (); +return flags; +} + +static inline unsigned long arch_local_save_flags (void ) +{ +unsigned long flags; + flags =__nds32__mfsr (NDS32_SR_PSW ) & PSW_mskGIE; +return flags; +} + +static inline void arch_local_irq_restore (unsigned long flags) +{ +if (flags) +GIE_ENABLE (); +} + +static inline int arch_irqs_disabled_flags (unsigned long flags) +{ +return !flags; +}
arch/nds32/kernel/irq.c new file +9 -0
@@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#include <linux/irqchip.h> + +void __init init_IRQ (void ) +{ +irqchip_init (); +}
Signature · 1 line
1.7.9.5
PATCH v4 12/36 nds32: Atomic operations
In reply to Greentime HuFrom: Greentime Hu <[email protected]>
This patch includes the atomic and futex operations. Many atomic operations use the load-lock word(llw) and store-condition word(scw) operations.
--- arch/nds32/include/asm/barrier.h | 15 ++++++ arch/nds32/include/asm/futex.h | 103 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+) create mode 100644 arch/nds32/include/asm/barrier.h create mode 100644 arch/nds32/include/asm/futex.h
arch/nds32/include/asm/barrier.h new file +15 -0
@@ -0,0 +1,15 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#ifndef __NDS32_ASM_BARRIER_H +#define __NDS32_ASM_BARRIER_H + +#ifndef __ASSEMBLY__ +#define mb () asm volatile("msync all":::"memory") +#define rmb () asm volatile("msync all":::"memory") +#define wmb () asm volatile("msync store":::"memory") +#include <asm-generic/barrier.h> + +#endif /* __ASSEMBLY__ */ + +#endif /* __NDS32_ASM_BARRIER_H */
arch/nds32/include/asm/futex.h new file +103 -0
103 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v4 13/36 nds32: Device specific operations
In reply to Greentime HuFrom: Greentime Hu <[email protected]>
This patch introduces ioremap implementations.
--- arch/nds32/include/asm/io.h | 83 +++++++++++++++++++++++++++++++++++++++++++ arch/nds32/mm/ioremap.c | 62 ++++++++++++++++++++++++++++++++ 2 files changed, 145 insertions(+) create mode 100644 arch/nds32/include/asm/io.h create mode 100644 arch/nds32/mm/ioremap.c
arch/nds32/include/asm/io.h new file +83 -0
@@ -0,0 +1,83 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#ifndef __ASM_NDS32_IO_H +#define __ASM_NDS32_IO_H + +extern void iounmap (void __iomem *addr); +#define __raw_writeb __raw_writeb +static inline void __raw_writeb (u8 val,volatile void __iomem *addr) +{ + asmvolatile ("sbi %0, [%1]" : :"r" (val),"r" (addr)); +} + +#define __raw_writew __raw_writew +static inline void __raw_writew (u16 val,volatile void __iomem *addr) +{ + asmvolatile ("shi %0, [%1]" : :"r" (val),"r" (addr)); +} + +#define __raw_writel __raw_writel +static inline void __raw_writel (u32 val,volatile void __iomem *addr) +{ + asmvolatile ("swi %0, [%1]" : :"r" (val),"r" (addr)); +} + +#define __raw_readb __raw_readb +static inline u8 __raw_readb (const volatile void __iomem *addr) +{ +u8 val; + + asmvolatile ("lbi %0, [%1]" :"=r" (val) :"r" (addr)); +return val; +} + +#define __raw_readw __raw_readw +static inline u16 __raw_readw (const volatile void __iomem *addr) +{ +u16 val; + + asmvolatile ("lhi %0, [%1]" :"=r" (val) :"r" (addr)); +return val; +} + +#define __raw_readl __raw_readl +static inline u32 __raw_readl (const volatile void __iomem *addr) +{ +u32 val; + + asmvolatile ("lwi %0, [%1]" :"=r" (val) :"r" (addr)); +return val; +} + +#define __iormb () rmb() +#define __iowmb () wmb() + +#define mmiowb () __asm__ __volatile__ ("msync all" : : : "memory"); + +/* +* {read,write}{b,w,l,q}_relaxed() are like the regular version, but +* are not guaranteed to provide ordering against spinlocks or memory +* accesses. +*/ + +#define readb_relaxed (c) ({ u8 __v = __raw_readb(c); __v; }) +#define readw_relaxed (c) ({ u16 __v = le16_to_cpu((__force __le16)__raw_readw(c)); __v; }) +#define readl_relaxed (c) ({ u32 __v = le32_to_cpu((__force __le32)__raw_readl(c)); __v; }) +#define writeb_relaxed (v,c) ((void)__raw_writeb((v),(c))) +#define writew_relaxed (v,c) ((void)__raw_writew((__force u16)cpu_to_le16(v),(c))) +#define writel_relaxed (v,c) ((void)__raw_writel((__force u32)cpu_to_le32(v),(c))) + +/* +* {read,write}{b,w,l,q}() access little endian memory and return result in +* native endianness. +*/ +#define readb (c) ({ u8 __v = readb_relaxed(c); __iormb(); __v; }) +#define readw (c) ({ u16 __v = readw_relaxed(c); __iormb(); __v; }) +#define readl (c) ({ u32 __v = readl_relaxed(c); __iormb(); __v; }) + +#define writeb (v,c) ({ __iowmb(); writeb_relaxed((v),(c)); }) +#define writew (v,c) ({ __iowmb(); writew_relaxed((v),(c)); }) +#define writel (v,c) ({ __iowmb(); writel_relaxed((v),(c)); }) +#include <asm-generic/io.h> +#endif /* __ASM_NDS32_IO_H */
arch/nds32/mm/ioremap.c new file +62 -0
62 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Arnd Bergmann
maintainerRe: [PATCH v4 13/36] nds32: Device specific operations
arch/nds32/include/asm/io.h line 7
Quoted 3 lines · Greentime Hu
arch/nds32/include/asm/io.h new file +3
-0+#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
Re: [PATCH v4 13/36] nds32: Device specific operations
2017-12-18 19:26 GMT+08:00 Arnd Bergmann <[email protected]>:
Quoted 9 lines · Greentime Hu
arch/nds32/include/asm/io.h line 7
Quoted 4 lines
arch/nds32/include/asm/io.h new file +3
-0+#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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v4 14/36 nds32: DMA mapping API
In reply to Greentime HuFrom: Greentime Hu <[email protected]>
This patch adds support for the DMA mapping API. It uses dma_map_ops for flexibility.
--- arch/nds32/include/asm/dma-mapping.h | 14 ++ arch/nds32/kernel/dma.c | 459 ++++++++++++++++++++++++++++++++++ 2 files changed, 473 insertions(+) create mode 100644 arch/nds32/include/asm/dma-mapping.h create mode 100644 arch/nds32/kernel/dma.c
arch/nds32/include/asm/dma-mapping.h new file +14 -0
@@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#ifndef ASMNDS32_DMA_MAPPING_H +#define ASMNDS32_DMA_MAPPING_H + +extern struct dma_map_ops nds32_dma_ops; + +static inline struct dma_map_ops *get_arch_dma_ops (struct bus_type *bus) +{ +return &nds32_dma_ops; +} + +#endif
arch/nds32/kernel/dma.c new file +459 -0
459 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v4 15/36 nds32: ELF definitions
In reply to Greentime HuFrom: Greentime Hu <greentime-MUIXKm3Oiri1Z/[email protected]>
This patch adds definitions for the ELF format, relocation types, vdso locations and EXEC_PAGESIZE.
--- arch/nds32/include/asm/elf.h | 179 ++++++++++++++++++++++++++++++++++ arch/nds32/include/uapi/asm/auxvec.h | 12 +++ arch/nds32/include/uapi/asm/param.h | 11 +++ 3 files changed, 202 insertions(+) create mode 100644 arch/nds32/include/asm/elf.h create mode 100644 arch/nds32/include/uapi/asm/auxvec.h create mode 100644 arch/nds32/include/uapi/asm/param.h
arch/nds32/include/asm/elf.h new file +179 -0
@@ -0,0 +1,179 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#ifndef __ASMNDS32_ELF_H +#define __ASMNDS32_ELF_H + +/* +* ELF register definitions.. +*/ + +#include <asm/ptrace.h> + +typedef unsigned long elf_greg_t ; +typedef unsigned long elf_freg_t [3 ]; + +extern unsigned int elf_hwcap; + +#define EM_NDS32 167 + +#define R_NDS32_NONE 0 +#define R_NDS32_16_RELA 19 +#define R_NDS32_32_RELA 20 +#define R_NDS32_9_PCREL_RELA 22 +#define R_NDS32_15_PCREL_RELA 23 +#define R_NDS32_17_PCREL_RELA 24 +#define R_NDS32_25_PCREL_RELA 25 +#define R_NDS32_HI20_RELA 26 +#define R_NDS32_LO12S3_RELA 27 +#define R_NDS32_LO12S2_RELA 28 +#define R_NDS32_LO12S1_RELA 29 +#define R_NDS32_LO12S0_RELA 30 +#define R_NDS32_SDA15S3_RELA 31 +#define R_NDS32_SDA15S2_RELA 32 +#define R_NDS32_SDA15S1_RELA 33 +#define R_NDS32_SDA15S0_RELA 34 +#define R_NDS32_GOT20 37 +#define R_NDS32_25_PLTREL 38 +#define R_NDS32_COPY 39 +#define R_NDS32_GLOB_DAT 40 +#define R_NDS32_JMP_SLOT 41 +#define R_NDS32_RELATIVE 42 +#define R_NDS32_GOTOFF 43 +#define R_NDS32_GOTPC20 44 +#define R_NDS32_GOT_HI20 45 +#define R_NDS32_GOT_LO12 46 +#define R_NDS32_GOTPC_HI20 47 +#define R_NDS32_GOTPC_LO12 48 +#define R_NDS32_GOTOFF_HI20 49 +#define R_NDS32_GOTOFF_LO12 50 +#define R_NDS32_INSN16 51 +#define R_NDS32_LABEL 52 +#define R_NDS32_LONGCALL1 53 +#define R_NDS32_LONGCALL2 54 +#define R_NDS32_LONGCALL3 55 +#define R_NDS32_LONGJUMP1 56 +#define R_NDS32_LONGJUMP2 57 +#define R_NDS32_LONGJUMP3 58 +#define R_NDS32_LOADSTORE 59 +#define R_NDS32_9_FIXED_RELA 60 +#define R_NDS32_15_FIXED_RELA 61 +#define R_NDS32_17_FIXED_RELA 62 +#define R_NDS32_25_FIXED_RELA 63 +#define R_NDS32_PLTREL_HI20 64 +#define R_NDS32_PLTREL_LO12 65 +#define R_NDS32_PLT_GOTREL_HI20 66 +#define R_NDS32_PLT_GOTREL_LO12 67 +#define R_NDS32_LO12S0_ORI_RELA 72 +#define R_NDS32_DWARF2_OP1_RELA 77 +#define R_NDS32_DWARF2_OP2_RELA 78 +#define R_NDS32_DWARF2_LEB_RELA 79 +#define R_NDS32_WORD_9_PCREL_RELA 94 +#define R_NDS32_LONGCALL4 107 +#define R_NDS32_RELA_NOP_MIX 192 +#define R_NDS32_RELA_NOP_MAX 255 + +#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t)) +typedef elf_greg_t elf_gregset_t [ELF_NGREG ]; + +/* Core file format: The core file is written in such a way that gdb +can understand it and provide useful information to the user (under +linux we use the 'trad-core' bfd). There are quite a number of +obstacles to being able to view the contents of the floating point +registers, and until these are solved you will not be able to view the +contents of them. Actually, you can read in the core file and look at +the contents of the user struct to find out what the floating point +registers contain. +The actual file contents are as follows: +UPAGE: 1 page consisting of a user struct that tells gdb what is present +in the file. Directly after this is a copy of the task_struct, which +is currently not used by gdb, but it may come in useful at some point. +All of the registers are stored as part of the upage. The upage should +always be only one page. +DATA: The data area is stored. We use current->end_text to +current->brk to pick up all of the user variables, plus any memory +that may have been malloced. No attempt is made to determine if a page +is demand-zero or if a page is totally unused, we just cover the entire +range. All of the addresses are rounded in such a way that an integral +number of pages is written. +STACK: We need the stack information in order to get a meaningful +backtrace. We need to write the data from (esp) to +current->start_stack, so we round each of these off in order to be able +to write an integer number of pages. +The minimum core file size is 3 pages, or 12288 bytes. +*/ + +struct user_fp { +struct fp_reg { +unsigned int sign1:1 ; +unsigned int unused:15 ; +unsigned int sign2:1 ; +unsigned int exponent:14 ; +unsigned int j:1 ; +unsigned int mantissa1:31 ; +unsigned int mantissa0:32 ; + } fpregs[8 ]; +unsigned int fpsr:32 ; +unsigned int fpcr:32 ; +unsigned char ftype[8 ]; +unsigned int init_flag; +}; + +typedef struct user_fp elf_fpregset_t ; + +struct elf32_hdr ; +#define elf_check_arch (x) ((x)->e_machine == EM_NDS32) + +/* +* These are used to set parameters in the core dumps. +*/ +#define ELF_CLASS ELFCLASS32 +#ifdef __NDS32_EB__ +#define ELF_DATA ELFDATA2MSB; +#else +#define ELF_DATA ELFDATA2LSB; +#endif +#define ELF_ARCH EM_NDS32 +#define USE_ELF_CORE_DUMP +#define ELF_EXEC_PAGESIZE PAGE_SIZE + +/* This is the location that an ET_DYN program is loaded if exec'ed. Typical +use of this is to invoke "./ld.so someprog" to test out a new version of +the loader. We need to make sure that it is out of the way of the program +that it will "exec", and that there is sufficient room for the brk. */ + +#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3) + +/* When the program starts, a1 contains a pointer to a function to be +registered with atexit, as per the SVR4 ABI. A value of 0 means we +have no such handler. */ +#define ELF_PLAT_INIT (_r, load_addr) (_r)->uregs[0] = 0 + +/* This yields a mask that user programs can use to figure out what +instruction set this cpu supports. */ + +#define ELF_HWCAP (elf_hwcap) + +#ifdef __KERNEL__ + +#define ELF_PLATFORM (NULL) + +/* Old NetWinder binaries were compiled in such a way that the iBCS +heuristic always trips on them. Until these binaries become uncommon +enough not to care, don't trust the `ibcs' flag here. In any case +there is no other ELF system currently supported by iBCS. +@@ Could print a warning message to encourage users to upgrade. */ +#define SET_PERSONALITY (ex) set_personality(PER_LINUX) + +#endif + +#define ARCH_DLINFO \ +do { \ + NEW_AUX_ENT(AT_SYSINFO_EHDR, \ + (elf_addr_t)current->mm->context.vdso); \ +} while (0) +#define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1 +struct linux_binprm ; +int arch_setup_additional_pages (struct linux_binprm *,int ); + +#endif
arch/nds32/include/uapi/asm/auxvec.h new file +12 -0
@@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#ifndef __ASM_AUXVEC_H +#define __ASM_AUXVEC_H + +/* VDSO location */ +#define AT_SYSINFO_EHDR 33 + +#define AT_VECTOR_SIZE_ARCH 1 + +#endif
arch/nds32/include/uapi/asm/param.h new file +11 -0
@@ -0,0 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#ifndef __ASM_NDS32_PARAM_H +#define __ASM_NDS32_PARAM_H + +#define EXEC_PAGESIZE 8192 + +#include <asm-generic/param.h> + +#endif /* __ASM_NDS32_PARAM_H */
Signature · 6 lines
1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v4 16/36 nds32: System calls handling
In reply to Greentime HuFrom: Greentime Hu <[email protected]>
This patch adds support for system calls.
--- arch/nds32/include/asm/syscall.h | 188 ++++++++++++++++++++++++++++++++++ arch/nds32/include/asm/syscalls.h | 13 +++ arch/nds32/include/asm/unistd.h | 6 ++ arch/nds32/include/uapi/asm/unistd.h | 12 +++ arch/nds32/kernel/ex-scall.S | 106 +++++++++++++++++++ arch/nds32/kernel/sys_nds32.c | 61 +++++++++++ arch/nds32/kernel/syscall_table.c | 17 +++ 7 files changed, 403 insertions(+) create mode 100644 arch/nds32/include/asm/syscall.h create mode 100644 arch/nds32/include/asm/syscalls.h create mode 100644 arch/nds32/include/asm/unistd.h create mode 100644 arch/nds32/include/uapi/asm/unistd.h create mode 100644 arch/nds32/kernel/ex-scall.S create mode 100644 arch/nds32/kernel/sys_nds32.c create mode 100644 arch/nds32/kernel/syscall_table.c
arch/nds32/include/asm/syscall.h new file +188 -0
@@ -0,0 +1,188 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2008-2009 Red Hat, Inc. All rights reserved. +// Copyright (C) 2005-2017 Andes Technology Corporation + +#ifndef _ASM_NDS32_SYSCALL_H +#define _ASM_NDS32_SYSCALL_H 1 + +#include <linux/err.h> +struct task_struct ; +struct pt_regs ; + +/** +* syscall_get_nr - find what system call a task is executing +* @task: task of interest, must be blocked +* @regs: task_pt_regs() of @task +* +* If @task is executing a system call or is at system call +* tracing about to attempt one, returns the system call number. +* If @task is not executing a system call, i.e. it's blocked +* inside the kernel for a fault or signal, returns -1. +* +* Note this returns int even on 64-bit machines. Only 32 bits of +* system call number can be meaningful. If the actual arch value +* is 64 bits, this truncates to 32 bits so 0xffffffff means -1. +* +* It's only valid to call this when @task is known to be blocked. +*/ +int syscall_get_nr (struct task_struct *task,struct pt_regs *regs) +{ +return regs->syscallno; +} + +/** +* syscall_rollback - roll back registers after an aborted system call +* @task: task of interest, must be in system call exit tracing +* @regs: task_pt_regs() of @task +* +* It's only valid to call this when @task is stopped for system +* call exit tracing (due to TIF_SYSCALL_TRACE or TIF_SYSCALL_AUDIT), +* after tracehook_report_syscall_entry() returned nonzero to prevent +* the system call from taking place. +* +* This rolls back the register state in @regs so it's as if the +* system call instruction was a no-op. The registers containing +* the system call number and arguments are as they were before the +* system call instruction. This may not be the same as what the +* register state looked like at system call entry tracing. +*/ +void syscall_rollback (struct task_struct *task,struct pt_regs *regs) +{ + regs->uregs[0 ] = regs->orig_r0; +} + +/** +* syscall_get_error - check result of traced system call +* @task: task of interest, must be blocked +* @regs: task_pt_regs() of @task +* +* Returns 0 if the system call succeeded, or -ERRORCODE if it failed. +* +* It's only valid to call this when @task is stopped for tracing on exit +* from a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT. +*/ +long syscall_get_error (struct task_struct *task,struct pt_regs *regs) +{ +unsigned long error = regs->uregs[0 ]; +return IS_ERR_VALUE (error) ? error :0 ; +} + +/** +* syscall_get_return_value - get the return value of a traced system call +* @task: task of interest, must be blocked +* @regs: task_pt_regs() of @task +* +* Returns the return value of the successful system call. +* This value is meaningless if syscall_get_error() returned nonzero. +* +* It's only valid to call this when @task is stopped for tracing on exit +* from a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT. +*/ +long syscall_get_return_value (struct task_struct *task,struct pt_regs *regs) +{ +return regs->uregs[0 ]; +} + +/** +* syscall_set_return_value - change the return value of a traced system call +* @task: task of interest, must be blocked +* @regs: task_pt_regs() of @task +* @error: negative error code, or zero to indicate success +* @val: user return value if @error is zero +* +* This changes the results of the system call that user mode will see. +* If @error is zero, the user sees a successful system call with a +* return value of @val. If @error is nonzero, it's a negated errno +* code; the user sees a failed system call with this errno code. +* +* It's only valid to call this when @task is stopped for tracing on exit +* from a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT. +*/ +void syscall_set_return_value (struct task_struct *task,struct pt_regs *regs, +int error,long val) +{ + regs->uregs[0 ] = (long )error ? error : val; +} + +/** +* syscall_get_arguments - extract system call parameter values +* @task: task of interest, must be blocked +* @regs: task_pt_regs() of @task +* @i: argument index [0,5] +* @n: number of arguments; n+i must be [1,6]. +* @args: array filled with argument values +* +* Fetches @n arguments to the system call starting with the @i'th argument +* (from 0 through 5). Argument @i is stored in @args[0], and so on. +* An arch inline version is probably optimal when @i and @n are constants. +* +* It's only valid to call this when @task is stopped for tracing on +* entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT. +* It's invalid to call this with @i + @n > 6; we only support system calls +* taking up to 6 arguments. +*/ +#define SYSCALL_MAX_ARGS 6 +void syscall_get_arguments (struct task_struct *task,struct pt_regs *regs, +unsigned int i,unsigned int n,unsigned long *args) +{ +if (n ==0 ) +return ; +if (i + n >SYSCALL_MAX_ARGS ) { +unsigned long *args_bad = args +SYSCALL_MAX_ARGS - i; +unsigned int n_bad = n + i -SYSCALL_MAX_ARGS ; +pr_warning ("%s called with max args %d, handling only %d\n" , + __func__, i + n,SYSCALL_MAX_ARGS ); +memset (args_bad,0 , n_bad *sizeof (args[0 ])); +memset (args_bad,0 , n_bad *sizeof (args[0 ])); + } + +if (i ==0 ) { + args[0 ] = regs->orig_r0; + args++; + i++; + n--; + } + +memcpy (args, ®s->uregs[0 ] + i, n *sizeof (args[0 ])); +} + +/** +* syscall_set_arguments - change system call parameter value +* @task: task of interest, must be in system call entry tracing +* @regs: task_pt_regs() of @task +* @i: argument index [0,5] +* @n: number of arguments; n+i must be [1,6]. +* @args: array of argument values to store +* +* Changes @n arguments to the system call starting with the @i'th argument. +* Argument @i gets value @args[0], and so on. +* An arch inline version is probably optimal when @i and @n are constants. +* +* It's only valid to call this when @task is stopped for tracing on +* entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT. +* It's invalid to call this with @i + @n > 6; we only support system calls +* taking up to 6 arguments. +*/ +void syscall_set_arguments (struct task_struct *task,struct pt_regs *regs, +unsigned int i,unsigned int n, +const unsigned long *args) +{ +if (n ==0 ) +return ; + +if (i + n >SYSCALL_MAX_ARGS ) { +pr_warn ("%s called with max args %d, handling only %d\n" , + __func__, i + n,SYSCALL_MAX_ARGS ); + n =SYSCALL_MAX_ARGS - i; + } + +if (i ==0 ) { + regs->orig_r0 = args[0 ]; + args++; + i++; + n--; + } + +memcpy (®s->uregs[0 ] + i, args, n *sizeof (args[0 ])); +} +#endif /* _ASM_NDS32_SYSCALL_H */
arch/nds32/include/asm/syscalls.h new file +13 -0
@@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#ifndef __ASM_NDS32_SYSCALLS_H +#define __ASM_NDS32_SYSCALLS_H + +asmlinkage long sys_cacheflush (unsigned long addr,unsigned long len,unsigned int op); +asmlinkage long sys_fadvise64_64_wrapper (int fd,int advice,loff_t offset,loff_t len); +asmlinkage long sys_rt_sigreturn_wrapper (void ); + +#include <asm-generic/syscalls.h> + +#endif /* __ASM_NDS32_SYSCALLS_H */
arch/nds32/include/asm/unistd.h new file +6 -0
@@ -0,0 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#define __ARCH_WANT_SYS_CLONE + +#include <uapi/asm/unistd.h>
arch/nds32/include/uapi/asm/unistd.h new file +12 -0
@@ -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)
arch/nds32/kernel/ex-scall.S new file +106 -0
106 lines not on this page · raw message
arch/nds32/kernel/sys_nds32.c new file +61 -0
61 lines not on this page · raw message
arch/nds32/kernel/syscall_table.c new file +17 -0
@@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#include <linux/syscalls.h> +#include <linux/signal.h> +#include <linux/unistd.h> +#include <asm/syscalls.h> + +#undef __SYSCALL +#define __SYSCALL (nr, call) [nr] = (call), + +#define sys_rt_sigreturn sys_rt_sigreturn_wrapper +#define sys_fadvise64_64 sys_fadvise64_64_wrapper +void *sys_call_table[__NR_syscalls]__aligned(8192) = { + [0 ... __NR_syscalls -1 ] = sys_ni_syscall, +#include <asm/unistd.h> +};
Signature · 1 line
1.7.9.5
Arnd Bergmann
maintainerRe: [PATCH v4 16/36] nds32: System calls handling
Quoted 7 lines · Greentime Hu
new file mode 100644
index 0000000..90da745arch/nds32/include/uapi/asm/unistd.h new file +2
-0@@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation
arch/nds32/include/uapi/asm/unistd.h line 12
Quoted 10 lines
arch/nds32/include/uapi/asm/unistd.h new file +10
-0+ +#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?
Quoted 11 lines
arch/nds32/include/uapi/asm/unistd.h new file +11
-0+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 )); +} +
arch/nds32/include/uapi/asm/unistd.h
Quoted 10 lines
arch/nds32/include/uapi/asm/unistd.h new file +10
-0+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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 16/36] nds32: System calls handling
2017-12-18 19:19 GMT+08:00 Arnd Bergmann <[email protected]>:
Quoted 14 lines · Greentime Hu
Quoted 13 lines
new file mode 100644
index 0000000..90da745arch/nds32/include/uapi/asm/unistd.h new file +6
-0@@ -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 */
Quoted 9 lines
arch/nds32/include/uapi/asm/unistd.h line 12
Quoted 6 lines
arch/nds32/include/uapi/asm/unistd.h new file +6
-0+#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__llseekhere, 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.
Quoted 15 lines
Quoted 15 lines
arch/nds32/include/uapi/asm/unistd.h new file +15
-0+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) +{
Quoted 9 lines
arch/nds32/include/uapi/asm/unistd.h
Quoted 6 lines
arch/nds32/include/uapi/asm/unistd.h new file +6
-0+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 tosys_mmap2().
This is my mistake. I will remove it in the next version patch.
Quoted 3 lines
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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v4 17/36 nds32: VDSO support
In reply to Greentime HuFrom: Greentime Hu <[email protected]>
This patch adds VDSO support. The VDSO code is currently used for sys_rt_sigreturn() and optimised gettimeofday() (using the SoC timer counter).
--- arch/nds32/include/asm/vdso.h | 24 +++ arch/nds32/include/asm/vdso_datapage.h | 36 ++++ arch/nds32/include/asm/vdso_timer_info.h | 14 ++ arch/nds32/kernel/vdso.c | 233 ++++++++++++++++++++++++ arch/nds32/kernel/vdso/Makefile | 82 +++++++++ arch/nds32/kernel/vdso/datapage.S | 21 +++ arch/nds32/kernel/vdso/gen_vdso_offsets.sh | 15 ++ arch/nds32/kernel/vdso/gettimeofday.c | 271 ++++++++++++++++++++++++++++ arch/nds32/kernel/vdso/note.S | 11 ++ arch/nds32/kernel/vdso/sigreturn.S | 19 ++ arch/nds32/kernel/vdso/vdso.S | 18 ++ arch/nds32/kernel/vdso/vdso.lds.S | 76 ++++++++ 12 files changed, 820 insertions(+) create mode 100644 arch/nds32/include/asm/vdso.h create mode 100644 arch/nds32/include/asm/vdso_datapage.h create mode 100644 arch/nds32/include/asm/vdso_timer_info.h create mode 100644 arch/nds32/kernel/vdso.c create mode 100644 arch/nds32/kernel/vdso/Makefile create mode 100644 arch/nds32/kernel/vdso/datapage.S create mode 100755 arch/nds32/kernel/vdso/gen_vdso_offsets.sh create mode 100644 arch/nds32/kernel/vdso/gettimeofday.c create mode 100644 arch/nds32/kernel/vdso/note.S create mode 100644 arch/nds32/kernel/vdso/sigreturn.S create mode 100644 arch/nds32/kernel/vdso/vdso.S create mode 100644 arch/nds32/kernel/vdso/vdso.lds.S
arch/nds32/include/asm/vdso.h new file +24 -0
@@ -0,0 +1,24 @@ +/* +* SPDX-License-Identifier: GPL-2.0 +* Copyright (C) 2005-2017 Andes Technology Corporation +*/ + +#ifndef __ASM_VDSO_H +#define __ASM_VDSO_H + +#ifdef __KERNEL__ + +#ifndef __ASSEMBLY__ + +#include <generated/vdso-offsets.h> + +#define VDSO_SYMBOL (base, name) \ +({ \ + (unsigned long)(vdso_offset_##name + (unsigned long)(base)); \ +}) + +#endif /* !__ASSEMBLY__ */ + +#endif /* __KERNEL__ */ + +#endif /* __ASM_VDSO_H */
arch/nds32/include/asm/vdso_datapage.h new file +36 -0
@@ -0,0 +1,36 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2012 ARM Limited +// Copyright (C) 2005-2017 Andes Technology Corporation +#ifndef __ASM_VDSO_DATAPAGE_H +#define __ASM_VDSO_DATAPAGE_H + +#ifdef __KERNEL__ + +#ifndef __ASSEMBLY__ + +struct vdso_data { +bool cycle_count_down;/* timer cyclye counter is decrease with time */ +u32 cycle_count_offset;/* offset of timer cycle counter register */ +u32 seq_count;/* sequence count - odd during updates */ +u32 xtime_coarse_sec;/* coarse time */ +u32 xtime_coarse_nsec; + +u32 wtm_clock_sec;/* wall to monotonic offset */ +u32 wtm_clock_nsec; +u32 xtime_clock_sec;/* CLOCK_REALTIME - seconds */ +u32 cs_mult;/* clocksource multiplier */ +u32 cs_shift;/* Cycle to nanosecond divisor (power of two) */ + +u64 cs_cycle_last;/* last cycle value */ +u64 cs_mask;/* clocksource mask */ + +u64 xtime_clock_nsec;/* CLOCK_REALTIME sub-ns base */ +u32 tz_minuteswest;/* timezone info for gettimeofday(2) */ +u32 tz_dsttime; +}; + +#endif /* !__ASSEMBLY__ */ + +#endif /* __KERNEL__ */ + +#endif /* __ASM_VDSO_DATAPAGE_H */
arch/nds32/include/asm/vdso_timer_info.h new file +14 -0
@@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +extern struct timer_info_t timer_info; +#define EMPTY_VALUE ~(0UL) +#define EMPTY_TIMER_MAPPING EMPTY_VALUE +#define EMPTY_REG_OFFSET EMPTY_VALUE + +struct timer_info_t +{ +bool cycle_count_down; +unsigned long mapping_base; +unsigned long cycle_count_reg_offset; +};
arch/nds32/kernel/vdso.c new file +233 -0
233 lines not on this page · raw message
arch/nds32/kernel/vdso/Makefile new file +82 -0
82 lines not on this page · raw message
arch/nds32/kernel/vdso/datapage.S new file +21 -0
@@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#include <linux/linkage.h> +#include <asm/page.h> + +ENTRY(__get_timerpage) + sethi $r0, hi20(. + PAGE_SIZE + 8) + ori $r0, $r0, lo12(. + PAGE_SIZE + 4) + mfusr $r1, $pc + sub $r0, $r1, $r0 + ret +ENDPROC(__get_timerpage) + +ENTRY(__get_datapage) + sethi $r0, hi20(. + 2*PAGE_SIZE + 8) + ori $r0, $r0, lo12(. + 2*PAGE_SIZE + 4) + mfusr $r1, $pc + sub $r0, $r1, $r0 + ret +ENDPROC(__get_datapage)
arch/nds32/kernel/vdso/gen_vdso_offsets.sh new file +15 -0
@@ -0,0 +1,15 @@ +#!/bin/sh + +# +# Match symbols in the DSO that look like VDSO_*; produce a header file +# of constant offsets into the shared object. +# +# Doing this inside the Makefile will break the $(filter-out) function, +# causing Kbuild to rebuild the vdso-offsets header file every time. +# +# Author: Will Deacon <[email protected] +# + +LC_ALL=C +sed -n -e 's/^00*/0/' -e \ +'s/^\([0-9a-fA-F]*\) . VDSO_\([a-zA-Z0-9_]*\)$/\#define vdso_offset_\2\t0x\1/p'
arch/nds32/kernel/vdso/gettimeofday.c new file +271 -0
271 lines not on this page · raw message
arch/nds32/kernel/vdso/note.S new file +11 -0
@@ -0,0 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2012 ARM Limited +// Copyright (C) 2005-2017 Andes Technology Corporation + +#include <linux/uts.h> +#include <linux/version.h> +#include <linux/elfnote.h> + +ELFNOTE_START(Linux, 0, "a") + .long LINUX_VERSION_CODE +ELFNOTE_END
arch/nds32/kernel/vdso/sigreturn.S new file +19 -0
@@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2012 ARM Limited +// Copyright (C) 2005-2017 Andes Technology Corporation + +#include <linux/linkage.h> +#include <asm/unistd.h> + + .text + +ENTRY(__kernel_rt_sigreturn) + .cfi_startproc + movi $r15, __NR_rt_sigreturn + /* + * The SWID of syscall should be __NR_rt_sigreturn to synchronize + * the unwinding scheme in gcc + */ + syscall __NR_rt_sigreturn + .cfi_endproc +ENDPROC(__kernel_rt_sigreturn)
arch/nds32/kernel/vdso/vdso.S new file +18 -0
@@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2012 ARM Limited +// Copyright (C) 2005-2017 Andes Technology Corporation + +#include <linux/init.h> +#include <linux/linkage.h> +#include <linux/const.h> +#include <asm/page.h> + + .globl vdso_start, vdso_end + .section .rodata + .balign PAGE_SIZE +vdso_start: + .incbin "arch/nds32/kernel/vdso/vdso.so" + .balign PAGE_SIZE +vdso_end: + + .previous
arch/nds32/kernel/vdso/vdso.lds.S new file +76 -0
76 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v4 18/36 nds32: Signal handling support
In reply to Greentime HuFrom: Greentime Hu <[email protected]>
This patch adds support for signal handling.
--- arch/nds32/include/uapi/asm/sigcontext.h | 60 ++++++ arch/nds32/kernel/signal.c | 337 ++++++++++++++++++++++++++++++ 2 files changed, 397 insertions(+) create mode 100644 arch/nds32/include/uapi/asm/sigcontext.h create mode 100644 arch/nds32/kernel/signal.c
arch/nds32/include/uapi/asm/sigcontext.h new file +60 -0
@@ -0,0 +1,60 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#ifndef _ASMNDS32_SIGCONTEXT_H +#define _ASMNDS32_SIGCONTEXT_H + +/* +* Signal context structure - contains all info to do with the state +* before the signal handler was invoked. Note: only add new entries +* to the end of the structure. +*/ + +struct zol_struct { +unsigned long nds32_lc;/* $LC */ +unsigned long nds32_le;/* $LE */ +unsigned long nds32_lb;/* $LB */ +}; + +struct sigcontext { +unsigned long trap_no; +unsigned long error_code; +unsigned long oldmask; +unsigned long nds32_r0; +unsigned long nds32_r1; +unsigned long nds32_r2; +unsigned long nds32_r3; +unsigned long nds32_r4; +unsigned long nds32_r5; +unsigned long nds32_r6; +unsigned long nds32_r7; +unsigned long nds32_r8; +unsigned long nds32_r9; +unsigned long nds32_r10; +unsigned long nds32_r11; +unsigned long nds32_r12; +unsigned long nds32_r13; +unsigned long nds32_r14; +unsigned long nds32_r15; +unsigned long nds32_r16; +unsigned long nds32_r17; +unsigned long nds32_r18; +unsigned long nds32_r19; +unsigned long nds32_r20; +unsigned long nds32_r21; +unsigned long nds32_r22; +unsigned long nds32_r23; +unsigned long nds32_r24; +unsigned long nds32_r25; +unsigned long nds32_fp;/* $r28 */ +unsigned long nds32_gp;/* $r29 */ +unsigned long nds32_lp;/* $r30 */ +unsigned long nds32_sp;/* $r31 */ +unsigned long nds32_ipc; +unsigned long fault_address; +unsigned long used_math_flag; +/* FPU Registers */ +struct zol_struct zol; +}; + +#endif
arch/nds32/kernel/signal.c new file +337 -0
337 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v4 19/36 nds32: Library functions
In reply to Greentime HuFrom: Greentime Hu <[email protected]>
This patch add support for various library functions.
--- arch/nds32/include/asm/string.h | 17 +++ arch/nds32/include/asm/swab.h | 35 +++++ arch/nds32/include/asm/uaccess.h | 283 ++++++++++++++++++++++++++++++++++++++ arch/nds32/kernel/nds32_ksyms.c | 31 +++++ arch/nds32/lib/Makefile | 3 + arch/nds32/lib/clear_user.S | 42 ++++++ arch/nds32/lib/copy_from_user.S | 45 ++++++ arch/nds32/lib/copy_template.S | 70 ++++++++++ arch/nds32/lib/copy_to_user.S | 45 ++++++ arch/nds32/lib/memcpy.S | 30 ++++ arch/nds32/lib/memmove.S | 70 ++++++++++ arch/nds32/lib/memset.S | 33 +++++ arch/nds32/lib/memzero.S | 18 +++ 13 files changed, 722 insertions(+) create mode 100644 arch/nds32/include/asm/string.h create mode 100644 arch/nds32/include/asm/swab.h create mode 100644 arch/nds32/include/asm/uaccess.h create mode 100644 arch/nds32/kernel/nds32_ksyms.c create mode 100644 arch/nds32/lib/Makefile create mode 100644 arch/nds32/lib/clear_user.S create mode 100644 arch/nds32/lib/copy_from_user.S create mode 100644 arch/nds32/lib/copy_template.S create mode 100644 arch/nds32/lib/copy_to_user.S create mode 100644 arch/nds32/lib/memcpy.S create mode 100644 arch/nds32/lib/memmove.S create mode 100644 arch/nds32/lib/memset.S create mode 100644 arch/nds32/lib/memzero.S
arch/nds32/include/asm/string.h new file +17 -0
@@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#ifndef __ASM_NDS32_STRING_H +#define __ASM_NDS32_STRING_H + +#define __HAVE_ARCH_MEMCPY +extern void *memcpy (void *,const void *,__kernel_size_t ); + +#define __HAVE_ARCH_MEMMOVE +extern void *memmove (void *,const void *,__kernel_size_t ); + +#define __HAVE_ARCH_MEMSET +extern void *memset (void *,int ,__kernel_size_t ); + +extern void *memzero (void *ptr,__kernel_size_t n); +#endif
arch/nds32/include/asm/swab.h new file +35 -0
@@ -0,0 +1,35 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#ifndef __NDS32_SWAB_H__ +#define __NDS32_SWAB_H__ + +#include <linux/types.h> +#include <linux/compiler.h> + +static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x) +{ + __asm__("wsbh %0, %0\n\t" /* word swap byte within halfword */ +"rotri %0, %0, #16\n" + :"=r" (x) + :"0" (x)); +return x; +} + +static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x) +{ + __asm__("wsbh %0, %0\n" /* word swap byte within halfword */ + :"=r" (x) + :"0" (x)); +return x; +} + +#define __arch_swab32 (x) ___arch__swab32(x) +#define __arch_swab16 (x) ___arch__swab16(x) + +#if !defined(__STRICT_ANSI__) || defined(__KERNEL__) +#define __BYTEORDER_HAS_U64__ +#define __SWAB_64_THRU_32__ +#endif + +#endif /* __NDS32_SWAB_H__ */
arch/nds32/include/asm/uaccess.h new file +283 -0
283 lines not on this page · raw message
arch/nds32/kernel/nds32_ksyms.c new file +31 -0
@@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#include <linux/module.h> +#include <linux/string.h> +#include <linux/delay.h> +#include <linux/in6.h> +#include <linux/syscalls.h> +#include <linux/uaccess.h> + +#include <asm/checksum.h> +#include <asm/io.h> +#include <asm/ftrace.h> +#include <asm/proc-fns.h> + +/* mem functions */ +EXPORT_SYMBOL (memset); +EXPORT_SYMBOL (memcpy); +EXPORT_SYMBOL (memmove); +EXPORT_SYMBOL (memzero); + +/* user mem (segment) */ +EXPORT_SYMBOL (__arch_copy_from_user); +EXPORT_SYMBOL (__arch_copy_to_user); +EXPORT_SYMBOL (__arch_clear_user); + +/* cache handling */ +EXPORT_SYMBOL (cpu_icache_inval_all); +EXPORT_SYMBOL (cpu_dcache_wbinval_all); +EXPORT_SYMBOL (cpu_dma_inval_range); +EXPORT_SYMBOL (cpu_dma_wb_range);
arch/nds32/lib/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +lib-y := copy_page.o memcpy.o memmove.o \ + memset.o memzero.o \ + copy_from_user.o copy_to_user.o clear_user.o
arch/nds32/lib/clear_user.S new file +42 -0
42 lines not on this page · raw message
arch/nds32/lib/copy_from_user.S new file +45 -0
45 lines not on this page · raw message
arch/nds32/lib/copy_template.S new file +70 -0
70 lines not on this page · raw message
arch/nds32/lib/copy_to_user.S new file +45 -0
45 lines not on this page · raw message
arch/nds32/lib/memcpy.S new file +30 -0
@@ -0,0 +1,30 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#include <linux/linkage.h> + + +.macro lbi1 dst, addr, adj +lbi.bi \dst, [\addr], \adj +.endm + +.macro sbi1 src, addr, adj +sbi.bi \src, [\addr], \adj +.endm + +.macro lmw1 start_reg, addr, end_reg +lmw.bim \start_reg, [\addr], \end_reg +.endm + +.macro smw1 start_reg, addr, end_reg +smw.bim \start_reg, [\addr], \end_reg +.endm + +.text +ENTRY(memcpy) + move $r5, $r0 +#include "copy_template.S" + move $r0, $r5 + ret + +ENDPROC(memcpy)
arch/nds32/lib/memmove.S new file +70 -0
70 lines not on this page · raw message
arch/nds32/lib/memset.S new file +33 -0
@@ -0,0 +1,33 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#include <linux/linkage.h> + + .text +ENTRY(memset) + move $r5, $r0 ! Return value + beqz $r2, end_memset ! Exit when len = 0 + srli $p1, $r2, 2 ! $p1 is how many words to copy + andi $r2, $r2, 3 ! How many bytes are less than a word + beqz $p1, byte_set ! When n is less than a word + + ! set $r1 from ??????ab to abababab + andi $r1, $r1, #0x00ff ! $r1 = 000000ab + slli $p0, $r1, #8 ! $p0 = 0000ab00 + or $r1, $r1, $p0 ! $r1 = 0000abab + slli $p0, $r1, #16 ! $p0 = abab0000 + or $r1, $r1, $p0 ! $r1 = abababab +word_set: + addi $p1, $p1, #-1 ! How many words left to copy + smw.bim $r1, [$r0], $r1 ! Copy the word to det + bnez $p1, word_set ! Still words to set, continue looping + beqz $r2, end_memset ! No left byte to set +byte_set: ! Less than 4 bytes left to set + addi $r2, $r2, #-1 ! Decrease len by 1 + sbi.bi $r1, [$r0], #1 ! Set data of the next byte to $r1 + bnez $r2, byte_set ! Still bytes left to set +end_memset: + move $r0, $r5 + ret + +ENDPROC(memset)
arch/nds32/lib/memzero.S new file +18 -0
@@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#include <linux/linkage.h> + + .text +ENTRY(memzero) + beqz $r1, 1f + push $lp + move $r2, $r1 + move $r1, #0 + push $r0 + bal memset + pop $r0 + pop $lp +1: + ret +ENDPROC(memzero)
Signature · 1 line
1.7.9.5
PATCH v4 20/36 nds32: Debugging support
In reply to Greentime HuFrom: Greentime Hu <[email protected]>
This patch adds ptrace support.
--- arch/nds32/include/uapi/asm/ptrace.h | 25 +++ arch/nds32/kernel/ptrace.c | 311 ++++++++++++++++++++++++++++++++++ 2 files changed, 336 insertions(+) create mode 100644 arch/nds32/include/uapi/asm/ptrace.h create mode 100644 arch/nds32/kernel/ptrace.c
arch/nds32/include/uapi/asm/ptrace.h new file +25 -0
@@ -0,0 +1,25 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#ifndef __UAPI_ASM_NDS32_PTRACE_H +#define __UAPI_ASM_NDS32_PTRACE_H + +#ifndef __ASSEMBLY__ + +/* +* User structures for general purpose register. +*/ +struct user_pt_regs { +long uregs[26 ]; +long fp; +long gp; +long lp; +long sp; +long ipc; +long lb; +long le; +long lc; +long syscallno; +}; +#endif +#endif
arch/nds32/kernel/ptrace.c new file +311 -0
311 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v4 21/36 nds32: L2 cache support
In reply to Greentime HuFrom: Greentime Hu <[email protected]>
This patch adds L2 cache support.
--- arch/nds32/include/asm/l2_cache.h | 142 +++++++++++++++++++++++++++++++++++++ arch/nds32/kernel/atl2c.c | 64 +++++++++++++++++ 2 files changed, 206 insertions(+) create mode 100644 arch/nds32/include/asm/l2_cache.h create mode 100644 arch/nds32/kernel/atl2c.c
arch/nds32/include/asm/l2_cache.h new file +142 -0
@@ -0,0 +1,142 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#ifndef L2_CACHE_H +#define L2_CACHE_H + +/* CCTL_CMD_OP */ +#define L2_CA_CONF_OFF 0x0 +#define L2_IF_CONF_OFF 0x4 +#define L2CC_SETUP_OFF 0x8 +#define L2CC_PROT_OFF 0xC +#define L2CC_CTRL_OFF 0x10 +#define L2_INT_EN_OFF 0x20 +#define L2_STA_OFF 0x24 +#define RDERR_ADDR_OFF 0x28 +#define WRERR_ADDR_OFF 0x2c +#define EVDPTERR_ADDR_OFF 0x30 +#define IMPL3ERR_ADDR_OFF 0x34 +#define L2_CNT0_CTRL_OFF 0x40 +#define L2_EVNT_CNT0_OFF 0x44 +#define L2_CNT1_CTRL_OFF 0x48 +#define L2_EVNT_CNT1_OFF 0x4c +#define L2_CCTL_CMD_OFF 0x60 +#define L2_CCTL_STATUS_OFF 0x64 +#define L2_LINE_TAG_OFF 0x68 +#define L2_LINE_DPT_OFF 0x70 + +#define CCTL_CMD_L2_IX_INVAL 0x0 +#define CCTL_CMD_L2_PA_INVAL 0x1 +#define CCTL_CMD_L2_IX_WB 0x2 +#define CCTL_CMD_L2_PA_WB 0x3 +#define CCTL_CMD_L2_PA_WBINVAL 0x5 +#define CCTL_CMD_L2_SYNC 0xa + +/* CCTL_CMD_TYPE */ +#define CCTL_SINGLE_CMD 0 +#define CCTL_BLOCK_CMD 0x10 +#define CCTL_ALL_CMD 0x10 + +/****************************************************************************** +* L2_CA_CONF (Cache architecture configuration) +*****************************************************************************/ +#define L2_CA_CONF_offL2SET 0 +#define L2_CA_CONF_offL2WAY 4 +#define L2_CA_CONF_offL2CLSZ 8 +#define L2_CA_CONF_offL2DW 11 +#define L2_CA_CONF_offL2PT 14 +#define L2_CA_CONF_offL2VER 16 + +#define L2_CA_CONF_mskL2SET (0xFUL << L2_CA_CONF_offL2SET) +#define L2_CA_CONF_mskL2WAY (0xFUL << L2_CA_CONF_offL2WAY) +#define L2_CA_CONF_mskL2CLSZ (0x7UL << L2_CA_CONF_offL2CLSZ) +#define L2_CA_CONF_mskL2DW (0x7UL << L2_CA_CONF_offL2DW) +#define L2_CA_CONF_mskL2PT (0x3UL << L2_CA_CONF_offL2PT) +#define L2_CA_CONF_mskL2VER (0xFFFFUL << L2_CA_CONF_offL2VER) + +/****************************************************************************** +* L2CC_SETUP (L2CC Setup register) +*****************************************************************************/ +#define L2CC_SETUP_offPART 0 +#define L2CC_SETUP_mskPART (0x3UL << L2CC_SETUP_offPART) +#define L2CC_SETUP_offDDLATC 4 +#define L2CC_SETUP_mskDDLATC (0x3UL << L2CC_SETUP_offDDLATC) +#define L2CC_SETUP_offTDLATC 8 +#define L2CC_SETUP_mskTDLATC (0x3UL << L2CC_SETUP_offTDLATC) + +/****************************************************************************** +* L2CC_PROT (L2CC Protect register) +*****************************************************************************/ +#define L2CC_PROT_offMRWEN 31 +#define L2CC_PROT_mskMRWEN (0x1UL << L2CC_PROT_offMRWEN) + +/****************************************************************************** +* L2_CCTL_STATUS_Mn (The L2CCTL command working status for Master n) +*****************************************************************************/ +#define L2CC_CTRL_offEN 31 +#define L2CC_CTRL_mskEN (0x1UL << L2CC_CTRL_offEN) + +/****************************************************************************** +* L2_CCTL_STATUS_Mn (The L2CCTL command working status for Master n) +*****************************************************************************/ +#define L2_CCTL_STATUS_offCMD_COMP 31 +#define L2_CCTL_STATUS_mskCMD_COMP (0x1 << L2_CCTL_STATUS_offCMD_COMP) + +#ifndef __ASSEMBLY__ +extern void __iomem *atl2c_base; + +#include <linux/smp.h> +#include <asm/io.h> +#include <asm/bitfield.h> + +#define L2C_R_REG (offset) readl(atl2c_base + offset) +#define L2C_W_REG (offset, value) writel(value, atl2c_base + offset) + +#define L2_CMD_RDY () \ + do{;}while((L2C_R_REG(L2_CCTL_STATUS_OFF) & L2_CCTL_STATUS_mskCMD_COMP) == 0) + +static inline unsigned long L2_CACHE_SET (void ) +{ +return 64 << ((L2C_R_REG (L2_CA_CONF_OFF ) & L2_CA_CONF_mskL2SET) >> + L2_CA_CONF_offL2SET); +} + +static inline unsigned long L2_CACHE_WAY (void ) +{ +return 1 + + ((L2C_R_REG (L2_CA_CONF_OFF ) & L2_CA_CONF_mskL2WAY) >> + L2_CA_CONF_offL2WAY); +} + +static inline unsigned long L2_CACHE_LINE_SIZE (void ) +{ + +return 4 << ((L2C_R_REG (L2_CA_CONF_OFF ) & L2_CA_CONF_mskL2CLSZ) >> + L2_CA_CONF_offL2CLSZ); +} + +static inline unsigned long GET_L2CC_CTRL_CPU (unsigned long cpu) +{ +if (cpu ==smp_processor_id ()) +return L2C_R_REG (L2CC_CTRL_OFF ); +return L2C_R_REG (L2CC_CTRL_OFF + (cpu <<8 )); +} + +static inline void SET_L2CC_CTRL_CPU (unsigned long cpu,unsigned long val) +{ +if (cpu ==smp_processor_id ()) +L2C_W_REG (L2CC_CTRL_OFF , val); +else +L2C_W_REG (L2CC_CTRL_OFF + (cpu <<8 ), val); +} + +static inline unsigned long GET_L2CC_STATUS_CPU (unsigned long cpu) +{ +if (cpu ==smp_processor_id ()) +return L2C_R_REG (L2_CCTL_STATUS_OFF ); +return L2C_R_REG (L2_CCTL_STATUS_OFF + (cpu <<8 )); +} + +#endif + +#endif
arch/nds32/kernel/atl2c.c new file +64 -0
64 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v4 22/36 nds32: Loadable modules
In reply to Greentime HuFrom: Greentime Hu <[email protected]>
This patch adds support for loadable modules.
--- arch/nds32/include/asm/module.h | 11 ++ arch/nds32/kernel/module.c | 286 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 297 insertions(+) create mode 100644 arch/nds32/include/asm/module.h create mode 100644 arch/nds32/kernel/module.c
arch/nds32/include/asm/module.h new file +11 -0
@@ -0,0 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#ifndef _ASM_NDS32_MODULE_H +#define _ASM_NDS32_MODULE_H + +#include <asm-generic/module.h> + +#define MODULE_ARCH_VERMAGIC "NDS32v3" + +#endif /* _ASM_NDS32_MODULE_H */
arch/nds32/kernel/module.c new file +286 -0
286 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v4 23/36 nds32: Generic timers support
In reply to Greentime HuFrom: Greentime Hu <[email protected]>
This patch adds support for timer.
--- arch/nds32/kernel/time.c | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 arch/nds32/kernel/time.c
arch/nds32/kernel/time.c new file +11 -0
@@ -0,0 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#include <linux/clocksource.h> +#include <linux/clk-provider.h> + +void __init time_init (void ) +{ +of_clk_init (NULL ); +timer_probe (); +}
Signature · 1 line
1.7.9.5
PATCH v4 24/36 nds32: Device tree support
In reply to Greentime HuFrom: Greentime Hu <[email protected]>
This patch adds support for device tree.
--- arch/nds32/boot/dts/Makefile | 8 +++++ arch/nds32/boot/dts/ae3xx.dts | 65 +++++++++++++++++++++++++++++++++++++++++ arch/nds32/kernel/devtree.c | 19 ++++++++++++ 3 files changed, 92 insertions(+) create mode 100644 arch/nds32/boot/dts/Makefile create mode 100644 arch/nds32/boot/dts/ae3xx.dts create mode 100644 arch/nds32/kernel/devtree.c
arch/nds32/boot/dts/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +ifneq '$(CONFIG_NDS32_BUILTIN_DTB)' '""' +BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_NDS32_BUILTIN_DTB)).dtb.o +else +BUILTIN_DTB := +endif +obj-$(CONFIG_OF) += $(BUILTIN_DTB) + +clean-files := *.dtb *.dtb.S
arch/nds32/boot/dts/ae3xx.dts new file +65 -0
65 lines not on this page · raw message
arch/nds32/kernel/devtree.c new file +19 -0
@@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#include <linux/bug.h> +#include <linux/printk.h> +#include <linux/of_fdt.h> + +void __init early_init_devtree (void *params) +{ +if (!params || !early_init_dt_scan (params)) { +pr_crit ("\n" +"Error: invalid device tree blob at (virtual address 0x%p)\n" +"\nPlease check your bootloader." , params); + +BUG_ON (1 ); + } + +dump_stack_set_arch_desc ("%s (DT)" ,of_flat_dt_get_machine_name ()); +}
Signature · 1 line
1.7.9.5
PATCH v4 25/36 nds32: Miscellaneous header files
In reply to Greentime HuFrom: Greentime Hu <[email protected]>
This patch introduces some miscellaneous header files.
--- arch/nds32/include/asm/delay.h | 38 +++++++++++++++++++++++++++++++ arch/nds32/include/asm/linkage.h | 11 +++++++++ arch/nds32/include/uapi/asm/byteorder.h | 13 +++++++++++ 3 files changed, 62 insertions(+) create mode 100644 arch/nds32/include/asm/delay.h create mode 100644 arch/nds32/include/asm/linkage.h create mode 100644 arch/nds32/include/uapi/asm/byteorder.h
arch/nds32/include/asm/delay.h new file +38 -0
@@ -0,0 +1,38 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#ifndef __NDS32_DELAY_H__ +#define __NDS32_DELAY_H__ + +#include <asm/param.h> + +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); +} + +#define udelay (usecs) __udelay((usecs), loops_per_jiffy) + +/* make sure "usecs *= ..." in udelay do not overflow. */ +#if HZ >=1000 +#define MAX_UDELAY_MS 1 +#elif HZ <=200 +#define MAX_UDELAY_MS 5 +#else +#define MAX_UDELAY_MS (1000 / HZ) +#endif + +#endif
arch/nds32/include/asm/linkage.h new file +11 -0
@@ -0,0 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#ifndef __ASM_LINKAGE_H +#define __ASM_LINKAGE_H + +/* This file is required by include/linux/linkage.h */ +#define __ALIGN .align 2 +#define __ALIGN_STR ".align 2" + +#endif
arch/nds32/include/uapi/asm/byteorder.h new file +13 -0
@@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (C) 2005-2017 Andes Technology Corporation + +#ifndef __NDS32_BYTEORDER_H__ +#define __NDS32_BYTEORDER_H__ + +#ifdef __NDS32_EB__ +#include <linux/byteorder/big_endian.h> +#else +#include <linux/byteorder/little_endian.h> +#endif + +#endif /* __NDS32_BYTEORDER_H__ */
Signature · 1 line
1.7.9.5
Arnd Bergmann
maintainerRe: [PATCH v4 25/36] nds32: Miscellaneous header files
Quoted 11 lines · Greentime Hu
From: Greentime Hu <greentime-MUIXKm3Oiri1Z/[email protected]>
This patch introduces some miscellaneous header files.
arch/nds32/include/asm/delay.h new file +7
-0+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)
arch/nds32/include/asm/delay.h line 25
Quoted 10 lines
arch/nds32/include/asm/delay.h new file +10
-0+ :"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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 25/36] nds32: Miscellaneous header files
Hi, Arnd:
2017-12-18 19:13 GMT+08:00 Arnd Bergmann <[email protected]>:
Quoted 19 lines · Greentime Hu
Quoted 18 lines
From: Greentime Hu <greentime-MUIXKm3Oiri1Z/[email protected]>
This patch introduces some miscellaneous header files.
arch/nds32/include/asm/delay.h new file +14
-0+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 );
Quoted 9 lines
arch/nds32/include/asm/delay.h line 25
Quoted 3 lines
arch/nds32/include/asm/delay.h new file +3
-0+ 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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Arnd Bergmann
maintainerRe: [PATCH v4 25/36] nds32: Miscellaneous header files
Quoted 32 lines · Greentime Hu
Hi, Arnd:
2017-12-18 19:13 GMT+08:00 Arnd Bergmann <[email protected]>:
Quoted 19 lines · Greentime Hu
Quoted 18 lines
From: Greentime Hu <greentime-MUIXKm3Oiri1Z/[email protected]>
This patch introduces some miscellaneous header files.
arch/nds32/include/asm/delay.h new file +14
-0+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 );Quoted 9 lines
arch/nds32/include/asm/delay.h line 25
Quoted 3 lines
arch/nds32/include/asm/delay.h new file +3
-0+ 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.
Quoted 5 lines
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.
Quoted 2 lines
Or maybe I can use a
CONFIG_USE_ACCURATE_DELAYto 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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 25/36] nds32: Miscellaneous header files
2017-12-19 17:54 GMT+08:00 Arnd Bergmann <[email protected]>:
Quoted 39 lines · Greentime Hu
Quoted 32 lines
Hi, Arnd:
2017-12-18 19:13 GMT+08:00 Arnd Bergmann <[email protected]>:
Quoted 19 lines · Greentime Hu
Quoted 18 lines
From: Greentime Hu <greentime-MUIXKm3Oiri1Z/[email protected]>
This patch introduces some miscellaneous header files.
arch/nds32/include/asm/delay.h new file +14
-0+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 );Quoted 9 lines
arch/nds32/include/asm/delay.h line 25
Quoted 3 lines
arch/nds32/include/asm/delay.h new file +3
-0+ 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.
Quoted 5 lines
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.
Quoted 8 lines
Ok, thanks for the clarification.
Quoted 2 lines
Or maybe I can use a
CONFIG_USE_ACCURATE_DELAYto keep these 2 implementions for these purposes?I'd just add a one-line comment in
delay.hto 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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v4 26/36 nds32: defconfig
In reply to Greentime HuFrom: Greentime Hu <[email protected]>
This patch adds nds32 defconfig.
--- arch/nds32/configs/defconfig | 108 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 arch/nds32/configs/defconfig
arch/nds32/configs/defconfig new file +108 -0
@@ -0,0 +1,108 @@ +CONFIG_CROSS_COMPILE="nds32le-linux-" +CONFIG_SYSVIPC=y +CONFIG_POSIX_MQUEUE=y +CONFIG_HIGH_RES_TIMERS=y +CONFIG_BSD_PROCESS_ACCT=y +CONFIG_BSD_PROCESS_ACCT_V3=y +CONFIG_IKCONFIG=y +CONFIG_IKCONFIG_PROC=y +CONFIG_LOG_BUF_SHIFT=14 +CONFIG_USER_NS=y +CONFIG_RELAY=y +CONFIG_BLK_DEV_INITRD=y +CONFIG_KALLSYMS_ALL=y +CONFIG_PROFILING=y +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y +# CONFIG_BLK_DEV_BSG is not set +# CONFIG_CACHE_L2 is not set +CONFIG_VMSPLIT_3G_OPT=y +CONFIG_PREEMPT=y +# CONFIG_COMPACTION is not set +CONFIG_HZ_100=y +# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set +CONFIG_NET=y +CONFIG_PACKET=y +CONFIG_UNIX=y +CONFIG_NET_KEY=y +CONFIG_INET=y +CONFIG_IP_MULTICAST=y +# CONFIG_INET_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET_XFRM_MODE_TUNNEL is not set +# CONFIG_INET_XFRM_MODE_BEET is not set +# CONFIG_INET_DIAG is not set +# CONFIG_IPV6 is not set +# CONFIG_BLK_DEV is not set +CONFIG_NETDEVICES=y +# CONFIG_NET_CADENCE is not set +# CONFIG_NET_VENDOR_BROADCOM is not set +CONFIG_FTMAC100=y +# CONFIG_NET_VENDOR_INTEL is not set +# CONFIG_NET_VENDOR_MARVELL is not set +# CONFIG_NET_VENDOR_MICREL is not set +# CONFIG_NET_VENDOR_NATSEMI is not set +# CONFIG_NET_VENDOR_SEEQ is not set +# CONFIG_NET_VENDOR_STMICRO is not set +# CONFIG_NET_VENDOR_WIZNET is not set +CONFIG_INPUT_EVDEV=y +# CONFIG_INPUT_KEYBOARD is not set +# CONFIG_INPUT_MOUSE is not set +CONFIG_INPUT_TOUCHSCREEN=y +# CONFIG_SERIO is not set +CONFIG_VT_HW_CONSOLE_BINDING=y +CONFIG_SERIAL_8250=y +# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set +CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_SERIAL_8250_NR_UARTS=3 +CONFIG_SERIAL_8250_RUNTIME_UARTS=3 +CONFIG_SERIAL_OF_PLATFORM=y +# CONFIG_HW_RANDOM is not set +# CONFIG_HWMON is not set +# CONFIG_RC_CORE is not set +# CONFIG_VGA_CONSOLE is not set +# CONFIG_HID_A4TECH is not set +# CONFIG_HID_APPLE is not set +# CONFIG_HID_BELKIN is not set +# CONFIG_HID_CHERRY is not set +# CONFIG_HID_CHICONY is not set +# CONFIG_HID_CYPRESS is not set +# CONFIG_HID_EZKEY is not set +# CONFIG_HID_ITE is not set +# CONFIG_HID_KENSINGTON is not set +# CONFIG_HID_LOGITECH is not set +# CONFIG_HID_MICROSOFT is not set +# CONFIG_HID_MONTEREY is not set +# CONFIG_USB_SUPPORT is not set +CONFIG_TIMER_ATCPIT100=y +CONFIG_GENERIC_PHY=y +CONFIG_EXT4_FS=y +CONFIG_EXT4_FS_POSIX_ACL=y +CONFIG_EXT4_FS_SECURITY=y +CONFIG_EXT4_ENCRYPTION=y +CONFIG_FUSE_FS=y +CONFIG_MSDOS_FS=y +CONFIG_VFAT_FS=y +CONFIG_TMPFS=y +CONFIG_TMPFS_POSIX_ACL=y +CONFIG_CONFIGFS_FS=y +CONFIG_NFS_FS=y +CONFIG_NFS_V3_ACL=y +CONFIG_NFS_V4=y +CONFIG_NFS_V4_1=y +CONFIG_NFS_USE_LEGACY_DNS=y +CONFIG_NLS_CODEPAGE_437=y +CONFIG_NLS_ISO8859_1=y +CONFIG_DEBUG_INFO=y +CONFIG_DEBUG_INFO_DWARF4=y +CONFIG_GDB_SCRIPTS=y +CONFIG_READABLE_ASM=y +CONFIG_HEADERS_CHECK=y +CONFIG_DEBUG_SECTION_MISMATCH=y +CONFIG_MAGIC_SYSRQ=y +CONFIG_DEBUG_KERNEL=y +CONFIG_PANIC_ON_OOPS=y +# CONFIG_SCHED_DEBUG is not set +# CONFIG_DEBUG_PREEMPT is not set +CONFIG_STACKTRACE=y +CONFIG_RCU_CPU_STALL_TIMEOUT=300 +# CONFIG_CRYPTO_HW is not set
Signature · 1 line
1.7.9.5
PATCH v4 27/36 nds32: Build infrastructure
In reply to Greentime HuFrom: Greentime Hu <[email protected]>
This patch adds Makefile, Kconfig and vmlinux.lds.S files required for building an nds32 kernel.
--- arch/nds32/Kconfig | 108 ++++++++++++++++++++++++ arch/nds32/Kconfig.cpu | 161 ++++++++++++++++++++++++++++++++++++ arch/nds32/Makefile | 66 +++++++++++++++ arch/nds32/boot/Makefile | 15 ++++ arch/nds32/include/asm/Kbuild | 53 ++++++++++++ arch/nds32/include/uapi/asm/Kbuild | 28 +++++++ arch/nds32/kernel/Makefile | 23 ++++++ arch/nds32/kernel/vmlinux.lds.S | 57 +++++++++++++ arch/nds32/mm/Makefile | 7 ++ 9 files changed, 518 insertions(+) create mode 100644 arch/nds32/Kconfig create mode 100644 arch/nds32/Kconfig.cpu create mode 100644 arch/nds32/Makefile create mode 100644 arch/nds32/boot/Makefile create mode 100644 arch/nds32/include/asm/Kbuild create mode 100644 arch/nds32/include/uapi/asm/Kbuild create mode 100644 arch/nds32/kernel/Makefile create mode 100644 arch/nds32/kernel/vmlinux.lds.S create mode 100644 arch/nds32/mm/Makefile
arch/nds32/Kconfig new file +108 -0
@@ -0,0 +1,108 @@ +# +# For a description of the syntax of this configuration file, +# see Documentation/kbuild/kconfig-language.txt. +# + +config NDS32 + def_bool y + select ARCH_HAS_RAW_COPY_USER + select ARCH_WANT_FRAME_POINTERS if FTRACE + select ARCH_WANT_IPC_PARSE_VERSION + select CLKSRC_MMIO + select CLONE_BACKWARDS + select COMMON_CLK + select TIMER_OF + select FRAME_POINTER + select GENERIC_ATOMIC64 + select GENERIC_CPU_DEVICES + select GENERIC_CLOCKEVENTS + select GENERIC_IRQ_CHIP + select GENERIC_IRQ_PROBE + select GENERIC_IRQ_SHOW + select GENERIC_STRNCPY_FROM_USER + select GENERIC_STRNLEN_USER + select GENERIC_TIME_VSYSCALL + select HANDLE_DOMAIN_IRQ + select HAVE_ARCH_TRACEHOOK + select HAVE_DEBUG_KMEMLEAK + select HAVE_MEMBLOCK + select HAVE_REGS_AND_STACK_ACCESS_API + select IRQ_DOMAIN + select LOCKDEP_SUPPORT + select MODULES_USE_ELF_RELA + select OF + select OF_EARLY_FLATTREE + select NO_BOOTMEM + select NO_IOPORT_MAP + select RTC_LIB + select THREAD_INFO_IN_TASK + help + Andes(nds32) Linux support. + +config GENERIC_CALIBRATE_DELAY + def_bool n + +config GENERIC_CSUM + def_bool y + +config GENERIC_HWEIGHT + def_bool y + +config GENERIC_LOCKBREAK + def_bool y + depends on PREEMPT + +config RWSEM_GENERIC_SPINLOCK + def_bool y + +config TRACE_IRQFLAGS_SUPPORT + def_bool y + +config STACKTRACE_SUPPORT + def_bool y + +config FIX_EARLYCON_MEM + def_bool y + +config PGTABLE_LEVELS + default 2 + +source "init/Kconfig" + +menu "System Type" +source "arch/nds32/Kconfig.cpu" +config NR_CPUS + int + default 1 + +config MMU + def_bool y + +config NDS32_BUILTIN_DTB + string "Builtin DTB" + default "" + help + User can use it to specify the dts of the SoC +endmenu + +menu "Kernel Features" +source "kernel/Kconfig.preempt" +source "mm/Kconfig" +source "kernel/Kconfig.hz" +endmenu + +menu "Executable file formats" +source "fs/Kconfig.binfmt" +endmenu + +source "net/Kconfig" +source "drivers/Kconfig" +source "fs/Kconfig" + +menu "Kernel hacking" +source "lib/Kconfig.debug" +endmenu + +source "security/Kconfig" +source "crypto/Kconfig" +source "lib/Kconfig"
arch/nds32/Kconfig.cpu new file +161 -0
161 lines not on this page · raw message
arch/nds32/Makefile new file +66 -0
66 lines not on this page · raw message
arch/nds32/boot/Makefile new file +15 -0
@@ -0,0 +1,15 @@ +targets := Image Image.gz + +$(obj)/Image: vmlinux FORCE + $(call if_changed,objcopy) + +$(obj)/Image.gz: $(obj)/Image FORCE + $(call if_changed,gzip) + +install: $(obj)/Image + $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \ + $(obj)/Image System.map "$(INSTALL_PATH)" + +zinstall: $(obj)/Image.gz + $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \ + $(obj)/Image.gz System.map "$(INSTALL_PATH)"
arch/nds32/include/asm/Kbuild new file +53 -0
53 lines not on this page · raw message
arch/nds32/include/uapi/asm/Kbuild new file +28 -0
@@ -0,0 +1,28 @@ +# UAPI Header export list +include include/uapi/asm-generic/Kbuild.asm + +generic-y += errno.h +generic-y += ioctl.h +generic-y += ioctls.h +generic-y += ipcbuf.h +generic-y += shmbuf.h +generic-y += bitsperlong.h +generic-y += fcntl.h +generic-y += stat.h +generic-y += mman.h +generic-y += msgbuf.h +generic-y += poll.h +generic-y += posix_types.h +generic-y += resource.h +generic-y += sembuf.h +generic-y += setup.h +generic-y += siginfo.h +generic-y += signal.h +generic-y += socket.h +generic-y += sockios.h +generic-y += swab.h +generic-y += statfs.h +generic-y += termbits.h +generic-y += termios.h +generic-y += types.h +generic-y += ucontext.h
arch/nds32/kernel/Makefile new file +23 -0
@@ -0,0 +1,23 @@ +# +# Makefile for the linux kernel. +# + +CPPFLAGS_vmlinux.lds := -DTEXTADDR=$(TEXTADDR) +AFLAGS_head.o := -DTEXTADDR=$(TEXTADDR) + +# Object file lists. + +obj-y := ex-entry.o ex-exit.o ex-scall.o irq.o \ + process.o ptrace.o setup.o signal.o \ + sys_nds32.o time.o traps.o cacheinfo.o \ + dma.o syscall_table.o vdso.o + +obj-$(CONFIG_MODULES) += nds32_ksyms.o module.o +obj-$(CONFIG_STACKTRACE) += stacktrace.o +obj-$(CONFIG_OF) += devtree.o +obj-$(CONFIG_CACHE_L2) += atl2c.o + +extra-y := head.o vmlinux.lds + + +obj-y += vdso/
arch/nds32/kernel/vmlinux.lds.S new file +57 -0
57 lines not on this page · raw message
arch/nds32/mm/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +obj-y := extable.o tlb.o \ + fault.o init.o ioremap.o mmap.o \ + mm-nds32.o cacheflush.o proc.o + +obj-$(CONFIG_ALIGNMENT_TRAP) += alignment.o +obj-$(CONFIG_HIGHMEM) += highmem.o +CFLAGS_proc-n13.o += -fomit-frame-pointer
Signature · 1 line
1.7.9.5
PATCH v4 28/36 MAINTAINERS: Add nds32
In reply to Greentime HuFrom: Greentime Hu <[email protected]>
--- MAINTAINERS | 11 +++++++++++ 1 file changed, 11 insertions(+)
MAINTAINERS +11 -0
@@ -857,6 +857,17 @@ X: drivers/iio/*/adjd* F: drivers/staging/iio/*/ad* F: drivers/staging/iio/trigger/iio-trig-bfin-timer.c +ANDES ARCHITECTURE +M: Greentime Hu <[email protected]> +M: Vincent Chen <[email protected]> +T: git https://github.com/andestech/linux.git +S: Supported +F: arch/nds32 +F: Documentation/devicetree/bindings/interrupt-controller/andestech,ativic32.txt +F: Documentation/devicetree/bindings/nds32 +K: nds32 +N: nds32 + ANDROID CONFIG FRAGMENTS M: Rob Herring <[email protected]> S: Supported
Signature · 1 line
1.7.9.5
PATCH v4 29/36 dt-bindings: nds32 CPU Bindings
In reply to Greentime HuFrom: Greentime Hu <[email protected]>
This patch adds nds32 CPU binding documents.
--- Documentation/devicetree/bindings/nds32/cpus.txt | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Documentation/devicetree/bindings/nds32/cpus.txt
Documentation/devicetree/bindings/nds32/cpus.txt new file +37 -0
@@ -0,0 +1,37 @@ +* Andestech Processor Binding + +This binding specifies what properties must be available in the device tree +representation of a Andestech Processor Core, which is the root node in the +tree. + +Required properties: + + - compatible: + Usage: required + Value type: <string> + Definition: should be one of: + "andestech,n13" + "andestech,n15" + "andestech,d15" + "andestech,n10" + "andestech,d10" + "andestech,nds32v3" + - device_type + Usage: required + Value type: <string> + Definition: must be "cpu" + - reg: Contains CPU index. + - clock-frequency: Contains the clock frequency for CPU, in Hz. + +* Examples + +/ { + cpus { + cpu@0 { + device_type = "cpu"; + compatible = "andestech,n13", "andestech,nds32v3"; + reg = <0x0>; + clock-frequency = <60000000> + }; + }; +};
Signature · 1 line
1.7.9.5
PATCH v4 30/36 dt-bindings: nds32 SoC Bindings
In reply to Greentime HuFrom: Greentime Hu <[email protected]>
This patch adds nds32 SoC(AE3XX and AG101P) binding documents.
--- .../devicetree/bindings/nds32/andestech-boards | 40 ++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Documentation/devicetree/bindings/nds32/andestech-boards
Documentation/devicetree/bindings/nds32/andestech-boards new file +40 -0
@@ -0,0 +1,40 @@ +Andestech(nds32) AE3XX Platform +----------------------------------------------------------------------------- +The AE3XX prototype demonstrates the AE3XX example platform on the FPGA. It +is composed of one Andestech(nds32) processor and AE3XX. + +Required properties (in root node): +- compatible = "andestech,ae3xx"; + +Example: +/dts-v1/; +/ { + compatible = "andestech,ae3xx"; + #address-cells = <1>; + #size-cells = <1>; + interrupt-parent = <&intc>; +}; + +Andestech(nds32) AG101P Platform +----------------------------------------------------------------------------- +AG101P is a generic SoC Platform IP that works with any of Andestech(nds32) +processors to provide a cost-effective and high performance solution for +majority of embedded systems in variety of application domains. Users may +simply attach their IP on one of the system buses together with certain glue +logics to complete a SoC solution for a specific application. With +comprehensive simulation and design environments, users may evaluate the +system performance of their applications and track bugs of their designs +efficiently. The optional hardware development platform further provides real +system environment for early prototyping and software/hardware co-development. + +Required properties (in root node): + compatible = "andestech,ag101p"; + +Example: +/dts-v1/; +/ { + compatible = "andestech,ag101p"; + #address-cells = <1>; + #size-cells = <1>; + interrupt-parent = <&intc>; +};
Signature · 1 line
1.7.9.5
PATCH v4 31/36 dt-bindings: interrupt-controller: Andestech Internal Vector Interrupt Controller
In reply to Greentime HuFrom: Greentime Hu <[email protected]>
This patch adds an irqchip driver document for the Andestech Internal Vector Interrupt Controller.
--- .../interrupt-controller/andestech,ativic32.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Documentation/devicetree/bindings/interrupt-controller/andestech,ativic32.txt
Documentation/devicetree/bindings/interrupt-controller/andestech,ativic32.txt new file +19 -0
@@ -0,0 +1,19 @@ +* Andestech Internal Vector Interrupt Controller + +The Internal Vector Interrupt Controller (IVIC) is a basic interrupt controller +suitable for a simpler SoC platform not requiring a more sophisticated and +bigger External Vector Interrupt Controller. + + +Main node required properties: + +- compatible : should at least contain "andestech,ativic32". +- interrupt-controller : Identifies the node as an interrupt controller +- #interrupt-cells: 1 cells and refer to interrupt-controller/interrupts + +Examples: + intc: interrupt-controller { + compatible = "andestech,ativic32"; + #interrupt-cells = <1>; + interrupt-controller; + };
Signature · 1 line
1.7.9.5
PATCH v4 32/36 irqchip: Andestech Internal Vector Interrupt Controller driver
In reply to Greentime HuFrom: Greentime Hu <[email protected]>
This patch adds the Andestech Internal Vector Interrupt Controller driver. You can find the spec here. Ch4.9 of AndeStar SPA V3 Manual.
http://www.andestech.com/product.php?cls=9
--- drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-ativic32.c | 107 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 drivers/irqchip/irq-ativic32.c
drivers/irqchip/Makefile +1 -0
@@ -80,3 +80,4 @@ obj-$(CONFIG_ARCH_ASPEED) += irq-aspeed-vic.o irq-aspeed-i2c-ic.o obj-$(CONFIG_STM32_EXTI) += irq-stm32-exti.o obj-$(CONFIG_QCOM_IRQ_COMBINER) += qcom-irq-combiner.o obj-$(CONFIG_IRQ_UNIPHIER_AIDET) += irq-uniphier-aidet.o +obj-$(CONFIG_NDS32) += irq-ativic32.o
drivers/irqchip/irq-ativic32.c new file +107 -0
107 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v4 33/36 net: faraday add nds32 support.
In reply to Greentime HuFrom: Greentime Hu <[email protected]>
This patch is used to support nds32 architecture to use these faraday mac IP.
--- drivers/net/ethernet/faraday/Kconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/faraday/Kconfig +3 -3
@@ -5,7 +5,7 @@ config NET_VENDOR_FARADAY bool "Faraday devices" default y - depends on ARM + depends on ARM || NDS32 || COMPILE_TEST ---help--- If you have a network (Ethernet) card belonging to this class, say Y.
@@ -18,7 +18,7 @@ if NET_VENDOR_FARADAY config FTMAC100 tristate "Faraday FTMAC100 10/100 Ethernet support" - depends on ARM + depends on ARM || NDS32 || COMPILE_TEST select MII ---help--- This driver supports the FTMAC100 10/100 Ethernet controller
@@ -27,7 +27,7 @@ config FTMAC100 config FTGMAC100 tristate "Faraday FTGMAC100 Gigabit Ethernet support" - depends on ARM + depends on ARM || NDS32 || COMPILE_TEST select PHYLIB ---help--- This driver supports the FTGMAC100 Gigabit Ethernet controller
Signature · 1 line
1.7.9.5
kbuild test robot
build botRe: [PATCH v4 33/36] net: faraday add nds32 support.
I love your patch! Perhaps something to improve:
Hi Greentime,
I love your patch! Perhaps something to improve:
[auto build test WARNING on tip/timers/core]
[cannot apply to linus/master v4.15-rc4 next-20171220]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Greentime-Hu/Andes-nds32-Linux-Kernel/20171220-155937
config: sparc64-allyesconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sparc64
All warnings (new ones prefixed by >>):
drivers/net/ethernet/faraday/ftmac100.c: In function 'ftmac100_rxdes_set_page':
>> drivers/net/ethernet/faraday/ftmac100.c:288:18: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
rxdes->rxdes3 = (unsigned int)page;
^
drivers/net/ethernet/faraday/ftmac100.c: In function 'ftmac100_rxdes_get_page':
>> drivers/net/ethernet/faraday/ftmac100.c:293:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
return (struct page *)rxdes->rxdes3;
^
drivers/net/ethernet/faraday/ftmac100.c: In function 'ftmac100_txdes_set_skb':
drivers/net/ethernet/faraday/ftmac100.c:548:18: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
txdes->txdes3 = (unsigned int)skb;
^
drivers/net/ethernet/faraday/ftmac100.c: In function 'ftmac100_txdes_get_skb':
drivers/net/ethernet/faraday/ftmac100.c:553:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
return (struct sk_buff *)txdes->txdes3;
^vim +288 drivers/net/ethernet/faraday/ftmac100.c
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 281
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 282 /*
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 283 * rxdes3 is not used by hardware. We use it to keep track of page.
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 284 * Since hardware does not touch it, we can skip cpu_to_le32()/le32_to_cpu().
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 285 */
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 286 static void ftmac100_rxdes_set_page(struct ftmac100_rxdes *rxdes, struct page *page)
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 287 {
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 @288 rxdes->rxdes3 = (unsigned int)page;
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 289 }
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 290
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 291 static struct page *ftmac100_rxdes_get_page(struct ftmac100_rxdes *rxdes)
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 292 {8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 @293 return (struct page *)rxdes->rxdes3;8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 294 } 8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 295
:::::: The code at line 288 was first introduced by commit
:::::: 8d77c036b57cf813d838f859e11b6a188acdb1fb net: add Faraday FTMAC100 10/100 Ethernet driver
:::::: TO: Po-Yu Chuang <[email protected]> :::::: CC: David S. Miller <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Re: [PATCH v4 33/36] net: faraday add nds32 support.
Quoted 15 lines · kbuild test robot
I love your patch! Perhaps something to improve:
[auto build test WARNING on tip/timers/core]
[cannot apply to linus/master v4.15-rc4 next-20171220]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]url: https://github.com/0day-ci/linux/commits/Greentime-Hu/Andes-nds32-Linux-Kernel/20171220-155937
config: sparc64-allyesconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sparc64
Quoted 6 lines
All warnings (new ones prefixed by >>):
drivers/net/ethernet/faraday/ftmac100.c: In function 'ftmac100_rxdes_set_page':Quoted 1 line
Quoted 1 line
drivers/net/ethernet/faraday/ftmac100.c:288:18: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]rxdes->rxdes3 = (unsigned int)page; ^
The proper way to casts pointer to integers is to cast to "uintptr_t".
However, the address is stored in a 32-bit descriptor, which means it can not work on 64-bit platforms.
Please make the driver depend on "!64BIT || BROKEN"
Cfr. commit 15bfe05c8d6386f1 ("net: ethernet: xilinx: Mark XILINX_LL_TEMAC broken on 64-bit")
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 33/36] net: faraday add nds32 support.
2017-12-20 17:58 GMT+08:00 Geert Uytterhoeven <[email protected]>:
Quoted 25 lines · kbuild test robot
Quoted 15 lines
I love your patch! Perhaps something to improve:
[auto build test WARNING on tip/timers/core]
[cannot apply to linus/master v4.15-rc4 next-20171220]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]url: https://github.com/0day-ci/linux/commits/Greentime-Hu/Andes-nds32-Linux-Kernel/20171220-155937
config: sparc64-allyesconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sparc64Quoted 6 lines
All warnings (new ones prefixed by >>):
drivers/net/ethernet/faraday/ftmac100.c: In function 'ftmac100_rxdes_set_page':Quoted 1 line
Quoted 1 line
drivers/net/ethernet/faraday/ftmac100.c:288:18: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]rxdes->rxdes3 = (unsigned int)page; ^The proper way to casts pointer to integers is to cast to "
uintptr_t".
Quoted 8 lines
However, the address is stored in a 32-bit descriptor, which means it can not work on 64-bit platforms.
Please make the driver depend on "!64BIT || BROKEN"
Cfr. commit
15bfe05c8d6386f1("net: ethernet: xilinx: MarkXILINX_LL_TEMACbroken on 64-bit")
Thanks Geert.
I will apply it like this.
+++ b/drivers/net/ethernet/faraday/Kconfig
@@ -5,7 +5,7 @@
config NET_VENDOR_FARADAY
bool "Faraday devices"
default y
- depends on ARM
+ depends on ARM || NDS32 || COMPILE_TEST
---help---
If you have a network (Ethernet) card belonging to this class, say Y.
@@ -18,7 +18,8 @@ if NET_VENDOR_FARADAY
config FTMAC100
tristate "Faraday FTMAC100 10/100 Ethernet support"
- depends on ARM + depends on ARM || NDS32 || COMPILE_TEST + depends on !64BIT || BROKEN
select MII
---help---
This driver supports the FTMAC100 10/100 Ethernet controller
@@ -27,7 +28,8 @@ config FTMAC100
config FTGMAC100
tristate "Faraday FTGMAC100 Gigabit Ethernet support"
- depends on ARM + depends on ARM || NDS32 || COMPILE_TEST + depends on !64BIT || BROKEN
select PHYLIB
---help---
This driver supports the FTGMAC100 Gigabit Ethernet controller
kbuild test robot
build botRe: [PATCH v4 33/36] net: faraday add nds32 support.
In reply to Greentime HuI love your patch! Perhaps something to improve:
Hi Greentime,
I love your patch! Perhaps something to improve:
[auto build test WARNING on tip/timers/core]
[cannot apply to linus/master v4.15-rc4 next-20171220]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Greentime-Hu/Andes-nds32-Linux-Kernel/20171220-155937
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__sparse warnings: (new ones prefixed by >>)
vim +205 drivers/net/ethernet/faraday/ftmac100.c
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 199
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 200 /******************************************************************************
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 201 * internal functions (receive descriptor)
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 202 *****************************************************************************/
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 203 static bool ftmac100_rxdes_first_segment(struct ftmac100_rxdes *rxdes)
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 204 {
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 @205 return rxdes->rxdes0 & cpu_to_le32(FTMAC100_RXDES0_FRS);
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 206 }
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 207
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 208 static bool ftmac100_rxdes_last_segment(struct ftmac100_rxdes *rxdes)
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 209 {
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 210 return rxdes->rxdes0 & cpu_to_le32(FTMAC100_RXDES0_LRS);
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 211 }
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 212
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 213 static bool ftmac100_rxdes_owned_by_dma(struct ftmac100_rxdes *rxdes)
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 214 {
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 @215 return rxdes->rxdes0 & cpu_to_le32(FTMAC100_RXDES0_RXDMA_OWN);
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 216 }
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 217
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 218 static void ftmac100_rxdes_set_dma_own(struct ftmac100_rxdes *rxdes)
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 219 {
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 220 /* clear status bits */
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 @221 rxdes->rxdes0 = cpu_to_le32(FTMAC100_RXDES0_RXDMA_OWN);
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 222 }
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 223
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 224 static bool ftmac100_rxdes_rx_error(struct ftmac100_rxdes *rxdes)
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 225 {
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 226 return rxdes->rxdes0 & cpu_to_le32(FTMAC100_RXDES0_RX_ERR);
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 227 }
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 228
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 229 static bool ftmac100_rxdes_crc_error(struct ftmac100_rxdes *rxdes)
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 230 {
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 231 return rxdes->rxdes0 & cpu_to_le32(FTMAC100_RXDES0_CRC_ERR);
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 232 }
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 233
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 234 static bool ftmac100_rxdes_frame_too_long(struct ftmac100_rxdes *rxdes)
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 235 {
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 236 return rxdes->rxdes0 & cpu_to_le32(FTMAC100_RXDES0_FTL);
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 237 }
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 238
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 239 static bool ftmac100_rxdes_runt(struct ftmac100_rxdes *rxdes)
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 240 {
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 241 return rxdes->rxdes0 & cpu_to_le32(FTMAC100_RXDES0_RUNT);
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 242 }
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 243
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 244 static bool ftmac100_rxdes_odd_nibble(struct ftmac100_rxdes *rxdes)
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 245 {
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 246 return rxdes->rxdes0 & cpu_to_le32(FTMAC100_RXDES0_RX_ODD_NB);
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 247 }
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 248
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 249 static unsigned int ftmac100_rxdes_frame_length(struct ftmac100_rxdes *rxdes)
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 250 {
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 @251 return le32_to_cpu(rxdes->rxdes0) & FTMAC100_RXDES0_RFL;
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 252 }
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 253
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 254 static bool ftmac100_rxdes_multicast(struct ftmac100_rxdes *rxdes)
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 255 {
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 256 return rxdes->rxdes0 & cpu_to_le32(FTMAC100_RXDES0_MULTICAST);
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 257 }
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 258
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 259 static void ftmac100_rxdes_set_buffer_size(struct ftmac100_rxdes *rxdes,
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 260 unsigned int size)
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 261 {
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 @262 rxdes->rxdes1 &= cpu_to_le32(FTMAC100_RXDES1_EDORR);
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 263 rxdes->rxdes1 |= cpu_to_le32(FTMAC100_RXDES1_RXBUF_SIZE(size));
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 264 }
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 265
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 266 static void ftmac100_rxdes_set_end_of_ring(struct ftmac100_rxdes *rxdes)
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 267 {
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 268 rxdes->rxdes1 |= cpu_to_le32(FTMAC100_RXDES1_EDORR);
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 269 }
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 270
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 271 static void ftmac100_rxdes_set_dma_addr(struct ftmac100_rxdes *rxdes,
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 272 dma_addr_t addr)
8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 273 {8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 @274 rxdes->rxdes2 = cpu_to_le32(addr);8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 275 } 8d77c036 drivers/net/ftmac100.c Po-Yu Chuang 2011-02-28 276
:::::: The code at line 205 was first introduced by commit
:::::: 8d77c036b57cf813d838f859e11b6a188acdb1fb net: add Faraday FTMAC100 10/100 Ethernet driver
:::::: TO: Po-Yu Chuang <[email protected]> :::::: CC: David S. Miller <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
PATCH v4 34/36 clocksource/drivers/atcpit100: Add andestech atcpit100 timer
In reply to Greentime HuFrom: Rick Chen <[email protected]>
ATCPIT100 is often used on the Andes architecture, This timer provide 4 PIT channels. Each PIT channel is a multi-function timer, can be configured as 32,16,8 bit timers or PWM as well.
For system timer it will set channel 1 32-bit timer0 as clock source and count downwards until underflow and restart again.
It also set channel 0 32-bit timer0 as clock event and count downwards until condition match. It will generate an interrupt for handling periodically.
--- drivers/clocksource/Kconfig | 7 + drivers/clocksource/Makefile | 1 + drivers/clocksource/timer-atcpit100.c | 255 +++++++++++++++++++++++++++++++++ 3 files changed, 263 insertions(+) create mode 100644 drivers/clocksource/timer-atcpit100.c
drivers/clocksource/Kconfig +7 -0
@@ -615,4 +615,11 @@ config CLKSRC_ST_LPC Enable this option to use the Low Power controller timer as clocksource. +config TIMER_ATCPIT100 + bool "Clocksource for AE3XX platform" + depends on NDS32 || COMPILE_TEST + depends on HAS_IOMEM + help + This option enables support for the Andestech AE3XX platform timers. + endmenu
drivers/clocksource/Makefile +1 -0
@@ -75,3 +75,4 @@ obj-$(CONFIG_H8300_TMR16) += h8300_timer16.o obj-$(CONFIG_H8300_TPU) += h8300_tpu.o obj-$(CONFIG_CLKSRC_ST_LPC) += clksrc_st_lpc.o obj-$(CONFIG_X86_NUMACHIP) += numachip.o +obj-$(CONFIG_TIMER_ATCPIT100) += timer-atcpit100.o
drivers/clocksource/timer-atcpit100.c new file +255 -0
255 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v4 35/36 clocksource/drivers/atcpit100: VDSO support
In reply to Greentime HuFrom: Rick Chen <[email protected]>
VDSO needs real-time cycle count to ensure the time accuracy. Unlike others, nds32 architecture does not define clock source, hence VDSO needs atcpit100 offering real-time cycle count to derive the correct time.
--- drivers/clocksource/timer-atcpit100.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/clocksource/timer-atcpit100.c +18 -0
@@ -29,6 +29,9 @@#include <linux/of_irq.h> #include <linux/of_platform.h> #include "timer-of.h" +#ifdef CONFIG_NDS32 +#include <asm/vdso_timer_info.h> +#endif /* * Definition of register offsets
@@ -211,6 +214,17 @@ static u64 notrace atcpit100_timer_sched_read(void)return ~readl (timer_of_base (&to) +CH1_CNT ); } +#ifdef CONFIG_NDS32 +static void fill_vdso_need_info (struct device_node *node) +{ +struct resource timer_res; +of_address_to_resource (node,0 , &timer_res); + timer_info.mapping_base = (unsigned long )timer_res.start; + timer_info.cycle_count_down = true; + timer_info.cycle_count_reg_offset =CH1_CNT ; +} +#endif +static int __init atcpit100_timer_init (struct device_node *node) {int ret;
@@ -249,6 +263,10 @@ static int __init atcpit100_timer_init(struct device_node *node) val =readl (base +INT_EN );writel (val |CH0INT0EN , base +INT_EN ); +#ifdef CONFIG_NDS32 +fill_vdso_need_info (node); +#endif +return ret; }
Signature · 1 line
1.7.9.5
PATCH v4 36/36 dt-bindings: timer: Add andestech atcpit100 timer binding doc
In reply to Greentime HuFrom: Rick Chen <[email protected]>
Add a document to describe Andestech atcpit100 timer and binding information.
--- .../bindings/timer/andestech,atcpit100-timer.txt | 33 ++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Documentation/devicetree/bindings/timer/andestech,atcpit100-timer.txt
Documentation/devicetree/bindings/timer/andestech,atcpit100-timer.txt new file +33 -0
@@ -0,0 +1,33 @@ +Andestech ATCPIT100 timer +------------------------------------------------------------------ +ATCPIT100 is a generic IP block from Andes Technology, embedded in +Andestech AE3XX platforms and other designs. + +This timer is a set of compact multi-function timers, which can be +used as pulse width modulators (PWM) as well as simple timers. + +It supports up to 4 PIT channels. Each PIT channel is a +multi-function timer and provide the following usage scenarios: +One 32-bit timer +Two 16-bit timers +Four 8-bit timers +One 16-bit PWM +One 16-bit timer and one 8-bit PWM +Two 8-bit timer and one 8-bit PWM + +Required properties: +- compatible : Should be "andestech,atcpit100" +- reg : Address and length of the register set +- interrupts : Reference to the timer interrupt +- clocks : a clock to provide the tick rate for "andestech,atcpit100" +- clock-names : should be "PCLK" for the peripheral clock source. + +Examples: + +timer0: timer@f0400000 { + compatible = "andestech,atcpit100"; + reg = <0xf0400000 0x1000>; + interrupts = <2>; + clocks = <&apb>; + clock-names = "PCLK"; +};
Signature · 1 line
1.7.9.5
Arnd Bergmann
maintainerQuoted 24 lines · Greentime Hu
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-v4The build script and toolchain repositories are able to be found here:
https://github.com/andestech/build_script.git
Quoted 7 lines
Freely available instruction set and architecture overview documents can be found on the following page:
http://www.andestech.com/product.php?cls=9Vincent 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