Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 12 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,31 @@ raw-cpuid = "10.7.0"
############# general ##############
iommu = [] # supported by: aarch64
pci = [] # supported by: aarch64
no_autodetect_ncpus = []

############# aarch64 ##############
# irqchip driver
gicv2 = []
gicv3 = []

# uart driver
pl011 = []
xuartps = []
imx_uart = []
uart_16550 = []

# pagetable layout
pt_layout_qemu = []
pt_layout_rk3568 = []
# cpu
a55 = []
a53 = []
pt_layout_rk3588 = []

# cpu
mpidr_rockchip = []

# uart infos
rk3568_uart_base = []
uart_base_rk3568 = []
uart_base_rk3588 = []

############## riscv64 #############
# irqchip driver
plic = []
Expand All @@ -85,4 +93,3 @@ loongson_uart = []
[profile.dev]
# panic = "abort" # avoid cargo test failure, this is a bug of cargo
debug = 2
# panic = "abort"
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@ elf:

disa:
readelf -a $(hvisor_elf) > hvisor-elf.txt
# rust-objdump --disassemble $(hvisor_elf) > hvisor.S
rust-objdump --disassemble --source $(hvisor_elf) > hvisor.S
rust-objdump --disassemble --source --line-numbers $(hvisor_elf) > hvisor.S

run: all
$(QEMU) $(QEMU_ARGS)
Expand Down
2 changes: 2 additions & 0 deletions platform/aarch64/imx8mp/board.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ use crate::{arch::zone::HvArchZoneConfig, config::*};

pub const BOARD_NAME: &str = "imx8mp";

pub const BOARD_NCPUS: usize = 4;

pub const ROOT_ZONE_DTB_ADDR: u64 = 0xa0000000;
pub const ROOT_ZONE_KERNEL_ADDR: u64 = 0xa0400000;
pub const ROOT_ZONE_ENTRY: u64 = 0xa0400000;
Expand Down
1 change: 0 additions & 1 deletion platform/aarch64/imx8mp/cargo/features
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
gicv3
imx_uart
a53
2 changes: 2 additions & 0 deletions platform/aarch64/qemu-gicv2/board.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ use crate::{arch::zone::HvArchZoneConfig, config::*};

pub const BOARD_NAME: &str = "qemu-gicv2";

pub const BOARD_NCPUS: usize = 4;

pub const ROOT_ZONE_DTB_ADDR: u64 = 0xa0000000;
pub const ROOT_ZONE_KERNEL_ADDR: u64 = 0xa0400000;
pub const ROOT_ZONE_ENTRY: u64 = 0xa0400000;
Expand Down
3 changes: 1 addition & 2 deletions platform/aarch64/qemu-gicv2/cargo/features
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ gicv2
pl011
iommu
pci
pt_layout_qemu
a53
pt_layout_qemu
4 changes: 3 additions & 1 deletion platform/aarch64/qemu-gicv3/board.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
//
use crate::{arch::zone::HvArchZoneConfig, config::*};

pub const BOARD_NAME: &str = "qemu-givc3";
pub const BOARD_NAME: &str = "qemu-gicv3";

pub const BOARD_NCPUS: usize = 4;

pub const ROOT_ZONE_DTB_ADDR: u64 = 0xa0000000;
pub const ROOT_ZONE_KERNEL_ADDR: u64 = 0xa0400000;
Expand Down
3 changes: 1 addition & 2 deletions platform/aarch64/qemu-gicv3/cargo/features
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ gicv3
pl011
iommu
pci
pt_layout_qemu
a53
pt_layout_qemu
2 changes: 2 additions & 0 deletions platform/aarch64/rk3568/board.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ use crate::{arch::zone::HvArchZoneConfig, config::*};

pub const BOARD_NAME: &str = "rk3568";

pub const BOARD_NCPUS: usize = 4;

