Skip to content

Commit

Permalink
Merge branch 'main' into cast-elimination
Browse files Browse the repository at this point in the history
  • Loading branch information
cagatay-y authored Oct 24, 2023
2 parents c4674e6 + 0564975 commit 752b355
Show file tree
Hide file tree
Showing 7 changed files with 178 additions and 175 deletions.
149 changes: 78 additions & 71 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ jobs:
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
workspaces: |
.
hermit-builtins
- run: cargo xtask clippy

format:
Expand Down Expand Up @@ -76,6 +79,9 @@ jobs:
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
workspaces: |
.
hermit-builtins
- name: Build minimal kernel
run: |
cargo xtask build --arch x86_64 --no-default-features
Expand All @@ -94,6 +100,9 @@ jobs:
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
workspaces: |
.
hermit-builtins
- name: Unit tests
run: cargo test --lib
env:
Expand All @@ -108,12 +117,58 @@ jobs:
env:
RUSTFLAGS:

run-x86_64:
name: Run Hermit for Rust (x86_64)
run-hermit:
name: Run
runs-on: ubuntu-latest
defaults:
run:
working-directory: kernel
strategy:
matrix:
arch: [x86_64, aarch64]
package: [rusty_demo, httpd, testudp, hello_world]
netdev: [none, virtio-net-pci, rtl8139]
profile: [dev, release]
exclude:
# microvm (Firecracker) test does not run on aarch64
- package: hello_world
arch: aarch64
# rtl8139 support does not build on aarch64
- arch: aarch64
netdev: rtl8139
# Following packages do not depend on the netdev
- package: rusty_demo
netdev: virtio-net-pci
- package: rusty_demo
netdev: rtl8139
- package: hello_world
netdev: virtio-net-pci
- package: hello_world
netdev: rtl8139
# Following packages require a netdev
- package: httpd
netdev: none
- package: testudp
netdev: none
include:
- arch: x86_64
packages: qemu-system-x86 libcap-ng-dev libseccomp-dev socat
- arch: aarch64
packages: qemu-system-aarch64

- arch: x86_64
package: rusty_demo
flags: --features pci-ids --virtiofsd
- arch: aarch64
package: rusty_demo
flags: --features pci-ids
- package: httpd
flags: --features ci,dhcpv4
- package: testudp
flags: --features udp,dhcpv4
- package: hello_world
flags: --no-default-features --microvm

steps:
- name: Checkout hermit-rs
uses: actions/checkout@v4
Expand All @@ -130,90 +185,38 @@ jobs:
- name: Install QEMU
run: |
sudo apt-get update
sudo apt-get install qemu-system-x86 libcap-ng-dev libseccomp-dev socat
sudo apt-get install ${{ matrix.packages }}
- uses: mkroening/rust-toolchain-toml@main
- uses: mkroening/rust-toolchain-toml@main
with:
toolchain-file: 'kernel/rust-toolchain.toml'
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
key: ${{ matrix.arch }}-${{ matrix.profile }}
save-if: ${{ github.ref == 'refs/heads/main' && matrix.package == 'rusty_demo' }}
workspaces: |
.
kernel
kernel/hermit-builtins
- name: Download loader
uses: dsaltares/fetch-gh-release-asset@master
with:
repo: hermit-os/loader
file: rusty-loader-x86_64
file: rusty-loader-${{ matrix.arch }}
- name: Install virtiofsd
if: ${{ matrix.arch == 'x86_64' && matrix.package == 'rusty_demo' }}
run: cargo install virtiofsd
- name: rusty_demo with pci-ids and virtiofsd
run: cargo xtask ci qemu --arch x86_64 --package rusty_demo --features pci-ids --virtiofsd
- name: rusty_demo with pci-ids and virtiofsd (release)
run: cargo xtask ci qemu --arch x86_64 --package rusty_demo --features pci-ids --virtiofsd --release
- name: httpd with virtio-net-pci and dhcpv4
run: cargo xtask ci qemu --arch x86_64 --package httpd --features ci,dhcpv4 --netdev virtio-net-pci
- name: httpd with virtio-net-pci and dhcpv4 (release)
run: cargo xtask ci qemu --arch x86_64 --package httpd --features ci,dhcpv4 --netdev virtio-net-pci --release
- name: httpd with rtl8139 and dhcpv4
run: cargo xtask ci qemu --arch x86_64 --package httpd --features ci,dhcpv4,rtl8139 --netdev rtl8139
- name: httpd with rtl8139 and dhcpv4 (release)
run: cargo xtask ci qemu --arch x86_64 --package httpd --features ci,dhcpv4,rtl8139 --netdev rtl8139 --release
- name: hello_world on microVM (release)
run: cargo xtask ci qemu --arch x86_64 --package hello_world --no-default-features --microvm --release
- name: testudp with virtio-net-pci and dhcpv4
run: cargo xtask ci qemu --arch x86_64 --package testudp --features udp,dhcpv4 --netdev virtio-net-pci
- name: testudp with virtio-net-pci and dhcpv4 (release)
run: cargo xtask ci qemu --arch x86_64 --package testudp --features udp,dhcpv4 --netdev virtio-net-pci --release

