Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
7be4000
create arch/x86_64 and pass compilation
Solicey Dec 4, 2024
90f14cf
init UART, handle traps, enable APIC timer, BSP wakes up AP
Solicey Dec 19, 2024
65fb931
enable VMX, configure VMCS, test with temporary guest code
Solicey Jan 2, 2025
f64bad8
enable EPT
Solicey Jan 20, 2025
743bfed
enable UART and APIC timer virtualization, test with temporary guest OS
Solicey Jan 24, 2025
92d6c63
hacking to the linux shell
Solicey Feb 27, 2025
d2bdba5
enable vPIC, fix vUART output delay
Solicey Mar 10, 2025
476dbb6
enable SMP on guest linux
Solicey Mar 18, 2025
f51428c
enable MMIO and I/O APIC, simplify Local APIC, passthrough UART
Solicey Mar 23, 2025
2b9625a
enable PCI devices, activate vt-d DMA remapping
Solicey Apr 3, 2025
fba3bf8
Merge branch 'dev' into dev-x86_64
Solicey Apr 4, 2025
4e4ee63
implement pci device probing, activate pci virtualization
Solicey Apr 6, 2025
fd05a71
update guest bootloader
Solicey Apr 9, 2025
916dfec
Merge branch 'dev' into dev-x86_64
Solicey Apr 9, 2025
d64e284
hacking to non-root linux
Solicey Apr 11, 2025
b0734f9
enable msi vector remap, modify cpu idle, enable zone shutdown
Solicey Apr 15, 2025
97449c6
Merge branch 'dev' into dev-x86_64
Solicey Apr 16, 2025
69bc963
launch virtio console on non-root linux
Solicey Apr 19, 2025
1d009b2
support virtio blk, virtio net
Solicey Apr 26, 2025
f3e7576
tiny fixes
Solicey May 24, 2025
4834442
x86 add platform NUC 14
Solicey Jul 9, 2025
daea7e6
Merge branch 'dev' into dev-x86_64
Solicey Jul 23, 2025
0fee5c8
x86 NUC14 hacking to root Linux shell
Solicey Jul 26, 2025
fe7fc08
x86 remove vector remapping, run rootfs on sda
Solicey Jul 27, 2025
bd7acc2
x86 NUC14 run root linux on SMP
Solicey Jul 27, 2025
bc1bc9e
x86 NUC14 run non-root, enable virtio blk, console, net
Solicey Aug 15, 2025
ac33403
Merge branch 'dev' into dev-x86_64
Solicey Aug 20, 2025
2fce4a6
rename nuc14 to nuc14mnk
Solicey Aug 24, 2025
47666c2
fix makefile diff
Solicey Aug 24, 2025
02aa5de
fix bug zone1 cannot restart
Solicey Sep 16, 2025
ac41fa0
Merge branch 'dev' into dev-x86_64
Solicey Sep 19, 2025
4b5b208
bug fix: add invalidation queue to x86 iommu, so that zone1 can use P…
Solicey Oct 18, 2025
fcc2254
Merge branch 'dev' into dev-x86_64
Solicey Oct 18, 2025
fb042ec
x86_64 add license headers
Solicey Oct 18, 2025
3e3ef7b
add feature uart16550a, modify logging implement
Solicey Oct 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
/images/*
/platform/*/*/image/kernel/*
/platform/*/*/image/virtdisk/*
/platform/*/*/image/bootloader/out
/platform/*/*/image/iso/boot/kernel/*
/platform/*/*/image/iso/boot/hvisor
/tools/hvisor
/tmp
*.mod.[co]
Expand Down
58 changes: 35 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 9 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ heapless = { version = "0.8.0 "}

[target.'cfg(target_arch = "aarch64")'.dependencies]
aarch64-cpu = "9.4.0"
psci = { version = "0.1.0", default-features = false, features = ["smc"]}
psci = { version = "0.1.0", default-features = false, features = ["smc"] }

[target.'cfg(target_arch = "riscv64")'.dependencies]
sbi-rt = { version = "0.0.3", features = ["legacy"] }
Expand All @@ -38,10 +38,11 @@ riscv-pac = "0.2.0"
loongArch64 = "0.2.5"

[target.'cfg(target_arch = "x86_64")'.dependencies]
x86 = "0.52.0"
x86 = "=0.52.0"
x86_64 = "=0.14.10"
x2apic = "0.4.3"
raw-cpuid = "10.7.0"
x2apic = "=0.4.3"
raw-cpuid = "=10.7.0"
acpi = "=5.2.0"

