Skip to content

Commit be49a9f

Browse files
committed
try to switch aarch64-qemu-virt to xconfig
Signed-off-by: Weikang Guo <guoweikang@kylinos.cn>
1 parent b550b4a commit be49a9f

21 files changed

Lines changed: 690 additions & 100 deletions

File tree

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
# Cargo lock
2222
Cargo.lock
2323

24-
# kernel config
24+
# Kconfig build artifacts
2525
.config
2626
.config.old
2727
auto.conf
2828
autoconf.h
29-
target/kbuild/config.rs
29+
target/kbuild/
3030
.cargo/config.toml

Kconfig

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,28 +100,30 @@ endmenu
100100

101101
menu "Kernel Features"
102102

103-
config FEAT_SMP
103+
config SMP
104104
bool "Symmetric Multiprocessing (SMP)"
105105
default y
106106

107-
config FEAT_FP_SIMD
107+
config FP_SIMD
108108
bool "Floating Point and SIMD"
109109
default y
110110

111-
config FEAT_NET
111+
config NET
112112
bool "Network Stack"
113113
default y
114114

115-
config FEAT_FS
115+
config FS
116116
bool "File System Support"
117117
default y
118118

119-
config FEAT_ALLOC
119+
config ALLOC
120120
bool "Dynamic Memory Allocation"
121121
default y
122122

123-
config FEAT_IRQ
123+
config IRQ
124124
bool "Interrupt Support"
125125
default y
126126

127127
endmenu
128+
129+
source "drivers/Kconfig"

arch/kcpu/src/aarch64/instrs.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,4 +209,5 @@ unsafe extern "C" {
209209
}
210210

211211
/// Alias for compatibility with other architectures
212+
#[cfg(feature = "uspace")]
212213
pub use raw_copy_from_user as user_copy;

drivers/Kconfig

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
menu "Drivers Basic Configuration"
2+
3+
config RTC
4+
bool "RTC Support"
5+
default y
6+
help
7+
Enable support for Real Time Clock (RTC) devices.
8+
9+
10+
if RTC
11+
12+
menu "RTC Configuration"
13+
14+
config PLATFORM_RTC_PADDR
15+
hex "RTC physical address"
16+
default 0x09010000
17+
help
18+
Physical address of the RTC device.
19+
20+
endmenu
21+
22+
endif
23+
24+
endmenu
25+

entry/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ unittest = { workspace = true, optional = true }
122122
[dependencies.aarch64-qemu-virt]
123123
workspace = true
124124
optional = true
125-
features = ["fp-simd", "smp", "rtc"]
126125

127126
[dependencies.x86_64-qemu-virt]
128127
workspace = true

platforms/Kconfig

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -145,20 +145,4 @@ config PLATFORM_GICC_PADDR
145145

146146
endmenu
147147

148-
menu "RTC Configuration"
149-
150-
config PLATFORM_RTC_PL031
151-
bool "PL031 RTC"
152-
default y
153-
help
154-
Enable PL031 Real-Time Clock support.
155-
156-
config PLATFORM_RTC_PADDR
157-
hex "RTC physical address"
158-
default 0x09010000
159-
depends on PLATFORM_RTC_PL031
160-
help
161-
Physical address of the PL031 RTC device.
162-
163-
endmenu
164148

platforms/aarch64-qemu-virt/Cargo.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ homepage.workspace = true
99
repository.workspace = true
1010

1111
[features]
12-
fp-simd = ["kcpu/fp-simd"]
13-
rtc = []
14-
smp = ["kplat/smp"]
12+
FP_SIMD = ["kcpu/fp-simd"]
13+
SMP = ["kplat/smp"]
1514
nmi = ["aarch64-peripherals/nmi-pmu", "kplat/nmi", "pmu"]
1615
pmu = ["kplat/pmu"]
1716

@@ -25,3 +24,6 @@ kbuild_config = { workspace = true }
2524

