Skip to content

Commit 42fe207

Browse files
authored
Merge pull request #333 from arceos-org/devhv2
feat: update driver-dyn feature configuration
2 parents 706491f + 7642636 commit 42fe207

File tree

7 files changed

+88
-65
lines changed

7 files changed

+88
-65
lines changed

Cargo.lock

Lines changed: 30 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ members = [
3333
]
3434

3535
[workspace.package]
36-
version = "0.2.2-hv.4"
36+
version = "0.2.2-hv.5"
3737
edition = "2024"
3838
authors = ["Yuekai Jia <equation618@gmail.com>"]
3939
license = "GPL-3.0-or-later OR Apache-2.0 OR MulanPSL-2.0"
@@ -44,28 +44,28 @@ keywords = ["arceos", "kernel"]
4444
categories = ["os", "no-std"]
4545

4646
[workspace.dependencies]
47-
axstd = { version = "=0.2.2-hv.4", path = "ulib/axstd" }
48-
axlibc = { version = "=0.2.2-hv.4", path = "ulib/axlibc" }
47+
axstd = { version = "=0.2.2-hv.5", path = "ulib/axstd" }
48+
axlibc = { version = "=0.2.2-hv.5", path = "ulib/axlibc" }
4949

50-
arceos_api = { version = "=0.2.2-hv.4", path = "api/arceos_api" }
51-
arceos_posix_api = { version = "=0.2.2-hv.4", path = "api/arceos_posix_api" }
52-
axfeat = { version = "=0.2.2-hv.4", path = "api/axfeat" }
50+
arceos_api = { version = "=0.2.2-hv.5", path = "api/arceos_api" }
51+
arceos_posix_api = { version = "=0.2.2-hv.5", path = "api/arceos_posix_api" }
52+
axfeat = { version = "=0.2.2-hv.5", path = "api/axfeat" }
5353

54-
axalloc = { version = "=0.2.2-hv.4", path = "modules/axalloc" }
55-
axconfig = { version = "=0.2.2-hv.4", path = "modules/axconfig" }
56-
axdisplay = { version = "=0.2.2-hv.4", path = "modules/axdisplay" }
57-
axdma = { version = "=0.2.2-hv.4", path = "modules/axdma" }
58-
axdriver = { version = "=0.2.2-hv.4", path = "modules/axdriver" }
59-
axfs = { version = "=0.2.2-hv.4", path = "modules/axfs" }
60-
axhal = { version = "=0.2.2-hv.4", path = "modules/axhal" }
61-
axinput = { version = "=0.2.2-hv.4", path = "modules/axinput" }
62-
axipi = { version = "=0.2.2-hv.4", path = "modules/axipi" }
54+
axalloc = { version = "=0.2.2-hv.5", path = "modules/axalloc" }
55+
axconfig = { version = "=0.2.2-hv.5", path = "modules/axconfig" }
56+
axdisplay = { version = "=0.2.2-hv.5", path = "modules/axdisplay" }
57+
axdma = { version = "=0.2.2-hv.5", path = "modules/axdma" }
58+
axdriver = { version = "=0.2.2-hv.5", path = "modules/axdriver" }
59+
axfs = { version = "=0.2.2-hv.5", path = "modules/axfs" }
60+
axhal = { version = "=0.2.2-hv.5", path = "modules/axhal" }
61+
axinput = { version = "=0.2.2-hv.5", path = "modules/axinput" }
62+
axipi = { version = "=0.2.2-hv.5", path = "modules/axipi" }
6363
axlog = { version = "=0.2.2-preview.1", path = "modules/axlog" }
64-
axmm = { version = "=0.2.2-hv.4", path = "modules/axmm" }
65-
axnet = { version = "=0.2.2-hv.4", path = "modules/axnet" }
66-
axruntime = { version = "=0.2.2-hv.4", path = "modules/axruntime" }
67-
axsync = { version = "=0.2.2-hv.4", path = "modules/axsync" }
68-
axtask = { version = "=0.2.2-hv.4", path = "modules/axtask" }
64+
axmm = { version = "=0.2.2-hv.5", path = "modules/axmm" }
65+
axnet = { version = "=0.2.2-hv.5", path = "modules/axnet" }
66+
axruntime = { version = "=0.2.2-hv.5", path = "modules/axruntime" }
67+
axsync = { version = "=0.2.2-hv.5", path = "modules/axsync" }
68+
axtask = { version = "=0.2.2-hv.5", path = "modules/axtask" }
6969