[features]
############# general ##############
Expand All @@ -60,6 +61,7 @@ imx_uart = []
uart_16550 = []
sifive_ccache = []
eic7700_sysreg = []
uart16550a = []

############## riscv64 #############
# irqchip driver
Expand All @@ -80,6 +82,9 @@ loongson_uart = []
loongson_3a5000 = []
loongson_3a6000 = []

############# x86_64 ###############
graphics = []


[profile.dev]
# panic = "abort" # avoid cargo test failure, this is a bug of cargo
Expand Down
168 changes: 168 additions & 0 deletions platform/x86_64/nuc14mnk/board.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
// Copyright (c) 2025 Syswonder
// hvisor is licensed under Mulan PSL v2.
// You can use this software according to the terms and conditions of the Mulan PSL v2.
// You may obtain a copy of Mulan PSL v2 at:
// http://license.coscl.org.cn/MulanPSL2
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR
// FIT FOR A PARTICULAR PURPOSE.
// See the Mulan PSL v2 for more details.
//
// Syswonder Website:
// https://www.syswonder.org
//
// Authors:
//
use crate::{arch::zone::HvArchZoneConfig, config::*, memory::GuestPhysAddr};

pub const MEM_TYPE_RESERVED: u32 = 5;

pub const BOARD_NCPUS: usize = 4;

pub const ROOT_ZONE_DTB_ADDR: u64 = 0x00000000;
pub const ROOT_ZONE_BOOT_STACK: GuestPhysAddr = 0x7000;
pub const ROOT_ZONE_ENTRY: u64 = 0x8000;
pub const ROOT_ZONE_KERNEL_ADDR: u64 = 0x500_0000; // hpa
pub const ROOT_ZONE_CPUS: u64 = (1 << 0) | (1 << 1);

const ROOT_ZONE_RSDP_REGION: HvConfigMemoryRegion = HvConfigMemoryRegion {
mem_type: MEM_TYPE_RAM,
physical_start: 0x50e_0000,
virtual_start: 0xe_0000,
size: 0x2_0000,
};

const ROOT_ZONE_ACPI_REGION: HvConfigMemoryRegion = HvConfigMemoryRegion {
mem_type: MEM_TYPE_RAM,
physical_start: 0x3a30_0000, // hpa
virtual_start: 0x3530_0000, // gpa
size: 0x10_0000, // modify size accordingly
};

pub const ROOT_ZONE_NAME: &str = "root-linux";
pub const ROOT_ZONE_CMDLINE: &str = "video=vesafb console=tty0 nointremap no_timer_check pci=pcie_scan_all root=/dev/sda2 rw init=/init rootwait\0";
// pub const ROOT_ZONE_CMDLINE: &str = "video=vesafb console=ttyS0 earlyprintk=serial nointremap no_timer_check pci=pcie_scan_all root=/dev/vda rw init=/init\0";
//"console=ttyS0 earlyprintk=serial rdinit=/init nokaslr nointremap\0"; // noapic
// video=vesafb

