-
Notifications
You must be signed in to change notification settings - Fork 565
AArch64 initial build #1168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AArch64 initial build #1168
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| name: Cloud Hypervisor Cross Build | ||
| on: [pull_request, create] | ||
|
|
||
| jobs: | ||
| build: | ||
| if: github.event_name == 'pull_request' | ||
| name: Build | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| rust: | ||
| - stable | ||
| target: | ||
| - aarch64-unknown-linux-gnu | ||
| - aarch64-unknown-linux-musl | ||
| steps: | ||
| - name: Code checkout | ||
| uses: actions/checkout@v2 | ||
| - name: Install Rust toolchain (${{ matrix.rust }}) | ||
| uses: actions-rs/toolchain@v1 | ||
| with: | ||
| toolchain: ${{ matrix.rust }} | ||
| target: ${{ matrix.target }} | ||
| override: true | ||
| - name: Disable "with-serde" in kvm-bindings | ||
| run: sed -i 's/"with-serde",\ //g' vmm/Cargo.toml | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a reasonable solution for the time being. |
||
| - name: Build | ||
| uses: actions-rs/cargo@v1 | ||
| with: | ||
| use-cross: true | ||
| command: build | ||
| args: --target=${{ matrix.target }} --no-default-features --features "mmio" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,16 +3,26 @@ | |
|
|
||
| pub mod layout; | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For 24e62df please prefix with "build:" and drop gerrit Change-Id. |
||
| use memory_model::{GuestAddress, GuestMemory}; | ||
| use crate::RegionType; | ||
| use kvm_ioctls::*; | ||
| use vm_memory::{GuestAddress, GuestMemoryMmap, GuestUsize}; | ||
|
|
||
| /// Stub function that needs to be implemented when aarch64 functionality is added. | ||
| pub fn arch_memory_regions(size: usize) -> Vec<(GuestAddress, usize, RegionType)> { | ||
| vec![(GuestAddress(0), size, RegionType::Ram)] | ||
| pub fn arch_memory_regions(size: GuestUsize) -> Vec<(GuestAddress, usize, RegionType)> { | ||
| vec![(GuestAddress(0), size as usize, RegionType::Ram)] | ||
| } | ||
|
|
||
| #[derive(Debug, Copy, Clone)] | ||
| /// Specifies the entry point address where the guest must start | ||
| /// executing code. | ||
| pub struct EntryPoint { | ||
| /// Address in guest memory where the guest must start execution | ||
| pub entry_addr: GuestAddress, | ||
| } | ||
|
|
||
| /// Stub function that needs to be implemented when aarch64 functionality is added. | ||
| pub fn configure_system( | ||
| _guest_mem: &GuestMemory, | ||
| _guest_mem: &GuestMemoryMmap, | ||
| _cmdline_addr: GuestAddress, | ||
| _cmdline_size: usize, | ||
| _num_cpus: u8, | ||
|
|
@@ -25,3 +35,29 @@ pub fn configure_system( | |
| pub fn get_reserved_mem_addr() -> usize { | ||
| 0 | ||
| } | ||
|
|
||
| pub fn get_host_cpu_phys_bits() -> u8 { | ||
| // The value returned here is used to determine the physical address space size | ||
| // for a VM (IPA size). | ||
| // In recent kernel versions, the maxium IPA size supported by the host can be | ||
| // known by querying cap KVM_CAP_ARM_VM_IPA_SIZE. And the IPA size for a | ||
| // guest can be configured smaller. | ||
| // But in Cloud-Hypervisor we simply use the maxium value for the VM. | ||
| // Reference https://lwn.net/Articles/766767/. | ||
| // | ||
| // The correct way to query KVM_CAP_ARM_VM_IPA_SIZE is via rust-vmm/kvm-ioctls, | ||
| // which wraps all IOCTL's and provides easy interface to user hypervisors. | ||
| // For now the cap hasn't been supported. A separate patch will be submitted to | ||
| // rust-vmm to add it. | ||
| // So a hardcoded value is used here as a temporary solution. | ||
| // It will be replace once rust-vmm/kvm-ioctls is ready. | ||
| // | ||
| 40 | ||
| } | ||
|
|
||
| pub fn check_required_kvm_extensions(kvm: &Kvm) -> super::Result<()> { | ||
| if !kvm.check_extension(Cap::SignalMsi) { | ||
| return Err(super::Error::CapabilityMissing(Cap::SignalMsi)); | ||
| } | ||
| Ok(()) | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| FROM ubuntu:18.04 as dev | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For b40aea0 please prefix first line of commit message with "build:" and drop trailing full-stop. Please remove the Gerrit Change-Id.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done for all commits. |
||
| ARG TARGETARCH="x86_64" | ||
| ARG RUST_TOOLCHAIN="1.42.0" | ||
| ARG CLH_SRC_DIR="/cloud-hypervisor" | ||
| ARG CLH_BUILD_DIR="$CLH_SRC_DIR/build" | ||
|
|
@@ -11,9 +12,9 @@ ENV RUSTUP_HOME=$CARGO_HOME | |
| ENV PATH="$PATH:$CARGO_HOME/bin" | ||
|
|
||
| # Install all CI dependencies | ||
| RUN apt-get update | ||
| RUN apt-get -yq upgrade | ||
| RUN DEBIAN_FRONTEND=noninteractive apt-get install -yq \ | ||
| RUN apt-get update \ | ||
| && apt-get -yq upgrade \ | ||
| && DEBIAN_FRONTEND=noninteractive apt-get install -yq \ | ||
| build-essential \ | ||
| bc \ | ||
| docker.io \ | ||
|
|
@@ -37,22 +38,29 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get install -yq \ | |
| dosfstools \ | ||
| cpio \ | ||
| bsdtar \ | ||
| gcc-multilib \ | ||
| libfdt-dev \ | ||
| && apt-get clean \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| RUN if [ "$TARGETARCH" = "x86_64" ]; then \ | ||
| apt-get update \ | ||
| && apt-get -yq upgrade \ | ||
| && DEBIAN_FRONTEND=noninteractive apt-get install -yq gcc-multilib \ | ||
| && apt-get clean \ | ||
| && rm -rf /var/lib/apt/lists/*; fi | ||
|
|
||
| # Fix the libssl-dev install | ||
| RUN cp /usr/include/x86_64-linux-gnu/openssl/opensslconf.h /usr/include/openssl/ | ||
| ENV OPENSSL_DIR=/usr/lib/x86_64-linux-gnu/ | ||
| ENV OPENSSL_LIB_DIR=/usr/lib/x86_64-linux-gnu/ | ||
| RUN cp /usr/include/"$TARGETARCH"-linux-gnu/openssl/opensslconf.h /usr/include/openssl/ | ||
| ENV OPENSSL_DIR=/usr/lib/"$TARGETARCH"-linux-gnu/ | ||
| ENV OPENSSL_LIB_DIR=/usr/lib/"$TARGETARCH"-linux-gnu/ | ||
| ENV OPENSSL_INCLUDE_DIR=/usr/include/ | ||
|
|
||
| # Install the rust toolchain | ||
| RUN nohup curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain "$RUST_TOOLCHAIN" \ | ||
| && rustup target add x86_64-unknown-linux-musl --toolchain "$RUST_TOOLCHAIN" \ | ||
| && rustup toolchain add $RUST_TOOLCHAIN-x86_64-unknown-linux-musl \ | ||
| && rustup component add rustfmt \ | ||
| && rustup component add clippy \ | ||
| && rustup target add $TARGETARCH-unknown-linux-musl --toolchain "$RUST_TOOLCHAIN" \ | ||
| && if [ "$TARGETARCH" = "x86_64" ]; then rustup toolchain add $RUST_TOOLCHAIN-x86_64-unknown-linux-musl; fi \ | ||
| && if [ "$TARGETARCH" = "x86_64" ]; then rustup component add rustfmt; fi \ | ||
| && if [ "$TARGETARCH" = "x86_64" ]; then rustup component add clippy; fi \ | ||
| && cargo install cargo-audit \ | ||
| && rm -rf "$CARGO_HOME/registry" \ | ||
| && ln -s "$CARGO_REGISTRY_DIR" "$CARGO_HOME/registry" \ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For 888028a please prefix first commit message line with "build: " and drop gerrit Change-Id