mirror of
https://github.com/edera-dev/krata.git
synced 2025-08-03 05:10:55 +00:00
fix(x86): use IOMMU only when needed for passthrough
This commit is contained in:
@ -261,7 +261,7 @@ impl<I: BootImageLoader, P: BootSetupPlatform> BootSetup<I, P> {
|
|||||||
|
|
||||||
#[async_trait::async_trait]
|
#[async_trait::async_trait]
|
||||||
pub trait BootSetupPlatform: Clone {
|
pub trait BootSetupPlatform: Clone {
|
||||||
fn create_domain(&self) -> CreateDomain;
|
fn create_domain(&self, needs_passthrough: bool) -> CreateDomain;
|
||||||
fn page_size(&self) -> u64;
|
fn page_size(&self) -> u64;
|
||||||
fn page_shift(&self) -> u64;
|
fn page_shift(&self) -> u64;
|
||||||
fn needs_early_kernel(&self) -> bool;
|
fn needs_early_kernel(&self) -> bool;
|
||||||
|
@ -150,7 +150,7 @@ impl<P: BootSetupPlatform> XenClient<P> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn create(&self, config: &DomainConfig) -> Result<CreatedDomain> {
|
pub async fn create(&self, config: &DomainConfig) -> Result<CreatedDomain> {
|
||||||
let mut domain = self.platform.create_domain();
|
let mut domain = self.platform.create_domain(!config.pcis.is_empty());
|
||||||
domain.max_vcpus = config.max_vcpus;
|
domain.max_vcpus = config.max_vcpus;
|
||||||
let domid = self.call.create_domain(domain).await?;
|
let domid = self.call.create_domain(domain).await?;
|
||||||
match self.init(domid, &domain, config).await {
|
match self.init(domid, &domain, config).await {
|
||||||
|
@ -16,7 +16,7 @@ impl UnsupportedPlatform {
|
|||||||
|
|
||||||
#[async_trait::async_trait]
|
#[async_trait::async_trait]
|
||||||
impl BootSetupPlatform for UnsupportedPlatform {
|
impl BootSetupPlatform for UnsupportedPlatform {
|
||||||
fn create_domain(&self) -> CreateDomain {
|
fn create_domain(&self, _: bool) -> CreateDomain {
|
||||||
panic!("unsupported platform")
|
panic!("unsupported platform")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -434,9 +434,13 @@ impl X86PvPlatform {
|
|||||||
|
|
||||||
#[async_trait::async_trait]
|
#[async_trait::async_trait]
|
||||||
impl BootSetupPlatform for X86PvPlatform {
|
impl BootSetupPlatform for X86PvPlatform {
|
||||||
fn create_domain(&self) -> CreateDomain {
|
fn create_domain(&self, needs_passthrough: bool) -> CreateDomain {
|
||||||
CreateDomain {
|
CreateDomain {
|
||||||
flags: XEN_DOMCTL_CDF_IOMMU,
|
flags: if needs_passthrough {
|
||||||
|
XEN_DOMCTL_CDF_IOMMU
|
||||||
|
} else {
|
||||||
|
0
|
||||||
|
},
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user