fix(xen): arm64 is currently unsupported, treat it as such at runtime

This commit is contained in:
Alex Zenla 2024-06-20 17:15:37 -07:00
parent 089c9cbff9
commit 11a34d4834
No known key found for this signature in database
GPG Key ID: 067B238899B51269
5 changed files with 99 additions and 9 deletions

View File

@ -7,7 +7,7 @@ use log::error;
use loopdev::LoopControl;
use tokio::sync::Semaphore;
use uuid::Uuid;
use xenclient::{x86pv::X86PvPlatform, XenClient};
use xenclient::XenClient;
use xenstore::{XsdClient, XsdInterface};
use self::{
@ -21,7 +21,11 @@ pub mod channel;
pub mod ip;
pub mod launch;
type RuntimePlatform = X86PvPlatform;
#[cfg(target_arch = "x86_64")]
type RuntimePlatform = xenclient::x86pv::X86PvPlatform;
#[cfg(not(target_arch = "x86_64"))]
type RuntimePlatform = xenclient::unsupported::UnsupportedPlatform;
pub struct GuestLoopInfo {
pub device: String,

View File

@ -270,7 +270,6 @@ impl Default for CreateDomain {
CreateDomain {
ssidref: SECINITSID_DOMU,
handle: Uuid::new_v4().into_bytes(),
#[cfg(target_arch = "x86_64")]
flags: 0,
iommu_opts: 0,
max_vcpus: 1,
@ -453,8 +452,8 @@ impl Default for VcpuGuestContextFpuCtx {
#[repr(C)]
#[derive(Copy, Clone, Debug, Default)]
#[cfg(target_arch = "x86_64")]
pub struct CpuUserRegs {
#[allow(non_camel_case_types)]
pub struct x8664CpuUserRegs {
pub r15: u64,
pub r14: u64,
pub r13: u64,
@ -493,7 +492,6 @@ pub struct CpuUserRegs {
#[repr(C)]
#[derive(Copy, Clone, Debug, Default)]
#[cfg(target_arch = "x86_64")]
pub struct TrapInfo {
pub vector: u8,
pub flags: u8,
@ -507,7 +505,7 @@ pub struct TrapInfo {
pub struct x8664VcpuGuestContext {
pub fpu_ctx: VcpuGuestContextFpuCtx,
pub flags: u64,
pub user_regs: CpuUserRegs,
pub user_regs: x8664CpuUserRegs,
pub trap_ctx: [TrapInfo; 256],
pub ldt_base: u64,
pub ldt_ents: u64,
@ -602,7 +600,7 @@ pub struct Arm64CpuUserRegs {
#[derive(Copy, Clone, Debug, Default)]
pub struct Arm64VcpuGuestContext {
pub flags: u32,
pub user_regs: CpuUserRegs,
pub user_regs: x8664CpuUserRegs,
pub sctlr: u64,
pub ttbcr: u64,
pub ttbr0: u64,

View File

@ -71,7 +71,6 @@ impl BootDomain {
pfn: self.pfn_alloc_end,
addr: 0,
size,
#[cfg(target_arch = "x86_64")]
pages,
};

View File

@ -27,6 +27,9 @@ use xenstore::{
};
pub mod pci;
pub mod unsupported;
#[cfg(target_arch = "x86_64")]
pub mod x86pv;
#[derive(Clone)]

View File

@ -0,0 +1,86 @@
use xencall::sys::CreateDomain;
use crate::{
boot::{BootDomain, BootSetupPlatform, DomainSegment},
error::Result,
};
#[derive(Default, Clone)]
pub struct UnsupportedPlatform;
impl UnsupportedPlatform {
pub fn new() -> Self {
Self {}
}
}
#[async_trait::async_trait]
impl BootSetupPlatform for UnsupportedPlatform {
fn create_domain(&self) -> CreateDomain {
panic!("unsupported platform")
}
fn page_size(&self) -> u64 {
panic!("unsupported platform")
}
fn page_shift(&self) -> u64 {
panic!("unsupported platform")
}
fn needs_early_kernel(&self) -> bool {
panic!("unsupported platform")
}
fn hvm(&self) -> bool {
panic!("unsupported platform")
}
async fn initialize_early(&mut self, _: &mut BootDomain) -> Result<()> {
panic!("unsupported platform")
}
async fn initialize_memory(&mut self, _: &mut BootDomain) -> Result<()> {
panic!("unsupported platform")
}
async fn alloc_p2m_segment(&mut self, _: &mut BootDomain) -> Result<Option<DomainSegment>> {
panic!("unsupported platform")
}
async fn alloc_page_tables(&mut self, _: &mut BootDomain) -> Result<Option<DomainSegment>> {
panic!("unsupported platform")
}
async fn setup_page_tables(&mut self, _: &mut BootDomain) -> Result<()> {
panic!("unsupported platform")
}
async fn setup_hypercall_page(&mut self, _: &mut BootDomain) -> Result<()> {
panic!("unsupported platform")
}
async fn alloc_magic_pages(&mut self, _: &mut BootDomain) -> Result<()> {
panic!("unsupported platform")
}
async fn setup_shared_info(&mut self, _: &mut BootDomain, _: u64) -> Result<()> {
panic!("unsupported platform")
}
async fn setup_start_info(&mut self, _: &mut BootDomain, _: u64) -> Result<()> {
panic!("unsupported platform")
}
async fn bootlate(&mut self, _: &mut BootDomain) -> Result<()> {
panic!("unsupported platform")
}
async fn vcpu(&mut self, _: &mut BootDomain) -> Result<()> {
panic!("unsupported platform")
}
async fn gnttab_seed(&mut self, _: &mut BootDomain) -> Result<()> {
panic!("unsupported platform")
}
}