Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
2655dfb
fix: pci bridge only_one_child function
ZhongkaiXu Mar 28, 2026
f6b1875
fix: complete `rom_init` and fix rom access handle code (add mapping …
ZhongkaiXu Mar 28, 2026
5109b30
feat: add bridge bar access handle code (region mapping)
ZhongkaiXu Mar 29, 2026
5679dff
feat: add feature `io_atu_index` to define the atu index for io and c…
ZhongkaiXu Mar 29, 2026
1f1aae4
feat: modify atu handlecode according to `io_atu_index`
ZhongkaiXu Mar 29, 2026
cc49129
feat: add msi count and msi_info when enumerating pci devs
ZhongkaiXu Mar 31, 2026
b33c0b0
feat: handle msi cap access, record doorbell from vm
ZhongkaiXu Mar 31, 2026
4ae0046
feat: add msix table access detect code (Currently enabled for all mo…
ZhongkaiXu Mar 31, 2026
2da6593
feat: add `dwc_msi` feature
ZhongkaiXu Apr 5, 2026
51c0420
feat (pci-dwc-msi): doorbell shadow and irq bit split
ZhongkaiXu Apr 7, 2026
3688ec6
fix: change msi msg by adding hw_irq_bit offset
ZhongkaiXu Apr 13, 2026
c5e3370
feat: add feature `pci_init_delay`
ZhongkaiXu Apr 14, 2026
53dfbed
feat: add dwc-msi-inject event and successfully boot 2 vms with 1 net…
ZhongkaiXu Apr 23, 2026
56179d1
update config files for imx8mp
ZhongkaiXu Apr 27, 2026
e1235c0
fix: sync pci_init_delay functions in zone.inner and re-write vbdf-bd…
ZhongkaiXu Apr 28, 2026
4279502
fix: fix iommu import
ZhongkaiXu Apr 28, 2026
1f593eb
fix: format adjust
ZhongkaiXu Apr 28, 2026
a258d13
fix: missing `intel_vtd` feature when rebasing code
ZhongkaiXu Apr 28, 2026
567ab8b
feat: modify config file, add pci vbdf-bdf remap
ZhongkaiXu May 10, 2026
b5330bf
feat: enumerate pci dev ext caps
ZhongkaiXu May 10, 2026
df5e792
format adjust
ZhongkaiXu May 10, 2026
5f1997f
feat: add `sriov` feature
ZhongkaiXu Jun 1, 2026
abf83c5
feat: sriov vf enumerate, sriov cap handler
ZhongkaiXu Jun 1, 2026
a0ca9ef
configs: add vf in dev list
ZhongkaiXu Jun 1, 2026
9a97aff
fix: compile error fix
ZhongkaiXu Jun 2, 2026
eadfdca
config: fix x86_qemu config vbdf setting
ZhongkaiXu Jun 3, 2026
4d331ac
config: fix loongarch config vbdf-bdf setting
ZhongkaiXu Jun 3, 2026
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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ uefi-raw = "=0.9.0"
############# general ##############
iommu = [] # supported by: aarch64, riscv64
pci = [] # supported by: aarch64, riscv64,loongarch64
sriov = ["pci"] # SR-IOV PF/VF enumeration and passthrough
print_timestamp = [] # print timestamp when logging

############# IOMMU ##############
Expand All @@ -65,6 +66,8 @@ ecam_pcie = [] # Standard ECAM mechanism (default for most platforms)
dwc_pcie = [] # DesignWare PCIe Core mechanism (CFG0/CFG1, used by RK3568)
loongarch64_pcie = [] # LoongArch PCIe mechanism (used by LoongArch platforms)
no_pcie_bar_realloc = []
dwc_msi = ["dwc_pcie"] # DesignWare Native MSI (used when arch doesn't provide MSI, e.g., ARM without ITS)
pci_init_delay = ["dwc_pcie"] # Delay hvisor PCI init until guest DBI offset 0 access
virtio_pci = [] # Virtual virtio pci support

############# aarch64 ##############
Expand Down
51 changes: 49 additions & 2 deletions platform/aarch64/imx8mp/board.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ use crate::{
config::*,
};

use crate::pci::vpci_dev::VpciDevType;
use crate::pci_dev;

pub const BOARD_NAME: &str = "imx8mp";

pub const BOARD_NCPUS: usize = 4;
Expand Down Expand Up @@ -107,14 +110,23 @@ pub const ROOT_ZONE_MEMORY_REGIONS: [HvConfigMemoryRegion; 8] = [
// virtual_start: 0x30890000,
// size: 0x1000,
// }, // serial
// 0x32f00000
// HvConfigMemoryRegion {
// mem_type: MEM_TYPE_IO,
// physical_start: 0x32f00000,
// virtual_start: 0x32f00000,
// size: 0x10000,
// }, // pcie-phy
];

pub const IRQ_WAKEUP_VIRTIO_DEVICE: usize = 32 + 0x20;
pub const ROOT_ZONE_IRQS_BITMAP: &[BitmapWord] = &get_irqs_bitmap(&[
35, 36, 37, 38, 45, 52, 55, 56, 57, 59, 64, 67, 75, 96, 97, 98, 99, 100, 101, 102, 103, 104,
105, 135, 150, 151, 152, 162,
105, 135, 150, 151, 152, 162, 172, 159,
]);

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

pub const ROOT_ARCH_ZONE_CONFIG: HvArchZoneConfig = HvArchZoneConfig {
is_aarch32: 0,
gic_config: GicConfig::Gicv3(Gicv3Config {
Expand All @@ -127,4 +139,39 @@ pub const ROOT_ARCH_ZONE_CONFIG: HvArchZoneConfig = HvArchZoneConfig {
}),
};

pub const ROOT_ZONE_IVC_CONFIG: [HvIvcConfig; 0] = [];
pub const ROOT_PCI_CONFIG: &[HvPciConfig] = &[HvPciConfig {
ecam_base: 0x33800000,
ecam_size: 0x400000,
io_base: 0x1ff80000,
io_size: 0x10000,
pci_io_base: 0x0,
mem32_base: 0x1800_0000,
mem32_size: 0x7f0_0000,
pci_mem32_base: 0x1800_0000,
mem64_base: 0x0,
mem64_size: 0x0,
pci_mem64_base: 0x0,
bus_range_begin: 0x0,
bus_range_end: 0x1f,
domain: 0x0,
}];

pub const ROOT_DWC_ATU_CONFIG: &[HvDwcAtuConfig] = &[HvDwcAtuConfig {
ecam_base: 0x33800000,
dbi_base: 0x33800000,
dbi_size: 0x400000,
apb_base: 0x0,
apb_size: 0x0,
cfg_base: 0x1ff00000,
cfg_size: 0x80000,
io_cfg_atu_shared: 1,
io_atu_index: 1,
dw_msi_irq: 172,
}];

pub const ROOT_PCI_DEVS: [HvPciDevConfig; 2] = [
pci_dev!(0x0, 0x00, 0x0, 0x0 => 0x0, 0x0, 0x0, VpciDevType::Physical),
pci_dev!(0x0, 0x01, 0x0, 0x0 => 0x1, 0x0, 0x0, VpciDevType::Physical),
// pci_dev!(0x0, 0x02, 0x10, 0x0 => 0x02, 0x10, 0x0, VpciDevType::Physical), // SRIOV VF
// pci_dev!(0x0, 0x02, 0x10, 0x4 => 0x02, 0x10, 0x4, VpciDevType::Physical), // SRIOV VF
];
6 changes: 6 additions & 0 deletions platform/aarch64/imx8mp/cargo/features
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
gicv3
imx_uart
pci
dwc_pcie
no_pcie_bar_realloc
dwc_msi
pci_init_delay
sriov
108 changes: 91 additions & 17 deletions platform/aarch64/imx8mp/configs/zone1-linux.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,80 +2,154 @@
"arch": "arm64",
"name": "linux2",
"zone_id": 1,
"cpus": [2, 3],
"cpus": [
2,
3
],
"memory_regions": [
{
"type": "ram",
"physical_start": "0x50000000",
"virtual_start": "0x50000000",
"virtual_start": "0x50000000",
"size": "0x30000000"
},
{
"type": "io",
"physical_start": "0x30a60000",
"virtual_start": "0x30a60000",
"virtual_start": "0x30a60000",
"size": "0x10000"
},
{
"type": "virtio",
"physical_start": "0xa003c00",
"virtual_start": "0xa003c00",
"virtual_start": "0xa003c00",
"size": "0x200"
},
{
"type": "virtio",
"physical_start": "0xa003800",
"virtual_start": "0xa003800",
"virtual_start": "0xa003800",
"size": "0x200"
},
{
"type": "virtio",
"physical_start": "0xa003600",
"virtual_start": "0xa003600",
"virtual_start": "0xa003600",
"size": "0x200"
},
{
"type": "io",
"physical_start": "0x38000000",
"virtual_start": "0x38000000",
"virtual_start": "0x38000000",
"size": "0x10000"
},
{
"type": "io",
"physical_start": "0x38500000",
"virtual_start": "0x38500000",
"virtual_start": "0x38500000",
"size": "0x20000"
},
{
"type": "io",
"physical_start": "0x32e80000",
"virtual_start": "0x32e80000",
"virtual_start": "0x32e80000",
"size": "0x20000"
},
{
"type": "io",
"physical_start": "0x30c00000",
"virtual_start": "0x30c00000",
"virtual_start": "0x30c00000",
"size": "0x400000"
},
{
"type": "io",
"physical_start": "0x32fc0000",
"virtual_start": "0x32fc0000",
"virtual_start": "0x32fc0000",
"size": "0x20000"
}
],
"interrupts": [35, 37, 38, 45, 56, 57, 61, 75, 76, 78, 135, 162],
"interrupts": [
35,
37,
38,
45,
56,
57,
61,
75,
76,
78,
135,
162,
172
],
"ivc_configs": [],
"kernel_filepath": "./Image",
"dtb_filepath": "./linux2.dtb",
"kernel_load_paddr": "0x50400000",
"dtb_load_paddr": "0x50000000",
"entry_point": "0x50400000",
"dtb_load_paddr": "0x50000000",
"entry_point": "0x50400000",
"arch_config": {
"gic_version": "v3",
"gicd_base": "0x38800000",
"gicd_size": "0x10000",
"gicr_base": "0x38880000",
"gicr_size": "0xc0000"
}
}
"gicr_size": "0xc0000",
"is_aarch32": false
},
"pci_config": [
{
"ecam_base": "0x33800000",
"ecam_size": "0x400000",
"io_base": "0x1ff80000",
"io_size": "0x10000",
"pci_io_base": "0x0",
"mem32_base": "0x18000000",
"mem32_size": "0x7f00000",
"pci_mem32_base": "0x18000000",
"mem64_base": "0x0",
"mem64_size": "0x0",
"pci_mem64_base": "0x0",
"bus_range_begin": "0x0",
"bus_range_end": "0x1f",
"domain": "0x0"
}
],
"dwc_atu_config": [
{
"ecam_base": "0x33800000",
"dbi_base": "0x33800000",
"dbi_size": "0x400000",
"apb_base": "0x0",
"apb_size": "0x0",
"cfg_base": "0x1ff00000",
"cfg_size": "0x10000",
"io_cfg_atu_shared": 1,
"io_atu_index": 1,
"dw_msi_irq": 172
}
],
"num_pci_devs": 2,
"alloc_pci_devs": [
{
"domain": "0x0",
"bus": "0x0",
"device": "0x0",
"function": "0x0",
"v_bus": "0x0",
"v_device": "0x0",
"v_function": "0x0",
"dev_type": "0"
},
{
"domain": "0x0",
"bus": "0x1",
"device": "0x0",
"function": "0x1",
"v_bus": "0x1",
"v_device": "0x0",
"v_function": "0x0",
"dev_type": "0"
}
]
}
6 changes: 3 additions & 3 deletions platform/aarch64/qemu-gicv2/board.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ pub const ROOT_PCI_CONFIG: [HvPciConfig; 1] = [
pub const ROOT_ZONE_IVC_CONFIG: [HvIvcConfig; 0] = [];

pub const ROOT_PCI_DEVS: [HvPciDevConfig; 3] = [
pci_dev!(0x0, 0x0, 0x0, 0x0, VpciDevType::Physical),
pci_dev!(0x0, 0x0, 0x1, 0x0, VpciDevType::Physical),
pci_dev!(0x0, 0x0, 0x2, 0x0, VpciDevType::Physical),
pci_dev!(0x0, 0x0, 0x0, 0x0 => 0x0, 0x0, 0x0, VpciDevType::Physical),
pci_dev!(0x0, 0x0, 0x1, 0x0 => 0x0, 0x1, 0x0, VpciDevType::Physical),
pci_dev!(0x0, 0x0, 0x2, 0x0 => 0x0, 0x2, 0x0, VpciDevType::Physical),
];
8 changes: 4 additions & 4 deletions platform/aarch64/qemu-gicv3/board.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ pub const ROOT_PCI_CONFIG: [HvPciConfig; 1] = [HvPciConfig {
pub const ROOT_ZONE_IVC_CONFIG: [HvIvcConfig; 0] = [];

pub const ROOT_PCI_DEVS: &[HvPciDevConfig] = &[
pci_dev!(0x0, 0x0, 0x0, 0x0, VpciDevType::Physical),
pci_dev!(0x0, 0x0, 0x1, 0x0, VpciDevType::Physical),
// pci_dev!(0x0, 0x0, 0x3, 0x0, VpciDevType::Physical),
pci_dev!(0x0, 0x0, 0x5, 0x0, VpciDevType::StandardVdev),
pci_dev!(0x0, 0x0, 0x0, 0x0 => 0x0, 0x0, 0x0, VpciDevType::Physical),
pci_dev!(0x0, 0x0, 0x1, 0x0 => 0x0, 0x3, 0x0, VpciDevType::Physical),
// pci_dev!(0x0, 0x0, 0x3, 0x0 => 0x0, 0x3, 0x0, VpciDevType::Physical),
// pci_dev!(0x0, 0x0, 0x5, 0x0 => 0x0, 0x5, 0x0, VpciDevType::StandardVdev),
];
53 changes: 32 additions & 21 deletions platform/aarch64/qemu-gicv3/configs/zone1-linux.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
{
"name": "linux2",
"zone_id": 1,
"cpus": [2, 3],
"cpus": [
2,
3
],
"memory_regions": [
{
"type": "ram",
"physical_start": "0x50000000",
"virtual_start": "0x50000000",
"virtual_start": "0x50000000",
"size": "0x30000000"
},
{
Expand Down Expand Up @@ -37,8 +40,8 @@
"kernel_filepath": "./Image",
"dtb_filepath": "./zone1-linux.dtb",
"kernel_load_paddr": "0x50400000",
"dtb_load_paddr": "0x50000000",
"entry_point": "0x50400000",
"dtb_load_paddr": "0x50000000",
"entry_point": "0x50400000",
"arch_config": {
"gic_version": "v3",
"gicd_base": "0x8000000",
Expand All @@ -49,36 +52,44 @@
"gits_size": "0x20000",
"is_aarch32": false
},
"pci_config": [{
"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",
"bus_range_begin": "0x0",
"bus_range_end": "0x1f",
"domain": "0x0"
}],
"pci_config": [
{
"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",
"bus_range_begin": "0x0",
"bus_range_end": "0x1f",
"domain": "0x0"
}
],
"num_pci_devs": 2,
"alloc_pci_devs": [
{
"domain": "0x0",
"bus": "0x0",
"device": "0x0",
"function": "0x0",
"v_bus": "0x0",
"v_device": "0x0",
"v_function": "0x0",
"dev_type": "0"
},
{
"domain": "0x0",
"bus": "0x0",
"device": "0x1",
"device": "0x2",
"function": "0x0",
"v_bus": "0x0",
"v_device": "0x1",
"v_function": "0x0",
"dev_type": "0"
}
]
Expand Down
Loading
Loading