7070
axallocator = { version = "0.1.3-preview.1", features = [
7171
"axerrno",

modules/axfs/Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ version.workspace = true
1111
default = []
1212
monolitic = []
1313
fat = ["dep:fatfs"]
14-
# ext4 = ["dep:lwext4_rust"]
15-
# std = ["lwext4_rust?/std"]
14+
ext4 = ["dep:lwext4_rust"]
15+
std = ["lwext4_rust?/std"]
1616
times = []
1717
use-ramdisk = [] # TODO: init ramdisk
1818

@@ -54,10 +54,10 @@ features = [
5454
"unicode",
5555
]
5656

57-
# [dependencies.lwext4_rust]
58-
# version = "0.3.1-preview.1"
59-
# default-features = false
60-
# optional = true
57+
[dependencies.lwext4_rust]
58+
version = "0.3.1-preview.1"
59+
default-features = false
60+
optional = true
6161

6262
[dependencies.fatfs]
6363
version = "0.4.1-preview.2"

modules/axruntime/Cargo.toml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,16 @@ default = []
1515
alloc = ["axalloc"]
1616
hv = ["axalloc/hv"]
1717
dma = ["paging"]
18-
driver-dyn = ["driver-dyn-base", "driver-dyn-aarch64", "driver-dyn-x86_64", "axconfig/driver-dyn"]
19-
driver-dyn-base = ["axdriver/dyn", "paging"]
18+
driver-dyn = ["axdriver/dyn", "paging"]
2019
ipi = ["dep:axipi"]
2120
irq = ["axhal/irq", "axtask?/irq", "percpu"]
2221
paging = ["axhal/paging", "axmm"]
2322
smp = ["axhal/smp", "axtask?/smp"]
2423
tls = ["axhal/tls", "axtask?/tls"]
2524

26-
# Platform-specific driver-dyn features
27-
driver-dyn-aarch64 = ["dep:axplat-dyn", "dep:somehal"]
28-
driver-dyn-x86_64 = ["dep:axplat-x86-qemu-q35"]
25+
# Platform-specific features (optional, enable separately if needed)
26+
plat-hv-aarch64 = ["dep:axplat-dyn", "dep:somehal", "axconfig/driver-dyn"]
27+
plat-hv-x86_64 = ["dep:axplat-x86-qemu-q35", "axconfig/driver-dyn"]
2928

3029
display = ["axdriver", "axdisplay"]
3130
fs = ["axdriver", "axfs"]
@@ -64,8 +63,8 @@ chrono = {version = "0.4.38", default-features = false}
6463
indoc = "2"
6564

6665
[target.'cfg(target_arch = "x86_64")'.dependencies]
67-
axplat-x86-qemu-q35 = {version ="0.1.0-preview.1", default-features = false, features = ["reboot-on-system-off"], optional = true}
66+
axplat-x86-qemu-q35 = { version ="0.1.0-preview.1", default-features = false, features = ["reboot-on-system-off", "smp", "irq"], optional = true }
6867

6968
[target.'cfg(target_arch = "aarch64")'.dependencies]
7069
axplat-dyn = { version = "0.4", features = ["irq", "smp", "hv"], optional = true }
71-
somehal = { version = "0.4", optional = true }
70+
somehal = { version = "0.4", optional = true }

modules/axruntime/src/lang_items.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use core::panic::PanicInfo;
1616

1717
#[panic_handler]
1818
fn panic(info: &PanicInfo) -> ! {
19-
error!("{info}");
19+
ax_println!("{}", info);
20+
// ax_println!("{}", axbacktrace::Backtrace::capture());
2021
axhal::power::system_off()
2122
}

modules/axruntime/src/lib.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@
3636
#[macro_use]
3737
extern crate axlog;
3838

39-
#[cfg(all(target_arch = "x86_64", feature = "driver-dyn"))]
39+
#[cfg(all(target_arch = "x86_64", feature = "plat-hv-x86_64"))]
4040
extern crate axplat_x86_qemu_q35;
4141

42-
#[cfg(all(target_arch = "aarch64", feature = "driver-dyn"))]
42+
#[cfg(all(target_arch = "aarch64", feature = "plat-hv-aarch64"))]
4343
extern crate axplat_dyn;
4444

45-
#[cfg(all(target_arch = "aarch64", feature = "driver-dyn"))]
45+
#[cfg(all(target_arch = "aarch64", feature = "plat-hv-aarch64"))]
4646
extern crate somehal;
4747

4848
#[cfg(all(target_os = "none", not(test)))]
@@ -111,13 +111,13 @@ use core::sync::atomic::{AtomicUsize, Ordering};
111111

112112
static INITED_CPUS: AtomicUsize = AtomicUsize::new(0);
113113

114-
#[cfg(feature = "driver-dyn")]
114+
#[cfg(any(feature = "plat-hv-x86_64", feature = "plat-hv-aarch64"))]
115115
fn is_init_ok() -> bool {
116116
let cpu_num = cpu_count();
117117
INITED_CPUS.load(Ordering::Acquire) == cpu_num
118118
}
119119

120-
#[cfg(not(feature = "driver-dyn"))]
120+
#[cfg(not(any(feature = "plat-hv-x86_64", feature = "plat-hv-aarch64")))]
121121
fn is_init_ok() -> bool {
122122
let cpu_num = axconfig::plat::CPU_NUM;
123123
INITED_CPUS.load(Ordering::Acquire) == cpu_num
@@ -140,10 +140,10 @@ pub fn rust_main(cpu_id: usize, arg: usize) -> ! {
140140
axhal::init_early(cpu_id, arg);
141141

142142
ax_println!("{}", LOGO);
143-
#[cfg(feature = "driver-dyn")]
144-
ax_println!("smp = {}", cpu_count());
143+
#[cfg(any(feature = "plat-hv-x86_64", feature = "plat-hv-aarch64"))]
144+
ax_println!("smp = {}\n", cpu_count());
145145

146-
#[cfg(not(feature = "driver-dyn"))]
146+
#[cfg(not(any(feature = "plat-hv-x86_64", feature = "plat-hv-aarch64")))]
147147
ax_println!(
148148
indoc::indoc! {"
149149
arch = {}
@@ -365,7 +365,7 @@ fn init_tls() {
365365
core::mem::forget(main_tls);
366366
}
367367

368-
#[cfg(feature = "driver-dyn")]
368+
#[cfg(any(feature = "plat-hv-x86_64", feature = "plat-hv-aarch64"))]
369369
fn smp() -> Option<usize> {
370370
let mut smp = None;
371371
let s = option_env!("AXVISOR_SMP");
@@ -378,14 +378,14 @@ fn smp() -> Option<usize> {
378378
}
379379

380380
/// Returns the number of CPUs available on the system
381-
#[cfg(feature = "driver-dyn")]
381+
#[cfg(any(feature = "plat-hv-x86_64", feature = "plat-hv-aarch64"))]
382382
pub fn cpu_count() -> usize {
383383
let mut cpu_count;
384384

385385
cfg_if::cfg_if! {
386-
if #[cfg(all(target_arch = "x86_64", target_os = "none"))] {
386+
if #[cfg(all(target_arch = "x86_64", feature = "plat-hv-x86_64"))] {
387387
cpu_count = axplat_x86_qemu_q35::cpu_count()
388-
} else if #[cfg(target_arch = "aarch64")] {
388+
} else if #[cfg(all(target_arch = "aarch64", feature = "plat-hv-aarch64"))] {
389389
cpu_count = somehal::mem::cpu_id_list().count()
390390
} else {
391391
cpu_count = 1;

0 commit comments

Comments
 (0)