Skip to content

Commit cee750f

Browse files
authored
Merge pull request #269 from syswonder/dev-x86_64
x86_64 add ci/cd
2 parents 91e2157 + 17a0cfe commit cee750f

File tree

27 files changed

+6711
-85
lines changed

27 files changed

+6711
-85
lines changed

.github/actions/setup-qemu/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ runs:
3333
run: |
3434
./configure \
3535
--prefix=${{ inputs.install-path }} \
36-
--target-list=aarch64-softmmu,riscv64-softmmu,riscv64-linux-user \
36+
--target-list=aarch64-softmmu,riscv64-softmmu,riscv64-linux-user,x86_64-softmmu \
3737
--enable-kvm \
3838
--enable-nettle \
3939
--enable-user \

.github/workflows/ci.yml

Lines changed: 52 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979
# there is no actual running in this job
8080
build:
8181
name: build
82-
runs-on: ubuntu-latest
82+
runs-on: ${{ matrix.runs-on }}
8383
strategy:
8484
fail-fast: false
8585
matrix:
@@ -88,57 +88,78 @@ jobs:
8888
- arch: aarch64
8989
board: "qemu-gicv3"
9090
rustc_target: aarch64-unknown-none
91+
runs-on: ubuntu-latest
9192
- arch: aarch64
9293
board: "qemu-gicv2"
9394
rustc_target: aarch64-unknown-none
95+
runs-on: ubuntu-latest
9496
- arch: aarch64
9597
board: "zcu102"
9698
rustc_target: aarch64-unknown-none
99+
runs-on: ubuntu-latest
97100
- arch: aarch64
98101
board: "imx8mp"
99102
rustc_target: aarch64-unknown-none
103+
runs-on: ubuntu-latest
100104
- arch: aarch64
101105
board: "rk3568"
102106
rustc_target: aarch64-unknown-none
107+
runs-on: ubuntu-latest
103108
- arch: aarch64
104109
board: "rk3588"
105110
rustc_target: aarch64-unknown-none
111+
runs-on: ubuntu-latest
106112
- arch: aarch64
107113
board: "ok6254-c"
108114
rustc_target: aarch64-unknown-none
115+
runs-on: ubuntu-latest
109116
- arch: aarch64
110117
board: "phytium-pi"
111118
rustc_target: aarch64-unknown-none
119+
runs-on: ubuntu-latest
112120
# riscv64
113121
- arch: riscv64
114122
board: "qemu-aia"
115123
rustc_target: riscv64gc-unknown-none-elf
124+
runs-on: ubuntu-latest
116125
- arch: riscv64
117126
board: "qemu-plic"
118127
rustc_target: riscv64gc-unknown-none-elf
128+
runs-on: ubuntu-latest
119129
- arch: riscv64
120130
board: "hifive-premier-p550"
121131
rustc_target: riscv64gc-unknown-none-elf
132+
runs-on: ubuntu-latest
122133
- arch: riscv64
123134
board: "megrez"
124135
rustc_target: riscv64gc-unknown-none-elf
136+
runs-on: ubuntu-latest
125137
- arch: riscv64
126138
board: "ur-dp1000"
127139
rustc_target: riscv64gc-unknown-none-elf
140+
runs-on: ubuntu-latest
128141
# loongarch64
129142
- arch: loongarch64
130143
board: "ls3a5000"
131144
rustc_target: loongarch64-unknown-none
145+
runs-on: ubuntu-latest
132146
- arch: loongarch64
133147
board: "ls3a6000"
134148
rustc_target: loongarch64-unknown-none
135-
# # x86_64
136-
# - arch: x86_64
137-
# board: "qemu"
138-
# rustc_target: x86_64-unknown-none
139-
# - arch: x86_64
140-
# board: "nuc14mnk"
141-
# rustc_target: x86_64-unknown-none
149+
runs-on: ubuntu-latest
150+
# x86_64
151+
- arch: x86_64
152+
board: "qemu"
153+
rustc_target: x86_64-unknown-none
154+
runs-on: ubuntu-latest
155+
- arch: x86_64
156+
board: "nuc14mnk"
157+
rustc_target: x86_64-unknown-none
158+
runs-on: ubuntu-latest
159+
- arch: x86_64
160+
board: "ecx-2300f-peg"
161+
rustc_target: x86_64-unknown-none
162+
runs-on: ubuntu-latest
142163
steps:
143164
- name: Checkout Repository
144165
uses: actions/checkout@v4
@@ -166,7 +187,7 @@ jobs:
166187
systemtest:
167188
# if: false # we need to update corresponding scripts for the new board abstraction
168189
name: systemtest
169-
runs-on: ubuntu-22.04
190+
runs-on: ${{ matrix.runs-on }}
170191
strategy:
171192
fail-fast: false
172193
matrix:
@@ -175,10 +196,20 @@ jobs:
175196
- arch: aarch64
176197
rustc_target: aarch64-unknown-none
177198
board: "qemu-gicv3"
199+
runs-on: ubuntu-22.04
200+
qemu_version: "9.0.2"
178201
# riscv64
179202
- arch: riscv64
180203
rustc_target: riscv64gc-unknown-none-elf
181204
board: "qemu-plic"
205+
runs-on: ubuntu-22.04
206+
qemu_version: "9.0.2"
207+
# x86_64
208+
- arch: x86_64
209+
rustc_target: x86_64-unknown-none
210+
board: "qemu"
211+
runs-on: ["self-hosted", "X64"]
212+
qemu_version: "9.2.3"
182213
# Because other features need to be customized scripts
183214
steps:
184215
- name: Checkout Repository
@@ -190,9 +221,10 @@ jobs:
190221
components: rust-src
191222