2625
[package.metadata.docs.rs]
2726
targets = ["aarch64-unknown-none"]
27+
28+
[package.metadata.kbuild]
29+
enabled = true
Lines changed: 40 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,46 @@
1-
ARCH_AARCH64=y
1+
#
2+
# Automatically generated file; DO NOT EDIT.
3+
# Rust Kbuild Configuration
4+
#
5+
PLATFORM_KERNEL_BASE_PADDR=0x40200000
6+
PLATFORM_PMU_IRQ=23
7+
PLATFORM_GICD_PADDR=0x8000000
8+
PLATFORM_GICC_PADDR=0x8010000
9+
# PLATFORM_LOONGARCH64_QEMU_VIRT is not set
10+
PLATFORM_DMA_MEM_SIZE=0x200000
11+
# PLATFORM_PSCI_SMC is not set
12+
# PLATFORM_RISCV64_QEMU_VIRT is not set
13+
FS=y
14+
ALLOC=y
15+
# ARCH_X86_64 is not set
16+
PLATFORM_IPI_IRQ=1
17+
PLATFORM_TIMER_IRQ=30
18+
IRQ=y
19+
# ARCH_LOONGARCH64 is not set
20+
# ARCH_RISCV64 is not set
221
PLATFORM_AARCH64_QEMU_VIRT=y
3-
4-
# Platform Basic Configuration
5-
PLATFORM_PHYS_MEMORY_BASE=0x40000000
622
PLATFORM_KERNEL_ASPACE_BASE=0xffff000000000000
7-
PLATFORM_PHYS_MEMORY_SIZE=0x8000000
8-
PLATFORM_CPU_NUM=4
23+
# BUILD_TYPE_DEBUG is not set
24+
PLATFORM_PSCI_HVC=y
25+
# PLATFORM_X86_64_QEMU_VIRT is not set
26+
PLATFORM_PHYS_BUS_OFFSET=0x0
27+
PLATFORM_PHYS_VIRT_OFFSET=0xffff000000000000
28+
PLATFORM_UART_IRQ=33
29+
PLATFORM_UART_PADDR=0x9000000
930
PLATFORM_KERNEL_BASE_VADDR=0xffff000040200000
31+
SMP=y
32+
BUILD_TYPE_RELEASE=y
1033
PLATFORM_KERNEL_ASPACE_SIZE=0x0000fffffffff000
11-
PLATFORM_PHYS_BUS_OFFSET=0
12-
PLATFORM_KERNEL_BASE_PADDR=0x40200000
34+
PLATFORM_CPU_NUM=4
35+
FP_SIMD=y
36+
NET=y
37+
PLATFORM_PHYS_MEM_BASE=0x40000000
38+
# PLATFORM_AARCH64_RASPI is not set
39+
# PLATFORM_AARCH64_CROSVM_VIRT is not set
40+
PLATFORM_RTC_PADDR=0x9010000
41+
RTC=y
1342
PLATFORM_BOOT_STACK_SIZE=0x40000
14-
PLATFORM_PHYS_VIRT_OFFSET=0xffff000000000000
15-
16-
# Platform DMA and Power Management
17-
PLATFORM_PSCI_HVC=y
18-
PLATFORM_DMA_MEM_SIZE=0x200000
43+
# PLATFORM_X86_CSV is not set
1944
PLATFORM_DMA_MEM_BASE=0x40000000
20-
21-
# Platform Devices
22-
PLATFORM_UART_PADDR=0x9000000
23-
PLATFORM_UART_IRQ=33
24-
PLATFORM_IPI_IRQ=1
25-
PLATFORM_TIMER_IRQ=30
26-
PLATFORM_PMU_IRQ=23
27-
28-
# GIC Configuration
29-
PLATFORM_GICD_PADDR=0x8000000
30-
PLATFORM_GICC_PADDR=0x8010000
31-
32-
# RTC Configuration
33-
PLATFORM_RTC_PL031=y
34-
PLATFORM_RTC_PADDR=0x9010000
35-
36-
# PCI Configuration
37-
PLATFORM_PCI_ECAM_BASE=0x4010000000
38-
PLATFORM_PCI_BUS_END=255
45+
ARCH_AARCH64=y
46+
PLATFORM_PHYS_MEM_SIZE=0x8000000

