Skip to content

Commit fa96b57

Browse files
committed
LoongArch: Add build infrastructure
Add Kbuild, Makefile, Kconfig and link script for LoongArch build infrastructure. Reviewed-by: Guo Ren <[email protected]> Reviewed-by: WANG Xuerui <[email protected]> Reviewed-by: Jiaxun Yang <[email protected]> Signed-off-by: Huacai Chen <[email protected]>
1 parent 439057e commit fa96b57

File tree

17 files changed

+701
-1
lines changed

17 files changed

+701
-1
lines changed

arch/loongarch/Kbuild

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
obj-y += kernel/
2+
obj-y += mm/
3+
obj-y += vdso/
4+
5+
# for cleaning
6+
subdir- += boot

arch/loongarch/Kconfig

Lines changed: 379 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,379 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
config LOONGARCH
3+
bool
4+
default y
5+
select ACPI_SYSTEM_POWER_STATES_SUPPORT if ACPI
6+
select ARCH_BINFMT_ELF_STATE
7+
select ARCH_ENABLE_MEMORY_HOTPLUG
8+
select ARCH_ENABLE_MEMORY_HOTREMOVE
9+
select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI
10+
select ARCH_HAS_PTE_SPECIAL
11+
select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
12+
select ARCH_INLINE_READ_LOCK if !PREEMPTION
13+
select ARCH_INLINE_READ_LOCK_BH if !PREEMPTION
14+
select ARCH_INLINE_READ_LOCK_IRQ if !PREEMPTION
15+
select ARCH_INLINE_READ_LOCK_IRQSAVE if !PREEMPTION
16+
select ARCH_INLINE_READ_UNLOCK if !PREEMPTION
17+
select ARCH_INLINE_READ_UNLOCK_BH if !PREEMPTION
18+
select ARCH_INLINE_READ_UNLOCK_IRQ if !PREEMPTION
19+
select ARCH_INLINE_READ_UNLOCK_IRQRESTORE if !PREEMPTION
20+
select ARCH_INLINE_WRITE_LOCK if !PREEMPTION
21+
select ARCH_INLINE_WRITE_LOCK_BH if !PREEMPTION
22+
select ARCH_INLINE_WRITE_LOCK_IRQ if !PREEMPTION
23+
select ARCH_INLINE_WRITE_LOCK_IRQSAVE if !PREEMPTION
24+
select ARCH_INLINE_WRITE_UNLOCK if !PREEMPTION
25+
select ARCH_INLINE_WRITE_UNLOCK_BH if !PREEMPTION
26+
select ARCH_INLINE_WRITE_UNLOCK_IRQ if !PREEMPTION
27+
select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE if !PREEMPTION
28+
select ARCH_INLINE_SPIN_TRYLOCK if !PREEMPTION
29+
select ARCH_INLINE_SPIN_TRYLOCK_BH if !PREEMPTION
30+
select ARCH_INLINE_SPIN_LOCK if !PREEMPTION
31+
select ARCH_INLINE_SPIN_LOCK_BH if !PREEMPTION
32+
select ARCH_INLINE_SPIN_LOCK_IRQ if !PREEMPTION
33+
select ARCH_INLINE_SPIN_LOCK_IRQSAVE if !PREEMPTION
34+
select ARCH_INLINE_SPIN_UNLOCK if !PREEMPTION
35+
select ARCH_INLINE_SPIN_UNLOCK_BH if !PREEMPTION
36+
select ARCH_INLINE_SPIN_UNLOCK_IRQ if !PREEMPTION
37+
select ARCH_INLINE_SPIN_UNLOCK_IRQRESTORE if !PREEMPTION
38+
select ARCH_MIGHT_HAVE_PC_PARPORT
39+
select ARCH_MIGHT_HAVE_PC_SERIO
40+
select ARCH_SPARSEMEM_ENABLE
41+
select ARCH_SUPPORTS_ACPI
42+
select ARCH_SUPPORTS_ATOMIC_RMW
43+
select ARCH_SUPPORTS_HUGETLBFS
44+
select ARCH_USE_BUILTIN_BSWAP
45+
select ARCH_USE_CMPXCHG_LOCKREF
46+
select ARCH_USE_QUEUED_RWLOCKS
47+
select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
48+
select ARCH_WANTS_NO_INSTR
49+
select BUILDTIME_TABLE_SORT
50+
select COMMON_CLK
51+
select GENERIC_CLOCKEVENTS
52+
select GENERIC_CMOS_UPDATE
53+
select GENERIC_CPU_AUTOPROBE
54+
select GENERIC_ENTRY
55+
select GENERIC_FIND_FIRST_BIT
56+
select GENERIC_GETTIMEOFDAY
57+
select GENERIC_IRQ_MULTI_HANDLER
58+
select GENERIC_IRQ_PROBE
59+
select GENERIC_IRQ_SHOW
60+
select GENERIC_LIB_ASHLDI3
61+
select GENERIC_LIB_ASHRDI3
62+
select GENERIC_LIB_CMPDI2
63+
select GENERIC_LIB_LSHRDI3
64+
select GENERIC_LIB_UCMPDI2
65+
select GENERIC_PCI_IOMAP
66+
select GENERIC_SCHED_CLOCK
67+
select GENERIC_TIME_VSYSCALL
68+
select GPIOLIB
69+
select HAVE_ARCH_AUDITSYSCALL
70+
select HAVE_ARCH_COMPILER_H
71+
select HAVE_ARCH_MMAP_RND_BITS if MMU
72+
select HAVE_ARCH_SECCOMP_FILTER
73+
select HAVE_ARCH_TRACEHOOK
74+
select HAVE_ARCH_TRANSPARENT_HUGEPAGE
75+
select HAVE_ASM_MODVERSIONS
76+
select HAVE_CONTEXT_TRACKING
77+
select HAVE_COPY_THREAD_TLS
78+
select HAVE_DEBUG_STACKOVERFLOW
79+
select HAVE_DMA_CONTIGUOUS
80+
select HAVE_EXIT_THREAD
81+
select HAVE_FAST_GUP
82+
select HAVE_GENERIC_VDSO
83+
select HAVE_IOREMAP_PROT
84+
select HAVE_IRQ_EXIT_ON_IRQ_STACK
85+
select HAVE_IRQ_TIME_ACCOUNTING
86+
select HAVE_MEMBLOCK
87+
select HAVE_MEMBLOCK_NODE_MAP
88+
select HAVE_MOD_ARCH_SPECIFIC
89+
select HAVE_NMI
90+
select HAVE_PERF_EVENTS
91+
select HAVE_REGS_AND_STACK_ACCESS_API
92+
select HAVE_RSEQ
93+
select HAVE_SYSCALL_TRACEPOINTS
94+
select HAVE_TIF_NOHZ
95+
select HAVE_VIRT_CPU_ACCOUNTING_GEN
96+
select IRQ_FORCED_THREADING
97+
select IRQ_LOONGARCH_CPU
98+
select MODULES_USE_ELF_RELA if MODULES
99+
select OF
100+
select OF_EARLY_FLATTREE
101+
select PERF_USE_VMALLOC
102+
select RTC_LIB
103+
select SPARSE_IRQ
104+
select SYSCTL_EXCEPTION_TRACE
105+
select SWIOTLB
106+
select TRACE_IRQFLAGS_SUPPORT
107+
select ZONE_DMA32
108+
109+
config 32BIT
110+
bool
111+
112+
config 64BIT
113+
def_bool y
114+
115+
config CPU_HAS_FPU
116+
bool
117+
default y
118+
119+
config CPU_HAS_PREFETCH
120+
bool
121+
default y
122+
123+
config GENERIC_CALIBRATE_DELAY
124+
def_bool y
125+
126+
config GENERIC_CSUM
127+
def_bool y
128+
129+
config GENERIC_HWEIGHT
130+
def_bool y
131+
132+
config L1_CACHE_SHIFT
133+
int
134+
default "6"
135+
136+
config LOCKDEP_SUPPORT
137+
bool
138+
default y
139+
140+
# MACH_LOONGSON32 and MACH_LOONGSON64 are delibrately carried over from the
141+
# MIPS Loongson code, to preserve Loongson-specific code paths in drivers that
142+
# are shared between architectures, and specifically expecting the symbols.
143+
config MACH_LOONGSON32
144+
def_bool 32BIT
145+
146+
config MACH_LOONGSON64
147+
def_bool 64BIT
148+
149+
config PAGE_SIZE_4KB
150+
bool
151+
152+
config PAGE_SIZE_16KB
153+
bool
154+
155+
config PAGE_SIZE_64KB
156+
bool
157+
158+
config PGTABLE_2LEVEL
159+
bool
160+
161+
config PGTABLE_3LEVEL
162+
bool
163+
164+
config PGTABLE_4LEVEL
165+
bool
166+
167+
config PGTABLE_LEVELS
168+
int
169+
default 2 if PGTABLE_2LEVEL
170+
default 3 if PGTABLE_3LEVEL
171+
default 4 if PGTABLE_4LEVEL
172+
173+
config SCHED_OMIT_FRAME_POINTER
174+
bool
175+
default y
176+
177+
menu "Kernel type and options"
178+
179+
source "kernel/Kconfig.hz"
180+
181+
choice
182+
prompt "Page Table Layout"
183+
default 16KB_2LEVEL if 32BIT
184+
default 16KB_3LEVEL if 64BIT
185+
help
186+
Allows choosing the page table layout, which is a combination
187+
of page size and page table levels. The size of virtual memory
188+
address space are determined by the page table layout.
189+
190+
config 4KB_3LEVEL
191+
bool "4KB with 3 levels"
192+
select PAGE_SIZE_4KB
193+
select PGTABLE_3LEVEL
194+
help
195+
This option selects 4KB page size with 3 level page tables, which
196+
support a maximum of 39 bits of application virtual memory.
197+
198+
config 4KB_4LEVEL
199+
bool "4KB with 4 levels"
200+
select PAGE_SIZE_4KB
201+
select PGTABLE_4LEVEL
202+
help
203+
This option selects 4KB page size with 4 level page tables, which
204+
support a maximum of 48 bits of application virtual memory.
205+
206+
config 16KB_2LEVEL
207+
bool "16KB with 2 levels"
208+
select PAGE_SIZE_16KB
209+
select PGTABLE_2LEVEL
210+
help
211+
This option selects 16KB page size with 2 level page tables, which
212+
support a maximum of 36 bits of application virtual memory.
213+
214+
config 16KB_3LEVEL
215+
bool "16KB with 3 levels"
216+
select PAGE_SIZE_16KB
217+
select PGTABLE_3LEVEL
218+
help
219+
This option selects 16KB page size with 3 level page tables, which
220+
support a maximum of 47 bits of application virtual memory.
221+
222+
config 64KB_2LEVEL
223+
bool "64KB with 2 levels"
224+
select PAGE_SIZE_64KB
225+
select PGTABLE_2LEVEL
226+
help
227+
This option selects 64KB page size with 2 level page tables, which
228+
support a maximum of 42 bits of application virtual memory.
229+
230+
config 64KB_3LEVEL
231+
bool "64KB with 3 levels"
232+
select PAGE_SIZE_64KB
233+
select PGTABLE_3LEVEL
234+
help
235+
This option selects 64KB page size with 3 level page tables, which
236+
support a maximum of 55 bits of application virtual memory.
237+
238+
endchoice
239+
240+
config CMDLINE
241+
string "Built-in kernel command line"
242+
help
243+
For most platforms, the arguments for the kernel's command line
244+
are provided at run-time, during boot. However, there are cases
245+
where either no arguments are being provided or the provided
246+
arguments are insufficient or even invalid.
247+
248+
When that occurs, it is possible to define a built-in command
249+
line here and choose how the kernel should use it later on.
250+
251+
choice
252+
prompt "Kernel command line type"
253+
default CMDLINE_BOOTLOADER
254+
help
255+
Choose how the kernel will handle the provided built-in command
256+
line.
257+
258+
config CMDLINE_BOOTLOADER
259+
bool "Use bootloader kernel arguments if available"
260+
help
261+
Prefer the command-line passed by the boot loader if available.
262+
Use the built-in command line as fallback in case we get nothing
263+
during boot. This is the default behaviour.
264+
265+
config CMDLINE_EXTEND
266+
bool "Use built-in to extend bootloader kernel arguments"
267+
help
268+
The command-line arguments provided during boot will be
269+
appended to the built-in command line. This is useful in
270+
cases where the provided arguments are insufficient and
271+
you don't want to or cannot modify them.
272+
273+
config CMDLINE_FORCE
274+
bool "Always use the built-in kernel command string"
275+
help
276+
Always use the built-in command line, even if we get one during
277+
boot. This is useful in case you need to override the provided
278+
command line on systems where you don't have or want control
279+
over it.
280+
281+
endchoice
282+
283+
config DMI
284+
bool "Enable DMI scanning"
285+
select DMI_SCAN_MACHINE_NON_EFI_FALLBACK
286+
default y
287+
help
288+
This enables SMBIOS/DMI feature for systems, and scanning of
289+
DMI to identify machine quirks.
290+
291+
config EFI
292+
bool "EFI runtime service support"
293+
select UCS2_STRING
294+
select EFI_PARAMS_FROM_FDT
295+
select EFI_RUNTIME_WRAPPERS
296+
help
297+
This enables the kernel to use EFI runtime services that are
298+
available (such as the EFI variable services).
299+
300+
config FORCE_MAX_ZONEORDER
301+
int "Maximum zone order"
302+
range 14 64 if PAGE_SIZE_64KB
303+
default "14" if PAGE_SIZE_64KB
304+
range 12 64 if PAGE_SIZE_16KB
305+
default "12" if PAGE_SIZE_16KB
306+
range 11 64
307+
default "11"
308+
help
309+
The kernel memory allocator divides physically contiguous memory
310+
blocks into "zones", where each zone is a power of two number of
311+
pages. This option selects the largest power of two that the kernel
312+
keeps in the memory allocator. If you need to allocate very large
313+
blocks of physically contiguous memory, then you may need to
314+
increase this value.
315+
316+
This config option is actually maximum order plus one. For example,
317+
a value of 11 means that the largest free memory block is 2^10 pages.
318+
319+
The page size is not necessarily 4KB. Keep this in mind
320+
when choosing a value for this option.
321+
322+
config SECCOMP
323+
bool "Enable seccomp to safely compute untrusted bytecode"
324+
depends on PROC_FS
325+
default y
326+
help
327+
This kernel feature is useful for number crunching applications
328+
that may need to compute untrusted bytecode during their
329+
execution. By using pipes or other transports made available to
330+
the process as file descriptors supporting the read/write
331+
syscalls, it's possible to isolate those applications in
332+
their own address space using seccomp. Once seccomp is
333+
enabled via /proc/<pid>/seccomp, it cannot be disabled
334+
and the task is only allowed to execute a few safe syscalls
335+
defined by each seccomp mode.
336+
337+
If unsure, say Y. Only embedded should say N here.
338+
339+
endmenu
340+
341+
config ARCH_SELECT_MEMORY_MODEL
342+
def_bool y
343+
344+
config ARCH_FLATMEM_ENABLE
345+
def_bool y
346+
347+
config ARCH_SPARSEMEM_ENABLE
348+
def_bool y
349+
help
350+
Say Y to support efficient handling of sparse physical memory,
351+
for architectures which are either NUMA (Non-Uniform Memory Access)
352+
or have huge holes in the physical address space for other reasons.
353+
See <file:Documentation/vm/numa.rst> for more.
354+
355+
config ARCH_ENABLE_THP_MIGRATION
356+
def_bool y
357+
depends on TRANSPARENT_HUGEPAGE
358+
359+
config ARCH_MEMORY_PROBE
360+
def_bool y
361+
depends on MEMORY_HOTPLUG
362+
363+
config MMU
364+
bool
365+
default y
366+
367+
config ARCH_MMAP_RND_BITS_MIN
368+
default 12
369+
370+
config ARCH_MMAP_RND_BITS_MAX
371+
default 18
372+
373+
menu "Power management options"
374+
375+
source "drivers/acpi/Kconfig"
376+
377+
endmenu
378+
379+
source "drivers/firmware/Kconfig"

arch/loongarch/Kconfig.debug

Whitespace-only changes.

0 commit comments

Comments
 (0)