Upstream kvx Linux port
Subsystems (21)
cover Upstream kvx Linux port
This patch series adds support for the kv3-1 CPU architecture of the kvx family found in the Coolidge (aka MPPA3-80) SoC of Kalray.
This is an RFC, since kvx support is not yet upstreamed into gcc/binutils, therefore this patch series cannot be merged into Linux for now.
The goal is to have preliminary reviews and to fix problems early.
The Kalray VLIW processor family (kvx) has the following features:
* 32/64 bits execution mode
* 6-issue VLIW architecture
* 64 x 64bits general purpose registers
* SIMD instructions
* little-endian
* deep learning co-processor
Kalray kv3-1 core which is the third of the kvx family is embedded in Kalray Coolidge SoC currently used on K200 and K200-LP boards.
The Coolidge SoC contains 5 clusters each of which is made of:
* 4MiB of on-chip memory (SMEM)
* 1 dedicated safety/security core (kv3-1 core).
* 16 PEs (Processing Elements) (kv3-1 cores).
* 16 Co-processors (one per PE)
* 2 Crypto accelerators
The Coolidge SoC contains the following features:
* 5 Clusters
* 2 100G Ethernet controllers
* 8 PCIe GEN4 controllers (Root Complex and Endpoint capable)
* 2 USB 2.0 controllers
* 1 Octal SPI-NOR flash controller
* 1 eMMC controller
* 3 Quad SPI controllers
* 6 UART
* 5 I2C controllers (3 of which are SMBus capable)
* 4 CAN controllers
* 1 OTP memory
A kvx toolchain can be built using:
# install dependencies: texinfo bison flex libgmp-dev libmpc-dev libmpfr-dev $ git clone https://github.com/kalray/build-scripts $ cd build-scripts $ source last.refs $ ./build-kvx-xgcc.sh output
The kvx toolchain will be installed in the "output" directory.
A buildroot image (kernel+rootfs) and toolchain can be built using:
$ git clone -b coolidge-for-upstream https://github.com/kalray/buildroot $ cd buildroot $ make O=build_kvx kvx_defconfig $ make O=build_kvx
The vmlinux image can be found in buildroot/build_kvx/images/vmlinux.
If you are just interested in building the Linux kernel with no rootfs you can just do this with the kvx-elf- toolchain:
$ make ARCH=kvx O=build_kvx CROSS_COMPILE=kvx-elf- default_defconfig $ make ARCH=kvx O=build_kvx CROSS_COMPILE=kvx-elf- -j$(($(nproc) + 1))
The vmlinux ELF can be run with qemu by doing:
# install dependencies: ninja pkg-config libglib-2.0-dev cmake libfdt-dev libpixman-1-dev zlib1g-dev $ git clone https://github.com/kalray/qemu-builder $ cd qemu-builder $ git submodule update --init $ make -j$(($(nproc) + 1)) $ ./qemu-system-kvx -m 1024 -nographic -kernel <path/to/vmlinux>
Yann Sionneau (25):
Documentation: kvx: Add basic documentation
kvx: Add ELF-related definitions
kvx: Add build infrastructure
kvx: Add CPU definition headers
kvx: Add atomic/locking headers
kvx: Add other common headers
kvx: Add boot and setup routines
kvx: Add exception/interrupt handling
kvx: irqchip: Add support for irq controllers
kvx: Add process management
kvx: Add memory management
kvx: Add system call support
kvx: Add signal handling support
kvx: Add ELF relocations and module support
kvx: Add misc common routines
kvx: Add some library functions
kvx: Add multi-processor (SMP) support
kvx: Add kvx default config file
kvx: power: scall poweroff driver
kvx: gdb: add kvx related gdb helpers
kvx: Add support for ftrace
kvx: Add support for jump labels
kvx: Add debugging related support
kvx: Add support for CPU Perf Monitors
kvx: Add support for cpuinfo
.../kalray,kvx-core-intc.txt | 22 + .../devicetree/bindings/perf/kalray-pm.txt | 21 + Documentation/kvx/kvx-exceptions.txt | 246 + Documentation/kvx/kvx-iommu.txt | 183 + Documentation/kvx/kvx-mmu.txt | 272 + Documentation/kvx/kvx-smp.txt | 36 + Documentation/kvx/kvx.txt | 268 + arch/kvx/Kconfig | 249 + arch/kvx/Kconfig.debug | 70 + arch/kvx/Makefile | 52 + arch/kvx/configs/default_defconfig | 130 + arch/kvx/include/asm/Kbuild | 20 + arch/kvx/include/asm/asm-prototypes.h | 14 + arch/kvx/include/asm/atomic.h | 104 + arch/kvx/include/asm/barrier.h | 15 + arch/kvx/include/asm/bitops.h | 207 + arch/kvx/include/asm/bitrev.h | 32 + arch/kvx/include/asm/break_hook.h | 69 + arch/kvx/include/asm/bug.h | 67 + arch/kvx/include/asm/cache.h | 46 + arch/kvx/include/asm/cacheflush.h | 181 + arch/kvx/include/asm/clocksource.h | 17 + arch/kvx/include/asm/cmpxchg.h | 185 + arch/kvx/include/asm/current.h | 22 + arch/kvx/include/asm/dame.h | 31 + arch/kvx/include/asm/debug.h | 35 + arch/kvx/include/asm/elf.h | 155 + arch/kvx/include/asm/fixmap.h | 47 + arch/kvx/include/asm/ftrace.h | 41 + arch/kvx/include/asm/futex.h | 141 + arch/kvx/include/asm/hardirq.h | 14 + arch/kvx/include/asm/hugetlb.h | 36 + arch/kvx/include/asm/hw_breakpoint.h | 72 + arch/kvx/include/asm/hw_irq.h | 14 + arch/kvx/include/asm/insns.h | 16 + arch/kvx/include/asm/insns_defs.h | 197 + arch/kvx/include/asm/io.h | 34 + arch/kvx/include/asm/ipi.h | 16 + arch/kvx/include/asm/irqflags.h | 58 + arch/kvx/include/asm/jump_label.h | 59 + arch/kvx/include/asm/l2_cache.h | 75 + arch/kvx/include/asm/l2_cache_defs.h | 64 + arch/kvx/include/asm/linkage.h | 13 + arch/kvx/include/asm/mem_map.h | 44 + arch/kvx/include/asm/mmu.h | 296 + arch/kvx/include/asm/mmu_context.h | 156 + arch/kvx/include/asm/mmu_stats.h | 38 + arch/kvx/include/asm/page.h | 187 + arch/kvx/include/asm/page_size.h | 29 + arch/kvx/include/asm/pci.h | 36 + arch/kvx/include/asm/perf_event.h | 90 + arch/kvx/include/asm/pgalloc.h | 101 + arch/kvx/include/asm/pgtable-bits.h | 102 + arch/kvx/include/asm/pgtable.h | 451 ++ arch/kvx/include/asm/privilege.h | 211 + arch/kvx/include/asm/processor.h | 176 + arch/kvx/include/asm/ptrace.h | 217 + arch/kvx/include/asm/pwr_ctrl.h | 45 + arch/kvx/include/asm/rm_fw.h | 16 + arch/kvx/include/asm/sections.h | 18 + arch/kvx/include/asm/setup.h | 29 + arch/kvx/include/asm/sfr.h | 107 + arch/kvx/include/asm/sfr_defs.h | 5028 +++++++++++++++++ arch/kvx/include/asm/smp.h | 42 + arch/kvx/include/asm/sparsemem.h | 15 + arch/kvx/include/asm/spinlock.h | 16 + arch/kvx/include/asm/spinlock_types.h | 17 + arch/kvx/include/asm/stackprotector.h | 47 + arch/kvx/include/asm/stacktrace.h | 44 + arch/kvx/include/asm/string.h | 20 + arch/kvx/include/asm/swab.h | 48 + arch/kvx/include/asm/switch_to.h | 21 + arch/kvx/include/asm/symbols.h | 16 + arch/kvx/include/asm/sys_arch.h | 51 + arch/kvx/include/asm/syscall.h | 73 + arch/kvx/include/asm/syscalls.h | 21 + arch/kvx/include/asm/thread_info.h | 78 + arch/kvx/include/asm/timex.h | 20 + arch/kvx/include/asm/tlb.h | 24 + arch/kvx/include/asm/tlb_defs.h | 131 + arch/kvx/include/asm/tlbflush.h | 58 + arch/kvx/include/asm/traps.h | 76 + arch/kvx/include/asm/types.h | 12 + arch/kvx/include/asm/uaccess.h | 324 ++ arch/kvx/include/asm/unistd.h | 11 + arch/kvx/include/asm/vermagic.h | 12 + arch/kvx/include/asm/vmalloc.h | 10 + arch/kvx/include/uapi/asm/Kbuild | 1 + arch/kvx/include/uapi/asm/bitsperlong.h | 14 + arch/kvx/include/uapi/asm/byteorder.h | 12 + arch/kvx/include/uapi/asm/cachectl.h | 25 + arch/kvx/include/uapi/asm/ptrace.h | 114 + arch/kvx/include/uapi/asm/sigcontext.h | 16 + arch/kvx/include/uapi/asm/unistd.h | 16 + arch/kvx/kernel/Makefile | 27 + arch/kvx/kernel/asm-offsets.c | 157 + arch/kvx/kernel/break_hook.c | 77 + arch/kvx/kernel/common.c | 11 + arch/kvx/kernel/cpuinfo.c | 96 + arch/kvx/kernel/dame_handler.c | 113 + arch/kvx/kernel/debug.c | 64 + arch/kvx/kernel/entry.S | 1759 ++++++ arch/kvx/kernel/ftrace.c | 339 ++ arch/kvx/kernel/head.S | 612 ++ arch/kvx/kernel/hw_breakpoint.c | 556 ++ arch/kvx/kernel/insns.c | 146 + arch/kvx/kernel/io.c | 96 + arch/kvx/kernel/irq.c | 78 + arch/kvx/kernel/jump_label.c | 34 + arch/kvx/kernel/kvx_ksyms.c | 29 + arch/kvx/kernel/l2_cache.c | 448 ++ arch/kvx/kernel/mcount.S | 340 ++ arch/kvx/kernel/module.c | 148 + arch/kvx/kernel/perf_event.c | 609 ++ arch/kvx/kernel/process.c | 212 + arch/kvx/kernel/prom.c | 24 + arch/kvx/kernel/ptrace.c | 461 ++ arch/kvx/kernel/reset.c | 37 + arch/kvx/kernel/return_address.c | 55 + arch/kvx/kernel/setup.c | 178 + arch/kvx/kernel/signal.c | 266 + arch/kvx/kernel/smp.c | 110 + arch/kvx/kernel/smpboot.c | 127 + arch/kvx/kernel/stacktrace.c | 173 + arch/kvx/kernel/sys_kvx.c | 58 + arch/kvx/kernel/syscall_table.c | 19 + arch/kvx/kernel/time.c | 242 + arch/kvx/kernel/traps.c | 243 + arch/kvx/kernel/vdso.c | 87 + arch/kvx/kernel/vmlinux.lds.S | 173 + arch/kvx/lib/Makefile | 6 + arch/kvx/lib/clear_page.S | 40 + arch/kvx/lib/copy_page.S | 90 + arch/kvx/lib/delay.c | 39 + arch/kvx/lib/memcpy.c | 70 + arch/kvx/lib/memset.S | 351 ++ arch/kvx/lib/strlen.S | 122 + arch/kvx/lib/usercopy.S | 90 + arch/kvx/mm/Makefile | 10 + arch/kvx/mm/cacheflush.c | 154 + arch/kvx/mm/dma-mapping.c | 95 + arch/kvx/mm/extable.c | 24 + arch/kvx/mm/fault.c | 264 + arch/kvx/mm/hugetlbpage.c | 317 ++ arch/kvx/mm/init.c | 527 ++ arch/kvx/mm/kernel_rwx.c | 228 + arch/kvx/mm/mmap.c | 31 + arch/kvx/mm/mmu.c | 204 + arch/kvx/mm/mmu_stats.c | 94 + arch/kvx/mm/tlb.c | 433 ++ arch/kvx/platform/Makefile | 7 + arch/kvx/platform/ipi.c | 110 + arch/kvx/platform/pwr_ctrl.c | 93 + drivers/irqchip/Kconfig | 27 + drivers/irqchip/Makefile | 4 + drivers/irqchip/irq-kvx-apic-gic.c | 349 ++ drivers/irqchip/irq-kvx-apic-mailbox.c | 465 ++ drivers/irqchip/irq-kvx-core-intc.c | 82 + drivers/irqchip/irq-kvx-itgen.c | 224 + drivers/power/reset/kvx-scall-poweroff.c | 53 + include/linux/cpuhotplug.h | 2 + include/linux/irqchip/irq-kvx-apic-gic.h | 21 + include/linux/irqchip/irq-kvx-apic-mailbox.h | 29 + include/linux/irqchip/irq-kvx-itgen.h | 24 + include/uapi/linux/audit.h | 1 + include/uapi/linux/elf-em.h | 1 + include/uapi/linux/elf.h | 1 + scripts/gdb/arch/Makefile | 11 + scripts/gdb/arch/__init__.py | 1 + scripts/gdb/arch/kvx/Makefile | 25 + scripts/gdb/arch/kvx/__init__.py | 1 + scripts/gdb/arch/kvx/constants.py.in | 74 + scripts/gdb/arch/kvx/mmu.py | 199 + scripts/gdb/arch/kvx/page_table_walk.py | 207 + tools/include/uapi/asm/bitsperlong.h | 2 + 175 files changed, 25814 insertions(+) create mode 100644 Documentation/devicetree/bindings/interrupt-controller/kalray,kvx-core-intc.txt create mode 100644 Documentation/devicetree/bindings/perf/kalray-pm.txt create mode 100644 Documentation/kvx/kvx-exceptions.txt create mode 100644 Documentation/kvx/kvx-iommu.txt create mode 100644 Documentation/kvx/kvx-mmu.txt create mode 100644 Documentation/kvx/kvx-smp.txt create mode 100644 Documentation/kvx/kvx.txt create mode 100644 arch/kvx/Kconfig create mode 100644 arch/kvx/Kconfig.debug create mode 100644 arch/kvx/Makefile create mode 100644 arch/kvx/configs/default_defconfig create mode 100644 arch/kvx/include/asm/Kbuild create mode 100644 arch/kvx/include/asm/asm-prototypes.h create mode 100644 arch/kvx/include/asm/atomic.h create mode 100644 arch/kvx/include/asm/barrier.h create mode 100644 arch/kvx/include/asm/bitops.h create mode 100644 arch/kvx/include/asm/bitrev.h create mode 100644 arch/kvx/include/asm/break_hook.h create mode 100644 arch/kvx/include/asm/bug.h create mode 100644 arch/kvx/include/asm/cache.h create mode 100644 arch/kvx/include/asm/cacheflush.h create mode 100644 arch/kvx/include/asm/clocksource.h create mode 100644 arch/kvx/include/asm/cmpxchg.h create mode 100644 arch/kvx/include/asm/current.h create mode 100644 arch/kvx/include/asm/dame.h create mode 100644 arch/kvx/include/asm/debug.h create mode 100644 arch/kvx/include/asm/elf.h create mode 100644 arch/kvx/include/asm/fixmap.h create mode 100644 arch/kvx/include/asm/ftrace.h create mode 100644 arch/kvx/include/asm/futex.h create mode 100644 arch/kvx/include/asm/hardirq.h create mode 100644 arch/kvx/include/asm/hugetlb.h create mode 100644 arch/kvx/include/asm/hw_breakpoint.h create mode 100644 arch/kvx/include/asm/hw_irq.h create mode 100644 arch/kvx/include/asm/insns.h create mode 100644 arch/kvx/include/asm/insns_defs.h create mode 100644 arch/kvx/include/asm/io.h create mode 100644 arch/kvx/include/asm/ipi.h create mode 100644 arch/kvx/include/asm/irqflags.h create mode 100644 arch/kvx/include/asm/jump_label.h create mode 100644 arch/kvx/include/asm/l2_cache.h create mode 100644 arch/kvx/include/asm/l2_cache_defs.h create mode 100644 arch/kvx/include/asm/linkage.h create mode 100644 arch/kvx/include/asm/mem_map.h create mode 100644 arch/kvx/include/asm/mmu.h create mode 100644 arch/kvx/include/asm/mmu_context.h create mode 100644 arch/kvx/include/asm/mmu_stats.h create mode 100644 arch/kvx/include/asm/page.h create mode 100644 arch/kvx/include/asm/page_size.h create mode 100644 arch/kvx/include/asm/pci.h create mode 100644 arch/kvx/include/asm/perf_event.h create mode 100644 arch/kvx/include/asm/pgalloc.h create mode 100644 arch/kvx/include/asm/pgtable-bits.h create mode 100644 arch/kvx/include/asm/pgtable.h create mode 100644 arch/kvx/include/asm/privilege.h create mode 100644 arch/kvx/include/asm/processor.h create mode 100644 arch/kvx/include/asm/ptrace.h create mode 100644 arch/kvx/include/asm/pwr_ctrl.h create mode 100644 arch/kvx/include/asm/rm_fw.h create mode 100644 arch/kvx/include/asm/sections.h create mode 100644 arch/kvx/include/asm/setup.h create mode 100644 arch/kvx/include/asm/sfr.h create mode 100644 arch/kvx/include/asm/sfr_defs.h create mode 100644 arch/kvx/include/asm/smp.h create mode 100644 arch/kvx/include/asm/sparsemem.h create mode 100644 arch/kvx/include/asm/spinlock.h create mode 100644 arch/kvx/include/asm/spinlock_types.h create mode 100644 arch/kvx/include/asm/stackprotector.h create mode 100644 arch/kvx/include/asm/stacktrace.h create mode 100644 arch/kvx/include/asm/string.h create mode 100644 arch/kvx/include/asm/swab.h create mode 100644 arch/kvx/include/asm/switch_to.h create mode 100644 arch/kvx/include/asm/symbols.h create mode 100644 arch/kvx/include/asm/sys_arch.h create mode 100644 arch/kvx/include/asm/syscall.h create mode 100644 arch/kvx/include/asm/syscalls.h create mode 100644 arch/kvx/include/asm/thread_info.h create mode 100644 arch/kvx/include/asm/timex.h create mode 100644 arch/kvx/include/asm/tlb.h create mode 100644 arch/kvx/include/asm/tlb_defs.h create mode 100644 arch/kvx/include/asm/tlbflush.h create mode 100644 arch/kvx/include/asm/traps.h create mode 100644 arch/kvx/include/asm/types.h create mode 100644 arch/kvx/include/asm/uaccess.h create mode 100644 arch/kvx/include/asm/unistd.h create mode 100644 arch/kvx/include/asm/vermagic.h create mode 100644 arch/kvx/include/asm/vmalloc.h create mode 100644 arch/kvx/include/uapi/asm/Kbuild create mode 100644 arch/kvx/include/uapi/asm/bitsperlong.h create mode 100644 arch/kvx/include/uapi/asm/byteorder.h create mode 100644 arch/kvx/include/uapi/asm/cachectl.h create mode 100644 arch/kvx/include/uapi/asm/ptrace.h create mode 100644 arch/kvx/include/uapi/asm/sigcontext.h create mode 100644 arch/kvx/include/uapi/asm/unistd.h create mode 100644 arch/kvx/kernel/Makefile create mode 100644 arch/kvx/kernel/asm-offsets.c create mode 100644 arch/kvx/kernel/break_hook.c create mode 100644 arch/kvx/kernel/common.c create mode 100644 arch/kvx/kernel/cpuinfo.c create mode 100644 arch/kvx/kernel/dame_handler.c create mode 100644 arch/kvx/kernel/debug.c create mode 100644 arch/kvx/kernel/entry.S create mode 100644 arch/kvx/kernel/ftrace.c create mode 100644 arch/kvx/kernel/head.S create mode 100644 arch/kvx/kernel/hw_breakpoint.c create mode 100644 arch/kvx/kernel/insns.c create mode 100644 arch/kvx/kernel/io.c create mode 100644 arch/kvx/kernel/irq.c create mode 100644 arch/kvx/kernel/jump_label.c create mode 100644 arch/kvx/kernel/kvx_ksyms.c create mode 100644 arch/kvx/kernel/l2_cache.c create mode 100644 arch/kvx/kernel/mcount.S create mode 100644 arch/kvx/kernel/module.c create mode 100644 arch/kvx/kernel/perf_event.c create mode 100644 arch/kvx/kernel/process.c create mode 100644 arch/kvx/kernel/prom.c create mode 100644 arch/kvx/kernel/ptrace.c create mode 100644 arch/kvx/kernel/reset.c create mode 100644 arch/kvx/kernel/return_address.c create mode 100644 arch/kvx/kernel/setup.c create mode 100644 arch/kvx/kernel/signal.c create mode 100644 arch/kvx/kernel/smp.c create mode 100644 arch/kvx/kernel/smpboot.c create mode 100644 arch/kvx/kernel/stacktrace.c create mode 100644 arch/kvx/kernel/sys_kvx.c create mode 100644 arch/kvx/kernel/syscall_table.c create mode 100644 arch/kvx/kernel/time.c create mode 100644 arch/kvx/kernel/traps.c create mode 100644 arch/kvx/kernel/vdso.c create mode 100644 arch/kvx/kernel/vmlinux.lds.S create mode 100644 arch/kvx/lib/Makefile create mode 100644 arch/kvx/lib/clear_page.S create mode 100644 arch/kvx/lib/copy_page.S create mode 100644 arch/kvx/lib/delay.c create mode 100644 arch/kvx/lib/memcpy.c create mode 100644 arch/kvx/lib/memset.S create mode 100644 arch/kvx/lib/strlen.S create mode 100644 arch/kvx/lib/usercopy.S create mode 100644 arch/kvx/mm/Makefile create mode 100644 arch/kvx/mm/cacheflush.c create mode 100644 arch/kvx/mm/dma-mapping.c create mode 100644 arch/kvx/mm/extable.c create mode 100644 arch/kvx/mm/fault.c create mode 100644 arch/kvx/mm/hugetlbpage.c create mode 100644 arch/kvx/mm/init.c create mode 100644 arch/kvx/mm/kernel_rwx.c create mode 100644 arch/kvx/mm/mmap.c create mode 100644 arch/kvx/mm/mmu.c create mode 100644 arch/kvx/mm/mmu_stats.c create mode 100644 arch/kvx/mm/tlb.c create mode 100644 arch/kvx/platform/Makefile create mode 100644 arch/kvx/platform/ipi.c create mode 100644 arch/kvx/platform/pwr_ctrl.c create mode 100644 drivers/irqchip/irq-kvx-apic-gic.c create mode 100644 drivers/irqchip/irq-kvx-apic-mailbox.c create mode 100644 drivers/irqchip/irq-kvx-core-intc.c create mode 100644 drivers/irqchip/irq-kvx-itgen.c create mode 100644 drivers/power/reset/kvx-scall-poweroff.c create mode 100644 include/linux/irqchip/irq-kvx-apic-gic.h create mode 100644 include/linux/irqchip/irq-kvx-apic-mailbox.h create mode 100644 include/linux/irqchip/irq-kvx-itgen.h create mode 100644 scripts/gdb/arch/Makefile create mode 100644 scripts/gdb/arch/__init__.py create mode 100644 scripts/gdb/arch/kvx/Makefile create mode 100644 scripts/gdb/arch/kvx/__init__.py create mode 100644 scripts/gdb/arch/kvx/constants.py.in create mode 100644 scripts/gdb/arch/kvx/mmu.py create mode 100644 scripts/gdb/arch/kvx/page_table_walk.py
Signature · 1 line
2.37.2
RFC PATCH 1/25 Documentation: kvx: Add basic documentation
Add some documentation for kvx arch and its Linux port.
--- Documentation/kvx/kvx-exceptions.txt | 246 ++++++++++++++++++++++++ Documentation/kvx/kvx-iommu.txt | 183 ++++++++++++++++++ Documentation/kvx/kvx-mmu.txt | 272 +++++++++++++++++++++++++++ Documentation/kvx/kvx-smp.txt | 36 ++++ Documentation/kvx/kvx.txt | 268 ++++++++++++++++++++++++++ 5 files changed, 1005 insertions(+) create mode 100644 Documentation/kvx/kvx-exceptions.txt create mode 100644 Documentation/kvx/kvx-iommu.txt create mode 100644 Documentation/kvx/kvx-mmu.txt create mode 100644 Documentation/kvx/kvx-smp.txt create mode 100644 Documentation/kvx/kvx.txt
Documentation/kvx/kvx-exceptions.txt new file +246 -0
@@ -0,0 +1,246 @@ +Exceptions +========== +On kvx, handlers are set using $ev (exception vector) register which +specifies a base address. +An offset is added to $ev upon exception and the result is used as +"Next $pc". +The offset depends on which exception vector the cpu wants to jump to: +* $ev + 0x00 for debug +* $ev + 0x40 for trap +* $ev + 0x80 for interrupt +* $ev + 0xc0 for syscall + +Then, handlers are laid in the following order: + + _____________ + | | + | Syscall | + |_____________| + | | + | Interrupts | + |_____________| + | | + | Traps | + |_____________| + | | ^ + | Debug | | Stride +BASE -> |_____________| v + + +Interrupts, and traps are serviced similarly, ie: +- Jump to handler +- Save all registers +- Prepare the call (do_IRQ or trap_handler) +- restore all registers +- return from exception + +entry.S file is (as for other architectures) the entry point into the kernel. +It contains all assembly routines related to interrupts/traps/syscall. + +Syscall handling +================ + +When executing a syscall, it must be done using "scall $r6" +where $r6 contains the syscall number. Using this convention allow to +modify and restart a syscall from the kernel. + +Syscalls are handled differently than interrupts/exceptions. From an ABI +point of view, scalls are like function calls: any caller saved register +can be clobbered by the syscall. However, syscall parameters are passed +using registers r0 through r7. These registers must be preserved to avoid +cloberring them before the actual syscall function. + +On syscall from userspace (scall instruction), the processor will put +the syscall number in $es.sn and switch from user to kernel privilege +mode. kvx_syscall_handler will be called in kernel mode. + +The following steps are then taken: + +- Switch to kernel stack +- Extract syscall number +- Check that the syscall number is not bogus + - If so, set syscall func to a not implemented one +- Check if tracing is enabled + - If so, jump to trace_syscall_enter + - Save syscall arguments (r0 -> r7) on stack in pt_regs + - Call do_trace_syscall_enter function +- Restore syscall arguments since they have been modified by C call +- Call the syscall function +- Save $r0 in pt_regs since it can be cloberred afterward +- If tracing was enabled, call trace_syscall_exit +- Call work_pending +- Return to user ! + +The trace call is handled out of the fast path. All slow path handling +is done in another part of code to avoid messing with the cache. + +Signals +======= + +Signals are handled when exiting kernel before returning to user. +When handling a signal, the path is the following: + +1 - User application is executing normally + Then any exception happens (syscall, interrupt, trap) +2 - The exception handling path is taken + and before returning to user, pending signals are checked +3 - Signal are handled by do_signal + Registers are saved and a special part of the stack is modified + to create a trampoline to call rt_sigreturn + $spc is modified to jump to user signal handler + $ra is modified to jump to sigreturn trampoline directly after + returning from user signal handler. +4 - User signal handler is called after rfe from exception + when returning, $ra is retored to $pc, resulting in a call + to the syscall trampoline. +5 - syscall trampoline is executed, leading to rt_sigreturn syscall +6 - rt_sigreturn syscall is executed + Previous registers are restored to allow returning to user correctly +7 - User application is restored at the exact point it was interrupted + before. + + + +----------+ + | 1 | + | User app | @func + | (user) | + +---+------+ + | + | it/trap/scall + | + +---v-------+ + | 2 | + | exception | + | handling | + | (kernel) | + +---+-------+ + | + | Check if signal are pending, if so, handle signals + | + +---v--------+ + | 3 | + | do_signal | + | handling | + | (kernel) | + +----+-------+ + | + | Return to user signal handler + | + +----v------+ + | 4 | + | signal | + | handler | + | (user) | + +----+------+ + | + | Return to sigreturn trampoline + | + +----v-------+ + | 5 | + | syscall | + |rt_sigreturn| + | (user) | + +----+-------+ + | + | Syscall to rt_sigreturn + | + +----v-------+ + | 6 | + | sigreturn | + | handler | + | (kernel) | + +----+-------+ + | + | Modify context to return to original func + | + +----v-----+ + | 7 | + | User app | @func + | (user) | + +----------+ + +Registers handling +================== + +MMU is disabled in all exceptions paths, during register save and restoration. +This will prevent from triggering MMU fault (such as TLB miss) which could +clobber the current register state. Such event can occurs when RWX mode is +enabled and the memory accessed to save register can trigger a TLB miss. +Aside from that which is common for all exceptions path, registers are saved +differently regarding the type of exception. + +Interrupts and traps +-------------------- + +When interrupt and traps are triggered, we only save the caller-saved registers. +Indeed, we rely on the fact that C code will save and restore callee-saved and +hence, there is no need to save them. This path is the following: + + +------------+ +-----------+ +---------------+ +IT | Save caller| C Call | Execute C | Ret | Restore caller| Ret from IT ++--->+ saved +--------->+ handler +------->+ saved +-----> + | registers | +-----------+ | registers | + +------------+ +---------------+ + +However, when returning to user, we check if there is work_pending. If a signal +is pending and there is a signal handler to be called, then we need all +registers to be saved on the stack in the pt_regs before executing the signal +handler and restored after that. Since we only saved caller-saved registers, we +need to also save callee-saved registers to restore them correctly when +returning to user. This path is the following (a bit more complicated !): + + +------------+ + | Save caller| +-----------+ Ret +------------+ + IT | saved | C Call | Execute C | to asm | Check work | + +--->+ registers +--------->+ handler +------->+ pending | + | to pt_regs | +-----------+ +--+---+-----+ + +------------+ | | + Work pending | | No work pending + +--------------------------------------------+ | + | | + | +------------+ + v | + +------+------+ v + | Save callee | +-------+-------+ + | saved | | Restore caller| RFE from IT + | registers | | saved +-------> + | to pt_regs | | registers | + +--+-------+--+ | from pt_regs | + | | +-------+-------+ + | | +---------+ ^ + | | | Execute | | + | +-------->+ needed +-----------+ + | | work | + | +---------+ + |Signal handler ? + v ++----+----------+ RFE to user +-------------+ +--------------+ +| Copy all | handler | Execute | ret | rt_sigreturn | +| registers +------------>+ user signal +------>+ trampoline | +| from pt_regs | | handler | | to kernel | +| to user stack | +-------------+ +------+-------+ ++---------------+ | + syscall rt_sigreturn | + +-------------------------------------------------+ + | + v ++--------+-------+ +-------------+ +| Recopy all | | Restore all | RFE +| registers from +--------------------->+ saved +-------> +| user stack | Return | registers | +| to pt_regs | from sigreturn |from pt_regs | ++----------------+ (via ret_from_fork) +-------------+ + + +Syscalls +-------- +As explained before, for syscalls, we can use whatever callee-saved registers +we want since syscall are seen as a "classic" call from ABI pov. +Only different path is the one for clone. For this path, since the child expects +to find same callee-registers content than his parent, we must save them before +executing the clone syscall and restore them after that for the child. This is +done via a redefinition of __sys_clone in assembly which will be called in place +of the standard sys_clone. This new call will save callee saved registers +in pt_regs. Parent will return using the syscall standard path. Freshly spawned +child however will be woken up via ret_from_fork which will restore all +registers (even if caller saved are not needed).
Documentation/kvx/kvx-iommu.txt new file +183 -0
183 lines not on this page · raw message
Documentation/kvx/kvx-mmu.txt new file +272 -0
272 lines not on this page · raw message
Documentation/kvx/kvx-smp.txt new file +36 -0
@@ -0,0 +1,36 @@ +SMP +=== + +On kvx, 5 clusters are organized as groups of 16 processors + 1 +secure core (RM) for each cluster. These 17 processors are L1$ coherent +for TCM (tightly Coupled Memory). A mixed hw/sw L2$ is present to have +cache coherency on DDR as well as TCM. +The RM manager is not meant to run Linux so, 16 processors are available +for SMP. + +Booting +======= + +When booting the kvx processor, only the RM is woken up. This RM will +execute a portion of code located in a section named .rm_firmware. +By default, a simple power off code is embedded in this section. +To avoid embedding the firmware in kernel sources, the section is patched +using external tools to add the L2$ firmware (and replace the default firmware). +Before executing this firmware, the RM boots the PE0. PE0 will then enable L2 +coherency and request will be stalled until RM boots the L2$ firmware. + +Locking primitives +================== + +spinlock/rwlock are using the kernel standard queued spinlock/rwlocks. +These primitives are based on cmpxch and xchg. More particularly, it uses xchg16 +which is implemented as a read modify write with acswap on 32 bit word since +kvx does not have cmpxchg for size < 32bits. + +IPI +=== + +An IPI controller allows to communicate between CPUs using a simple +memory mapped register. This register can simply be written using a mask to +trigger interrupts directly to the cores matching the mask. +
Documentation/kvx/kvx.txt new file +268 -0
268 lines not on this page · raw message
Signature · 1 line
2.37.2
Jonathan Corbet
maintainerRe: [RFC PATCH 01/25] Documentation: kvx: Add basic documentation
Quoted 10 lines · Yann Sionneau
Add some documentation for kvx arch and its Linux port.
CC Jonathan Corbet <[email protected]>Co-developed-by Clement Leger <[email protected]>Signed-off-by Clement Leger <[email protected]>Co-developed-by Guillaume Thouvenin <[email protected]>Signed-off-by Guillaume Thouvenin <[email protected]>Signed-off-by Yann Sionneau <[email protected]>
Quoted 12 lines
--- Documentation/kvx/kvx-exceptions.txt | 246 ++++++++++++++++++++++++ Documentation/kvx/kvx-iommu.txt | 183 ++++++++++++++++++ Documentation/kvx/kvx-mmu.txt | 272 +++++++++++++++++++++++++++ Documentation/kvx/kvx-smp.txt | 36 ++++ Documentation/kvx/kvx.txt | 268 ++++++++++++++++++++++++++ 5 files changed, 1005 insertions(+) create mode 100644 Documentation/kvx/kvx-exceptions.txt create mode 100644 Documentation/kvx/kvx-iommu.txt create mode 100644 Documentation/kvx/kvx-mmu.txt create mode 100644 Documentation/kvx/kvx-smp.txt create mode 100644 Documentation/kvx/kvx.txt
Please write this documentation in the RST format (you're 95% of the way there now) and incorporate into the kernel docs build.
Thanks,
jon
cover kvx documentation improv (was: Re: [RFC PATCH 01/25] Documentation: kvx: Add basic documentation)
Quoted 23 lines · Jonathan Corbet
Quoted 10 lines
Add some documentation for kvx arch and its Linux port.
CC Jonathan Corbet <[email protected]>Co-developed-by Clement Leger <[email protected]>Signed-off-by Clement Leger <[email protected]>Co-developed-by Guillaume Thouvenin <[email protected]>Signed-off-by Guillaume Thouvenin <[email protected]>Signed-off-by Yann Sionneau <[email protected]>Quoted 12 lines
--- Documentation/kvx/kvx-exceptions.txt | 246 ++++++++++++++++++++++++ Documentation/kvx/kvx-iommu.txt | 183 ++++++++++++++++++ Documentation/kvx/kvx-mmu.txt | 272 +++++++++++++++++++++++++++ Documentation/kvx/kvx-smp.txt | 36 ++++ Documentation/kvx/kvx.txt | 268 ++++++++++++++++++++++++++ 5 files changed, 1005 insertions(+) create mode 100644 Documentation/kvx/kvx-exceptions.txt create mode 100644 Documentation/kvx/kvx-iommu.txt create mode 100644 Documentation/kvx/kvx-mmu.txt create mode 100644 Documentation/kvx/kvx-smp.txt create mode 100644 Documentation/kvx/kvx.txt
Quoted 2 lines
Please write this documentation in the RST format (you're 95% of the way there now) and incorporate into the kernel docs build.
Here is the polished documentation in reST format. Yann, can you please squash this series into your documentation patch?
Bagas Sanjaya (8):
Documentation: kvx: Convert to reST
Documentation: kvx: Wrap diagrams in literal code block
Documentation: kvx: Fix lists
Documentation: kvx: kvx-iommu: Use reST syntax for subsections
Documentation: kvx: kvx-iommu: monospacize kvx iommu device tree path
Documentation: kvx: Promote title headings
Documentation: kvx: Use literal code block for command-line inputs
Documentation: kvx: reword
Documentation/arch.rst | 1 + Documentation/kvx/index.rst | 12 ++ Documentation/kvx/kvx-exceptions.rst | 258 +++++++++++++++++++++++ Documentation/kvx/kvx-exceptions.txt | 246 ---------------------- Documentation/kvx/kvx-iommu.rst | 188 +++++++++++++++++ Documentation/kvx/kvx-iommu.txt | 183 ----------------- Documentation/kvx/kvx-mmu.rst | 294 +++++++++++++++++++++++++++ Documentation/kvx/kvx-mmu.txt | 272 ------------------------- Documentation/kvx/kvx-smp.rst | 36 ++++ Documentation/kvx/kvx-smp.txt | 36 ---- Documentation/kvx/kvx.rst | 269 ++++++++++++++++++++++++ Documentation/kvx/kvx.txt | 268 ------------------------ 12 files changed, 1058 insertions(+), 1005 deletions(-) create mode 100644 Documentation/kvx/index.rst create mode 100644 Documentation/kvx/kvx-exceptions.rst delete mode 100644 Documentation/kvx/kvx-exceptions.txt create mode 100644 Documentation/kvx/kvx-iommu.rst delete mode 100644 Documentation/kvx/kvx-iommu.txt create mode 100644 Documentation/kvx/kvx-mmu.rst delete mode 100644 Documentation/kvx/kvx-mmu.txt create mode 100644 Documentation/kvx/kvx-smp.rst delete mode 100644 Documentation/kvx/kvx-smp.txt create mode 100644 Documentation/kvx/kvx.rst delete mode 100644 Documentation/kvx/kvx.txt
Signature · 1 line
An old man doll... just what I always wanted! - Clara
PATCH 1/8 Documentation: kvx: Convert to reST
Convert kvx documentation to reST format. While at it, fix constructs that cause Sphinx to confuse with section markup.
Note that 101 warnings are generated due to markup syntax issues. These will be addressed in subsequent patches.
---
Documentation/arch.rst | 1 +
Documentation/kvx/index.rst | 12 ++++++++
...{kvx-exceptions.txt => kvx-exceptions.rst} | 10 +++----
.../kvx/{kvx-iommu.txt => kvx-iommu.rst} | 0
.../kvx/{kvx-mmu.txt => kvx-mmu.rst} | 28 +++++++++++--------
.../kvx/{kvx-smp.txt => kvx-smp.rst} | 0
Documentation/kvx/{kvx.txt => kvx.rst} | 0
7 files changed, 35 insertions(+), 16 deletions(-)
create mode 100644 Documentation/kvx/index.rst
rename Documentation/kvx/{kvx-exceptions.txt => kvx-exceptions.rst} (98%)
rename Documentation/kvx/{kvx-iommu.txt => kvx-iommu.rst} (100%)
rename Documentation/kvx/{kvx-mmu.txt => kvx-mmu.rst} (88%)
rename Documentation/kvx/{kvx-smp.txt => kvx-smp.rst} (100%)
rename Documentation/kvx/{kvx.txt => kvx.rst} (100%)Documentation/arch.rst +1 -0
@@ -13,6 +13,7 @@ implementation. arm/index arm64/index ia64/index + kvx/index loongarch/index m68k/index mips/index
Documentation/kvx/index.rst new file +12 -0
@@ -0,0 +1,12 @@ +================ +KVX Architecture +================ + +.. toctree:: + :maxdepth: 1 + + kvx-exceptions + kvx-iommu + kvx-mmu + kvx-smp + kvx
Documentation/kvx/kvx-exceptions.rst renamed from Documentation/kvx/kvx-exceptions.txt +5 -5
@@ -12,19 +12,19 @@ The offset depends on which exception vector the cpu wants to jump to: Then, handlers are laid in the following order: - _____________ + +-------------+ | | | Syscall | - |_____________| + +-------------+ | | | Interrupts | - |_____________| + +-------------+ | | | Traps | - |_____________| + +-------------+ | | ^ | Debug | | Stride -BASE -> |_____________| v +BASE -> +-------------+ v Interrupts, and traps are serviced similarly, ie:
Documentation/kvx/kvx-iommu.rst renamed from Documentation/kvx/kvx-iommu.txt +0 -0
Documentation/kvx/kvx-mmu.rst renamed from Documentation/kvx/kvx-mmu.txt +17 -11
@@ -24,17 +24,23 @@ only one ZONE_NORMAL. This will be updated if DMA cannot access all memory. Currently, the memory mapping is the following for 4KB page: -+-----------------------+-----------------------+------+-------+--------------+ -| Start | End | Attr | Size | Name | -+-----------------------+-----------------------+------+-------+--------------+ -| 0000 0000 0000 0000 | 0000 003F FFFF FFFF | --- | 256GB | User | -| 0000 0040 0000 0000 | 0000 007F FFFF FFFF | --- | 256GB | MMAP | -| 0000 0080 0000 0000 | FFFF FF7F FFFF FFFF | --- | --- | Gap | -| FFFF FF80 0000 0000 | FFFF FFFF FFFF FFFF | --- | 512GB | Kernel | -| FFFF FF80 0000 0000 | FFFF FF8F FFFF FFFF | RWX | 64GB | Direct Map | -| FFFF FF90 0000 0000 | FFFF FF90 3FFF FFFF | RWX | 1GB | Vmalloc | -| FFFF FF90 4000 0000 | FFFF FFFF FFFF FFFF | RW | 447GB | Free area | -+-----------------------+-----------------------+------+-------+--------------+ ++-----------------------+-----------------------+---------+----------+--------------+ +| Start | End | Attr | Size | Name | ++=======================+=======================+=========+==========+==============+ +| 0000 0000 0000 0000 | 0000 003F FFFF FFFF | \-\-\- | 256GB | User | ++-----------------------+-----------------------+---------+----------+--------------+ +| 0000 0040 0000 0000 | 0000 007F FFFF FFFF | \-\-\- | 256GB | MMAP | ++-----------------------+-----------------------+---------+----------+--------------+ +| 0000 0080 0000 0000 | FFFF FF7F FFFF FFFF | \-\-\- | \-\-\- | Gap | ++-----------------------+-----------------------+---------+----------+--------------+ +| FFFF FF80 0000 0000 | FFFF FFFF FFFF FFFF | \-\-\- | 512GB | Kernel | ++-----------------------+-----------------------+---------+----------+--------------+ +| FFFF FF80 0000 0000 | FFFF FF8F FFFF FFFF | RWX | 64GB | Direct Map | ++-----------------------+-----------------------+---------+----------+--------------+ +| FFFF FF90 0000 0000 | FFFF FF90 3FFF FFFF | RWX | 1GB | Vmalloc | ++-----------------------+-----------------------+---------+----------+--------------+ +| FFFF FF90 4000 0000 | FFFF FFFF FFFF FFFF | RW | 447GB | Free area | ++-----------------------+-----------------------+---------+----------+--------------+ Enable the MMU ==============
Documentation/kvx/kvx-smp.rst renamed from Documentation/kvx/kvx-smp.txt +0 -0
Documentation/kvx/kvx.rst renamed from Documentation/kvx/kvx.txt +0 -0
Signature · 1 line
An old man doll... just what I always wanted! - Clara
PATCH 2/8 Documentation: kvx: Wrap diagrams in literal code block
In reply to Bagas SanjayaWrap code path diagrams in literal code block, just like other diagrams in the kernel documentation. This avoids confusion with other constructs (tables, block quotes, and inline substitutions).
--- Documentation/kvx/kvx-exceptions.rst | 241 ++++++++++++++------------- Documentation/kvx/kvx-iommu.rst | 64 +++---- Documentation/kvx/kvx-mmu.rst | 41 +++-- Documentation/kvx/kvx.rst | 96 +++++------ 4 files changed, 225 insertions(+), 217 deletions(-)
Documentation/kvx/kvx-exceptions.rst +121 -120
@@ -10,21 +10,21 @@ The offset depends on which exception vector the cpu wants to jump to: * $ev + 0x80 for interrupt * $ev + 0xc0 for syscall -Then, handlers are laid in the following order: +Then, handlers are laid in the following order:: - +-------------+ - | | - | Syscall | - +-------------+ - | | - | Interrupts | - +-------------+ - | | - | Traps | - +-------------+ - | | ^ - | Debug | | Stride -BASE -> +-------------+ v + +-------------+ + | | + | Syscall | + +-------------+ + | | + | Interrupts | + +-------------+ + | | + | Traps | + +-------------+ + | | ^ + | Debug | | Stride + BASE -> +-------------+ v Interrupts, and traps are serviced similarly, ie:
@@ -99,65 +99,66 @@ When handling a signal, the path is the following: 7 - User application is restored at the exact point it was interrupted before. + :: - +----------+ - | 1 | - | User app | @func - | (user) | - +---+------+ - | - | it/trap/scall - | - +---v-------+ - | 2 | - | exception | - | handling | - | (kernel) | - +---+-------+ - | - | Check if signal are pending, if so, handle signals - | - +---v--------+ - | 3 | - | do_signal | - | handling | - | (kernel) | - +----+-------+ - | - | Return to user signal handler - | - +----v------+ - | 4 | - | signal | - | handler | - | (user) | - +----+------+ - | - | Return to sigreturn trampoline - | - +----v-------+ - | 5 | - | syscall | - |rt_sigreturn| - | (user) | - +----+-------+ - | - | Syscall to rt_sigreturn - | - +----v-------+ - | 6 | - | sigreturn | - | handler | - | (kernel) | - +----+-------+ - | - | Modify context to return to original func - | - +----v-----+ - | 7 | - | User app | @func - | (user) | - +----------+ + +----------+ + | 1 | + | User app | @func + | (user) | + +---+------+ + | + | it/trap/scall + | + +---v-------+ + | 2 | + | exception | + | handling | + | (kernel) | + +---+-------+ + | + | Check if signal are pending, if so, handle signals + | + +---v--------+ + | 3 | + | do_signal | + | handling | + | (kernel) | + +----+-------+ + | + | Return to user signal handler + | + +----v------+ + | 4 | + | signal | + | handler | + | (user) | + +----+------+ + | + | Return to sigreturn trampoline + | + +----v-------+ + | 5 | + | syscall | + |rt_sigreturn| + | (user) | + +----+-------+ + | + | Syscall to rt_sigreturn + | + +----v-------+ + | 6 | + | sigreturn | + | handler | + | (kernel) | + +----+-------+ + | + | Modify context to return to original func + | + +----v-----+ + | 7 | + | User app | @func + | (user) | + +----------+ Registers handling ==================
@@ -174,62 +175,62 @@ Interrupts and traps When interrupt and traps are triggered, we only save the caller-saved registers. Indeed, we rely on the fact that C code will save and restore callee-saved and -hence, there is no need to save them. This path is the following: +hence, there is no need to save them. This path is the following:: - +------------+ +-----------+ +---------------+ -IT | Save caller| C Call | Execute C | Ret | Restore caller| Ret from IT -+--->+ saved +--------->+ handler +------->+ saved +-----> - | registers | +-----------+ | registers | - +------------+ +---------------+ + +------------+ +-----------+ +---------------+ + IT | Save caller| C Call | Execute C | Ret | Restore caller| Ret from IT + +--->+ saved +--------->+ handler +------->+ saved +-----> + | registers | +-----------+ | registers | + +------------+ +---------------+ However, when returning to user, we check if there is work_pending. If a signal is pending and there is a signal handler to be called, then we need all registers to be saved on the stack in the pt_regs before executing the signal handler and restored after that. Since we only saved caller-saved registers, we need to also save callee-saved registers to restore them correctly when -returning to user. This path is the following (a bit more complicated !): +returning to user. This path is the following (a bit more complicated !):: - +------------+ - | Save caller| +-----------+ Ret +------------+ - IT | saved | C Call | Execute C | to asm | Check work | - +--->+ registers +--------->+ handler +------->+ pending | - | to pt_regs | +-----------+ +--+---+-----+ - +------------+ | | - Work pending | | No work pending - +--------------------------------------------+ | - | | - | +------------+ - v | - +------+------+ v - | Save callee | +-------+-------+ - | saved | | Restore caller| RFE from IT - | registers | | saved +-------> - | to pt_regs | | registers | - +--+-------+--+ | from pt_regs | - | | +-------+-------+ - | | +---------+ ^ - | | | Execute | | - | +-------->+ needed +-----------+ - | | work | - | +---------+ - |Signal handler ? - v -+----+----------+ RFE to user +-------------+ +--------------+ -| Copy all | handler | Execute | ret | rt_sigreturn | -| registers +------------>+ user signal +------>+ trampoline | -| from pt_regs | | handler | | to kernel | -| to user stack | +-------------+ +------+-------+ -+---------------+ | - syscall rt_sigreturn | - +-------------------------------------------------+ - | - v -+--------+-------+ +-------------+ -| Recopy all | | Restore all | RFE -| registers from +--------------------->+ saved +-------> -| user stack | Return | registers | -| to pt_regs | from sigreturn |from pt_regs | -+----------------+ (via ret_from_fork) +-------------+ + +------------+ + | Save caller| +-----------+ Ret +------------+ + IT | saved | C Call | Execute C | to asm | Check work | + +--->+ registers +--------->+ handler +------->+ pending | + | to pt_regs | +-----------+ +--+---+-----+ + +------------+ | | + Work pending | | No work pending + +--------------------------------------------+ | + | | + | +------------+ + v | + +------+------+ v + | Save callee | +-------+-------+ + | saved | | Restore caller| RFE from IT + | registers | | saved +-------> + | to pt_regs | | registers | + +--+-------+--+ | from pt_regs | + | | +-------+-------+ + | | +---------+ ^ + | | | Execute | | + | +-------->+ needed +-----------+ + | | work | + | +---------+ + |Signal handler ? + v + +----+----------+ RFE to user +-------------+ +--------------+ + | Copy all | handler | Execute | ret | rt_sigreturn | + | registers +------------>+ user signal +------>+ trampoline | + | from pt_regs | | handler | | to kernel | + | to user stack | +-------------+ +------+-------+ + +---------------+ | + syscall rt_sigreturn | + +-------------------------------------------------+ + | + v + +--------+-------+ +-------------+ + | Recopy all | | Restore all | RFE + | registers from +--------------------->+ saved +-------> + | user stack | Return | registers | + | to pt_regs | from sigreturn |from pt_regs | + +----------------+ (via ret_from_fork) +-------------+ Syscalls
Documentation/kvx/kvx-iommu.rst +32 -32
71 lines not on this page · raw message
Documentation/kvx/kvx-mmu.rst +24 -17
60 lines not on this page · raw message
Documentation/kvx/kvx.rst +48 -48
110 lines not on this page · raw message
Signature · 1 line
An old man doll... just what I always wanted! - Clara
PATCH 3/8 Documentation: kvx: Fix lists
In reply to Bagas SanjayaMany "unexpected indentation" and block quote warnings are generated due to errors in lists. Fix them up by:
* Align lists texts just after the lists marker
* Add required blank line between nested lists and between paragraphs and the lists
* Use appropriate syntax for numbered lists
While at it, also lightly reword.
--- Documentation/kvx/kvx-exceptions.rst | 53 ++++++++++++++----------- Documentation/kvx/kvx-iommu.rst | 3 +- Documentation/kvx/kvx-mmu.rst | 37 +++++++++-------- Documentation/kvx/kvx.rst | 59 +++++++++++++++------------- 4 files changed, 85 insertions(+), 67 deletions(-)
Documentation/kvx/kvx-exceptions.rst +31 -22
@@ -5,6 +5,7 @@ specifies a base address. An offset is added to $ev upon exception and the result is used as "Next $pc". The offset depends on which exception vector the cpu wants to jump to: + * $ev + 0x00 for debug * $ev + 0x40 for trap * $ev + 0x80 for interrupt
@@ -28,6 +29,7 @@ Then, handlers are laid in the following order:: Interrupts, and traps are serviced similarly, ie: + - Jump to handler - Save all registers - Prepare the call (do_IRQ or trap_handler)
@@ -58,12 +60,15 @@ The following steps are then taken: - Switch to kernel stack - Extract syscall number -- Check that the syscall number is not bogus - - If so, set syscall func to a not implemented one -- Check if tracing is enabled - - If so, jump to trace_syscall_enter +- Check that the syscall number is not bogus. + If so, set syscall func to a not implemented one + +- Check if tracing is enabled. + If so, jump to trace_syscall_enter, then: + - Save syscall arguments (r0 -> r7) on stack in pt_regs - Call do_trace_syscall_enter function + - Restore syscall arguments since they have been modified by C call - Call the syscall function - Save $r0 in pt_regs since it can be cloberred afterward
@@ -80,24 +85,28 @@ Signals Signals are handled when exiting kernel before returning to user. When handling a signal, the path is the following: -1 - User application is executing normally - Then any exception happens (syscall, interrupt, trap) -2 - The exception handling path is taken - and before returning to user, pending signals are checked -3 - Signal are handled by do_signal - Registers are saved and a special part of the stack is modified - to create a trampoline to call rt_sigreturn - $spc is modified to jump to user signal handler - $ra is modified to jump to sigreturn trampoline directly after - returning from user signal handler. -4 - User signal handler is called after rfe from exception - when returning, $ra is retored to $pc, resulting in a call - to the syscall trampoline. -5 - syscall trampoline is executed, leading to rt_sigreturn syscall -6 - rt_sigreturn syscall is executed - Previous registers are restored to allow returning to user correctly -7 - User application is restored at the exact point it was interrupted - before. +1. User application is executing normally, then exception occurs (syscall, + interrupt, trap) +2. The exception handling path is taken + and before returning to user, pending signals are checked. + +3. The signal handling path is as follows: + + * Signals are handled by do_signal. + * Registers are saved and a special part of the stack is modified + to create a trampoline to call rt_sigreturn. + * $spc is modified to jump to user signal handler. + * $ra is modified to jump to sigreturn trampoline directly after + returning from user signal handler. + +4. User signal handler is called after rfe from exception. + When returning, $ra is retored to $pc, resulting in a call + to the syscall trampoline. +5. syscall trampoline is executed, leading to rt_sigreturn syscall +6. rt_sigreturn syscall is executed. + Previous registers are restored to allow returning to user correctly +7. User application is restored at the exact point it was interrupted + before. ::
Documentation/kvx/kvx-iommu.rst +2 -1
@@ -32,7 +32,8 @@ Cluster IOMMUs -------------- IOMMUs on cluster are used for DMA and cryptographic accelerators. -There are six IOMMUs connected to the: +There are six IOMMUs connected: + - cluster DMA tx - cluster DMA rx - first non secure cryptographic accelerator
Documentation/kvx/kvx-mmu.rst +21 -16
@@ -77,6 +77,7 @@ routine which would (obviously) not work... Once this is done, we can flush the entries and that new entries inserted in JTLB will apply. By default, the following policy is applied on vmlinux sections: + - init_data: RW - init_text: RX (or RWX if parameter rodata=off) - text: RX (or RWX if parameter rodata=off)
@@ -92,8 +93,9 @@ spaces to be in the same space as the user. The kernel will have the $ps.mmup set in kernel (PL1) and unset for user (PL2). As said in kvx documentation, we have two cases when the kernel is booted: -- Either we have been booted by someone (bootloader, hypervisor, etc) -- Or we are alone (boot from flash) + +- Boot via intermediaries (bootloader, hypervisor, etc) +- Direct boot from flash In both cases, we will use the virtual space 0. Indeed, if we are alone on the core, then it means nobody is using the MMU and we can take the
@@ -115,6 +117,7 @@ setup_bootmem: Memory : 0x100000000 - 0x120000000 setup_bootmem: Reserved: 0x10001f000 - 0x1002d1bc0 During the paging init we need to set: + - min_low_pfn that is the lowest PFN available in the system - max_low_pfn that indicates the end if NORMAL zone - max_pfn that is the number of pages in the system
@@ -213,16 +216,16 @@ kvx core does not feature a hardware page walker. This work must be done by the core in software. In order to optimize TLB refill, a special fast path is taken when entering in kernel space. In order to speed up the process, the following actions are taken: -# Save some registers in a per process scratchpad -# If the trap is a nomapping then try the fastpath -# Save some more registers for this fastpath -# Check if faulting address is a memory direct mapping one. - # If entry is a direct mapping one and RWX is not enabled, add an entry into LTLB - # If not, continue -# Try to walk the page table - # If entry is not present, take the slowpath (do_page_fault) -# Refill the tlb properly -# Exit by restoring only a few registers + +1. Save some registers in a per process scratchpad +2. If the trap is a nomapping then try the fastpath +3. Save some more registers for this fastpath +4. Check if faulting address is a memory direct mapping one. If entry is a + direct mapping one and RWX is not enabled, add an entry into LTLB. + Otherwise, continue +5. Try to walk the page table. If entry is not present, take the slowpath (do_page_fault) +6. Refill the tlb properly +7. Exit by restoring only a few registers ASN Handling ============
@@ -273,13 +276,15 @@ Debug In order to debug the page table and tlb entries, gdb scripts contains commands which allows to dump the page table: + - lx-kvx-page-table-walk - - Display the current process page table by default + Display the current process page table by default - lx-kvx-tlb-decode - - Display the content of $tel and $teh into something readable + Display the content of $tel and $teh into something readable Other commands available in kvx-gdb are the following: + - mppa-dump-tlb - - Display the content of TLBs (JTLB and LTLB) + Display the content of TLBs (JTLB and LTLB) - mppa-lookup-addr - - Find physical address matching a virtual one + Find physical address matching a virtual one
Documentation/kvx/kvx.rst +31 -28
88 lines not on this page · raw message
Signature · 1 line
An old man doll... just what I always wanted! - Clara
PATCH 4/8 Documentation: kvx: kvx-iommu: Use reST syntax for subsections
In reply to Bagas SanjayaSubsection headings of "IOMMU implementation" is written using triple-hash syntax, which is valid only for Markdown. Since the documentation is written in reST, use appropriate syntax instead (tilde underline).
--- Documentation/kvx/kvx-iommu.rst | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
Documentation/kvx/kvx-iommu.rst +8 -4
@@ -110,7 +110,8 @@ the cluster. IOMMU is related to a specific bus like PCIe we will be able to specify that all peripherals will go through this IOMMU. -### IOMMU Page table +IOMMU Page table +~~~~~~~~~~~~~~~~ We need to be able to know which IO virtual addresses (IOVA) are mapped in the TLB in order to be able to remove entries when a device finishes a transfer and
@@ -137,7 +138,8 @@ huge page table for a given IOMMU (typically the PCIe IOMMU). As we won't refill the TLB we know that we won't have more than 128*16 entries. In this case we can simply keep a table with all possible entries. -### Maintenance interface +Maintenance interface +~~~~~~~~~~~~~~~~~~~~~ It is possible to have several "maintainers" for the same IOMMU. The driver is using two of them. One that writes the TLB and another interface reads TLB. For
@@ -149,7 +151,8 @@ following command in gdb: Since different management interface are used for read and write it is safe to execute the above command at any moment. -### Interrupts +Interrupts +~~~~~~~~~~ IOMMU can have 3 kind of interrupts that corresponds to 3 different types of errors (no mapping. protection, parity). When the IOMMU is shared between
@@ -163,7 +166,8 @@ stall one. So when an interrupt occurs it is managed by the driver. All others interrupts that occurs are stored and the IOMMU is stalled. When driver cleans the first interrupt others will be managed one by one. -### ASN (Address Space Number) +ASN (Address Space Number) +~~~~~~~~~~~~~~~~~~~~~~~~~~ This is also know as ASID in some other architecture. Each device will have a given ASN that will be given through the device tree. As address space is
Signature · 1 line
An old man doll... just what I always wanted! - Clara
PATCH 5/8 Documentation: kvx: kvx-iommu: monospacize kvx iommu device tree path
In reply to Bagas SanjayaThe device tree path shares the same "kvm-iommu" as the actual documentation path (kvm-iommu.rst), which make it links to the doc instead. Monospacize the path by enclosing it in inline code.
--- Documentation/kvx/kvx-iommu.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/kvx/kvx-iommu.rst +1 -1
@@ -178,7 +178,7 @@ Device tree ----------- Relationships between devices, DMAs and IOMMUs are described in the -device tree (see Documentation/devicetree/bindings/iommu/kalray,kvx-iommu.txt +device tree (see ``Documentation/devicetree/bindings/iommu/kalray,kvx-iommu.txt`` for more details). Limitations
Signature · 1 line
An old man doll... just what I always wanted! - Clara
PATCH 6/8 Documentation: kvx: Promote title headings
In reply to Bagas SanjayaThe documentation contains headings which all marked up using the same heading level, which cause doc sections to also appear in index TOC alongside doc titles.
Promote title headings while expanding their title text to be more descriptive.
--- Documentation/kvx/kvx-exceptions.rst | 6 ++++-- Documentation/kvx/kvx-iommu.rst | 4 ++-- Documentation/kvx/kvx-mmu.rst | 5 +++-- Documentation/kvx/kvx-smp.rst | 5 +++-- Documentation/kvx/kvx.rst | 1 + 5 files changed, 13 insertions(+), 8 deletions(-)
Documentation/kvx/kvx-exceptions.rst +4 -2
@@ -1,5 +1,7 @@ -Exceptions -========== +========================= +Exception handling in kvx +========================= + On kvx, handlers are set using $ev (exception vector) register which specifies a base address. An offset is added to $ev upon exception and the result is used as
Documentation/kvx/kvx-iommu.rst +2 -2
@@ -1,5 +1,5 @@ -IOMMU -===== +IOMMU in kvx +============ General Overview ----------------
Documentation/kvx/kvx-mmu.rst +3 -2
@@ -1,5 +1,6 @@ -MMU -=== +========================== +kvx Memory Management Unit +========================== Virtual addresses are on 41 bits for kvx when using 64-bit mode. To differentiate kernel from user space, we use the high order bit
Documentation/kvx/kvx-smp.rst +3 -2
@@ -1,5 +1,6 @@ -SMP -=== +=============================================== +Symmetric Multiprocessing Implementation in kvx +=============================================== On kvx, 5 clusters are organized as groups of 16 processors + 1 secure core (RM) for each cluster. These 17 processors are L1$ coherent
Documentation/kvx/kvx.rst +1 -0
@@ -1,3 +1,4 @@ +======================= kvx Core Implementation =======================
Signature · 1 line
An old man doll... just what I always wanted! - Clara
PATCH 7/8 Documentation: kvx: Use literal code block for command-line inputs
In reply to Bagas SanjayaCommand-line, like codes, looks ugly when default paragraph block is used (since proportional font is used), where literal code blocks (which render as monospace) do the job better.
--- Documentation/kvx/kvx-iommu.rst | 2 +- Documentation/kvx/kvx.rst | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-)
Documentation/kvx/kvx-iommu.rst +1 -1
@@ -144,7 +144,7 @@ Maintenance interface It is possible to have several "maintainers" for the same IOMMU. The driver is using two of them. One that writes the TLB and another interface reads TLB. For debug purpose it is possible to display the content of the tlb by using the -following command in gdb: +following command in gdb:: gdb> p kvx_iommu_dump_tlb( <iommu addr>, 0)
Documentation/kvx/kvx.rst +5 -5
@@ -122,7 +122,7 @@ To be able to set breakpoints when MMU is enabled we added a label called gdb_mmu_enabled. If you try to set a breakpoint on a function that is in virtual memory before the activation of the MMU this address as no signification for GDB. So, for example, if you want to break on the function start_kernel() -you will need to run: +you will need to run:: kvx-gdb -silent path_to/vmlinux \ -ex 'tbreak gdb_mmu_enabled' -ex 'run' \
@@ -253,19 +253,19 @@ Building ======== In order to build the kernel, you will need a complete kvx toolchain. -First, setup the config using the following command line +First, setup the config using the following command line:: $ make ARCH=kvx O=your_directory default_defconfig -Adjust any configuration option you may need and then, build the kernel: +Adjust any configuration option you may need and then, build the kernel:: $ make ARCH=kvx O=your_directory -j12 -You will finally have a vmlinux image ready to be run. +You will finally have a vmlinux image ready to be run:: $ kvx-mppa -- vmlinux -Additionally, you may want to debug it. To do so, use kvx-gdb: +Additionally, you may want to debug it. To do so, use kvx-gdb:: $ kvx-gdb vmlinux
Signature · 1 line
An old man doll... just what I always wanted! - Clara
PATCH 8/8 Documentation: kvx: reword
In reply to Bagas SanjayaImprove the documentation wording to be clearer and effective.
In most cases, third-person perspective ("we") is avoided unless absolutely necessary.
Also, monospacize programming keywords (like variable and function names).
--- Documentation/kvx/kvx-exceptions.rst | 114 +++++++------- Documentation/kvx/kvx-iommu.rst | 124 +++++++-------- Documentation/kvx/kvx-mmu.rst | 227 ++++++++++++++------------- Documentation/kvx/kvx-smp.rst | 29 ++-- Documentation/kvx/kvx.rst | 209 ++++++++++++------------ 5 files changed, 351 insertions(+), 352 deletions(-)
Documentation/kvx/kvx-exceptions.rst +57 -57
@@ -2,11 +2,10 @@ Exception handling in kvx ========================= -On kvx, handlers are set using $ev (exception vector) register which -specifies a base address. -An offset is added to $ev upon exception and the result is used as -"Next $pc". -The offset depends on which exception vector the cpu wants to jump to: +On kvx, handlers are set using $ev (exception vector) register which specifies +a base address. An offset is added to $ev upon exception and the result is used +as "Next $pc". The offset depends on which exception vector the cpu wants to +jump to: * $ev + 0x00 for debug * $ev + 0x40 for trap
@@ -30,53 +29,52 @@ Then, handlers are laid in the following order:: BASE -> +-------------+ v -Interrupts, and traps are serviced similarly, ie: +Interrupts and traps are serviced similarly, ie: - Jump to handler - Save all registers - Prepare the call (do_IRQ or trap_handler) -- restore all registers -- return from exception +- Restore all registers +- Return from exception -entry.S file is (as for other architectures) the entry point into the kernel. +``entry.S`` is (as for other architectures) the entry point into the kernel. It contains all assembly routines related to interrupts/traps/syscall. Syscall handling ================ When executing a syscall, it must be done using "scall $r6" -where $r6 contains the syscall number. Using this convention allow to +where $r6 contains the syscall number. This convention allows to modify and restart a syscall from the kernel. Syscalls are handled differently than interrupts/exceptions. From an ABI -point of view, scalls are like function calls: any caller saved register +point of view, syscalls are like function calls: any caller-saved register can be clobbered by the syscall. However, syscall parameters are passed using registers r0 through r7. These registers must be preserved to avoid -cloberring them before the actual syscall function. +clobbering them before the actual syscall function. -On syscall from userspace (scall instruction), the processor will put +On syscall from userspace (``scall`` instruction), the processor will put the syscall number in $es.sn and switch from user to kernel privilege -mode. kvx_syscall_handler will be called in kernel mode. +mode. ``kvx_syscall_handler`` will then be called in kernel mode. -The following steps are then taken: +Below is the path when executing syscall: -- Switch to kernel stack -- Extract syscall number -- Check that the syscall number is not bogus. - If so, set syscall func to a not implemented one +- Switch to kernel stack. +- Extract syscall number. +- Check that the syscall number is not bogus. If so, set syscall func to the + unimplemented one. -- Check if tracing is enabled. - If so, jump to trace_syscall_enter, then: +- Check if tracing is enabled. If so, jump to ``trace_syscall_enter``, then: - - Save syscall arguments (r0 -> r7) on stack in pt_regs - - Call do_trace_syscall_enter function + - Save syscall arguments (r0 -> r7) on stack in pt_regs. + - Call ``do_trace_syscall_enter`` function. -- Restore syscall arguments since they have been modified by C call -- Call the syscall function -- Save $r0 in pt_regs since it can be cloberred afterward -- If tracing was enabled, call trace_syscall_exit -- Call work_pending -- Return to user ! +- Restore syscall arguments since they have been modified by C function call. +- Call the ``syscall`` function. +- Save $r0 in ``pt_regs`` since it can be clobbered afterward. +- If tracing is enabled, call ``trace_syscall_exit``. +- Call ``work_pending``. +- Return to user The trace call is handled out of the fast path. All slow path handling is done in another part of code to avoid messing with the cache.
@@ -85,18 +83,18 @@ Signals ======= Signals are handled when exiting kernel before returning to user. -When handling a signal, the path is the following: +When handling a signal, the execution path is: 1. User application is executing normally, then exception occurs (syscall, interrupt, trap) -2. The exception handling path is taken - and before returning to user, pending signals are checked. +2. The exception handling path is taken and before returning to user, pending + signals are checked. 3. The signal handling path is as follows: - * Signals are handled by do_signal. + * Signals are handled by ``do_signal``. * Registers are saved and a special part of the stack is modified - to create a trampoline to call rt_sigreturn. + to create a trampoline to call ``rt_sigreturn``. * $spc is modified to jump to user signal handler. * $ra is modified to jump to sigreturn trampoline directly after returning from user signal handler.
@@ -104,9 +102,9 @@ When handling a signal, the path is the following: 4. User signal handler is called after rfe from exception. When returning, $ra is retored to $pc, resulting in a call to the syscall trampoline. -5. syscall trampoline is executed, leading to rt_sigreturn syscall -6. rt_sigreturn syscall is executed. - Previous registers are restored to allow returning to user correctly +5. syscall trampoline is executed, leading to ``rt_sigreturn`` syscall +6. ``rt_sigreturn`` syscall is executed. Previous registers are restored to + allow returning to user correctly 7. User application is restored at the exact point it was interrupted before.
@@ -175,18 +173,18 @@ Registers handling ================== MMU is disabled in all exceptions paths, during register save and restoration. -This will prevent from triggering MMU fault (such as TLB miss) which could +This will prevent triggering MMU fault (such as TLB miss) which could clobber the current register state. Such event can occurs when RWX mode is enabled and the memory accessed to save register can trigger a TLB miss. Aside from that which is common for all exceptions path, registers are saved -differently regarding the type of exception. +differently according to exception type. Interrupts and traps -------------------- -When interrupt and traps are triggered, we only save the caller-saved registers. +When interrupt and traps are triggered, only caller-saved registers are saved. Indeed, we rely on the fact that C code will save and restore callee-saved and -hence, there is no need to save them. This path is the following:: +hence, there is no need to save them. The path is:: +------------+ +-----------+ +---------------+ IT | Save caller| C Call | Execute C | Ret | Restore caller| Ret from IT
@@ -194,12 +192,13 @@ hence, there is no need to save them. This path is the following:: | registers | +-----------+ | registers | +------------+ +---------------+ -However, when returning to user, we check if there is work_pending. If a signal -is pending and there is a signal handler to be called, then we need all -registers to be saved on the stack in the pt_regs before executing the signal -handler and restored after that. Since we only saved caller-saved registers, we -need to also save callee-saved registers to restore them correctly when -returning to user. This path is the following (a bit more complicated !):: +However, when returning to user, we check if there is ``work_pending``. If a +signal is pending and there is a signal handler to be called, then all +registers are needed to be saved on the stack in ``pt_regs`` before executing +the signal handler and restored after that. Since only caller-saved registers +are saved, we need to also save callee-saved registers to restore them +correctly when returning to user. The path will be (note: a bit more +complicated!):: +------------+ | Save caller| +-----------+ Ret +------------+
@@ -246,13 +245,14 @@ returning to user. This path is the following (a bit more complicated !):: Syscalls -------- -As explained before, for syscalls, we can use whatever callee-saved registers -we want since syscall are seen as a "classic" call from ABI pov. -Only different path is the one for clone. For this path, since the child expects -to find same callee-registers content than his parent, we must save them before -executing the clone syscall and restore them after that for the child. This is -done via a redefinition of __sys_clone in assembly which will be called in place -of the standard sys_clone. This new call will save callee saved registers -in pt_regs. Parent will return using the syscall standard path. Freshly spawned -child however will be woken up via ret_from_fork which will restore all -registers (even if caller saved are not needed). +As explained before, for syscalls, any arbitrary callee-saved registers can +besince syscall are seen as a "classic" call from ABI pov. The only different +path is the one for :manpage:`clone(2)`. For this path, since the child expects +to find same callee-registers content than its parent, they must be saved +before executing the :manpage:`clone(2)` syscall and restore them after that +for the child. This is done via a redefinition of ``__sys_clone`` in assembly +which will be called in place of the standard ``sys_clone``. This new call will +save callee-saved registers in ``pt_regs``. Parent will return using the +syscall standard path. Freshly spawned child however will be woken up via +``ret_from_fork`` which will restore all registers (even if caller-saved +registers are not needed).
Documentation/kvx/kvx-iommu.rst +62 -62
192 lines not on this page · raw message
Documentation/kvx/kvx-mmu.rst +115 -112
347 lines not on this page · raw message
Documentation/kvx/kvx-smp.rst +14 -15
@@ -2,30 +2,29 @@ Symmetric Multiprocessing Implementation in kvx =============================================== -On kvx, 5 clusters are organized as groups of 16 processors + 1 -secure core (RM) for each cluster. These 17 processors are L1$ coherent -for TCM (tightly Coupled Memory). A mixed hw/sw L2$ is present to have -cache coherency on DDR as well as TCM. -The RM manager is not meant to run Linux so, 16 processors are available -for SMP. +On kvx, 5 clusters are organized as groups of 16 processors + 1 secure core +(RM) for each cluster. These 17 processors are L1$ coherent for TCM (tightly +Coupled Memory). There is also a mixed hw/sw L2$ to provide cache coherency on +DDR as well as TCM. As the secure core (RM) is not meant to run the kernel, +the rest 16 processors are available for SMP. Booting ======= -When booting the kvx processor, only the RM is woken up. This RM will -execute a portion of code located in a section named .rm_firmware. -By default, a simple power off code is embedded in this section. -To avoid embedding the firmware in kernel sources, the section is patched -using external tools to add the L2$ firmware (and replace the default firmware). -Before executing this firmware, the RM boots the PE0. PE0 will then enable L2 +When booting the kvx processor, only the RM is woken up. This secure core will +execute a portion of code located in a section named ``.rm_firmware``. By +default, a simple power off code is embedded in this section. To avoid +embedding the firmware in kernel sources, the section is patched using external +tools to add the L2$ firmware (and replace the default firmware). Before +executing this firmware, the RM boots the PE0. PE0 will then enable L2 coherency and request will be stalled until RM boots the L2$ firmware. Locking primitives ================== -spinlock/rwlock are using the kernel standard queued spinlock/rwlocks. -These primitives are based on cmpxch and xchg. More particularly, it uses xchg16 -which is implemented as a read modify write with acswap on 32 bit word since +spinlock/rwlock are using the kernel standard queued spinlock/rwlocks. These +primitives are based on cmpxch and xchg. More particularly, it uses xchg16 +which is implemented as a read-modify-write with acswap on 32 bit word since kvx does not have cmpxchg for size < 32bits. IPI
Documentation/kvx/kvx.rst +103 -106
317 lines not on this page · raw message
Signature · 1 line
An old man doll... just what I always wanted! - Clara
Re: [PATCH 0/8] kvx documentation improv (was: Re: [RFC PATCH 01/25] Documentation: kvx: Add basic documentation)
In reply to Bagas SanjayaHi Bagas,
Quoted 24 lines · Bagas Sanjaya
Quoted 23 lines · Jonathan Corbet
Quoted 22 lines
Add some documentation for kvx arch and its Linux port.
CC Jonathan Corbet <[email protected]>Co-developed-by Clement Leger <[email protected]>Signed-off-by Clement Leger <[email protected]>Co-developed-by Guillaume Thouvenin <[email protected]>Signed-off-by Guillaume Thouvenin <[email protected]>Signed-off-by Yann Sionneau <[email protected]>--- Documentation/kvx/kvx-exceptions.txt | 246 ++++++++++++++++++++++++ Documentation/kvx/kvx-iommu.txt | 183 ++++++++++++++++++ Documentation/kvx/kvx-mmu.txt | 272 +++++++++++++++++++++++++++ Documentation/kvx/kvx-smp.txt | 36 ++++ Documentation/kvx/kvx.txt | 268 ++++++++++++++++++++++++++ 5 files changed, 1005 insertions(+) create mode 100644 Documentation/kvx/kvx-exceptions.txt create mode 100644 Documentation/kvx/kvx-iommu.txt create mode 100644 Documentation/kvx/kvx-mmu.txt create mode 100644 Documentation/kvx/kvx-smp.txt create mode 100644 Documentation/kvx/kvx.txt
Quoted 5 lines
Quoted 2 lines
Please write this documentation in the RST format (you're 95% of the way there now) and incorporate into the kernel docs build.
Here is the polished documentation in reST format. Yann, can you please squash this series into your documentation patch?
Thanks a lot, I've already converted the documentation to reST, but I will take a look at this series and see what I can apply.
Quoted 42 lines
Bagas Sanjaya (8):
Documentation: kvx: Convert to reST
Documentation: kvx: Wrap diagrams in literal code block
Documentation: kvx: Fix lists
Documentation: kvx: kvx-iommu: Use reST syntax for subsections
Documentation: kvx: kvx-iommu: monospacize kvx iommu device tree path
Documentation: kvx: Promote title headings
Documentation: kvx: Use literal code block for command-line inputs
Documentation: kvx: rewordDocumentation/arch.rst | 1 + Documentation/kvx/index.rst | 12 ++ Documentation/kvx/kvx-exceptions.rst | 258 +++++++++++++++++++++++ Documentation/kvx/kvx-exceptions.txt | 246 ---------------------- Documentation/kvx/kvx-iommu.rst | 188 +++++++++++++++++ Documentation/kvx/kvx-iommu.txt | 183 ----------------- Documentation/kvx/kvx-mmu.rst | 294 +++++++++++++++++++++++++++ Documentation/kvx/kvx-mmu.txt | 272 ------------------------- Documentation/kvx/kvx-smp.rst | 36 ++++ Documentation/kvx/kvx-smp.txt | 36 ---- Documentation/kvx/kvx.rst | 269 ++++++++++++++++++++++++ Documentation/kvx/kvx.txt | 268 ------------------------ 12 files changed, 1058 insertions(+), 1005 deletions(-) create mode 100644 Documentation/kvx/index.rst create mode 100644 Documentation/kvx/kvx-exceptions.rst delete mode 100644 Documentation/kvx/kvx-exceptions.txt create mode 100644 Documentation/kvx/kvx-iommu.rst delete mode 100644 Documentation/kvx/kvx-iommu.txt create mode 100644 Documentation/kvx/kvx-mmu.rst delete mode 100644 Documentation/kvx/kvx-mmu.txt create mode 100644 Documentation/kvx/kvx-smp.rst delete mode 100644 Documentation/kvx/kvx-smp.txt create mode 100644 Documentation/kvx/kvx.rst delete mode 100644 Documentation/kvx/kvx.txtSignature · 1 line
An old man doll... just what I always wanted! - Clara
Randy Dunlap
reviewerRe: [PATCH 0/8] kvx documentation improv (was: Re: [RFC PATCH 01/25] Documentation: kvx: Add basic documentation)
In reply to Bagas SanjayaHi Bagas,
Quoted 3 lines · Bagas Sanjaya
Quoted 2 lines · Jonathan Corbet
Quoted 2 lines
Add some documentation for kvx arch and its Linux port.
...
Quoted 6 lines
Quoted 3 lines
Please write this documentation in the RST format (you're 95% of the way there now) and incorporate into the kernel docs build.
Here is the polished documentation in reST format. Yann, can you please squash this series into your documentation patch?
JFYI, to me "improv" applies mostly to jazz (music) or comedy. :)
https://www.merriam-webster.com/dictionary/improv
https://en.wikipedia.org/wiki/Improv
Thanks for the patches.
Signature · 1 line
~Randy
Re: [RFC PATCH 01/25] Documentation: kvx: Add basic documentation
In reply to Jonathan CorbetQuoted 24 lines · Jonathan Corbet
Quoted 17 lines · Yann Sionneau
Add some documentation for kvx arch and its Linux port.
CC Jonathan Corbet <[email protected]>Co-developed-by Clement Leger <[email protected]>Signed-off-by Clement Leger <[email protected]>Co-developed-by Guillaume Thouvenin <[email protected]>Signed-off-by Guillaume Thouvenin <[email protected]>Signed-off-by Yann Sionneau <[email protected]>--- Documentation/kvx/kvx-exceptions.txt | 246 ++++++++++++++++++++++++ Documentation/kvx/kvx-iommu.txt | 183 ++++++++++++++++++ Documentation/kvx/kvx-mmu.txt | 272 +++++++++++++++++++++++++++ Documentation/kvx/kvx-smp.txt | 36 ++++ Documentation/kvx/kvx.txt | 268 ++++++++++++++++++++++++++ 5 files changed, 1005 insertions(+)Quoted 5 lines
create mode 100644
Documentation/kvx/kvx-exceptions.txtcreate mode 100644Documentation/kvx/kvx-iommu.txtcreate mode 100644Documentation/kvx/kvx-mmu.txtcreate mode 100644Documentation/kvx/kvx-smp.txtcreate mode 100644Documentation/kvx/kvx.txt
Quoted 2 lines
Please write this documentation in the RST format (you're 95% of the way there now) and incorporate into the kernel docs build.
Ack, it will be part of the V2, thanks for the review.
Signature · 1 line
Yann
kernel test robot
build botRe: [RFC PATCH 01/25] Documentation: kvx: Add basic documentation
In reply to Yann Sionneau[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in…
Hi Yann,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on tip/irq/core]
[also build test WARNING on kees/for-next/execve soc/for-next linus/master v6.2-rc2 next-20230105] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Yann-Sionneau/Documentation-kvx-Add-basic-documentation/20230104-010703 patch link: https://lore.kernel.org/r/20230103164359.24347-2-ysionneau%40kalray.eu patch subject: [RFC PATCH 01/25] Documentation: kvx: Add basic documentation reproduce: # https://github.com/intel-lab-lkp/linux/commit/4ac33edac5947a08dadef4d4f4fb2211758220b7 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Yann-Sionneau/Documentation-kvx-Add-basic-documentation/20230104-010703 git checkout 4ac33edac5947a08dadef4d4f4fb2211758220b7 make menuconfig # enable CONFIG_COMPILE_TEST, CONFIG_WARN_MISSING_DOCUMENTS, CONFIG_WARN_ABI_ERRORS make htmldocs
If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <[email protected]>
All warnings (new ones prefixed by >>):
>> Warning: Documentation/kvx/kvx-iommu.txt references a file that doesn't exist: Documentation/devicetree/bindings/iommu/kalray,kvx-iommu.txt
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86_64 6.1.0-rc5 Kernel Configuration
#CONFIG_CC_VERSION_TEXT="gcc-11 (Debian 11.3.0-8) 11.3.0" CONFIG_CC_IS_GCC=yCONFIG_GCC_VERSION=110300 CONFIG_CLANG_VERSION=0CONFIG_AS_IS_GNU=yCONFIG_AS_VERSION=23900CONFIG_LD_IS_BFD=yCONFIG_LD_VERSION=23900CONFIG_LLD_VERSION=0CONFIG_CC_CAN_LINK=y CONFIG_CC_CAN_LINK_STATIC=y CONFIG_CC_HAS_ASM_GOTO_OUTPUT=y CONFIG_CC_HAS_ASM_INLINE=y CONFIG_CC_HAS_NO_PROFILE_FN_ATTR=y CONFIG_PAHOLE_VERSION=123CONFIG_IRQ_WORK=yCONFIG_BUILDTIME_TABLE_SORT=y CONFIG_THREAD_INFO_IN_TASK=y
#
# General setup
#CONFIG_BROKEN_ON_SMP=yCONFIG_INIT_ENV_ARG_LIMIT=32CONFIG_COMPILE_TEST=y
# CONFIG_WERROR is not setCONFIG_LOCALVERSION=""CONFIG_BUILD_SALT=""CONFIG_HAVE_KERNEL_GZIP=yCONFIG_HAVE_KERNEL_BZIP2=yCONFIG_HAVE_KERNEL_LZMA=yCONFIG_HAVE_KERNEL_XZ=yCONFIG_HAVE_KERNEL_LZO=yCONFIG_HAVE_KERNEL_LZ4=yCONFIG_HAVE_KERNEL_ZSTD=yCONFIG_KERNEL_GZIP=y
# CONFIG_KERNEL_BZIP2 is not set
# CONFIG_KERNEL_LZMA is not set
# CONFIG_KERNEL_XZ is not set
# CONFIG_KERNEL_LZO is not set
# CONFIG_KERNEL_LZ4 is not set
# CONFIG_KERNEL_ZSTD is not setCONFIG_DEFAULT_INIT=""CONFIG_DEFAULT_HOSTNAME="(none)"
# CONFIG_SYSVIPC is not set
# CONFIG_WATCH_QUEUE is not set
# CONFIG_CROSS_MEMORY_ATTACH is not set
# CONFIG_USELIB is not setCONFIG_HAVE_ARCH_AUDITSYSCALL=y
#
# IRQ subsystem
#CONFIG_GENERIC_IRQ_PROBE=yCONFIG_GENERIC_IRQ_SHOW=yCONFIG_HARDIRQS_SW_RESEND=yCONFIG_IRQ_DOMAIN=yCONFIG_IRQ_DOMAIN_HIERARCHY=yCONFIG_GENERIC_IRQ_MATRIX_ALLOCATOR=yCONFIG_GENERIC_IRQ_RESERVATION_MODE=yCONFIG_IRQ_FORCED_THREADING=yCONFIG_SPARSE_IRQ=y
# end of IRQ subsystem
CONFIG_CLOCKSOURCE_WATCHDOG=yCONFIG_ARCH_CLOCKSOURCE_INIT=yCONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE=yCONFIG_GENERIC_TIME_VSYSCALL=yCONFIG_GENERIC_CLOCKEVENTS=yCONFIG_GENERIC_CLOCKEVENTS_BROADCAST=yCONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST=yCONFIG_GENERIC_CMOS_UPDATE=yCONFIG_HAVE_POSIX_CPU_TIMERS_TASK_WORK=yCONFIG_POSIX_CPU_TIMERS_TASK_WORK=y
#
# Timers subsystem
#CONFIG_HZ_PERIODIC=y
# CONFIG_NO_HZ_IDLE is not set
# CONFIG_NO_HZ is not set
# CONFIG_HIGH_RES_TIMERS is not setCONFIG_CLOCKSOURCE_WATCHDOG_MAX_SKEW_US=100
# end of Timers subsystem
CONFIG_HAVE_EBPF_JIT=yCONFIG_ARCH_WANT_DEFAULT_BPF_JIT=y
#
# BPF subsystem
#
# CONFIG_BPF_SYSCALL is not set
# end of BPF subsystem
CONFIG_PREEMPT_NONE_BUILD=yCONFIG_PREEMPT_NONE=y
# CONFIG_PREEMPT_VOLUNTARY is not set
# CONFIG_PREEMPT is not set
# CONFIG_PREEMPT_DYNAMIC is not set
#
# CPU/Task time and stats accounting
#CONFIG_TICK_CPU_ACCOUNTING=y
# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set
# CONFIG_IRQ_TIME_ACCOUNTING is not set
# CONFIG_BSD_PROCESS_ACCT is not set
# CONFIG_PSI is not set
# end of CPU/Task time and stats accounting
CONFIG_CPU_ISOLATION=y
#
# RCU Subsystem
#CONFIG_TINY_RCU=y
# CONFIG_RCU_EXPERT is not setCONFIG_SRCU=yCONFIG_TINY_SRCU=y
# end of RCU Subsystem
# CONFIG_IKCONFIG is not set
# CONFIG_IKHEADERS is not setCONFIG_LOG_BUF_SHIFT=17CONFIG_PRINTK_SAFE_LOG_BUF_SHIFT=13CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y
#
# Scheduler features
#
# end of Scheduler features
CONFIG_ARCH_SUPPORTS_NUMA_BALANCING=y CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH=y CONFIG_CC_HAS_INT128=y CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" CONFIG_GCC12_NO_ARRAY_BOUNDS=y CONFIG_ARCH_SUPPORTS_INT128=y
# CONFIG_CGROUPS is not setCONFIG_NAMESPACES=y
# CONFIG_UTS_NS is not set
# CONFIG_TIME_NS is not set
# CONFIG_USER_NS is not set
# CONFIG_PID_NS is not set
# CONFIG_CHECKPOINT_RESTORE is not set
# CONFIG_SCHED_AUTOGROUP is not set
# CONFIG_SYSFS_DEPRECATED is not set
# CONFIG_RELAY is not set
# CONFIG_BLK_DEV_INITRD is not set
# CONFIG_BOOT_CONFIG is not set
# CONFIG_INITRAMFS_PRESERVE_MTIME is not set CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y
# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set CONFIG_LD_ORPHAN_WARN=yCONFIG_SYSCTL=yCONFIG_SYSCTL_EXCEPTION_TRACE=y CONFIG_HAVE_PCSPKR_PLATFORM=y
# CONFIG_EXPERT is not setCONFIG_MULTIUSER=yCONFIG_SGETMASK_SYSCALL=yCONFIG_SYSFS_SYSCALL=yCONFIG_FHANDLE=yCONFIG_POSIX_TIMERS=yCONFIG_PRINTK=yCONFIG_BUG=yCONFIG_ELF_CORE=yCONFIG_PCSPKR_PLATFORM=yCONFIG_BASE_FULL=yCONFIG_FUTEX=yCONFIG_FUTEX_PI=yCONFIG_EPOLL=yCONFIG_SIGNALFD=yCONFIG_TIMERFD=yCONFIG_EVENTFD=yCONFIG_SHMEM=yCONFIG_AIO=yCONFIG_IO_URING=yCONFIG_ADVISE_SYSCALLS=yCONFIG_MEMBARRIER=yCONFIG_KALLSYMS=y CONFIG_KALLSYMS_BASE_RELATIVE=y CONFIG_ARCH_HAS_MEMBARRIER_SYNC_CORE=y CONFIG_RSEQ=y
# CONFIG_EMBEDDED is not set CONFIG_HAVE_PERF_EVENTS=y
#
# Kernel Performance Events And Counters
#CONFIG_PERF_EVENTS=y
# end of Kernel Performance Events And Counters
# CONFIG_PROFILING is not set
# end of General setup
CONFIG_64BIT=yCONFIG_X86_64=yCONFIG_X86=yCONFIG_INSTRUCTION_DECODER=yCONFIG_OUTPUT_FORMAT="elf64-x86-64"CONFIG_LOCKDEP_SUPPORT=yCONFIG_STACKTRACE_SUPPORT=yCONFIG_MMU=yCONFIG_ARCH_MMAP_RND_BITS_MIN=28CONFIG_ARCH_MMAP_RND_BITS_MAX=32CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=8CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=16CONFIG_GENERIC_ISA_DMA=yCONFIG_GENERIC_BUG=yCONFIG_GENERIC_BUG_RELATIVE_POINTERS=yCONFIG_ARCH_MAY_HAVE_PC_FDC=yCONFIG_GENERIC_CALIBRATE_DELAY=yCONFIG_ARCH_HAS_CPU_RELAX=yCONFIG_ARCH_HIBERNATION_POSSIBLE=yCONFIG_ARCH_NR_GPIO=1024CONFIG_ARCH_SUSPEND_POSSIBLE=yCONFIG_AUDIT_ARCH=yCONFIG_ARCH_SUPPORTS_UPROBES=yCONFIG_FIX_EARLYCON_MEM=yCONFIG_PGTABLE_LEVELS=4CONFIG_CC_HAS_SANE_STACKPROTECTOR=y
#
# Processor type and features
#
# CONFIG_SMP is not set CONFIG_X86_FEATURE_NAMES=y CONFIG_X86_MPPARSE=y
# CONFIG_GOLDFISH is not set
# CONFIG_X86_CPU_RESCTRL is not set
# CONFIG_X86_EXTENDED_PLATFORM is not set
# CONFIG_SCHED_OMIT_FRAME_POINTER is not set # CONFIG_HYPERVISOR_GUEST is not set
# CONFIG_MK8 is not set
# CONFIG_MPSC is not set
# CONFIG_MCORE2 is not set
# CONFIG_MATOM is not set CONFIG_GENERIC_CPU=y CONFIG_X86_INTERNODE_CACHE_SHIFT=6 CONFIG_X86_L1_CACHE_SHIFT=6CONFIG_X86_TSC=yCONFIG_X86_CMPXCHG64=yCONFIG_X86_CMOV=y CONFIG_X86_MINIMUM_CPU_FAMILY=64 CONFIG_X86_DEBUGCTLMSR=y CONFIG_IA32_FEAT_CTL=y CONFIG_X86_VMX_FEATURE_NAMES=y CONFIG_CPU_SUP_INTEL=yCONFIG_CPU_SUP_AMD=yCONFIG_CPU_SUP_HYGON=y CONFIG_CPU_SUP_CENTAUR=y CONFIG_CPU_SUP_ZHAOXIN=yCONFIG_HPET_TIMER=yCONFIG_DMI=yCONFIG_NR_CPUS_RANGE_BEGIN=1 CONFIG_NR_CPUS_RANGE_END=1 CONFIG_NR_CPUS_DEFAULT=1CONFIG_NR_CPUS=1CONFIG_UP_LATE_INIT=y CONFIG_X86_LOCAL_APIC=yCONFIG_X86_IO_APIC=y
# CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS is not set # CONFIG_X86_MCE is not set
#
# Performance monitoring
#
# CONFIG_PERF_EVENTS_AMD_POWER is not set
# CONFIG_PERF_EVENTS_AMD_UNCORE is not set
# CONFIG_PERF_EVENTS_AMD_BRS is not set
# end of Performance monitoring
CONFIG_X86_16BIT=yCONFIG_X86_ESPFIX64=y CONFIG_X86_VSYSCALL_EMULATION=y
# CONFIG_X86_IOPL_IOPERM is not set
# CONFIG_MICROCODE is not set
# CONFIG_X86_MSR is not set
# CONFIG_X86_CPUID is not set
# CONFIG_X86_5LEVEL is not set CONFIG_X86_DIRECT_GBPAGES=y
# CONFIG_AMD_MEM_ENCRYPT is not set CONFIG_ARCH_SPARSEMEM_ENABLE=y CONFIG_ARCH_SPARSEMEM_DEFAULT=y CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 # CONFIG_X86_CHECK_BIOS_CORRUPTION is not set CONFIG_MTRR=y
# CONFIG_MTRR_SANITIZER is not set CONFIG_X86_PAT=y CONFIG_ARCH_USES_PG_UNCACHED=y CONFIG_X86_UMIP=yCONFIG_CC_HAS_IBT=y
# CONFIG_X86_KERNEL_IBT is not set
# CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS is not set CONFIG_X86_INTEL_TSX_MODE_OFF=y
# CONFIG_X86_INTEL_TSX_MODE_ON is not set
# CONFIG_X86_INTEL_TSX_MODE_AUTO is not set # CONFIG_HZ_100 is not setCONFIG_HZ_250=y
# CONFIG_HZ_300 is not set
# CONFIG_HZ_1000 is not setCONFIG_HZ=250
# CONFIG_KEXEC is not set
# CONFIG_CRASH_DUMP is not set CONFIG_PHYSICAL_START=0x1000000
# CONFIG_RELOCATABLE is not set CONFIG_PHYSICAL_ALIGN=0x200000 CONFIG_LEGACY_VSYSCALL_XONLY=y
# CONFIG_LEGACY_VSYSCALL_NONE is not set
# CONFIG_CMDLINE_BOOL is not set CONFIG_MODIFY_LDT_SYSCALL=y
# CONFIG_STRICT_SIGALTSTACK_SIZE is not set CONFIG_HAVE_LIVEPATCH=y
# end of Processor type and features
CONFIG_CC_HAS_SLS=yCONFIG_CC_HAS_RETURN_THUNK=y
# CONFIG_SPECULATION_MITIGATIONS is not setCONFIG_ARCH_HAS_ADD_PAGES=yCONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE=y
#
# Power management and ACPI options
#
# CONFIG_SUSPEND is not set
# CONFIG_PM is not setCONFIG_ARCH_SUPPORTS_ACPI=y
# CONFIG_ACPI is not set
#
# CPU Frequency scaling
#
# CONFIG_CPU_FREQ is not set
# end of CPU Frequency scaling
#
# CPU Idle
#
# CONFIG_CPU_IDLE is not set
# end of CPU Idle # end of Power management and ACPI options
#
# Bus options (PCI etc.)
#CONFIG_ISA_DMA_API=y
# end of Bus options (PCI etc.)
#
# Binary Emulations
#
# CONFIG_IA32_EMULATION is not set
# CONFIG_X86_X32_ABI is not set
# end of Binary Emulations
CONFIG_HAVE_KVM=y
# CONFIG_VIRTUALIZATION is not setCONFIG_AS_AVX512=yCONFIG_AS_SHA1_NI=yCONFIG_AS_SHA256_NI=yCONFIG_AS_TPAUSE=y
#
# General architecture-dependent options
#CONFIG_GENERIC_ENTRY=y
# CONFIG_JUMP_LABEL is not set
# CONFIG_STATIC_CALL_SELFTEST is not set CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y CONFIG_ARCH_USE_BUILTIN_BSWAP=y CONFIG_HAVE_IOREMAP_PROT=y CONFIG_HAVE_KPROBES=y CONFIG_HAVE_KRETPROBES=y CONFIG_HAVE_OPTPROBES=y CONFIG_HAVE_KPROBES_ON_FTRACE=y CONFIG_ARCH_CORRECT_STACKTRACE_ON_KRETPROBE=y CONFIG_HAVE_FUNCTION_ERROR_INJECTION=y CONFIG_HAVE_NMI=y CONFIG_TRACE_IRQFLAGS_SUPPORT=y CONFIG_TRACE_IRQFLAGS_NMI_SUPPORT=y CONFIG_HAVE_ARCH_TRACEHOOK=y CONFIG_HAVE_DMA_CONTIGUOUS=y CONFIG_GENERIC_SMP_IDLE_THREAD=y CONFIG_ARCH_HAS_FORTIFY_SOURCE=y CONFIG_ARCH_HAS_SET_MEMORY=y CONFIG_ARCH_HAS_SET_DIRECT_MAP=y CONFIG_HAVE_ARCH_THREAD_STRUCT_WHITELIST=y CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT=y CONFIG_ARCH_WANTS_NO_INSTR=y CONFIG_HAVE_ASM_MODVERSIONS=y CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y CONFIG_HAVE_RSEQ=yCONFIG_HAVE_RUST=y CONFIG_HAVE_FUNCTION_ARG_ACCESS_API=y CONFIG_HAVE_HW_BREAKPOINT=y CONFIG_HAVE_MIXED_BREAKPOINTS_REGS=y CONFIG_HAVE_USER_RETURN_NOTIFIER=y CONFIG_HAVE_PERF_EVENTS_NMI=y CONFIG_HAVE_HARDLOCKUP_DETECTOR_PERF=y CONFIG_HAVE_PERF_REGS=y CONFIG_HAVE_PERF_USER_STACK_DUMP=y CONFIG_HAVE_ARCH_JUMP_LABEL=y CONFIG_HAVE_ARCH_JUMP_LABEL_RELATIVE=y CONFIG_MMU_GATHER_MERGE_VMAS=y CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y CONFIG_HAVE_ALIGNED_STRUCT_PAGE=y CONFIG_HAVE_CMPXCHG_LOCAL=y CONFIG_HAVE_CMPXCHG_DOUBLE=y CONFIG_HAVE_ARCH_SECCOMP=y CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
# CONFIG_SECCOMP is not set CONFIG_HAVE_ARCH_STACKLEAK=y CONFIG_HAVE_STACKPROTECTOR=y
# CONFIG_STACKPROTECTOR is not set CONFIG_ARCH_SUPPORTS_LTO_CLANG=y CONFIG_ARCH_SUPPORTS_LTO_CLANG_THIN=y CONFIG_LTO_NONE=y CONFIG_ARCH_SUPPORTS_CFI_CLANG=y CONFIG_HAVE_ARCH_WITHIN_STACK_FRAMES=y CONFIG_HAVE_CONTEXT_TRACKING_USER=y CONFIG_HAVE_CONTEXT_TRACKING_USER_OFFSTACK=y CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y CONFIG_HAVE_MOVE_PUD=y CONFIG_HAVE_MOVE_PMD=y CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD=y CONFIG_HAVE_ARCH_HUGE_VMAP=y CONFIG_HAVE_ARCH_HUGE_VMALLOC=y CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y CONFIG_HAVE_ARCH_SOFT_DIRTY=y CONFIG_HAVE_MOD_ARCH_SPECIFIC=y CONFIG_MODULES_USE_ELF_RELA=y CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK=y CONFIG_HAVE_SOFTIRQ_ON_OWN_STACK=y CONFIG_SOFTIRQ_ON_OWN_STACK=y CONFIG_ARCH_HAS_ELF_RANDOMIZE=y CONFIG_HAVE_ARCH_MMAP_RND_BITS=y CONFIG_HAVE_EXIT_THREAD=y CONFIG_ARCH_MMAP_RND_BITS=28 CONFIG_PAGE_SIZE_LESS_THAN_64KB=y CONFIG_PAGE_SIZE_LESS_THAN_256KB=y CONFIG_HAVE_OBJTOOL=y CONFIG_HAVE_JUMP_LABEL_HACK=y CONFIG_HAVE_NOINSTR_HACK=y CONFIG_HAVE_NOINSTR_VALIDATION=y CONFIG_HAVE_UACCESS_VALIDATION=y CONFIG_HAVE_STACK_VALIDATION=y CONFIG_HAVE_RELIABLE_STACKTRACE=y
# CONFIG_COMPAT_32BIT_TIME is not set CONFIG_HAVE_ARCH_VMAP_STACK=y
# CONFIG_VMAP_STACK is not set CONFIG_HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET=y CONFIG_RANDOMIZE_KSTACK_OFFSET=y
# CONFIG_RANDOMIZE_KSTACK_OFFSET_DEFAULT is not set CONFIG_ARCH_HAS_STRICT_KERNEL_RWX=y CONFIG_STRICT_KERNEL_RWX=y CONFIG_ARCH_HAS_STRICT_MODULE_RWX=y CONFIG_HAVE_ARCH_PREL32_RELOCATIONS=y CONFIG_ARCH_HAS_MEM_ENCRYPT=y CONFIG_HAVE_STATIC_CALL=y CONFIG_HAVE_STATIC_CALL_INLINE=y CONFIG_HAVE_PREEMPT_DYNAMIC=y CONFIG_HAVE_PREEMPT_DYNAMIC_CALL=y CONFIG_ARCH_WANT_LD_ORPHAN_WARN=y CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y CONFIG_ARCH_SUPPORTS_PAGE_TABLE_CHECK=y CONFIG_ARCH_HAS_ELFCORE_COMPAT=y CONFIG_ARCH_HAS_PARANOID_L1D_FLUSH=y CONFIG_DYNAMIC_SIGFRAME=y CONFIG_ARCH_HAS_NONLEAF_PMD_YOUNG=y
#
# GCOV-based kernel profiling
#CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y
# end of GCOV-based kernel profiling
CONFIG_HAVE_GCC_PLUGINS=y
# CONFIG_GCC_PLUGINS is not set
# end of General architecture-dependent options
CONFIG_RT_MUTEXES=yCONFIG_BASE_SMALL=0
# CONFIG_MODULES is not setCONFIG_BLOCK=y
# CONFIG_BLOCK_LEGACY_AUTOLOAD is not set
# CONFIG_BLK_DEV_BSGLIB is not set
# CONFIG_BLK_DEV_INTEGRITY is not set
# CONFIG_BLK_DEV_ZONED is not set
# CONFIG_BLK_WBT is not set
# CONFIG_BLK_SED_OPAL is not set
# CONFIG_BLK_INLINE_ENCRYPTION is not set
#
# Partition Types
#
# CONFIG_PARTITION_ADVANCED is not setCONFIG_MSDOS_PARTITION=yCONFIG_EFI_PARTITION=y
# end of Partition Types
#
# IO Schedulers
#
# CONFIG_MQ_IOSCHED_DEADLINE is not set
# CONFIG_MQ_IOSCHED_KYBER is not set
# CONFIG_IOSCHED_BFQ is not set
# end of IO Schedulers
CONFIG_INLINE_SPIN_UNLOCK_IRQ=yCONFIG_INLINE_READ_UNLOCK=yCONFIG_INLINE_READ_UNLOCK_IRQ=yCONFIG_INLINE_WRITE_UNLOCK=yCONFIG_INLINE_WRITE_UNLOCK_IRQ=yCONFIG_ARCH_SUPPORTS_ATOMIC_RMW=yCONFIG_ARCH_USE_QUEUED_SPINLOCKS=yCONFIG_ARCH_USE_QUEUED_RWLOCKS=yCONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE=yCONFIG_ARCH_HAS_SYNC_CORE_BEFORE_USERMODE=yCONFIG_ARCH_HAS_SYSCALL_WRAPPER=y
#
# Executable file formats
#
# CONFIG_BINFMT_ELF is not set
# CONFIG_BINFMT_SCRIPT is not set
# CONFIG_BINFMT_MISC is not setCONFIG_COREDUMP=y
# end of Executable file formats
#
# Memory Management options
#
# CONFIG_SWAP is not set
#
# SLAB allocator options
#
# CONFIG_SLAB is not setCONFIG_SLUB=y
# CONFIG_SLAB_MERGE_DEFAULT is not set
# CONFIG_SLAB_FREELIST_RANDOM is not set
# CONFIG_SLAB_FREELIST_HARDENED is not set
# CONFIG_SLUB_STATS is not set
# end of SLAB allocator options
# CONFIG_SHUFFLE_PAGE_ALLOCATOR is not set
# CONFIG_COMPAT_BRK is not setCONFIG_SPARSEMEM=yCONFIG_SPARSEMEM_EXTREME=yCONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
# CONFIG_SPARSEMEM_VMEMMAP is not setCONFIG_HAVE_FAST_GUP=yCONFIG_EXCLUSIVE_SYSTEM_RAM=yCONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
# CONFIG_MEMORY_HOTPLUG is not setCONFIG_SPLIT_PTLOCK_CPUS=4CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK=y
# CONFIG_COMPACTION is not set
# CONFIG_PAGE_REPORTING is not setCONFIG_PHYS_ADDR_T_64BIT=y
# CONFIG_KSM is not setCONFIG_DEFAULT_MMAP_MIN_ADDR=4096CONFIG_ARCH_WANT_GENERAL_HUGETLB=yCONFIG_ARCH_WANTS_THP_SWAP=y
# CONFIG_TRANSPARENT_HUGEPAGE is not setCONFIG_NEED_PER_CPU_KM=yCONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=yCONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=yCONFIG_HAVE_SETUP_PER_CPU_AREA=y
# CONFIG_CMA is not setCONFIG_GENERIC_EARLY_IOREMAP=y
# CONFIG_IDLE_PAGE_TRACKING is not setCONFIG_ARCH_HAS_CACHE_LINE_SIZE=yCONFIG_ARCH_HAS_CURRENT_STACK_POINTER=yCONFIG_ARCH_HAS_PTE_DEVMAP=yCONFIG_ZONE_DMA=yCONFIG_ZONE_DMA32=yCONFIG_VM_EVENT_COUNTERS=y
# CONFIG_PERCPU_STATS is not set
#
# GUP_TEST needs to have DEBUG_FS enabled
#CONFIG_ARCH_HAS_PTE_SPECIAL=yCONFIG_SECRETMEM=y
# CONFIG_ANON_VMA_NAME is not set
# CONFIG_USERFAULTFD is not set
# CONFIG_LRU_GEN is not set
#
# Data Access Monitoring
#
# CONFIG_DAMON is not set
# end of Data Access Monitoring # end of Memory Management options
# CONFIG_NET is not set
#
# Device Drivers
#CONFIG_HAVE_EISA=y
# CONFIG_EISA is not setCONFIG_HAVE_PCI=y
# CONFIG_PCI is not set
# CONFIG_PCCARD is not set
#
# Generic Driver Options
#
# CONFIG_UEVENT_HELPER is not set
# CONFIG_DEVTMPFS is not set
# CONFIG_STANDALONE is not set
# CONFIG_PREVENT_FIRMWARE_BUILD is not set
#
# Firmware loader
#CONFIG_FW_LOADER=yCONFIG_EXTRA_FIRMWARE=""
# CONFIG_FW_LOADER_USER_HELPER is not set
# CONFIG_FW_LOADER_COMPRESS is not set
# CONFIG_FW_UPLOAD is not set
# end of Firmware loader
CONFIG_ALLOW_DEV_COREDUMP=yCONFIG_GENERIC_CPU_AUTOPROBE=yCONFIG_GENERIC_CPU_VULNERABILITIES=y
# end of Generic Driver Options
#
# Bus devices
#
# CONFIG_ARM_INTEGRATOR_LM is not set
# CONFIG_BT1_APB is not set
# CONFIG_BT1_AXI is not set
# CONFIG_HISILICON_LPC is not set
# CONFIG_INTEL_IXP4XX_EB is not set
# CONFIG_QCOM_EBI2 is not set
# CONFIG_MHI_BUS is not set
# CONFIG_MHI_BUS_EP is not set
# end of Bus devices
#
# Firmware Drivers
#
#
# ARM System Control and Management Interface Protocol #
# CONFIG_ARM_SCMI_PROTOCOL is not set
# end of ARM System Control and Management Interface Protocol
# CONFIG_EDD is not setCONFIG_FIRMWARE_MEMMAP=y
# CONFIG_DMIID is not set
# CONFIG_DMI_SYSFS is not setCONFIG_DMI_SCAN_MACHINE_NON_EFI_FALLBACK=y
# CONFIG_FW_CFG_SYSFS is not set
# CONFIG_SYSFB_SIMPLEFB is not set
# CONFIG_BCM47XX_NVRAM is not set
# CONFIG_GOOGLE_FIRMWARE is not set
#
# Tegra firmware driver
#
# end of Tegra firmware driver # end of Firmware Drivers
# CONFIG_GNSS is not set
# CONFIG_MTD is not set
# CONFIG_OF is not setCONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
# CONFIG_PARPORT is not set
# CONFIG_BLK_DEV is not set
#
# NVME Support
#
# CONFIG_NVME_FC is not set
# end of NVME Support
#
# Misc devices
#
# CONFIG_DUMMY_IRQ is not set
# CONFIG_ATMEL_SSC is not set
# CONFIG_ENCLOSURE_SERVICES is not set
# CONFIG_QCOM_COINCELL is not set
# CONFIG_SRAM is not set
# CONFIG_XILINX_SDFEC is not set
# CONFIG_C2PORT is not set
#
# EEPROM support
#
# CONFIG_EEPROM_93CX6 is not set
# end of EEPROM support
#
# Texas Instruments shared transport line discipline #
# end of Texas Instruments shared transport line discipline
#
# Altera FPGA firmware download module (requires I2C) #
# CONFIG_ECHO is not set
# CONFIG_PVPANIC is not set
# end of Misc devices
#
# SCSI device support
#CONFIG_SCSI_MOD=y
# CONFIG_RAID_ATTRS is not set
# CONFIG_SCSI is not set
# end of SCSI device support
# CONFIG_ATA is not set
# CONFIG_MD is not set
# CONFIG_TARGET_CORE is not set
#
# IEEE 1394 (FireWire) support
#
# CONFIG_FIREWIRE is not set
# end of IEEE 1394 (FireWire) support
# CONFIG_MACINTOSH_DRIVERS is not set
#
# Input device support
#CONFIG_INPUT=y
# CONFIG_INPUT_FF_MEMLESS is not set
# CONFIG_INPUT_SPARSEKMAP is not set
# CONFIG_INPUT_MATRIXKMAP is not set
#
# Userland interfaces
#
# CONFIG_INPUT_MOUSEDEV is not set
# CONFIG_INPUT_JOYDEV is not set
# CONFIG_INPUT_EVDEV is not set
# CONFIG_INPUT_EVBUG is not set
#
# Input Device Drivers
#
# CONFIG_INPUT_KEYBOARD is not set
# CONFIG_INPUT_MOUSE is not set
# CONFIG_INPUT_JOYSTICK is not set
# CONFIG_INPUT_TABLET is not set
# CONFIG_INPUT_TOUCHSCREEN is not set
# CONFIG_INPUT_MISC is not set
# CONFIG_RMI4_CORE is not set
#
# Hardware I/O ports
#
# CONFIG_SERIO is not setCONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y
# CONFIG_GAMEPORT is not set
# end of Hardware I/O ports # end of Input device support
#
# Character devices
#CONFIG_TTY=yCONFIG_VT=yCONFIG_CONSOLE_TRANSLATIONS=yCONFIG_VT_CONSOLE=yCONFIG_HW_CONSOLE=y
# CONFIG_VT_HW_CONSOLE_BINDING is not setCONFIG_UNIX98_PTYS=y
# CONFIG_LEGACY_PTYS is not set
# CONFIG_LDISC_AUTOLOAD is not set
#
# Serial drivers
#
# CONFIG_SERIAL_8250 is not set
#
# Non-8250 serial port support
#
# CONFIG_SERIAL_AMBA_PL010 is not set
# CONFIG_SERIAL_MESON is not set
# CONFIG_SERIAL_CLPS711X is not set
# CONFIG_SERIAL_SAMSUNG is not set
# CONFIG_SERIAL_TEGRA is not set
# CONFIG_SERIAL_IMX is not set
# CONFIG_SERIAL_UARTLITE is not set
# CONFIG_SERIAL_SH_SCI is not set
# CONFIG_SERIAL_MSM is not set
# CONFIG_SERIAL_VT8500 is not set
# CONFIG_SERIAL_OMAP is not set
# CONFIG_SERIAL_LANTIQ is not set
# CONFIG_SERIAL_SCCNXP is not set
# CONFIG_SERIAL_TIMBERDALE is not set
# CONFIG_SERIAL_BCM63XX is not set
# CONFIG_SERIAL_ALTERA_JTAGUART is not set
# CONFIG_SERIAL_ALTERA_UART is not set
# CONFIG_SERIAL_MXS_AUART is not set
# CONFIG_SERIAL_MPS2_UART is not set
# CONFIG_SERIAL_ARC is not set
# CONFIG_SERIAL_FSL_LPUART is not set
# CONFIG_SERIAL_FSL_LINFLEXUART is not set
# CONFIG_SERIAL_ST_ASC is not set
# CONFIG_SERIAL_STM32 is not set
# CONFIG_SERIAL_OWL is not set
# CONFIG_SERIAL_RDA is not set
# CONFIG_SERIAL_LITEUART is not set
# CONFIG_SERIAL_SUNPLUS is not set
# end of Serial drivers
# CONFIG_SERIAL_NONSTANDARD is not set
# CONFIG_NULL_TTY is not set
# CONFIG_SERIAL_DEV_BUS is not set
# CONFIG_VIRTIO_CONSOLE is not set
# CONFIG_IPMI_HANDLER is not set
# CONFIG_ASPEED_KCS_IPMI_BMC is not set
# CONFIG_NPCM7XX_KCS_IPMI_BMC is not set
# CONFIG_HW_RANDOM is not set
# CONFIG_MWAVE is not set
# CONFIG_DEVMEM is not set
# CONFIG_NVRAM is not set
# CONFIG_HANGCHECK_TIMER is not set
# CONFIG_TCG_TPM is not set
# CONFIG_TELCLOCK is not set
# CONFIG_RANDOM_TRUST_CPU is not set
# CONFIG_RANDOM_TRUST_BOOTLOADER is not set
# end of Character devices
#
# I2C support
#
# CONFIG_I2C is not set
# end of I2C support
# CONFIG_I3C is not set
# CONFIG_SPI is not set
# CONFIG_SPMI is not set
# CONFIG_HSI is not set
# CONFIG_PPS is not set
#
# PTP clock support
#CONFIG_PTP_1588_CLOCK_OPTIONAL=y
#
# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks. #
# end of PTP clock support
# CONFIG_PINCTRL is not set
# CONFIG_GPIOLIB is not set
# CONFIG_W1 is not set
# CONFIG_POWER_RESET is not set
# CONFIG_POWER_SUPPLY is not set
# CONFIG_HWMON is not set
# CONFIG_THERMAL is not set
# CONFIG_WATCHDOG is not setCONFIG_SSB_POSSIBLE=y
# CONFIG_SSB is not setCONFIG_BCMA_POSSIBLE=y
# CONFIG_BCMA is not set
#
# Multifunction device drivers
#
# CONFIG_MFD_SUN4I_GPADC is not set
# CONFIG_MFD_AT91_USART is not set
# CONFIG_MFD_MADERA is not set
# CONFIG_MFD_EXYNOS_LPASS is not set
# CONFIG_MFD_MXS_LRADC is not set
# CONFIG_MFD_MX25_TSADC is not set
# CONFIG_HTC_PASIC3 is not set
# CONFIG_MFD_KEMPLD is not set
# CONFIG_MFD_MT6397 is not set
# CONFIG_MFD_PM8XXX is not set
# CONFIG_MFD_SM501 is not set
# CONFIG_ABX500_CORE is not set
# CONFIG_MFD_SUN6I_PRCM is not set
# CONFIG_MFD_SYSCON is not set
# CONFIG_MFD_TI_AM335X_TSCADC is not set
# CONFIG_MFD_TQMX86 is not set
# CONFIG_MFD_STM32_LPTIMER is not set
# CONFIG_MFD_STM32_TIMERS is not set
# end of Multifunction device drivers
# CONFIG_REGULATOR is not set
# CONFIG_RC_CORE is not set
#
# CEC support
#
# CONFIG_MEDIA_CEC_SUPPORT is not set
# end of CEC support
# CONFIG_MEDIA_SUPPORT is not set
#
# Graphics support
#
# CONFIG_IMX_IPUV3_CORE is not set
# CONFIG_DRM is not set
#
# ARM devices
#
# end of ARM devices
#
# Frame buffer Devices
#
# CONFIG_FB is not set
# CONFIG_MMP_DISP is not set
# end of Frame buffer Devices
#
# Backlight & LCD device support
#
# CONFIG_LCD_CLASS_DEVICE is not set
# CONFIG_BACKLIGHT_CLASS_DEVICE is not set
# end of Backlight & LCD device support
#
# Console display driver support
#CONFIG_VGA_CONSOLE=yCONFIG_DUMMY_CONSOLE=yCONFIG_DUMMY_CONSOLE_COLUMNS=80CONFIG_DUMMY_CONSOLE_ROWS=25
# end of Console display driver support # end of Graphics support
# CONFIG_SOUND is not set
#
# HID support
#
# CONFIG_HID is not set
# end of HID support
CONFIG_USB_OHCI_LITTLE_ENDIAN=y
# CONFIG_USB_SUPPORT is not set
# CONFIG_MMC is not set
# CONFIG_MEMSTICK is not set
# CONFIG_NEW_LEDS is not set
# CONFIG_ACCESSIBILITY is not setCONFIG_EDAC_ATOMIC_SCRUB=yCONFIG_EDAC_SUPPORT=yCONFIG_RTC_LIB=yCONFIG_RTC_MC146818_LIB=y
# CONFIG_RTC_CLASS is not set
# CONFIG_DMADEVICES is not set
#
# DMABUF options
#
# CONFIG_SYNC_FILE is not set
# CONFIG_DMABUF_HEAPS is not set
# end of DMABUF options
# CONFIG_AUXDISPLAY is not set
# CONFIG_UIO is not set
# CONFIG_VFIO is not set
# CONFIG_VIRT_DRIVERS is not set
# CONFIG_VIRTIO_MENU is not set
# CONFIG_VHOST_MENU is not set
#
# Microsoft Hyper-V guest support
#
# end of Microsoft Hyper-V guest support
# CONFIG_GREYBUS is not set
# CONFIG_COMEDI is not set
# CONFIG_STAGING is not set
# CONFIG_CHROME_PLATFORMS is not set
# CONFIG_MELLANOX_PLATFORM is not set
# CONFIG_OLPC_XO175 is not set
# CONFIG_SURFACE_PLATFORMS is not set
# CONFIG_X86_PLATFORM_DEVICES is not set
# CONFIG_COMMON_CLK is not set
# CONFIG_HWSPINLOCK is not set
#
# Clock Source drivers
#CONFIG_CLKEVT_I8253=yCONFIG_I8253_LOCK=yCONFIG_CLKBLD_I8253=y
# CONFIG_BCM2835_TIMER is not set
# CONFIG_BCM_KONA_TIMER is not set
# CONFIG_DAVINCI_TIMER is not set
# CONFIG_DIGICOLOR_TIMER is not set
# CONFIG_OMAP_DM_TIMER is not set
# CONFIG_DW_APB_TIMER is not set
# CONFIG_FTTMR010_TIMER is not set
# CONFIG_IXP4XX_TIMER is not set
# CONFIG_MESON6_TIMER is not set
# CONFIG_OWL_TIMER is not set
# CONFIG_RDA_TIMER is not set
# CONFIG_SUN4I_TIMER is not set
# CONFIG_TEGRA_TIMER is not set
# CONFIG_VT8500_TIMER is not set
# CONFIG_NPCM7XX_TIMER is not set
# CONFIG_ASM9260_TIMER is not set
# CONFIG_CLKSRC_DBX500_PRCMU is not set
# CONFIG_CLPS711X_TIMER is not set
# CONFIG_MXS_TIMER is not set
# CONFIG_NSPIRE_TIMER is not set
# CONFIG_INTEGRATOR_AP_TIMER is not set
# CONFIG_CLKSRC_PISTACHIO is not set
# CONFIG_CLKSRC_STM32_LP is not set
# CONFIG_ARMV7M_SYSTICK is not set
# CONFIG_ATMEL_PIT is not set
# CONFIG_ATMEL_ST is not set
# CONFIG_CLKSRC_SAMSUNG_PWM is not set
# CONFIG_FSL_FTM_TIMER is not set
# CONFIG_OXNAS_RPS_TIMER is not set
# CONFIG_MTK_TIMER is not set
# CONFIG_SH_TIMER_CMT is not set
# CONFIG_SH_TIMER_MTU2 is not set
# CONFIG_RENESAS_OSTM is not set
# CONFIG_SH_TIMER_TMU is not set
# CONFIG_EM_TIMER_STI is not set
# CONFIG_CLKSRC_PXA is not set
# CONFIG_TIMER_IMX_SYS_CTR is not set
# CONFIG_CLKSRC_ST_LPC is not set
# CONFIG_GXP_TIMER is not set
# CONFIG_MSC313E_TIMER is not set
# CONFIG_MICROCHIP_PIT64B is not set
# end of Clock Source drivers
# CONFIG_MAILBOX is not set
# CONFIG_IOMMU_SUPPORT is not set
#
# Remoteproc drivers
#
# CONFIG_REMOTEPROC is not set
# end of Remoteproc drivers
#
# Rpmsg drivers
#
# CONFIG_RPMSG_VIRTIO is not set
# end of Rpmsg drivers
#
# SOC (System On Chip) specific Drivers
#
#
# Amlogic SoC drivers
#
# CONFIG_MESON_CANVAS is not set
# CONFIG_MESON_CLK_MEASURE is not set
# CONFIG_MESON_GX_SOCINFO is not set
# CONFIG_MESON_MX_SOCINFO is not set
# end of Amlogic SoC drivers
#
# Apple SoC drivers
#
# CONFIG_APPLE_SART is not set
# end of Apple SoC drivers
#
# ASPEED SoC drivers
#
# CONFIG_ASPEED_LPC_CTRL is not set
# CONFIG_ASPEED_LPC_SNOOP is not set
# CONFIG_ASPEED_UART_ROUTING is not set
# CONFIG_ASPEED_P2A_CTRL is not set
# CONFIG_ASPEED_SOCINFO is not set
# end of ASPEED SoC drivers
# CONFIG_AT91_SOC_ID is not set
# CONFIG_AT91_SOC_SFR is not set
#
# Broadcom SoC drivers
#
# CONFIG_SOC_BCM63XX is not set
# CONFIG_SOC_BRCMSTB is not set
# end of Broadcom SoC drivers
#
# NXP/Freescale QorIQ SoC drivers
#
# end of NXP/Freescale QorIQ SoC drivers
#
# fujitsu SoC drivers # # end of fujitsu SoC drivers
#
# i.MX SoC drivers
#
# CONFIG_SOC_IMX8M is not set
# CONFIG_SOC_IMX9 is not set
# end of i.MX SoC drivers
#
# IXP4xx SoC drivers
#
# CONFIG_IXP4XX_QMGR is not set
# CONFIG_IXP4XX_NPE is not set
# end of IXP4xx SoC drivers
#
# Enable LiteX SoC Builder specific drivers
#
# CONFIG_LITEX_SOC_CONTROLLER is not set
# end of Enable LiteX SoC Builder specific drivers
#
# MediaTek SoC drivers
#
# CONFIG_MTK_CMDQ is not set
# CONFIG_MTK_DEVAPC is not set
# CONFIG_MTK_INFRACFG is not set
# CONFIG_MTK_MMSYS is not set
# end of MediaTek SoC drivers
#
# Qualcomm SoC drivers
#
# CONFIG_QCOM_GENI_SE is not set
# CONFIG_QCOM_GSBI is not set
# CONFIG_QCOM_LLCC is not set
# CONFIG_QCOM_RPMH is not set
# CONFIG_QCOM_SPM is not set
# CONFIG_QCOM_ICC_BWMON is not set
# end of Qualcomm SoC drivers
# CONFIG_SOC_RENESAS is not set
# CONFIG_ROCKCHIP_GRF is not set
# CONFIG_SOC_SAMSUNG is not set
# CONFIG_SOC_TI is not set
# CONFIG_UX500_SOC_ID is not set
#
# Xilinx SoC drivers
#
# end of Xilinx SoC drivers # end of SOC (System On Chip) specific Drivers
# CONFIG_PM_DEVFREQ is not set
# CONFIG_EXTCON is not set
# CONFIG_MEMORY is not set
# CONFIG_IIO is not set
# CONFIG_PWM is not set
#
# IRQ chip support
#
# CONFIG_RENESAS_INTC_IRQPIN is not set
# CONFIG_RENESAS_IRQC is not set
# CONFIG_RENESAS_RZA1_IRQC is not set
# CONFIG_RENESAS_RZG2L_IRQC is not set
# CONFIG_SL28CPLD_INTC is not set
# CONFIG_TS4800_IRQ is not set
# CONFIG_INGENIC_TCU_IRQ is not set
# CONFIG_IRQ_UNIPHIER_AIDET is not set
# CONFIG_MESON_IRQ_GPIO is not set
# CONFIG_IMX_IRQSTEER is not set
# CONFIG_IMX_INTMUX is not set
# CONFIG_EXYNOS_IRQ_COMBINER is not set
# CONFIG_MST_IRQ is not set
# CONFIG_MCHP_EIC is not set
# CONFIG_SUNPLUS_SP7021_INTC is not set
# end of IRQ chip support
# CONFIG_IPACK_BUS is not set
# CONFIG_RESET_CONTROLLER is not set
#
# PHY Subsystem
#
# CONFIG_GENERIC_PHY is not set
# CONFIG_PHY_PISTACHIO_USB is not set
# CONFIG_PHY_CAN_TRANSCEIVER is not set
#
# PHY drivers for Broadcom platforms
#
# CONFIG_PHY_BCM63XX_USBH is not set
# CONFIG_BCM_KONA_USB2_PHY is not set
# end of PHY drivers for Broadcom platforms
# CONFIG_PHY_HI6220_USB is not set
# CONFIG_PHY_HI3660_USB is not set
# CONFIG_PHY_HI3670_USB is not set
# CONFIG_PHY_HI3670_PCIE is not set
# CONFIG_PHY_HISTB_COMBPHY is not set
# CONFIG_PHY_HISI_INNO_USB2 is not set
# CONFIG_PHY_PXA_28NM_HSIC is not set
# CONFIG_PHY_PXA_28NM_USB2 is not set
# CONFIG_PHY_PXA_USB is not set
# CONFIG_PHY_MMP3_USB is not set
# CONFIG_PHY_MMP3_HSIC is not set
# CONFIG_PHY_MT7621_PCI is not set
# CONFIG_PHY_RALINK_USB is not set
# CONFIG_PHY_RCAR_GEN3_USB3 is not set
# CONFIG_PHY_ROCKCHIP_DPHY_RX0 is not set
# CONFIG_PHY_ROCKCHIP_PCIE is not set
# CONFIG_PHY_ROCKCHIP_SNPS_PCIE3 is not set
# CONFIG_PHY_EXYNOS_MIPI_VIDEO is not set
# CONFIG_PHY_SAMSUNG_USB2 is not set
# CONFIG_PHY_ST_SPEAR1310_MIPHY is not set
# CONFIG_PHY_ST_SPEAR1340_MIPHY is not set
# CONFIG_PHY_TEGRA194_P2U is not set
# CONFIG_PHY_DA8XX_USB is not set
# CONFIG_OMAP_CONTROL_PHY is not set
# CONFIG_TI_PIPE3 is not set
# CONFIG_PHY_INTEL_KEEMBAY_EMMC is not set
# CONFIG_PHY_INTEL_KEEMBAY_USB is not set
# CONFIG_PHY_INTEL_LGM_EMMC is not set
# CONFIG_PHY_XILINX_ZYNQMP is not set
# end of PHY Subsystem
# CONFIG_POWERCAP is not set
# CONFIG_MCB is not set
#
# Performance monitor support
#
# CONFIG_ARM_CCN is not set
# CONFIG_ARM_CMN is not set
# CONFIG_FSL_IMX8_DDR_PMU is not set
# CONFIG_XGENE_PMU is not set
# CONFIG_ARM_DMC620_PMU is not set
# CONFIG_MARVELL_CN10K_TAD_PMU is not set
# CONFIG_ALIBABA_UNCORE_DRW_PMU is not set
# CONFIG_MARVELL_CN10K_DDR_PMU is not set
# end of Performance monitor support
# CONFIG_RAS is not set
#
# Android
#
# CONFIG_ANDROID_BINDER_IPC is not set
# end of Android
# CONFIG_DAX is not set
# CONFIG_NVMEM is not set
#
# HW tracing support
#
# CONFIG_STM is not set
# CONFIG_INTEL_TH is not set
# end of HW tracing support
# CONFIG_FPGA is not set
# CONFIG_TEE is not set
# CONFIG_SIOX is not set
# CONFIG_SLIMBUS is not set
# CONFIG_INTERCONNECT is not set
# CONFIG_COUNTER is not set
# CONFIG_PECI is not set
# CONFIG_HTE is not set
# end of Device Drivers
#
# File systems
#CONFIG_DCACHE_WORD_ACCESS=y
# CONFIG_VALIDATE_FS_PARSER is not set
# CONFIG_EXT2_FS is not set
# CONFIG_EXT3_FS is not set
# CONFIG_EXT4_FS is not set
# CONFIG_REISERFS_FS is not set
# CONFIG_JFS_FS is not set
# CONFIG_XFS_FS is not set
# CONFIG_GFS2_FS is not set
# CONFIG_BTRFS_FS is not set
# CONFIG_NILFS2_FS is not set
# CONFIG_F2FS_FS is not setCONFIG_EXPORTFS=y
# CONFIG_EXPORTFS_BLOCK_OPS is not setCONFIG_FILE_LOCKING=y
# CONFIG_FS_ENCRYPTION is not set
# CONFIG_FS_VERITY is not set
# CONFIG_DNOTIFY is not set
# CONFIG_INOTIFY_USER is not set
# CONFIG_FANOTIFY is not set
# CONFIG_QUOTA is not set
# CONFIG_AUTOFS4_FS is not set
# CONFIG_AUTOFS_FS is not set
# CONFIG_FUSE_FS is not set
# CONFIG_OVERLAY_FS is not set
#
# Caches
#
# CONFIG_FSCACHE is not set
# end of Caches
#
# CD-ROM/DVD Filesystems
#
# CONFIG_ISO9660_FS is not set
# CONFIG_UDF_FS is not set
# end of CD-ROM/DVD Filesystems
#
# DOS/FAT/EXFAT/NT Filesystems
#
# CONFIG_MSDOS_FS is not set
# CONFIG_VFAT_FS is not set
# CONFIG_EXFAT_FS is not set
# CONFIG_NTFS_FS is not set
# CONFIG_NTFS3_FS is not set
# end of DOS/FAT/EXFAT/NT Filesystems
#
# Pseudo filesystems
#CONFIG_PROC_FS=y
# CONFIG_PROC_KCORE is not setCONFIG_PROC_SYSCTL=yCONFIG_PROC_PAGE_MONITOR=y
# CONFIG_PROC_CHILDREN is not setCONFIG_PROC_PID_ARCH_STATUS=yCONFIG_KERNFS=yCONFIG_SYSFS=y
# CONFIG_TMPFS is not set
# CONFIG_HUGETLBFS is not setCONFIG_ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP=yCONFIG_ARCH_HAS_GIGANTIC_PAGE=y
# CONFIG_CONFIGFS_FS is not set
# end of Pseudo filesystems
# CONFIG_MISC_FILESYSTEMS is not set
# CONFIG_NLS is not set
# CONFIG_UNICODE is not setCONFIG_IO_WQ=y
# end of File systems
#
# Security options
#
# CONFIG_KEYS is not set
# CONFIG_SECURITY_DMESG_RESTRICT is not set
# CONFIG_SECURITY is not set
# CONFIG_SECURITYFS is not set CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR=y
# CONFIG_HARDENED_USERCOPY is not set
# CONFIG_FORTIFY_SOURCE is not set
# CONFIG_STATIC_USERMODEHELPER is not set CONFIG_DEFAULT_SECURITY_DAC=y CONFIG_LSM="landlock,lockdown,yama,loadpin,safesetid,integrity,bpf"
#
# Kernel hardening options
#
#
# Memory initialization
#CONFIG_INIT_STACK_NONE=y
# CONFIG_INIT_ON_ALLOC_DEFAULT_ON is not set
# CONFIG_INIT_ON_FREE_DEFAULT_ON is not setCONFIG_CC_HAS_ZERO_CALL_USED_REGS=y
# CONFIG_ZERO_CALL_USED_REGS is not set
# end of Memory initialization
CONFIG_RANDSTRUCT_NONE=y
# end of Kernel hardening options # end of Security options
# CONFIG_CRYPTO is not set
#
# Library routines
#
# CONFIG_PACKING is not setCONFIG_BITREVERSE=yCONFIG_GENERIC_STRNCPY_FROM_USER=yCONFIG_GENERIC_STRNLEN_USER=y
# CONFIG_CORDIC is not set
# CONFIG_PRIME_NUMBERS is not setCONFIG_GENERIC_PCI_IOMAP=yCONFIG_GENERIC_IOMAP=yCONFIG_ARCH_USE_CMPXCHG_LOCKREF=yCONFIG_ARCH_HAS_FAST_MULTIPLIER=yCONFIG_ARCH_USE_SYM_ANNOTATIONS=y
#
# Crypto library routines
#CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y
# CONFIG_CRYPTO_LIB_CHACHA is not set
# CONFIG_CRYPTO_LIB_CURVE25519 is not setCONFIG_CRYPTO_LIB_POLY1305_RSIZE=11
# CONFIG_CRYPTO_LIB_POLY1305 is not set
# end of Crypto library routines
# CONFIG_CRC_CCITT is not set
# CONFIG_CRC16 is not set
# CONFIG_CRC_T10DIF is not set
# CONFIG_CRC64_ROCKSOFT is not set
# CONFIG_CRC_ITU_T is not setCONFIG_CRC32=y
# CONFIG_CRC32_SELFTEST is not setCONFIG_CRC32_SLICEBY8=y
# CONFIG_CRC32_SLICEBY4 is not set
# CONFIG_CRC32_SARWATE is not set
# CONFIG_CRC32_BIT is not set
# CONFIG_CRC64 is not set
# CONFIG_CRC4 is not set
# CONFIG_CRC7 is not set
# CONFIG_LIBCRC32C is not set
# CONFIG_CRC8 is not set
# CONFIG_RANDOM32_SELFTEST is not set
# CONFIG_XZ_DEC is not setCONFIG_HAS_IOMEM=yCONFIG_HAS_IOPORT_MAP=yCONFIG_HAS_DMA=yCONFIG_NEED_SG_DMA_LENGTH=yCONFIG_NEED_DMA_MAP_STATE=yCONFIG_ARCH_DMA_ADDR_T_64BIT=yCONFIG_SWIOTLB=y
# CONFIG_DMA_API_DEBUG is not set
# CONFIG_IRQ_POLL is not setCONFIG_HAVE_GENERIC_VDSO=yCONFIG_GENERIC_GETTIMEOFDAY=yCONFIG_GENERIC_VDSO_TIME_NS=yCONFIG_ARCH_HAS_PMEM_API=yCONFIG_ARCH_HAS_UACCESS_FLUSHCACHE=yCONFIG_ARCH_HAS_COPY_MC=yCONFIG_ARCH_STACKWALK=yCONFIG_STACKDEPOT=yCONFIG_SBITMAP=y
# CONFIG_PARMAN is not set
# CONFIG_OBJAGG is not set
# end of Library routines
#
# Kernel hacking
#
#
# printk and dmesg options # # CONFIG_PRINTK_TIME is not set # CONFIG_PRINTK_CALLER is not set # CONFIG_STACKTRACE_BUILD_ID is not set CONFIG_CONSOLE_LOGLEVEL_DEFAULT=7 CONFIG_CONSOLE_LOGLEVEL_QUIET=4 CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 # CONFIG_DYNAMIC_DEBUG is not set # CONFIG_DYNAMIC_DEBUG_CORE is not set # CONFIG_SYMBOLIC_ERRNAME is not set CONFIG_DEBUG_BUGVERBOSE=y # end of printk and dmesg options
# CONFIG_DEBUG_KERNEL is not set
#
# Compile-time checks and compiler options
#CONFIG_AS_HAS_NON_CONST_LEB128=yCONFIG_FRAME_WARN=2048
# CONFIG_STRIP_ASM_SYMS is not set
# CONFIG_HEADERS_INSTALL is not setCONFIG_DEBUG_SECTION_MISMATCH=yCONFIG_SECTION_MISMATCH_WARN_ONLY=yCONFIG_OBJTOOL=y
# end of Compile-time checks and compiler options
#
# Generic Kernel Debugging Instruments
#
# CONFIG_MAGIC_SYSRQ is not set
# CONFIG_DEBUG_FS is not setCONFIG_HAVE_ARCH_KGDB=yCONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL=y
# CONFIG_UBSAN is not setCONFIG_HAVE_ARCH_KCSAN=yCONFIG_HAVE_KCSAN_COMPILER=y
# end of Generic Kernel Debugging Instruments
#
# Networking Debugging
#
# end of Networking Debugging
#
# Memory Debugging
#
# CONFIG_PAGE_EXTENSION is not setCONFIG_SLUB_DEBUG=y
# CONFIG_SLUB_DEBUG_ON is not set
# CONFIG_PAGE_TABLE_CHECK is not set
# CONFIG_PAGE_POISONING is not set
# CONFIG_DEBUG_RODATA_TEST is not setCONFIG_ARCH_HAS_DEBUG_WX=y
# CONFIG_DEBUG_WX is not setCONFIG_GENERIC_PTDUMP=yCONFIG_HAVE_DEBUG_KMEMLEAK=yCONFIG_ARCH_HAS_DEBUG_VM_PGTABLE=y
# CONFIG_DEBUG_VM_PGTABLE is not setCONFIG_ARCH_HAS_DEBUG_VIRTUAL=yCONFIG_DEBUG_MEMORY_INIT=yCONFIG_ARCH_SUPPORTS_KMAP_LOCAL_FORCE_MAP=yCONFIG_HAVE_ARCH_KASAN=yCONFIG_HAVE_ARCH_KASAN_VMALLOC=yCONFIG_CC_HAS_KASAN_GENERIC=yCONFIG_CC_HAS_WORKING_NOSANITIZE_ADDRESS=y
# CONFIG_KASAN is not setCONFIG_HAVE_ARCH_KFENCE=y
# CONFIG_KFENCE is not setCONFIG_HAVE_ARCH_KMSAN=y
# end of Memory Debugging
#
# Debug Oops, Lockups and Hangs
#
# CONFIG_PANIC_ON_OOPS is not setCONFIG_PANIC_ON_OOPS_VALUE=0CONFIG_PANIC_TIMEOUT=0CONFIG_HARDLOCKUP_CHECK_TIMESTAMP=y
# end of Debug Oops, Lockups and Hangs
#
# Scheduler Debugging
#
# end of Scheduler Debugging
# CONFIG_DEBUG_TIMEKEEPING is not set
#
# Lock Debugging (spinlocks, mutexes, etc...)
#CONFIG_LOCK_DEBUGGING_SUPPORT=y
# CONFIG_WW_MUTEX_SELFTEST is not set
# end of Lock Debugging (spinlocks, mutexes, etc...)
# CONFIG_DEBUG_IRQFLAGS is not setCONFIG_STACKTRACE=y
# CONFIG_WARN_ALL_UNSEEDED_RANDOM is not set
#
# Debug kernel data structures
#
# CONFIG_BUG_ON_DATA_CORRUPTION is not set
# end of Debug kernel data structures
#
# RCU Debugging
#
# end of RCU Debugging
CONFIG_USER_STACKTRACE_SUPPORT=yCONFIG_HAVE_RETHOOK=yCONFIG_HAVE_FUNCTION_TRACER=yCONFIG_HAVE_DYNAMIC_FTRACE=yCONFIG_HAVE_DYNAMIC_FTRACE_WITH_REGS=yCONFIG_HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS=yCONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS=yCONFIG_HAVE_DYNAMIC_FTRACE_NO_PATCHABLE=yCONFIG_HAVE_FTRACE_MCOUNT_RECORD=yCONFIG_HAVE_SYSCALL_TRACEPOINTS=yCONFIG_HAVE_FENTRY=yCONFIG_HAVE_OBJTOOL_MCOUNT=yCONFIG_HAVE_C_RECORDMCOUNT=yCONFIG_HAVE_BUILDTIME_MCOUNT_SORT=yCONFIG_TRACING_SUPPORT=y
# CONFIG_FTRACE is not set
# CONFIG_SAMPLES is not setCONFIG_HAVE_SAMPLE_FTRACE_DIRECT=yCONFIG_HAVE_SAMPLE_FTRACE_DIRECT_MULTI=yCONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y
#
# x86 Debugging # # CONFIG_X86_VERBOSE_BOOTUP is not set CONFIG_EARLY_PRINTK=y CONFIG_HAVE_MMIOTRACE_SUPPORT=y CONFIG_IO_DELAY_0X80=y # CONFIG_IO_DELAY_0XED is not set # CONFIG_IO_DELAY_UDELAY is not set # CONFIG_IO_DELAY_NONE is not set CONFIG_UNWINDER_ORC=y # CONFIG_UNWINDER_FRAME_POINTER is not set # end of x86 Debugging
#
# Kernel Testing and Coverage
#
# CONFIG_KUNIT is not setCONFIG_ARCH_HAS_KCOV=yCONFIG_CC_HAS_SANCOV_TRACE_PC=y
# CONFIG_KCOV is not set
# CONFIG_RUNTIME_TESTING_MENU is not setCONFIG_ARCH_USE_MEMTEST=y
# CONFIG_MEMTEST is not set
# end of Kernel Testing and Coverage
#
# Rust hacking
#
# end of Rust hacking
CONFIG_WARN_MISSING_DOCUMENTS=yCONFIG_WARN_ABI_ERRORS=y
# end of Kernel hacking
Re: [RFC PATCH 01/25] Documentation: kvx: Add basic documentation
In reply to Yann SionneauQuoted 23 lines · Yann Sionneau
Add some documentation for kvx arch and its Linux port.
CC Jonathan Corbet <[email protected]>Co-developed-by Clement Leger <[email protected]>Signed-off-by Clement Leger <[email protected]>Co-developed-by Guillaume Thouvenin <[email protected]>Signed-off-by Guillaume Thouvenin <[email protected]>Signed-off-by Yann Sionneau <[email protected]>--- Documentation/kvx/kvx-exceptions.txt | 246 ++++++++++++++++++++++++ Documentation/kvx/kvx-iommu.txt | 183 ++++++++++++++++++ Documentation/kvx/kvx-mmu.txt | 272 +++++++++++++++++++++++++++ Documentation/kvx/kvx-smp.txt | 36 ++++ Documentation/kvx/kvx.txt | 268 ++++++++++++++++++++++++++ 5 files changed, 1005 insertions(+) create mode 100644 Documentation/kvx/kvx-exceptions.txt create mode 100644 Documentation/kvx/kvx-iommu.txt create mode 100644 Documentation/kvx/kvx-mmu.txt create mode 100644 Documentation/kvx/kvx-smp.txt create mode 100644 Documentation/kvx/kvx.txt
[...]
Documentation/kvx/kvx.txt line 108
Quoted 13 lines
Documentation/kvx/kvx.txt new file +13
-0+Virtual and physical memory +=========================== + +The mapping used and the memory management is described in +Documentation/kvx/kvx-mmu.txt. +Our Kernel is compiled using virtual addresses that starts at +0xffffff0000000000. But when it is started the kernel uses physical addresses. +Before calling the first function arch_low_level_start() we configure 2 entries +of the LTLB. + +The first entry will map the first 1G of virtual address space to the first +1G of DDR: + - TLB[0]: 0xffffff0000000000 -> 0x100000000 (size 512Mo)
Maybe should change it to:
- TLB[0]: 0xffffff8000000000 -> 0x100000000 (size 512Mo)
As the PAGE_OFFSET = 0xffffff8000000000
[...]
Signature · 2 lines
Thanks, JeffXie
RFC PATCH 2/25 kvx: Add ELF-related definitions
In reply to Yann SionneauAdd ELF-related definitions for kvx, including: EM_KVX, AUDIT_ARCH_KVX and NT_KVX_TCA.
--- include/uapi/linux/audit.h | 1 + include/uapi/linux/elf-em.h | 1 + include/uapi/linux/elf.h | 1 + 3 files changed, 3 insertions(+)
include/uapi/linux/audit.h +1 -0
@@ -402,6 +402,7 @@ enum {#define AUDIT_ARCH_HEXAGON (EM_HEXAGON)#define AUDIT_ARCH_I386 (EM_386|__AUDIT_ARCH_LE)#define AUDIT_ARCH_IA64 (EM_IA_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) +#define AUDIT_ARCH_KVX (EM_KVX|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)#define AUDIT_ARCH_M32R (EM_M32R)#define AUDIT_ARCH_M68K (EM_68K)#define AUDIT_ARCH_MICROBLAZE (EM_MICROBLAZE)
include/uapi/linux/elf-em.h +1 -0
@@ -51,6 +51,7 @@#define EM_RISCV 243/* RISC-V */ #define EM_BPF 247/* Linux BPF - in-kernel virtual machine */ #define EM_CSKY 252/* C-SKY */ +#define EM_KVX 256/* Kalray VLIW Architecture */ #define EM_LOONGARCH 258/* LoongArch */ #define EM_FRV 0x5441/* Fujitsu FR-V */
include/uapi/linux/elf.h +1 -0
@@ -444,6 +444,7 @@ typedef struct elf64_shdr {#define NT_LOONGARCH_LSX 0xa02/* LoongArch Loongson SIMD Extension registers */ #define NT_LOONGARCH_LASX 0xa03/* LoongArch Loongson Advanced SIMD Extension registers */ #define NT_LOONGARCH_LBT 0xa04/* LoongArch Loongson Binary Translation registers */ +#define NT_KVX_TCA 0x900/* kvx TCA registers */ /* Note types with note name "GNU" */ #define NT_GNU_PROPERTY_TYPE_0 5
Signature · 1 line
2.37.2
Re: [RFC PATCH 02/25] kvx: Add ELF-related definitions
Quoted 2 lines · Yann Sionneau
Add ELF-related definitions for kvx, including:
EM_KVX,AUDIT_ARCH_KVXandNT_KVX_TCA.
Has someone written an SYSVABI architecture specification for your architecture?
I feel uncomfortable with the linux-kernel headers being the authoritative place for the ELF abi definitions.
Especially since the linux kernel does not deal with relocations, and the kernel headers could diverge from the real world and no one would notice..
I know at least at one point the linux standards base was taking up the work on collecting up some of these definitions. I would be happy if there was anything outside of the linux kernel that people could refer too.
Eric
Quoted 52 lines
CC Paul Moore <[email protected]>CC Eric Paris <[email protected]>CC Eric Biederman <[email protected]>CC Kees Cook <[email protected]>Co-developed-by Clement Leger <[email protected]>Signed-off-by Clement Leger <[email protected]>Signed-off-by Yann Sionneau <[email protected]>--- include/uapi/linux/audit.h | 1 + include/uapi/linux/elf-em.h | 1 + include/uapi/linux/elf.h | 1 + 3 files changed, 3 insertions(+)include/uapi/linux/audit.h +1
-0@@ -402,6 +402,7 @@ enum {#define AUDIT_ARCH_HEXAGON (EM_HEXAGON)#define AUDIT_ARCH_I386 (EM_386|__AUDIT_ARCH_LE)#define AUDIT_ARCH_IA64 (EM_IA_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) +#define AUDIT_ARCH_KVX (EM_KVX|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)#define AUDIT_ARCH_M32R (EM_M32R)#define AUDIT_ARCH_M68K (EM_68K)#define AUDIT_ARCH_MICROBLAZE (EM_MICROBLAZE)include/uapi/linux/elf-em.h +1
-0@@ -51,6 +51,7 @@#define EM_RISCV 243/* RISC-V */ #define EM_BPF 247/* Linux BPF - in-kernel virtual machine */ #define EM_CSKY 252/* C-SKY */ +#define EM_KVX 256/* Kalray VLIW Architecture */ #define EM_LOONGARCH 258/* LoongArch */ #define EM_FRV 0x5441/* Fujitsu FR-V */ include/uapi/linux/elf.h +1
-0@@ -444,6 +444,7 @@ typedef struct elf64_shdr {#define NT_LOONGARCH_LSX 0xa02/* LoongArch Loongson SIMD Extension registers */ #define NT_LOONGARCH_LASX 0xa03/* LoongArch Loongson Advanced SIMD Extension registers */ #define NT_LOONGARCH_LBT 0xa04/* LoongArch Loongson Binary Translation registers */ +#define NT_KVX_TCA 0x900/* kvx TCA registers */ /* Note types with note name "GNU" */ #define NT_GNU_PROPERTY_TYPE_0 5
Re: [RFC PATCH 02/25] kvx: Add ELF-related definitions
Quoted 6 lines · Eric W. Biederman
Quoted 2 lines · Yann Sionneau
Add ELF-related definitions for kvx, including:
EM_KVX,AUDIT_ARCH_KVXandNT_KVX_TCA.Has someone written an SYSVABI architecture specification for your architecture?
Internally at Kalray we have an ABI document, I started a discussion about its publication.
It will not be part of the V2, but I'm working on it.
Quoted 4 lines
I feel uncomfortable with the linux-kernel headers being the authoritative place for the ELF abi definitions.
Quoted 8 lines
Especially since the linux kernel does not deal with relocations, and the kernel headers could diverge from the real world and no one would notice..
I know at least at one point the linux standards base was taking up the work on collecting up some of these definitions. I would be happy if there was anything outside of the linux kernel that people could refer too.
I completely agree with you!
Thanks for the review.
Signature · 1 line
Yann
RFC PATCH 3/25 kvx: Add build infrastructure
In reply to Yann SionneauAdd Kbuild, Makefile, Kconfig and link script for kvx build infrastructure.
--- arch/kvx/Kconfig | 249 +++++++++++++++++++++++++++++++ arch/kvx/Kconfig.debug | 70 +++++++++ arch/kvx/Makefile | 52 +++++++ arch/kvx/include/asm/Kbuild | 20 +++ arch/kvx/include/uapi/asm/Kbuild | 1 + arch/kvx/kernel/Makefile | 27 ++++ arch/kvx/kernel/kvx_ksyms.c | 24 +++ arch/kvx/kernel/vmlinux.lds.S | 173 +++++++++++++++++++++ arch/kvx/lib/Makefile | 6 + arch/kvx/mm/Makefile | 10 ++ arch/kvx/platform/Makefile | 7 + 11 files changed, 639 insertions(+) create mode 100644 arch/kvx/Kconfig create mode 100644 arch/kvx/Kconfig.debug create mode 100644 arch/kvx/Makefile create mode 100644 arch/kvx/include/asm/Kbuild create mode 100644 arch/kvx/include/uapi/asm/Kbuild create mode 100644 arch/kvx/kernel/Makefile create mode 100644 arch/kvx/kernel/kvx_ksyms.c create mode 100644 arch/kvx/kernel/vmlinux.lds.S create mode 100644 arch/kvx/lib/Makefile create mode 100644 arch/kvx/mm/Makefile create mode 100644 arch/kvx/platform/Makefile
arch/kvx/Kconfig new file +249 -0
@@ -0,0 +1,249 @@ +# +# For a description of the syntax of this configuration file, +# see Documentation/kbuild/kconfig-language.txt. +# + +config 64BIT + def_bool y + +config GENERIC_CALIBRATE_DELAY + def_bool y + +config FIX_EARLYCON_MEM + def_bool y + +config MMU + def_bool y + +config KALLSYMS_BASE_RELATIVE + def_bool n + +config GENERIC_CSUM + def_bool y + +config RWSEM_GENERIC_SPINLOCK + def_bool y + +config GENERIC_HWEIGHT + def_bool y + +config ARCH_MMAP_RND_BITS_MAX + default 24 + +config ARCH_MMAP_RND_BITS_MIN + default 18 + +config STACKTRACE_SUPPORT + def_bool y + +config LOCKDEP_SUPPORT + def_bool y + +config GENERIC_BUG + def_bool y + depends on BUG + +config KVX_4K_PAGES + def_bool y + +config KVX + def_bool y + select ARCH_CLOCKSOURCE_DATA + select ARCH_DMA_ADDR_T_64BIT + select ARCH_HAS_DEVMEM_IS_ALLOWED + select ARCH_HAS_DMA_PREP_COHERENT + select ARCH_HAS_ELF_RANDOMIZE + select ARCH_HAS_PTE_SPECIAL + select ARCH_HAS_SETUP_DMA_OPS if IOMMU_SUPPORT + select ARCH_HAS_STRICT_KERNEL_RWX + select ARCH_HAS_STRICT_MODULE_RWX + select ARCH_HAS_SYNC_DMA_FOR_DEVICE + select ARCH_HAS_SYNC_DMA_FOR_CPU + select ARCH_HAS_TEARDOWN_DMA_OPS if IOMMU_SUPPORT + select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT + select ARCH_SUPPORTS_HUGETLBFS + select ARCH_USE_QUEUED_SPINLOCKS + select ARCH_USE_QUEUED_RWLOCKS + select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT + select ARCH_WANT_FRAME_POINTERS + select CLKSRC_OF + select COMMON_CLK + select DMA_DIRECT_REMAP + select GENERIC_ALLOCATOR + select GENERIC_CLOCKEVENTS + select GENERIC_CLOCKEVENTS + select GENERIC_CPU_DEVICES + select GENERIC_IOMAP + select GENERIC_IOREMAP + select GENERIC_IRQ_CHIP + select GENERIC_IRQ_PROBE + select GENERIC_IRQ_SHOW + select GENERIC_SCHED_CLOCK + select HAVE_ARCH_AUDITSYSCALL + select HAVE_ARCH_BITREVERSE + select HAVE_ARCH_JUMP_LABEL + select HAVE_ARCH_MMAP_RND_BITS + select HAVE_ARCH_TRACEHOOK + select HAVE_ARCH_TRANSPARENT_HUGEPAGE + select HAVE_ASM_MODVERSIONS + select HAVE_DEBUG_KMEMLEAK + select HAVE_DYNAMIC_FTRACE + select HAVE_EFFICIENT_UNALIGNED_ACCESS + select HAVE_FTRACE_MCOUNT_RECORD + select HAVE_FUTEX_CMPXCHG if FUTEX + select HAVE_FUNCTION_TRACER + select HAVE_FUNCTION_GRAPH_TRACER + select HAVE_HW_BREAKPOINT + select HAVE_IOREMAP_PROT + select HAVE_MEMBLOCK_NODE_MAP + select HAVE_PCI + select HAVE_PERF_EVENTS + select HAVE_STACKPROTECTOR + select HAVE_SYSCALL_TRACEPOINTS + select IOMMU_DMA if IOMMU_SUPPORT + select KVX_APIC_GIC + select KVX_APIC_MAILBOX + select KVX_CORE_INTC + select KVX_ITGEN + select KVX_WATCHDOG + select MODULES_USE_ELF_RELA + select OF + select OF_EARLY_FLATTREE + select OF_RESERVED_MEM + select PERF_EVENTS + select PCI_DOMAINS_GENERIC if PCI + select SPARSE_IRQ + select SYSCTL_EXCEPTION_TRACE + select THREAD_INFO_IN_TASK + select TIMER_OF + select TRACE_IRQFLAGS_SUPPORT + select WATCHDOG + select ZONE_DMA32 + +config PGTABLE_LEVELS + int + default 3 + +config HAVE_KPROBES + def_bool n + +menu "System setup" + +config POISON_INITMEM + bool "Enable to poison freed initmem" + default y + help + In order to debug initmem, using poison allows to verify if + some data/code is stille using them. Enable this for debug + purposes + +config KVX_PHYS_OFFSET + hex "RAM address of memory base" + default 0x100000000 + +config KVX_PAGE_OFFSET + hex "kernel virtual address of memory base" + default 0xFFFFFF8000000000 + +config ARCH_FLATMEM_ENABLE + def_bool y + +config ARCH_SPARSEMEM_ENABLE + def_bool y + +config ARCH_SPARSEMEM_DEFAULT + def_bool ARCH_SPARSEMEM_ENABLE + +config ARCH_SELECT_MEMORY_MODEL + def_bool ARCH_SPARSEMEM_ENABLE + +config STACK_MAX_DEPTH_TO_PRINT + int "Maximum depth of stack to print" + range 1 128 + default "24" + +config L2_CACHE + bool "Enable l2 cache driver" + default y + help + Enable L2 cache driver in order to handle it. This driver can be + disabled to eliminate any overhead related to L2 cache + inval/writeback. Note that L2 cache is mandatory for SMP in order + to maintain coherency on DDR between all PEs. + +config SECURE_DAME_HANDLING + bool "Secure DAME handling" + default y + help + In order to securely handle Data Asynchronous Memory Errors, we need + to do a barrier upon kernel entry when coming from userspace. This + barrier guarantee us that any pending DAME will be serviced right + away. We also need to do a barrier when returning from kernel to user. + This way, if the kernel or the user triggered a DAME, it will be + serviced by knowing we are coming from kernel or user and avoid + pulling the wrong lever (panic for kernel or sigfault for user). + This can be costly but ensure that user cannot interfere with kernel. + /!\ Do not disable unless you want to open a giant breach between + user and kernel /!\ + +config CACHECTL_UNSAFE_PHYS_OPERATIONS + bool "Enable cachectl syscall unsafe physical operations" + default n + help + Enable cachectl syscall to allow writebacking/invalidating ranges + based on physical addresses. These operations requires the + CAP_SYS_ADMIN capability + +config ENABLE_TCA + bool "Enable TCA coprocessor support" + default y + help + This option enables TCA coprocessor support. It will allow the user to + use the coprocessor and save registers on context switch if used. + Registers content will also be cleared when switching. + +config SMP + bool "Symmetric multi-processing support" + default n + select GENERIC_SMP_IDLE_THREAD + select GENERIC_IRQ_IPI + select IRQ_DOMAIN_HIERARCHY + select IRQ_DOMAIN + select L2_CACHE + help + This enables support for systems with more than one CPU. If you have + a system with only one CPU, say N. If you have a system with more + than one CPU, say Y. + + If you say N here, the kernel will run on uni- and multiprocessor + machines, but will use only one CPU of a multiprocessor machine. If + you say Y here, the kernel will run on many, but not all, + uniprocessor machines. On a uniprocessor machine, the kernel + will run faster if you say N here. + +config NR_CPUS + int "Maximum number of CPUs" + range 1 16 + default "16" + depends on SMP + help + Kalray support can handle a maximum of 16 CPUs. + +config KVX_PAGE_SHIFT + int + default 12 + +config CMDLINE + string "Default kernel command string" + default "" + help + On some architectures there is currently no way for the boot loader + to pass arguments to the kernel. For these architectures, you should + supply some command-line options at build time by entering them + here. + +endmenu + +menu "Kernel Features" +source "kernel/Kconfig.hz" +endmenu
arch/kvx/Kconfig.debug new file +70 -0
70 lines not on this page · raw message
arch/kvx/Makefile new file +52 -0
52 lines not on this page · raw message
arch/kvx/include/asm/Kbuild new file +20 -0
@@ -0,0 +1,20 @@ +generic-y += asm-offsets.h +generic-y += clkdev.h +generic-y += auxvec.h +generic-y += bpf_perf_event.h +generic-y += cmpxchg-local.h +generic-y += errno.h +generic-y += extable.h +generic-y += export.h +generic-y += kvm_para.h +generic-y += mcs_spinlock.h +generic-y += mman.h +generic-y += param.h +generic-y += qrwlock.h +generic-y += qspinlock.h +generic-y += rwsem.h +generic-y += sockios.h +generic-y += stat.h +generic-y += statfs.h +generic-y += ucontext.h +generic-y += user.h
arch/kvx/include/uapi/asm/Kbuild new file +1 -0
@@ -0,0 +1 @@ +
arch/kvx/kernel/Makefile new file +27 -0
@@ -0,0 +1,27 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2019-2023 Kalray Inc. +# + +ifdef CONFIG_FUNCTION_TRACER +CFLAGS_REMOVE_ftrace.o = $(CC_FLAGS_FTRACE) +CFLAGS_REMOVE_insns.o = $(CC_FLAGS_FTRACE) +endif + +CFLAGS_REMOVE_return_address.o = $(CC_FLAGS_FTRACE) + +obj-y := head.o setup.o process.o traps.o common.o time.o prom.o kvx_ksyms.o \ + irq.o cpuinfo.o ptrace.o entry.o syscall_table.o signal.o sys_kvx.o \ + stacktrace.o dame_handler.o vdso.o perf_event.o return_address.o \ + insns.o break_hook.o reset.o io.o debug.o + +obj-$(CONFIG_JUMP_LABEL) += jump_label.o +obj-$(CONFIG_SMP) += smp.o smpboot.o +obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o +obj-$(CONFIG_MODULES) += module.o +obj-$(CONFIG_KGDB) += kgdb.o +CFLAGS_module.o += -Wstrict-overflow -fstrict-overflow +obj-$(CONFIG_L2_CACHE) += l2_cache.o +obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o + +extra-y += vmlinux.lds
arch/kvx/kernel/kvx_ksyms.c new file +24 -0
@@ -0,0 +1,24 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* derived from arch/nios2/kernel/nios2_ksyms.c +* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +* Yann Sionneau +*/ + +#include <linux/kernel.h> +#include <linux/export.h> + +/* +* libgcc functions - functions that are used internally by the +* compiler... (prototypes are not correct though, but that +* doesn't really matter since they're not versioned). +*/ +#define DECLARE_EXPORT (name) extern void name(void); EXPORT_SYMBOL(name) + +DECLARE_EXPORT (__moddi3); +DECLARE_EXPORT (__umoddi3); +DECLARE_EXPORT (__divdi3); +DECLARE_EXPORT (__udivdi3); +DECLARE_EXPORT (__multi3);
arch/kvx/kernel/vmlinux.lds.S new file +173 -0
173 lines not on this page · raw message
arch/kvx/lib/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2017-2023 Kalray Inc. +# + +lib-y := usercopy.o clear_page.o copy_page.o memcpy.o memset.o strlen.o delay.o
arch/kvx/mm/Makefile new file +10 -0
@@ -0,0 +1,10 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2017-2023 Kalray Inc. +# + +obj-y := init.o mmu.o fault.o tlb.o extable.o dma-mapping.o cacheflush.o +obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o +obj-$(CONFIG_KVX_MMU_STATS) += mmu_stats.o +obj-$(CONFIG_STRICT_KERNEL_RWX) += kernel_rwx.o +obj-$(CONFIG_STRICT_DEVMEM) += mmap.o
arch/kvx/platform/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Copyright (C) 2018-2023 Kalray Inc. +# + +obj-$(CONFIG_SMP) += pwr_ctrl.o +obj-$(CONFIG_SMP) += ipi.o
Signature · 1 line
2.37.2
Randy Dunlap
reviewerRe: [RFC PATCH 03/25] kvx: Add build infrastructure
Hi,
Quoted 77 lines · Yann Sionneau
Add
Kbuild,Makefile,Kconfigand link script for kvx build infrastructure.Co-developed-by Clement Leger <[email protected]>Signed-off-by Clement Leger <[email protected]>Co-developed-by Guillaume Thouvenin <[email protected]>Signed-off-by Guillaume Thouvenin <[email protected]>Co-developed-by Jonathan Borne <[email protected]>Signed-off-by Jonathan Borne <[email protected]>Co-developed-by Jules Maselbas <[email protected]>Signed-off-by Jules Maselbas <[email protected]>Co-developed-by Julian Vetter <[email protected]>Signed-off-by Julian Vetter <[email protected]>Co-developed-by Marc Poulhiès <[email protected]>Signed-off-by Marc Poulhiès <[email protected]>Co-developed-by Marius Gligor <[email protected]>Signed-off-by Marius Gligor <[email protected]>Co-developed-by Samuel Jones <[email protected]>Signed-off-by Samuel Jones <[email protected]>Co-developed-by Vincent Chardon <[email protected]>Signed-off-by Vincent Chardon <[email protected]>Co-developed-by Yann Sionneau <[email protected]>Signed-off-by Yann Sionneau <[email protected]>--- arch/kvx/Kconfig | 249 +++++++++++++++++++++++++++++++ arch/kvx/Kconfig.debug | 70 +++++++++ arch/kvx/Makefile | 52 +++++++ arch/kvx/include/asm/Kbuild | 20 +++ arch/kvx/include/uapi/asm/Kbuild | 1 + arch/kvx/kernel/Makefile | 27 ++++ arch/kvx/kernel/kvx_ksyms.c | 24 +++ arch/kvx/kernel/vmlinux.lds.S | 173 +++++++++++++++++++++ arch/kvx/lib/Makefile | 6 + arch/kvx/mm/Makefile | 10 ++ arch/kvx/platform/Makefile | 7 + 11 files changed, 639 insertions(+) create mode 100644 arch/kvx/Kconfig create mode 100644 arch/kvx/Kconfig.debug create mode 100644 arch/kvx/Makefile create mode 100644 arch/kvx/include/asm/Kbuild create mode 100644 arch/kvx/include/uapi/asm/Kbuild create mode 100644 arch/kvx/kernel/Makefile create mode 100644 arch/kvx/kernel/kvx_ksyms.c create mode 100644 arch/kvx/kernel/vmlinux.lds.S create mode 100644 arch/kvx/lib/Makefile create mode 100644 arch/kvx/mm/Makefile create mode 100644 arch/kvx/platform/Makefilearch/kvx/Kconfig new file +22
-0@@ -0,0 +1,249 @@ +# +# For a description of the syntax of this configuration file, +# see Documentation/kbuild/kconfig-language.txt. +# + +config 64BIT + def_bool y + +config GENERIC_CALIBRATE_DELAY + def_bool y + +config FIX_EARLYCON_MEM + def_bool y + +config MMU + def_bool y + +config KALLSYMS_BASE_RELATIVE + def_bool n + +config GENERIC_CSUM + def_bool y
arch/kvx/Kconfig line 32
Quoted 10 lines
arch/kvx/Kconfig new file +10
-0+ +config RWSEM_GENERIC_SPINLOCK + def_bool y + +config GENERIC_HWEIGHT + def_bool y + +config ARCH_MMAP_RND_BITS_MAX + default 24 +
Do the above and below configs need an "int" line for their type? I notice that the patch does that below for PGTABLE_LEVELS.
Quoted 8 lines
arch/kvx/Kconfig new file +8
-0+config ARCH_MMAP_RND_BITS_MIN + default 18 + +config STACKTRACE_SUPPORT + def_bool y + +config LOCKDEP_SUPPORT + def_bool y
arch/kvx/Kconfig line 50
Quoted 10 lines
arch/kvx/Kconfig new file +10
-0+ +config GENERIC_BUG + def_bool y + depends on BUG + +config KVX_4K_PAGES + def_bool y + +config KVX + def_bool y
[deletes]
arch/kvx/Kconfig line 125
Quoted 4 lines
arch/kvx/Kconfig new file +4
-0+ +config PGTABLE_LEVELS + int + default 3
^^^^^^^^^^^^^^^^^^^^^^^^
arch/kvx/Kconfig line 137
Quoted 12 lines
arch/kvx/Kconfig new file +12
-0+ +config HAVE_KPROBES + def_bool n + +menu "System setup" + +config POISON_INITMEM + bool "Enable to poison freed initmem" + default y + help + In order to debug initmem, using poison allows to verify if + some data/code is stille using them. Enable this for debug
still
arch/kvx/Kconfig line 138
Quoted 1 line
arch/kvx/Kconfig new file +1
-0+ purposes
purposes.
Quoted 18 lines
arch/kvx/Kconfig new file +18
-0+ +config KVX_PHYS_OFFSET + hex "RAM address of memory base" + default 0x100000000 + +config KVX_PAGE_OFFSET + hex "kernel virtual address of memory base" + default 0xFFFFFF8000000000 + +config ARCH_FLATMEM_ENABLE + def_bool y + +config ARCH_SPARSEMEM_ENABLE + def_bool y + +config ARCH_SPARSEMEM_DEFAULT + def_bool ARCH_SPARSEMEM_ENABLE +
arch/kvx/Kconfig line 166
Quoted 10 lines
arch/kvx/Kconfig new file +10
-0+config ARCH_SELECT_MEMORY_MODEL + def_bool ARCH_SPARSEMEM_ENABLE + +config STACK_MAX_DEPTH_TO_PRINT + int "Maximum depth of stack to print" + range 1 128 + default "24" + +config L2_CACHE + bool "Enable l2 cache driver"
L2
Quoted 4 lines
arch/kvx/Kconfig new file +4
-0+ default y + help + Enable L2 cache driver in order to handle it. This driver can be + disabled to eliminate any overhead related to L2 cache
arch/kvx/Kconfig line 180
Quoted 10 lines
arch/kvx/Kconfig new file +10
-0+ inval/writeback. Note that L2 cache is mandatory for SMP in order + to maintain coherency on DDR between all PEs. + +config SECURE_DAME_HANDLING + bool "Secure DAME handling" + default y + help + In order to securely handle Data Asynchronous Memory Errors, we need + to do a barrier upon kernel entry when coming from userspace. This + barrier guarantee us that any pending DAME will be serviced right
guarantees
arch/kvx/Kconfig line 185
Quoted 5 lines
arch/kvx/Kconfig new file +5
-0+ away. We also need to do a barrier when returning from kernel to user. + This way, if the kernel or the user triggered a DAME, it will be + serviced by knowing we are coming from kernel or user and avoid + pulling the wrong lever (panic for kernel or sigfault for user). + This can be costly but ensure that user cannot interfere with kernel.
ensures
arch/kvx/Kconfig line 195
Quoted 10 lines
arch/kvx/Kconfig new file +10
-0+ /!\ Do not disable unless you want to open a giant breach between + user and kernel /!\ + +config CACHECTL_UNSAFE_PHYS_OPERATIONS + bool "Enable cachectl syscall unsafe physical operations" + default n + help + Enable cachectl syscall to allow writebacking/invalidating ranges + based on physical addresses. These operations requires the + CAP_SYS_ADMIN capability
capability.
Quoted 60 lines
arch/kvx/Kconfig new file +54
-0+ +config ENABLE_TCA + bool "Enable TCA coprocessor support" + default y + help + This option enables TCA coprocessor support. It will allow the user to + use the coprocessor and save registers on context switch if used. + Registers content will also be cleared when switching. + +config SMP + bool "Symmetric multi-processing support" + default n + select GENERIC_SMP_IDLE_THREAD + select GENERIC_IRQ_IPI + select IRQ_DOMAIN_HIERARCHY + select IRQ_DOMAIN + select L2_CACHE + help + This enables support for systems with more than one CPU. If you have + a system with only one CPU, say N. If you have a system with more + than one CPU, say Y. + + If you say N here, the kernel will run on uni- and multiprocessor + machines, but will use only one CPU of a multiprocessor machine. If + you say Y here, the kernel will run on many, but not all, + uniprocessor machines. On a uniprocessor machine, the kernel + will run faster if you say N here. + +config NR_CPUS + int "Maximum number of CPUs" + range 1 16 + default "16" + depends on SMP + help + Kalray support can handle a maximum of 16 CPUs. + +config KVX_PAGE_SHIFT + int + default 12 + +config CMDLINE + string "Default kernel command string" + default "" + help + On some architectures there is currently no way for the boot loader + to pass arguments to the kernel. For these architectures, you should + supply some command-line options at build time by entering them + here. + +endmenu + +menu "Kernel Features" +source "kernel/Kconfig.hz" +endmenuarch/kvx/Kconfig.debug new file +0
-0
arch/kvx/Kconfig.debug line 8
Quoted 8 lines
arch/kvx/Kconfig.debug new file +8
-0@@ -0,0 +1,70 @@ +menu "KVX debugging" + +config KVX_DEBUG_ASN + bool "Check ASN before writing TLB entry" + default n + help + This option allows to check if the ASN of the current + process is matching the ASN found in MMC. If it is not the
s/is matching/matches/
arch/kvx/Kconfig.debug line 17
Quoted 9 lines
arch/kvx/Kconfig.debug new file +9
-0+ case an error will be printed. + +config KVX_DEBUG_TLB_WRITE + bool "Enable TLBs write checks" + default n + help + Enabling this option will enable TLB access checks. This is + particularly helpful when modifying the assembly code responsible + of TLB refill. If set, mmc.e will be checked each time the tlb are
for TLB refill. TLB
arch/kvx/Kconfig.debug line 25
Quoted 8 lines
arch/kvx/Kconfig.debug new file +8
-0+ written and a panic will be thrown on error. + +config KVX_DEBUG_TLB_ACCESS + bool "Enable TLBs accesses logging" + default n + help + Enabling this option will enable TLB entry manipulation logging. + Each time an entry will be added to the TLBs, it will be logged in
s/will be/is/ s/will be/is/
arch/kvx/Kconfig.debug line 38
Quoted 13 lines
arch/kvx/Kconfig.debug new file +13
-0+ an array readable via gdb scripts. This can be useful to understand + strange crashes related to suspicious virtual/physical addresses. + +config KVX_DEBUG_TLB_ACCESS_BITS + int "Number of bits used as index of entries in log table" + default 12 + depends on KVX_DEBUG_TLB_ACCESS + help + Set the number of bits used as index of entries that will be logged + in a ring buffer called kvx_tlb_access. One entry in the table + contains registers TEL, TEH and MMC. It also logs the type of the + operations (0:read, 1:write, 2:probe). Buffer is per CPU. For one + entry 24 bytes are used. So by default it uses 96Ko of memory per
What does "Ko" mean?
arch/kvx/Kconfig.debug line 42
Quoted 4 lines
arch/kvx/Kconfig.debug new file +4
-0+ CPU to store 2^12 (4096) entries. + +config KVX_MMU_STATS + bool "Register mmu stats debugfs entries"
Preferably MMU
arch/kvx/Kconfig.debug line 44
Quoted 2 lines
arch/kvx/Kconfig.debug new file +2
-0+ default n + select DEBUG_FS
Preferably:
depends on DEBUG_FS
arch/kvx/Kconfig.debug line 46
Quoted 2 lines
arch/kvx/Kconfig.debug new file +2
-0+ help + Enable debugfs attribute which will allow inspecting various metric
metrics
Quoted 9 lines
arch/kvx/Kconfig.debug new file +9
-0+ regarding MMU: + - Number of nomapping traps handled + - avg/min/max time for nomapping refill (user/kernel) + +config DEBUG_EXCEPTION_STACK + bool "Enable exception stack debugging" + default n + help + Enable stack check debugging when entering/exiting
arch/kvx/Kconfig.debug line 65
Quoted 10 lines
arch/kvx/Kconfig.debug new file +10
-0+ exception handlers. + This can be particularly helpful after modifying stack + handling to see if stack when exiting is the same as the one + when entering exception handler. + +config DEBUG_SFR_SET_MASK + bool "Enable sfr set_mask debugging" + default n + help + Verify that values written using kvx_sfr_set_mask are matching the
s/are matching/match/
arch/kvx/Kconfig.debug line 66
Quoted 1 line
arch/kvx/Kconfig.debug new file +1
-0+ mask. This ensure that no extra bits of sfr will be overridden by some
ensures
and preferably s/sfr/SFR/ in 2 places (not in kvx_sfr_set_mask).
arch/kvx/Kconfig.debug line 70
Quoted 4 lines
arch/kvx/Kconfig.debug new file +4
-0+ incorrectly truncated values. This can lead to huge problems by + modifying important bits in system registers. + +endmenu
Thanks.
Signature · 1 line
~Randy
Re: [RFC PATCH 03/25] kvx: Add build infrastructure
Hi,
Quoted 2 lines · Randy Dunlap
Hi,
-- snip snip
Quoted 7 lines
arch/kvx/Kconfig line 32
Quoted 3 lines
arch/kvx/Kconfig new file +3
-0+config ARCH_MMAP_RND_BITS_MAX + default 24 +Do the above and below configs need an "int" line for their type? I notice that the patch does that below for
PGTABLE_LEVELS.
I don't think it needs an "int" line, it is added in arch/Kconfig (which includes arch/kvx/Kconfig)
Quoted 19 lines
Quoted 8 lines
arch/kvx/Kconfig new file +8
-0+config ARCH_MMAP_RND_BITS_MIN + default 18 + +config STACKTRACE_SUPPORT + def_bool y + +config LOCKDEP_SUPPORT + def_bool yarch/kvx/Kconfig line 50
Quoted 10 lines
arch/kvx/Kconfig new file +10
-0+ +config GENERIC_BUG + def_bool y + depends on BUG + +config KVX_4K_PAGES + def_bool y + +config KVX + def_bool y[deletes]
Quoted 5 lines
arch/kvx/Kconfig line 125
Quoted 4 lines
arch/kvx/Kconfig new file +4
-0+ +config PGTABLE_LEVELS + int + default 3^^^^^^^^^^^^^^^^^^^^^^^^
I think the "int" here can be removed, as done for ARCH_MMAP_RND_BITS_MAX and ARCH_MMAP_RND_BITS_MIN
Quoted 182 lines
arch/kvx/Kconfig line 137
Quoted 12 lines
arch/kvx/Kconfig new file +12
-0+ +config HAVE_KPROBES + def_bool n + +menu "System setup" + +config POISON_INITMEM + bool "Enable to poison freed initmem" + default y + help + In order to debug initmem, using poison allows to verify if + some data/code is stille using them. Enable this for debugstill
arch/kvx/Kconfig line 138
Quoted 1 line
arch/kvx/Kconfig new file +1
-0+ purposespurposes.
Quoted 18 lines
arch/kvx/Kconfig new file +18
-0+ +config KVX_PHYS_OFFSET + hex "RAM address of memory base" + default 0x100000000 + +config KVX_PAGE_OFFSET + hex "kernel virtual address of memory base" + default 0xFFFFFF8000000000 + +config ARCH_FLATMEM_ENABLE + def_bool y + +config ARCH_SPARSEMEM_ENABLE + def_bool y + +config ARCH_SPARSEMEM_DEFAULT + def_bool ARCH_SPARSEMEM_ENABLE +arch/kvx/Kconfig line 166
Quoted 10 lines
arch/kvx/Kconfig new file +10
-0+config ARCH_SELECT_MEMORY_MODEL + def_bool ARCH_SPARSEMEM_ENABLE + +config STACK_MAX_DEPTH_TO_PRINT + int "Maximum depth of stack to print" + range 1 128 + default "24" + +config L2_CACHE + bool "Enable l2 cache driver"L2Quoted 4 lines
arch/kvx/Kconfig new file +4
-0+ default y + help + Enable L2 cache driver in order to handle it. This driver can be + disabled to eliminate any overhead related to L2 cachearch/kvx/Kconfig line 180
Quoted 10 lines
arch/kvx/Kconfig new file +10
-0+ inval/writeback. Note that L2 cache is mandatory for SMP in order + to maintain coherency on DDR between all PEs. + +config SECURE_DAME_HANDLING + bool "Secure DAME handling" + default y + help + In order to securely handle Data Asynchronous Memory Errors, we need + to do a barrier upon kernel entry when coming from userspace. This + barrier guarantee us that any pending DAME will be serviced rightguarantees
arch/kvx/Kconfig line 185
Quoted 5 lines
arch/kvx/Kconfig new file +5
-0+ away. We also need to do a barrier when returning from kernel to user. + This way, if the kernel or the user triggered a DAME, it will be + serviced by knowing we are coming from kernel or user and avoid + pulling the wrong lever (panic for kernel or sigfault for user). + This can be costly but ensure that user cannot interfere with kernel.ensures
arch/kvx/Kconfig line 195
Quoted 10 lines
arch/kvx/Kconfig new file +10
-0+ /!\ Do not disable unless you want to open a giant breach between + user and kernel /!\ + +config CACHECTL_UNSAFE_PHYS_OPERATIONS + bool "Enable cachectl syscall unsafe physical operations" + default n + help + Enable cachectl syscall to allow writebacking/invalidating ranges + based on physical addresses. These operations requires the + CAP_SYS_ADMIN capabilitycapability.
Quoted 60 lines
arch/kvx/Kconfig new file +54
-0+ +config ENABLE_TCA + bool "Enable TCA coprocessor support" + default y + help + This option enables TCA coprocessor support. It will allow the user to + use the coprocessor and save registers on context switch if used. + Registers content will also be cleared when switching. + +config SMP + bool "Symmetric multi-processing support" + default n + select GENERIC_SMP_IDLE_THREAD + select GENERIC_IRQ_IPI + select IRQ_DOMAIN_HIERARCHY + select IRQ_DOMAIN + select L2_CACHE + help + This enables support for systems with more than one CPU. If you have + a system with only one CPU, say N. If you have a system with more + than one CPU, say Y. + + If you say N here, the kernel will run on uni- and multiprocessor + machines, but will use only one CPU of a multiprocessor machine. If + you say Y here, the kernel will run on many, but not all, + uniprocessor machines. On a uniprocessor machine, the kernel + will run faster if you say N here. + +config NR_CPUS + int "Maximum number of CPUs" + range 1 16 + default "16" + depends on SMP + help + Kalray support can handle a maximum of 16 CPUs. + +config KVX_PAGE_SHIFT + int + default 12 + +config CMDLINE + string "Default kernel command string" + default "" + help + On some architectures there is currently no way for the boot loader + to pass arguments to the kernel. For these architectures, you should + supply some command-line options at build time by entering them + here. + +endmenu + +menu "Kernel Features" +source "kernel/Kconfig.hz" +endmenuarch/kvx/Kconfig.debug new file +0
-0arch/kvx/Kconfig.debug line 8
Quoted 8 lines
arch/kvx/Kconfig.debug new file +8
-0@@ -0,0 +1,70 @@ +menu "KVX debugging" + +config KVX_DEBUG_ASN + bool "Check ASN before writing TLB entry" + default n + help + This option allows to check if the ASN of the current + process is matching the ASN found in MMC. If it is not thes/is matching/matches/
arch/kvx/Kconfig.debug line 17
Quoted 9 lines
arch/kvx/Kconfig.debug new file +9
-0+ case an error will be printed. + +config KVX_DEBUG_TLB_WRITE + bool "Enable TLBs write checks" + default n + help + Enabling this option will enable TLB access checks. This is + particularly helpful when modifying the assembly code responsible + of TLB refill. If set, mmc.e will be checked each time the tlb arefor TLB refill. TLB
arch/kvx/Kconfig.debug line 25
Quoted 8 lines
arch/kvx/Kconfig.debug new file +8
-0+ written and a panic will be thrown on error. + +config KVX_DEBUG_TLB_ACCESS + bool "Enable TLBs accesses logging" + default n + help + Enabling this option will enable TLB entry manipulation logging. + Each time an entry will be added to the TLBs, it will be logged ins/will be/is/ s/will be/is/
Quoted 15 lines
arch/kvx/Kconfig.debug line 38
Quoted 13 lines
arch/kvx/Kconfig.debug new file +13
-0+ an array readable via gdb scripts. This can be useful to understand + strange crashes related to suspicious virtual/physical addresses. + +config KVX_DEBUG_TLB_ACCESS_BITS + int "Number of bits used as index of entries in log table" + default 12 + depends on KVX_DEBUG_TLB_ACCESS + help + Set the number of bits used as index of entries that will be logged + in a ring buffer called kvx_tlb_access. One entry in the table + contains registers TEL, TEH and MMC. It also logs the type of the + operations (0:read, 1:write, 2:probe). Buffer is per CPU. For one + entry 24 bytes are used. So by default it uses 96Ko of memory perWhat does "Ko" mean?
Ko stands for kilo-octet which is the french equivalent for kilo byte. I've found more typos like this in the documentation and they will be corrected as well.
Quoted 7 lines
arch/kvx/Kconfig.debug line 42
Quoted 4 lines
arch/kvx/Kconfig.debug new file +4
-0+ CPU to store 2^12 (4096) entries. + +config KVX_MMU_STATS + bool "Register mmu stats debugfs entries"Preferably MMU
Quoted 5 lines
arch/kvx/Kconfig.debug line 44
Quoted 2 lines
arch/kvx/Kconfig.debug new file +2
-0+ default n + select DEBUG_FSPreferably:
depends onDEBUG_FS
ack
Quoted 31 lines
arch/kvx/Kconfig.debug line 46
Quoted 2 lines
arch/kvx/Kconfig.debug new file +2
-0+ help + Enable debugfs attribute which will allow inspecting various metricmetrics
Quoted 9 lines
arch/kvx/Kconfig.debug new file +9
-0+ regarding MMU: + - Number of nomapping traps handled + - avg/min/max time for nomapping refill (user/kernel) + +config DEBUG_EXCEPTION_STACK + bool "Enable exception stack debugging" + default n + help + Enable stack check debugging when entering/exitingarch/kvx/Kconfig.debug line 65
Quoted 10 lines
arch/kvx/Kconfig.debug new file +10
-0+ exception handlers. + This can be particularly helpful after modifying stack + handling to see if stack when exiting is the same as the one + when entering exception handler. + +config DEBUG_SFR_SET_MASK + bool "Enable sfr set_mask debugging" + default n + help + Verify that values written using kvx_sfr_set_mask are matching thes/are matching/match/
arch/kvx/Kconfig.debug line 66
Quoted 1 line
arch/kvx/Kconfig.debug new file +1
-0+ mask. This ensure that no extra bits of sfr will be overridden by someensures
Quoted 6 lines
and preferably s/sfr/SFR/ in 2 places (not in
kvx_sfr_set_mask).arch/kvx/Kconfig.debug line 70
Quoted 4 lines
arch/kvx/Kconfig.debug new file +4
-0+ incorrectly truncated values. This can lead to huge problems by + modifying important bits in system registers. + +endmenu
Thanks, all the typos will be corrected :)
Jules
kernel test robot
build botRe: [RFC PATCH 03/25] kvx: Add build infrastructure
In reply to Yann Sionneau[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in…
Hi Yann,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on tip/irq/core]
[also build test WARNING on kees/for-next/execve soc/for-next linus/master v6.2-rc2 next-20230105] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Yann-Sionneau/Documentation-kvx-Add-basic-documentation/20230104-010703 patch link: https://lore.kernel.org/r/20230103164359.24347-4-ysionneau%40kalray.eu patch subject: [RFC PATCH 03/25] kvx: Add build infrastructure reproduce: # https://github.com/intel-lab-lkp/linux/commit/cc2343608420844de50f88e8bd02b4a69a50e353 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Yann-Sionneau/Documentation-kvx-Add-basic-documentation/20230104-010703 git checkout cc2343608420844de50f88e8bd02b4a69a50e353 make menuconfig # enable CONFIG_COMPILE_TEST, CONFIG_WARN_MISSING_DOCUMENTS, CONFIG_WARN_ABI_ERRORS make htmldocs
If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <[email protected]>
All warnings (new ones prefixed by >>):
>> Warning: arch/kvx/Kconfig references a file that doesn't exist: Documentation/kbuild/kconfig-language.txt
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86_64 6.1.0-rc5 Kernel Configuration
#CONFIG_CC_VERSION_TEXT="gcc-11 (Debian 11.3.0-8) 11.3.0" CONFIG_CC_IS_GCC=yCONFIG_GCC_VERSION=110300 CONFIG_CLANG_VERSION=0CONFIG_AS_IS_GNU=yCONFIG_AS_VERSION=23900CONFIG_LD_IS_BFD=yCONFIG_LD_VERSION=23900CONFIG_LLD_VERSION=0CONFIG_CC_CAN_LINK=y CONFIG_CC_CAN_LINK_STATIC=y CONFIG_CC_HAS_ASM_GOTO_OUTPUT=y CONFIG_CC_HAS_ASM_INLINE=y CONFIG_CC_HAS_NO_PROFILE_FN_ATTR=y CONFIG_PAHOLE_VERSION=123CONFIG_IRQ_WORK=yCONFIG_BUILDTIME_TABLE_SORT=y CONFIG_THREAD_INFO_IN_TASK=y
#
# General setup
#CONFIG_BROKEN_ON_SMP=yCONFIG_INIT_ENV_ARG_LIMIT=32CONFIG_COMPILE_TEST=y
# CONFIG_WERROR is not setCONFIG_LOCALVERSION=""CONFIG_BUILD_SALT=""CONFIG_HAVE_KERNEL_GZIP=yCONFIG_HAVE_KERNEL_BZIP2=yCONFIG_HAVE_KERNEL_LZMA=yCONFIG_HAVE_KERNEL_XZ=yCONFIG_HAVE_KERNEL_LZO=yCONFIG_HAVE_KERNEL_LZ4=yCONFIG_HAVE_KERNEL_ZSTD=yCONFIG_KERNEL_GZIP=y
# CONFIG_KERNEL_BZIP2 is not set
# CONFIG_KERNEL_LZMA is not set
# CONFIG_KERNEL_XZ is not set
# CONFIG_KERNEL_LZO is not set
# CONFIG_KERNEL_LZ4 is not set
# CONFIG_KERNEL_ZSTD is not setCONFIG_DEFAULT_INIT=""CONFIG_DEFAULT_HOSTNAME="(none)"
# CONFIG_SYSVIPC is not set
# CONFIG_WATCH_QUEUE is not set
# CONFIG_CROSS_MEMORY_ATTACH is not set
# CONFIG_USELIB is not setCONFIG_HAVE_ARCH_AUDITSYSCALL=y
#
# IRQ subsystem
#CONFIG_GENERIC_IRQ_PROBE=yCONFIG_GENERIC_IRQ_SHOW=yCONFIG_HARDIRQS_SW_RESEND=yCONFIG_IRQ_DOMAIN=yCONFIG_IRQ_DOMAIN_HIERARCHY=yCONFIG_GENERIC_IRQ_MATRIX_ALLOCATOR=yCONFIG_GENERIC_IRQ_RESERVATION_MODE=yCONFIG_IRQ_FORCED_THREADING=yCONFIG_SPARSE_IRQ=y
# end of IRQ subsystem
CONFIG_CLOCKSOURCE_WATCHDOG=yCONFIG_ARCH_CLOCKSOURCE_INIT=yCONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE=yCONFIG_GENERIC_TIME_VSYSCALL=yCONFIG_GENERIC_CLOCKEVENTS=yCONFIG_GENERIC_CLOCKEVENTS_BROADCAST=yCONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST=yCONFIG_GENERIC_CMOS_UPDATE=yCONFIG_HAVE_POSIX_CPU_TIMERS_TASK_WORK=yCONFIG_POSIX_CPU_TIMERS_TASK_WORK=y
#
# Timers subsystem
#CONFIG_HZ_PERIODIC=y
# CONFIG_NO_HZ_IDLE is not set
# CONFIG_NO_HZ is not set
# CONFIG_HIGH_RES_TIMERS is not setCONFIG_CLOCKSOURCE_WATCHDOG_MAX_SKEW_US=100
# end of Timers subsystem
CONFIG_HAVE_EBPF_JIT=yCONFIG_ARCH_WANT_DEFAULT_BPF_JIT=y
#
# BPF subsystem
#
# CONFIG_BPF_SYSCALL is not set
# end of BPF subsystem
CONFIG_PREEMPT_NONE_BUILD=yCONFIG_PREEMPT_NONE=y
# CONFIG_PREEMPT_VOLUNTARY is not set
# CONFIG_PREEMPT is not set
# CONFIG_PREEMPT_DYNAMIC is not set
#
# CPU/Task time and stats accounting
#CONFIG_TICK_CPU_ACCOUNTING=y
# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set
# CONFIG_IRQ_TIME_ACCOUNTING is not set
# CONFIG_BSD_PROCESS_ACCT is not set
# CONFIG_PSI is not set
# end of CPU/Task time and stats accounting
CONFIG_CPU_ISOLATION=y
#
# RCU Subsystem
#CONFIG_TINY_RCU=y
# CONFIG_RCU_EXPERT is not setCONFIG_SRCU=yCONFIG_TINY_SRCU=y
# end of RCU Subsystem
# CONFIG_IKCONFIG is not set
# CONFIG_IKHEADERS is not setCONFIG_LOG_BUF_SHIFT=17CONFIG_PRINTK_SAFE_LOG_BUF_SHIFT=13CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y
#
# Scheduler features
#
# end of Scheduler features
CONFIG_ARCH_SUPPORTS_NUMA_BALANCING=y CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH=y CONFIG_CC_HAS_INT128=y CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5" CONFIG_GCC12_NO_ARRAY_BOUNDS=y CONFIG_ARCH_SUPPORTS_INT128=y
# CONFIG_CGROUPS is not setCONFIG_NAMESPACES=y
# CONFIG_UTS_NS is not set
# CONFIG_TIME_NS is not set
# CONFIG_USER_NS is not set
# CONFIG_PID_NS is not set
# CONFIG_CHECKPOINT_RESTORE is not set
# CONFIG_SCHED_AUTOGROUP is not set
# CONFIG_SYSFS_DEPRECATED is not set
# CONFIG_RELAY is not set
# CONFIG_BLK_DEV_INITRD is not set
# CONFIG_BOOT_CONFIG is not set
# CONFIG_INITRAMFS_PRESERVE_MTIME is not set CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y
# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set CONFIG_LD_ORPHAN_WARN=yCONFIG_SYSCTL=yCONFIG_SYSCTL_EXCEPTION_TRACE=y CONFIG_HAVE_PCSPKR_PLATFORM=y
# CONFIG_EXPERT is not setCONFIG_MULTIUSER=yCONFIG_SGETMASK_SYSCALL=yCONFIG_SYSFS_SYSCALL=yCONFIG_FHANDLE=yCONFIG_POSIX_TIMERS=yCONFIG_PRINTK=yCONFIG_BUG=yCONFIG_ELF_CORE=yCONFIG_PCSPKR_PLATFORM=yCONFIG_BASE_FULL=yCONFIG_FUTEX=yCONFIG_FUTEX_PI=yCONFIG_EPOLL=yCONFIG_SIGNALFD=yCONFIG_TIMERFD=yCONFIG_EVENTFD=yCONFIG_SHMEM=yCONFIG_AIO=yCONFIG_IO_URING=yCONFIG_ADVISE_SYSCALLS=yCONFIG_MEMBARRIER=yCONFIG_KALLSYMS=y CONFIG_KALLSYMS_BASE_RELATIVE=y CONFIG_ARCH_HAS_MEMBARRIER_SYNC_CORE=y CONFIG_RSEQ=y
# CONFIG_EMBEDDED is not set CONFIG_HAVE_PERF_EVENTS=y
#
# Kernel Performance Events And Counters
#CONFIG_PERF_EVENTS=y
# end of Kernel Performance Events And Counters
# CONFIG_PROFILING is not set
# end of General setup
CONFIG_64BIT=yCONFIG_X86_64=yCONFIG_X86=yCONFIG_INSTRUCTION_DECODER=yCONFIG_OUTPUT_FORMAT="elf64-x86-64"CONFIG_LOCKDEP_SUPPORT=yCONFIG_STACKTRACE_SUPPORT=yCONFIG_MMU=yCONFIG_ARCH_MMAP_RND_BITS_MIN=28CONFIG_ARCH_MMAP_RND_BITS_MAX=32CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=8CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=16CONFIG_GENERIC_ISA_DMA=yCONFIG_GENERIC_BUG=yCONFIG_GENERIC_BUG_RELATIVE_POINTERS=yCONFIG_ARCH_MAY_HAVE_PC_FDC=yCONFIG_GENERIC_CALIBRATE_DELAY=yCONFIG_ARCH_HAS_CPU_RELAX=yCONFIG_ARCH_HIBERNATION_POSSIBLE=yCONFIG_ARCH_NR_GPIO=1024CONFIG_ARCH_SUSPEND_POSSIBLE=yCONFIG_AUDIT_ARCH=yCONFIG_ARCH_SUPPORTS_UPROBES=yCONFIG_FIX_EARLYCON_MEM=yCONFIG_PGTABLE_LEVELS=4CONFIG_CC_HAS_SANE_STACKPROTECTOR=y
#
# Processor type and features
#
# CONFIG_SMP is not set CONFIG_X86_FEATURE_NAMES=y CONFIG_X86_MPPARSE=y
# CONFIG_GOLDFISH is not set
# CONFIG_X86_CPU_RESCTRL is not set
# CONFIG_X86_EXTENDED_PLATFORM is not set
# CONFIG_SCHED_OMIT_FRAME_POINTER is not set # CONFIG_HYPERVISOR_GUEST is not set
# CONFIG_MK8 is not set
# CONFIG_MPSC is not set
# CONFIG_MCORE2 is not set
# CONFIG_MATOM is not set CONFIG_GENERIC_CPU=y CONFIG_X86_INTERNODE_CACHE_SHIFT=6 CONFIG_X86_L1_CACHE_SHIFT=6CONFIG_X86_TSC=yCONFIG_X86_CMPXCHG64=yCONFIG_X86_CMOV=y CONFIG_X86_MINIMUM_CPU_FAMILY=64 CONFIG_X86_DEBUGCTLMSR=y CONFIG_IA32_FEAT_CTL=y CONFIG_X86_VMX_FEATURE_NAMES=y CONFIG_CPU_SUP_INTEL=yCONFIG_CPU_SUP_AMD=yCONFIG_CPU_SUP_HYGON=y CONFIG_CPU_SUP_CENTAUR=y CONFIG_CPU_SUP_ZHAOXIN=yCONFIG_HPET_TIMER=yCONFIG_DMI=yCONFIG_NR_CPUS_RANGE_BEGIN=1 CONFIG_NR_CPUS_RANGE_END=1 CONFIG_NR_CPUS_DEFAULT=1CONFIG_NR_CPUS=1CONFIG_UP_LATE_INIT=y CONFIG_X86_LOCAL_APIC=yCONFIG_X86_IO_APIC=y
# CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS is not set # CONFIG_X86_MCE is not set
#
# Performance monitoring
#
# CONFIG_PERF_EVENTS_AMD_POWER is not set
# CONFIG_PERF_EVENTS_AMD_UNCORE is not set
# CONFIG_PERF_EVENTS_AMD_BRS is not set
# end of Performance monitoring
CONFIG_X86_16BIT=yCONFIG_X86_ESPFIX64=y CONFIG_X86_VSYSCALL_EMULATION=y
# CONFIG_X86_IOPL_IOPERM is not set
# CONFIG_MICROCODE is not set
# CONFIG_X86_MSR is not set
# CONFIG_X86_CPUID is not set
# CONFIG_X86_5LEVEL is not set CONFIG_X86_DIRECT_GBPAGES=y
# CONFIG_AMD_MEM_ENCRYPT is not set CONFIG_ARCH_SPARSEMEM_ENABLE=y CONFIG_ARCH_SPARSEMEM_DEFAULT=y CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 # CONFIG_X86_CHECK_BIOS_CORRUPTION is not set CONFIG_MTRR=y
# CONFIG_MTRR_SANITIZER is not set CONFIG_X86_PAT=y CONFIG_ARCH_USES_PG_UNCACHED=y CONFIG_X86_UMIP=yCONFIG_CC_HAS_IBT=y
# CONFIG_X86_KERNEL_IBT is not set
# CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS is not set CONFIG_X86_INTEL_TSX_MODE_OFF=y
# CONFIG_X86_INTEL_TSX_MODE_ON is not set
# CONFIG_X86_INTEL_TSX_MODE_AUTO is not set # CONFIG_HZ_100 is not setCONFIG_HZ_250=y
# CONFIG_HZ_300 is not set
# CONFIG_HZ_1000 is not setCONFIG_HZ=250
# CONFIG_KEXEC is not set
# CONFIG_CRASH_DUMP is not set CONFIG_PHYSICAL_START=0x1000000
# CONFIG_RELOCATABLE is not set CONFIG_PHYSICAL_ALIGN=0x200000 CONFIG_LEGACY_VSYSCALL_XONLY=y
# CONFIG_LEGACY_VSYSCALL_NONE is not set
# CONFIG_CMDLINE_BOOL is not set CONFIG_MODIFY_LDT_SYSCALL=y
# CONFIG_STRICT_SIGALTSTACK_SIZE is not set CONFIG_HAVE_LIVEPATCH=y
# end of Processor type and features
CONFIG_CC_HAS_SLS=yCONFIG_CC_HAS_RETURN_THUNK=y
# CONFIG_SPECULATION_MITIGATIONS is not setCONFIG_ARCH_HAS_ADD_PAGES=yCONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE=y
#
# Power management and ACPI options
#
# CONFIG_SUSPEND is not set
# CONFIG_PM is not setCONFIG_ARCH_SUPPORTS_ACPI=y
# CONFIG_ACPI is not set
#
# CPU Frequency scaling
#
# CONFIG_CPU_FREQ is not set
# end of CPU Frequency scaling
#
# CPU Idle
#
# CONFIG_CPU_IDLE is not set
# end of CPU Idle # end of Power management and ACPI options
#
# Bus options (PCI etc.)
#CONFIG_ISA_DMA_API=y
# end of Bus options (PCI etc.)
#
# Binary Emulations
#
# CONFIG_IA32_EMULATION is not set
# CONFIG_X86_X32_ABI is not set
# end of Binary Emulations
CONFIG_HAVE_KVM=y
# CONFIG_VIRTUALIZATION is not setCONFIG_AS_AVX512=yCONFIG_AS_SHA1_NI=yCONFIG_AS_SHA256_NI=yCONFIG_AS_TPAUSE=y
#
# General architecture-dependent options
#CONFIG_GENERIC_ENTRY=y
# CONFIG_JUMP_LABEL is not set
# CONFIG_STATIC_CALL_SELFTEST is not set CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y CONFIG_ARCH_USE_BUILTIN_BSWAP=y CONFIG_HAVE_IOREMAP_PROT=y CONFIG_HAVE_KPROBES=y CONFIG_HAVE_KRETPROBES=y CONFIG_HAVE_OPTPROBES=y CONFIG_HAVE_KPROBES_ON_FTRACE=y CONFIG_ARCH_CORRECT_STACKTRACE_ON_KRETPROBE=y CONFIG_HAVE_FUNCTION_ERROR_INJECTION=y CONFIG_HAVE_NMI=y CONFIG_TRACE_IRQFLAGS_SUPPORT=y CONFIG_TRACE_IRQFLAGS_NMI_SUPPORT=y CONFIG_HAVE_ARCH_TRACEHOOK=y CONFIG_HAVE_DMA_CONTIGUOUS=y CONFIG_GENERIC_SMP_IDLE_THREAD=y CONFIG_ARCH_HAS_FORTIFY_SOURCE=y CONFIG_ARCH_HAS_SET_MEMORY=y CONFIG_ARCH_HAS_SET_DIRECT_MAP=y CONFIG_HAVE_ARCH_THREAD_STRUCT_WHITELIST=y CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT=y CONFIG_ARCH_WANTS_NO_INSTR=y CONFIG_HAVE_ASM_MODVERSIONS=y CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y CONFIG_HAVE_RSEQ=yCONFIG_HAVE_RUST=y CONFIG_HAVE_FUNCTION_ARG_ACCESS_API=y CONFIG_HAVE_HW_BREAKPOINT=y CONFIG_HAVE_MIXED_BREAKPOINTS_REGS=y CONFIG_HAVE_USER_RETURN_NOTIFIER=y CONFIG_HAVE_PERF_EVENTS_NMI=y CONFIG_HAVE_HARDLOCKUP_DETECTOR_PERF=y CONFIG_HAVE_PERF_REGS=y CONFIG_HAVE_PERF_USER_STACK_DUMP=y CONFIG_HAVE_ARCH_JUMP_LABEL=y CONFIG_HAVE_ARCH_JUMP_LABEL_RELATIVE=y CONFIG_MMU_GATHER_MERGE_VMAS=y CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y CONFIG_HAVE_ALIGNED_STRUCT_PAGE=y CONFIG_HAVE_CMPXCHG_LOCAL=y CONFIG_HAVE_CMPXCHG_DOUBLE=y CONFIG_HAVE_ARCH_SECCOMP=y CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
# CONFIG_SECCOMP is not set CONFIG_HAVE_ARCH_STACKLEAK=y CONFIG_HAVE_STACKPROTECTOR=y
# CONFIG_STACKPROTECTOR is not set CONFIG_ARCH_SUPPORTS_LTO_CLANG=y CONFIG_ARCH_SUPPORTS_LTO_CLANG_THIN=y CONFIG_LTO_NONE=y CONFIG_ARCH_SUPPORTS_CFI_CLANG=y CONFIG_HAVE_ARCH_WITHIN_STACK_FRAMES=y CONFIG_HAVE_CONTEXT_TRACKING_USER=y CONFIG_HAVE_CONTEXT_TRACKING_USER_OFFSTACK=y CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y CONFIG_HAVE_MOVE_PUD=y CONFIG_HAVE_MOVE_PMD=y CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD=y CONFIG_HAVE_ARCH_HUGE_VMAP=y CONFIG_HAVE_ARCH_HUGE_VMALLOC=y CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y CONFIG_HAVE_ARCH_SOFT_DIRTY=y CONFIG_HAVE_MOD_ARCH_SPECIFIC=y CONFIG_MODULES_USE_ELF_RELA=y CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK=y CONFIG_HAVE_SOFTIRQ_ON_OWN_STACK=y CONFIG_SOFTIRQ_ON_OWN_STACK=y CONFIG_ARCH_HAS_ELF_RANDOMIZE=y CONFIG_HAVE_ARCH_MMAP_RND_BITS=y CONFIG_HAVE_EXIT_THREAD=y CONFIG_ARCH_MMAP_RND_BITS=28 CONFIG_PAGE_SIZE_LESS_THAN_64KB=y CONFIG_PAGE_SIZE_LESS_THAN_256KB=y CONFIG_HAVE_OBJTOOL=y CONFIG_HAVE_JUMP_LABEL_HACK=y CONFIG_HAVE_NOINSTR_HACK=y CONFIG_HAVE_NOINSTR_VALIDATION=y CONFIG_HAVE_UACCESS_VALIDATION=y CONFIG_HAVE_STACK_VALIDATION=y CONFIG_HAVE_RELIABLE_STACKTRACE=y
# CONFIG_COMPAT_32BIT_TIME is not set CONFIG_HAVE_ARCH_VMAP_STACK=y
# CONFIG_VMAP_STACK is not set CONFIG_HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET=y CONFIG_RANDOMIZE_KSTACK_OFFSET=y
# CONFIG_RANDOMIZE_KSTACK_OFFSET_DEFAULT is not set CONFIG_ARCH_HAS_STRICT_KERNEL_RWX=y CONFIG_STRICT_KERNEL_RWX=y CONFIG_ARCH_HAS_STRICT_MODULE_RWX=y CONFIG_HAVE_ARCH_PREL32_RELOCATIONS=y CONFIG_ARCH_HAS_MEM_ENCRYPT=y CONFIG_HAVE_STATIC_CALL=y CONFIG_HAVE_STATIC_CALL_INLINE=y CONFIG_HAVE_PREEMPT_DYNAMIC=y CONFIG_HAVE_PREEMPT_DYNAMIC_CALL=y CONFIG_ARCH_WANT_LD_ORPHAN_WARN=y CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y CONFIG_ARCH_SUPPORTS_PAGE_TABLE_CHECK=y CONFIG_ARCH_HAS_ELFCORE_COMPAT=y CONFIG_ARCH_HAS_PARANOID_L1D_FLUSH=y CONFIG_DYNAMIC_SIGFRAME=y CONFIG_ARCH_HAS_NONLEAF_PMD_YOUNG=y
#
# GCOV-based kernel profiling
#CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y
# end of GCOV-based kernel profiling
CONFIG_HAVE_GCC_PLUGINS=y
# CONFIG_GCC_PLUGINS is not set
# end of General architecture-dependent options
CONFIG_RT_MUTEXES=yCONFIG_BASE_SMALL=0
# CONFIG_MODULES is not setCONFIG_BLOCK=y
# CONFIG_BLOCK_LEGACY_AUTOLOAD is not set
# CONFIG_BLK_DEV_BSGLIB is not set
# CONFIG_BLK_DEV_INTEGRITY is not set
# CONFIG_BLK_DEV_ZONED is not set
# CONFIG_BLK_WBT is not set
# CONFIG_BLK_SED_OPAL is not set
# CONFIG_BLK_INLINE_ENCRYPTION is not set
#
# Partition Types
#
# CONFIG_PARTITION_ADVANCED is not setCONFIG_MSDOS_PARTITION=yCONFIG_EFI_PARTITION=y
# end of Partition Types
#
# IO Schedulers
#
# CONFIG_MQ_IOSCHED_DEADLINE is not set
# CONFIG_MQ_IOSCHED_KYBER is not set
# CONFIG_IOSCHED_BFQ is not set
# end of IO Schedulers
CONFIG_INLINE_SPIN_UNLOCK_IRQ=yCONFIG_INLINE_READ_UNLOCK=yCONFIG_INLINE_READ_UNLOCK_IRQ=yCONFIG_INLINE_WRITE_UNLOCK=yCONFIG_INLINE_WRITE_UNLOCK_IRQ=yCONFIG_ARCH_SUPPORTS_ATOMIC_RMW=yCONFIG_ARCH_USE_QUEUED_SPINLOCKS=yCONFIG_ARCH_USE_QUEUED_RWLOCKS=yCONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE=yCONFIG_ARCH_HAS_SYNC_CORE_BEFORE_USERMODE=yCONFIG_ARCH_HAS_SYSCALL_WRAPPER=y
#
# Executable file formats
#
# CONFIG_BINFMT_ELF is not set
# CONFIG_BINFMT_SCRIPT is not set
# CONFIG_BINFMT_MISC is not setCONFIG_COREDUMP=y
# end of Executable file formats
#
# Memory Management options
#
# CONFIG_SWAP is not set
#
# SLAB allocator options
#
# CONFIG_SLAB is not setCONFIG_SLUB=y
# CONFIG_SLAB_MERGE_DEFAULT is not set
# CONFIG_SLAB_FREELIST_RANDOM is not set
# CONFIG_SLAB_FREELIST_HARDENED is not set
# CONFIG_SLUB_STATS is not set
# end of SLAB allocator options
# CONFIG_SHUFFLE_PAGE_ALLOCATOR is not set
# CONFIG_COMPAT_BRK is not setCONFIG_SPARSEMEM=yCONFIG_SPARSEMEM_EXTREME=yCONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
# CONFIG_SPARSEMEM_VMEMMAP is not setCONFIG_HAVE_FAST_GUP=yCONFIG_EXCLUSIVE_SYSTEM_RAM=yCONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
# CONFIG_MEMORY_HOTPLUG is not setCONFIG_SPLIT_PTLOCK_CPUS=4CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK=y
# CONFIG_COMPACTION is not set
# CONFIG_PAGE_REPORTING is not setCONFIG_PHYS_ADDR_T_64BIT=y
# CONFIG_KSM is not setCONFIG_DEFAULT_MMAP_MIN_ADDR=4096CONFIG_ARCH_WANT_GENERAL_HUGETLB=yCONFIG_ARCH_WANTS_THP_SWAP=y
# CONFIG_TRANSPARENT_HUGEPAGE is not setCONFIG_NEED_PER_CPU_KM=yCONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=yCONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=yCONFIG_HAVE_SETUP_PER_CPU_AREA=y
# CONFIG_CMA is not setCONFIG_GENERIC_EARLY_IOREMAP=y
# CONFIG_IDLE_PAGE_TRACKING is not setCONFIG_ARCH_HAS_CACHE_LINE_SIZE=yCONFIG_ARCH_HAS_CURRENT_STACK_POINTER=yCONFIG_ARCH_HAS_PTE_DEVMAP=yCONFIG_ZONE_DMA=yCONFIG_ZONE_DMA32=yCONFIG_VM_EVENT_COUNTERS=y
# CONFIG_PERCPU_STATS is not set
#
# GUP_TEST needs to have DEBUG_FS enabled
#CONFIG_ARCH_HAS_PTE_SPECIAL=yCONFIG_SECRETMEM=y
# CONFIG_ANON_VMA_NAME is not set
# CONFIG_USERFAULTFD is not set
# CONFIG_LRU_GEN is not set
#
# Data Access Monitoring
#
# CONFIG_DAMON is not set
# end of Data Access Monitoring # end of Memory Management options
# CONFIG_NET is not set
#
# Device Drivers
#CONFIG_HAVE_EISA=y
# CONFIG_EISA is not setCONFIG_HAVE_PCI=y
# CONFIG_PCI is not set
# CONFIG_PCCARD is not set
#
# Generic Driver Options
#
# CONFIG_UEVENT_HELPER is not set
# CONFIG_DEVTMPFS is not set
# CONFIG_STANDALONE is not set
# CONFIG_PREVENT_FIRMWARE_BUILD is not set
#
# Firmware loader
#CONFIG_FW_LOADER=yCONFIG_EXTRA_FIRMWARE=""
# CONFIG_FW_LOADER_USER_HELPER is not set
# CONFIG_FW_LOADER_COMPRESS is not set
# CONFIG_FW_UPLOAD is not set
# end of Firmware loader
CONFIG_ALLOW_DEV_COREDUMP=yCONFIG_GENERIC_CPU_AUTOPROBE=yCONFIG_GENERIC_CPU_VULNERABILITIES=y
# end of Generic Driver Options
#
# Bus devices
#
# CONFIG_ARM_INTEGRATOR_LM is not set
# CONFIG_BT1_APB is not set
# CONFIG_BT1_AXI is not set
# CONFIG_HISILICON_LPC is not set
# CONFIG_INTEL_IXP4XX_EB is not set
# CONFIG_QCOM_EBI2 is not set
# CONFIG_MHI_BUS is not set
# CONFIG_MHI_BUS_EP is not set
# end of Bus devices
#
# Firmware Drivers
#
#
# ARM System Control and Management Interface Protocol #
# CONFIG_ARM_SCMI_PROTOCOL is not set
# end of ARM System Control and Management Interface Protocol
# CONFIG_EDD is not setCONFIG_FIRMWARE_MEMMAP=y
# CONFIG_DMIID is not set
# CONFIG_DMI_SYSFS is not setCONFIG_DMI_SCAN_MACHINE_NON_EFI_FALLBACK=y
# CONFIG_FW_CFG_SYSFS is not set
# CONFIG_SYSFB_SIMPLEFB is not set
# CONFIG_BCM47XX_NVRAM is not set
# CONFIG_GOOGLE_FIRMWARE is not set
#
# Tegra firmware driver
#
# end of Tegra firmware driver # end of Firmware Drivers
# CONFIG_GNSS is not set
# CONFIG_MTD is not set
# CONFIG_OF is not setCONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
# CONFIG_PARPORT is not set
# CONFIG_BLK_DEV is not set
#
# NVME Support
#
# CONFIG_NVME_FC is not set
# end of NVME Support
#
# Misc devices
#
# CONFIG_DUMMY_IRQ is not set
# CONFIG_ATMEL_SSC is not set
# CONFIG_ENCLOSURE_SERVICES is not set
# CONFIG_QCOM_COINCELL is not set
# CONFIG_SRAM is not set
# CONFIG_XILINX_SDFEC is not set
# CONFIG_C2PORT is not set
#
# EEPROM support
#
# CONFIG_EEPROM_93CX6 is not set
# end of EEPROM support
#
# Texas Instruments shared transport line discipline #
# end of Texas Instruments shared transport line discipline
#
# Altera FPGA firmware download module (requires I2C) #
# CONFIG_ECHO is not set
# CONFIG_PVPANIC is not set
# end of Misc devices
#
# SCSI device support
#CONFIG_SCSI_MOD=y
# CONFIG_RAID_ATTRS is not set
# CONFIG_SCSI is not set
# end of SCSI device support
# CONFIG_ATA is not set
# CONFIG_MD is not set
# CONFIG_TARGET_CORE is not set
#
# IEEE 1394 (FireWire) support
#
# CONFIG_FIREWIRE is not set
# end of IEEE 1394 (FireWire) support
# CONFIG_MACINTOSH_DRIVERS is not set
#
# Input device support
#CONFIG_INPUT=y
# CONFIG_INPUT_FF_MEMLESS is not set
# CONFIG_INPUT_SPARSEKMAP is not set
# CONFIG_INPUT_MATRIXKMAP is not set
#
# Userland interfaces
#
# CONFIG_INPUT_MOUSEDEV is not set
# CONFIG_INPUT_JOYDEV is not set
# CONFIG_INPUT_EVDEV is not set
# CONFIG_INPUT_EVBUG is not set
#
# Input Device Drivers
#
# CONFIG_INPUT_KEYBOARD is not set
# CONFIG_INPUT_MOUSE is not set
# CONFIG_INPUT_JOYSTICK is not set
# CONFIG_INPUT_TABLET is not set
# CONFIG_INPUT_TOUCHSCREEN is not set
# CONFIG_INPUT_MISC is not set
# CONFIG_RMI4_CORE is not set
#
# Hardware I/O ports
#
# CONFIG_SERIO is not setCONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y
# CONFIG_GAMEPORT is not set
# end of Hardware I/O ports # end of Input device support
#
# Character devices
#CONFIG_TTY=yCONFIG_VT=yCONFIG_CONSOLE_TRANSLATIONS=yCONFIG_VT_CONSOLE=yCONFIG_HW_CONSOLE=y
# CONFIG_VT_HW_CONSOLE_BINDING is not setCONFIG_UNIX98_PTYS=y
# CONFIG_LEGACY_PTYS is not set
# CONFIG_LDISC_AUTOLOAD is not set
#
# Serial drivers
#
# CONFIG_SERIAL_8250 is not set
#
# Non-8250 serial port support
#
# CONFIG_SERIAL_AMBA_PL010 is not set
# CONFIG_SERIAL_MESON is not set
# CONFIG_SERIAL_CLPS711X is not set
# CONFIG_SERIAL_SAMSUNG is not set
# CONFIG_SERIAL_TEGRA is not set
# CONFIG_SERIAL_IMX is not set
# CONFIG_SERIAL_UARTLITE is not set
# CONFIG_SERIAL_SH_SCI is not set
# CONFIG_SERIAL_MSM is not set
# CONFIG_SERIAL_VT8500 is not set
# CONFIG_SERIAL_OMAP is not set
# CONFIG_SERIAL_LANTIQ is not set
# CONFIG_SERIAL_SCCNXP is not set
# CONFIG_SERIAL_TIMBERDALE is not set
# CONFIG_SERIAL_BCM63XX is not set
# CONFIG_SERIAL_ALTERA_JTAGUART is not set
# CONFIG_SERIAL_ALTERA_UART is not set
# CONFIG_SERIAL_MXS_AUART is not set
# CONFIG_SERIAL_MPS2_UART is not set
# CONFIG_SERIAL_ARC is not set
# CONFIG_SERIAL_FSL_LPUART is not set
# CONFIG_SERIAL_FSL_LINFLEXUART is not set
# CONFIG_SERIAL_ST_ASC is not set
# CONFIG_SERIAL_STM32 is not set
# CONFIG_SERIAL_OWL is not set
# CONFIG_SERIAL_RDA is not set
# CONFIG_SERIAL_LITEUART is not set
# CONFIG_SERIAL_SUNPLUS is not set
# end of Serial drivers
# CONFIG_SERIAL_NONSTANDARD is not set
# CONFIG_NULL_TTY is not set
# CONFIG_SERIAL_DEV_BUS is not set
# CONFIG_VIRTIO_CONSOLE is not set
# CONFIG_IPMI_HANDLER is not set
# CONFIG_ASPEED_KCS_IPMI_BMC is not set
# CONFIG_NPCM7XX_KCS_IPMI_BMC is not set
# CONFIG_HW_RANDOM is not set
# CONFIG_MWAVE is not set
# CONFIG_DEVMEM is not set
# CONFIG_NVRAM is not set
# CONFIG_HANGCHECK_TIMER is not set
# CONFIG_TCG_TPM is not set
# CONFIG_TELCLOCK is not set
# CONFIG_RANDOM_TRUST_CPU is not set
# CONFIG_RANDOM_TRUST_BOOTLOADER is not set
# end of Character devices
#
# I2C support
#
# CONFIG_I2C is not set
# end of I2C support
# CONFIG_I3C is not set
# CONFIG_SPI is not set
# CONFIG_SPMI is not set
# CONFIG_HSI is not set
# CONFIG_PPS is not set
#
# PTP clock support
#CONFIG_PTP_1588_CLOCK_OPTIONAL=y
#
# Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks. #
# end of PTP clock support
# CONFIG_PINCTRL is not set
# CONFIG_GPIOLIB is not set
# CONFIG_W1 is not set
# CONFIG_POWER_RESET is not set
# CONFIG_POWER_SUPPLY is not set
# CONFIG_HWMON is not set
# CONFIG_THERMAL is not set
# CONFIG_WATCHDOG is not setCONFIG_SSB_POSSIBLE=y
# CONFIG_SSB is not setCONFIG_BCMA_POSSIBLE=y
# CONFIG_BCMA is not set
#
# Multifunction device drivers
#
# CONFIG_MFD_SUN4I_GPADC is not set
# CONFIG_MFD_AT91_USART is not set
# CONFIG_MFD_MADERA is not set
# CONFIG_MFD_EXYNOS_LPASS is not set
# CONFIG_MFD_MXS_LRADC is not set
# CONFIG_MFD_MX25_TSADC is not set
# CONFIG_HTC_PASIC3 is not set
# CONFIG_MFD_KEMPLD is not set
# CONFIG_MFD_MT6397 is not set
# CONFIG_MFD_PM8XXX is not set
# CONFIG_MFD_SM501 is not set
# CONFIG_ABX500_CORE is not set
# CONFIG_MFD_SUN6I_PRCM is not set
# CONFIG_MFD_SYSCON is not set
# CONFIG_MFD_TI_AM335X_TSCADC is not set
# CONFIG_MFD_TQMX86 is not set
# CONFIG_MFD_STM32_LPTIMER is not set
# CONFIG_MFD_STM32_TIMERS is not set
# end of Multifunction device drivers
# CONFIG_REGULATOR is not set
# CONFIG_RC_CORE is not set
#
# CEC support
#
# CONFIG_MEDIA_CEC_SUPPORT is not set
# end of CEC support
# CONFIG_MEDIA_SUPPORT is not set
#
# Graphics support
#
# CONFIG_IMX_IPUV3_CORE is not set
# CONFIG_DRM is not set
#
# ARM devices
#
# end of ARM devices
#
# Frame buffer Devices
#
# CONFIG_FB is not set
# CONFIG_MMP_DISP is not set
# end of Frame buffer Devices
#
# Backlight & LCD device support
#
# CONFIG_LCD_CLASS_DEVICE is not set
# CONFIG_BACKLIGHT_CLASS_DEVICE is not set
# end of Backlight & LCD device support
#
# Console display driver support
#CONFIG_VGA_CONSOLE=yCONFIG_DUMMY_CONSOLE=yCONFIG_DUMMY_CONSOLE_COLUMNS=80CONFIG_DUMMY_CONSOLE_ROWS=25
# end of Console display driver support # end of Graphics support
# CONFIG_SOUND is not set
#
# HID support
#
# CONFIG_HID is not set
# end of HID support
CONFIG_USB_OHCI_LITTLE_ENDIAN=y
# CONFIG_USB_SUPPORT is not set
# CONFIG_MMC is not set
# CONFIG_MEMSTICK is not set
# CONFIG_NEW_LEDS is not set
# CONFIG_ACCESSIBILITY is not setCONFIG_EDAC_ATOMIC_SCRUB=yCONFIG_EDAC_SUPPORT=yCONFIG_RTC_LIB=yCONFIG_RTC_MC146818_LIB=y
# CONFIG_RTC_CLASS is not set
# CONFIG_DMADEVICES is not set
#
# DMABUF options
#
# CONFIG_SYNC_FILE is not set
# CONFIG_DMABUF_HEAPS is not set
# end of DMABUF options
# CONFIG_AUXDISPLAY is not set
# CONFIG_UIO is not set
# CONFIG_VFIO is not set
# CONFIG_VIRT_DRIVERS is not set
# CONFIG_VIRTIO_MENU is not set
# CONFIG_VHOST_MENU is not set
#
# Microsoft Hyper-V guest support
#
# end of Microsoft Hyper-V guest support
# CONFIG_GREYBUS is not set
# CONFIG_COMEDI is not set
# CONFIG_STAGING is not set
# CONFIG_CHROME_PLATFORMS is not set
# CONFIG_MELLANOX_PLATFORM is not set
# CONFIG_OLPC_XO175 is not set
# CONFIG_SURFACE_PLATFORMS is not set
# CONFIG_X86_PLATFORM_DEVICES is not set
# CONFIG_COMMON_CLK is not set
# CONFIG_HWSPINLOCK is not set
#
# Clock Source drivers
#CONFIG_CLKEVT_I8253=yCONFIG_I8253_LOCK=yCONFIG_CLKBLD_I8253=y
# CONFIG_BCM2835_TIMER is not set
# CONFIG_BCM_KONA_TIMER is not set
# CONFIG_DAVINCI_TIMER is not set
# CONFIG_DIGICOLOR_TIMER is not set
# CONFIG_OMAP_DM_TIMER is not set
# CONFIG_DW_APB_TIMER is not set
# CONFIG_FTTMR010_TIMER is not set
# CONFIG_IXP4XX_TIMER is not set
# CONFIG_MESON6_TIMER is not set
# CONFIG_OWL_TIMER is not set
# CONFIG_RDA_TIMER is not set
# CONFIG_SUN4I_TIMER is not set
# CONFIG_TEGRA_TIMER is not set
# CONFIG_VT8500_TIMER is not set
# CONFIG_NPCM7XX_TIMER is not set
# CONFIG_ASM9260_TIMER is not set
# CONFIG_CLKSRC_DBX500_PRCMU is not set
# CONFIG_CLPS711X_TIMER is not set
# CONFIG_MXS_TIMER is not set
# CONFIG_NSPIRE_TIMER is not set
# CONFIG_INTEGRATOR_AP_TIMER is not set
# CONFIG_CLKSRC_PISTACHIO is not set
# CONFIG_CLKSRC_STM32_LP is not set
# CONFIG_ARMV7M_SYSTICK is not set
# CONFIG_ATMEL_PIT is not set
# CONFIG_ATMEL_ST is not set
# CONFIG_CLKSRC_SAMSUNG_PWM is not set
# CONFIG_FSL_FTM_TIMER is not set
# CONFIG_OXNAS_RPS_TIMER is not set
# CONFIG_MTK_TIMER is not set
# CONFIG_SH_TIMER_CMT is not set
# CONFIG_SH_TIMER_MTU2 is not set
# CONFIG_RENESAS_OSTM is not set
# CONFIG_SH_TIMER_TMU is not set
# CONFIG_EM_TIMER_STI is not set
# CONFIG_CLKSRC_PXA is not set
# CONFIG_TIMER_IMX_SYS_CTR is not set
# CONFIG_CLKSRC_ST_LPC is not set
# CONFIG_GXP_TIMER is not set
# CONFIG_MSC313E_TIMER is not set
# CONFIG_MICROCHIP_PIT64B is not set
# end of Clock Source drivers
# CONFIG_MAILBOX is not set
# CONFIG_IOMMU_SUPPORT is not set
#
# Remoteproc drivers
#
# CONFIG_REMOTEPROC is not set
# end of Remoteproc drivers
#
# Rpmsg drivers
#
# CONFIG_RPMSG_VIRTIO is not set
# end of Rpmsg drivers
#
# SOC (System On Chip) specific Drivers
#
#
# Amlogic SoC drivers
#
# CONFIG_MESON_CANVAS is not set
# CONFIG_MESON_CLK_MEASURE is not set
# CONFIG_MESON_GX_SOCINFO is not set
# CONFIG_MESON_MX_SOCINFO is not set
# end of Amlogic SoC drivers
#
# Apple SoC drivers
#
# CONFIG_APPLE_SART is not set
# end of Apple SoC drivers
#
# ASPEED SoC drivers
#
# CONFIG_ASPEED_LPC_CTRL is not set
# CONFIG_ASPEED_LPC_SNOOP is not set
# CONFIG_ASPEED_UART_ROUTING is not set
# CONFIG_ASPEED_P2A_CTRL is not set
# CONFIG_ASPEED_SOCINFO is not set
# end of ASPEED SoC drivers
# CONFIG_AT91_SOC_ID is not set
# CONFIG_AT91_SOC_SFR is not set
#
# Broadcom SoC drivers
#
# CONFIG_SOC_BCM63XX is not set
# CONFIG_SOC_BRCMSTB is not set
# end of Broadcom SoC drivers
#
# NXP/Freescale QorIQ SoC drivers
#
# end of NXP/Freescale QorIQ SoC drivers
#
# fujitsu SoC drivers # # end of fujitsu SoC drivers
#
# i.MX SoC drivers
#
# CONFIG_SOC_IMX8M is not set
# CONFIG_SOC_IMX9 is not set
# end of i.MX SoC drivers
#
# IXP4xx SoC drivers
#
# CONFIG_IXP4XX_QMGR is not set
# CONFIG_IXP4XX_NPE is not set
# end of IXP4xx SoC drivers
#
# Enable LiteX SoC Builder specific drivers
#
# CONFIG_LITEX_SOC_CONTROLLER is not set
# end of Enable LiteX SoC Builder specific drivers
#
# MediaTek SoC drivers
#
# CONFIG_MTK_CMDQ is not set
# CONFIG_MTK_DEVAPC is not set
# CONFIG_MTK_INFRACFG is not set
# CONFIG_MTK_MMSYS is not set
# end of MediaTek SoC drivers
#
# Qualcomm SoC drivers
#
# CONFIG_QCOM_GENI_SE is not set
# CONFIG_QCOM_GSBI is not set
# CONFIG_QCOM_LLCC is not set
# CONFIG_QCOM_RPMH is not set
# CONFIG_QCOM_SPM is not set
# CONFIG_QCOM_ICC_BWMON is not set
# end of Qualcomm SoC drivers
# CONFIG_SOC_RENESAS is not set
# CONFIG_ROCKCHIP_GRF is not set
# CONFIG_SOC_SAMSUNG is not set
# CONFIG_SOC_TI is not set
# CONFIG_UX500_SOC_ID is not set
#
# Xilinx SoC drivers
#
# end of Xilinx SoC drivers # end of SOC (System On Chip) specific Drivers
# CONFIG_PM_DEVFREQ is not set
# CONFIG_EXTCON is not set
# CONFIG_MEMORY is not set
# CONFIG_IIO is not set
# CONFIG_PWM is not set
#
# IRQ chip support
#
# CONFIG_RENESAS_INTC_IRQPIN is not set
# CONFIG_RENESAS_IRQC is not set
# CONFIG_RENESAS_RZA1_IRQC is not set
# CONFIG_RENESAS_RZG2L_IRQC is not set
# CONFIG_SL28CPLD_INTC is not set
# CONFIG_TS4800_IRQ is not set
# CONFIG_INGENIC_TCU_IRQ is not set
# CONFIG_IRQ_UNIPHIER_AIDET is not set
# CONFIG_MESON_IRQ_GPIO is not set
# CONFIG_IMX_IRQSTEER is not set
# CONFIG_IMX_INTMUX is not set
# CONFIG_EXYNOS_IRQ_COMBINER is not set
# CONFIG_MST_IRQ is not set
# CONFIG_MCHP_EIC is not set
# CONFIG_SUNPLUS_SP7021_INTC is not set
# end of IRQ chip support
# CONFIG_IPACK_BUS is not set
# CONFIG_RESET_CONTROLLER is not set
#
# PHY Subsystem
#
# CONFIG_GENERIC_PHY is not set
# CONFIG_PHY_PISTACHIO_USB is not set
# CONFIG_PHY_CAN_TRANSCEIVER is not set
#
# PHY drivers for Broadcom platforms
#
# CONFIG_PHY_BCM63XX_USBH is not set
# CONFIG_BCM_KONA_USB2_PHY is not set
# end of PHY drivers for Broadcom platforms
# CONFIG_PHY_HI6220_USB is not set
# CONFIG_PHY_HI3660_USB is not set
# CONFIG_PHY_HI3670_USB is not set
# CONFIG_PHY_HI3670_PCIE is not set
# CONFIG_PHY_HISTB_COMBPHY is not set
# CONFIG_PHY_HISI_INNO_USB2 is not set
# CONFIG_PHY_PXA_28NM_HSIC is not set
# CONFIG_PHY_PXA_28NM_USB2 is not set
# CONFIG_PHY_PXA_USB is not set
# CONFIG_PHY_MMP3_USB is not set
# CONFIG_PHY_MMP3_HSIC is not set
# CONFIG_PHY_MT7621_PCI is not set
# CONFIG_PHY_RALINK_USB is not set
# CONFIG_PHY_RCAR_GEN3_USB3 is not set
# CONFIG_PHY_ROCKCHIP_DPHY_RX0 is not set
# CONFIG_PHY_ROCKCHIP_PCIE is not set
# CONFIG_PHY_ROCKCHIP_SNPS_PCIE3 is not set
# CONFIG_PHY_EXYNOS_MIPI_VIDEO is not set
# CONFIG_PHY_SAMSUNG_USB2 is not set
# CONFIG_PHY_ST_SPEAR1310_MIPHY is not set
# CONFIG_PHY_ST_SPEAR1340_MIPHY is not set
# CONFIG_PHY_TEGRA194_P2U is not set
# CONFIG_PHY_DA8XX_USB is not set
# CONFIG_OMAP_CONTROL_PHY is not set
# CONFIG_TI_PIPE3 is not set
# CONFIG_PHY_INTEL_KEEMBAY_EMMC is not set
# CONFIG_PHY_INTEL_KEEMBAY_USB is not set
# CONFIG_PHY_INTEL_LGM_EMMC is not set
# CONFIG_PHY_XILINX_ZYNQMP is not set
# end of PHY Subsystem
# CONFIG_POWERCAP is not set
# CONFIG_MCB is not set
#
# Performance monitor support
#
# CONFIG_ARM_CCN is not set
# CONFIG_ARM_CMN is not set
# CONFIG_FSL_IMX8_DDR_PMU is not set
# CONFIG_XGENE_PMU is not set
# CONFIG_ARM_DMC620_PMU is not set
# CONFIG_MARVELL_CN10K_TAD_PMU is not set
# CONFIG_ALIBABA_UNCORE_DRW_PMU is not set
# CONFIG_MARVELL_CN10K_DDR_PMU is not set
# end of Performance monitor support
# CONFIG_RAS is not set
#
# Android
#
# CONFIG_ANDROID_BINDER_IPC is not set
# end of Android
# CONFIG_DAX is not set
# CONFIG_NVMEM is not set
#
# HW tracing support
#
# CONFIG_STM is not set
# CONFIG_INTEL_TH is not set
# end of HW tracing support
# CONFIG_FPGA is not set
# CONFIG_TEE is not set
# CONFIG_SIOX is not set
# CONFIG_SLIMBUS is not set
# CONFIG_INTERCONNECT is not set
# CONFIG_COUNTER is not set
# CONFIG_PECI is not set
# CONFIG_HTE is not set
# end of Device Drivers
#
# File systems
#CONFIG_DCACHE_WORD_ACCESS=y
# CONFIG_VALIDATE_FS_PARSER is not set
# CONFIG_EXT2_FS is not set
# CONFIG_EXT3_FS is not set
# CONFIG_EXT4_FS is not set
# CONFIG_REISERFS_FS is not set
# CONFIG_JFS_FS is not set
# CONFIG_XFS_FS is not set
# CONFIG_GFS2_FS is not set
# CONFIG_BTRFS_FS is not set
# CONFIG_NILFS2_FS is not set
# CONFIG_F2FS_FS is not setCONFIG_EXPORTFS=y
# CONFIG_EXPORTFS_BLOCK_OPS is not setCONFIG_FILE_LOCKING=y
# CONFIG_FS_ENCRYPTION is not set
# CONFIG_FS_VERITY is not set
# CONFIG_DNOTIFY is not set
# CONFIG_INOTIFY_USER is not set
# CONFIG_FANOTIFY is not set
# CONFIG_QUOTA is not set
# CONFIG_AUTOFS4_FS is not set
# CONFIG_AUTOFS_FS is not set
# CONFIG_FUSE_FS is not set
# CONFIG_OVERLAY_FS is not set
#
# Caches
#
# CONFIG_FSCACHE is not set
# end of Caches
#
# CD-ROM/DVD Filesystems
#
# CONFIG_ISO9660_FS is not set
# CONFIG_UDF_FS is not set
# end of CD-ROM/DVD Filesystems
#
# DOS/FAT/EXFAT/NT Filesystems
#
# CONFIG_MSDOS_FS is not set
# CONFIG_VFAT_FS is not set
# CONFIG_EXFAT_FS is not set
# CONFIG_NTFS_FS is not set
# CONFIG_NTFS3_FS is not set
# end of DOS/FAT/EXFAT/NT Filesystems
#
# Pseudo filesystems
#CONFIG_PROC_FS=y
# CONFIG_PROC_KCORE is not setCONFIG_PROC_SYSCTL=yCONFIG_PROC_PAGE_MONITOR=y
# CONFIG_PROC_CHILDREN is not setCONFIG_PROC_PID_ARCH_STATUS=yCONFIG_KERNFS=yCONFIG_SYSFS=y
# CONFIG_TMPFS is not set
# CONFIG_HUGETLBFS is not setCONFIG_ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP=yCONFIG_ARCH_HAS_GIGANTIC_PAGE=y
# CONFIG_CONFIGFS_FS is not set
# end of Pseudo filesystems
# CONFIG_MISC_FILESYSTEMS is not set
# CONFIG_NLS is not set
# CONFIG_UNICODE is not setCONFIG_IO_WQ=y
# end of File systems
#
# Security options
#
# CONFIG_KEYS is not set
# CONFIG_SECURITY_DMESG_RESTRICT is not set
# CONFIG_SECURITY is not set
# CONFIG_SECURITYFS is not set CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR=y
# CONFIG_HARDENED_USERCOPY is not set
# CONFIG_FORTIFY_SOURCE is not set
# CONFIG_STATIC_USERMODEHELPER is not set CONFIG_DEFAULT_SECURITY_DAC=y CONFIG_LSM="landlock,lockdown,yama,loadpin,safesetid,integrity,bpf"
#
# Kernel hardening options
#
#
# Memory initialization
#CONFIG_INIT_STACK_NONE=y
# CONFIG_INIT_ON_ALLOC_DEFAULT_ON is not set
# CONFIG_INIT_ON_FREE_DEFAULT_ON is not setCONFIG_CC_HAS_ZERO_CALL_USED_REGS=y
# CONFIG_ZERO_CALL_USED_REGS is not set
# end of Memory initialization
CONFIG_RANDSTRUCT_NONE=y
# end of Kernel hardening options # end of Security options
# CONFIG_CRYPTO is not set
#
# Library routines
#
# CONFIG_PACKING is not setCONFIG_BITREVERSE=yCONFIG_GENERIC_STRNCPY_FROM_USER=yCONFIG_GENERIC_STRNLEN_USER=y
# CONFIG_CORDIC is not set
# CONFIG_PRIME_NUMBERS is not setCONFIG_GENERIC_PCI_IOMAP=yCONFIG_GENERIC_IOMAP=yCONFIG_ARCH_USE_CMPXCHG_LOCKREF=yCONFIG_ARCH_HAS_FAST_MULTIPLIER=yCONFIG_ARCH_USE_SYM_ANNOTATIONS=y
#
# Crypto library routines
#CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y
# CONFIG_CRYPTO_LIB_CHACHA is not set
# CONFIG_CRYPTO_LIB_CURVE25519 is not setCONFIG_CRYPTO_LIB_POLY1305_RSIZE=11
# CONFIG_CRYPTO_LIB_POLY1305 is not set
# end of Crypto library routines
# CONFIG_CRC_CCITT is not set
# CONFIG_CRC16 is not set
# CONFIG_CRC_T10DIF is not set
# CONFIG_CRC64_ROCKSOFT is not set
# CONFIG_CRC_ITU_T is not setCONFIG_CRC32=y
# CONFIG_CRC32_SELFTEST is not setCONFIG_CRC32_SLICEBY8=y
# CONFIG_CRC32_SLICEBY4 is not set
# CONFIG_CRC32_SARWATE is not set
# CONFIG_CRC32_BIT is not set
# CONFIG_CRC64 is not set
# CONFIG_CRC4 is not set
# CONFIG_CRC7 is not set
# CONFIG_LIBCRC32C is not set
# CONFIG_CRC8 is not set
# CONFIG_RANDOM32_SELFTEST is not set
# CONFIG_XZ_DEC is not setCONFIG_HAS_IOMEM=yCONFIG_HAS_IOPORT_MAP=yCONFIG_HAS_DMA=yCONFIG_NEED_SG_DMA_LENGTH=yCONFIG_NEED_DMA_MAP_STATE=yCONFIG_ARCH_DMA_ADDR_T_64BIT=yCONFIG_SWIOTLB=y
# CONFIG_DMA_API_DEBUG is not set
# CONFIG_IRQ_POLL is not setCONFIG_HAVE_GENERIC_VDSO=yCONFIG_GENERIC_GETTIMEOFDAY=yCONFIG_GENERIC_VDSO_TIME_NS=yCONFIG_ARCH_HAS_PMEM_API=yCONFIG_ARCH_HAS_UACCESS_FLUSHCACHE=yCONFIG_ARCH_HAS_COPY_MC=yCONFIG_ARCH_STACKWALK=yCONFIG_STACKDEPOT=yCONFIG_SBITMAP=y
# CONFIG_PARMAN is not set
# CONFIG_OBJAGG is not set
# end of Library routines
#
# Kernel hacking
#
#
# printk and dmesg options # # CONFIG_PRINTK_TIME is not set # CONFIG_PRINTK_CALLER is not set # CONFIG_STACKTRACE_BUILD_ID is not set CONFIG_CONSOLE_LOGLEVEL_DEFAULT=7 CONFIG_CONSOLE_LOGLEVEL_QUIET=4 CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 # CONFIG_DYNAMIC_DEBUG is not set # CONFIG_DYNAMIC_DEBUG_CORE is not set # CONFIG_SYMBOLIC_ERRNAME is not set CONFIG_DEBUG_BUGVERBOSE=y # end of printk and dmesg options
# CONFIG_DEBUG_KERNEL is not set
#
# Compile-time checks and compiler options
#CONFIG_AS_HAS_NON_CONST_LEB128=yCONFIG_FRAME_WARN=2048
# CONFIG_STRIP_ASM_SYMS is not set
# CONFIG_HEADERS_INSTALL is not setCONFIG_DEBUG_SECTION_MISMATCH=yCONFIG_SECTION_MISMATCH_WARN_ONLY=yCONFIG_OBJTOOL=y
# end of Compile-time checks and compiler options
#
# Generic Kernel Debugging Instruments
#
# CONFIG_MAGIC_SYSRQ is not set
# CONFIG_DEBUG_FS is not setCONFIG_HAVE_ARCH_KGDB=yCONFIG_ARCH_HAS_UBSAN_SANITIZE_ALL=y
# CONFIG_UBSAN is not setCONFIG_HAVE_ARCH_KCSAN=yCONFIG_HAVE_KCSAN_COMPILER=y
# end of Generic Kernel Debugging Instruments
#
# Networking Debugging
#
# end of Networking Debugging
#
# Memory Debugging
#
# CONFIG_PAGE_EXTENSION is not setCONFIG_SLUB_DEBUG=y
# CONFIG_SLUB_DEBUG_ON is not set
# CONFIG_PAGE_TABLE_CHECK is not set
# CONFIG_PAGE_POISONING is not set
# CONFIG_DEBUG_RODATA_TEST is not setCONFIG_ARCH_HAS_DEBUG_WX=y
# CONFIG_DEBUG_WX is not setCONFIG_GENERIC_PTDUMP=yCONFIG_HAVE_DEBUG_KMEMLEAK=yCONFIG_ARCH_HAS_DEBUG_VM_PGTABLE=y
# CONFIG_DEBUG_VM_PGTABLE is not setCONFIG_ARCH_HAS_DEBUG_VIRTUAL=yCONFIG_DEBUG_MEMORY_INIT=yCONFIG_ARCH_SUPPORTS_KMAP_LOCAL_FORCE_MAP=yCONFIG_HAVE_ARCH_KASAN=yCONFIG_HAVE_ARCH_KASAN_VMALLOC=yCONFIG_CC_HAS_KASAN_GENERIC=yCONFIG_CC_HAS_WORKING_NOSANITIZE_ADDRESS=y
# CONFIG_KASAN is not setCONFIG_HAVE_ARCH_KFENCE=y
# CONFIG_KFENCE is not setCONFIG_HAVE_ARCH_KMSAN=y
# end of Memory Debugging
#
# Debug Oops, Lockups and Hangs
#
# CONFIG_PANIC_ON_OOPS is not setCONFIG_PANIC_ON_OOPS_VALUE=0CONFIG_PANIC_TIMEOUT=0CONFIG_HARDLOCKUP_CHECK_TIMESTAMP=y
# end of Debug Oops, Lockups and Hangs
#
# Scheduler Debugging
#
# end of Scheduler Debugging
# CONFIG_DEBUG_TIMEKEEPING is not set
#
# Lock Debugging (spinlocks, mutexes, etc...)
#CONFIG_LOCK_DEBUGGING_SUPPORT=y
# CONFIG_WW_MUTEX_SELFTEST is not set
# end of Lock Debugging (spinlocks, mutexes, etc...)
# CONFIG_DEBUG_IRQFLAGS is not setCONFIG_STACKTRACE=y
# CONFIG_WARN_ALL_UNSEEDED_RANDOM is not set
#
# Debug kernel data structures
#
# CONFIG_BUG_ON_DATA_CORRUPTION is not set
# end of Debug kernel data structures
#
# RCU Debugging
#
# end of RCU Debugging
CONFIG_USER_STACKTRACE_SUPPORT=yCONFIG_HAVE_RETHOOK=yCONFIG_HAVE_FUNCTION_TRACER=yCONFIG_HAVE_DYNAMIC_FTRACE=yCONFIG_HAVE_DYNAMIC_FTRACE_WITH_REGS=yCONFIG_HAVE_DYNAMIC_FTRACE_WITH_DIRECT_CALLS=yCONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS=yCONFIG_HAVE_DYNAMIC_FTRACE_NO_PATCHABLE=yCONFIG_HAVE_FTRACE_MCOUNT_RECORD=yCONFIG_HAVE_SYSCALL_TRACEPOINTS=yCONFIG_HAVE_FENTRY=yCONFIG_HAVE_OBJTOOL_MCOUNT=yCONFIG_HAVE_C_RECORDMCOUNT=yCONFIG_HAVE_BUILDTIME_MCOUNT_SORT=yCONFIG_TRACING_SUPPORT=y
# CONFIG_FTRACE is not set
# CONFIG_SAMPLES is not setCONFIG_HAVE_SAMPLE_FTRACE_DIRECT=yCONFIG_HAVE_SAMPLE_FTRACE_DIRECT_MULTI=yCONFIG_ARCH_HAS_DEVMEM_IS_ALLOWED=y
#
# x86 Debugging # # CONFIG_X86_VERBOSE_BOOTUP is not set CONFIG_EARLY_PRINTK=y CONFIG_HAVE_MMIOTRACE_SUPPORT=y CONFIG_IO_DELAY_0X80=y # CONFIG_IO_DELAY_0XED is not set # CONFIG_IO_DELAY_UDELAY is not set # CONFIG_IO_DELAY_NONE is not set CONFIG_UNWINDER_ORC=y # CONFIG_UNWINDER_FRAME_POINTER is not set # end of x86 Debugging
#
# Kernel Testing and Coverage
#
# CONFIG_KUNIT is not setCONFIG_ARCH_HAS_KCOV=yCONFIG_CC_HAS_SANCOV_TRACE_PC=y
# CONFIG_KCOV is not set
# CONFIG_RUNTIME_TESTING_MENU is not setCONFIG_ARCH_USE_MEMTEST=y
# CONFIG_MEMTEST is not set
# end of Kernel Testing and Coverage
#
# Rust hacking
#
# end of Rust hacking
CONFIG_WARN_MISSING_DOCUMENTS=yCONFIG_WARN_ABI_ERRORS=y
# end of Kernel hacking
RFC PATCH 4/25 kvx: Add CPU definition headers
In reply to Yann SionneauAdd common headers for basic kvx support:
- CPU definition
- SFR (System Function Registers)
- Privilege levels owners
- Hw breakpoints
--- arch/kvx/include/asm/hw_breakpoint.h | 72 + arch/kvx/include/asm/privilege.h | 211 ++ arch/kvx/include/asm/processor.h | 176 + arch/kvx/include/asm/sfr.h | 107 + arch/kvx/include/asm/sfr_defs.h | 5028 ++++++++++++++++++++++++++ arch/kvx/include/asm/swab.h | 48 + arch/kvx/include/asm/sys_arch.h | 51 + 7 files changed, 5693 insertions(+) create mode 100644 arch/kvx/include/asm/hw_breakpoint.h create mode 100644 arch/kvx/include/asm/privilege.h create mode 100644 arch/kvx/include/asm/processor.h create mode 100644 arch/kvx/include/asm/sfr.h create mode 100644 arch/kvx/include/asm/sfr_defs.h create mode 100644 arch/kvx/include/asm/swab.h create mode 100644 arch/kvx/include/asm/sys_arch.h
arch/kvx/include/asm/hw_breakpoint.h new file +72 -0
@@ -0,0 +1,72 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Marius Gligor +* Clement Leger +*/ + +#ifndef _ASM_KVX_HW_BREAKPOINT_H +#define _ASM_KVX_HW_BREAKPOINT_H + +#ifdef CONFIG_HAVE_HW_BREAKPOINT + +#include <linux/types.h> + +#define KVX_HW_BREAKPOINT_TYPE 0 +#define KVX_HW_WATCHPOINT_TYPE 1 + +#define KVX_HW_WP_PER_WP 2 + +struct arch_hw_breakpoint { +u64 addr; +u32 len; +u32 type; +union { +struct { +u64 hw_addr; +u32 hw_range; + } bp; +struct { +u64 hw_addr[KVX_HW_WP_PER_WP ]; +u32 hw_range[KVX_HW_WP_PER_WP ]; +u32 use_wp1; +u32 hit_info; + } wp; + }; +}; + +struct perf_event_attr ; +struct perf_event ; +struct pt_regs ; +struct task_struct ; + +int hw_breakpoint_slots (int type); +int arch_check_bp_in_kernelspace (struct arch_hw_breakpoint *hw); +int hw_breakpoint_arch_parse (struct perf_event *bp, +const struct perf_event_attr *attr, +struct arch_hw_breakpoint *hw); +int hw_breakpoint_exceptions_notify (struct notifier_block *unused, +unsigned long val,void *data); + +int arch_install_hw_breakpoint (struct perf_event *bp); +void arch_uninstall_hw_breakpoint (struct perf_event *bp); +void hw_breakpoint_pmu_read (struct perf_event *bp); +void check_hw_breakpoint (struct pt_regs *regs); +int check_hw_watchpoint (struct pt_regs *regs,u64 ea); +int check_hw_watchpoint_stepped (struct pt_regs *regs); +void clear_ptrace_hw_breakpoint (struct task_struct *tsk); +int ptrace_request_hw_breakpoint (int idx); +int ptrace_request_hw_watchpoint (int idx); + +#else + +struct task_struct ; + +static inline void clear_ptrace_hw_breakpoint (struct task_struct *tsk) +{ +} + +#endif /* CONFIG_HAVE_HW_BREAKPOINT */ + +#endif /* _ASM_KVX_HW_BREAKPOINT_H */ +
arch/kvx/include/asm/privilege.h new file +211 -0
211 lines not on this page · raw message
arch/kvx/include/asm/processor.h new file +176 -0
176 lines not on this page · raw message
arch/kvx/include/asm/sfr.h new file +107 -0
107 lines not on this page · raw message
arch/kvx/include/asm/sfr_defs.h new file +5028 -0
2,434 lines not on this page · raw message
arch/kvx/include/asm/swab.h new file +48 -0
48 lines not on this page · raw message
arch/kvx/include/asm/sys_arch.h new file +51 -0
51 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.37.2
Part of the diff is not shown here. View the raw message.
RFC PATCH 5/25 kvx: Add atomic/locking headers
In reply to Yann SionneauAdd common headers (atomic, bitops, barrier and locking) for basic kvx support.
--- arch/kvx/include/asm/atomic.h | 104 +++++++++++++++++ arch/kvx/include/asm/barrier.h | 15 +++ arch/kvx/include/asm/bitops.h | 207 +++++++++++++++++++++++++++++++++ arch/kvx/include/asm/bitrev.h | 32 +++++ arch/kvx/include/asm/cmpxchg.h | 185 +++++++++++++++++++++++++++++ 5 files changed, 543 insertions(+) create mode 100644 arch/kvx/include/asm/atomic.h create mode 100644 arch/kvx/include/asm/barrier.h create mode 100644 arch/kvx/include/asm/bitops.h create mode 100644 arch/kvx/include/asm/bitrev.h create mode 100644 arch/kvx/include/asm/cmpxchg.h
arch/kvx/include/asm/atomic.h new file +104 -0
@@ -0,0 +1,104 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _ASM_KVX_ATOMIC_H +#define _ASM_KVX_ATOMIC_H + +#include <linux/types.h> + +#include <asm/cmpxchg.h> + +#define ATOMIC64_INIT (i) { (i) } + +#define arch_atomic64_cmpxchg (v, old, new) (arch_cmpxchg(&((v)->counter), old, new)) +#define arch_atomic64_xchg (v, new) (arch_xchg(&((v)->counter), new)) + +static inline long arch_atomic64_read (const atomic64_t *v) +{ +return v->counter; +} + +static inline void arch_atomic64_set (atomic64_t *v,long i) +{ + v->counter = i; +} + +#define ATOMIC64_RETURN_OP (op, c_op) \ +static inline long arch_atomic64_##op##_return(long i, atomic64_t *v) \ +{ \ + long new, old, ret; \ + \ + do { \ + old = v->counter; \ + new = old c_op i; \ + ret = arch_cmpxchg(&v->counter, old, new); \ + } while (ret != old); \ + \ + return new; \ +} + +#define ATOMIC64_OP (op, c_op) \ +static inline void arch_atomic64_##op(long i, atomic64_t *v) \ +{ \ + long new, old, ret; \ + \ + do { \ + old = v->counter; \ + new = old c_op i; \ + ret = arch_cmpxchg(&v->counter, old, new); \ + } while (ret != old); \ +} + +#define ATOMIC64_FETCH_OP (op, c_op) \ +static inline long arch_atomic64_fetch_##op(long i, atomic64_t *v) \ +{ \ + long new, old, ret; \ + \ + do { \ + old = v->counter; \ + new = old c_op i; \ + ret = arch_cmpxchg(&v->counter, old, new); \ + } while (ret != old); \ + \ + return old; \ +} + +#define ATOMIC64_OPS (op, c_op) \ + ATOMIC64_OP(op, c_op) \ + ATOMIC64_RETURN_OP(op, c_op) \ + ATOMIC64_FETCH_OP(op, c_op) + +ATOMIC64_OPS(and, &) +ATOMIC64_OPS(or, |) +ATOMIC64_OPS(xor, ^) +ATOMIC64_OPS(add, +) +ATOMIC64_OPS(sub, -) + +#undef ATOMIC64_OPS +#undef ATOMIC64_FETCH_OP +#undef ATOMIC64_OP + +static inline int arch_atomic_add_return(int i, atomic_t *v) +{ + int new, old, ret; + + do { + old = v->counter; + new = old + i; + ret = arch_cmpxchg(&v->counter, old, new); + } while (ret != old); + + return new; +} + +static inline int arch_atomic_sub_return(int i, atomic_t *v) +{ + return arch_atomic_add_return(-i, v); +} + +#include <asm-generic/atomic.h> + +#endif /* _ASM_KVX_ATOMIC_H */
arch/kvx/include/asm/barrier.h new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _ASM_KVX_BARRIER_H +#define _ASM_KVX_BARRIER_H + +/* fence is sufficient to guarantee write ordering */ +#define mb () __builtin_kvx_fence() + +#include <asm-generic/barrier.h> + +#endif /* _ASM_KVX_BARRIER_H */
arch/kvx/include/asm/bitops.h new file +207 -0
207 lines not on this page · raw message
arch/kvx/include/asm/bitrev.h new file +32 -0
@@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _ASM_KVX_BITREV_H +#define _ASM_KVX_BITREV_H + +#include <linux/swab.h> + +/* Bit reversal constant for matrix multiply */ +#define BIT_REVERSE 0x0102040810204080ULL + +static __always_inline __attribute_const__ u32 __arch_bitrev32(u32 x) +{ +/* Reverse all bits for each bytes and then byte-reverse the 32 LSB */ +return swab32 (__builtin_kvx_sbmm8 (BIT_REVERSE , x)); +} + +static __always_inline __attribute_const__ u16 __arch_bitrev16(u16 x) +{ +/* Reverse all bits for each bytes and then byte-reverse the 16 LSB */ +return swab16 (__builtin_kvx_sbmm8 (BIT_REVERSE , x)); +} + +static __always_inline __attribute_const__ u8 __arch_bitrev8(u8 x) +{ +return __builtin_kvx_sbmm8 (BIT_REVERSE , x); +} + +#endif
arch/kvx/include/asm/cmpxchg.h new file +185 -0
185 lines not on this page · raw message
Signature · 1 line
2.37.2
Mark Rutland
maintainerRe: [RFC PATCH 05/25] kvx: Add atomic/locking headers
Quoted 49 lines · Yann Sionneau
Add common headers (atomic, bitops, barrier and locking) for basic kvx support.
CC Will Deacon <[email protected]>CC Peter Zijlstra <[email protected]>CC Boqun Feng <[email protected]>CC Mark Rutland <[email protected]>Co-developed-by Clement Leger <[email protected]>Signed-off-by Clement Leger <[email protected]>Co-developed-by Jules Maselbas <[email protected]>Signed-off-by Jules Maselbas <[email protected]>Co-developed-by Julian Vetter <[email protected]>Signed-off-by Julian Vetter <[email protected]>Co-developed-by Julien Villette <[email protected]>Signed-off-by Julien Villette <[email protected]>Co-developed-by Yann Sionneau <[email protected]>Signed-off-by Yann Sionneau <[email protected]>--- arch/kvx/include/asm/atomic.h | 104 +++++++++++++++++ arch/kvx/include/asm/barrier.h | 15 +++ arch/kvx/include/asm/bitops.h | 207 +++++++++++++++++++++++++++++++++ arch/kvx/include/asm/bitrev.h | 32 +++++ arch/kvx/include/asm/cmpxchg.h | 185 +++++++++++++++++++++++++++++ 5 files changed, 543 insertions(+) create mode 100644 arch/kvx/include/asm/atomic.h create mode 100644 arch/kvx/include/asm/barrier.h create mode 100644 arch/kvx/include/asm/bitops.h create mode 100644 arch/kvx/include/asm/bitrev.h create mode 100644 arch/kvx/include/asm/cmpxchg.harch/kvx/include/asm/atomic.h new file +12
-0@@ -0,0 +1,104 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _ASM_KVX_ATOMIC_H +#define _ASM_KVX_ATOMIC_H + +#include <linux/types.h> + +#include <asm/cmpxchg.h>
arch/kvx/include/asm/atomic.h line 22
Quoted 10 lines
arch/kvx/include/asm/atomic.h new file +10
-0+ +#define ATOMIC64_INIT (i) { (i) } + +#define arch_atomic64_cmpxchg (v, old, new) (arch_cmpxchg(&((v)->counter), old, new)) +#define arch_atomic64_xchg (v, new) (arch_xchg(&((v)->counter), new)) + +static inline long arch_atomic64_read (const atomic64_t *v) +{ +return v->counter; +}
This is a plain read, and is *not* atomic.
The compiler can replay a plain read an arbitrary number of times, and is permitted to split it into smaller accesses.
At minimum this needs to be
READ_ONCE(v->counter)
... which will prevent replay. Whether or not that's actually atomic will depend on the instructions the compiler generates, and how those instructions are defines in your architecture.
Do you have a single instruction that can read a 64-bit memory location, and is it guaranteed to result in a single access that cannot be split?
arch/kvx/include/asm/atomic.h line 27
Quoted 4 lines
arch/kvx/include/asm/atomic.h new file +4
-0+static inline void arch_atomic64_set (atomic64_t *v,long i) +{ + v->counter = i; +}
Same comments as for arch_atomic64_read(); at minimum this needs to be:
WRITE_ONCE(v->counter, i)
... but that may or may not actually be atomic on your architecture.
Quoted 29 lines
arch/kvx/include/asm/atomic.h new file +29
-0+#define ATOMIC64_RETURN_OP (op, c_op) \ +static inline long arch_atomic64_##op##_return(long i, atomic64_t *v) \ +{ \ + long new, old, ret; \ + \ + do { \ + old = v->counter; \ + new = old c_op i; \ + ret = arch_cmpxchg(&v->counter, old, new); \ + } while (ret != old); \ + \ + return new; \ +} + +#define ATOMIC64_OP (op, c_op) \ +static inline void arch_atomic64_##op(long i, atomic64_t *v) \ +{ \ + long new, old, ret; \ + \ + do { \ + old = v->counter; \ + new = old c_op i; \ + ret = arch_cmpxchg(&v->counter, old, new); \ + } while (ret != old); \ +} + +#define ATOMIC64_FETCH_OP (op, c_op) \ +static inline long arch_atomic64_fetch_##op(long i, atomic64_t *v) \ +{ \
arch/kvx/include/asm/atomic.h line 67
Quoted 10 lines
arch/kvx/include/asm/atomic.h new file +10
-0+long new, old, ret; \ + \ +do { \ + old = v->counter; \ + new = old c_op i; \ + ret =arch_cmpxchg (&v->counter, old, new); \ + }while (ret != old); \ + \ +return old; \ +}
These look ok, but it'd be nicer if we could teach the generic atomic64 code to do this, like the generic atomic code does.
We could rename the existing asm-generic/atomic64 code to atomic64-spinlock, and add a separate atomic64-cmpxchg (and likewise for the 32-bit code) to make that clearer and consistent.
Quoted 23 lines
arch/kvx/include/asm/atomic.h new file +23
-0+ +#define ATOMIC64_OPS(op, c_op) \ + ATOMIC64_OP(op, c_op) \ + ATOMIC64_RETURN_OP(op, c_op) \ + ATOMIC64_FETCH_OP(op, c_op) + +ATOMIC64_OPS(and, &) +ATOMIC64_OPS(or, |) +ATOMIC64_OPS(xor, ^) +ATOMIC64_OPS(add, +) +ATOMIC64_OPS(sub, -) + +#undef ATOMIC64_OPS +#undef ATOMIC64_FETCH_OP +#undef ATOMIC64_OP + +static inline int arch_atomic_add_return(int i, atomic_t *v) +{ + int new, old, ret; + + do { + old = v->counter; + new = old + i;
arch/kvx/include/asm/atomic.h line 100
Quoted 10 lines
arch/kvx/include/asm/atomic.h new file +10
-0+ ret =arch_cmpxchg (&v->counter, old, new); + }while (ret != old); + +return new; +} + +static inline int arch_atomic_sub_return (int i,atomic_t *v) +{ +return arch_atomic_add_return (-i, v); +}
Likewise for these two.
Quoted 25 lines
arch/kvx/include/asm/atomic.h new file +4
-0+ +#include <asm-generic/atomic.h> + +#endif /* _ASM_KVX_ATOMIC_H */ arch/kvx/include/asm/barrier.h new file +14
-0@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _ASM_KVX_BARRIER_H +#define _ASM_KVX_BARRIER_H +/* Bitmask modifiers */ +#define __NOP (x) (x) +#define __NOT (x) (~(x)) + + +#define __test_and_op_bit (nr, addr, op, mod) \
arch/kvx/include/asm/barrier.h
Quoted 10 lines
arch/kvx/include/asm/barrier.h new file +10
-0+({ \ +unsigned long __mask =BIT_MASK (nr); \ +unsigned long __new, __old, __ret; \ +do { \ + __old = *(&addr[BIT_WORD (nr)]); \ + __new = __old op mod(__mask); \ + __ret =cmpxchg (addr, __old, __new); \ + }while (__ret != __old); \ + (__old & __mask); \ +})
Please use <asm-generic/bitops/atomic.h> which should give you the common bit operations "for free" atop your regular atomics.
[...]
Quoted 27 lines
arch/kvx/include/asm/cmpxchg.h new file +21
-0@@ -0,0 +1,185 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +* Yann Sionneau +*/ + +#ifndef _ASM_KVX_CMPXCHG_H +#define _ASM_KVX_CMPXCHG_H + +#include <linux/bits.h> +#include <linux/types.h> +#include <linux/build_bug.h> + +/* +* On kvx, we have a boolean compare and swap which means that the operation +* returns only the success of operation. +* If operation succeed, this is simple, we just need to return the provided +* old value. However, if it fails, we need to load the value to return it for +* the caller. If the loaded value is different from the "old" provided by the +* caller, we can return it since it will means it failed.
arch/kvx/include/asm/cmpxchg.h line 31
Quoted 10 lines
arch/kvx/include/asm/cmpxchg.h new file +10
-0+* However, if for some reason the value we read is equal to the old value +* provided by the caller, we can't simply return it or the caller will think it +* succeeded. So if the value we read is the same as the "old" provided by +* the caller, we try again until either we succeed or we fail with a different +* value than the provided one. +*/ +#define __cmpxchg (ptr, old, new, op_suffix, load_suffix) \ +({ \ + register unsigned long __rn asm("r62"); \ + register unsigned long __ro asm("r63"); \
Why do you need to specify the exact registers?
e.g. does some instruction use these implicitly, or do you need two adjacent register for encoding reasons?
arch/kvx/include/asm/cmpxchg.h line 34
Quoted 3 lines
arch/kvx/include/asm/cmpxchg.h new file +3
-0+ __asm__ __volatile__ ( \ +/* Fence to guarantee previous store to be committed */ \ + "fence\n" \
This implies you can implement the relaxed form of cmpxchg().
What ordering do you get by default, and do you have any other barriers (e.g. for acquire/release semantics), or just "fence" ?
Thanks,
Mark.
Quoted 158 lines
arch/kvx/include/asm/cmpxchg.h new file +151
-0+/* Init "expect" with previous value */ \ +"copyd $r63 = %[rOld]\n" \ +";;\n" \ +"1:\n" \ +/* Init "update" value with new */ \ +"copyd $r62 = %[rNew]\n" \ +";;\n" \ + "acswap" #op_suffix " 0[%[rPtr]], $r62r63\n" \ +";;\n" \ +/* if acswap succeed, simply return */ \ +"cb.dnez $r62? 2f\n" \ +";;\n" \ +/* We failed, load old value */ \ + "l" #op_suffix #load_suffix" $r63 = 0[%[rPtr]]\n" \ + ";;\n" \ +/* Check if equal to "old" one */ \ + "comp" #op_suffix ".ne $r62 = $r63, %[rOld]\n" \ +";;\n" \ +/* If different from "old", return it to caller */ \ +"cb.deqz $r62? 1b\n" \ +";;\n" \ +"2:\n" \ + : "+r" (__rn), "+r" (__ro) \ +: [rPtr] " r" (ptr), [rOld] " r" (old), [rNew] " r" (new) \ + : "memory"); \ + (__ro); \ +}) + +#define arch_cmpxchg(ptr, o, n) \ +({ \ +unsigned long __ret; \ +BUILD_BUG_ON (sizeof (*(ptr)) !=4 &&sizeof (*(ptr)) !=8 ); \ +switch (sizeof (*(ptr))) { \ +case 4 : \ + __ret =__cmpxchg ((ptr), (o), (n), w, s); \ +break ; \ +case 8 : \ + __ret = __cmpxchg((ptr), (o), (n), d, ); \ +break ; \ + } \ + (__typeof__ (*(ptr ))) (__ret); \ +}) + +/* +* In order to optimize xchg for 16 byte, we can use insf/extfs if we know the +* bounds. This way, we only take one more bundle than standard xchg. +* We simply do a read modify acswap on a 32 bit word. + */ +#define __xchg_small_asm (ptr, new, start, stop) \ +({ \ + register unsigned long __rn asm("r62"); \ + register unsigned long __ro asm("r63"); \ + __asm__ __volatile__ ( \ + "fence\n" \ + ";;\n" \ + "1:\n" \ +/* Load original old value */ \ +"lws $r62 = 0[%[rPtr]]\n" \ +";;\n" \ +/* Copy read value into "expect" */ \ +"copyd $r63 = $r62\n" \ +/* Prepare new value with insf */ \ + "insf $r62 = %[rNew], " #stop "," #start "\n" \ + ";;\n" \ +/* Try compare & swap with loaded value */ \ +"acswapw 0[%[rPtr]], $r62r63\n" \ +";;\n" \ +/* Did we succeed ?, if no, try again */ \ +"cb.deqz $r62? 1b\n" \ +/* Extract old value for ret value */ \ + "extfs $r63 = $r63, " #stop "," #start "\n" \ + ";;\n" \ + : "+r" (__rn), "+r" (__ro) \ + : [rPtr] "r" (ptr), [rNew] "r" (new) \ + : "memory"); \ + (__ro); \ +}) + +/* Needed for generic qspinlock implementation */ +static inline unsigned long xchg_u16 (volatile void *ptr,unsigned long new, +int size) +{ +int off = (unsigned long )ptr %sizeof (u32); +volatile u32 *p = ptr - off; + +/* +* GCC is smart enough to eliminate the dead branches by detecting +* the offset statically +*/ +if (off ==0 ) +return __xchg_small_asm (p, new,0 ,15 ); +else +return __xchg_small_asm (p, new,16 ,31 ); +} + +#define __xchg_asm (ptr, new, op_suffix, load_suffix) \ +({ \ + register unsigned long __rn asm("r62") = (unsigned long) (new); \ + register unsigned long __ro asm("r63"); \ + __asm__ __volatile__ ( \ + "fence\n" \ + ";;\n" \ + "1:\n" \ +/* Load original old value */ \ + "l" #op_suffix #load_suffix " $r63 = 0[%[rPtr]]\n" \ + ";;\n" \ +/* Try compare & swap with loaded value */ \ + "acswap" #op_suffix " 0[%[rPtr]], $r62r63\n" \ +";;\n" \ +/* Did we succeed ?, if no, try again */ \ +"cb.deqz $r62? 1b\n" \ +/* $r62 has been cloberred by acswap, restore it */ \ +"copyd $r62 = %[rNew]\n" \ +";;\n" \ + : "+r" (__rn), "+r" (__ro) \ +: [rPtr] " r" (ptr), [rNew] " r" (new) \ +: " memory"); \ +(__ro); \ +}) + +/* +* This function doesn't exist, so you'll get a linker error if +* something tries to do an invalidly-sized xchg(). + */ +extern unsigned long __xchg_called_with_bad_pointer(void) +__compiletime_error ("Bad argument size for xchg" ); + +static inline unsigned long __xchg (volatile void *ptr,unsigned long val, +int size) +{ +switch (size) { +case 2 : +return xchg_u16 (ptr, val, size); +case 4 : +return __xchg_asm (ptr, val, w, s); +case 8 : + return __xchg_asm(ptr, val, d, ); + } +__xchg_called_with_bad_pointer (); + +return val; +} + +#define arch_xchg (ptr, with) \ + ({ \ + (__typeof__(*(ptr))) __xchg((ptr), \ + (unsigned long)(with), \ + sizeof(*(ptr))); \ + }) + +#endif Signature · 1 line
2.37.2
Re: [RFC PATCH 05/25] kvx: Add atomic/locking headers
Hi Mark,
Quoted 66 lines · Mark Rutland
Quoted 49 lines · Yann Sionneau
Add common headers (atomic, bitops, barrier and locking) for basic kvx support.
CC Will Deacon <[email protected]>CC Peter Zijlstra <[email protected]>CC Boqun Feng <[email protected]>CC Mark Rutland <[email protected]>Co-developed-by Clement Leger <[email protected]>Signed-off-by Clement Leger <[email protected]>Co-developed-by Jules Maselbas <[email protected]>Signed-off-by Jules Maselbas <[email protected]>Co-developed-by Julian Vetter <[email protected]>Signed-off-by Julian Vetter <[email protected]>Co-developed-by Julien Villette <[email protected]>Signed-off-by Julien Villette <[email protected]>Co-developed-by Yann Sionneau <[email protected]>Signed-off-by Yann Sionneau <[email protected]>--- arch/kvx/include/asm/atomic.h | 104 +++++++++++++++++ arch/kvx/include/asm/barrier.h | 15 +++ arch/kvx/include/asm/bitops.h | 207 +++++++++++++++++++++++++++++++++ arch/kvx/include/asm/bitrev.h | 32 +++++ arch/kvx/include/asm/cmpxchg.h | 185 +++++++++++++++++++++++++++++ 5 files changed, 543 insertions(+) create mode 100644 arch/kvx/include/asm/atomic.h create mode 100644 arch/kvx/include/asm/barrier.h create mode 100644 arch/kvx/include/asm/bitops.h create mode 100644 arch/kvx/include/asm/bitrev.h create mode 100644 arch/kvx/include/asm/cmpxchg.harch/kvx/include/asm/atomic.h new file +12
-0@@ -0,0 +1,104 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _ASM_KVX_ATOMIC_H +#define _ASM_KVX_ATOMIC_H + +#include <linux/types.h> + +#include <asm/cmpxchg.h> arch/kvx/include/asm/atomic.h line 22
Quoted 10 lines
arch/kvx/include/asm/atomic.h new file +10
-0+ +#define ATOMIC64_INIT (i) { (i) } + +#define arch_atomic64_cmpxchg (v, old, new) (arch_cmpxchg(&((v)->counter), old, new)) +#define arch_atomic64_xchg (v, new) (arch_xchg(&((v)->counter), new)) + +static inline long arch_atomic64_read (const atomic64_t *v) +{ +return v->counter; +}This is a plain read, and is *not* atomic.
The compiler can replay a plain read an arbitrary number of times, and is permitted to split it into smaller accesses.
Quoted 7 lines
At minimum this needs to be
READ_ONCE(v->counter)... which will prevent replay. Whether or not that's actually atomic will depend on the instructions the compiler generates, and how those instructions are defines in your architecture.
Good point, we are going to use {READ,WRITE}_ONCE macros
Quoted 2 lines
Do you have a single instruction that can read a 64-bit memory location, and is it guaranteed to result in a single access that cannot be split?
We do have a single instruction that can read a 64-bit memory location (supported sizes are 8, 16, 32, 64, 128, 256).
All accesses are guaranteed to not be split, unless they are misaligned. Furthermore, misaligned write accesses crossing a 32-byte boundary may complete in a non-atomic way.
Quoted 55 lines
arch/kvx/include/asm/atomic.h line 27
Quoted 5 lines
arch/kvx/include/asm/atomic.h new file +4
-0+static inline void arch_atomic64_set (atomic64_t *v,long i) +{ + v->counter = i; +}Same comments as for
arch_atomic64_read(); at minimum this needs to be:
WRITE_ONCE(v->counter, i)... but that may or may not actually be atomic on your architecture.
Quoted 29 lines
arch/kvx/include/asm/atomic.h new file +29
-0+#define ATOMIC64_RETURN_OP (op, c_op) \ +static inline long arch_atomic64_##op##_return(long i, atomic64_t *v) \ +{ \ + long new, old, ret; \ + \ + do { \ + old = v->counter; \ + new = old c_op i; \ + ret = arch_cmpxchg(&v->counter, old, new); \ + } while (ret != old); \ + \ + return new; \ +} + +#define ATOMIC64_OP (op, c_op) \ +static inline void arch_atomic64_##op(long i, atomic64_t *v) \ +{ \ + long new, old, ret; \ + \ + do { \ + old = v->counter; \ + new = old c_op i; \ + ret = arch_cmpxchg(&v->counter, old, new); \ + } while (ret != old); \ +} + +#define ATOMIC64_FETCH_OP (op, c_op) \ +static inline long arch_atomic64_fetch_##op(long i, atomic64_t *v) \ +{ \arch/kvx/include/asm/atomic.h line 67
Quoted 10 lines
arch/kvx/include/asm/atomic.h new file +10
-0+long new, old, ret; \ + \ +do { \ + old = v->counter; \ + new = old c_op i; \ + ret =arch_cmpxchg (&v->counter, old, new); \ + }while (ret != old); \ + \ +return old; \ +}These look ok, but it'd be nicer if we could teach the generic atomic64 code to do this, like the generic atomic code does.
Quoted 3 lines
We could rename the existing asm-generic/atomic64 code to atomic64-spinlock, and add a separate atomic64-cmpxchg (and likewise for the 32-bit code) to make that clearer and consistent.
I am not sure what this implies and how big this change might be, but I'll take a look at this.
Quoted 66 lines
Quoted 23 lines
arch/kvx/include/asm/atomic.h new file +23
-0+ +#define ATOMIC64_OPS(op, c_op) \ + ATOMIC64_OP(op, c_op) \ + ATOMIC64_RETURN_OP(op, c_op) \ + ATOMIC64_FETCH_OP(op, c_op) + +ATOMIC64_OPS(and, &) +ATOMIC64_OPS(or, |) +ATOMIC64_OPS(xor, ^) +ATOMIC64_OPS(add, +) +ATOMIC64_OPS(sub, -) + +#undef ATOMIC64_OPS +#undef ATOMIC64_FETCH_OP +#undef ATOMIC64_OP + +static inline int arch_atomic_add_return(int i, atomic_t *v) +{ + int new, old, ret; + + do { + old = v->counter; + new = old + i;arch/kvx/include/asm/atomic.h line 100
Quoted 10 lines
arch/kvx/include/asm/atomic.h new file +10
-0+ ret =arch_cmpxchg (&v->counter, old, new); + }while (ret != old); + +return new; +} + +static inline int arch_atomic_sub_return (int i,atomic_t *v) +{ +return arch_atomic_add_return (-i, v); +}Likewise for these two.
Quoted 30 lines
arch/kvx/include/asm/atomic.h new file +4
-0+ +#include <asm-generic/atomic.h> + +#endif /* _ASM_KVX_ATOMIC_H */ arch/kvx/include/asm/barrier.h new file +19
-0@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _ASM_KVX_BARRIER_H +#define _ASM_KVX_BARRIER_H +/* Bitmask modifiers */ +#define __NOP (x) (x) +#define __NOT (x) (~(x)) + + +#define __test_and_op_bit (nr, addr, op, mod) \ +({ \ + unsigned long __mask = BIT_MASK(nr); \ + unsigned long __new, __old, __ret; \ + do { \ + __old = *(&addr[BIT_WORD(nr)]); \
Quoted 8 lines
arch/kvx/include/asm/barrier.h
Quoted 5 lines
arch/kvx/include/asm/barrier.h new file +5
-0+ __new = __old op mod(__mask); \ + __ret =cmpxchg (addr, __old, __new); \ + }while (__ret != __old); \ + (__old & __mask); \ +})Please use <
asm-generic/bitops/atomic.h> which should give you the common bit operations "for free" atop your regular atomics.
Yes
Quoted 34 lines
[...]
Quoted 31 lines
arch/kvx/include/asm/cmpxchg.h new file +25
-0@@ -0,0 +1,185 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +* Yann Sionneau +*/ + +#ifndef _ASM_KVX_CMPXCHG_H +#define _ASM_KVX_CMPXCHG_H + +#include <linux/bits.h> +#include <linux/types.h> +#include <linux/build_bug.h> + +/* +* On kvx, we have a boolean compare and swap which means that the operation +* returns only the success of operation. +* If operation succeed, this is simple, we just need to return the provided +* old value. However, if it fails, we need to load the value to return it for +* the caller. If the loaded value is different from the "old" provided by the +* caller, we can return it since it will means it failed. +* However, if for some reason the value we read is equal to the old value +* provided by the caller, we can't simply return it or the caller will think it +* succeeded. So if the value we read is the same as the "old" provided by +* the caller, we try again until either we succeed or we fail with a different
Quoted 8 lines
arch/kvx/include/asm/cmpxchg.h line 31
Quoted 6 lines
arch/kvx/include/asm/cmpxchg.h new file +6
-0+* value than the provided one. +*/ +#define __cmpxchg (ptr, old, new, op_suffix, load_suffix) \ +({ \ + register unsigned long __rn asm("r62"); \ + register unsigned long __ro asm("r63"); \Why do you need to specify the exact registers?
r62 and r63 are hardcoded in the inline assembly, they are caller saved. I have a C implementation that uses builtins however this is not merged in our tree yet (but I want to).
Quoted 2 lines
e.g. does some instruction use these implicitly, or do you need two adjacent register for encoding reasons?
The atomic compare and swap (acswap) instruction needs a register "pair" which can only exists with "adjacent" registers: $r0r1, $r2r3 ect.
Quoted 8 lines
arch/kvx/include/asm/cmpxchg.h line 34
Quoted 3 lines
arch/kvx/include/asm/cmpxchg.h new file +3
-0+ __asm__ __volatile__ ( \ +/* Fence to guarantee previous store to be committed */ \ + "fence\n" \This implies you can implement the relaxed form of
cmpxchg().What ordering do you get by default, and do you have any other barriers (e.g. for acquire/release semantics), or just "fence" ?
We have two barrier types:
- fence: ensure that all uncached memory operations are committed to memory, typically used to ensure a write to memory is visible to other cores.
- barrier: flush the core instruction pipeline and memory system
Thanks,
-- Jules
Mark Rutland
maintainerRe: [RFC PATCH 05/25] kvx: Add atomic/locking headers
Quoted 78 lines · Jules Maselbas
Hi Mark,
Quoted 66 lines · Mark Rutland
Quoted 49 lines · Yann Sionneau
Add common headers (atomic, bitops, barrier and locking) for basic kvx support.
CC Will Deacon <[email protected]>CC Peter Zijlstra <[email protected]>CC Boqun Feng <[email protected]>CC Mark Rutland <[email protected]>Co-developed-by Clement Leger <[email protected]>Signed-off-by Clement Leger <[email protected]>Co-developed-by Jules Maselbas <[email protected]>Signed-off-by Jules Maselbas <[email protected]>Co-developed-by Julian Vetter <[email protected]>Signed-off-by Julian Vetter <[email protected]>Co-developed-by Julien Villette <[email protected]>Signed-off-by Julien Villette <[email protected]>Co-developed-by Yann Sionneau <[email protected]>Signed-off-by Yann Sionneau <[email protected]>--- arch/kvx/include/asm/atomic.h | 104 +++++++++++++++++ arch/kvx/include/asm/barrier.h | 15 +++ arch/kvx/include/asm/bitops.h | 207 +++++++++++++++++++++++++++++++++ arch/kvx/include/asm/bitrev.h | 32 +++++ arch/kvx/include/asm/cmpxchg.h | 185 +++++++++++++++++++++++++++++ 5 files changed, 543 insertions(+) create mode 100644 arch/kvx/include/asm/atomic.h create mode 100644 arch/kvx/include/asm/barrier.h create mode 100644 arch/kvx/include/asm/bitops.h create mode 100644 arch/kvx/include/asm/bitrev.h create mode 100644 arch/kvx/include/asm/cmpxchg.harch/kvx/include/asm/atomic.h new file +12
-0@@ -0,0 +1,104 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _ASM_KVX_ATOMIC_H +#define _ASM_KVX_ATOMIC_H + +#include <linux/types.h> + +#include <asm/cmpxchg.h> arch/kvx/include/asm/atomic.h line 22
Quoted 10 lines
arch/kvx/include/asm/atomic.h new file +10
-0+ +#define ATOMIC64_INIT (i) { (i) } + +#define arch_atomic64_cmpxchg (v, old, new) (arch_cmpxchg(&((v)->counter), old, new)) +#define arch_atomic64_xchg (v, new) (arch_xchg(&((v)->counter), new)) + +static inline long arch_atomic64_read (const atomic64_t *v) +{ +return v->counter; +}This is a plain read, and is *not* atomic.
The compiler can replay a plain read an arbitrary number of times, and is permitted to split it into smaller accesses.
Quoted 7 lines
At minimum this needs to be
READ_ONCE(v->counter)... which will prevent replay. Whether or not that's actually atomic will depend on the instructions the compiler generates, and how those instructions are defines in your architecture.
Good point, we are going to use {READ,WRITE}_ONCE macros
Quoted 8 lines
Quoted 2 lines
Do you have a single instruction that can read a 64-bit memory location, and is it guaranteed to result in a single access that cannot be split?
We do have a single instruction that can read a 64-bit memory location (supported sizes are 8, 16, 32, 64, 128, 256).
All accesses are guaranteed to not be split, unless they are misaligned. Furthermore, misaligned write accesses crossing a 32-byte boundary may complete in a non-atomic way.
Perfect, thanks for confirming!
[...]
Quoted 54 lines
Quoted 54 lines
arch/kvx/include/asm/atomic.h line 27
Quoted 4 lines
arch/kvx/include/asm/atomic.h new file +4
-0+static inline void arch_atomic64_set (atomic64_t *v,long i) +{ + v->counter = i; +}Same comments as for
arch_atomic64_read(); at minimum this needs to be:
WRITE_ONCE(v->counter, i)... but that may or may not actually be atomic on your architecture.
Quoted 29 lines
arch/kvx/include/asm/atomic.h new file +29
-0+#define ATOMIC64_RETURN_OP (op, c_op) \ +static inline long arch_atomic64_##op##_return(long i, atomic64_t *v) \ +{ \ + long new, old, ret; \ + \ + do { \ + old = v->counter; \ + new = old c_op i; \ + ret = arch_cmpxchg(&v->counter, old, new); \ + } while (ret != old); \ + \ + return new; \ +} + +#define ATOMIC64_OP (op, c_op) \ +static inline void arch_atomic64_##op(long i, atomic64_t *v) \ +{ \ + long new, old, ret; \ + \ + do { \ + old = v->counter; \ + new = old c_op i; \ + ret = arch_cmpxchg(&v->counter, old, new); \ + } while (ret != old); \ +} + +#define ATOMIC64_FETCH_OP (op, c_op) \ +static inline long arch_atomic64_fetch_##op(long i, atomic64_t *v) \ +{ \arch/kvx/include/asm/atomic.h line 67
Quoted 10 lines
arch/kvx/include/asm/atomic.h new file +10
-0+long new, old, ret; \ + \ +do { \ + old = v->counter; \ + new = old c_op i; \ + ret =arch_cmpxchg (&v->counter, old, new); \ + }while (ret != old); \ + \ +return old; \ +}These look ok, but it'd be nicer if we could teach the generic atomic64 code to do this, like the generic atomic code does.
Quoted 5 lines
Quoted 3 lines
We could rename the existing asm-generic/atomic64 code to atomic64-spinlock, and add a separate atomic64-cmpxchg (and likewise for the 32-bit code) to make that clearer and consistent.
I am not sure what this implies and how big this change might be, but I'll take a look at this.
Hmm... from a quick attempt just now it looks like that will be a bit more churny than I thought.
We can always factor this out later, so feel free to leave it as-is, thgouh if we could make this genric (and have it look like asm-generic/atomic.h), it'd be nice for consistency and maintenance.
Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
arch/kvx/include/asm/atomic.h new file +27
-0+ +#define ATOMIC64_OPS(op, c_op) \ + ATOMIC64_OP(op, c_op) \ + ATOMIC64_RETURN_OP(op, c_op) \ + ATOMIC64_FETCH_OP(op, c_op) + +ATOMIC64_OPS(and, &) +ATOMIC64_OPS(or, |) +ATOMIC64_OPS(xor, ^) +ATOMIC64_OPS(add, +) +ATOMIC64_OPS(sub, -) + +#undef ATOMIC64_OPS +#undef ATOMIC64_FETCH_OP +#undef ATOMIC64_OP + +static inline int arch_atomic_add_return(int i, atomic_t *v) +{ + int new, old, ret; + + do { + old = v->counter; + new = old + i; + ret = arch_cmpxchg(&v->counter, old, new); + } while (ret != old); + + return new;
Quoted 8 lines
Quoted 8 lines
arch/kvx/include/asm/atomic.h line 100
Quoted 6 lines
arch/kvx/include/asm/atomic.h new file +6
-0+} + +static inline int arch_atomic_sub_return (int i,atomic_t *v) +{ +return arch_atomic_add_return (-i, v); +}Likewise for these two.
The 32-bit atomics should come from asm-generic/atomic.h and not be necesary, that has both arch_atomic_add_return() and arch_atomic_sub_return().
Quoted 43 lines
Quoted 31 lines
Quoted 31 lines
arch/kvx/include/asm/cmpxchg.h new file +25
-0@@ -0,0 +1,185 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +* Yann Sionneau +*/ + +#ifndef _ASM_KVX_CMPXCHG_H +#define _ASM_KVX_CMPXCHG_H + +#include <linux/bits.h> +#include <linux/types.h> +#include <linux/build_bug.h> + +/* +* On kvx, we have a boolean compare and swap which means that the operation +* returns only the success of operation. +* If operation succeed, this is simple, we just need to return the provided +* old value. However, if it fails, we need to load the value to return it for +* the caller. If the loaded value is different from the "old" provided by the +* caller, we can return it since it will means it failed. +* However, if for some reason the value we read is equal to the old value +* provided by the caller, we can't simply return it or the caller will think it +* succeeded. So if the value we read is the same as the "old" provided by +* the caller, we try again until either we succeed or we fail with a different Quoted 8 lines
arch/kvx/include/asm/cmpxchg.h line 31
Quoted 6 lines
arch/kvx/include/asm/cmpxchg.h new file +6
-0+* value than the provided one. +*/ +#define __cmpxchg (ptr, old, new, op_suffix, load_suffix) \ +({ \ + register unsigned long __rn asm("r62"); \ + register unsigned long __ro asm("r63"); \Why do you need to specify the exact registers?
r62 and r63 are hardcoded in the inline assembly, they are caller saved. I have a C implementation that uses builtins however this is not merged in our tree yet (but I want to).
Quoted 5 lines
Quoted 2 lines
e.g. does some instruction use these implicitly, or do you need two adjacent register for encoding reasons?
The atomic compare and swap (acswap) instruction needs a register "pair" which can only exists with "adjacent" registers: $r0r1, $r2r3 ect.
Ok; and you don't have a way to ask GCC for an arbitrary register pair, so you chose r62+r63 as they can be clobbered?
It might be worth looking into using an __int128_t to give you a register pair, assuming your calling convention mandares adjacency of the two halves. That could give you the pair while giving the compiler freedom to chose any suitable pair (assuming you have a suitable operand modifier to extract the low/high registers from the asm operand.
Quoted 6 lines
Quoted 6 lines
arch/kvx/include/asm/cmpxchg.h line 34
Quoted 3 lines
arch/kvx/include/asm/cmpxchg.h new file +3
-0+ __asm__ __volatile__ ( \ +/* Fence to guarantee previous store to be committed */ \ + "fence\n" \This implies you can implement the relaxed form of
cmpxchg().
Quoted 7 lines
Quoted 2 lines
What ordering do you get by default, and do you have any other barriers (e.g. for acquire/release semantics), or just "fence" ?
We have two barrier types:
- fence: ensure that all uncached memory operations are committed to memory, typically used to ensure a write to memory is visible to other cores.
- barrier: flush the core instruction pipeline and memory system
Ok.
In the absence of barriers do you have any ordering guarantee? e.g. weak like arm/power, TSO like x86, or something else entirely?
When you say "uncached memory operations", does that mean that you have cached memory operatins which are not affected by the barriers, or is "uncached memory operations" just meant to read as "oustanding/incomplete memory operations" ?
Thanks,
Mark.
Re: [RFC PATCH 05/25] kvx: Add atomic/locking headers
Hi Mark,
Quoted 69 lines · Mark Rutland
Quoted 68 lines · Jules Maselbas
Hi Mark,
Quoted 65 lines · Mark Rutland
Quoted 49 lines · Yann Sionneau
Add common headers (atomic, bitops, barrier and locking) for basic kvx support.
CC Will Deacon <[email protected]>CC Peter Zijlstra <[email protected]>CC Boqun Feng <[email protected]>CC Mark Rutland <[email protected]>Co-developed-by Clement Leger <[email protected]>Signed-off-by Clement Leger <[email protected]>Co-developed-by Jules Maselbas <[email protected]>Signed-off-by Jules Maselbas <[email protected]>Co-developed-by Julian Vetter <[email protected]>Signed-off-by Julian Vetter <[email protected]>Co-developed-by Julien Villette <[email protected]>Signed-off-by Julien Villette <[email protected]>Co-developed-by Yann Sionneau <[email protected]>Signed-off-by Yann Sionneau <[email protected]>--- arch/kvx/include/asm/atomic.h | 104 +++++++++++++++++ arch/kvx/include/asm/barrier.h | 15 +++ arch/kvx/include/asm/bitops.h | 207 +++++++++++++++++++++++++++++++++ arch/kvx/include/asm/bitrev.h | 32 +++++ arch/kvx/include/asm/cmpxchg.h | 185 +++++++++++++++++++++++++++++ 5 files changed, 543 insertions(+)create mode 100644
arch/kvx/include/asm/atomic.hcreate mode 100644arch/kvx/include/asm/barrier.hcreate mode 100644arch/kvx/include/asm/bitops.hcreate mode 100644arch/kvx/include/asm/bitrev.hcreate mode 100644arch/kvx/include/asm/cmpxchg.harch/kvx/include/asm/atomic.h new file +12
-0@@ -0,0 +1,104 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _ASM_KVX_ATOMIC_H +#define _ASM_KVX_ATOMIC_H + +#include <linux/types.h> + +#include <asm/cmpxchg.h> arch/kvx/include/asm/atomic.h line 22
Quoted 10 lines
arch/kvx/include/asm/atomic.h new file +10
-0+ +#define ATOMIC64_INIT (i) { (i) } + +#define arch_atomic64_cmpxchg (v, old, new) (arch_cmpxchg(&((v)->counter), old, new)) +#define arch_atomic64_xchg (v, new) (arch_xchg(&((v)->counter), new)) + +static inline long arch_atomic64_read (const atomic64_t *v) +{ +return v->counter; +}This is a plain read, and is *not* atomic.
The compiler can replay a plain read an arbitrary number of times, and is permitted to split it into smaller accesses.
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
At minimum this needs to be
READ_ONCE(v->counter)... which will prevent replay. Whether or not that's actually atomic will depend on the instructions the compiler generates, and how those instructions are defines in your architecture.
Good point, we are going to use {READ,WRITE}_ONCE macros
Done for V2 (which we will send pretty soon).
Quoted 67 lines
Quoted 8 lines
Quoted 3 lines
Do you have a single instruction that can read a 64-bit memory location, and is it guaranteed to result in a single access that cannot be split?
We do have a single instruction that can read a 64-bit memory location (supported sizes are 8, 16, 32, 64, 128, 256).
All accesses are guaranteed to not be split, unless they are misaligned. Furthermore, misaligned write accesses crossing a 32-byte boundary may complete in a non-atomic way.Perfect, thanks for confirming!
[...]
Quoted 55 lines
Quoted 55 lines
arch/kvx/include/asm/atomic.h line 27
Quoted 4 lines
arch/kvx/include/asm/atomic.h new file +4
-0+static inline void arch_atomic64_set (atomic64_t *v,long i) +{ + v->counter = i; +}Same comments as for
arch_atomic64_read(); at minimum this needs to be:WRITE_ONCE(v->counter, i)... but that may or may not actually be atomic on your architecture.
Quoted 29 lines
arch/kvx/include/asm/atomic.h new file +29
-0+#define ATOMIC64_RETURN_OP (op, c_op) \ +static inline long arch_atomic64_##op##_return(long i, atomic64_t *v) \ +{ \ + long new, old, ret; \ + \ + do { \ + old = v->counter; \ + new = old c_op i; \ + ret = arch_cmpxchg(&v->counter, old, new); \ + } while (ret != old); \ + \ + return new; \ +} + +#define ATOMIC64_OP (op, c_op) \ +static inline void arch_atomic64_##op(long i, atomic64_t *v) \ +{ \ + long new, old, ret; \ + \ + do { \ + old = v->counter; \ + new = old c_op i; \ + ret = arch_cmpxchg(&v->counter, old, new); \ + } while (ret != old); \ +} + +#define ATOMIC64_FETCH_OP (op, c_op) \ +static inline long arch_atomic64_fetch_##op(long i, atomic64_t *v) \ +{ \arch/kvx/include/asm/atomic.h line 67
Quoted 10 lines
arch/kvx/include/asm/atomic.h new file +10
-0+long new, old, ret; \ + \ +do { \ + old = v->counter; \ + new = old c_op i; \ + ret =arch_cmpxchg (&v->counter, old, new); \ + }while (ret != old); \ + \ +return old; \ +}These look ok, but it'd be nicer if we could teach the generic atomic64 code to do this, like the generic atomic code does.
We could rename the existing asm-generic/atomic64 code to atomic64-spinlock, and add a separate atomic64-cmpxchg (and likewise for the 32-bit code) to make that clearer and consistent.
Quoted 8 lines
Quoted 2 lines
I am not sure what this implies and how big this change might be, but I'll take a look at this.
Hmm... from a quick attempt just now it looks like that will be a bit more churny than I thought.
We can always factor this out later, so feel free to leave it as-is, thgouh if we could make this genric (and have it look like
asm-generic/atomic.h), it'd be nice for consistency and maintenance.
Ack for doing it later.
Quoted 84 lines
Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
arch/kvx/include/asm/atomic.h new file +26
-0+ +#define ATOMIC64_OPS(op, c_op) \ + ATOMIC64_OP(op, c_op) \ + ATOMIC64_RETURN_OP(op, c_op) \ + ATOMIC64_FETCH_OP(op, c_op) + +ATOMIC64_OPS(and, &) +ATOMIC64_OPS(or, |) +ATOMIC64_OPS(xor, ^) +ATOMIC64_OPS(add, +) +ATOMIC64_OPS(sub, -) + +#undef ATOMIC64_OPS +#undef ATOMIC64_FETCH_OP +#undef ATOMIC64_OP + +static inline int arch_atomic_add_return(int i, atomic_t *v) +{ + int new, old, ret; + + do { + old = v->counter; + new = old + i; + ret = arch_cmpxchg(&v->counter, old, new); + } while (ret != old); +Quoted 8 lines
Quoted 8 lines
arch/kvx/include/asm/atomic.h line 100
Quoted 7 lines
arch/kvx/include/asm/atomic.h new file +7
-0+return new; +} + +static inline int arch_atomic_sub_return (int i,atomic_t *v) +{ +return arch_atomic_add_return (-i, v); +}Likewise for these two.
The 32-bit atomics should come from
asm-generic/atomic.hand not be necesary, that has botharch_atomic_add_return()andarch_atomic_sub_return().Quoted 38 lines
Quoted 30 lines
Quoted 30 lines
arch/kvx/include/asm/cmpxchg.h new file +24
-0@@ -0,0 +1,185 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +* Yann Sionneau +*/ + +#ifndef _ASM_KVX_CMPXCHG_H +#define _ASM_KVX_CMPXCHG_H + +#include <linux/bits.h> +#include <linux/types.h> +#include <linux/build_bug.h> + +/* +* On kvx, we have a boolean compare and swap which means that the operation +* returns only the success of operation. +* If operation succeed, this is simple, we just need to return the provided +* old value. However, if it fails, we need to load the value to return it for +* the caller. If the loaded value is different from the "old" provided by the +* caller, we can return it since it will means it failed. +* However, if for some reason the value we read is equal to the old value +* provided by the caller, we can't simply return it or the caller will think it +* succeeded. So if the value we read is the same as the "old" provided by Quoted 8 lines
arch/kvx/include/asm/cmpxchg.h line 31
Quoted 7 lines
arch/kvx/include/asm/cmpxchg.h new file +7
-0+* the caller, we try again until either we succeed or we fail with a different +* value than the provided one. +*/ +#define __cmpxchg (ptr, old, new, op_suffix, load_suffix) \ +({ \ + register unsigned long __rn asm("r62"); \ + register unsigned long __ro asm("r63"); \Why do you need to specify the exact registers?
Quoted 8 lines
r62 and r63 are hardcoded in the inline assembly, they are caller saved. I have a C implementation that uses builtins however this is not merged in our tree yet (but I want to).
Quoted 2 lines
e.g. does some instruction use these implicitly, or do you need two adjacent register for encoding reasons?
The atomic compare and swap (acswap) instruction needs a register "pair" which can only exists with "adjacent" registers: $r0r1, $r2r3 ect.
Quoted 8 lines
Ok; and you don't have a way to ask GCC for an arbitrary register pair, so you chose r62+r63 as they can be clobbered?
It might be worth looking into using an
__int128_tto give you a register pair, assuming your calling convention mandares adjacency of the two halves. That could give you the pair while giving the compiler freedom to chose any suitable pair (assuming you have a suitable operand modifier to extract the low/high registers from the asm operand.
In the V2 we replaced the assembly code with C code.
acswap{d,w} instruction is generated by the mean of a compiler builtin. This way
the code is much more readable and it allows to not hard code some
register pair, letting the compiler allocate them.
Quoted 13 lines
Quoted 6 lines
Quoted 6 lines
arch/kvx/include/asm/cmpxchg.h line 34
Quoted 4 lines
arch/kvx/include/asm/cmpxchg.h new file +3
-0+ __asm__ __volatile__ ( \ +/* Fence to guarantee previous store to be committed */ \ + "fence\n" \This implies you can implement the relaxed form of
cmpxchg().Quoted 7 lines
Quoted 2 lines
What ordering do you get by default, and do you have any other barriers (e.g. for acquire/release semantics), or just "fence" ?
We have two barrier types:
- fence: ensure that all uncached memory operations are committed to memory, typically used to ensure a write to memory is visible to other cores.
- barrier: flush the core instruction pipeline and memory system
Quoted 4 lines
Ok.
In the absence of barriers do you have any ordering guarantee? e.g. weak like arm/power, TSO like x86, or something else entirely?
Our memory ordering model is weak.
``` store @data_addr = new_value ;; store @data_is_valid_addr = 1 ;; ```
By running the previous pseudo-code, there is no guarantee that another CPU would see the *data_addr == new_value just because it sees *data_is_valid_addr == 1
The correct code would need an extra bundle containing a fence instruction in-between the 2 other bundles.
Quoted 3 lines
When you say "uncached memory operations", does that mean that you have cached memory operatins which are not affected by the barriers, or is "uncached memory operations" just meant to read as "oustanding/incomplete memory operations" ?
The fence instruction will force all outstanding memory write operations to finish and reach their target.
* For an uncached access it means that after the fence the DDR has been updated (or the target device register).
* For a cached access it means the L2 cache has been updated, and therefore all the corresponding L1D lines invalidated. (L1I is untouched!)
Bottom line is that after the fence, all other cores of the cluster running Linux will see the new value. Except of course if the write is through an uncached MMU mapping and the read is done through a cached MMU mapping, but this seems normal.
Thanks for the review, it's much appreciated!
Signature · 1 line
Yann
RFC PATCH 6/25 kvx: Add other common headers
In reply to Yann SionneauAdd some other common headers for basic kvx support.
--- arch/kvx/include/asm/asm-prototypes.h | 14 ++++++++ arch/kvx/include/asm/clocksource.h | 17 +++++++++ arch/kvx/include/asm/linkage.h | 13 +++++++ arch/kvx/include/asm/pci.h | 36 +++++++++++++++++++ arch/kvx/include/asm/sections.h | 18 ++++++++++ arch/kvx/include/asm/spinlock.h | 16 +++++++++ arch/kvx/include/asm/spinlock_types.h | 17 +++++++++ arch/kvx/include/asm/stackprotector.h | 47 +++++++++++++++++++++++++ arch/kvx/include/asm/timex.h | 20 +++++++++++ arch/kvx/include/asm/types.h | 12 +++++++ arch/kvx/include/uapi/asm/bitsperlong.h | 14 ++++++++ arch/kvx/include/uapi/asm/byteorder.h | 12 +++++++ tools/include/uapi/asm/bitsperlong.h | 2 ++ 13 files changed, 238 insertions(+) create mode 100644 arch/kvx/include/asm/asm-prototypes.h create mode 100644 arch/kvx/include/asm/clocksource.h create mode 100644 arch/kvx/include/asm/linkage.h create mode 100644 arch/kvx/include/asm/pci.h create mode 100644 arch/kvx/include/asm/sections.h create mode 100644 arch/kvx/include/asm/spinlock.h create mode 100644 arch/kvx/include/asm/spinlock_types.h create mode 100644 arch/kvx/include/asm/stackprotector.h create mode 100644 arch/kvx/include/asm/timex.h create mode 100644 arch/kvx/include/asm/types.h create mode 100644 arch/kvx/include/uapi/asm/bitsperlong.h create mode 100644 arch/kvx/include/uapi/asm/byteorder.h
arch/kvx/include/asm/asm-prototypes.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _ASM_KVX_ASM_PROTOTYPES_H +#define _ASM_KVX_ASM_PROTOTYPES_H + +#include <asm/string.h> + +#include <asm-generic/asm-prototypes.h> + +#endif /* _ASM_KVX_ASM_PROTOTYPES_H */
arch/kvx/include/asm/clocksource.h new file +17 -0
@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Yann Sionneau +* Clement Leger +*/ + +#ifndef _ASM_KVX_CLOCKSOURCE_H +#define _ASM_KVX_CLOCKSOURCE_H + +#include <linux/compiler.h> + +struct arch_clocksource_data { +void __iomem *regs; +}; + +#endif /* _ASM_KVX_CLOCKSOURCE_H */
arch/kvx/include/asm/linkage.h new file +13 -0
@@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Yann Sionneau +*/ + +#ifndef __ASM_KVX_LINKAGE_H +#define __ASM_KVX_LINKAGE_H + +#define __ALIGN .align 4 +#define __ALIGN_STR ".align 4" + +#endif
arch/kvx/include/asm/pci.h new file +36 -0
@@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Vincent Chardon +* Clement Leger +*/ + +#ifndef __ASM_KVX_PCI_H_ +#define __ASM_KVX_PCI_H_ + +#include <linux/dma-mapping.h> +#include <linux/pci.h> +#include <linux/of_gpio.h> + +#define ARCH_GENERIC_PCI_MMAP_RESOURCE 1 +#define HAVE_PCI_MMAP 1 + +extern int isa_dma_bridge_buggy; + +/* Can be used to override the logic in pci_scan_bus for skipping +* already-configured bus numbers - to be used for buggy BIOSes +* or architectures with incomplete PCI setup by the loader. +*/ +#define pcibios_assign_all_busses () 0 + +#define PCIBIOS_MIN_IO 0UL +#define PCIBIOS_MIN_MEM 0UL + +#ifdef CONFIG_PCI_DOMAINS +static inline int pci_proc_domain (struct pci_bus *bus) +{ +return pci_domain_nr (bus); +} +#endif /* CONFIG_PCI_DOMAINS */ + +#endif /* _ASM_KVX_PCI_H */
arch/kvx/include/asm/sections.h new file +18 -0
@@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _ASM_KVX_SECTIONS_H +#define _ASM_KVX_SECTIONS_H + +#include <asm-generic/sections.h> + +extern char __rodata_start[], __rodata_end[]; +extern char __initdata_start[], __initdata_end[]; +extern char __inittext_start[], __inittext_end[]; +extern char __exception_start[], __exception_end[]; +extern char __rm_firmware_regs_start[]; + +#endif
arch/kvx/include/asm/spinlock.h new file +16 -0
@@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _ASM_KVX_SPINLOCK_H +#define _ASM_KVX_SPINLOCK_H + +#include <asm/qspinlock.h> +#include <asm/qrwlock.h> + +/* See include/linux/spinlock.h */ +#define smp_mb__after_spinlock () smp_mb() + +#endif
arch/kvx/include/asm/spinlock_types.h new file +17 -0
@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _ASM_KVX_SPINLOCK_TYPES_H +#define _ASM_KVX_SPINLOCK_TYPES_H + +#if !defined(__LINUX_SPINLOCK_TYPES_RAW_H) && !defined(__ASM_SPINLOCK_H) +# error "please don't include this file directly" +#endif + +#include <asm-generic/qspinlock_types.h> +#include <asm-generic/qrwlock_types.h> + +#endif /* _ASM_KVX_SPINLOCK_TYPES_H */
arch/kvx/include/asm/stackprotector.h new file +47 -0
47 lines not on this page · raw message
arch/kvx/include/asm/timex.h new file +20 -0
@@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _ASM_KVX_TIMEX_H +#define _ASM_KVX_TIMEX_H + +#define get_cycles get_cycles + +#include <asm/sfr.h> +#include <asm-generic/timex.h> + +static inline cycles_t get_cycles (void ) +{ +return kvx_sfr_get (PM0 ); +} + +#endif /* _ASM_KVX_TIMEX_H */
arch/kvx/include/asm/types.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _ASM_KVX_TYPES_H +#define _ASM_KVX_TYPES_H + +#include <asm-generic/int-ll64.h> + +#endif /* _ASM_KVX_TYPES_H */
arch/kvx/include/uapi/asm/bitsperlong.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _UAPI_ASM_KVX_BITSPERLONG_H +#define _UAPI_ASM_KVX_BITSPERLONG_H + +#define __BITS_PER_LONG 64 + +#include <asm-generic/bitsperlong.h> + +#endif /* _UAPI_ASM_KVX_BITSPERLONG_H */
arch/kvx/include/uapi/asm/byteorder.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _ASM_KVX_BYTEORDER_H +#define _ASM_KVX_BYTEORDER_H + +#include <linux/byteorder/little_endian.h> + +#endif /* _ASM_KVX_BYTEORDER_H */
tools/include/uapi/asm/bitsperlong.h +2 -0
@@ -19,6 +19,8 @@#include "../../../arch/alpha/include/uapi/asm/bitsperlong.h" #elif defined(__loongarch__)#include "../../../arch/loongarch/include/uapi/asm/bitsperlong.h" +#elif defined(__kvx__) +#include "../../../arch/kvx/include/uapi/asm/bitsperlong.h" #else #include <asm-generic/bitsperlong.h> #endif
Signature · 1 line
2.37.2
RFC PATCH 7/25 kvx: Add boot and setup routines
In reply to Yann SionneauAdd basic boot, setup and reset routines for kvx.
--- arch/kvx/include/asm/setup.h | 29 ++ arch/kvx/kernel/common.c | 11 + arch/kvx/kernel/head.S | 612 +++++++++++++++++++++++++++++++++++ arch/kvx/kernel/prom.c | 24 ++ arch/kvx/kernel/reset.c | 37 +++ arch/kvx/kernel/setup.c | 178 ++++++++++ arch/kvx/kernel/time.c | 242 ++++++++++++++ 7 files changed, 1133 insertions(+) create mode 100644 arch/kvx/include/asm/setup.h create mode 100644 arch/kvx/kernel/common.c create mode 100644 arch/kvx/kernel/head.S create mode 100644 arch/kvx/kernel/prom.c create mode 100644 arch/kvx/kernel/reset.c create mode 100644 arch/kvx/kernel/setup.c create mode 100644 arch/kvx/kernel/time.c
arch/kvx/include/asm/setup.h new file +29 -0
@@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _ASM_KVX_SETUP_H +#define _ASM_KVX_SETUP_H + +#include <linux/const.h> + +#include <asm-generic/setup.h> + +/* Magic is found in r0 when some parameters are given to kernel */ +#define LINUX_BOOT_PARAM_MAGIC ULL(0x31564752414E494C) + +#ifndef __ASSEMBLY__ + +void early_fixmap_init (void ); + +void setup_device_tree (void ); + +void setup_arch_memory (void ); + +void kvx_init_mmu (void ); + +#endif + +#endif /* _ASM_KVX_SETUP_H */
arch/kvx/kernel/common.c new file +11 -0
@@ -0,0 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#include <linux/percpu-defs.h> +#include <linux/sched/task.h> + +DEFINE_PER_CPU (int, __preempt_count) =INIT_PREEMPT_COUNT ; +EXPORT_PER_CPU_SYMBOL (__preempt_count);
arch/kvx/kernel/head.S new file +612 -0
612 lines not on this page · raw message
arch/kvx/kernel/prom.c new file +24 -0
@@ -0,0 +1,24 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#include <linux/of_platform.h> +#include <linux/of_fdt.h> +#include <linux/printk.h> +#include <linux/init.h> + +void __init setup_device_tree (void ) +{ +const char *name; + + name =of_flat_dt_get_machine_name (); +if (!name) +return ; + +pr_info ("Machine model: %s\n" , name); +dump_stack_set_arch_desc ("%s (DT)" , name); + +unflatten_device_tree (); +}
arch/kvx/kernel/reset.c new file +37 -0
@@ -0,0 +1,37 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#include <linux/pm.h> +#include <linux/reboot.h> + +#include <asm/processor.h> + +static void kvx_default_power_off (void ) +{ +smp_send_stop (); +local_cpu_stop (); +} + +void (*pm_power_off)(void ) = kvx_default_power_off; +EXPORT_SYMBOL (pm_power_off); + +void machine_restart (char *cmd) +{ +smp_send_stop (); +do_kernel_restart (cmd); +pr_err ("Reboot failed -- System halted\n" ); +local_cpu_stop (); +} + +void machine_halt (void ) +{ +pm_power_off (); +} + +void machine_power_off (void ) +{ +pm_power_off (); +}
arch/kvx/kernel/setup.c new file +178 -0
178 lines not on this page · raw message
arch/kvx/kernel/time.c new file +242 -0
242 lines not on this page · raw message
Signature · 1 line
2.37.2
RFC PATCH 8/25 kvx: Add exception/interrupt handling
In reply to Yann SionneauAdd the exception and interrupt handling machanism for basic kvx support.
--- arch/kvx/include/asm/break_hook.h | 69 +++++++++ arch/kvx/include/asm/bug.h | 67 ++++++++ arch/kvx/include/asm/dame.h | 31 ++++ arch/kvx/include/asm/hardirq.h | 14 ++ arch/kvx/include/asm/hw_irq.h | 14 ++ arch/kvx/include/asm/ipi.h | 16 ++ arch/kvx/include/asm/irqflags.h | 58 +++++++ arch/kvx/include/asm/stacktrace.h | 44 ++++++ arch/kvx/include/asm/traps.h | 76 ++++++++++ arch/kvx/kernel/dame_handler.c | 113 ++++++++++++++ arch/kvx/kernel/irq.c | 78 ++++++++++ arch/kvx/kernel/traps.c | 243 ++++++++++++++++++++++++++++++ arch/kvx/platform/ipi.c | 110 ++++++++++++++ 13 files changed, 933 insertions(+) create mode 100644 arch/kvx/include/asm/break_hook.h create mode 100644 arch/kvx/include/asm/bug.h create mode 100644 arch/kvx/include/asm/dame.h create mode 100644 arch/kvx/include/asm/hardirq.h create mode 100644 arch/kvx/include/asm/hw_irq.h create mode 100644 arch/kvx/include/asm/ipi.h create mode 100644 arch/kvx/include/asm/irqflags.h create mode 100644 arch/kvx/include/asm/stacktrace.h create mode 100644 arch/kvx/include/asm/traps.h create mode 100644 arch/kvx/kernel/dame_handler.c create mode 100644 arch/kvx/kernel/irq.c create mode 100644 arch/kvx/kernel/traps.c create mode 100644 arch/kvx/platform/ipi.c
arch/kvx/include/asm/break_hook.h new file +69 -0
@@ -0,0 +1,69 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef __ASM_KVX_BREAK_HOOK_H_ +#define __ASM_KVX_BREAK_HOOK_H_ + +#include <linux/types.h> + +#include <asm/sfr_defs.h> +#include <asm/insns_defs.h> + +/* +* The following macros define the different causes of break: +* We use the `set $vsfr0 = $rXX` instruction which will raise a trap into the +* debugger. The trapping instruction is read and decoded to extract the source +* register number. The source register number is used to differentiate the +* trap cause. +*/ +#define BREAK_CAUSE_BUG KVX_REG_R1 +#define BREAK_CAUSE_KGDB_DYN KVX_REG_R2 +#define BREAK_CAUSE_KGDB_COMP KVX_REG_R3 +#define BREAK_CAUSE_BKPT KVX_REG_R63 + +/** +* enum break_ret - Break return value +* @BREAK_HOOK_HANDLED: Hook handled successfully +* @BREAK_HOOK_ERROR: Hook was not handled +*/ +enum break_ret { +BREAK_HOOK_HANDLED =0 , +BREAK_HOOK_ERROR =1 , +}; + +/* +* The following macro assembles a `set` instruction targeting $vsfr0 +* using the source register whose number is __id. +*/ +#define KVX_BREAK_INSN (__id) \ + KVX_INSN_SET_SYLLABLE_0(KVX_INSN_PARALLEL_EOB, KVX_SFR_VSFR0, __id) + +#define KVX_BREAK_INSN_SIZE (KVX_INSN_SET_SIZE * KVX_INSN_SYLLABLE_WIDTH) + +struct pt_regs ; + +/** +* struct break_hook - Break hook description +* @node: List node +* @handler: handler called when break matches this hook +* @imm: Immediate value expected for break insn +* @mode: Hook mode (user/kernel) +*/ +struct break_hook { +struct list_head node; +int (*handler)(struct break_hook *brk_hook,struct pt_regs *regs); +u8 id; +u8 mode; +}; + +void kvx_skip_break_insn (struct pt_regs *regs); + +void break_hook_register (struct break_hook *brk_hook); +void break_hook_unregister (struct break_hook *brk_hook); + +int break_hook_handler (u64 es,struct pt_regs *regs); + +#endif /* __ASM_KVX_BREAK_HOOK_H_ */
arch/kvx/include/asm/bug.h new file +67 -0
67 lines not on this page · raw message
arch/kvx/include/asm/dame.h new file +31 -0
@@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _ASM_KVX_DAME_H +#define _ASM_KVX_DAME_H + +#include <asm/sfr.h> +#include <asm/ptrace.h> + +static inline void dame_irq_check (struct pt_regs *regs) +{ +#ifdef CONFIG_SECURE_DAME_HANDLING +unsigned long ilr; +/* If we are returning to the kernel, no need to check for DAME */ +if (!user_mode (regs)) +return ; + +/* Else, make sure we do a barrier to trig any pending DAME IRQ */ +__builtin_kvx_barrier (); + +/* Check if we triggered a DAME */ + ilr =kvx_sfr_get (ILR ); +if (ilr &KVX_SFR_ILR_IT16_MASK ) +panic ("DAME error encountered while in kernel !!!!\n" ); +#endif +} + +#endif /* _ASM_KVX_DAME_H */
arch/kvx/include/asm/hardirq.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _ASM_KVX_HARDIRQ_H +#define _ASM_KVX_HARDIRQ_H + +#define __ARCH_IRQ_EXIT_IRQS_DISABLED 1 + +#include <asm-generic/hardirq.h> + +#endif /* _ASM_KVX_HARDIRQ_H */
arch/kvx/include/asm/hw_irq.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* derived from arch/mips/include/asm/ide.h +* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _ASM_KVX_HW_IRQ_H +#define _ASM_KVX_HW_IRQ_H + +void kvx_init_core_irq (void ); + +#endif /* _ASM_KVX_HW_IRQ_H */
arch/kvx/include/asm/ipi.h new file +16 -0
@@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _ASM_KVX_IPI_H +#define _ASM_KVX_IPI_H + +#include <linux/irqreturn.h> + +int kvx_ipi_ctrl_probe (irqreturn_t (*ipi_irq_handler)(int ,void *)); + +void kvx_ipi_send (const struct cpumask *mask); + +#endif /* _ASM_KVX_IPI_H */
arch/kvx/include/asm/irqflags.h new file +58 -0
58 lines not on this page · raw message
arch/kvx/include/asm/stacktrace.h new file +44 -0
44 lines not on this page · raw message
arch/kvx/include/asm/traps.h new file +76 -0
76 lines not on this page · raw message
arch/kvx/kernel/dame_handler.c new file +113 -0
113 lines not on this page · raw message
arch/kvx/kernel/irq.c new file +78 -0
78 lines not on this page · raw message
arch/kvx/kernel/traps.c new file +243 -0
243 lines not on this page · raw message
arch/kvx/platform/ipi.c new file +110 -0
110 lines not on this page · raw message
Signature · 1 line
2.37.2
Re: [RFC PATCH 08/25] kvx: Add exception/interrupt handling
Quoted 21 lines · Yann Sionneau
arch/kvx/kernel/irq.c new file +18
-0@@ -0,0 +1,78 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#include <linux/irqdomain.h> +#include <linux/irqflags.h> +#include <linux/hardirq.h> +#include <linux/irqchip.h> +#include <linux/bitops.h> +#include <linux/init.h> + +#include <asm/dame.h> + +#define IT_MASK (__it) (KVX_SFR_ILL_ ## __it ## _MASK) +#define IT_LEVEL (__it, __level) \ + (__level##ULL << KVX_SFR_ILL_ ## __it ## _SHIFT)
arch/kvx/kernel/irq.c line 28
Quoted 10 lines
arch/kvx/kernel/irq.c new file +10
-0+ +void do_IRQ (unsigned long hwirq_mask,struct pt_regs *regs) +{ +struct pt_regs *old_regs =set_irq_regs (regs); +int irq; +unsigned int hwirq; + +trace_hardirqs_off (); + +irq_enter ();
Please use the generic entry code for interrupts to handle tracing, irq_enter() etc. correctly.
arch/kvx/kernel/irq.c line 39
Quoted 11 lines
arch/kvx/kernel/irq.c new file +11
-0+/** +* trap_handler - trap handler called by _trap_handler routine in trap_handler.S +* This handler will redirect to other trap handlers if present +* If not then it will do a generic action +* @es: Exception Syndrome register value +* @ea: Exception Address register +* @regs: pointer to registers saved when trapping +*/ +void trap_handler (uint64_t es,uint64_t ea,struct pt_regs *regs) +{ +enum ctx_state prev_state =exception_enter ();
Please do not implement exception_enter/exit(). Use the generic entry handling code so your code is correct and extensible.
Thanks,
tglx
RFC PATCH 9/25 kvx: irqchip: Add support for irq controllers
In reply to Yann SionneauAdd support for kvx irq controllers found in Coolidge MPPA SoC
The core-intc:
Each kvx core includes a hardware interrupt controller (core ITC) with the following features:
* 32 independent interrupt sources
* 4-bit priotity level
* Individual interrupt enable bit
* Interrupt status bit displaying the pending interrupts
* Priority management between the 32 interrupts
Among those 32 interrupt sources, the first are hard-wired to hardware sources. The remaining interrupt sources can be triggered via software by directly writing to the ILR SFR.
The hard-wired interrupt sources are the following:
0: Timer 0
1: Timer 1
2: Watchdog
3: Performance Monitors
4: APIC GIC line 0
5: APIC GIC line 1
6: APIC GIC line 2
7: APIC GIC line 3
12: SECC error from memory system
13: Arithmetic exception (carry and IEEE 754 flags)
16: Data Asynchronous Memory Error (DAME), raised for DECC/DSYS errors 17: CLI (Cache Line Invalidation) for L1D or L1I following DECC/DSYS/Parity
errors
The APIC GIC lines will be used to route interrupts coming from SoC peripherals from outside the Cluster to the kvx core. Those peripherals include USB host controller, eMMC/SD host controller, i2c, spi, PCIe, IOMMUs etc...
The APIC GIC:
Each Cluster of the Coolidge SoC includes an APIC
(Advanced Programmable Interrupt Controller) GIC (Generic Interrupt Controller). The APIC GIC acts as an intermediary interrupt controller, muxing/routing incoming interrupts to output interrupts connected to the kvx core ITC lines. The first 128 incoming interrupt lines come from the mailbox controller (itself containing 128 mailboxes).
The remaining 11 interrupt lines come from external interrupt sources (NoC router, the 5 IOMMUs, L2$ DMA job fifo, watchdog, SECC, DECC, D NoC). The APIC GIC has 72 output interrupts: 4 per kvx cores in the cluster (1 RM and 16 PE) connected to the "APIC GIC lines" described above and 1 for the L2$ controller which makes 69 interrupts lines (rounded up to 72).
The APIC Mailbox:
The APIC includes a mailbox controller, containing 128 mailboxes. This hardware block is basically a 1 Kb of smart memory space. Each mailbox is an 8 bytes word memory location which can generate and interrupt.
Each mailbox has a trigger function and an input function. When a mailbox is written to, if the condition described by the trigger function is satisfied, the corresponding interrupt will fire.
Since this hardware block generates IRQs based on writes
at some memory locations, it is both an interrupt controller and an MSI controller.
The ITGEN:
The ITGEN (InTerrupt GENerator) is an interrupt controller block. It's purpose is to convert IRQ lines coming from SoC peripherals (USB host controller for instance) into writes on the AXI bus. Those writes are targeting the APIC Mailboxes.
--- .../kalray,kvx-core-intc.txt | 22 + drivers/irqchip/Kconfig | 27 + drivers/irqchip/Makefile | 4 + drivers/irqchip/irq-kvx-apic-gic.c | 349 +++++++++++++ drivers/irqchip/irq-kvx-apic-mailbox.c | 465 ++++++++++++++++++ drivers/irqchip/irq-kvx-core-intc.c | 82 +++ drivers/irqchip/irq-kvx-itgen.c | 224 +++++++++ include/linux/irqchip/irq-kvx-apic-gic.h | 21 + include/linux/irqchip/irq-kvx-apic-mailbox.h | 29 ++ include/linux/irqchip/irq-kvx-itgen.h | 24 + 10 files changed, 1247 insertions(+) create mode 100644 Documentation/devicetree/bindings/interrupt-controller/kalray,kvx-core-intc.txt create mode 100644 drivers/irqchip/irq-kvx-apic-gic.c create mode 100644 drivers/irqchip/irq-kvx-apic-mailbox.c create mode 100644 drivers/irqchip/irq-kvx-core-intc.c create mode 100644 drivers/irqchip/irq-kvx-itgen.c create mode 100644 include/linux/irqchip/irq-kvx-apic-gic.h create mode 100644 include/linux/irqchip/irq-kvx-apic-mailbox.h create mode 100644 include/linux/irqchip/irq-kvx-itgen.h
Documentation/devicetree/bindings/interrupt-controller/kalray,kvx-core-intc.txt new file +22 -0
@@ -0,0 +1,22 @@ +* KVX Core Interrupt controller + +Required properties: + +- compatible: must to be "kalray,kvx-core-intc". +- interrupt-controller +- #interrupt-cells: has to be <1>: an interrupt index +- regs: Base address of interrupt controller registers. + +Optional properties: + +- kalray,intc-nr-irqs: Number of irqs handled by the controller. + if not given, will default to 32. + +Example: + + core_intc: core_intc@0 { + compatible = "kalray,kvx-core-intc"; + #interrupt-cells = <1>; + interrupt-controller; + interrupt-parent = <&core_intc>; + };
drivers/irqchip/Kconfig +27 -0
@@ -334,6 +334,33 @@ config MIPS_GIC select IRQ_DOMAIN_HIERARCHY select MIPS_CM +config KVX_CORE_INTC + bool + depends on KVX + select IRQ_DOMAIN + +config KVX_APIC_GIC + bool + depends on KVX + select IRQ_DOMAIN + select IRQ_DOMAIN_HIERARCHY + +config KVX_APIC_MAILBOX + bool + depends on KVX + select GENERIC_IRQ_IPI if SMP + select GENERIC_MSI_IRQ_DOMAIN + select IRQ_DOMAIN + select IRQ_DOMAIN_HIERARCHY + +config KVX_ITGEN + bool + depends on KVX + select GENERIC_IRQ_IPI if SMP + select GENERIC_MSI_IRQ_DOMAIN + select IRQ_DOMAIN + select IRQ_DOMAIN_HIERARCHY + config INGENIC_IRQ bool depends on MACH_INGENIC
drivers/irqchip/Makefile +4 -0
@@ -69,6 +69,10 @@ obj-$(CONFIG_BCM7120_L2_IRQ) += irq-bcm7120-l2.o obj-$(CONFIG_BRCMSTB_L2_IRQ) += irq-brcmstb-l2.o obj-$(CONFIG_KEYSTONE_IRQ) += irq-keystone.o obj-$(CONFIG_MIPS_GIC) += irq-mips-gic.o +obj-$(CONFIG_KVX_CORE_INTC) += irq-kvx-core-intc.o +obj-$(CONFIG_KVX_APIC_GIC) += irq-kvx-apic-gic.o +obj-$(CONFIG_KVX_APIC_MAILBOX) += irq-kvx-apic-mailbox.o +obj-$(CONFIG_KVX_ITGEN) += irq-kvx-itgen.o obj-$(CONFIG_ARCH_MEDIATEK) += irq-mtk-sysirq.o irq-mtk-cirq.o obj-$(CONFIG_ARCH_DIGICOLOR) += irq-digicolor.o obj-$(CONFIG_ARCH_SA1100) += irq-sa11x0.o
drivers/irqchip/irq-kvx-apic-gic.c new file +349 -0
349 lines not on this page · raw message
drivers/irqchip/irq-kvx-apic-mailbox.c new file +465 -0
465 lines not on this page · raw message
drivers/irqchip/irq-kvx-core-intc.c new file +82 -0
82 lines not on this page · raw message
drivers/irqchip/irq-kvx-itgen.c new file +224 -0
224 lines not on this page · raw message
include/linux/irqchip/irq-kvx-apic-gic.h new file +21 -0
@@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2018-2023 Kalray Inc. +* Author: Clement Leger +*/ + +#ifndef KVX_APIC_GIC_H +#define KVX_APIC_GIC_H + +/* GIC enable register definitions */ +#define KVX_GIC_ENABLE_OFFSET 0x0 +#define KVX_GIC_ENABLE_ELEM_SIZE 0x1 +#define KVX_GIC_INPUT_IT_COUNT 0x9D +#define KVX_GIC_ELEM_SIZE 0x400 + +/* GIC status lac register definitions */ +#define KVX_GIC_STATUS_LAC_OFFSET 0x120 +#define KVX_GIC_STATUS_LAC_ELEM_SIZE 0x8 +#define KVX_GIC_STATUS_LAC_ARRAY_SIZE 0x3 + +#endif /* KVX_APIC_GIC_H */
include/linux/irqchip/irq-kvx-apic-mailbox.h new file +29 -0
@@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2018-2023 Kalray Inc. +*/ + +#ifndef IRQ_KVX_APIC_MAILBOX_H +#define IRQ_KVX_APIC_MAILBOX_H + +#define KVX_MAILBOX_MODE_WRITE 0x0 +#define KVX_MAILBOX_MODE_OR 0x1 +#define KVX_MAILBOX_MODE_ADD 0x2 + +#define KVX_MAILBOX_TRIG_NO_TRIG 0x0 +#define KVX_MAILBOX_TRIG_DOORBELL 0x1 +#define KVX_MAILBOX_TRIG_MATCH 0x2 +#define KVX_MAILBOX_TRIG_BARRIER 0x3 +#define KVX_MAILBOX_TRIG_THRESHOLD 0x4 + +/* Mailbox defines */ +#define KVX_MAILBOX_OFFSET 0x0 +#define KVX_MAILBOX_ELEM_SIZE 0x200 +#define KVX_MAILBOX_MASK_OFFSET 0x10 +#define KVX_MAILBOX_FUNCT_OFFSET 0x18 +#define KVX_MAILBOX_LAC_OFFSET 0x8 +#define KVX_MAILBOX_VALUE_OFFSET 0x0 +#define KVX_MAILBOX_FUNCT_MODE_SHIFT 0x0 +#define KVX_MAILBOX_FUNCT_TRIG_SHIFT 0x8 + +#endif /* IRQ_KVX_APIC_MAILBOX_H */
include/linux/irqchip/irq-kvx-itgen.h new file +24 -0
@@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2018-2023 Kalray Inc. +*/ + +#ifndef IRQ_KVX_ITGEN_H +#define IRQ_KVX_ITGEN_H + +/* Parameters */ +#define KVX_ITGEN_PARAM_OFFSET 0x1100 +#define KVX_ITGEN_PARAM_IT_NUM_OFFSET 0x0 + +/* Target configuration */ +#define KVX_ITGEN_CFG_ENABLE_OFFSET 0x8 +#define KVX_ITGEN_CFG_ELEM_SIZE 0x10 +#define KVX_ITGEN_CFG_TARGET_OFFSET 0x0 +#define KVX_ITGEN_CFG_TARGET_MAILBOX_SHIFT 0x0 +#define KVX_ITGEN_CFG_TARGET_MAILBOX_MASK 0x7FUL +#define KVX_ITGEN_CFG_TARGET_CLUSTER_SHIFT 0x8 +#define KVX_ITGEN_CFG_TARGET_CLUSTER_MASK 0x700UL +#define KVX_ITGEN_CFG_TARGET_SELECT_BIT_SHIFT 0x18 +#define KVX_ITGEN_CFG_TARGET_SELECT_BIT_MASK 0x3F000000UL + +#endif /* IRQ_KVX_ITGEN_H */
Signature · 1 line
2.37.2
Rob Herring
maintainerRe: [RFC PATCH 09/25] kvx: irqchip: Add support for irq controllers
Quoted 88 lines · Yann Sionneau
Add support for kvx irq controllers found in Coolidge MPPA SoC
The core-intc:
Each kvx core includes a hardware interrupt controller (core ITC) with the following features:
* 32 independent interrupt sources
* 4-bit priotity level
* Individual interrupt enable bit
* Interrupt status bit displaying the pending interrupts
* Priority management between the 32 interruptsAmong those 32 interrupt sources, the first are hard-wired to hardware sources. The remaining interrupt sources can be triggered via software by directly writing to the ILR SFR.
The hard-wired interrupt sources are the following:
0: Timer 0
1: Timer 1
2: Watchdog
3: Performance Monitors
4: APIC GIC line 0
5: APIC GIC line 1
6: APIC GIC line 2
7: APIC GIC line 3
12: SECC error from memory system
13: Arithmetic exception (carry and IEEE 754 flags)
16: Data Asynchronous Memory Error (DAME), raised for DECC/DSYS errors 17: CLI (Cache Line Invalidation) for L1D or L1I following DECC/DSYS/Parity
errorsThe APIC GIC lines will be used to route interrupts coming from SoC peripherals from outside the Cluster to the kvx core. Those peripherals include USB host controller, eMMC/SD host controller, i2c, spi, PCIe, IOMMUs etc...
The APIC GIC:
Each Cluster of the Coolidge SoC includes an APIC
(Advanced Programmable Interrupt Controller) GIC (Generic Interrupt Controller). The APIC GIC acts as an intermediary interrupt controller, muxing/routing incoming interrupts to output interrupts connected to the kvx core ITC lines. The first 128 incoming interrupt lines come from the mailbox controller (itself containing 128 mailboxes).
The remaining 11 interrupt lines come from external interrupt sources (NoC router, the 5 IOMMUs, L2$ DMA job fifo, watchdog, SECC, DECC, D NoC). The APIC GIC has 72 output interrupts: 4 per kvx cores in the cluster (1 RM and 16 PE) connected to the "APIC GIC lines" described above and 1 for the L2$ controller which makes 69 interrupts lines (rounded up to 72).The APIC Mailbox:
The APIC includes a mailbox controller, containing 128 mailboxes. This hardware block is basically a 1 Kb of smart memory space. Each mailbox is an 8 bytes word memory location which can generate and interrupt.
Each mailbox has a trigger function and an input function. When a mailbox is written to, if the condition described by the trigger function is satisfied, the corresponding interrupt will fire.
Since this hardware block generates IRQs based on writes
at some memory locations, it is both an interrupt controller and an MSI controller.The ITGEN:
The ITGEN (InTerrupt GENerator) is an interrupt controller block. It's purpose is to convert IRQ lines coming from SoC peripherals (USB host controller for instance) into writes on the AXI bus. Those writes are targeting the APIC Mailboxes.
CC Thomas Gleixner <[email protected]>CC Marc Zyngier <[email protected]>CC Rob Herring <[email protected]>CC Krzysztof Kozlowski <[email protected]>Co-developed-by Clement Leger <[email protected]>Signed-off-by Clement Leger <[email protected]>Co-developed-by Jules Maselbas <[email protected]>Signed-off-by Jules Maselbas <[email protected]>Co-developed-by Julian Vetter <[email protected]>Signed-off-by Julian Vetter <[email protected]>Co-developed-by Luc Michel <[email protected]>Signed-off-by Luc Michel <[email protected]>Co-developed-by Vincent Chardon <[email protected]>Signed-off-by Vincent Chardon <[email protected]>Co-developed-by Yann Sionneau <[email protected]>Signed-off-by Yann Sionneau <[email protected]>
Quoted 2 lines
--- .../kalray,kvx-core-intc.txt | 22 +
Bindings should be a separate patch and must be in schema format now.
You probably should do a patch per driver too.
Documentation/devicetree/bindings/interrupt-controller/kalray,kvx-core-intc.txt line 5
Quoted 11 lines
Documentation/devicetree/bindings/interrupt-controller/kalray,kvx-core-intc.txt new file +5
-0@@ -0,0 +1,22 @@ +* KVX Core Interrupt controller + +Required properties: + +- compatible: must to be "kalray,kvx-core-intc".
compatible strings should be specific enough to identify bugs/features of a specific implementation unless there's another way to do that (e.g. version registers).
Documentation/devicetree/bindings/interrupt-controller/kalray,kvx-core-intc.txt line 13
Quoted 8 lines
Documentation/devicetree/bindings/interrupt-controller/kalray,kvx-core-intc.txt new file +8
-0+- interrupt-controller +- #interrupt-cells: has to be <1>: an interrupt index +- regs: Base address of interrupt controller registers. + +Optional properties: + +- kalray,intc-nr-irqs: Number of irqs handled by the controller. + if not given, will default to 32.
What's the range?
Documentation/devicetree/bindings/interrupt-controller/kalray,kvx-core-intc.txt line 17
Quoted 4 lines
Documentation/devicetree/bindings/interrupt-controller/kalray,kvx-core-intc.txt new file +4
-0+ +Example: + + core_intc: core_intc@0 {
interrupt-controller {
Quoted 5 lines
Documentation/devicetree/bindings/interrupt-controller/kalray,kvx-core-intc.txt new file +5
-0+ compatible = "kalray,kvx-core-intc"; + #interrupt-cells = <1>; + interrupt-controller; + interrupt-parent = <&core_intc>; + };
[...]
Documentation/devicetree/bindings/interrupt-controller/kalray,kvx-core-intc.txt
Quoted 9 lines
Documentation/devicetree/bindings/interrupt-controller/kalray,kvx-core-intc.txt new file +7
-0+IRQCHIP_DECLARE(kvx_apic_gic, "kalray,kvx-apic-gic", kvx_init_apic_gic); +IRQCHIP_DECLARE(kvx_apic_mailbox, "kalray,kvx-apic-mailbox", + kvx_init_apic_mailbox); +static const struct of_device_id itgen_of_match[] = { + { .compatible = "kalray,kvx-itgen" }, + { /* END */ } +};
All these compatible strings need binding schemas, too.
Quoted 15 lines
include/linux/irqchip/irq-kvx-apic-gic.h new file +9
-0@@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2018-2023 Kalray Inc. +* Author: Clement Leger +*/ + +#ifndef KVX_APIC_GIC_H +#define KVX_APIC_GIC_H +
include/linux/irqchip/irq-kvx-apic-gic.h line 19
Quoted 10 lines
include/linux/irqchip/irq-kvx-apic-gic.h new file +10
-0+/* GIC enable register definitions */ +#define KVX_GIC_ENABLE_OFFSET 0x0 +#define KVX_GIC_ENABLE_ELEM_SIZE 0x1 +#define KVX_GIC_INPUT_IT_COUNT 0x9D +#define KVX_GIC_ELEM_SIZE 0x400 + +/* GIC status lac register definitions */ +#define KVX_GIC_STATUS_LAC_OFFSET 0x120 +#define KVX_GIC_STATUS_LAC_ELEM_SIZE 0x8 +#define KVX_GIC_STATUS_LAC_ARRAY_SIZE 0x3
Do these defines need to be public to *all* the kernel? Doesn't look like it.
Same question on the other headers.
Rob
RFC PATCH 10/25 kvx: Add process management
In reply to Yann SionneauAdd process management support for kvx, including: thread info definition, context switch and process tracing.
--- arch/kvx/include/asm/current.h | 22 ++ arch/kvx/include/asm/ptrace.h | 217 ++++++++++++++ arch/kvx/include/asm/switch_to.h | 21 ++ arch/kvx/include/asm/thread_info.h | 78 +++++ arch/kvx/include/uapi/asm/ptrace.h | 114 +++++++ arch/kvx/kernel/process.c | 212 +++++++++++++ arch/kvx/kernel/ptrace.c | 461 +++++++++++++++++++++++++++++ arch/kvx/kernel/stacktrace.c | 173 +++++++++++ 8 files changed, 1298 insertions(+) create mode 100644 arch/kvx/include/asm/current.h create mode 100644 arch/kvx/include/asm/ptrace.h create mode 100644 arch/kvx/include/asm/switch_to.h create mode 100644 arch/kvx/include/asm/thread_info.h create mode 100644 arch/kvx/include/uapi/asm/ptrace.h create mode 100644 arch/kvx/kernel/process.c create mode 100644 arch/kvx/kernel/ptrace.c create mode 100644 arch/kvx/kernel/stacktrace.c
arch/kvx/include/asm/current.h new file +22 -0
@@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _ASM_KVX_CURRENT_H +#define _ASM_KVX_CURRENT_H + +#include <asm/percpu.h> +#include <asm/sfr.h> + +struct task_struct ; + +static __always_inline struct task_struct *get_current(void) +{ +return (struct task_struct *)kvx_sfr_get (SR ); +} + +#define current get_current() + +#endif /* _ASM_KVX_CURRENT_H */
arch/kvx/include/asm/ptrace.h new file +217 -0
217 lines not on this page · raw message
arch/kvx/include/asm/switch_to.h new file +21 -0
@@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _ASM_KVX_SWITCH_TO_H +#define _ASM_KVX_SWITCH_TO_H + +struct task_struct ; + +/* context switching is now performed out-of-line in switch_to.S */ +extern struct task_struct *__switch_to (struct task_struct *prev, +struct task_struct *next); + +#define switch_to (prev, next, last) \ + do { \ + ((last) = __switch_to((prev), (next))); \ + } while (0) + +#endif /* _ASM_KVX_SWITCH_TO_H */
arch/kvx/include/asm/thread_info.h new file +78 -0
78 lines not on this page · raw message
arch/kvx/include/uapi/asm/ptrace.h new file +114 -0
114 lines not on this page · raw message
arch/kvx/kernel/process.c new file +212 -0
212 lines not on this page · raw message
arch/kvx/kernel/ptrace.c new file +461 -0
461 lines not on this page · raw message
arch/kvx/kernel/stacktrace.c new file +173 -0
173 lines not on this page · raw message
Signature · 1 line
2.37.2
RFC PATCH 11/25 kvx: Add memory management
In reply to Yann SionneauAdd memory management support for kvx, including: cache and tlb management, page fault handling, ioremap/mmap and streaming dma support.
--- arch/kvx/include/asm/cache.h | 46 +++ arch/kvx/include/asm/cacheflush.h | 181 +++++++++ arch/kvx/include/asm/fixmap.h | 47 +++ arch/kvx/include/asm/hugetlb.h | 36 ++ arch/kvx/include/asm/l2_cache.h | 75 ++++ arch/kvx/include/asm/l2_cache_defs.h | 64 ++++ arch/kvx/include/asm/mem_map.h | 44 +++ arch/kvx/include/asm/mmu.h | 296 +++++++++++++++ arch/kvx/include/asm/mmu_context.h | 156 ++++++++ arch/kvx/include/asm/mmu_stats.h | 38 ++ arch/kvx/include/asm/page.h | 187 ++++++++++ arch/kvx/include/asm/page_size.h | 29 ++ arch/kvx/include/asm/pgalloc.h | 101 +++++ arch/kvx/include/asm/pgtable-bits.h | 102 ++++++ arch/kvx/include/asm/pgtable.h | 451 +++++++++++++++++++++++ arch/kvx/include/asm/rm_fw.h | 16 + arch/kvx/include/asm/sparsemem.h | 15 + arch/kvx/include/asm/symbols.h | 16 + arch/kvx/include/asm/tlb.h | 24 ++ arch/kvx/include/asm/tlb_defs.h | 131 +++++++ arch/kvx/include/asm/tlbflush.h | 58 +++ arch/kvx/include/asm/vmalloc.h | 10 + arch/kvx/mm/cacheflush.c | 154 ++++++++ arch/kvx/mm/dma-mapping.c | 95 +++++ arch/kvx/mm/extable.c | 24 ++ arch/kvx/mm/fault.c | 264 ++++++++++++++ arch/kvx/mm/hugetlbpage.c | 317 ++++++++++++++++ arch/kvx/mm/init.c | 527 +++++++++++++++++++++++++++ arch/kvx/mm/kernel_rwx.c | 228 ++++++++++++ arch/kvx/mm/mmap.c | 31 ++ arch/kvx/mm/mmu.c | 204 +++++++++++ arch/kvx/mm/mmu_stats.c | 94 +++++ arch/kvx/mm/tlb.c | 433 ++++++++++++++++++++++ 33 files changed, 4494 insertions(+) create mode 100644 arch/kvx/include/asm/cache.h create mode 100644 arch/kvx/include/asm/cacheflush.h create mode 100644 arch/kvx/include/asm/fixmap.h create mode 100644 arch/kvx/include/asm/hugetlb.h create mode 100644 arch/kvx/include/asm/l2_cache.h create mode 100644 arch/kvx/include/asm/l2_cache_defs.h create mode 100644 arch/kvx/include/asm/mem_map.h create mode 100644 arch/kvx/include/asm/mmu.h create mode 100644 arch/kvx/include/asm/mmu_context.h create mode 100644 arch/kvx/include/asm/mmu_stats.h create mode 100644 arch/kvx/include/asm/page.h create mode 100644 arch/kvx/include/asm/page_size.h create mode 100644 arch/kvx/include/asm/pgalloc.h create mode 100644 arch/kvx/include/asm/pgtable-bits.h create mode 100644 arch/kvx/include/asm/pgtable.h create mode 100644 arch/kvx/include/asm/rm_fw.h create mode 100644 arch/kvx/include/asm/sparsemem.h create mode 100644 arch/kvx/include/asm/symbols.h create mode 100644 arch/kvx/include/asm/tlb.h create mode 100644 arch/kvx/include/asm/tlb_defs.h create mode 100644 arch/kvx/include/asm/tlbflush.h create mode 100644 arch/kvx/include/asm/vmalloc.h create mode 100644 arch/kvx/mm/cacheflush.c create mode 100644 arch/kvx/mm/dma-mapping.c create mode 100644 arch/kvx/mm/extable.c create mode 100644 arch/kvx/mm/fault.c create mode 100644 arch/kvx/mm/hugetlbpage.c create mode 100644 arch/kvx/mm/init.c create mode 100644 arch/kvx/mm/kernel_rwx.c create mode 100644 arch/kvx/mm/mmap.c create mode 100644 arch/kvx/mm/mmu.c create mode 100644 arch/kvx/mm/mmu_stats.c create mode 100644 arch/kvx/mm/tlb.c
arch/kvx/include/asm/cache.h new file +46 -0
@@ -0,0 +1,46 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _ASM_KVX_CACHE_H +#define _ASM_KVX_CACHE_H + +/** +* On kvx I$ and D$ have the same size (16KB). +* Caches are 16K bytes big, VIPT 4-way set associative, true LRU, with 64-byte +* lines. The D$ is also write-through. +*/ +#define KVX_ICACHE_WAY_COUNT 4 +#define KVX_ICACHE_SET_COUNT 64 +#define KVX_ICACHE_LINE_SHIFT 6 +#define KVX_ICACHE_LINE_SIZE (1 << KVX_ICACHE_LINE_SHIFT) +#define KVX_ICACHE_SIZE \ + (KVX_ICACHE_WAY_COUNT * KVX_ICACHE_SET_COUNT * KVX_ICACHE_LINE_SIZE) + +/** +* Invalidate the whole I-cache if the size to flush is more than this value +*/ +#define KVX_ICACHE_INVAL_SIZE (KVX_ICACHE_SIZE) + +/* D-Cache */ +#define KVX_DCACHE_WAY_COUNT 4 +#define KVX_DCACHE_SET_COUNT 64 +#define KVX_DCACHE_LINE_SHIFT 6 +#define KVX_DCACHE_LINE_SIZE (1 << KVX_DCACHE_LINE_SHIFT) +#define KVX_DCACHE_SIZE \ + (KVX_DCACHE_WAY_COUNT * KVX_DCACHE_SET_COUNT * KVX_DCACHE_LINE_SIZE) + +/** +* Same for I-cache +*/ +#define KVX_DCACHE_INVAL_SIZE (KVX_DCACHE_SIZE) + +#define L1_CACHE_SHIFT KVX_DCACHE_LINE_SHIFT +#define L1_CACHE_BYTES KVX_DCACHE_LINE_SIZE + +#define L2_CACHE_LINE_SIZE 256 +#define L2_CACHE_LINE_MASK (L2_CACHE_LINE_SIZE - 1) + +#endif /* _ASM_KVX_CACHE_H */
arch/kvx/include/asm/cacheflush.h new file +181 -0
181 lines not on this page · raw message
arch/kvx/include/asm/fixmap.h new file +47 -0
47 lines not on this page · raw message
arch/kvx/include/asm/hugetlb.h new file +36 -0
@@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Guillaume Thouvenin +* Clement Leger +*/ + +#ifndef _ASM_KVX_HUGETLB_H +#define _ASM_KVX_HUGETLB_H + +#include <asm/pgtable.h> + +#define __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT +extern void set_huge_pte_at (struct mm_struct *mm,unsigned long addr, +pte_t *ptep,pte_t pte); + +#define __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR +extern pte_t huge_ptep_get_and_clear (struct mm_struct *mm, +unsigned long addr,pte_t *ptep); + +#define __HAVE_ARCH_HUGE_PTEP_SET_ACCESS_FLAGS +extern int huge_ptep_set_access_flags (struct vm_area_struct *vma, +unsigned long addr,pte_t *ptep, +pte_t pte,int dirty); + +#define __HAVE_ARCH_HUGE_PTEP_SET_WRPROTECT +extern void huge_ptep_set_wrprotect (struct mm_struct *mm, +unsigned long addr,pte_t *ptep); + +#define __HAVE_ARCH_HUGE_PTEP_CLEAR_FLUSH +extern pte_t huge_ptep_clear_flush (struct vm_area_struct *vma, +unsigned long addr,pte_t *ptep); + +#include <asm-generic/hugetlb.h> + +#endif /* _ASM_KVX_HUGETLB_H */
arch/kvx/include/asm/l2_cache.h new file +75 -0
75 lines not on this page · raw message
arch/kvx/include/asm/l2_cache_defs.h new file +64 -0
64 lines not on this page · raw message
arch/kvx/include/asm/mem_map.h new file +44 -0
44 lines not on this page · raw message
arch/kvx/include/asm/mmu.h new file +296 -0
296 lines not on this page · raw message
arch/kvx/include/asm/mmu_context.h new file +156 -0
156 lines not on this page · raw message
arch/kvx/include/asm/mmu_stats.h new file +38 -0
@@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _ASM_KVX_MMU_STATS_H +#define _ASM_KVX_MMU_STATS_H + +#ifdef CONFIG_KVX_MMU_STATS +#include <linux/percpu.h> + +struct mmu_refill_stats { +unsigned long count; +unsigned long total; +unsigned long min; +unsigned long max; +}; + +enum mmu_refill_type { +MMU_REFILL_TYPE_USER , +MMU_REFILL_TYPE_KERNEL , +MMU_REFILL_TYPE_KERNEL_DIRECT , +MMU_REFILL_TYPE_COUNT , +}; + +struct mmu_stats { +struct mmu_refill_stats refill[MMU_REFILL_TYPE_COUNT ]; +/* keep these fields ordered this way for assembly */ +unsigned long cycles_between_refill; +unsigned long last_refill; +unsigned long tlb_flush_all; +}; + +DECLARE_PER_CPU(struct mmu_stats, mmu_stats); +#endif + +#endif /* _ASM_KVX_MMU_STATS_H */
arch/kvx/include/asm/page.h new file +187 -0
187 lines not on this page · raw message
arch/kvx/include/asm/page_size.h new file +29 -0
@@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Guillaume Thouvenin +* Clement Leger +*/ + +#ifndef _ASM_KVX_PAGE_SIZE_H +#define _ASM_KVX_PAGE_SIZE_H + +#include <asm/tlb_defs.h> + +#if defined(CONFIG_HUGETLB_PAGE ) +#define HUGE_PAGE_SIZE (MMC_PMJ_64K | MMC_PMJ_2M | MMC_PMJ_512M) +#else +#define HUGE_PAGE_SIZE (0) +#endif + +#if defined(CONFIG_KVX_4K_PAGES ) +#define TLB_DEFAULT_PS TLB_PS_4K +#define KVX_SUPPORTED_PSIZE (MMC_PMJ_4K | HUGE_PAGE_SIZE) +#elif defined(CONFIG_KVX_64K_PAGES ) +#define TLB_DEFAULT_PS TLB_PS_64K +#define KVX_SUPPORTED_PSIZE (MMC_PMJ_64K | HUGE_PAGE_SIZE) +#else +#error "Unsupported page size" +#endif + +#endif
arch/kvx/include/asm/pgalloc.h new file +101 -0
101 lines not on this page · raw message
arch/kvx/include/asm/pgtable-bits.h new file +102 -0
102 lines not on this page · raw message
arch/kvx/include/asm/pgtable.h new file +451 -0
451 lines not on this page · raw message
arch/kvx/include/asm/rm_fw.h new file +16 -0
@@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _ASM_KVX_RM_FW_H +#define _ASM_KVX_RM_FW_H + +#include <linux/sizes.h> + +#define KVX_RM_ID 16 + +#define RM_FIRMWARE_REGS_SIZE (SZ_4K) + +#endif /* _ASM_KVX_RM_FW_H */
arch/kvx/include/asm/sparsemem.h new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _ASM_KVX_SPARSEMEM_H +#define _ASM_KVX_SPARSEMEM_H + +#ifdef CONFIG_SPARSEMEM +#define MAX_PHYSMEM_BITS 40 +#define SECTION_SIZE_BITS 30 +#endif /* CONFIG_SPARSEMEM */ + +#endif /* _ASM_KVX_SPARSEMEM_H */
arch/kvx/include/asm/symbols.h new file +16 -0
@@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _ASM_KVX_SYMBOLS_H +#define _ASM_KVX_SYMBOLS_H + +/* Symbols to patch TLB refill handler */ +extern char kvx_perf_tlb_refill[], kvx_std_tlb_refill[]; + +/* Entry point of the ELF, used to start other PEs in SMP */ +extern int kvx_start[]; + +#endif
arch/kvx/include/asm/tlb.h new file +24 -0
@@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Guillaume Thouvenin +* Clement Leger +*/ + +#ifndef _ASM_KVX_TLB_H +#define _ASM_KVX_TLB_H + +struct mmu_gather ; + +static void tlb_flush (struct mmu_gather *tlb); + +int clear_ltlb_entry (unsigned long vaddr); + +#include <asm-generic/tlb.h> + +static inline unsigned int pgprot_cache_policy (unsigned long flags) +{ +return (flags &KVX_PAGE_CP_MASK ) >>KVX_PAGE_CP_SHIFT ; +} + +#endif /* _ASM_KVX_TLB_H */
arch/kvx/include/asm/tlb_defs.h new file +131 -0
131 lines not on this page · raw message
arch/kvx/include/asm/tlbflush.h new file +58 -0
58 lines not on this page · raw message
arch/kvx/include/asm/vmalloc.h new file +10 -0
@@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _ASM_KVX_VMALLOC_H +#define _ASM_KVX_VMALLOC_H + +#endif /* _ASM_KVX_VMALLOC_H */
arch/kvx/mm/cacheflush.c new file +154 -0
154 lines not on this page · raw message
arch/kvx/mm/dma-mapping.c new file +95 -0
95 lines not on this page · raw message
arch/kvx/mm/extable.c new file +24 -0
@@ -0,0 +1,24 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* derived from arch/riscv/mm/extable.c +* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + + +#include <linux/extable.h> +#include <linux/module.h> +#include <linux/uaccess.h> + +int fixup_exception (struct pt_regs *regs) +{ +const struct exception_table_entry *fixup; + + fixup =search_exception_tables (regs->spc); +if (fixup) { + regs->spc = fixup->fixup; +return 1 ; + } +return 0 ; +}
arch/kvx/mm/fault.c new file +264 -0
264 lines not on this page · raw message
arch/kvx/mm/hugetlbpage.c new file +317 -0
317 lines not on this page · raw message
arch/kvx/mm/init.c new file +527 -0
23 lines not on this page · raw message
arch/kvx/mm/kernel_rwx.c new file +228 -0
228 lines not on this page · raw message
arch/kvx/mm/mmu.c new file +204 -0
204 lines not on this page · raw message
arch/kvx/mm/mmu_stats.c new file +94 -0
94 lines not on this page · raw message
arch/kvx/mm/tlb.c new file +433 -0
433 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.37.2
Part of the diff is not shown here. View the raw message.
Re: [RFC PATCH 11/25] kvx: Add memory management
Quoted 64 lines · Yann Sionneau
Add memory management support for kvx, including: cache and tlb management, page fault handling, ioremap/mmap and streaming dma support.
CC Will Deacon <[email protected]>CC "Aneesh Kumar K.V" <[email protected]>CC Andrew Morton <[email protected]>CC Nick Piggin <[email protected]>CC Peter Zijlstra <[email protected]>CC Paul Walmsley <[email protected]>CC Palmer Dabbelt <[email protected]>CC Albert Ou <[email protected]>Co-developed-by Clement Leger <[email protected]>Signed-off-by Clement Leger <[email protected]>Co-developed-by Guillaume Thouvenin <[email protected]>Signed-off-by Guillaume Thouvenin <[email protected]>Co-developed-by Jean-Christophe Pince <[email protected]>Signed-off-by Jean-Christophe Pince <[email protected]>Co-developed-by Jules Maselbas <[email protected]>Signed-off-by Jules Maselbas <[email protected]>Co-developed-by Julian Vetter <[email protected]>Signed-off-by Julian Vetter <[email protected]>Co-developed-by Julien Hascoet <[email protected]>Signed-off-by Julien Hascoet <[email protected]>Co-developed-by Louis Morhet <[email protected]>Signed-off-by Louis Morhet <[email protected]>Co-developed-by Marc Poulhiès <[email protected]>Signed-off-by Marc Poulhiès <[email protected]>Co-developed-by Marius Gligor <[email protected]>Signed-off-by Marius Gligor <[email protected]>Co-developed-by Vincent Chardon <[email protected]>Signed-off-by Vincent Chardon <[email protected]>Co-developed-by Yann Sionneau <[email protected]>Signed-off-by Yann Sionneau <[email protected]>--- arch/kvx/include/asm/cache.h | 46 +++ arch/kvx/include/asm/cacheflush.h | 181 +++++++++ arch/kvx/include/asm/fixmap.h | 47 +++ arch/kvx/include/asm/hugetlb.h | 36 ++ arch/kvx/include/asm/l2_cache.h | 75 ++++ arch/kvx/include/asm/l2_cache_defs.h | 64 ++++ arch/kvx/include/asm/mem_map.h | 44 +++ arch/kvx/include/asm/mmu.h | 296 +++++++++++++++ arch/kvx/include/asm/mmu_context.h | 156 ++++++++ arch/kvx/include/asm/mmu_stats.h | 38 ++ arch/kvx/include/asm/page.h | 187 ++++++++++ arch/kvx/include/asm/page_size.h | 29 ++ arch/kvx/include/asm/pgalloc.h | 101 +++++ arch/kvx/include/asm/pgtable-bits.h | 102 ++++++ arch/kvx/include/asm/pgtable.h | 451 +++++++++++++++++++++++ arch/kvx/include/asm/rm_fw.h | 16 + arch/kvx/include/asm/sparsemem.h | 15 + arch/kvx/include/asm/symbols.h | 16 + arch/kvx/include/asm/tlb.h | 24 ++ arch/kvx/include/asm/tlb_defs.h | 131 +++++++ arch/kvx/include/asm/tlbflush.h | 58 +++ arch/kvx/include/asm/vmalloc.h | 10 + arch/kvx/mm/cacheflush.c | 154 ++++++++ arch/kvx/mm/dma-mapping.c | 95 +++++ arch/kvx/mm/extable.c | 24 ++ arch/kvx/mm/fault.c | 264 ++++++++++++++
Quoted 8 lines
arch/kvx/mm/hugetlbpage.c | 317 ++++++++++++++++ arch/kvx/mm/init.c | 527 +++++++++++++++++++++++++++ arch/kvx/mm/kernel_rwx.c | 228 ++++++++++++ arch/kvx/mm/mmap.c | 31 ++ arch/kvx/mm/mmu.c | 204 +++++++++++ arch/kvx/mm/mmu_stats.c | 94 +++++ arch/kvx/mm/tlb.c | 433 ++++++++++++++++++++++ 33 files changed, 4494 insertions(+)
Please strip functionality that's not essential for boot and the re-add it after the very core code is merged. I'd say multiple page size, hugetlb and strict RWX are not necessary to start with.
I'd also suggest to have separate patches for different parts, like cache and tlb management, page tables and page fault fault handling, ioremap/mmap and streaming dma support.
Signature · 2 lines
Sincerely yours, Mike.
RFC PATCH 12/25 kvx: Add system call support
In reply to Yann SionneauAdd system call support and related uaccess.h for kvx.
--- arch/kvx/include/asm/syscall.h | 73 ++ arch/kvx/include/asm/syscalls.h | 21 + arch/kvx/include/asm/uaccess.h | 324 +++++ arch/kvx/include/asm/unistd.h | 11 + arch/kvx/include/uapi/asm/cachectl.h | 25 + arch/kvx/include/uapi/asm/unistd.h | 16 + arch/kvx/kernel/entry.S | 1759 ++++++++++++++++++++++++++ arch/kvx/kernel/sys_kvx.c | 58 + arch/kvx/kernel/syscall_table.c | 19 + 9 files changed, 2306 insertions(+) create mode 100644 arch/kvx/include/asm/syscall.h create mode 100644 arch/kvx/include/asm/syscalls.h create mode 100644 arch/kvx/include/asm/uaccess.h create mode 100644 arch/kvx/include/asm/unistd.h create mode 100644 arch/kvx/include/uapi/asm/cachectl.h create mode 100644 arch/kvx/include/uapi/asm/unistd.h create mode 100644 arch/kvx/kernel/entry.S create mode 100644 arch/kvx/kernel/sys_kvx.c create mode 100644 arch/kvx/kernel/syscall_table.c
arch/kvx/include/asm/syscall.h new file +73 -0
@@ -0,0 +1,73 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _ASM_KVX_SYSCALL_H +#define _ASM_KVX_SYSCALL_H + +#include <linux/err.h> +#include <linux/audit.h> + +#include <asm/ptrace.h> + +/* The array of function pointers for syscalls. */ +extern void *sys_call_table[]; + +void scall_machine_exit (unsigned char value); + +/** +* syscall_get_nr - find which 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. +*/ +static inline int syscall_get_nr (struct task_struct *task,struct pt_regs *regs) +{ +if (!in_syscall (regs)) +return -1 ; + +return es_sysno (regs); +} + +static inline long syscall_get_error (struct task_struct *task, +struct pt_regs *regs) +{ +/* 0 if syscall succeeded, otherwise -Errorcode */ +return IS_ERR_VALUE (regs->r0) ? regs->r0 :0 ; +} + +static inline long syscall_get_return_value (struct task_struct *task, +struct pt_regs *regs) +{ +return regs->r0; +} + +static inline int syscall_get_arch (struct task_struct *task) +{ +return AUDIT_ARCH_KVX ; +} + +static inline void syscall_get_arguments (struct task_struct *task, +struct pt_regs *regs, +unsigned long *args) +{ + args[0 ] = regs->orig_r0; + args++; +memcpy (args, ®s->r1,5 *sizeof (args[0 ])); +} + +int __init setup_syscall_sigreturn_page (void *sigpage_addr); + +#endif
arch/kvx/include/asm/syscalls.h new file +21 -0
@@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _ASM_KVX_SYSCALLS_H +#define _ASM_KVX_SYSCALLS_H + +#include <asm-generic/syscalls.h> + +/* We redefine clone in assembly for special slowpath */ +asmlinkage long __sys_clone (unsigned long clone_flags,unsigned long newsp, +int __user *parent_tid,int __user *child_tid,int tls); + +#define sys_clone __sys_clone + +long sys_cachectl (unsigned long addr,unsigned long len,unsigned long cache, +unsigned long flags); + +#endif
arch/kvx/include/asm/uaccess.h new file +324 -0
324 lines not on this page · raw message
arch/kvx/include/asm/unistd.h new file +11 -0
@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#define __ARCH_WANT_SYS_CLONE + +#include <uapi/asm/unistd.h> + +#define NR_syscalls (__NR_syscalls)
arch/kvx/include/uapi/asm/cachectl.h new file +25 -0
@@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _UAPI_ASM_KVX_CACHECTL_H +#define _UAPI_ASM_KVX_CACHECTL_H + +/* +* Cache type for cachectl system call +*/ +#define CACHECTL_CACHE_DCACHE (1 << 0) + +/* +* Flags for cachectl system call +*/ +#define CACHECTL_FLAG_OP_INVAL (1 << 0) +#define CACHECTL_FLAG_OP_WB (1 << 1) +#define CACHECTL_FLAG_OP_MASK (CACHECTL_FLAG_OP_INVAL | \ + CACHECTL_FLAG_OP_WB) + +#define CACHECTL_FLAG_ADDR_PHYS (1 << 2) + +#endif /* _UAPI_ASM_KVX_CACHECTL_H */
arch/kvx/include/uapi/asm/unistd.h new file +16 -0
@@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#define __ARCH_WANT_RENAMEAT +#define __ARCH_WANT_NEW_STAT +#define __ARCH_WANT_SET_GET_RLIMIT +#define __ARCH_WANT_SYS_CLONE3 + +#include <asm-generic/unistd.h> + +/* Additional KVX specific syscalls */ +#define __NR_cachectl (__NR_arch_specific_syscall) +__SYSCALL (__NR_cachectl, sys_cachectl)
arch/kvx/kernel/entry.S new file +1759 -0
1,759 lines not on this page · raw message
arch/kvx/kernel/sys_kvx.c new file +58 -0
58 lines not on this page · raw message
arch/kvx/kernel/syscall_table.c new file +19 -0
@@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* derived from arch/riscv/kernel/syscall_table.c +* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#include <linux/syscalls.h> + +#include <asm/syscalls.h> + +#undef __SYSCALL +#define __SYSCALL (nr, call) [nr] = (call), + +void *sys_call_table[__NR_syscalls] = { + [0 ... __NR_syscalls -1 ] = sys_ni_syscall, +#include <asm/unistd.h> +};
Signature · 1 line
2.37.2
Arnd Bergmann
maintainerRe: [RFC PATCH 12/25] kvx: Add system call support
arch/kvx/include/asm/uaccess.h line 44
Quoted 9 lines · Yann Sionneau
arch/kvx/include/asm/uaccess.h new file +9
-0+ +/* +* Ensure that the range [addr, addr+size) is within the process's +* address space +*/ +static inline int __access_ok (unsigned long addr,unsigned long size) +{ +return size <=TASK_SIZE && addr <=TASK_SIZE - size; +}
This is the same as the generic version, so just use that instead.
Quoted 9 lines
arch/kvx/include/asm/uaccess.h new file +9
-0+#define HAVE_GET_KERNEL_NOFAULT + +#define __get_kernel_nofault (dst, src, type, err_label) \ +do { \ + long __kr_err; \ + \ + __get_user_nocheck(*((type *)(dst)), (type *)(src), __kr_err); \ + if (unlikely(__kr_err)) \ + goto err_label; \
arch/kvx/include/asm/uaccess.h line 321
Quoted 10 lines
arch/kvx/include/asm/uaccess.h new file +10
-0+} while (0) + +#define __put_kernel_nofault (dst, src, type, err_label) \ +do { \ + long __kr_err; \ + \ + __put_user_nocheck(*((type *)(src)), (type *)(dst), __kr_err); \ + if (unlikely(__kr_err)) \ + goto err_label; \ +} while (0)
The wrapper around __get_user_nocheck/__put_user_nocheck is not ideal here. Since I think you only support new compilers anyway, you can use the asm-goto-with-output feature to define the asm to branch to the label directly, and use the same thing to build __get_user()/__put_user().
arch/kvx/include/uapi/asm/unistd.h line 10
Quoted 8 lines
+++
b/arch/kvx/include/uapi/asm/unistd.harch/kvx/include/uapi/asm/unistd.h new file +5
-0@@ -0,0 +1,16 @@ + +#define __ARCH_WANT_RENAMEAT +#define __ARCH_WANT_NEW_STAT +#define __ARCH_WANT_SET_GET_RLIMIT +#define __ARCH_WANT_SYS_CLONE3
It's good to have clone3() but the other three sets of syscalls should no longer be defined for new architectures, so please remove those.
Arnd
Re: [RFC PATCH 12/25] kvx: Add system call support
In reply to Yann SionneauQuoted 31 lines · Yann Sionneau
arch/kvx/kernel/entry.S new file +31
-0+/*********************************************************************** +* Common exception return path +***********************************************************************/ +/** + * Restore registers after exception + * When entering this macro, $sp must be located right before regs + * storage. + */ +EXCEPTION_ENTRY(return_from_exception) +#ifdef CONFIG_DEBUG_EXCEPTION_STACK + ld $r1 = 0[$sp] + ;; + sbfd $r1 = $r1, $sp + ;; + cb.deqz $r1, _check_ok + ;; + make $r2 = panic + make $r0 = stack_error_panic_str_label + ;; + icall $r2 + ;; +_check_ok: + addd $sp = $sp, STACK_REG_SIZE + ;; +#endif + get $r11 = $sr + /* Load sps value from saved registers */ + ld $r6 = PT_SPS[$sp] + ;; + /* Disable interrupt to check task flags atomically */ + disable_interrupt $r60
arch/kvx/kernel/entry.S line 368
Quoted 10 lines
arch/kvx/kernel/entry.S new file +10
-0+ ;; + /* Check PL bit of sps, if set, then it means we are returning + * to a lower privilege level (ie to user), if so, we need to + * check work pending. If coming from kernel, directly go to + * register restoration */ + cb.even $r6? _restore_regs + ld $r1 = TASK_TI_FLAGS[$r11] + ;; + /* Do we have work pending ? */ + andd $r5 = $r1, _TIF_WORK_MASK
Please use the generic entry code to handle pending work, tracing etc.
All over the place....
Thanks,
tglx
_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
RFC PATCH 13/25 kvx: Add signal handling support
In reply to Yann SionneauAdd sigcontext definition and signal handling support for kvx.
--- arch/kvx/include/uapi/asm/sigcontext.h | 16 ++ arch/kvx/kernel/signal.c | 266 +++++++++++++++++++++++++ arch/kvx/kernel/vdso.c | 87 ++++++++ 3 files changed, 369 insertions(+) create mode 100644 arch/kvx/include/uapi/asm/sigcontext.h create mode 100644 arch/kvx/kernel/signal.c create mode 100644 arch/kvx/kernel/vdso.c
arch/kvx/include/uapi/asm/sigcontext.h new file +16 -0
@@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _UAPI_ASM_KVX_SIGCONTEXT_H +#define _UAPI_ASM_KVX_SIGCONTEXT_H + +#include <asm/ptrace.h> + +struct sigcontext { +struct user_pt_regs sc_regs; +}; + +#endif /* _UAPI_ASM_KVX_SIGCONTEXT_H */
arch/kvx/kernel/signal.c new file +266 -0
266 lines not on this page · raw message
arch/kvx/kernel/vdso.c new file +87 -0
87 lines not on this page · raw message
Signature · 1 line
2.37.2
Mark Rutland
maintainerRe: [RFC PATCH 13/25] kvx: Add signal handling support
Quoted 2 lines · Yann Sionneau
Add sigcontext definition and signal handling support for kvx.
[...]
Quoted 12 lines
arch/kvx/kernel/signal.c new file +12
-0+asmlinkage void do_work_pending(struct pt_regs *regs, +unsigned long thread_flags) +{ +/* We are called with IRQs disabled */ +trace_hardirqs_off (); + + do { + if (thread_flags & _TIF_NEED_RESCHED) { + schedule(); + } else { + local_irq_enable(); + if (thread_flags & (_TIF_SIGPENDING | _TIF_NOTIFY_SIGNAL))
arch/kvx/kernel/signal.c line 263
Quoted 10 lines
arch/kvx/kernel/signal.c new file +10
-0+do_signal (regs); + +if (thread_flags & _TIF_NOTIFY_RESUME) { +clear_thread_flag (TIF_NOTIFY_RESUME ); +resume_user_mode_work (regs); + } + } +/* Guarantee task flag atomic read */ +local_irq_disable (); + thread_flags =READ_ONCE (current_thread_info ()->flags);
The comment here is a bit misleading; disabling IRQs doesn't affect the atomicity of the read (and flags can be set by remote threads), so I'd recommend removing it.
Please use read_thread_flags() to read the flags.
arch/kvx/kernel/signal.c line 265
Quoted 2 lines
arch/kvx/kernel/signal.c new file +2
-0+ }while (thread_flags & _TIF_WORK_MASK); +}
Thanks,
Mark.
RFC PATCH 14/25 kvx: Add ELF relocations and module support
In reply to Yann SionneauAdd ELF-related definition and module relocation code for basic kvx support.
--- arch/kvx/include/asm/elf.h | 155 ++++++++++++++++++++++++++++++++ arch/kvx/include/asm/vermagic.h | 12 +++ arch/kvx/kernel/module.c | 148 ++++++++++++++++++++++++++++++ 3 files changed, 315 insertions(+) create mode 100644 arch/kvx/include/asm/elf.h create mode 100644 arch/kvx/include/asm/vermagic.h create mode 100644 arch/kvx/kernel/module.c
arch/kvx/include/asm/elf.h new file +155 -0
@@ -0,0 +1,155 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Yann Sionneau +* Clement Leger +* Marius Gligor +* Guillaume Thouvenin +*/ + +#ifndef _ASM_KVX_ELF_H +#define _ASM_KVX_ELF_H + +#include <linux/types.h> + +#include <asm/ptrace.h> + +/* +* These are used to set parameters in the core dumps. +*/ +#define ELF_CLASS ELFCLASS64 +#define ELF_DATA ELFDATA2LSB +#define ELF_ARCH EM_KVX + +typedef uint64_t elf_greg_t ; +typedef uint64_t elf_fpregset_t ; + +#define ELF_NGREG (sizeof(struct user_pt_regs) / sizeof(elf_greg_t)) +typedef elf_greg_t elf_gregset_t [ELF_NGREG ]; + +/* Copy user_pt_regs from pt_regs into the elf_gregset_t */ +#define ELF_CORE_COPY_REGS (dest, regs) \ + *(struct user_pt_regs *)&(dest) = (regs)->user_regs; + +/* +* This is used to ensure we don't load something for the wrong architecture. +*/ +#define elf_check_arch (x) ((x)->e_machine == EM_KVX) + +#define ELF_CORE_EFLAGS 0x1308 + +#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 ((TASK_SIZE / 3) * 2) + +/* +* This yields a mask that user programs can use to figure out what +* instruction set this CPU supports. This could be done in user space, +* but it's not easy, and we've already done it here. +*/ +#define ELF_HWCAP (elf_hwcap) +extern unsigned long elf_hwcap; + +/* +* This yields a string that ld.so will use to load implementation +* specific libraries for optimization. This is more specific in +* intent than poking at uname or /proc/cpuinfo. +*/ +#define ELF_PLATFORM (NULL) + +#define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1 +struct linux_binprm ; +extern int arch_setup_additional_pages (struct linux_binprm *bprm, +int uses_interp); + +/* KVX relocs */ +#define R_KVX_NONE 0 +#define R_KVX_16 1 +#define R_KVX_32 2 +#define R_KVX_64 3 +#define R_KVX_S16_PCREL 4 +#define R_KVX_PCREL17 5 +#define R_KVX_PCREL27 6 +#define R_KVX_32_PCREL 7 +#define R_KVX_S37_PCREL_LO10 8 +#define R_KVX_S37_PCREL_UP27 9 +#define R_KVX_S43_PCREL_LO10 10 +#define R_KVX_S43_PCREL_UP27 11 +#define R_KVX_S43_PCREL_EX6 12 +#define R_KVX_S64_PCREL_LO10 13 +#define R_KVX_S64_PCREL_UP27 14 +#define R_KVX_S64_PCREL_EX27 15 +#define R_KVX_64_PCREL 16 +#define R_KVX_S16 17 +#define R_KVX_S32_LO5 18 +#define R_KVX_S32_UP27 19 +#define R_KVX_S37_LO10 20 +#define R_KVX_S37_UP27 21 +#define R_KVX_S37_GOTOFF_LO10 22 +#define R_KVX_S37_GOTOFF_UP27 23 +#define R_KVX_S43_GOTOFF_LO10 24 +#define R_KVX_S43_GOTOFF_UP27 25 +#define R_KVX_S43_GOTOFF_EX6 26 +#define R_KVX_32_GOTOFF 27 +#define R_KVX_64_GOTOFF 28 +#define R_KVX_32_GOT 29 +#define R_KVX_S37_GOT_LO10 30 +#define R_KVX_S37_GOT_UP27 31 +#define R_KVX_S43_GOT_LO10 32 +#define R_KVX_S43_GOT_UP27 33 +#define R_KVX_S43_GOT_EX6 34 +#define R_KVX_64_GOT 35 +#define R_KVX_GLOB_DAT 36 +#define R_KVX_COPY 37 +#define R_KVX_JMP_SLOT 38 +#define R_KVX_RELATIVE 39 +#define R_KVX_S43_LO10 40 +#define R_KVX_S43_UP27 41 +#define R_KVX_S43_EX6 42 +#define R_KVX_S64_LO10 43 +#define R_KVX_S64_UP27 44 +#define R_KVX_S64_EX27 45 +#define R_KVX_S37_GOTADDR_LO10 46 +#define R_KVX_S37_GOTADDR_UP27 47 +#define R_KVX_S43_GOTADDR_LO10 48 +#define R_KVX_S43_GOTADDR_UP27 49 +#define R_KVX_S43_GOTADDR_EX6 50 +#define R_KVX_S64_GOTADDR_LO10 51 +#define R_KVX_S64_GOTADDR_UP27 52 +#define R_KVX_S64_GOTADDR_EX27 53 +#define R_KVX_64_DTPMOD 54 +#define R_KVX_64_DTPOFF 55 +#define R_KVX_S37_TLS_DTPOFF_LO10 56 +#define R_KVX_S37_TLS_DTPOFF_UP27 57 +#define R_KVX_S43_TLS_DTPOFF_LO10 58 +#define R_KVX_S43_TLS_DTPOFF_UP27 59 +#define R_KVX_S43_TLS_DTPOFF_EX6 60 +#define R_KVX_S37_TLS_GD_LO10 61 +#define R_KVX_S37_TLS_GD_UP27 62 +#define R_KVX_S43_TLS_GD_LO10 63 +#define R_KVX_S43_TLS_GD_UP27 64 +#define R_KVX_S43_TLS_GD_EX6 65 +#define R_KVX_S37_TLS_LD_LO10 66 +#define R_KVX_S37_TLS_LD_UP27 67 +#define R_KVX_S43_TLS_LD_LO10 68 +#define R_KVX_S43_TLS_LD_UP27 69 +#define R_KVX_S43_TLS_LD_EX6 70 +#define R_KVX_64_TPOFF 71 +#define R_KVX_S37_TLS_IE_LO10 72 +#define R_KVX_S37_TLS_IE_UP27 73 +#define R_KVX_S43_TLS_IE_LO10 74 +#define R_KVX_S43_TLS_IE_UP27 75 +#define R_KVX_S43_TLS_IE_EX6 76 +#define R_KVX_S37_TLS_LE_LO10 77 +#define R_KVX_S37_TLS_LE_UP27 78 +#define R_KVX_S43_TLS_LE_LO10 79 +#define R_KVX_S43_TLS_LE_UP27 80 +#define R_KVX_S43_TLS_LE_EX6 81 + +#endif /* _ASM_KVX_ELF_H */
arch/kvx/include/asm/vermagic.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _ASM_KVX_VERMAGIC_H +#define _ASM_KVX_VERMAGIC_H + +#define MODULE_ARCH_VERMAGIC "kvx" + +#endif /* _ASM_KVX_VERMAGIC_H */
arch/kvx/kernel/module.c new file +148 -0
148 lines not on this page · raw message
Signature · 1 line
2.37.2
RFC PATCH 15/25 kvx: Add misc common routines
In reply to Yann SionneauAdd some misc common routines for kvx, including: asm-offsets routines, futex functions, i/o memory access functions.
--- arch/kvx/include/asm/futex.h | 141 ++++++++++++++++++++++++++++++ arch/kvx/include/asm/io.h | 34 ++++++++ arch/kvx/kernel/asm-offsets.c | 157 ++++++++++++++++++++++++++++++++++ arch/kvx/kernel/io.c | 96 +++++++++++++++++++++ 4 files changed, 428 insertions(+) create mode 100644 arch/kvx/include/asm/futex.h create mode 100644 arch/kvx/include/asm/io.h create mode 100644 arch/kvx/kernel/asm-offsets.c create mode 100644 arch/kvx/kernel/io.c
arch/kvx/include/asm/futex.h new file +141 -0
@@ -0,0 +1,141 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2018-2023 Kalray Inc. +* Authors: +* Clement Leger <[email protected]> +* Yann Sionneau <[email protected]> +* Jonathan Borne <[email protected]> +* +* Part of code is taken from RiscV port +*/ + +#ifndef _ASM_KVX_FUTEX_H +#define _ASM_KVX_FUTEX_H + +#ifdef __KERNEL__ + +#include <linux/futex.h> +#include <linux/uaccess.h> + +#define __futex_atomic_op (insn, ret, oldval, uaddr, oparg) \ +{ \ + __enable_user_access(); \ + __asm__ __volatile__ ( \ + " fence \n" \ + " ;;\n " \ + "1: lwz $r63 = 0[%[u]] \n" \ + " ;;\n " \ + " " insn " \n" \ + " ;;\n " \ + " acswapw 0[%[u]], $r62r63 \n" \ + " ;;\n " \ + " cb.deqz $r62? 1b \n" \ + " ;;\n " \ + " copyd %[ov] = $r63 \n" \ + " ;;\n " \ + "2: \n" \ + " .section .fixup,\"ax\" \n" \ + "3: make %[r] = 2b \n" \ + " ;;\n " \ + " make %[r] = %[e] \n" \ + " igoto %[r] \n" \ + " ;;\n " \ + " .previous \n" \ + " .section __ex_table,\"a\" \n" \ + " .align 8 \n" \ + " .dword 1b,3b \n" \ + " .dword 2b,3b \n" \ + " .previous \n" \ + : [r] "+r" (ret), [ov] "+r" (oldval) \ + : [u] "r" (uaddr), \ + [op] "r" (oparg), [e] "i" (-EFAULT) \ + : "r62", "r63", "memory"); \ + __disable_user_access(); \ +} + + +static inline int +arch_futex_atomic_op_inuser (int op,u32 oparg,int *oval,u32 __user *uaddr) +{ +int oldval =0 , ret =0 ; + +if (!access_ok (uaddr,sizeof (u32))) +return -EFAULT ; +switch (op) { +case FUTEX_OP_SET :/* *(int *)UADDR = OPARG; */ +__futex_atomic_op ("copyd $r62 = %[op]" , + ret, oldval, uaddr, oparg); +break ; +case FUTEX_OP_ADD :/* *(int *)UADDR += OPARG; */ +__futex_atomic_op ("addw $r62 = $r63, %[op]" , + ret, oldval, uaddr, oparg); +break ; +case FUTEX_OP_OR :/* *(int *)UADDR |= OPARG; */ +__futex_atomic_op ("orw $r62 = $r63, %[op]" , + ret, oldval, uaddr, oparg); +break ; +case FUTEX_OP_ANDN :/* *(int *)UADDR &= ~OPARG; */ +__futex_atomic_op ("andnw $r62 = %[op], $r63" , + ret, oldval, uaddr, oparg); +break ; +case FUTEX_OP_XOR : +__futex_atomic_op ("xorw $r62 = $r63, %[op]" , + ret, oldval, uaddr, oparg); +break ; +default : + ret = -ENOSYS ; + } + +if (!ret) + *oval = oldval; + +return ret; +} + +static inline int futex_atomic_cmpxchg_inatomic (u32 *uval,u32 __user *uaddr, +u32 oldval,u32 newval) +{ +int ret =0 ; + +if (!access_ok (uaddr,sizeof (u32))) +return -EFAULT ; +__enable_user_access (); + __asm__ __volatile__ ( +" fence \n" /* commit previous stores */ +" copyd $r63 = %[ov] \n" /* init "expect" with ov */ +" copyd $r62 = %[nv] \n" /* init "update" with nv */ +" ;;\n " +"1: acswapw 0[%[u]], $r62r63 \n" +" ;;\n " +" cb.dnez $r62? 3f \n" /* if acswap ok -> return */ +" ;;\n " +"2: lws $r63 = 0[%[u]] \n" /* fail -> load old value */ +" ;;\n " +" compw.ne $r62 = $r63, %[ov] \n" /* check if equal to "old" */ +" ;;\n " +" cb.deqz $r62? 1b \n" /* if not equal, try again */ +" ;;\n " +"3: \n" +" .section .fixup,\"ax\" \n" +"4: make %[r] = 3b \n" +" ;;\n " +" make %[r] = %[e] \n" +" igoto %[r] \n" /* goto 3b */ +" ;;\n " +" .previous \n" +" .section __ex_table,\"a\" \n" +" .align 8 \n" +" .dword 1b,4b \n" +" .dword 2b,4b \n" +".previous \n" + : [r]"+r" (ret) + : [ov]"r" (oldval), [nv]"r" (newval), + [e]"i" (-EFAULT ), [u]"r" (uaddr) + :"r62" ,"r63" ,"memory" ); +__disable_user_access (); + *uval = oldval; +return ret; +} + +#endif +#endif /* _ASM_KVX_FUTEX_H */
arch/kvx/include/asm/io.h new file +34 -0
@@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _ASM_KVX_IO_H +#define _ASM_KVX_IO_H + +#include <linux/types.h> + +#include <asm/page.h> +#include <asm/pgtable.h> + +#define _PAGE_IOREMAP _PAGE_KERNEL_DEVICE + +/* +* String version of I/O memory access operations. +*/ +extern void __memcpy_fromio (void *to,const volatile void __iomem *from, +size_t count); +extern void __memcpy_toio (volatile void __iomem *to,const void *from, +size_t count); +extern void __memset_io (volatile void __iomem *dst,int c,size_t count); + +#define memset_io (c, v, l) __memset_io((c), (v), (l)) +#define memcpy_fromio (a, c, l) __memcpy_fromio((a), (c), (l)) +#define memcpy_toio (c, a, l) __memcpy_toio((c), (a), (l)) + +#include <asm-generic/io.h> + +extern int devmem_is_allowed (unsigned long pfn); + +#endif /* _ASM_KVX_IO_H */
arch/kvx/kernel/asm-offsets.c new file +157 -0
157 lines not on this page · raw message
arch/kvx/kernel/io.c new file +96 -0
96 lines not on this page · raw message
Signature · 1 line
2.37.2
RFC PATCH 16/25 kvx: Add some library functions
In reply to Yann SionneauAdd some library functions for kvx, including: delay, memset, memcpy, strlen, clear_page, copy_page, raw_copy_from/to_user, asm_clear_user.
--- arch/kvx/include/asm/string.h | 20 ++ arch/kvx/kernel/kvx_ksyms.c | 5 + arch/kvx/lib/clear_page.S | 40 ++++ arch/kvx/lib/copy_page.S | 90 +++++++++ arch/kvx/lib/delay.c | 39 ++++ arch/kvx/lib/memcpy.c | 70 +++++++ arch/kvx/lib/memset.S | 351 ++++++++++++++++++++++++++++++++++ arch/kvx/lib/strlen.S | 122 ++++++++++++ arch/kvx/lib/usercopy.S | 90 +++++++++ 9 files changed, 827 insertions(+) create mode 100644 arch/kvx/include/asm/string.h create mode 100644 arch/kvx/lib/clear_page.S create mode 100644 arch/kvx/lib/copy_page.S create mode 100644 arch/kvx/lib/delay.c create mode 100644 arch/kvx/lib/memcpy.c create mode 100644 arch/kvx/lib/memset.S create mode 100644 arch/kvx/lib/strlen.S create mode 100644 arch/kvx/lib/usercopy.S
arch/kvx/include/asm/string.h new file +20 -0
@@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +* Jules Maselbas +*/ + +#ifndef _ASM_KVX_STRING_H +#define _ASM_KVX_STRING_H + +#define __HAVE_ARCH_MEMSET +extern void *memset (void *s,int c,size_t n); + +#define __HAVE_ARCH_MEMCPY +extern void *memcpy (void *dest,const void *src,size_t n); + +#define __HAVE_ARCH_STRLEN +extern size_t strlen (const char *s); + +#endif /* _ASM_KVX_STRING_H */
arch/kvx/kernel/kvx_ksyms.c +5 -0
@@ -22,3 +22,8 @@ DECLARE_EXPORT(__umoddi3);DECLARE_EXPORT (__divdi3);DECLARE_EXPORT (__udivdi3);DECLARE_EXPORT (__multi3); + +DECLARE_EXPORT (clear_page); +DECLARE_EXPORT (copy_page); +DECLARE_EXPORT (memset); +DECLARE_EXPORT (asm_clear_user);
arch/kvx/lib/clear_page.S new file +40 -0
@@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (C) 2017-2023 Kalray Inc. + * Author(s): Marius Gligor + * Clement Leger + */ + +#include <linux/linkage.h> +#include <linux/export.h> +#include <linux/const.h> + +#include <asm/cache.h> +#include <asm/page.h> + +#define CLEAR_PAGE_LOOP_COUNT (PAGE_SIZE / 32) + +/* + * Clear page @dest. + * + * Parameters: + * r0 - dest page + */ +ENTRY(clear_page) + make $r1 = CLEAR_PAGE_LOOP_COUNT + ;; + make $r4 = 0 + make $r5 = 0 + make $r6 = 0 + make $r7 = 0 + ;; + + loopdo $r1, clear_page_done + ;; + so 0[$r0] = $r4r5r6r7 + addd $r0 = $r0, 32 + ;; + clear_page_done: + ret + ;; +ENDPROC(clear_page)
arch/kvx/lib/copy_page.S new file +90 -0
90 lines not on this page · raw message
arch/kvx/lib/delay.c new file +39 -0
@@ -0,0 +1,39 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#include <linux/export.h> +#include <linux/delay.h> + +#include <asm/param.h> +#include <asm/timex.h> + +void __delay (unsigned long loops) +{ +cycles_t target_cycle =get_cycles () + loops; + +while (get_cycles () < target_cycle); +} +EXPORT_SYMBOL (__delay); + +inline void __const_udelay (unsigned long xloops) +{ +u64 loops = (u64 )xloops * (u64 )loops_per_jiffy *HZ ; + +__delay (loops >>32 ); +} +EXPORT_SYMBOL (__const_udelay); + +void __udelay (unsigned long usecs) +{ +__const_udelay (usecs *0x10C7UL );/* 2**32 / 1000000 (rounded up) */ +} +EXPORT_SYMBOL (__udelay); + +void __ndelay (unsigned long nsecs) +{ +__const_udelay (nsecs *0x5UL );/* 2**32 / 1000000000 (rounded up) */ +} +EXPORT_SYMBOL (__ndelay);
arch/kvx/lib/memcpy.c new file +70 -0
70 lines not on this page · raw message
arch/kvx/lib/memset.S new file +351 -0
351 lines not on this page · raw message
arch/kvx/lib/strlen.S new file +122 -0
122 lines not on this page · raw message
arch/kvx/lib/usercopy.S new file +90 -0
90 lines not on this page · raw message
Signature · 1 line
2.37.2
Re: [RFC PATCH 16/25] kvx: Add some library functions
Quoted 245 lines · Yann Sionneau
Add some library functions for kvx, including: delay, memset, memcpy, strlen,
clear_page,copy_page, raw_copy_from/to_user,asm_clear_user.Co-developed-by Clement Leger <[email protected]>Signed-off-by Clement Leger <[email protected]>Co-developed-by Jules Maselbas <[email protected]>Signed-off-by Jules Maselbas <[email protected]>Co-developed-by Julian Vetter <[email protected]>Signed-off-by Julian Vetter <[email protected]>Co-developed-by Marius Gligor <[email protected]>Signed-off-by Marius Gligor <[email protected]>Co-developed-by Yann Sionneau <[email protected]>Signed-off-by Yann Sionneau <[email protected]>--- arch/kvx/include/asm/string.h | 20 ++ arch/kvx/kernel/kvx_ksyms.c | 5 + arch/kvx/lib/clear_page.S | 40 ++++ arch/kvx/lib/copy_page.S | 90 +++++++++ arch/kvx/lib/delay.c | 39 ++++ arch/kvx/lib/memcpy.c | 70 +++++++ arch/kvx/lib/memset.S | 351 ++++++++++++++++++++++++++++++++++ arch/kvx/lib/strlen.S | 122 ++++++++++++ arch/kvx/lib/usercopy.S | 90 +++++++++ 9 files changed, 827 insertions(+) create mode 100644 arch/kvx/include/asm/string.h create mode 100644 arch/kvx/lib/clear_page.S create mode 100644 arch/kvx/lib/copy_page.S create mode 100644 arch/kvx/lib/delay.c create mode 100644 arch/kvx/lib/memcpy.c create mode 100644 arch/kvx/lib/memset.S create mode 100644 arch/kvx/lib/strlen.S create mode 100644 arch/kvx/lib/usercopy.Sarch/kvx/include/asm/string.h new file +20
-0@@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +* Jules Maselbas +*/ + +#ifndef _ASM_KVX_STRING_H +#define _ASM_KVX_STRING_H + +#define __HAVE_ARCH_MEMSET +extern void *memset (void *s,int c,size_t n); + +#define __HAVE_ARCH_MEMCPY +extern void *memcpy (void *dest,const void *src,size_t n); + +#define __HAVE_ARCH_STRLEN +extern size_t strlen (const char *s); + +#endif /* _ASM_KVX_STRING_H */ arch/kvx/kernel/kvx_ksyms.c +5
-0@@ -22,3 +22,8 @@ DECLARE_EXPORT(__umoddi3);DECLARE_EXPORT (__divdi3);DECLARE_EXPORT (__udivdi3);DECLARE_EXPORT (__multi3); + +DECLARE_EXPORT (clear_page); +DECLARE_EXPORT (copy_page); +DECLARE_EXPORT (memset); +DECLARE_EXPORT (asm_clear_user);arch/kvx/lib/clear_page.S new file +40
-0@@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (C) 2017-2023 Kalray Inc. + * Author(s): Marius Gligor + * Clement Leger + */ + +#include <linux/linkage.h> +#include <linux/export.h> +#include <linux/const.h> + +#include <asm/cache.h> +#include <asm/page.h> + +#define CLEAR_PAGE_LOOP_COUNT (PAGE_SIZE / 32) + +/* + * Clear page @dest. + * + * Parameters: + * r0 - dest page + */ +ENTRY(clear_page) + make $r1 = CLEAR_PAGE_LOOP_COUNT + ;; + make $r4 = 0 + make $r5 = 0 + make $r6 = 0 + make $r7 = 0 + ;; + + loopdo $r1, clear_page_done + ;; + so 0[$r0] = $r4r5r6r7 + addd $r0 = $r0, 32 + ;; + clear_page_done: + ret + ;; +ENDPROC(clear_page)arch/kvx/lib/copy_page.S new file +90
-0@@ -0,0 +1,90 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (C) 2017-2023 Kalray Inc. + * Author(s): Clement Leger + */ + +#include <linux/linkage.h> +#include <linux/const.h> + +#include <asm/page.h> + +/* We have 8 load/store octuple (32 bytes) per hardware loop */ +#define COPY_SIZE_PER_LOOP (32 * 8) +#define COPY_PAGE_LOOP_COUNT (PAGE_SIZE / COPY_SIZE_PER_LOOP) + +/* + * Copy a page from src to dest (both are page aligned) + * In order to recover from smem latency, unroll the loop to trigger multiple + * onfly loads and avoid waiting too much for them to return. + * We use 8 * 32 load even though we could use more (up to 10 loads) to simplify + * the handling using a single hardware loop + * + * Parameters: + * r0 - dest + * r1 - src + */ +ENTRY(copy_page) + make $r2 = COPY_PAGE_LOOP_COUNT + make $r3 = 0 + ;; + loopdo $r2, copy_page_done + ;; + /* + * Load 8 * 32 bytes using uncached access to avoid hitting + * the cache + */ + lo.xs $r32r33r34r35 = $r3[$r1] + /* Copy current copy index for store */ + copyd $r2 = $r3 + addd $r3 = $r3, 1 + ;; + lo.xs $r36r37r38r39 = $r3[$r1] + addd $r3 = $r3, 1 + ;; + lo.xs $r40r41r42r43 = $r3[$r1] + addd $r3 = $r3, 1 + ;; + lo.xs $r44r45r46r47 = $r3[$r1] + addd $r3 = $r3, 1 + ;; + lo.xs $r48r49r50r51 = $r3[$r1] + addd $r3 = $r3, 1 + ;; + lo.xs $r52r53r54r55 = $r3[$r1] + addd $r3 = $r3, 1 + ;; + lo.xs $r56r57r58r59 = $r3[$r1] + addd $r3 = $r3, 1 + ;; + lo.xs $r60r61r62r63 = $r3[$r1] + addd $r3 = $r3, 1 + ;; + /* And then store all of them */ + so.xs $r2[$r0] = $r32r33r34r35 + addd $r2 = $r2, 1 + ;; + so.xs $r2[$r0] = $r36r37r38r39 + addd $r2 = $r2, 1 + ;; + so.xs $r2[$r0] = $r40r41r42r43 + addd $r2 = $r2, 1 + ;; + so.xs $r2[$r0] = $r44r45r46r47 + addd $r2 = $r2, 1 + ;; + so.xs $r2[$r0] = $r48r49r50r51 + addd $r2 = $r2, 1 + ;; + so.xs $r2[$r0] = $r52r53r54r55 + addd $r2 = $r2, 1 + ;; + so.xs $r2[$r0] = $r56r57r58r59 + addd $r2 = $r2, 1 + ;; + so.xs $r2[$r0] = $r60r61r62r63 + ;; + copy_page_done: + ret + ;; +ENDPROC(copy_page)arch/kvx/lib/delay.c new file +23
-0@@ -0,0 +1,39 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#include <linux/export.h> +#include <linux/delay.h> + +#include <asm/param.h> +#include <asm/timex.h> + +void __delay (unsigned long loops) +{ +cycles_t target_cycle =get_cycles () + loops; + +while (get_cycles () < target_cycle); +} +EXPORT_SYMBOL (__delay); + +inline void __const_udelay (unsigned long xloops) +{ +u64 loops = (u64 )xloops * (u64 )loops_per_jiffy *HZ ;
arch/kvx/lib/delay.c line 33
Quoted 10 lines
arch/kvx/lib/delay.c new file +10
-0+ +__delay (loops >>32 ); +} +EXPORT_SYMBOL (__const_udelay); + +void __udelay (unsigned long usecs) +{ +__const_udelay (usecs *0x10C7UL );/* 2**32 / 1000000 (rounded up) */ +} +EXPORT_SYMBOL (__udelay);
This could probably be factorized with arm64, csky, nios2, etc.
arch/kvx/lib/delay.c line 39
Quoted 6 lines
arch/kvx/lib/delay.c new file +6
-0+ +void __ndelay (unsigned long nsecs) +{ +__const_udelay (nsecs *0x5UL );/* 2**32 / 1000000000 (rounded up) */ +} +EXPORT_SYMBOL (__ndelay);
Same goes for __ndelay I think
Quoted 657 lines
arch/kvx/lib/memcpy.c new file +70
-0@@ -0,0 +1,70 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +* Yann Sionneau +*/ + +#include <linux/export.h> +#include <linux/types.h> + +void *memcpy (void *dest,const void *src,size_t n) +{ +__uint128_t *tmp128_d = dest; +const __uint128_t *tmp128_s = src; +uint64_t *tmp64_d; +const uint64_t *tmp64_s; +uint32_t *tmp32_d; +const uint32_t *tmp32_s; +uint16_t *tmp16_d; +const uint16_t *tmp16_s; +uint8_t *tmp8_d; +const uint8_t *tmp8_s; + +while (n >=16 ) { + *tmp128_d = *tmp128_s; + tmp128_d++; + tmp128_s++; + n -=16 ; + } + + tmp64_d = (uint64_t *) tmp128_d; + tmp64_s = (uint64_t *) tmp128_s; +while (n >=8 ) { + *tmp64_d = *tmp64_s; + tmp64_d++; + tmp64_s++; + n -=8 ; + } + + tmp32_d = (uint32_t *) tmp64_d; + tmp32_s = (uint32_t *) tmp64_s; +while (n >=4 ) { + *tmp32_d = *tmp32_s; + tmp32_d++; + tmp32_s++; + n -=4 ; + } + + tmp16_d = (uint16_t *) tmp32_d; + tmp16_s = (uint16_t *) tmp32_s; +while (n >=2 ) { + *tmp16_d = *tmp16_s; + tmp16_d++; + tmp16_s++; + n -=2 ; + } + + tmp8_d = (uint8_t *) tmp16_d; + tmp8_s = (uint8_t *) tmp16_s; +while (n >=1 ) { + *tmp8_d = *tmp8_s; + tmp8_d++; + tmp8_s++; + n--; + } + +return dest; +} +EXPORT_SYMBOL (memcpy); +arch/kvx/lib/memset.S new file +351
-0@@ -0,0 +1,351 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (C) 2017-2023 Kalray Inc. + * Author(s): Clement Leger + * Marius Gligor + */ + +#include <linux/linkage.h> + +#include <asm/cache.h> + +#define REPLICATE_BYTE_MASK 0x0101010101010101 +#define MIN_SIZE_FOR_ALIGN 128 + +/* + * Optimized memset for kvx architecture + * + * In order to optimize memset on kvx, we can use various things: + * - conditionnal store which avoid branch penalty + * - store half/word/double/quad/octuple to store up to 16 bytes at a time + * - dzerol to zero a cacheline when the pattern is '0' (often the case) + * - hardware loop for steady cases. + * + * First, we assume that memset is mainly used for zeroing areas. In order + * to optimize this case, we consider it to be the fast path of the algorithm. + * In both cases (0 and non 0 pattern), we start by checking if the size is + * below a minimum size. If so, we skip the alignment part. Indeed, the kvx + * supports misalignment and the penalty for letting it do unaligned accesses is + * lower than trying to realigning us. So for small sizes, we don't even bother + * to realign. Minor difference is that in the memset with 0, we skip after the + * dzerol loop since dzerol must be cache-line aligned (no misalignment of + * course). + * Regarding the non 0 pattern memset, we use sbmm to replicate the pattern on + * all bits on a register in one call. + * Once alignment has been reached, we can do the hardware loop for both cases( + * store octuple/dzerol) in order to optimize throughput. Care must be taken to + * align hardware loops on at least 8 bytes for performances. + * Once the main loop has been done, we finish the copy by checking length to do + * the necessary calls to store remaining bytes. + * + * Pseudo code (applies for non 0 pattern): + * + * int memset(void *dest, char pattern, long length) + * { + * long dest_align = -((long) dest); + * long copy; + * long orig_dest = dest; + * + * uint64_t pattern = sbmm8(pattern, 0x0101010101010101); + * uint128_t pattern128 = pattern << 64 | pattern; + * uint256_t pattern128 = pattern128 << 128 | pattern128; + * + * // Keep only low bits + * dest_align &= 0x1F; + * length -= dest_align; + * + * // Byte align + * copy = align & (1 << 0); + * if (copy) + * *((u8 *) dest) = pattern; + * dest += copy; + * // Half align + * copy = align & (1 << 1); + * if (copy) + * *((u16 *) dest) = pattern; + * dest += copy; + * // Word align + * copy = align & (1 << 2); + * if (copy) + * *((u32 *) dest) = pattern; + * dest += copy; + * // Double align + * copy = align & (1 << 3); + * if (copy) + * *((u64 *) dest) = pattern; + * dest += copy; + * // Quad align + * copy = align & (1 << 4); + * if (copy) + * *((u128 *) dest) = pattern128; + * dest += copy; + * + * // We are now aligned on 256 bits + * loop_octuple_count = size >> 5; + * for (i = 0; i < loop_octuple_count; i++) { + * *((u256 *) dest) = pattern256; + * dest += 32; + * } + * + * if (length == 0) + * return orig_dest; + * + * // Copy remaining part + * remain = length & (1 << 4); + * if (copy) + * *((u128 *) dest) = pattern128; + * dest += remain; + * remain = length & (1 << 3); + * if (copy) + * *((u64 *) dest) = pattern; + * dest += remain; + * remain = length & (1 << 2); + * if (copy) + * *((u32 *) dest) = pattern; + * dest += remain; + * remain = length & (1 << 1); + * if (copy) + * *((u16 *) dest) = pattern; + * dest += remain; + * remain = length & (1 << 0); + * if (copy) + * *((u8 *) dest) = pattern; + * dest += remain; + * + * return orig_dest; + * } + */ + +.text +.align 16 +ENTRY(memset): + make $r32 = 0 + make $r33 = 0 + /* Check if length < KVX_DCACHE_LINE_SIZE */ + compd.ltu $r7 = $r2, KVX_DCACHE_LINE_SIZE + /* Jump to generic memset if pattern is != 0 */ + cb.dnez $r1? memset_non_0_pattern + ;; + /* Preserve return value */ + copyd $r3 = $r0 + /* Invert address to compute size to copy to be aligned on 32 bytes */ + negd $r5 = $r0 + /* Remaining bytes for 16 bytes store (for alignment on 64 bytes) */ + andd $r8 = $r2, (1 << 5) + copyq $r34r35 = $r32, $r33 + /* Skip loopdo with dzerol if length < KVX_DCACHE_LINE_SIZE */ + cb.dnez $r7? .Ldzerol_done + ;; + /* Compute the size that will be copied to align on 64 bytes boundary */ + andw $r6 = $r5, 0x3F + /* Check if address is aligned on 64 bytes */ + andw $r9 = $r0, 0x3F + /* Alignment */ + nop + ;; + /* If address already aligned on 64 bytes, jump to dzerol loop */ + cb.deqz $r9? .Laligned_64 + /* Remove unaligned part from length */ + sbfd $r2 = $r6, $r2 + /* Check if we need to copy 1 byte */ + andw $r4 = $r5, (1 << 0) + ;; + /* If we are not aligned, store byte */ + sb.dnez $r4? [$r0] = $r32 + /* Check if we need to copy 2 bytes */ + andw $r4 = $r5, (1 << 1) + /* Add potentially copied part for next store offset */ + addd $r0 = $r0, $r4 + ;; + sh.dnez $r4? [$r0] = $r32 + /* Check if we need to copy 4 bytes */ + andw $r4 = $r5, (1 << 2) + addd $r0 = $r0, $r4 + ;; + sw.dnez $r4? [$r0] = $r32 + /* Check if we need to copy 8 bytes */ + andw $r4 = $r5, (1 << 3) + addd $r0 = $r0, $r4 + ;; + sd.dnez $r4? [$r0] = $r32 + /* Check if we need to copy 16 bytes */ + andw $r4 = $r5, (1 << 4) + addd $r0 = $r0, $r4 + ;; + sq.dnez $r4? [$r0] = $r32r33 + /* Check if we need to copy 32 bytes */ + andw $r4 = $r5, (1 << 5) + addd $r0 = $r0, $r4 + ;; + so.dnez $r4? [$r0] = $r32r33r34r35 + addd $r0 = $r0, $r4 + ;; +.Laligned_64: + /* Prepare amount of data for dzerol */ + srld $r10 = $r2, 6 + /* Size to be handled in loopdo */ + andd $r4 = $r2, ~0x3F + make $r11 = 64 + cb.deqz $r2? .Lmemset_done + ;; + /* Remaining bytes for 16 bytes store */ + andw $r8 = $r2, (1 << 5) + /* Skip dzerol if there are not enough data for 64 bytes store */ + cb.deqz $r10? .Ldzerol_done + /* Update length to copy */ + sbfd $r2 = $r4, $r2 + ;; + loopdo $r10, .Ldzerol_done + ;; + so 0[$r0], $r32r33r34r35 + ;; + so 32[$r0], $r32r33r34r35 + addd $r0 = $r0, $r11 + ;; + .Ldzerol_done: + /* + * Now that we have handled every aligned bytes using 'dzerol', we can + * handled the remainder of length using store by decrementing size + * We also exploit the fact we are aligned to simply check remaining + * size */ + so.dnez $r8? [$r0] = $r32r33r34r35 + addd $r0 = $r0, $r8 + /* Remaining bytes for 16 bytes store */ + andw $r8 = $r2, (1 << 4) + cb.deqz $r2? .Lmemset_done + ;; + sq.dnez $r8? [$r0] = $r32r33 + addd $r0 = $r0, $r8 + /* Remaining bytes for 8 bytes store */ + andw $r8 = $r2, (1 << 3) + ;; + sd.dnez $r8? [$r0] = $r32 + addd $r0 = $r0, $r8 + /* Remaining bytes for 4 bytes store */ + andw $r8 = $r2, (1 << 2) + ;; + sw.dnez $r8? [$r0] = $r32 + addd $r0 = $r0, $r8 + /* Remaining bytes for 2 bytes store */ + andw $r8 = $r2, (1 << 1) + ;; + sh.dnez $r8? [$r0] = $r32 + addd $r0 = $r0, $r8 + ;; + sb.odd $r2? [$r0] = $r32 + /* Restore original value */ + copyd $r0 = $r3 + ret + ;; + +.align 16 +memset_non_0_pattern: + /* Preserve return value */ + copyd $r3 = $r0 + /* Replicate the first pattern byte on all bytes */ + sbmm8 $r32 = $r1, REPLICATE_BYTE_MASK + /* Check if length < MIN_SIZE_FOR_ALIGN */ + compd.geu $r7 = $r2, MIN_SIZE_FOR_ALIGN + /* Invert address to compute size to copy to be aligned on 32 bytes */ + negd $r5 = $r0 + ;; + /* Check if we are aligned on 32 bytes */ + andw $r9 = $r0, 0x1F + /* Compute the size that will be copied to align on 32 bytes boundary */ + andw $r6 = $r5, 0x1F + /* + * If size < MIN_SIZE_FOR_ALIGN bits, directly go to so, it will be done + * unaligned but that is still better that what we can do with sb + */ + cb.deqz $r7? .Laligned_32 + ;; + /* Remove unaligned part from length */ + sbfd $r2 = $r6, $r2 + /* If we are already aligned on 32 bytes, jump to main "so" loop */ + cb.deqz $r9? .Laligned_32 + /* Check if we need to copy 1 byte */ + andw $r4 = $r5, (1 << 0) + ;; + /* If we are not aligned, store byte */ + sb.dnez $r4? [$r0] = $r32 + /* Check if we need to copy 2 bytes */ + andw $r4 = $r5, (1 << 1) + /* Add potentially copied part for next store offset */ + addd $r0 = $r0, $r4 + ;; + sh.dnez $r4? [$r0] = $r32 + /* Check if we need to copy 4 bytes */ + andw $r4 = $r5, (1 << 2) + addd $r0 = $r0, $r4 + ;; + sw.dnez $r4? [$r0] = $r32 + /* Check if we need to copy 8 bytes */ + andw $r4 = $r5, (1 << 3) + addd $r0 = $r0, $r4 + /* Copy second part of pattern for sq */ + copyd $r33 = $r32 + ;; + sd.dnez $r4? [$r0] = $r32 + /* Check if we need to copy 16 bytes */ + andw $r4 = $r5, (1 << 4) + addd $r0 = $r0, $r4 + ;; + sq.dnez $r4? [$r0] = $r32r33 + addd $r0 = $r0, $r4 + ;; +.Laligned_32: + /* Copy second part of pattern for sq */ + copyd $r33 = $r32 + /* Prepare amount of data for 32 bytes store */ + srld $r10 = $r2, 5 + nop + nop + ;; + copyq $r34r35 = $r32, $r33 + /* Remaining bytes for 16 bytes store */ + andw $r8 = $r2, (1 << 4) + make $r11 = 32 + /* Check if there are enough data for 32 bytes store */ + cb.deqz $r10? .Laligned_32_done + ;; + loopdo $r10, .Laligned_32_done + ;; + so 0[$r0] = $r32r33r34r35 + addd $r0 = $r0, $r11 + ;; + .Laligned_32_done: + /* + * Now that we have handled every aligned bytes using 'so', we can + * handled the remainder of length using store by decrementing size + * We also exploit the fact we are aligned to simply check remaining + * size */ + sq.dnez $r8? [$r0] = $r32r33 + addd $r0 = $r0, $r8 + /* Remaining bytes for 8 bytes store */ + andw $r8 = $r2, (1 << 3) + cb.deqz $r2? .Lmemset_done + ;; + sd.dnez $r8? [$r0] = $r32 + addd $r0 = $r0, $r8 + /* Remaining bytes for 4 bytes store */ + andw $r8 = $r2, (1 << 2) + ;; + sw.dnez $r8? [$r0] = $r32 + addd $r0 = $r0, $r8 + /* Remaining bytes for 2 bytes store */ + andw $r8 = $r2, (1 << 1) + ;; + sh.dnez $r8? [$r0] = $r32 + addd $r0 = $r0, $r8 + ;; + sb.odd $r2? [$r0] = $r32 + /* Restore original value */ + copyd $r0 = $r3 + ret + ;; +.Lmemset_done: + /* Restore original value */ + copyd $r0 = $r3 + ret + ;; +ENDPROC(memset)arch/kvx/lib/strlen.S new file +122
-0@@ -0,0 +1,122 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (C) 2017-2023 Kalray Inc. + * Author(s): Jules Maselbas + */ +#include <linux/linkage.h> +#include <asm/export.h> + +/* + * kvx optimized strlen + * + * This implementation of strlen only does aligned memory accesses. + * Since we don't know the total length the idea is to do double word + * load and stop on the first null byte found. As it's always safe to + * read more up to a lower 8-bytes boundary. + * + * This implementation of strlen uses a trick to detect if a double + * word contains a null byte [1]: + * + * > #define haszero(v) (((v) - 0x01010101UL) & ~(v) & 0x80808080UL) + * > The sub-expression (v - 0x01010101UL), evaluates to a high bit set + * > in any byte whenever the corresponding byte in v is zero or greater + * > than 0x80. The sub-expression ~v & 0x80808080UL evaluates to high + * > bits set in bytes where the byte of v doesn't have its high bit set + * > (so the byte was less than 0x80). Finally, by ANDing these two sub- + * > expressions the result is the high bits set where the bytes in v + * > were zero, since the high bits set due to a value greater than 0x80 + * > in the first sub-expression are masked off by the second. + * + * [1] http://graphics.stanford.edu/~seander/bithacks.html#ZeroInWord + * + * A second trick is used to get the exact number of characters before + * the first null byte in a double word: + * + * clz(sbmmt(zero, 0x0102040810204080)) + * + * This trick uses the haszero result which maps null byte to 0x80 and + * others value to 0x00. The idea is to count the number of consecutive + * null byte in the double word (counting from less significant byte + * to most significant byte). To do so, using the bit matrix transpose + * will "pack" all high bit (0x80) to the most significant byte (MSB). + * It is not possible to count the trailing zeros in this MSB, however + * if a byte swap is done before the bit matrix transpose we still have + * all the information in the MSB but now we can count the leading zeros. + * The instruction sbmmt with the matrix 0x0102040810204080 does exactly + * what we need a byte swap followed by a bit transpose. + * + * A last trick is used to handle the first double word misalignment. + * This is done by masking off the N lower bytes (excess read) with N + * between 0 and 7. The mask is applied on haszero results and will + * force the N lower bytes to be considered not null. + * + * This is a C implementation of the algorithm described above: + * + * size_t strlen(char *s) { + * uint64_t *p = (uint64_t *)((uintptr_t)s) & ~0x7; + * uint64_t rem = ((uintptr_t)s) % 8; + * uint64_t low = -0x0101010101010101; + * uint64_t high = 0x8080808080808080; + * uint64_t dword, zero; + * uint64_t msk, len; + * + * dword = *p++; + * zero = (dword + low) & ~dword & high; + * msk = 0xffffffffffffffff << (rem * 8); + * zero &= msk; + * + * while (!zero) { + * dword = *p++; + * zero = (dword + low) & ~dword & high; + * } + * + * zero = __builtin_kvx_sbmmt8(zero, 0x0102040810204080); + * len = ((void *)p - (void *)s) - 8; + * len += __builtin_kvx_clzd(zero); + * + * return len; + * } + */ + +.text +.align 16 +ENTRY(strlen) + andd $r1 = $r0, ~0x7 + andd $r2 = $r0, 0x7 + make $r10 = -0x0101010101010101 + make $r11 = 0x8080808080808080 + ;; + ld $r4 = 0[$r1] + sllw $r2 = $r2, 3 + make $r3 = 0xffffffffffffffff + ;; + slld $r2 = $r3, $r2 + addd $r5 = $r4, $r10 + andnd $r6 = $r4, $r11 + ;; + andd $r6 = $r6, $r2 + make $r3 = 0 + ;; +.loop: + andd $r4 = $r5, $r6 + addd $r1 = $r1, 0x8 + ;; + cb.dnez $r4? .end + ld.deqz $r4? $r4 = [$r1] + ;; + addd $r5 = $r4, $r10 + andnd $r6 = $r4, $r11 + goto .loop + ;; +.end: + addd $r1 = $r1, -0x8 + sbmmt8 $r4 = $r4, 0x0102040810204080 + ;; + clzd $r4 = $r4 + sbfd $r1 = $r0, $r1 + ;; + addd $r0 = $r4, $r1 + ret + ;; +ENDPROC(strlen) +EXPORT_SYMBOL(strlen)arch/kvx/lib/usercopy.S new file +90
-0@@ -0,0 +1,90 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (C) 2017-2023 Kalray Inc. + * Author(s): Clement Leger + */ +#include <linux/linkage.h> + +/** + * Copy from/to a user buffer + * r0 = to buffer + * r1 = from buffer + * r2 = size to copy + * This function can trapped when hitting a non-mapped page. + * It will trigger a trap NOMAPPING and the trap handler will interpret + * it and check if instruction pointer is inside __ex_table. + * The next step are described later ! + */ +.text +ENTRY(raw_copy_from_user) +ENTRY(raw_copy_to_user) + /** + * naive implementation byte per byte + */ + make $r33 = 0x0; + /* If size == 0, exit directly */ + cb.deqz $r2? copy_exit + ;; + loopdo $r2, copy_exit + ;; +0: lbz $r34 = $r33[$r1] + ;; +1: sb $r33[$r0] = $r34 + addd $r33 = $r33, 1 /* Ptr increment */ + addd $r2 = $r2, -1 /* Remaining bytes to copy */ + ;; + copy_exit: + copyd $r0 = $r2 + ret + ;; +ENDPROC(raw_copy_to_user) +ENDPROC(raw_copy_from_user) + +/** + * Exception table + * each entry correspond to the following: + * .dword trapping_addr, restore_addr + * + * On trap, the handler will try to locate if $spc is matching a + * trapping address in the exception table. If so, the restore addr + * will be put in the return address of the trap handler, allowing + * to properly finish the copy and return only the bytes copied/cleared + */ +.pushsection __ex_table,"a" +.balign 8 +.dword 0b, copy_exit +.dword 1b, copy_exit +.popsection + +/** + * Clear a user buffer + * r0 = buffer to clear + * r1 = size to clear + */ +.text +ENTRY(asm_clear_user) + /** + * naive implementation byte per byte + */ + make $r33 = 0x0; + make $r34 = 0x0; + /* If size == 0, exit directly */ + cb.deqz $r1? clear_exit + ;; + loopdo $r1, clear_exit + ;; +40: sb $r33[$r0] = $r34 + addd $r33 = $r33, 1 /* Ptr increment */ + addd $r1 = $r1, -1 /* Remaining bytes to copy */ + ;; + clear_exit: + copyd $r0 = $r1 + ret + ;; +ENDPROC(asm_clear_user) + +.pushsection __ex_table,"a" +.balign 8 +.dword 40b, clear_exit +.popsection +
Signature · 3 lines
Clément Léger, Embedded Linux and Kernel engineer at Bootlin https://bootlin.com
RFC PATCH 17/25 kvx: Add multi-processor (SMP) support
In reply to Yann SionneauCoolidge v1 SoC has 5 clusters of 16 kvx cores
(+1 special Resource Manager (RM) core).
Linux can run in SMP config on the 16 cores of
a Cluster.
Cache coherency is done by the L2 cache.
--- arch/kvx/include/asm/pwr_ctrl.h | 45 ++++ arch/kvx/include/asm/smp.h | 42 +++ arch/kvx/kernel/l2_cache.c | 448 ++++++++++++++++++++++++++++++++ arch/kvx/kernel/smp.c | 110 ++++++++ arch/kvx/kernel/smpboot.c | 127 +++++++++ arch/kvx/platform/pwr_ctrl.c | 93 +++++++ include/linux/cpuhotplug.h | 2 + 7 files changed, 867 insertions(+) create mode 100644 arch/kvx/include/asm/pwr_ctrl.h create mode 100644 arch/kvx/include/asm/smp.h create mode 100644 arch/kvx/kernel/l2_cache.c create mode 100644 arch/kvx/kernel/smp.c create mode 100644 arch/kvx/kernel/smpboot.c create mode 100644 arch/kvx/platform/pwr_ctrl.c
arch/kvx/include/asm/pwr_ctrl.h new file +45 -0
@@ -0,0 +1,45 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +* Marius Gligor +*/ + +#ifndef _ASM_KVX_PWR_CTRL_H +#define _ASM_KVX_PWR_CTRL_H + +#ifndef __ASSEMBLY__ + +int kvx_pwr_ctrl_probe (void ); + +void kvx_pwr_ctrl_cpu_poweron (unsigned int cpu); + +#endif + +/* Power controller vector register definitions */ +#define KVX_PWR_CTRL_VEC_OFFSET 0x1000 +#define KVX_PWR_CTRL_VEC_WUP_SET_OFFSET 0x10 +#define KVX_PWR_CTRL_VEC_WUP_CLEAR_OFFSET 0x20 + +/* Power controller PE reset PC register definitions */ +#define KVX_PWR_CTRL_RESET_PC_OFFSET 0x2000 + +/* Power controller global register definitions */ +#define KVX_PWR_CTRL_GLOBAL_OFFSET 0x4040 + +#define KVX_PWR_CTRL_GLOBAL_SET_OFFSET 0x10 +#define KVX_PWR_CTRL_GLOBAL_SET_PE_EN_SHIFT 0x1 + +#define PWR_CTRL_WUP_SET_OFFSET \ + (KVX_PWR_CTRL_VEC_OFFSET + \ + KVX_PWR_CTRL_VEC_WUP_SET_OFFSET) + +#define PWR_CTRL_WUP_CLEAR_OFFSET \ + (KVX_PWR_CTRL_VEC_OFFSET + \ + KVX_PWR_CTRL_VEC_WUP_CLEAR_OFFSET) + +#define PWR_CTRL_GLOBAL_CONFIG_OFFSET \ + (KVX_PWR_CTRL_GLOBAL_OFFSET + \ + KVX_PWR_CTRL_GLOBAL_SET_OFFSET) + +#endif /* _ASM_KVX_PWR_CTRL_H */
arch/kvx/include/asm/smp.h new file +42 -0
42 lines not on this page · raw message
arch/kvx/kernel/l2_cache.c new file +448 -0
448 lines not on this page · raw message
arch/kvx/kernel/smp.c new file +110 -0
110 lines not on this page · raw message
arch/kvx/kernel/smpboot.c new file +127 -0
127 lines not on this page · raw message
arch/kvx/platform/pwr_ctrl.c new file +93 -0
93 lines not on this page · raw message
include/linux/cpuhotplug.h +2 -0
@@ -152,6 +152,7 @@ enum cpuhp_state {CPUHP_AP_IRQ_RISCV_STARTING ,CPUHP_AP_IRQ_LOONGARCH_STARTING ,CPUHP_AP_IRQ_SIFIVE_PLIC_STARTING , +CPUHP_AP_IRQ_KVX_STARTING ,CPUHP_AP_ARM_MVEBU_COHERENCY ,CPUHP_AP_MICROCODE_LOADER , CPUHP_AP_PERF_X86_AMD_UNCORE_STARTING,
@@ -189,6 +190,7 @@ enum cpuhp_state {CPUHP_AP_KVM_ARM_VGIC_INIT_STARTING ,CPUHP_AP_KVM_ARM_VGIC_STARTING ,CPUHP_AP_KVM_ARM_TIMER_STARTING , +CPUHP_AP_KVX_TIMER_STARTING ,/* Must be the last timer callback */ CPUHP_AP_DUMMY_TIMER_STARTING , CPUHP_AP_ARM_XEN_STARTING,
Signature · 1 line
2.37.2
Rob Herring
maintainerRe: [RFC PATCH 17/25] kvx: Add multi-processor (SMP) support
Quoted 495 lines · Yann Sionneau
Coolidge v1 SoC has 5 clusters of 16 kvx cores
(+1 special Resource Manager (RM) core).Linux can run in SMP config on the 16 cores of
a Cluster.Cache coherency is done by the L2 cache.
Co-developed-by Clement Leger <[email protected]>Signed-off-by Clement Leger <[email protected]>Co-developed-by Julian Vetter <[email protected]>Signed-off-by Julian Vetter <[email protected]>Co-developed-by Julien Hascoet <[email protected]>Signed-off-by Julien Hascoet <[email protected]>Co-developed-by Louis Morhet <[email protected]>Signed-off-by Louis Morhet <[email protected]>Co-developed-by Luc Michel <[email protected]>Signed-off-by Luc Michel <[email protected]>Co-developed-by Marius Gligor <[email protected]>Signed-off-by Marius Gligor <[email protected]>Co-developed-by Yann Sionneau <[email protected]>Signed-off-by Yann Sionneau <[email protected]>--- arch/kvx/include/asm/pwr_ctrl.h | 45 ++++ arch/kvx/include/asm/smp.h | 42 +++ arch/kvx/kernel/l2_cache.c | 448 ++++++++++++++++++++++++++++++++ arch/kvx/kernel/smp.c | 110 ++++++++ arch/kvx/kernel/smpboot.c | 127 +++++++++ arch/kvx/platform/pwr_ctrl.c | 93 +++++++ include/linux/cpuhotplug.h | 2 + 7 files changed, 867 insertions(+) create mode 100644 arch/kvx/include/asm/pwr_ctrl.h create mode 100644 arch/kvx/include/asm/smp.h create mode 100644 arch/kvx/kernel/l2_cache.c create mode 100644 arch/kvx/kernel/smp.c create mode 100644 arch/kvx/kernel/smpboot.c create mode 100644 arch/kvx/platform/pwr_ctrl.carch/kvx/include/asm/pwr_ctrl.h new file +45
-0@@ -0,0 +1,45 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +* Marius Gligor +*/ + +#ifndef _ASM_KVX_PWR_CTRL_H +#define _ASM_KVX_PWR_CTRL_H + +#ifndef __ASSEMBLY__ + +int kvx_pwr_ctrl_probe (void ); + +void kvx_pwr_ctrl_cpu_poweron (unsigned int cpu); + +#endif + +/* Power controller vector register definitions */ +#define KVX_PWR_CTRL_VEC_OFFSET 0x1000 +#define KVX_PWR_CTRL_VEC_WUP_SET_OFFSET 0x10 +#define KVX_PWR_CTRL_VEC_WUP_CLEAR_OFFSET 0x20 + +/* Power controller PE reset PC register definitions */ +#define KVX_PWR_CTRL_RESET_PC_OFFSET 0x2000 + +/* Power controller global register definitions */ +#define KVX_PWR_CTRL_GLOBAL_OFFSET 0x4040 + +#define KVX_PWR_CTRL_GLOBAL_SET_OFFSET 0x10 +#define KVX_PWR_CTRL_GLOBAL_SET_PE_EN_SHIFT 0x1 + +#define PWR_CTRL_WUP_SET_OFFSET \ + (KVX_PWR_CTRL_VEC_OFFSET + \ + KVX_PWR_CTRL_VEC_WUP_SET_OFFSET) + +#define PWR_CTRL_WUP_CLEAR_OFFSET \ + (KVX_PWR_CTRL_VEC_OFFSET + \ + KVX_PWR_CTRL_VEC_WUP_CLEAR_OFFSET) + +#define PWR_CTRL_GLOBAL_CONFIG_OFFSET \ + (KVX_PWR_CTRL_GLOBAL_OFFSET + \ + KVX_PWR_CTRL_GLOBAL_SET_OFFSET) + +#endif /* _ASM_KVX_PWR_CTRL_H */ arch/kvx/include/asm/smp.h new file +42
-0@@ -0,0 +1,42 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _ASM_KVX_SMP_H +#define _ASM_KVX_SMP_H + +#include <linux/cpumask.h> +#include <linux/irqreturn.h> + +#include <asm/sfr.h> + +#ifdef CONFIG_SMP + +/* Hook for the generic smp_call_function_many() routine. */ +void arch_send_call_function_ipi_mask (struct cpumask *mask); + +/* Hook for the generic smp_call_function_single() routine. */ +void arch_send_call_function_single_ipi (int cpu); + +void __init setup_processor (void ); + +void smp_init_cpus (void ); + +irqreturn_t ipi_call_interrupt (int irq,void *dev_id); + +#define raw_smp_processor_id () ((int) \ + ((kvx_sfr_get(PCR) & KVX_SFR_PCR_PID_MASK) \ + >> KVX_SFR_PCR_PID_SHIFT)) + +#define flush_cache_vmap (start, end) do { } while (0) +#define flush_cache_vunmap (start, end) do { } while (0) + +#else + +void smp_init_cpus (void ) {} + +#endif /* CONFIG_SMP */ + +#endif arch/kvx/kernel/l2_cache.c new file +351
-0@@ -0,0 +1,448 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +* Luc Michel +* Julien Hascoet +*/ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt + +#include <linux/io.h> +#include <linux/of.h> +#include <linux/jiffies.h> +#include <linux/of_address.h> +#include <linux/irqchip/irq-kvx-apic-mailbox.h> + +#include <asm/rm_fw.h> +#include <asm/l2_cache.h> +#include <asm/sections.h> +#include <asm/cacheflush.h> + +#define L2_START_TIMEOUT_MS 10 +#define L2_CMD_TIMEOUT_MS 200 + +#define L2_MK_OP (__cmd, __sync) (BIT(L2_CMD_OP_VALID_SHIFT) | \ + ((u64) __sync << L2_CMD_OP_SYNC_SHIFT) | \ + ((u64) __cmd << L2_CMD_OP_CMD_SHIFT)) + +#define L2_ERROR (_err) \ + ((error & L2_ERROR_ERROR_CODE_MASK) >> L2_ERROR_ERROR_CODE_SHIFT) + +struct l2_cache_hw_cmd { +u64 op; +u64 args[L2_CMD_OP_ARG_COUNT ]; +} __packed; + +struct l2_cache_cmd { +int sync; +int cmd_type; +unsigned int arg_count; +u64 args[L2_CMD_OP_ARG_COUNT ]; +}; + +/** +* struct l2_cached_data - Data associated to the l2-cache +* @regs: base of L2 registers +* @mbox_regs: Mailbox registers for L2 signaling +*/ +struct l2_cache_data { +void __iomem *regs; +void __iomem *mbox_regs; +u64 fifo_cmd_count; +}; + +DEFINE_STATIC_KEY_FALSE (l2_enabled); +static struct l2_cache_data l2c_ctrl; + +static void *l2_cmd_regs_addr (void ) +{ +return l2c_ctrl.regs +L2_CMD_OFFSET ; +} + +static struct l2_cache_hw_cmd *l2_cache_hw_cmd_addr (u64 idx) +{ +void *cmd_regs =l2_cmd_regs_addr (); + +/* Wrap index */ + idx &= (l2c_ctrl.fifo_cmd_count -1 ); +return cmd_regs +L2_CMD_FIFO_OFFSET + idx *L2_CMD_FIFO_ELEM_SIZE ; +} + +static u64 l2_cache_get_cmd_idx (unsigned int cmd_count) +{ +u64 cmd_idx; +void *cmd_regs =l2_cmd_regs_addr (); +u64 *write_idx_ptr = cmd_regs +L2_CMD_WRITE_IDX_OFFSET ; +u64 *read_idx_ptr = cmd_regs +L2_CMD_READ_IDX_OFFSET ; + +/* Grab a commands tickets */ + cmd_idx =__builtin_kvx_aladdd (write_idx_ptr, cmd_count); + +/* Wait until there is room in command fifo to enqueue commands */ +while ((cmd_idx + cmd_count) >= + (readq (read_idx_ptr) + l2c_ctrl.fifo_cmd_count)) +cpu_relax (); + +return cmd_idx; +} + +static void l2_wait_completion (u64 cmd_idx) +{ +u64 *read_idx_ptr =l2_cmd_regs_addr () +L2_CMD_READ_IDX_OFFSET ; +unsigned long timeout = jiffies +msecs_to_jiffies (L2_CMD_TIMEOUT_MS ); + +/* Wait for completion */ +while (cmd_idx >=readq (read_idx_ptr)) { +cpu_relax (); +if (time_after (jiffies, timeout)) +panic ("L2 cache completion timeout\n" ); + } +} + +static u64 l2_cache_push_cmds (struct l2_cache_cmd *cmds,int cmd_count) +{ +int i, arg; +u64 cmd_op; +struct l2_cache_hw_cmd *cmd; +struct l2_cache_cmd *soft_cmd; +u64 cmd_idx =l2_cache_get_cmd_idx (cmd_count); + +for (i =0 ; i < cmd_count; i++) { + soft_cmd = &cmds[i]; + cmd =l2_cache_hw_cmd_addr (cmd_idx); + cmd_idx++; + +for (arg =0 ; arg < soft_cmd->arg_count; arg++) +writeq_relaxed (soft_cmd->args[arg], &cmd->args[arg]); + + cmd_op =L2_MK_OP (soft_cmd->cmd_type, soft_cmd->sync); +writeq (cmd_op, &cmd->op); + } + +return cmd_idx -1 ; +} + +static void l2_cache_create_line_cmd (struct l2_cache_cmd *cmd,int cmd_type, +int sync,u64 addr) +{ + cmd->cmd_type = cmd_type; + cmd->sync = sync; + cmd->arg_count =1 ; + cmd->args[0 ] = addr; +} + +static void l2_cache_create_area_cmd (struct l2_cache_cmd *cmd,int cmd_type, +int sync,u64 addr,u64 size) +{ +l2_cache_create_line_cmd (cmd, cmd_type, sync, addr); + cmd->arg_count =2 ; + cmd->args[1 ] = size; +} + +static void l2_cache_push_inval_cmd (phys_addr_t start, +unsigned long size) +{ +phys_addr_t end = start + size; +struct l2_cache_cmd cmds[3 ]; +unsigned long irq_flags; +int cmd_count =0 ; +u64 cmd_idx; + +/* +* In case of invalidation, we must make sure we do not invalidate +* unwanted area and thus discard legit data. In case we are not aligned +* send a purge line command (writeback + inval) to unaligned lines +* (which can be the end line or the start line) +*/ +if (!IS_ALIGNED (end,L2_CACHE_LINE_SIZE )) { + end &= ~L2_CACHE_LINE_MASK ; +l2_cache_create_line_cmd (&cmds[cmd_count], +L2_CMD_OP_CMD_PURGE_LINE ,1 , end); + cmd_count++; + } + +if (!IS_ALIGNED (start,L2_CACHE_LINE_SIZE )) { + start &= ~L2_CACHE_LINE_MASK ; +/* If there is at least another line to clear */ +if (end != start) { +l2_cache_create_line_cmd (&cmds[cmd_count], +L2_CMD_OP_CMD_PURGE_LINE ,1 , + start); + cmd_count++; + start +=L2_CACHE_LINE_SIZE ; + } + } + +BUG_ON (end < start); + + size = (end - start); +if (size >0 ) { +l2_cache_create_area_cmd (&cmds[cmd_count], +L2_CMD_OP_CMD_INVAL_AREA ,1 , start, + size); + cmd_count++; + } + +BUG_ON (cmd_count ==0 ); + +local_irq_save (irq_flags); + + cmd_idx =l2_cache_push_cmds (cmds, cmd_count); + +/* Finally, ping the L2 cache controller */ +writeq (1 , l2c_ctrl.mbox_regs); + +local_irq_restore (irq_flags); + +l2_wait_completion (cmd_idx); +} + +static void l2_cache_push_generic_cmd (u64 cmd_type,phys_addr_t start, +unsigned long size) +{ +unsigned long irq_flags; +struct l2_cache_cmd cmd; +u64 cmd_idx; + +/* Align the start address and size on cache line */ + size += start & (L2_CACHE_LINE_SIZE -1 ); + size =ALIGN (size,L2_CACHE_LINE_SIZE ); + start =ALIGN_DOWN (start,L2_CACHE_LINE_SIZE ); + +local_irq_save (irq_flags); + +l2_cache_create_area_cmd (&cmd, cmd_type,1 , start, size); + cmd_idx =l2_cache_push_cmds (&cmd,1 ); + +/* Finally, ping the L2 cache controller */ +writeq (1 , l2c_ctrl.mbox_regs); + +local_irq_restore (irq_flags); + +l2_wait_completion (cmd_idx); +} + +void l2_cache_push_area_cmd (u64 cmd_type,phys_addr_t start, +unsigned long size) +{ +if (WARN_ON (size ==0 )) +return ; + +if (cmd_type ==L2_CMD_OP_CMD_INVAL_AREA ) +l2_cache_push_inval_cmd (start, size); +else +l2_cache_push_generic_cmd (cmd_type, start, size); +} + +static void __init l2_disp_error (u64 error) +{ +const char *err_type; + +if (error &L2_ERROR_API_ERR_MASK ) + err_type ="API" ; +else if (error &L2_ERROR_SETUP_ERR_MASK ) + err_type ="SETUP" ; +else + err_type ="UNKNOWN" ; + +pr_err ("%s error: 0x%llx\n" , err_type,L2_ERROR (error)); +} + +static int __init l2_cache_configure_mailboxes (void ) +{ +phys_addr_t l2_mbox_addr =0 ; +void *cmd_regs =l2_cmd_regs_addr (); + +/* We do not use mailbox to wait for completion, set it to 0 */ +writeq (0 , cmd_regs +L2_CMD_DOORBELL_READ_ADDR_OFFSET ); + +/* Read mailbox address from L2 registers */ + l2_mbox_addr =readq (cmd_regs +L2_CMD_DOORBELL_WRITE_ADDR_OFFSET ); + +/* Then map the mailbox */ + l2c_ctrl.mbox_regs =ioremap (l2_mbox_addr,PAGE_SIZE ); +if (!l2c_ctrl.mbox_regs) { +pr_err ("Failed to map mailbox\n" ); +return 1 ; + } + +/* Lock this entry into the LTLB */ +kvx_mmu_ltlb_add_entry ((unsigned long ) l2c_ctrl.mbox_regs &PAGE_MASK , + l2_mbox_addr &PAGE_MASK , +PAGE_KERNEL_DEVICE ,TLB_PS_4K ); + +return 0 ; +} + +static int __init l2_cache_read_queue_size (void ) +{ +u64 inst; + +/* Read command queue size */ + inst =readq (l2c_ctrl.regs +L2_INSTANCE_OFFSET ); + l2c_ctrl.fifo_cmd_count = (inst &L2_INSTANCE_CMD_QUEUE_SIZE_MASK ) + >>L2_INSTANCE_CMD_QUEUE_SIZE_SHIFT ; + +/* Check if value is a power of two */ +if (hweight64 (l2c_ctrl.fifo_cmd_count) !=1 ) { +pr_err ("Command queue size is not a power of two\n" ); +return 1 ; + } + +return 0 ; +} + +static int __init l2_cache_init_hw (void ) +{ +unsigned long timeout = jiffies +msecs_to_jiffies (L2_START_TIMEOUT_MS ); +unsigned long flags; +u64 status, error; +int ret; + +/* Wait for L2 to be up */ +do { + status =readq (l2c_ctrl.regs +L2_STATUS_OFFSET ); +if (status & (L2_STATUS_READY_MASK |L2_STATUS_ERROR_MASK )) +break ; + }while (time_before (jiffies, timeout)); + +if (!status) { +pr_err ("Timeout while waiting for firmware status\n" ); +return -ENODEV ; + } + +if (status &L2_STATUS_ERROR_MASK ) { + error =readq (l2c_ctrl.regs +L2_ERROR_OFFSET ); +l2_disp_error (error); +return -EINVAL ; + } + +/* Now write ack to L2 firmware */ +writeq (status |L2_STATUS_ACK_MASK , l2c_ctrl.regs +L2_STATUS_OFFSET ); + + ret =l2_cache_read_queue_size (); +if (ret) +return ret; + + ret =l2_cache_configure_mailboxes (); +if (ret) +return ret; + +/* Enable the L2 atomically */ +local_irq_save (flags); + +/* Fence data accesses */ +kvx_fence (); +/* Purge L1 */ +l1_inval_dcache_all (); +l1_inval_icache_all (); +__builtin_kvx_barrier (); + +local_irq_restore (flags); + +/* Enable L2$ */ +kvx_sfr_set_field (PS ,L2E ,1 ); + +return 0 ; +} + +static phys_addr_t __init l2_get_regs_addr (struct device_node *np) +{
arch/kvx/kernel/l2_cache.c line 361
Quoted 10 lines
arch/kvx/kernel/l2_cache.c new file +10
-0+const void *reg; +struct resource res; +phys_addr_t l2_regs_addr; +int ret; + +/* +* If regs is specified in device tree, then the L2$ has been loaded by +* someone else and not by ourself. +*/ + reg =of_get_property (np,"reg" ,NULL );
Why do you read 'reg' and then...
arch/kvx/kernel/l2_cache.c line 363
Quoted 2 lines
arch/kvx/kernel/l2_cache.c new file +2
-0+if (reg) { + ret =of_address_to_resource (np,0 , &res);
...read it again?
arch/kvx/kernel/l2_cache.c line 369
Quoted 6 lines
arch/kvx/kernel/l2_cache.c new file +6
-0+if (ret) { +pr_err ("Address translation error\n" ); +return 0 ; + } +if ((res.end - res.start) >PAGE_SIZE ) { +pr_err ("L2 reg size > PAGE_SIZE\n" );
Why do you care?
arch/kvx/kernel/l2_cache.c line 379
Quoted 10 lines
arch/kvx/kernel/l2_cache.c new file +10
-0+return 0 ; + } + + l2_regs_addr = res.start; + }else { + l2_regs_addr = (phys_addr_t ) __rm_firmware_regs_start; + } + +if (!IS_ALIGNED (l2_regs_addr,PAGE_SIZE )) { +pr_err ("Registers not aligned on PAGE_SIZE\n" );
So?
If you have constraints, put those in the DT schema for this device and validate your DT. The kernel doesn't need to validate the DT.
arch/kvx/kernel/l2_cache.c line 392
Quoted 13 lines
arch/kvx/kernel/l2_cache.c new file +13
-0+return 0 ; + } + +return l2_regs_addr; +} + +static int __init l2_cache_init (void ) +{ +int ret = -ENODEV ; +struct device_node *np; +phys_addr_t l2_regs_addr; + + np =of_find_compatible_node (NULL ,NULL ,"kalray,kvx-l2-cache" );
Needs to be documented.
arch/kvx/kernel/l2_cache.c line 399
Quoted 7 lines
arch/kvx/kernel/l2_cache.c new file +7
-0+if (!np || !of_device_is_available (np)) { +if (!IS_ENABLED (CONFIG_SMP )) { +pr_info ("controller disabled\n" ); +return 0 ; + } + +if (np &&of_get_property (np,"kalray,is-qemu" ,NULL )) {
Make your compatible strings specific enough to detect this rather than a flag.
Quoted 179 lines
arch/kvx/kernel/l2_cache.c new file +49
-0+/* +* QEMU is always full cache coherent. The L2 cache controller is +* not strictly necessary to ensure coherency in SMP. +*/ +pr_info ("controller disabled (QEMU detected)\n" ); +return 0 ; + } + +/* Else, SMP is enabled and L2 is mandatory for it */ + goto err; + } + + l2_regs_addr =l2_get_regs_addr (np); +if (!l2_regs_addr) + goto err; + +/* Map the L2 registers */ + l2c_ctrl.regs =ioremap (l2_regs_addr,PAGE_SIZE ); +if (!l2c_ctrl.regs) + goto err; + +/* Lock this entry into the LTLB */ +kvx_mmu_ltlb_add_entry ((unsigned long ) l2c_ctrl.regs, l2_regs_addr, +PAGE_KERNEL_NOCACHE ,TLB_PS_4K ); + + ret =l2_cache_init_hw (); +if (ret) { +pr_err ("Failed to init L2 cache controller" ); + goto err_unmap_l2; + } + +static_branch_enable (&l2_enabled); + +pr_info ("controller enabled\n" ); + +return 0 ; + +err_unmap_l2: +kvx_mmu_ltlb_remove_entry ((unsigned long ) l2c_ctrl.regs); +iounmap (l2c_ctrl.regs); +err: +if (IS_ENABLED (CONFIG_SMP )) +panic ("L2$ controller is mandatory for SMP" ); + +return ret; +} + + +early_initcall (l2_cache_init);arch/kvx/kernel/smp.c new file +110
-0@@ -0,0 +1,110 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#include <linux/smp.h> +#include <linux/cpu.h> +#include <linux/of_irq.h> +#include <linux/cpumask.h> +#include <linux/irq_work.h> +#include <linux/mm_types.h> +#include <linux/interrupt.h> + +#include <asm/ipi.h> +#include <asm/tlbflush.h> + +enum ipi_message_type { +IPI_RESCHEDULE , +IPI_CALL_FUNC , +IPI_IRQ_WORK , +IPI_MAX +}; + +/* A collection of single bit ipi messages. */ +static struct { +unsigned long bits____cacheline_aligned ; +} ipi_data[NR_CPUS] __cacheline_aligned; + +static void send_ipi_message (const struct cpumask *mask, +enum ipi_message_type operation) +{ +unsigned long flags; +int cpu; + +/* Set operation that must be done by receiver */ +for_each_cpu (cpu, mask) +set_bit (operation, &ipi_data[cpu].bits); + +/* Commit the write before sending IPI */ +smp_wmb (); + +local_irq_save (flags); + +kvx_ipi_send (mask); + +local_irq_restore (flags); +} + +void arch_send_call_function_ipi_mask (struct cpumask *mask) +{ +send_ipi_message (mask,IPI_CALL_FUNC ); +} + +void arch_send_call_function_single_ipi (int cpu) +{ +send_ipi_message (cpumask_of (cpu),IPI_CALL_FUNC ); +} + +#ifdef CONFIG_IRQ_WORK +void arch_irq_work_raise (void ) +{ +send_ipi_message (cpumask_of (smp_processor_id ()),IPI_IRQ_WORK ); +} +#endif + +static void ipi_stop (void *unused) +{ +local_cpu_stop (); +} + +void smp_send_stop (void ) +{ +struct cpumask targets; + +cpumask_copy (&targets, cpu_online_mask); +cpumask_clear_cpu (smp_processor_id (), &targets); + +smp_call_function_many (&targets, ipi_stop,NULL ,0 ); +} + +void smp_send_reschedule (int cpu) +{ +send_ipi_message (cpumask_of (cpu),IPI_RESCHEDULE ); +} + +irqreturn_t ipi_call_interrupt (int irq,void *dev_id) +{ +unsigned long *pending_ipis = &ipi_data[smp_processor_id ()].bits; + +while (true) { +unsigned long ops =xchg (pending_ipis,0 ); + +if (ops ==0 ) +return IRQ_HANDLED ; + +if (ops & (1 <<IPI_RESCHEDULE )) +scheduler_ipi (); + +if (ops & (1 <<IPI_CALL_FUNC )) +generic_smp_call_function_interrupt (); + +if (ops & (1 <<IPI_IRQ_WORK )) +irq_work_run (); + +BUG_ON ((ops >>IPI_MAX ) !=0 ); + } + +return IRQ_HANDLED ; +}arch/kvx/kernel/smpboot.c new file +8
-0@@ -0,0 +1,127 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +* Julian Vetter +*/ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt
arch/kvx/kernel/smpboot.c line 18
Quoted 10 lines
arch/kvx/kernel/smpboot.c new file +10
-0+ +#include <linux/io.h> +#include <linux/of.h> +#include <linux/smp.h> +#include <linux/cpu.h> +#include <linux/sched.h> +#include <linux/cpumask.h> +#include <linux/sched/mm.h> +#include <linux/mm_types.h> +#include <linux/of_platform.h>
Don't think this is needed.
Quoted 36 lines
arch/kvx/kernel/smpboot.c new file +36
-0+#include <linux/sched/task_stack.h> + +#include <asm/pwr_ctrl.h> +#include <asm/tlbflush.h> +#include <asm/ipi.h> + +void *__cpu_up_stack_pointer[NR_CPUS ]; +void *__cpu_up_task_pointer[NR_CPUS ]; + +void __init smp_prepare_boot_cpu (void ) +{ +} + +int __cpu_up (unsigned int cpu,struct task_struct *tidle) +{ + __cpu_up_stack_pointer[cpu] =task_stack_page (tidle) +THREAD_SIZE ; + __cpu_up_task_pointer[cpu] = tidle; +/* We need to be sure writes are committed */ +smp_mb (); + +kvx_pwr_ctrl_cpu_poweron (cpu); +while (!cpu_online (cpu)) +cpu_relax (); + +return 0 ; +} + +void __init smp_cpus_done (unsigned int max_cpus) +{ +} + +void __init smp_init_cpus (void ) +{ +struct cpumask cpumask; +struct device_node *cpu; +const __be32 *reg;
arch/kvx/kernel/smpboot.c line 64
Quoted 10 lines
arch/kvx/kernel/smpboot.c new file +10
-0+u32 cpu_num; +unsigned int nr_cpus =0 ; + +cpumask_clear (&cpumask); + +for_each_of_cpu_node (cpu) { +if (!of_device_is_available (cpu)) +continue ; + + reg =of_get_property (cpu,"reg" ,NULL );
Use of_get_cpu_hwid()
arch/kvx/kernel/smpboot.c line 73
Quoted 9 lines
arch/kvx/kernel/smpboot.c new file +9
-0+if (!reg) +continue ; + + cpu_num =be32_to_cpup (reg); +if (cpu_num >= nr_cpu_ids) +continue ; + + nr_cpus++; +cpumask_set_cpu (cpu_num, &cpumask);
Why not just do set_cpu_possible() directly instead of the temp cpumask.
Quoted 104 lines
arch/kvx/kernel/smpboot.c new file +54
-0+ } + +pr_info ("%d possible cpus\n" , nr_cpus); +init_cpu_possible (&cpumask); +} + +void __init smp_prepare_cpus (unsigned int max_cpus) +{ +if (num_present_cpus () <=1 ) +init_cpu_present (cpu_possible_mask); +} + +int __init setup_smp (void ) +{ +int ret; + + ret =kvx_pwr_ctrl_probe (); +if (ret) +panic ("Failed to probe power controller !" ); + + ret =kvx_ipi_ctrl_probe (ipi_call_interrupt); +if (ret) +panic ("Failed to probe IPI controller !" ); + +return 0 ; +} + +early_initcall (setup_smp); + +/* +* C entry point for a secondary processor. +*/ +void __init start_kernel_secondary (void ) +{ +struct mm_struct *mm = &init_mm; +unsigned int cpu =smp_processor_id (); + +setup_processor (); +kvx_mmu_early_setup (); + +/* All kernel threads share the same mm context. */ +mmgrab (mm); + current->active_mm = mm; +cpumask_set_cpu (cpu,mm_cpumask (mm)); + +notify_cpu_starting (cpu); +set_cpu_online (cpu, true); +trace_hardirqs_off (); + +local_flush_tlb_all (); + +local_irq_enable (); +cpu_startup_entry (CPUHP_AP_ONLINE_IDLE ); +}arch/kvx/platform/pwr_ctrl.c new file +44
-0@@ -0,0 +1,93 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt + +#include <linux/io.h> +#include <linux/slab.h> +#include <linux/types.h> +#include <linux/module.h> +#include <linux/of_address.h> +#include <linux/of_platform.h> + +#include <asm/pwr_ctrl.h> +#include <asm/symbols.h> + +struct kvx_pwr_ctrl { +void __iomem *regs; +}; + +static struct kvx_pwr_ctrl kvx_pwr_controller; + +/** +* kvx_pwr_ctrl_cpu_poweron() - Wakeup a cpu +* @cpu: cpu to wakeup +*/ +void kvx_pwr_ctrl_cpu_poweron (unsigned int cpu) +{ +/* Set PE boot address */ +writeq ((unsigned long long )kvx_start, + kvx_pwr_controller.regs +KVX_PWR_CTRL_RESET_PC_OFFSET ); +/* Wake up processor ! */ +writeq (1ULL << cpu, + kvx_pwr_controller.regs +PWR_CTRL_WUP_SET_OFFSET ); +/* Then clear wakeup to allow processor to sleep */ +writeq (1ULL << cpu, + kvx_pwr_controller.regs +PWR_CTRL_WUP_CLEAR_OFFSET ); +} + +static struct device_node *__init get_pwr_ctrl_node (void ) +{ +const phandle *ph;
arch/kvx/platform/pwr_ctrl.c line 54
Quoted 10 lines
arch/kvx/platform/pwr_ctrl.c new file +10
-0+struct device_node *cpu; +struct device_node *node; + + cpu =of_get_cpu_node (raw_smp_processor_id (),NULL ); +if (!cpu) { +pr_err ("Failed to get CPU node\n" ); +return NULL ; + } + + ph =of_get_property (cpu,"power-controller" ,NULL );
Not a standard property.
Quoted 15 lines
arch/kvx/platform/pwr_ctrl.c new file +15
-0+if (!ph) { +pr_err ("Failed to get power-controller phandle\n" ); +return NULL ; + } + + node =of_find_node_by_phandle (be32_to_cpup (ph)); +if (!node) { +pr_err ("Failed to get power-controller node\n" ); +return NULL ; + } + +return node; +} + +int __init kvx_pwr_ctrl_probe (void )
arch/kvx/platform/pwr_ctrl.c line 79
Quoted 10 lines
arch/kvx/platform/pwr_ctrl.c new file +10
-0+{ +struct device_node *ctrl; + + ctrl =get_pwr_ctrl_node (); +if (!ctrl) { +pr_err ("Failed to get power controller node\n" ); +return -EINVAL ; + } + +if (!of_device_is_compatible (ctrl,"kalray,kvx-pwr-ctrl" )) {
Needs to be documented...
arch/kvx/platform/pwr_ctrl.c line 90
Quoted 11 lines
arch/kvx/platform/pwr_ctrl.c new file +11
-0+pr_err ("Failed to get power controller node\n" ); +return -EINVAL ; + } + + kvx_pwr_controller.regs =of_iomap (ctrl,0 ); +if (!kvx_pwr_controller.regs) { +pr_err ("Failed ioremap\n" ); +return -EINVAL ; + } + +pr_info ("kvx power controller probed\n" );
Drop success messages.
Quoted 31 lines
arch/kvx/platform/pwr_ctrl.c new file +3
-0+ +return 0 ; +}include/linux/cpuhotplug.h +2
-0@@ -152,6 +152,7 @@ enum cpuhp_state {CPUHP_AP_IRQ_RISCV_STARTING ,CPUHP_AP_IRQ_LOONGARCH_STARTING ,CPUHP_AP_IRQ_SIFIVE_PLIC_STARTING , +CPUHP_AP_IRQ_KVX_STARTING ,CPUHP_AP_ARM_MVEBU_COHERENCY ,CPUHP_AP_MICROCODE_LOADER , CPUHP_AP_PERF_X86_AMD_UNCORE_STARTING,@@ -189,6 +190,7 @@ enum cpuhp_state {CPUHP_AP_KVM_ARM_VGIC_INIT_STARTING ,CPUHP_AP_KVM_ARM_VGIC_STARTING ,CPUHP_AP_KVM_ARM_TIMER_STARTING , +CPUHP_AP_KVX_TIMER_STARTING ,/* Must be the last timer callback */ CPUHP_AP_DUMMY_TIMER_STARTING , CPUHP_AP_ARM_XEN_STARTING,Signature · 1 line
2.37.2
Re: [RFC PATCH 17/25] kvx: Add multi-processor (SMP) support
In reply to Yann SionneauQuoted 519 lines · Yann Sionneau
Coolidge v1 SoC has 5 clusters of 16 kvx cores
(+1 special Resource Manager (RM) core).Linux can run in SMP config on the 16 cores of
a Cluster.Cache coherency is done by the L2 cache.
Co-developed-by Clement Leger <[email protected]>Signed-off-by Clement Leger <[email protected]>Co-developed-by Julian Vetter <[email protected]>Signed-off-by Julian Vetter <[email protected]>Co-developed-by Julien Hascoet <[email protected]>Signed-off-by Julien Hascoet <[email protected]>Co-developed-by Louis Morhet <[email protected]>Signed-off-by Louis Morhet <[email protected]>Co-developed-by Luc Michel <[email protected]>Signed-off-by Luc Michel <[email protected]>Co-developed-by Marius Gligor <[email protected]>Signed-off-by Marius Gligor <[email protected]>Co-developed-by Yann Sionneau <[email protected]>Signed-off-by Yann Sionneau <[email protected]>--- arch/kvx/include/asm/pwr_ctrl.h | 45 ++++ arch/kvx/include/asm/smp.h | 42 +++ arch/kvx/kernel/l2_cache.c | 448 ++++++++++++++++++++++++++++++++ arch/kvx/kernel/smp.c | 110 ++++++++ arch/kvx/kernel/smpboot.c | 127 +++++++++ arch/kvx/platform/pwr_ctrl.c | 93 +++++++ include/linux/cpuhotplug.h | 2 + 7 files changed, 867 insertions(+) create mode 100644 arch/kvx/include/asm/pwr_ctrl.h create mode 100644 arch/kvx/include/asm/smp.h create mode 100644 arch/kvx/kernel/l2_cache.c create mode 100644 arch/kvx/kernel/smp.c create mode 100644 arch/kvx/kernel/smpboot.c create mode 100644 arch/kvx/platform/pwr_ctrl.carch/kvx/include/asm/pwr_ctrl.h new file +45
-0@@ -0,0 +1,45 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +* Marius Gligor +*/ + +#ifndef _ASM_KVX_PWR_CTRL_H +#define _ASM_KVX_PWR_CTRL_H + +#ifndef __ASSEMBLY__ + +int kvx_pwr_ctrl_probe (void ); + +void kvx_pwr_ctrl_cpu_poweron (unsigned int cpu); + +#endif + +/* Power controller vector register definitions */ +#define KVX_PWR_CTRL_VEC_OFFSET 0x1000 +#define KVX_PWR_CTRL_VEC_WUP_SET_OFFSET 0x10 +#define KVX_PWR_CTRL_VEC_WUP_CLEAR_OFFSET 0x20 + +/* Power controller PE reset PC register definitions */ +#define KVX_PWR_CTRL_RESET_PC_OFFSET 0x2000 + +/* Power controller global register definitions */ +#define KVX_PWR_CTRL_GLOBAL_OFFSET 0x4040 + +#define KVX_PWR_CTRL_GLOBAL_SET_OFFSET 0x10 +#define KVX_PWR_CTRL_GLOBAL_SET_PE_EN_SHIFT 0x1 + +#define PWR_CTRL_WUP_SET_OFFSET \ + (KVX_PWR_CTRL_VEC_OFFSET + \ + KVX_PWR_CTRL_VEC_WUP_SET_OFFSET) + +#define PWR_CTRL_WUP_CLEAR_OFFSET \ + (KVX_PWR_CTRL_VEC_OFFSET + \ + KVX_PWR_CTRL_VEC_WUP_CLEAR_OFFSET) + +#define PWR_CTRL_GLOBAL_CONFIG_OFFSET \ + (KVX_PWR_CTRL_GLOBAL_OFFSET + \ + KVX_PWR_CTRL_GLOBAL_SET_OFFSET) + +#endif /* _ASM_KVX_PWR_CTRL_H */ arch/kvx/include/asm/smp.h new file +42
-0@@ -0,0 +1,42 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#ifndef _ASM_KVX_SMP_H +#define _ASM_KVX_SMP_H + +#include <linux/cpumask.h> +#include <linux/irqreturn.h> + +#include <asm/sfr.h> + +#ifdef CONFIG_SMP + +/* Hook for the generic smp_call_function_many() routine. */ +void arch_send_call_function_ipi_mask (struct cpumask *mask); + +/* Hook for the generic smp_call_function_single() routine. */ +void arch_send_call_function_single_ipi (int cpu); + +void __init setup_processor (void ); + +void smp_init_cpus (void ); + +irqreturn_t ipi_call_interrupt (int irq,void *dev_id); + +#define raw_smp_processor_id () ((int) \ + ((kvx_sfr_get(PCR) & KVX_SFR_PCR_PID_MASK) \ + >> KVX_SFR_PCR_PID_SHIFT)) + +#define flush_cache_vmap (start, end) do { } while (0) +#define flush_cache_vunmap (start, end) do { } while (0) + +#else + +void smp_init_cpus (void ) {} + +#endif /* CONFIG_SMP */ + +#endif arch/kvx/kernel/l2_cache.c new file +375
-0@@ -0,0 +1,448 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +* Luc Michel +* Julien Hascoet +*/ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt + +#include <linux/io.h> +#include <linux/of.h> +#include <linux/jiffies.h> +#include <linux/of_address.h> +#include <linux/irqchip/irq-kvx-apic-mailbox.h> + +#include <asm/rm_fw.h> +#include <asm/l2_cache.h> +#include <asm/sections.h> +#include <asm/cacheflush.h> + +#define L2_START_TIMEOUT_MS 10 +#define L2_CMD_TIMEOUT_MS 200 + +#define L2_MK_OP (__cmd, __sync) (BIT(L2_CMD_OP_VALID_SHIFT) | \ + ((u64) __sync << L2_CMD_OP_SYNC_SHIFT) | \ + ((u64) __cmd << L2_CMD_OP_CMD_SHIFT)) + +#define L2_ERROR (_err) \ + ((error & L2_ERROR_ERROR_CODE_MASK) >> L2_ERROR_ERROR_CODE_SHIFT) + +struct l2_cache_hw_cmd { +u64 op; +u64 args[L2_CMD_OP_ARG_COUNT ]; +} __packed; + +struct l2_cache_cmd { +int sync; +int cmd_type; +unsigned int arg_count; +u64 args[L2_CMD_OP_ARG_COUNT ]; +}; + +/** +* struct l2_cached_data - Data associated to the l2-cache +* @regs: base of L2 registers +* @mbox_regs: Mailbox registers for L2 signaling +*/ +struct l2_cache_data { +void __iomem *regs; +void __iomem *mbox_regs; +u64 fifo_cmd_count; +}; + +DEFINE_STATIC_KEY_FALSE (l2_enabled); +static struct l2_cache_data l2c_ctrl; + +static void *l2_cmd_regs_addr (void ) +{ +return l2c_ctrl.regs +L2_CMD_OFFSET ; +} + +static struct l2_cache_hw_cmd *l2_cache_hw_cmd_addr (u64 idx) +{ +void *cmd_regs =l2_cmd_regs_addr (); + +/* Wrap index */ + idx &= (l2c_ctrl.fifo_cmd_count -1 ); +return cmd_regs +L2_CMD_FIFO_OFFSET + idx *L2_CMD_FIFO_ELEM_SIZE ; +} + +static u64 l2_cache_get_cmd_idx (unsigned int cmd_count) +{ +u64 cmd_idx; +void *cmd_regs =l2_cmd_regs_addr (); +u64 *write_idx_ptr = cmd_regs +L2_CMD_WRITE_IDX_OFFSET ; +u64 *read_idx_ptr = cmd_regs +L2_CMD_READ_IDX_OFFSET ; + +/* Grab a commands tickets */ + cmd_idx =__builtin_kvx_aladdd (write_idx_ptr, cmd_count); + +/* Wait until there is room in command fifo to enqueue commands */ +while ((cmd_idx + cmd_count) >= + (readq (read_idx_ptr) + l2c_ctrl.fifo_cmd_count)) +cpu_relax (); + +return cmd_idx; +} + +static void l2_wait_completion (u64 cmd_idx) +{ +u64 *read_idx_ptr =l2_cmd_regs_addr () +L2_CMD_READ_IDX_OFFSET ; +unsigned long timeout = jiffies +msecs_to_jiffies (L2_CMD_TIMEOUT_MS ); + +/* Wait for completion */ +while (cmd_idx >=readq (read_idx_ptr)) { +cpu_relax (); +if (time_after (jiffies, timeout)) +panic ("L2 cache completion timeout\n" ); + } +} + +static u64 l2_cache_push_cmds (struct l2_cache_cmd *cmds,int cmd_count) +{ +int i, arg; +u64 cmd_op; +struct l2_cache_hw_cmd *cmd; +struct l2_cache_cmd *soft_cmd; +u64 cmd_idx =l2_cache_get_cmd_idx (cmd_count); + +for (i =0 ; i < cmd_count; i++) { + soft_cmd = &cmds[i]; + cmd =l2_cache_hw_cmd_addr (cmd_idx); + cmd_idx++; + +for (arg =0 ; arg < soft_cmd->arg_count; arg++) +writeq_relaxed (soft_cmd->args[arg], &cmd->args[arg]); + + cmd_op =L2_MK_OP (soft_cmd->cmd_type, soft_cmd->sync); +writeq (cmd_op, &cmd->op); + } + +return cmd_idx -1 ; +} + +static void l2_cache_create_line_cmd (struct l2_cache_cmd *cmd,int cmd_type, +int sync,u64 addr) +{ + cmd->cmd_type = cmd_type; + cmd->sync = sync; + cmd->arg_count =1 ; + cmd->args[0 ] = addr; +} + +static void l2_cache_create_area_cmd (struct l2_cache_cmd *cmd,int cmd_type, +int sync,u64 addr,u64 size) +{ +l2_cache_create_line_cmd (cmd, cmd_type, sync, addr); + cmd->arg_count =2 ; + cmd->args[1 ] = size; +} + +static void l2_cache_push_inval_cmd (phys_addr_t start, +unsigned long size) +{ +phys_addr_t end = start + size; +struct l2_cache_cmd cmds[3 ]; +unsigned long irq_flags; +int cmd_count =0 ; +u64 cmd_idx; + +/* +* In case of invalidation, we must make sure we do not invalidate +* unwanted area and thus discard legit data. In case we are not aligned +* send a purge line command (writeback + inval) to unaligned lines +* (which can be the end line or the start line) +*/ +if (!IS_ALIGNED (end,L2_CACHE_LINE_SIZE )) { + end &= ~L2_CACHE_LINE_MASK ; +l2_cache_create_line_cmd (&cmds[cmd_count], +L2_CMD_OP_CMD_PURGE_LINE ,1 , end); + cmd_count++; + } + +if (!IS_ALIGNED (start,L2_CACHE_LINE_SIZE )) { + start &= ~L2_CACHE_LINE_MASK ; +/* If there is at least another line to clear */ +if (end != start) { +l2_cache_create_line_cmd (&cmds[cmd_count], +L2_CMD_OP_CMD_PURGE_LINE ,1 , + start); + cmd_count++; + start +=L2_CACHE_LINE_SIZE ; + } + } + +BUG_ON (end < start); + + size = (end - start); +if (size >0 ) { +l2_cache_create_area_cmd (&cmds[cmd_count], +L2_CMD_OP_CMD_INVAL_AREA ,1 , start, + size); + cmd_count++; + } + +BUG_ON (cmd_count ==0 ); + +local_irq_save (irq_flags); + + cmd_idx =l2_cache_push_cmds (cmds, cmd_count); + +/* Finally, ping the L2 cache controller */ +writeq (1 , l2c_ctrl.mbox_regs); + +local_irq_restore (irq_flags); + +l2_wait_completion (cmd_idx); +} + +static void l2_cache_push_generic_cmd (u64 cmd_type,phys_addr_t start, +unsigned long size) +{ +unsigned long irq_flags; +struct l2_cache_cmd cmd; +u64 cmd_idx; + +/* Align the start address and size on cache line */ + size += start & (L2_CACHE_LINE_SIZE -1 ); + size =ALIGN (size,L2_CACHE_LINE_SIZE ); + start =ALIGN_DOWN (start,L2_CACHE_LINE_SIZE ); + +local_irq_save (irq_flags); + +l2_cache_create_area_cmd (&cmd, cmd_type,1 , start, size); + cmd_idx =l2_cache_push_cmds (&cmd,1 ); + +/* Finally, ping the L2 cache controller */ +writeq (1 , l2c_ctrl.mbox_regs); + +local_irq_restore (irq_flags); + +l2_wait_completion (cmd_idx); +} + +void l2_cache_push_area_cmd (u64 cmd_type,phys_addr_t start, +unsigned long size) +{ +if (WARN_ON (size ==0 )) +return ; + +if (cmd_type ==L2_CMD_OP_CMD_INVAL_AREA ) +l2_cache_push_inval_cmd (start, size); +else +l2_cache_push_generic_cmd (cmd_type, start, size); +} + +static void __init l2_disp_error (u64 error) +{ +const char *err_type; + +if (error &L2_ERROR_API_ERR_MASK ) + err_type ="API" ; +else if (error &L2_ERROR_SETUP_ERR_MASK ) + err_type ="SETUP" ; +else + err_type ="UNKNOWN" ; + +pr_err ("%s error: 0x%llx\n" , err_type,L2_ERROR (error)); +} + +static int __init l2_cache_configure_mailboxes (void ) +{ +phys_addr_t l2_mbox_addr =0 ; +void *cmd_regs =l2_cmd_regs_addr (); + +/* We do not use mailbox to wait for completion, set it to 0 */ +writeq (0 , cmd_regs +L2_CMD_DOORBELL_READ_ADDR_OFFSET ); + +/* Read mailbox address from L2 registers */ + l2_mbox_addr =readq (cmd_regs +L2_CMD_DOORBELL_WRITE_ADDR_OFFSET ); + +/* Then map the mailbox */ + l2c_ctrl.mbox_regs =ioremap (l2_mbox_addr,PAGE_SIZE ); +if (!l2c_ctrl.mbox_regs) { +pr_err ("Failed to map mailbox\n" ); +return 1 ; + } + +/* Lock this entry into the LTLB */ +kvx_mmu_ltlb_add_entry ((unsigned long ) l2c_ctrl.mbox_regs &PAGE_MASK , + l2_mbox_addr &PAGE_MASK , +PAGE_KERNEL_DEVICE ,TLB_PS_4K ); + +return 0 ; +} + +static int __init l2_cache_read_queue_size (void ) +{ +u64 inst; + +/* Read command queue size */ + inst =readq (l2c_ctrl.regs +L2_INSTANCE_OFFSET ); + l2c_ctrl.fifo_cmd_count = (inst &L2_INSTANCE_CMD_QUEUE_SIZE_MASK ) + >>L2_INSTANCE_CMD_QUEUE_SIZE_SHIFT ; + +/* Check if value is a power of two */ +if (hweight64 (l2c_ctrl.fifo_cmd_count) !=1 ) { +pr_err ("Command queue size is not a power of two\n" ); +return 1 ; + } + +return 0 ; +} + +static int __init l2_cache_init_hw (void ) +{ +unsigned long timeout = jiffies +msecs_to_jiffies (L2_START_TIMEOUT_MS ); +unsigned long flags; +u64 status, error; +int ret; + +/* Wait for L2 to be up */ +do { + status =readq (l2c_ctrl.regs +L2_STATUS_OFFSET ); +if (status & (L2_STATUS_READY_MASK |L2_STATUS_ERROR_MASK )) +break ; + }while (time_before (jiffies, timeout)); + +if (!status) { +pr_err ("Timeout while waiting for firmware status\n" ); +return -ENODEV ; + } + +if (status &L2_STATUS_ERROR_MASK ) { + error =readq (l2c_ctrl.regs +L2_ERROR_OFFSET ); +l2_disp_error (error); +return -EINVAL ; + } + +/* Now write ack to L2 firmware */ +writeq (status |L2_STATUS_ACK_MASK , l2c_ctrl.regs +L2_STATUS_OFFSET ); + + ret =l2_cache_read_queue_size (); +if (ret) +return ret; + + ret =l2_cache_configure_mailboxes (); +if (ret) +return ret; + +/* Enable the L2 atomically */ +local_irq_save (flags); + +/* Fence data accesses */ +kvx_fence (); +/* Purge L1 */ +l1_inval_dcache_all (); +l1_inval_icache_all (); +__builtin_kvx_barrier (); + +local_irq_restore (flags); + +/* Enable L2$ */ +kvx_sfr_set_field (PS ,L2E ,1 ); + +return 0 ; +} + +static phys_addr_t __init l2_get_regs_addr (struct device_node *np) +{ +const void *reg; +struct resource res; +phys_addr_t l2_regs_addr; +int ret; + +/* +* If regs is specified in device tree, then the L2$ has been loaded by +* someone else and not by ourself. +*/ + reg =of_get_property (np,"reg" ,NULL ); +if (reg) { + ret =of_address_to_resource (np,0 , &res); +if (ret) { +pr_err ("Address translation error\n" ); +return 0 ; + } +if ((res.end - res.start) >PAGE_SIZE ) { +pr_err ("L2 reg size > PAGE_SIZE\n" ); +return 0 ; + } + + l2_regs_addr = res.start; + }else { + l2_regs_addr = (phys_addr_t)
Quoted 1 line
__rm_firmware_regs_start;
Hi Yann !
Regarding the L2 cache support, since for the moment, only the QEMU support is available and that KVX QEMU emulates a coherent L2 cache, I think it would be preferable to remove this L2 cache driver for multiple reasons:
- The firmware is still proprietary-sourced (at least to my knowledge) and can not be obtained easily.
- L2 cache firmware needs to be linked with the kernel at compile time if not already loaded by the RM.
If the RM is now already loaded with the L2 cache firmware at linux boot time, then maybe this support can be kept but the "rm_firmware_regs" section support can then be removed.
Clément
Quoted 441 lines
arch/kvx/kernel/l2_cache.c new file +73
-0+ } + +if (!IS_ALIGNED (l2_regs_addr,PAGE_SIZE )) { +pr_err ("Registers not aligned on PAGE_SIZE\n" ); +return 0 ; + } + +return l2_regs_addr; +} + +static int __init l2_cache_init (void ) +{ +int ret = -ENODEV ; +struct device_node *np; +phys_addr_t l2_regs_addr; + + np =of_find_compatible_node (NULL ,NULL ,"kalray,kvx-l2-cache" ); +if (!np || !of_device_is_available (np)) { +if (!IS_ENABLED (CONFIG_SMP )) { +pr_info ("controller disabled\n" ); +return 0 ; + } + +if (np &&of_get_property (np,"kalray,is-qemu" ,NULL )) { +/* +* QEMU is always full cache coherent. The L2 cache controller is +* not strictly necessary to ensure coherency in SMP. +*/ +pr_info ("controller disabled (QEMU detected)\n" ); +return 0 ; + } + +/* Else, SMP is enabled and L2 is mandatory for it */ + goto err; + } + + l2_regs_addr =l2_get_regs_addr (np); +if (!l2_regs_addr) + goto err; + +/* Map the L2 registers */ + l2c_ctrl.regs =ioremap (l2_regs_addr,PAGE_SIZE ); +if (!l2c_ctrl.regs) + goto err; + +/* Lock this entry into the LTLB */ +kvx_mmu_ltlb_add_entry ((unsigned long ) l2c_ctrl.regs, l2_regs_addr, +PAGE_KERNEL_NOCACHE ,TLB_PS_4K ); + + ret =l2_cache_init_hw (); +if (ret) { +pr_err ("Failed to init L2 cache controller" ); + goto err_unmap_l2; + } + +static_branch_enable (&l2_enabled); + +pr_info ("controller enabled\n" ); + +return 0 ; + +err_unmap_l2: +kvx_mmu_ltlb_remove_entry ((unsigned long ) l2c_ctrl.regs); +iounmap (l2c_ctrl.regs); +err: +if (IS_ENABLED (CONFIG_SMP )) +panic ("L2$ controller is mandatory for SMP" ); + +return ret; +} + + +early_initcall (l2_cache_init);arch/kvx/kernel/smp.c new file +110
-0@@ -0,0 +1,110 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#include <linux/smp.h> +#include <linux/cpu.h> +#include <linux/of_irq.h> +#include <linux/cpumask.h> +#include <linux/irq_work.h> +#include <linux/mm_types.h> +#include <linux/interrupt.h> + +#include <asm/ipi.h> +#include <asm/tlbflush.h> + +enum ipi_message_type { +IPI_RESCHEDULE , +IPI_CALL_FUNC , +IPI_IRQ_WORK , +IPI_MAX +}; + +/* A collection of single bit ipi messages. */ +static struct { +unsigned long bits____cacheline_aligned ; +} ipi_data[NR_CPUS] __cacheline_aligned; + +static void send_ipi_message (const struct cpumask *mask, +enum ipi_message_type operation) +{ +unsigned long flags; +int cpu; + +/* Set operation that must be done by receiver */ +for_each_cpu (cpu, mask) +set_bit (operation, &ipi_data[cpu].bits); + +/* Commit the write before sending IPI */ +smp_wmb (); + +local_irq_save (flags); + +kvx_ipi_send (mask); + +local_irq_restore (flags); +} + +void arch_send_call_function_ipi_mask (struct cpumask *mask) +{ +send_ipi_message (mask,IPI_CALL_FUNC ); +} + +void arch_send_call_function_single_ipi (int cpu) +{ +send_ipi_message (cpumask_of (cpu),IPI_CALL_FUNC ); +} + +#ifdef CONFIG_IRQ_WORK +void arch_irq_work_raise (void ) +{ +send_ipi_message (cpumask_of (smp_processor_id ()),IPI_IRQ_WORK ); +} +#endif + +static void ipi_stop (void *unused) +{ +local_cpu_stop (); +} + +void smp_send_stop (void ) +{ +struct cpumask targets; + +cpumask_copy (&targets, cpu_online_mask); +cpumask_clear_cpu (smp_processor_id (), &targets); + +smp_call_function_many (&targets, ipi_stop,NULL ,0 ); +} + +void smp_send_reschedule (int cpu) +{ +send_ipi_message (cpumask_of (cpu),IPI_RESCHEDULE ); +} + +irqreturn_t ipi_call_interrupt (int irq,void *dev_id) +{ +unsigned long *pending_ipis = &ipi_data[smp_processor_id ()].bits; + +while (true) { +unsigned long ops =xchg (pending_ipis,0 ); + +if (ops ==0 ) +return IRQ_HANDLED ; + +if (ops & (1 <<IPI_RESCHEDULE )) +scheduler_ipi (); + +if (ops & (1 <<IPI_CALL_FUNC )) +generic_smp_call_function_interrupt (); + +if (ops & (1 <<IPI_IRQ_WORK )) +irq_work_run (); + +BUG_ON ((ops >>IPI_MAX ) !=0 ); + } + +return IRQ_HANDLED ; +}arch/kvx/kernel/smpboot.c new file +127
-0@@ -0,0 +1,127 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +* Julian Vetter +*/ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt + +#include <linux/io.h> +#include <linux/of.h> +#include <linux/smp.h> +#include <linux/cpu.h> +#include <linux/sched.h> +#include <linux/cpumask.h> +#include <linux/sched/mm.h> +#include <linux/mm_types.h> +#include <linux/of_platform.h> +#include <linux/sched/task_stack.h> + +#include <asm/pwr_ctrl.h> +#include <asm/tlbflush.h> +#include <asm/ipi.h> + +void *__cpu_up_stack_pointer[NR_CPUS ]; +void *__cpu_up_task_pointer[NR_CPUS ]; + +void __init smp_prepare_boot_cpu (void ) +{ +} + +int __cpu_up (unsigned int cpu,struct task_struct *tidle) +{ + __cpu_up_stack_pointer[cpu] =task_stack_page (tidle) +THREAD_SIZE ; + __cpu_up_task_pointer[cpu] = tidle; +/* We need to be sure writes are committed */ +smp_mb (); + +kvx_pwr_ctrl_cpu_poweron (cpu); +while (!cpu_online (cpu)) +cpu_relax (); + +return 0 ; +} + +void __init smp_cpus_done (unsigned int max_cpus) +{ +} + +void __init smp_init_cpus (void ) +{ +struct cpumask cpumask; +struct device_node *cpu; +const __be32 *reg; +u32 cpu_num; +unsigned int nr_cpus =0 ; + +cpumask_clear (&cpumask); + +for_each_of_cpu_node (cpu) { +if (!of_device_is_available (cpu)) +continue ; + + reg =of_get_property (cpu,"reg" ,NULL ); +if (!reg) +continue ; + + cpu_num =be32_to_cpup (reg); +if (cpu_num >= nr_cpu_ids) +continue ; + + nr_cpus++; +cpumask_set_cpu (cpu_num, &cpumask); + } + +pr_info ("%d possible cpus\n" , nr_cpus); +init_cpu_possible (&cpumask); +} + +void __init smp_prepare_cpus (unsigned int max_cpus) +{ +if (num_present_cpus () <=1 ) +init_cpu_present (cpu_possible_mask); +} + +int __init setup_smp (void ) +{ +int ret; + + ret =kvx_pwr_ctrl_probe (); +if (ret) +panic ("Failed to probe power controller !" ); + + ret =kvx_ipi_ctrl_probe (ipi_call_interrupt); +if (ret) +panic ("Failed to probe IPI controller !" ); + +return 0 ; +} + +early_initcall (setup_smp); + +/* +* C entry point for a secondary processor. +*/ +void __init start_kernel_secondary (void ) +{ +struct mm_struct *mm = &init_mm; +unsigned int cpu =smp_processor_id (); + +setup_processor (); +kvx_mmu_early_setup (); + +/* All kernel threads share the same mm context. */ +mmgrab (mm); + current->active_mm = mm; +cpumask_set_cpu (cpu,mm_cpumask (mm)); + +notify_cpu_starting (cpu); +set_cpu_online (cpu, true); +trace_hardirqs_off (); + +local_flush_tlb_all (); + +local_irq_enable (); +cpu_startup_entry (CPUHP_AP_ONLINE_IDLE ); +}arch/kvx/platform/pwr_ctrl.c new file +93
-0@@ -0,0 +1,93 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Clement Leger +*/ + +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt + +#include <linux/io.h> +#include <linux/slab.h> +#include <linux/types.h> +#include <linux/module.h> +#include <linux/of_address.h> +#include <linux/of_platform.h> + +#include <asm/pwr_ctrl.h> +#include <asm/symbols.h> + +struct kvx_pwr_ctrl { +void __iomem *regs; +}; + +static struct kvx_pwr_ctrl kvx_pwr_controller; + +/** +* kvx_pwr_ctrl_cpu_poweron() - Wakeup a cpu +* @cpu: cpu to wakeup +*/ +void kvx_pwr_ctrl_cpu_poweron (unsigned int cpu) +{ +/* Set PE boot address */ +writeq ((unsigned long long )kvx_start, + kvx_pwr_controller.regs +KVX_PWR_CTRL_RESET_PC_OFFSET ); +/* Wake up processor ! */ +writeq (1ULL << cpu, + kvx_pwr_controller.regs +PWR_CTRL_WUP_SET_OFFSET ); +/* Then clear wakeup to allow processor to sleep */ +writeq (1ULL << cpu, + kvx_pwr_controller.regs +PWR_CTRL_WUP_CLEAR_OFFSET ); +} + +static struct device_node *__init get_pwr_ctrl_node (void ) +{ +const phandle *ph; +struct device_node *cpu; +struct device_node *node; + + cpu =of_get_cpu_node (raw_smp_processor_id (),NULL ); +if (!cpu) { +pr_err ("Failed to get CPU node\n" ); +return NULL ; + } + + ph =of_get_property (cpu,"power-controller" ,NULL ); +if (!ph) { +pr_err ("Failed to get power-controller phandle\n" ); +return NULL ; + } + + node =of_find_node_by_phandle (be32_to_cpup (ph)); +if (!node) { +pr_err ("Failed to get power-controller node\n" ); +return NULL ; + } + +return node; +} + +int __init kvx_pwr_ctrl_probe (void ) +{ +struct device_node *ctrl; + + ctrl =get_pwr_ctrl_node (); +if (!ctrl) { +pr_err ("Failed to get power controller node\n" ); +return -EINVAL ; + } + +if (!of_device_is_compatible (ctrl,"kalray,kvx-pwr-ctrl" )) { +pr_err ("Failed to get power controller node\n" ); +return -EINVAL ; + } + + kvx_pwr_controller.regs =of_iomap (ctrl,0 ); +if (!kvx_pwr_controller.regs) { +pr_err ("Failed ioremap\n" ); +return -EINVAL ; + } + +pr_info ("kvx power controller probed\n" ); + +return 0 ; +}include/linux/cpuhotplug.h +2
-0@@ -152,6 +152,7 @@ enum cpuhp_state {CPUHP_AP_IRQ_RISCV_STARTING ,CPUHP_AP_IRQ_LOONGARCH_STARTING ,CPUHP_AP_IRQ_SIFIVE_PLIC_STARTING , +CPUHP_AP_IRQ_KVX_STARTING ,CPUHP_AP_ARM_MVEBU_COHERENCY ,CPUHP_AP_MICROCODE_LOADER , CPUHP_AP_PERF_X86_AMD_UNCORE_STARTING,@@ -189,6 +190,7 @@ enum cpuhp_state {CPUHP_AP_KVM_ARM_VGIC_INIT_STARTING ,CPUHP_AP_KVM_ARM_VGIC_STARTING ,CPUHP_AP_KVM_ARM_TIMER_STARTING , +CPUHP_AP_KVX_TIMER_STARTING ,/* Must be the last timer callback */ CPUHP_AP_DUMMY_TIMER_STARTING , CPUHP_AP_ARM_XEN_STARTING,
Signature · 3 lines
Clément Léger, Embedded Linux and Kernel engineer at Bootlin https://bootlin.com
RFC PATCH 18/25 kvx: Add kvx default config file
In reply to Yann SionneauAdd a default config file for kvx based Coolidge SoC.
--- arch/kvx/configs/default_defconfig | 130 +++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 arch/kvx/configs/default_defconfig
arch/kvx/configs/default_defconfig new file +130 -0
@@ -0,0 +1,130 @@ +CONFIG_DEFAULT_HOSTNAME="KVXlinux" +CONFIG_EMBEDDED=y +CONFIG_SERIAL_KVX_SCALL_COMM=y +CONFIG_CONFIGFS_FS=y +CONFIG_DEBUG_KERNEL=y +CONFIG_DEBUG_INFO=y +CONFIG_DEBUG_INFO_DWARF4=y +CONFIG_PRINTK_TIME=y +CONFIG_CONSOLE_LOGLEVEL_DEFAULT=15 +CONFIG_MESSAGE_LOGLEVEL_DEFAULT=7 +CONFIG_PANIC_TIMEOUT=-1 +CONFIG_BLK_DEV_INITRD=y +CONFIG_GDB_SCRIPTS=y +CONFIG_FRAME_POINTER=y +CONFIG_HZ_100=y +CONFIG_SERIAL_EARLYCON=y +CONFIG_HOTPLUG_PCI_PCIE=y +CONFIG_PCIEAER=y +CONFIG_PCIE_DPC=y +CONFIG_HOTPLUG_PCI=y +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_SERIAL_8250_DW=y +CONFIG_SERIAL_8250_NR_UARTS=8 +CONFIG_SERIAL_8250_RUNTIME_UARTS=8 +CONFIG_PINCTRL=y +CONFIG_PINCTRL_SINGLE=y +CONFIG_JUMP_LABEL=y +CONFIG_POWER_RESET_KVX_SCALL_POWEROFF=y +CONFIG_PCI=y +CONFIG_PCI_MSI=y +CONFIG_PCIE_KVX_NWL=y +CONFIG_PCIEPORTBUS=y +# CONFIG_PCIEASPM is not set +CONFIG_PCIEAER_INJECT=y +CONFIG_TMPFS=y +CONFIG_DMADEVICES=y +CONFIG_KVX_DMA_NOC=m +CONFIG_KVX_IOMMU=y +CONFIG_KVX_OTP_NV=y +CONFIG_PACKET=y +CONFIG_NET=y +# CONFIG_WLAN is not set +CONFIG_INET=y +CONFIG_IPV6=y +CONFIG_NETDEVICES=y +CONFIG_NET_CORE=y +CONFIG_E1000E=y +CONFIG_BLK_DEV_NVME=y +CONFIG_VFAT_FS=y +CONFIG_NLS_DEFAULT="iso8859-1" +CONFIG_NLS_CODEPAGE_437=y +CONFIG_NLS_ISO8859_1=y +CONFIG_WATCHDOG=y +CONFIG_KVX_WATCHDOG=y +CONFIG_HUGETLBFS=y +CONFIG_MAILBOX=y +CONFIG_KVX_MBOX=y +CONFIG_REMOTEPROC=y +CONFIG_KVX_REMOTEPROC=y +CONFIG_VIRTIO_NET=y +CONFIG_VIRTIO_MMIO=y +CONFIG_RPMSG_VIRTIO=y +CONFIG_RPMSG_CHAR=y +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y +CONFIG_MODVERSIONS=y +CONFIG_MODULE_SRCVERSION_ALL=y +CONFIG_BLK_DEV=y +CONFIG_BLK_DEV_LOOP=m +CONFIG_BLK_DEV_LOOP_MIN_COUNT=8 +CONFIG_EXT4_FS=m +CONFIG_EXT4_USE_FOR_EXT2=y +CONFIG_SYSVIPC=y +CONFIG_UNIX=y +CONFIG_NET_VENDOR_KALRAY=y +CONFIG_NET_KVX_SOC=m +CONFIG_STACKPROTECTOR=y +CONFIG_TRANSPARENT_HUGEPAGE=y +CONFIG_GPIO_DWAPB=y +CONFIG_I2C=y +CONFIG_I2C_SLAVE=y +CONFIG_I2C_CHARDEV=y +CONFIG_I2C_DESIGNWARE_PLATFORM=y +CONFIG_I2C_DESIGNWARE_CORE=y +CONFIG_I2C_DESIGNWARE_SLAVE=y +CONFIG_I2C_SLAVE_USPACE=y +CONFIG_POWER_RESET=y +CONFIG_POWER_RESET_SYSCON=y +CONFIG_SPI=y +CONFIG_SPI_DESIGNWARE=y +CONFIG_SPI_DW_MMIO=y +CONFIG_SPI_DW_KVX=y +CONFIG_MTD=y +CONFIG_MTD_SPI_NOR=y +# CONFIG_MTD_SPI_NOR_USE_4K_SECTORS is not set +CONFIG_SQUASHFS=m +CONFIG_USB=y +CONFIG_USB_CONFIGFS=m +CONFIG_USB_CONFIGFS_ACM=y +CONFIG_USB_CONFIGFS_ECM=y +CONFIG_USB_DWC2=y +CONFIG_USB_DWC2_DUAL_ROLE=y +CONFIG_USB_GADGET=y +CONFIG_U_SERIAL_CONSOLE=y +CONFIG_USB_USBNET=m +CONFIG_USB_NET_SMSC95XX=m +# CONFIG_NOP_USB_XCEIV is not set +CONFIG_USB_PHY=y +CONFIG_GENERIC_PHY=y +CONFIG_GENERIC_PHY_USB=y +CONFIG_MMC=y +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_PLTFM=y +CONFIG_MMC_SDHCI_OF_DWCMSHC=y +CONFIG_MDIO_BITBANG=m +CONFIG_MDIO_GPIO=m +CONFIG_MARVELL_PHY=m +CONFIG_GPIO_PCA953X=y +CONFIG_NETFILTER=y +CONFIG_NF_CONNTRACK=m +CONFIG_NF_NAT=m +CONFIG_IP_NF_IPTABLES=m +CONFIG_IP_NF_NAT=m +CONFIG_LEDS_GPIO=y +CONFIG_LEDS_CLASS=y +CONFIG_LEDS_TRIGGERS=y +CONFIG_LEDS_TRIGGER_NETDEV=y +CONFIG_LEDS_TRIGGER_PATTERN=y +CONFIG_DCB=y
Signature · 1 line
2.37.2
Re: [RFC PATCH 18/25] kvx: Add kvx default config file
Quoted 4 lines · Yann Sionneau
arch/kvx/configs/default_defconfig | 130 +++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 arch/kvx/configs/default_defconfig
Shouldn't it be arch/kvx/configs/defconfig to be consistent with other archs?
Signature · 1 line
An old man doll... just what I always wanted! - Clara
Re: [RFC PATCH 18/25] kvx: Add kvx default config file
Quoted 8 lines · Bagas Sanjaya
Quoted 4 lines · Yann Sionneau
arch/kvx/configs/default_defconfig | 130 +++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 arch/kvx/configs/default_defconfigShouldn't it be
arch/kvx/configs/defconfigto be consistent with other archs?
Yes, we are going to use defconfig instead of default_defconfig (which doesn't make much sens)
Thanks,
-- Jules
RFC PATCH 19/25 kvx: power: scall poweroff driver
In reply to Yann SionneauAdd a driver to poweroff the Coolidge SoC
when running under Qemu, ISS or when
the debugger (jtag-runner) runs on PL0
to catch the scall.
--- drivers/power/reset/kvx-scall-poweroff.c | 53 ++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 drivers/power/reset/kvx-scall-poweroff.c
drivers/power/reset/kvx-scall-poweroff.c new file +53 -0
@@ -0,0 +1,53 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Copyright (c) 2017 - 2022 Kalray Inc. +* Author(s): Clement Leger +*/ + +#include <linux/pm.h> +#include <linux/module.h> +#include <linux/of_device.h> +#include <linux/platform_device.h> + +#define SCALL_NUM_EXIT "0xfff" + +static void kvx_scall_poweroff (void ) +{ + register int status asm("r0") = 0; + + asmvolatile ("scall " SCALL_NUM_EXIT "\n\t;;" + :/* out */ + :"r" (status)); + +unreachable (); +} + +static int kvx_scall_poweroff_probe (struct platform_device *pdev) +{ + pm_power_off = kvx_scall_poweroff; + +return 0 ; +} + +static int kvx_scall_poweroff_remove (struct platform_device *pdev) +{ +if (pm_power_off == kvx_scall_poweroff) + pm_power_off =NULL ; + +return 0 ; +} + +static const struct of_device_id kvx_scall_poweroff_of_match[] = { + { .compatible ="kalray,kvx-scall-poweroff" }, + {} +}; + +static struct platform_driver kvx_scall_poweroff_driver = { + .probe = kvx_scall_poweroff_probe, + .remove = kvx_scall_poweroff_remove, + .driver = { + .name ="kvx-scall-poweroff" , + .of_match_table = kvx_scall_poweroff_of_match, + }, +}; +module_platform_driver (kvx_scall_poweroff_driver);
Signature · 1 line
2.37.2
Re: [RFC PATCH 19/25] kvx: power: scall poweroff driver
Hi,
Quoted 4 lines · Yann Sionneau
Add a driver to poweroff the Coolidge SoC
when running under Qemu, ISS or when
the debugger (jtag-runner) runs on PL0
to catch the scall.
line length of 41 characters is quite short.
Quoted 39 lines
CC Sebastian Reichel <[email protected]>Co-developed-by Clement Leger <[email protected]>Signed-off-by Clement Leger <[email protected]>Co-developed-by Julian Vetter <[email protected]>Signed-off-by Julian Vetter <[email protected]>Signed-off-by Yann Sionneau <[email protected]>--- drivers/power/reset/kvx-scall-poweroff.c | 53 ++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 drivers/power/reset/kvx-scall-poweroff.cdrivers/power/reset/kvx-scall-poweroff.c new file +20
-0@@ -0,0 +1,53 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Copyright (c) 2017 - 2022 Kalray Inc. +* Author(s): Clement Leger +*/ + +#include <linux/pm.h> +#include <linux/module.h> +#include <linux/of_device.h> +#include <linux/platform_device.h> + +#define SCALL_NUM_EXIT "0xfff" + +static void kvx_scall_poweroff (void ) +{ + register int status asm("r0") = 0; + + asmvolatile ("scall " SCALL_NUM_EXIT "\n\t;;" + :/* out */ + :"r" (status));
drivers/power/reset/kvx-scall-poweroff.c line 30
Quoted 10 lines
drivers/power/reset/kvx-scall-poweroff.c new file +10
-0+ +unreachable (); +} + +static int kvx_scall_poweroff_probe (struct platform_device *pdev) +{ + pm_power_off = kvx_scall_poweroff; + +return 0 ; +}
Please use devm_register_power_off_handler().
-- Sebastian
Quoted 29 lines
drivers/power/reset/kvx-scall-poweroff.c new file +22
-0+static int kvx_scall_poweroff_remove (struct platform_device *pdev) +{ +if (pm_power_off == kvx_scall_poweroff) + pm_power_off =NULL ; + +return 0 ; +} + +static const struct of_device_id kvx_scall_poweroff_of_match[] = { + { .compatible ="kalray,kvx-scall-poweroff" }, + {} +}; + +static struct platform_driver kvx_scall_poweroff_driver = { + .probe = kvx_scall_poweroff_probe, + .remove = kvx_scall_poweroff_remove, + .driver = { + .name ="kvx-scall-poweroff" , + .of_match_table = kvx_scall_poweroff_of_match, + }, +}; +module_platform_driver (kvx_scall_poweroff_driver);Signature · 1 line
2.37.2
RFC PATCH 20/25 kvx: gdb: add kvx related gdb helpers
In reply to Yann SionneauAdd kvx related gdb helpers:
* lx-kvx-tlb-access
* lx-kvx-tlb-decode
* lx-kvx-page-table-walk
* lx-kvx-virt-to-phys
--- scripts/gdb/arch/Makefile | 11 ++ scripts/gdb/arch/__init__.py | 1 + scripts/gdb/arch/kvx/Makefile | 25 +++ scripts/gdb/arch/kvx/__init__.py | 1 + scripts/gdb/arch/kvx/constants.py.in | 74 +++++++++ scripts/gdb/arch/kvx/mmu.py | 199 +++++++++++++++++++++++ scripts/gdb/arch/kvx/page_table_walk.py | 207 ++++++++++++++++++++++++ 7 files changed, 518 insertions(+) create mode 100644 scripts/gdb/arch/Makefile create mode 100644 scripts/gdb/arch/__init__.py create mode 100644 scripts/gdb/arch/kvx/Makefile create mode 100644 scripts/gdb/arch/kvx/__init__.py create mode 100644 scripts/gdb/arch/kvx/constants.py.in create mode 100644 scripts/gdb/arch/kvx/mmu.py create mode 100644 scripts/gdb/arch/kvx/page_table_walk.py
scripts/gdb/arch/Makefile new file +11 -0
@@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 +subdir-y := kvx + +always-y := gdb-scripts + +SRCTREE := $(abspath $(srctree)) + +$(obj)/gdb-scripts: +ifdef building_out_of_srctree + $(Q)ln -fsn $(SRCTREE)/$(obj)/*.py $(objtree)/$(obj) +endif
scripts/gdb/arch/__init__.py new file +1 -0
@@ -0,0 +1 @@ +# nothing to do for the initialization of this package
scripts/gdb/arch/kvx/Makefile new file +25 -0
@@ -0,0 +1,25 @@ +# SPDX-License-Identifier: GPL-2.0 + +ifdef building_out_of_srctree + +symlinks := $(patsubst $(srctree)/$(src)/%,%,$(wildcard $(srctree)/$(src)/*.py)) + +quiet_cmd_symlink = SYMLINK $@ + cmd_symlink = ln -fsn $(patsubst $(obj)/%,$(abspath $(srctree))/$(src)/%,$@) $@ + +extra-y += $(symlinks) +$(addprefix $(obj)/, $(symlinks)): FORCE + $(call if_changed,symlink) + +endif + +quiet_cmd_gen_constants_py = GEN $@ + cmd_gen_constants_py = \ + $(CPP) -E -x c -P $(c_flags) $< > $@ ;\ + sed -i '1,/<!-- end-c-headers -->/d;' $@ + +extra-y += constants.py +$(obj)/constants.py: $(src)/constants.py.in FORCE + $(call if_changed_dep,gen_constants_py) + +clean-files := *.pyc *.pyo
scripts/gdb/arch/kvx/__init__.py new file +1 -0
@@ -0,0 +1 @@ +# nothing to do for the initialization of this package
scripts/gdb/arch/kvx/constants.py.in new file +74 -0
74 lines not on this page · raw message
scripts/gdb/arch/kvx/mmu.py new file +199 -0
199 lines not on this page · raw message
scripts/gdb/arch/kvx/page_table_walk.py new file +207 -0
207 lines not on this page · raw message
Signature · 1 line
2.37.2
Jan Kiszka
maintainerRe: [RFC PATCH 20/25] kvx: gdb: add kvx related gdb helpers
Quoted 5 lines · Yann Sionneau
Add kvx related gdb helpers:
* lx-kvx-tlb-access
* lx-kvx-tlb-decode
* lx-kvx-page-table-walk
* lx-kvx-virt-to-phys
Dmitrii just proposed translate-vm [1], just x86-only so far. Would be good to use that scheme, maybe even watch out for chances to factor out arch-independent logic if there is any.
In general, it would be good to define helpers that can be implemented by other archs as well and stay away from "lx-<my-special-arch>-*" unless there is really something valuable to add that only makes sense for that arch.
Jan
[1]
https://lore.kernel.org/lkml/[email protected]/
Signature · 2 lines
Siemens AG, Technology Competence Center Embedded Linux
Re: [RFC PATCH 20/25] kvx: gdb: add kvx related gdb helpers
Quoted 1 line · Yann Sionneau
* lx-kvx-virt-to-phys
I think it might be a good idea to implement lx-kvx-virt-to-phys as the translate-vm command for the kvx arch. The details of the page walk used for translation of a particular address and page's attributes values might be useful for debugging purposes.
Quoted 1 line · Yann Sionneau
* lx-kvx-page-table-walk
It seems to be a good candidate to be implemented as an arch-independent command.
RFC PATCH 21/25 kvx: Add support for ftrace
In reply to Yann SionneauAdd support for ftrace to kvx arch.
--- arch/kvx/include/asm/ftrace.h | 41 ++++ arch/kvx/kernel/ftrace.c | 339 ++++++++++++++++++++++++++++++ arch/kvx/kernel/mcount.S | 340 +++++++++++++++++++++++++++++++ arch/kvx/kernel/return_address.c | 55 +++++ 4 files changed, 775 insertions(+) create mode 100644 arch/kvx/include/asm/ftrace.h create mode 100644 arch/kvx/kernel/ftrace.c create mode 100644 arch/kvx/kernel/mcount.S create mode 100644 arch/kvx/kernel/return_address.c
arch/kvx/include/asm/ftrace.h new file +41 -0
@@ -0,0 +1,41 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (C) 2017-2023 Kalray Inc. +* Author(s): Guillaume Thouvenin +* Clement Leger +*/ + +#ifndef _ASM_KVX_FTRACE_H +#define _ASM_KVX_FTRACE_H + +#include <asm/insns_defs.h> + +#define INSN_MAKE_IMM64_SYLLABLE_SIZE INSN_SIZE(MAKE_IMM64) +#define INSN_ICALL_SYLLABLE_SIZE INSN_SIZE(ICALL) +#define INSN_IGOTO_SYLLABLE_SIZE INSN_SIZE(IGOTO) +#define INSN_CALL_SYLLABLE_SIZE INSN_SIZE(CALL) +#define INSN_NOP_SYLLABLE_SIZE INSN_SIZE(NOP) + +#define INSN_ICALL_REG_MASK 0x3f + +#define MCOUNT_ADDR ((unsigned long)(__mcount)) +#define MCOUNT_INSN_SIZE INSN_CALL_SYLLABLE_SIZE/* sizeof mcount call */ + +extern void ftrace_graph_call (void ); + +#ifdef CONFIG_DYNAMIC_FTRACE +extern unsigned long ftrace_call_adjust (unsigned long addr); +struct dyn_arch_ftrace { +unsigned int insn; +}; +#endif + +extern void *return_address (unsigned int level); +#define ftrace_return_address (n) return_address(n) + +#ifdef CONFIG_FUNCTION_TRACER +extern void __mcount (void ); +#define mcount __mcount +#endif /* CONFIG_FUNCTION_TRACER */ + +#endif /* _ASM_KVX_FTRACE_H */
arch/kvx/kernel/ftrace.c new file +339 -0
339 lines not on this page · raw message
arch/kvx/kernel/mcount.S new file +340 -0
340 lines not on this page · raw message
arch/kvx/kernel/return_address.c new file +55 -0
55 lines not on this page · raw message
Signature · 1 line
2.37.2