Skip to content

Commit 343f1a2

Browse files
committed
add loongarch64 support
Signed-off-by: yzewei <[email protected]>
1 parent b292f15 commit 343f1a2

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ jobs:
6363
## ARMv6
6464
- { os: 'ubuntu-latest', target: 'arm-unknown-linux-gnueabihf', cross: true }
6565
- { os: 'ubuntu-latest', target: 'arm-unknown-linux-musleabihf', cross: true }
66+
## LOONGARCH64
67+
- { os: 'ubuntu-latest', target: 'loongarch64-unknown-linux-gnu', cross: true }
68+
6669
toolchain:
6770
- 1.46.0 # MSRV
6871
- stable

heim-host/src/os/linux.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use std::net::IpAddr;
55
use crate::Pid;
66

77
cfg_if::cfg_if! {
8-
// aarch64-unknown-linux-gnu has different type
9-
if #[cfg(all(target_arch = "aarch64", not(target_family = "musl")))] {
8+
// aarch64-unknown-linux-gnu and loongarch64-unknown-linux-gnu has different type
9+
if #[cfg(all(any(target_arch = "aarch64", target_arch = "loongarch64"), not(target_family = "musl")))] {
1010
/// User session ID.
1111
pub type SessionId = i64;
1212
} else {

heim-virt/src/sys/linux/device_tree.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ use heim_common::prelude::StreamExt;
66
target_arch = "arm",
77
target_arch = "aarch64",
88
target_arch = "powerpc",
9-
target_arch = "powerpc64"
9+
target_arch = "powerpc64",
10+
target_arch = "loongarch64"
1011
))]
1112
use heim_common::prelude::TryFutureExt;
1213
use heim_runtime as rt;
@@ -54,7 +55,8 @@ where
5455
target_arch = "arm",
5556
target_arch = "aarch64",
5657
target_arch = "powerpc",
57-
target_arch = "powerpc64"
58+
target_arch = "powerpc64",
59+
target_arch = "loongarch64"
5860
))]
5961
pub async fn detect_vm_device_tree() -> Result<Virtualization, ()> {
6062
hypervisor(HYPERVISOR_COMPAT_PATH)
@@ -66,7 +68,8 @@ pub async fn detect_vm_device_tree() -> Result<Virtualization, ()> {
6668
target_arch = "arm",
6769
target_arch = "aarch64",
6870
target_arch = "powerpc",
69-
target_arch = "powerpc64"
71+
target_arch = "powerpc64",
72+
target_arch = "loongarch64"
7073
)))]
7174
pub async fn detect_vm_device_tree() -> Result<Virtualization, ()> {
7275
Err(())

heim-virt/src/sys/linux/dmi.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ use crate::Virtualization;
66
target_arch = "x86",
77
target_arch = "x86_64",
88
target_arch = "arm",
9-
target_arch = "aarch64"
9+
target_arch = "aarch64",
10+
target_arch = "loongarch64"
1011
))]
1112
pub async fn detect_vm_dmi() -> Result<Virtualization, ()> {
1213
let probe_files = vec![
@@ -43,7 +44,8 @@ pub async fn detect_vm_dmi() -> Result<Virtualization, ()> {
4344
target_arch = "x86",
4445
target_arch = "x86_64",
4546
target_arch = "arm",
46-
target_arch = "aarch64"
47+
target_arch = "aarch64",
48+
target_arch = "loongarch64"
4749
)))]
4850
pub async fn detect_vm_dmi() -> Result<Virtualization, ()> {
4951
Err(())

0 commit comments

Comments
 (0)