192223
- name: Setup QEMU from Source
224+
if: matrix.arch != 'x86_64'
193225
uses: ./.github/actions/setup-qemu
194226
with:
195-
qemu-version: '9.0.2'
227+
qemu-version: ${{ matrix.qemu_version }}
196228
install-path: '/opt/qemu'
197229

198230
- name: Setup ARM aarch64-none-linux-gnu
@@ -209,18 +241,26 @@ jobs:
209241
version: '13.2.0'
210242
install-path: '/opt/riscv64-unknown-linux-gnu'
211243

212-
213244
- name: Install Dependencies
214245
run: |
215246
sudo apt-get update
216247
sudo apt-get install -y qemu-system-aarch64 qemu-system-riscv64 gdb-multiarch llvm-dev libclang-dev wget expect device-tree-compiler p7zip-full gcc-aarch64-linux-gnu gcc-riscv64-linux-gnu
217248
cargo install --version 0.3.0 --locked cargo-binutils
249+
250+
- name: x86_64 Dependencies
251+
if: matrix.arch == 'x86_64'
252+
run: |
253+
sudo apt-get install -y qemu-system-x86-64 grub-common xorriso grub-efi-amd64 mtools ovmf
254+
sudo chmod 777 /dev/kvm
255+
sed -i 's/ecam_base:.*,/ecam_base: 0xb0000000,/' ./platform/x86_64/qemu/board.rs
256+
218257
- name: Set up environment variables
219258
run: |
220259
echo "ARCH=${{ matrix.arch }}" >> $GITHUB_ENV
221260
echo "BOARD=${{ matrix.board }}" >> $GITHUB_ENV
222261
- name: Run System Test
223-
run: make stest
262+
run: |
263+
make stest
224264
225265
license-checker:
226266
name: license-checker

platform/aarch64/qemu-gicv3/test/systemtest/trootfs_deploy.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ deploy_artifacts() {
6868

6969
}
7070