pub const ROOT_ZONE_MEMORY_REGIONS: [HvConfigMemoryRegion; 14] = [
HvConfigMemoryRegion {
mem_type: MEM_TYPE_RAM,
physical_start: 0x500_0000,
virtual_start: 0x0,
size: 0xe_0000,
}, // ram
ROOT_ZONE_RSDP_REGION, // rsdp
HvConfigMemoryRegion {
mem_type: MEM_TYPE_RAM,
physical_start: 0x510_0000,
virtual_start: 0x10_0000,
size: 0x14f0_0000,
}, // ram
HvConfigMemoryRegion {
mem_type: MEM_TYPE_RAM,
physical_start: 0x1a00_0000,
virtual_start: 0x1500_0000,
size: 0x30_0000,
}, // ram
HvConfigMemoryRegion {
mem_type: MEM_TYPE_RAM,
physical_start: 0x1a30_0000,
virtual_start: 0x1530_0000,
size: 0x2000_0000,
}, // ram
ROOT_ZONE_ACPI_REGION, // acpi
HvConfigMemoryRegion {
mem_type: MEM_TYPE_IO,
physical_start: 0xfed0_0000,
virtual_start: 0xfed0_0000,
size: 0x1000,
}, // hpet
// TODO: e820 mem space probe
HvConfigMemoryRegion {
mem_type: MEM_TYPE_RESERVED,
physical_start: 0x1_0000_0000,
virtual_start: 0x1_0000_0000,
size: 0x2000_0000,
}, // zone 1
HvConfigMemoryRegion {
mem_type: MEM_TYPE_RESERVED,
physical_start: 0x6ed7_f000,
virtual_start: 0x6ed7_f000,
size: 0x10_e000,
}, // ACPI non-volatile storage
HvConfigMemoryRegion {
mem_type: MEM_TYPE_RESERVED,
physical_start: 0xfeda_0000,
virtual_start: 0xfeda_0000,
size: 0x2_8000,
}, // pnp 00:05
HvConfigMemoryRegion {
mem_type: MEM_TYPE_RESERVED,
physical_start: 0xfe01_1000,
virtual_start: 0xfe01_1000,
size: 0x40_0000,
}, // reserved
HvConfigMemoryRegion {
mem_type: MEM_TYPE_RESERVED,
physical_start: 0x677a_b000,
virtual_start: 0x677a_b000,
size: 0x74d_3000,
}, // reserved
HvConfigMemoryRegion {
mem_type: MEM_TYPE_RESERVED,
physical_start: 0xfd69_0000,
virtual_start: 0xfd69_0000,
size: 0x6_0000,
}, // INTC1057:00
HvConfigMemoryRegion {
mem_type: MEM_TYPE_RESERVED,
physical_start: 0xfb00_0000,
virtual_start: 0xfb00_0000,
size: 0x100_0000,
}, // reserved
];

const ROOT_ZONE_CMDLINE_ADDR: GuestPhysAddr = 0x9000;
const ROOT_ZONE_SETUP_ADDR: GuestPhysAddr = 0xa000;
const ROOT_ZONE_VMLINUX_ENTRY_ADDR: GuestPhysAddr = 0x10_0000;
const ROOT_ZONE_SCREEN_BASE_ADDR: GuestPhysAddr = 0x8000_0000;

pub const ROOT_ZONE_IRQS: [u32; 32] = [0; 32];
pub const ROOT_ZONE_IOAPIC_BASE: usize = 0xfec0_0000;
pub const ROOT_ARCH_ZONE_CONFIG: HvArchZoneConfig = HvArchZoneConfig {
ioapic_base: ROOT_ZONE_IOAPIC_BASE,
ioapic_size: 0x1000,
kernel_entry_gpa: ROOT_ZONE_VMLINUX_ENTRY_ADDR,
cmdline_load_gpa: ROOT_ZONE_CMDLINE_ADDR,
setup_load_gpa: ROOT_ZONE_SETUP_ADDR,
initrd_load_gpa: 0, // 0x1500_0000,
initrd_size: 0, // 0x26_b000,
rsdp_memory_region_id: 0x1,
acpi_memory_region_id: 0x5,
// not longer than 32 bits
screen_base: ROOT_ZONE_SCREEN_BASE_ADDR,
};

pub const ROOT_PCI_CONFIG: HvPciConfig = HvPciConfig {
ecam_base: 0xc0000000,
ecam_size: 0x300000,
io_base: 0x0,
io_size: 0x0,
pci_io_base: 0x0,
mem32_base: 0x0,
mem32_size: 0x0,
pci_mem32_base: 0x0,
mem64_base: 0x0,
mem64_size: 0x0,
pci_mem64_base: 0x0,
};

pub const ROOT_PCI_DEVS: [u64; 19] = [
0x0, 0x10, 0x20, 0x40, 0x50, 0x68, 0x90, 0xa0, 0xa2, 0xa3, 0xb0, 0xe0, 0xe8, 0xf8, 0xfb, 0xfc,
0xfd, 0x100, 0x200,
];

#[cfg(all(feature = "graphics"))]
pub const GRAPHICS_FONT: &[u8] =
include_bytes!("../../platform/x86_64/qemu/image/font/spleen-6x12.psf");
10 changes: 10 additions & 0 deletions platform/x86_64/nuc14mnk/cargo/config.template.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[target.x86_64-unknown-none]
linker = "rust-lld"
rustflags = [
"-Clink-arg=-Tplatform/__ARCH__/__BOARD__/linker.ld",
"-Clink-arg=-no-pie",
"-Clinker-flavor=ld.lld",
"-Cforce-frame-pointers=yes",
"-Ctarget-feature=-mmx,-sse,+soft-float",
"-Cno-redzone=yes",
]
2 changes: 2 additions & 0 deletions platform/x86_64/nuc14mnk/cargo/features
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pci
uart16550a
Loading