MIPS
Single-page view · as markdown
MIPS-specific Documentation
Peios Kernel / Hardware and drivers / Processor architectures / MIPS
BMIPS DeviceTree Booting
Peios Kernel / Hardware and drivers / Processor architectures / MIPS
Some bootloaders only support a single entry point, at the start of the kernel image. Other bootloaders will jump to the ELF start address. Both schemes are supported; CONFIG_BOOT_RAW=y and CONFIG_NO_EXCEPT_FILL=y, so the first instruction immediately jumps to kernel_entry().
Similar to the arch/arm case (b), a DT-aware bootloader is expected to set up the following registers:
a0 : 0
a1 : 0xffffffff
a2 : Physical pointer to the device tree block (defined in chapter II) in RAM. The device tree can be located anywhere in the first 512MB of the physical address space (0x00000000 - 0x1fffffff), aligned on a 64 bit boundary.
Legacy bootloaders do not use this convention, and they do not pass in a DT block. In this case, Linux will look for a builtin DTB, selected via CONFIG_DT_*.
This convention is defined for 32-bit systems only, as there are not currently any 64-bit BMIPS implementations.
Feature status on mips architecture
Peios Kernel / Hardware and drivers / Processor architectures / MIPS
| Subsystem | Feature | Kconfig | Status | Description |
|---|---|---|---|---|
| core | cBPF-JIT | HAVE_CBPF_JIT | ok | arch supports cBPF JIT optimizations |
| core | eBPF-JIT | HAVE_EBPF_JIT | ok | arch supports eBPF JIT optimizations |
| core | generic-idle-thread | GENERIC_SMP_IDLE_THREAD | ok | arch makes use of the generic SMP idle thread facility |
| core | jump-labels | HAVE_ARCH_JUMP_LABEL | ok | arch supports live patched, high efficiency branches |
| core | mseal-system-mappings | ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS | TODO | arch supports mseal system mappings |
| core | thread-info-in-task | THREAD_INFO_IN_TASK | TODO | arch makes use of the core kernel facility to embed thread_info in task_struct |
| core | tracehook | HAVE_ARCH_TRACEHOOK | ok | arch supports tracehook (ptrace) register handling APIs |
| debug | debug-vm-pgtable | ARCH_HAS_DEBUG_VM_PGTABLE | TODO | arch supports pgtable tests for semantics compliance |
| debug | gcov-profile-all | ARCH_HAS_GCOV_PROFILE_ALL | ok | arch supports whole-kernel GCOV code coverage profiling |
| debug | KASAN | HAVE_ARCH_KASAN | TODO | arch supports the KASAN runtime memory checker |
| debug | kcov | ARCH_HAS_KCOV | ok | arch supports kcov for coverage-guided fuzzing |
| debug | kgdb | HAVE_ARCH_KGDB | ok | arch supports the kGDB kernel debugger |
| debug | kmemleak | HAVE_DEBUG_KMEMLEAK | ok | arch supports the kernel memory leak detector |
| debug | kprobes | HAVE_KPROBES | ok | arch supports live patched kernel probe |
| debug | kprobes-on-ftrace | HAVE_KPROBES_ON_FTRACE | TODO | arch supports combined kprobes and ftrace live patching |
| debug | kretprobes | HAVE_KRETPROBES | ok | arch supports kernel function-return probes |
| debug | optprobes | HAVE_OPTPROBES | TODO | arch supports live patched optprobes |
| debug | stackprotector | HAVE_STACKPROTECTOR | ok | arch supports compiler driven stack overflow protection |
| debug | uprobes | ARCH_SUPPORTS_UPROBES | ok | arch supports live patched user probes |
| debug | user-ret-profiler | HAVE_USER_RETURN_NOTIFIER | TODO | arch supports user-space return from system call profiler |
| io | dma-contiguous | HAVE_DMA_CONTIGUOUS | ok | arch supports the DMA CMA (continuous memory allocator) |
| locking | cmpxchg-local | HAVE_CMPXCHG_LOCAL | TODO | arch supports the this_cpu_cmpxchg() API |
| locking | lockdep | LOCKDEP_SUPPORT | ok | arch supports the runtime locking correctness debug facility |
| locking | queued-rwlocks | ARCH_USE_QUEUED_RWLOCKS | ok | arch supports queued rwlocks |
| locking | queued-spinlocks | ARCH_USE_QUEUED_SPINLOCKS | ok | arch supports queued spinlocks |
| perf | kprobes-event | HAVE_REGS_AND_STACK_ACCESS_API | ok | arch supports kprobes with perf events |
| perf | perf-regs | HAVE_PERF_REGS | ok | arch supports perf events register access |
| perf | perf-stackdump | HAVE_PERF_USER_STACK_DUMP | ok | arch supports perf events stack dumps |
| sched | membarrier-sync-core | ARCH_HAS_MEMBARRIER_SYNC_CORE | TODO | arch supports core serializing membarrier |
| sched | numa-balancing | ARCH_SUPPORTS_NUMA_BALANCING | TODO | arch supports NUMA balancing |
| seccomp | seccomp-filter | HAVE_ARCH_SECCOMP_FILTER | ok | arch supports seccomp filters |
| time | arch-tick-broadcast | ARCH_HAS_TICK_BROADCAST | ok | arch provides tick_broadcast() |
| time | clockevents | !LEGACY_TIMER_TICK | ok | arch support generic clock events |
| time | irq-time-acct | HAVE_IRQ_TIME_ACCOUNTING | ok | arch supports precise IRQ time accounting |
| time | user-context-tracking | HAVE_CONTEXT_TRACKING_USER | ok | arch supports user context tracking for NO_HZ_FULL |
| time | virt-cpuacct | HAVE_VIRT_CPU_ACCOUNTING | ok | arch supports precise virtual CPU time accounting |
| vm | batch-unmap-tlb-flush | ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH | TODO | arch supports deferral of TLB flush until multiple pages are unmapped |
| vm | ELF-ASLR | ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT | ok | arch randomizes the stack, heap and binary images of ELF binaries |
| vm | huge-vmap | HAVE_ARCH_HUGE_VMAP | TODO | arch supports the arch_vmap_pud_supported() and arch_vmap_pmd_supported() VM APIs |
| vm | ioremap_prot | HAVE_IOREMAP_PROT | ok | arch has ioremap_prot() |
| vm | pte_special | ARCH_HAS_PTE_SPECIAL | ok | arch supports the pte_special()/pte_mkspecial() VM APIs |
| vm | THP | HAVE_ARCH_TRANSPARENT_HUGEPAGE | ok | arch supports transparent hugepages |
Ingenic JZ47xx SoCs Timer/Counter Unit hardware
Peios Kernel / Hardware and drivers / Processor architectures / MIPS
The Timer/Counter Unit (TCU) in Ingenic JZ47xx SoCs is a multi-function hardware block. It features up to eight channels, that can be used as counters, timers, or PWM.
-
JZ4725B, JZ4750, JZ4755 only have six TCU channels. The other SoCs all have eight channels.
-
JZ4725B introduced a separate channel, called Operating System Timer (OST). It is a 32-bit programmable timer. On JZ4760B and above, it is 64-bit.
-
Each one of the TCU channels has its own clock, which can be reparented to three different clocks (pclk, ext, rtc), gated, and reclocked, through their TCSR register.
-
The watchdog and OST hardware blocks also feature a TCSR register with the same format in their register space.
-
The TCU registers used to gate/ungate can also gate/ungate the watchdog and OST clocks.
-
-
Each TCU channel works in one of two modes:
-
mode TCU1: channels cannot work in sleep mode, but are easier to operate.
-
mode TCU2: channels can work in sleep mode, but the operation is a bit more complicated than with TCU1 channels.
-
-
The mode of each TCU channel depends on the SoC used:
-
On the oldest SoCs (up to JZ4740), all of the eight channels operate in TCU1 mode.
-
On JZ4725B, channel 5 operates as TCU2, the others operate as TCU1.
-
On newest SoCs (JZ4750 and above), channels 1-2 operate as TCU2, the others operate as TCU1.
-
-
Each channel can generate an interrupt. Some channels share an interrupt line, some don't, and this changes between SoC versions:
-
on older SoCs (JZ4740 and below), channel 0 and channel 1 have their own interrupt line; channels 2-7 share the last interrupt line.
-
On JZ4725B, channel 0 has its own interrupt; channels 1-5 share one interrupt line; the OST uses the last interrupt line.
-
on newer SoCs (JZ4750 and above), channel 5 has its own interrupt; channels 0-4 and (if eight channels) 6-7 all share one interrupt line; the OST uses the last interrupt line.
-
Implementation #
The functionalities of the TCU hardware are spread across multiple drivers:
|
clocks |
drivers/clk/ingenic/tcu.c |
|
interrupts |
drivers/irqchip/irq-ingenic-tcu.c |
|
timers |
drivers/clocksource/ingenic-timer.c |
|
OST |
drivers/clocksource/ingenic-ost.c |
|
PWM |
drivers/pwm/pwm-jz4740.c |
|
watchdog |
drivers/watchdog/jz4740_wdt.c |
Because various functionalities of the TCU that belong to different drivers and frameworks can be controlled from the same registers, all of these drivers access their registers through the same regmap.
For more information regarding the devicetree bindings of the TCU drivers, have a look at Documentation/devicetree/bindings/timer/ingenic,tcu.yaml.