71+
umount_rootfs() {
72+
echo "=== Umounting rootfs ==="
73+
if mountpoint -q "${ROOTFS_DIR}"; then
74+
sudo umount "${ROOTFS_DIR}"
75+
fi
76+
}
77+
7178
# ========================
7279
# Main Execution Flow
7380
# ========================
@@ -77,6 +84,7 @@ deploy_artifacts() {
7784
# Setup environment
7885
mount_rootfs
7986
prepare_sources
87+
trap umount_rootfs EXIT TERM
8088

8189
# Build process
8290
if ! build_hvisor_tool; then
@@ -87,7 +95,4 @@ deploy_artifacts() {
8795
# Deployment
8896
deploy_artifacts
8997

90-
# Cleanup
91-
echo "=== Unmounting rootfs ==="
92-
sudo umount "${ROOTFS_DIR}"
9398
) || exit 1

platform/riscv64/qemu-plic/test/systemtest/trootfs_deploy.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ deploy_artifacts() {
6868

6969
}
7070

71+
umount_rootfs() {
72+
echo "=== Umounting rootfs ==="
73+
if mountpoint -q "${ROOTFS_DIR}"; then
74+
sudo umount "${ROOTFS_DIR}"
75+
fi
76+
}
77+
7178
# ========================
7279
# Main Execution Flow
7380
# ========================
@@ -77,6 +84,7 @@ deploy_artifacts() {
7784
# Setup environment
7885
mount_rootfs
7986
prepare_sources
87+
trap umount_rootfs EXIT TERM
8088

8189
# Build process
8290
if ! build_hvisor_tool; then
@@ -87,7 +95,4 @@ deploy_artifacts() {
8795
# Deployment
8896
deploy_artifacts
8997

90-
# Cleanup
91-
echo "=== Unmounting rootfs ==="
92-
sudo umount "${ROOTFS_DIR}"
9398
) || exit 1

platform/x86_64/ecx-2300f-peg/board.rs

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
// Authors:
1515
//
1616
use crate::pci_dev;
17-
use crate::{arch::zone::HvArchZoneConfig, config::*, memory::GuestPhysAddr};
17+
use crate::{
18+
arch::zone::HvArchZoneConfig, config::*, memory::GuestPhysAddr, pci::vpci_dev::VpciDevType,
19+
};
1820

1921
pub const MEM_TYPE_RESERVED: u32 = 5;
2022

@@ -117,7 +119,8 @@ const ROOT_ZONE_SETUP_ADDR: GuestPhysAddr = 0xa000;
117119
const ROOT_ZONE_VMLINUX_ENTRY_ADDR: GuestPhysAddr = 0x10_0000;
118120
const ROOT_ZONE_SCREEN_BASE_ADDR: GuestPhysAddr = 0x8000_0000;
119121

120-
pub const ROOT_ZONE_IRQS: [u32; 32] = [0; 32];
122+
pub const IRQ_WAKEUP_VIRTIO_DEVICE: usize = 0x6;
123+
pub const ROOT_ZONE_IRQS_BITMAP: &[BitmapWord] = &get_irqs_bitmap(&[0; 32]);
121124
pub const ROOT_ZONE_IOAPIC_BASE: usize = 0xfec0_0000;
122125
pub const ROOT_ARCH_ZONE_CONFIG: HvArchZoneConfig = HvArchZoneConfig {
123126
ioapic_base: ROOT_ZONE_IOAPIC_BASE,
@@ -135,6 +138,8 @@ pub const ROOT_ARCH_ZONE_CONFIG: HvArchZoneConfig = HvArchZoneConfig {
135138
};
136139

137140
pub const ROOT_PCI_CONFIG: [HvPciConfig; 1] = [HvPciConfig {
141+
bus_range_begin: 0x0,
142+
bus_range_end: 0x1f,
138143
ecam_base: 0xe0000000,
139144
ecam_size: 0x400000,
140145
io_base: 0x0,
@@ -146,32 +151,33 @@ pub const ROOT_PCI_CONFIG: [HvPciConfig; 1] = [HvPciConfig {
146151
mem64_base: 0x0,
147152
mem64_size: 0x0,
148153
pci_mem64_base: 0x0,
154+
domain: 0x0,
149155
}];
150156

151157
pub const ROOT_PCI_MAX_BUS: usize = 3;
152158
pub const ROOT_PCI_DEVS: [HvPciDevConfig; 19] = [
153-
pci_dev!(0x0, 0x0, 0x0), // host bridge
154-
pci_dev!(0x0, 0x1, 0x0), // PCI bridge
155-
pci_dev!(0x0, 0x1, 0x1), // PCI bridge
156-
// pci_dev!(0x0, 0x2, 0x0), // display controller
157-
pci_dev!(0x0, 0x8, 0x0), // system peripheral
158-
pci_dev!(0x0, 0x12, 0x0), // signal processing controller
159-
pci_dev!(0x0, 0x14, 0x0), // USB controller
160-
pci_dev!(0x0, 0x14, 0x2), // RAM memory
161-
pci_dev!(0x0, 0x14, 0x5), // SD host controller
162-
pci_dev!(0x0, 0x15, 0x0), // serial bus controller
163-
pci_dev!(0x0, 0x16, 0x0), // communication controller
164-
pci_dev!(0x0, 0x16, 0x3), // serial controller
165-
pci_dev!(0x0, 0x17, 0x0), // SATA controller
166-
pci_dev!(0x0, 0x1d, 0x0), // PCI bridge
167-
// pci_dev!(0x0, 0x1f, 0x0), // ISA bridge
168-
pci_dev!(0x0, 0x1f, 0x3), // audio device
169-
pci_dev!(0x0, 0x1f, 0x4), // SMBus
170-
pci_dev!(0x0, 0x1f, 0x5), // serial bus controller
171-
// pci_dev!(0x0, 0x1f, 0x6), // ethernet controller
172-
pci_dev!(0x2, 0x0, 0x0), // VGA controller
173-
pci_dev!(0x2, 0x0, 0x1), // audio device
174-
pci_dev!(0x3, 0x0, 0x0), // ethernet controller
159+
pci_dev!(0x0, 0x0, 0x0, 0x0, VpciDevType::Physical), // host bridge
160+
pci_dev!(0x0, 0x0, 0x1, 0x0, VpciDevType::Physical), // PCI bridge
161+
pci_dev!(0x0, 0x0, 0x1, 0x1, VpciDevType::Physical), // PCI bridge
162+
// pci_dev!(0x0, 0x0, 0x2, 0x0, VpciDevType::Physical), // display controller
163+
pci_dev!(0x0, 0x0, 0x8, 0x0, VpciDevType::Physical), // system peripheral
164+
pci_dev!(0x0, 0x0, 0x12, 0x0, VpciDevType::Physical), // signal processing controller
165+
pci_dev!(0x0, 0x0, 0x14, 0x0, VpciDevType::Physical), // USB controller
166+
pci_dev!(0x0, 0x0, 0x14, 0x2, VpciDevType::Physical), // RAM memory
167+
pci_dev!(0x0, 0x0, 0x14, 0x5, VpciDevType::Physical), // SD host controller
168+
pci_dev!(0x0, 0x0, 0x15, 0x0, VpciDevType::Physical), // serial bus controller
169+
pci_dev!(0x0, 0x0, 0x16, 0x0, VpciDevType::Physical), // communication controller
170+
pci_dev!(0x0, 0x0, 0x16, 0x3, VpciDevType::Physical), // serial controller
171+
pci_dev!(0x0, 0x0, 0x17, 0x0, VpciDevType::Physical), // SATA controller
172+
pci_dev!(0x0, 0x0, 0x1d, 0x0, VpciDevType::Physical), // PCI bridge
173+
// pci_dev!(0x0, 0x0, 0x1f, 0x0, VpciDevType::Physical), // ISA bridge
174+
pci_dev!(0x0, 0x0, 0x1f, 0x3, VpciDevType::Physical), // audio device
175+
pci_dev!(0x0, 0x0, 0x1f, 0x4, VpciDevType::Physical), // SMBus
176+
pci_dev!(0x0, 0x0, 0x1f, 0x5, VpciDevType::Physical), // serial bus controller
177+
// pci_dev!(0x0, 0x0, 0x1f, 0x6, VpciDevType::Physical), // ethernet controller
178+
pci_dev!(0x0, 0x2, 0x0, 0x0, VpciDevType::Physical), // VGA controller
179+
pci_dev!(0x0, 0x2, 0x0, 0x1, VpciDevType::Physical), // audio device
180+
pci_dev!(0x0, 0x3, 0x0, 0x0, VpciDevType::Physical), // ethernet controller
175181
];
176182

177183
#[cfg(all(feature = "graphics"))]

platform/x86_64/ecx-2300f-peg/linker.ld

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
ENTRY(arch_entry)
22
BASE_ADDRESS = 0xffffff8000200000;
3+
CPU_NUM = 16;
34

45
SECTIONS
56
{
@@ -41,6 +42,17 @@ SECTIONS
4142
*(.sbss .sbss.*)
4243
}
4344

45+
. = ALIGN(4K);
46+
_percpu_start = .;
47+
_percpu_end = _percpu_start + SIZEOF(.percpu);
48+
.percpu 0x0 (NOLOAD) : AT(_percpu_start) {
49+
_percpu_load_start = .;
50+
*(.percpu .percpu.*)
51+
_percpu_load_end = .;
52+
. = _percpu_load_start + ALIGN(64) * CPU_NUM;
53+
}
54+
. = _percpu_end;
55+
4456
. = ALIGN(4K);
4557
ebss = .;
4658
ekernel = .;
@@ -50,4 +62,6 @@ SECTIONS
5062
}
5163
. = ALIGN(4K);
5264
__core_end = .;
53-
}
65+
}
66+
67+
__hv_end = __core_end + HV_EXTENDED_SIZE;

platform/x86_64/ecx-2300f-peg/platform.mk

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,31 @@ $(hvisor_bin): elf boot
4242
$(OBJCOPY) $(hvisor_elf) --strip-all -O binary $@
4343
cp $(hvisor_elf) $(image_dir)/iso/boot
4444
mkdir -p $(image_dir)/iso/boot/kernel
45-
cp $(zone0_boot) $(image_dir)/iso/boot/kernel
46-
cp $(zone0_setup) $(image_dir)/iso/boot/kernel
47-
cp $(zone0_vmlinux) $(image_dir)/iso/boot/kernel
45+
46+
if [ -f $(zone0_boot) ]; then \
47+
cp $(zone0_boot) $(image_dir)/iso/boot/kernel; \
48+
else \
49+
echo "Warning: $(zone0_boot) not found, skipping"; \
50+
fi
51+
52+
if [ -f $(zone0_setup) ]; then \
53+
cp $(zone0_setup) $(image_dir)/iso/boot/kernel; \
54+
else \
55+
echo "Warning: $(zone0_setup) not found, skipping"; \
56+
fi
57+
58+
if [ -f $(zone0_vmlinux) ]; then \
59+
cp $(zone0_vmlinux) $(image_dir)/iso/boot/kernel; \
60+
else \
61+
echo "Warning: $(zone0_vmlinux) not found, skipping"; \
62+
fi
63+
4864
mkdir -p $(image_dir)/virtdisk
49-
grub-mkrescue /usr/lib/grub/x86_64-efi -o $(image_dir)/virtdisk/hvisor.iso $(image_dir)/iso
65+
66+
if command -v xorriso >/dev/null 2>&1; then \
67+
grub-mkrescue /usr/lib/grub/x86_64-efi -o $(image_dir)/virtdisk/hvisor.iso $(image_dir)/iso; \
68+
else \
69+
echo "Warning: xorriso not installed, skipping ISO creation"; \
70+
fi
5071

5172
include $(image_dir)/bootloader/boot.mk

0 commit comments

Comments
 (0)