pub const ROOT_ZONE_DTB_ADDR: u64 = 0xa0000000;
pub const ROOT_ZONE_KERNEL_ADDR: u64 = 0x60080000 ;
pub const ROOT_ZONE_ENTRY: u64 = 0x60080000 ;
Expand Down
4 changes: 2 additions & 2 deletions platform/aarch64/rk3568/cargo/features
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
gicv3
uart_16550
uart_base_rk3568
pt_layout_rk3568
rk3568_uart_base
a55
mpidr_rockchip
180 changes: 180 additions & 0 deletions platform/aarch64/rk3588/board.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
// 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::*};

// [ 17.796762] node 0: [mem 0x0000000000200000-0x000000000047ffff]
// [ 17.797335] node 0: [mem 0x0000000000480000-0x000000000087ffff]
// [ 17.797907] node 0: [mem 0x0000000000880000-0x00000000083fffff]
// [ 17.798479] node 0: [mem 0x0000000009400000-0x00000000efffffff]
// [ 17.799053] node 0: [mem 0x0000000100000000-0x00000003fbffffff]
// [ 17.799628] node 0: [mem 0x00000003fc500000-0x00000003ffefffff]
// [ 17.800200] node 0: [mem 0x00000004f0000000-0x00000004ffffffff]

pub const BOARD_NAME: &str = "rk3588";

pub const BOARD_NCPUS: usize = 8;

pub const ROOT_ZONE_DTB_ADDR: u64 = 0x10000000;
pub const ROOT_ZONE_KERNEL_ADDR: u64 = 0x09400000;
pub const ROOT_ZONE_ENTRY: u64 = 0x09400000;
pub const ROOT_ZONE_CPUS: u64 = (1 << 0) | (1 << 1);

pub const ROOT_ZONE_NAME: &str = "root-linux";

pub const ROOT_ZONE_MEMORY_REGIONS: [HvConfigMemoryRegion; 9] = [
HvConfigMemoryRegion {
mem_type: MEM_TYPE_RAM,
physical_start: 0x100000,
virtual_start: 0x100000,
size: 0xf0000,
},
HvConfigMemoryRegion {
mem_type: MEM_TYPE_RAM,
physical_start: 0x200000,
virtual_start: 0x200000,
size: 0x8200000,
},
HvConfigMemoryRegion {
mem_type: MEM_TYPE_RAM,
physical_start: 0x9400000,
virtual_start: 0x9400000,
size: 0xe6c00000,
},
HvConfigMemoryRegion {
mem_type: MEM_TYPE_RAM,
physical_start: 0x100000000,
virtual_start: 0x100000000,
size: 0x2fc000000,
},
HvConfigMemoryRegion {
mem_type: MEM_TYPE_RAM,
physical_start: 0x3fc500000,
virtual_start: 0x3fc500000,
size: 0x3a00000,
},
HvConfigMemoryRegion {
mem_type: MEM_TYPE_RAM,
physical_start: 0x4f0000000,
virtual_start: 0x4f0000000,
size: 0x10000000,
},
HvConfigMemoryRegion {
mem_type: MEM_TYPE_IO,
physical_start: 0xfc000000,
virtual_start: 0xfc000000,
size: 0x2000000,
},
HvConfigMemoryRegion {
mem_type: MEM_TYPE_IO,
physical_start: 0xfe800000,
virtual_start: 0xfe800000,
size: 0x800000,
},
HvConfigMemoryRegion {
mem_type: MEM_TYPE_IO,
physical_start: 0xfe000000,
virtual_start: 0xfe000000,
size: 0x600000,
},
// HvConfigMemoryRegion {
// mem_type: MEM_TYPE_RAM,
// physical_start: 0x0000000000200000,
// virtual_start: 0x0000000000200000,
// size: 0x00000000083fffff - 0x0000000000200000 + 1,
// }, // ram
// HvConfigMemoryRegion {
// mem_type: MEM_TYPE_RAM,
// physical_start: 0x0000000009400000,
// virtual_start: 0x0000000009400000,
// size: 0x00000000efffffff - 0x0000000009400000 + 1,
// }, // ram
// HvConfigMemoryRegion {
// mem_type: MEM_TYPE_RAM,
// physical_start: 0x0000000100000000,
// virtual_start: 0x0000000100000000,
// size: 0x00000003fbffffff - 0x0000000100000000 + 1,
// }, // ram
// HvConfigMemoryRegion {
// mem_type: MEM_TYPE_RAM,
// physical_start: 0x00000003fc500000,
// virtual_start: 0x00000003fc500000,
// size: 0x00000003ffefffff - 0x00000003fc500000 + 1,
// }, // ram
// HvConfigMemoryRegion {
// mem_type: MEM_TYPE_RAM,
// physical_start: 0x00000004f0000000,
// virtual_start: 0x00000004f0000000,
// size: 0x00000004ffffffff - 0x00000004f0000000 + 1,
// }, // ram
// HvConfigMemoryRegion {
// mem_type: MEM_TYPE_IO,
// physical_start: 0xfeb50000,
// virtual_start: 0xfeb50000,
// size: 0x100,
// }, // uart
// HvConfigMemoryRegion {
// mem_type: MEM_TYPE_IO,
// physical_start: 0xfd000000,
// virtual_start: 0xfd000000,
// size: 0x1000000,
// },
// HvConfigMemoryRegion {
// mem_type: MEM_TYPE_IO,
// physical_start: 0x100000,
// virtual_start: 0x100000,
// size: 0x100000,
// }
];