run-aarch64:
name: Run Hermit for Rust (aarch64)
runs-on: ubuntu-latest
defaults:
run:
working-directory: kernel
steps:
- name: Checkout hermit-rs
uses: actions/checkout@v4
with:
repository: hermit-os/hermit-rs
submodules: true
- name: Remove hermit-kernel submodule
run: git rm -r kernel
working-directory: .
- name: Checkout hermit-kernel
uses: actions/checkout@v4
with:
path: kernel
- name: Download loader
uses: dsaltares/fetch-gh-release-asset@master
with:
repo: hermit-os/loader
file: rusty-loader-aarch64
- uses: mkroening/rust-toolchain-toml@main
- uses: mkroening/rust-toolchain-toml@main
with:
toolchain-file: 'kernel/rust-toolchain.toml'
- name: Install QEMU
run: |
sudo apt-get update
sudo apt-get install qemu-system-aarch64
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
workspaces: |
.
kernel
kernel/hermit-builtins
- name: rusty_demo with pci-ids
run: cargo xtask ci qemu --arch aarch64 --package rusty_demo --features pci-ids
- name: rusty_demo with pci-ids (release)
run: cargo xtask ci qemu --arch aarch64 --package rusty_demo --features pci-ids --release
- name: httpd with dhcpv4
run: cargo xtask ci qemu --arch aarch64 --package httpd --features ci,dhcpv4 --netdev virtio-net-pci
- name: httpd with dhcpv4 (release)
run: cargo xtask ci qemu --arch aarch64 --package httpd --features ci,dhcpv4 --netdev virtio-net-pci --release
- name: Run VM
# cargo accepts multiple 'features' flags
# The '… && … || …' expression is like a ternary operator
run: >
cargo xtask ci qemu
--arch ${{ matrix.arch }}
--package ${{ matrix.package }}
${{ matrix.flags }}
${{ matrix.netdev == 'rtl8139' && '--features rtl8139' || '' }}
${{ matrix.netdev != 'none' && format('--netdev {0}', matrix.netdev) || '' }}
--profile ${{ matrix.profile }}
run-x86_64-kvm:
name: Run Hermit for Rust (x86_64 + kvm)
Expand Down Expand Up @@ -274,6 +277,10 @@ jobs:
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
workspaces: |
.
kernel
kernel/hermit-builtins
- name: rusty_demo on Uhyve
run: cargo xtask ci uhyve --arch x86_64 --package rusty_demo
- name: rusty_demo on Uhyve (release)
Expand Down
21 changes: 11 additions & 10 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ ahash = { version = "0.8", default-features = false }
align-address = "0.1"
bit_field = "0.10"
bitflags = "2.4"
cfg-if = "1"
crossbeam-utils = { version = "0.8", default-features = false }
dyn-clone = "1.0"
hashbrown = { version = "0.14", default-features = false }
Expand Down
4 changes: 2 additions & 2 deletions hermit-builtins/Cargo.lock

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

16 changes: 16 additions & 0 deletions src/arch/aarch64/mod.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,18 @@
pub mod kernel;
pub mod mm;

/// Force strict CPU ordering, serializes load and store operations.
#[allow(dead_code)]
#[inline(always)]
pub(crate) fn memory_barrier() {
use core::arch::asm;
unsafe {
asm!("dmb ish", options(nostack, nomem, preserves_flags),);
}
}

pub fn init_drivers() {
// Initialize PCI Drivers
#[cfg(feature = "pci")]
crate::drivers::pci::init_drivers();
}
Loading

0 comments on commit 752b355

Please sign in to comment.