platforms/aarch64-qemu-virt/platconfig.toml

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ phys-memory-size = 0x800_0000 # uint
1919
kernel-base-paddr = 0x4020_0000 # uint
2020
# Base virtual address of the kernel image.
2121
kernel-base-vaddr = "0xffff_0000_4020_0000" # uint
22-
# Linear mapping offset, for quick conversions between physical and virtual
23-
# addresses.
24-
phys-virt-offset = "0xffff_0000_0000_0000" # uint
2522
# Offset of bus address and phys address. some boards, the bus address is
2623
# different from the physical address.
2724
phys-bus-offset = 0 # uint
@@ -35,22 +32,12 @@ boot-stack-size = 0x40000 # uint
3532
dma-mem-base = 0x40000000 # uint
3633
# DMA memory size.
3734
dma-mem-size = 0x200_000 # uint
38-
# PSCI
39-
psci-method = "hvc" # str
4035

4136
#
4237
# Device specifications
4338
#
4439
[devices]
4540
# MMIO ranges with format (`base_paddr`, `size`).
46-
mmio-ranges = [
47-
[0x0900_0000, 0x1000], # PL011 UART
48-
[0x0910_0000, 0x1000], # PL031 RTC
49-
[0x0800_0000, 0x2_0000], # GICv2
50-
[0x0a00_0000, 0x4000], # VirtIO
51-
[0x1000_0000, 0x2eff_0000], # PCI memory ranges (ranges 1: 32-bit MMIO space)
52-
[0x40_1000_0000, 0x1000_0000], # PCI config space
53-
] # [(uint, uint)]
5441
# VirtIO MMIO ranges with format (`base_paddr`, `size`).
5542
virtio-mmio-ranges = [
5643
[0x0a00_0000, 0x200],
@@ -96,21 +83,6 @@ pci-ranges = [
9683
[0x1000_0000, 0x2eff_0000], # 32-bit MMIO space
9784
[0x80_0000_0000, 0x80_0000_0000], # 64-bit MMIO space
9885
] # [(uint, uint)]
99-
# UART Address
100-
uart-paddr = 0x0900_0000 # uint
101-
# UART IRQ number (SPI, 1)
102-
uart-irq = 33 # uint
103-
# Timer interrupt num (PPI, physical timer).
104-
timer-irq = 30 # uint
105-
# IPI interrupt num
106-
ipi-irq = 1 # uint
107-
# PMU interrupt num
108-
pmu-irq = 23 # uint
109-
110-
# GIC CPU Interface base address
111-
gicc-paddr = 0x0801_0000 # uint
112-
# GIC Distributor base address
113-
gicd-paddr = 0x0800_0000 # uint
11486

11587
# pl031@9010000 {
11688
# clock-names = "apb_pclk";

platforms/aarch64-qemu-virt/src/boot.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ unsafe fn init_boot_page_table() {
3232
}
3333
}
3434
unsafe fn enable_fp() {
35-
#[cfg(feature = "fp-simd")]
35+
#[cfg(FP_SIMD)]
3636
kcpu::instrs::enable_fp();
3737
}
3838
#[unsafe(naked)]
@@ -89,7 +89,7 @@ unsafe extern "C" fn _start_primary() -> ! {
8989
entry = sym kplat::entry,
9090
)
9191
}
92-
#[cfg(feature = "smp")]
92+
#[cfg(SMP)]
9393
#[unsafe(naked)]
9494
pub(crate) unsafe extern "C" fn _start_secondary() -> ! {
9595
core::arch::naked_asm!("

0 commit comments

Comments
 (0)