// pub const ROOT_ZONE_IRQS: [u32; 10] = [39, 64, 235, 237, 309, 312, 360, 365, 429, 455];
pub const ROOT_ZONE_IRQS: [u32; 29] = [
39, 41, 42, 43, 45, 46, 64, 120, 121, 235, 237, 247, 248, 250, 251, 252, 265, 266, 309, 312,
313, 355, 360, 365, 423, 424, 425, 429, 455,
];

pub const ROOT_ARCH_ZONE_CONFIG: HvArchZoneConfig = HvArchZoneConfig {
gicd_base: 0xfe600000,
gicd_size: 0x10000,
gicr_base: 0xfe680000,
gicr_size: 0x100000,
gicc_base: 0x8010000,
gicc_size: 0x10000,
gicc_offset: 0x0,
gich_base: 0x8030000,
gich_size: 0x10000,
gicv_base: 0x8040000,
gicv_size: 0x10000,
gits_base: 0x8080000,
gits_size: 0x20000,
};

pub const ROOT_PCI_CONFIG: HvPciConfig = HvPciConfig {
ecam_base: 0x4010000000,
ecam_size: 0x10000000,
io_base: 0x3eff0000,
io_size: 0x10000,
pci_io_base: 0x0,
mem32_base: 0x10000000,
mem32_size: 0x2eff0000,
pci_mem32_base: 0x10000000,
mem64_base: 0x8000000000,
mem64_size: 0x8000000000,
pci_mem64_base: 0x8000000000,
};

pub const ROOT_ZONE_IVC_CONFIG: [HvIvcConfig; 0] = [];

pub const ROOT_PCI_DEVS: [u64; 2] = [0, 1 << 3];
7 changes: 7 additions & 0 deletions platform/aarch64/rk3588/cargo/config.template.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[target.aarch64-unknown-none]
runner = "platform/__ARCH__/__BOARD__/test/runner.sh"
rustflags = [
"-Clink-arg=-Tplatform/__ARCH__/__BOARD__/linker.ld",
"-Ctarget-feature=+a72,+v8a,+strict-align,-neon,-fp-armv8",
"-Cforce-frame-pointers=yes",
]
6 changes: 6 additions & 0 deletions platform/aarch64/rk3588/cargo/features
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
gicv3
uart_16550
uart_base_rk3588
pt_layout_rk3588
mpidr_rockchip
no_autodetect_ncpus
31 changes: 31 additions & 0 deletions platform/aarch64/rk3588/configs/zone1-linux-virtio.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"zones": [
{
"id": 1,
"memory_region": [
{
"zone0_ipa": "0x50000000",
"zonex_ipa": "0x50000000",
"size": "0x25000000"
}
],
"devices": [
{
"type": "blk",
"addr": "0xff9d0000",
"len": "0x200",
"irq": 78,
"img": "rootfs.ext4",
"status": "enable"
},
{
"type": "console",
"addr": "0xff9e0000",
"len": "0x200",
"irq": 76,
"status": "enable"
}
]
}
]
}
Loading
Loading