Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/arch/aarch64/hypercall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ use crate::hypercall::HyperCallResult;
use crate::zone::this_zone_id;

impl<'a> HyperCall<'a> {
pub fn hv_get_ecam_base(&mut self, _ecam_base: *mut u64) -> HyperCallResult {
HyperCallResult::Ok(0)
}

pub fn hv_ivc_info(&mut self, ivc_info_ipa: u64) -> HyperCallResult {
let zone_id = this_zone_id();
let zone = this_zone();
Expand Down
4 changes: 4 additions & 0 deletions src/arch/loongarch64/hypercall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ use crate::device::virtio_trampoline::MAX_DEVS;
use crate::hypercall::HyperCall;
use crate::hypercall::HyperCallResult;
impl<'a> HyperCall<'a> {
pub fn hv_get_ecam_base(&mut self, _ecam_base: *mut u64) -> HyperCallResult {
HyperCallResult::Ok(0)
}

pub fn hv_ivc_info(&mut self, ivc_info_ipa: u64) -> HyperCallResult {
warn!("hv_ivc_info is not implemented for LoongArch64");
HyperCallResult::Ok(0)
Expand Down
4 changes: 4 additions & 0 deletions src/arch/riscv64/hypercall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ use crate::hypercall::HyperCall;
use crate::hypercall::HyperCallResult;

impl<'a> HyperCall<'a> {
pub fn hv_get_ecam_base(&mut self, _ecam_base: *mut u64) -> HyperCallResult {
HyperCallResult::Ok(0)
}

pub fn hv_ivc_info(&mut self, _ivc_info_ipa: u64) -> HyperCallResult {
warn!("hv_ivc_info is not implemented for Risc-V");
HyperCallResult::Ok(0)
Expand Down
12 changes: 12 additions & 0 deletions src/arch/x86_64/hypercall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@ use crate::{
use spin::RwLock;

impl<'a> HyperCall<'a> {
pub fn hv_get_ecam_base(&mut self, ecam_base: *mut u64) -> HyperCallResult {
let ecam_base_pa = self.hv_get_real_pa(ecam_base as u64);
let base = crate::arch::acpi::root_get_config_space_info()
.map(|(base, _)| base as u64)
.unwrap_or(0);
unsafe {
*(ecam_base_pa as *mut u64) = base;
}
debug!("hvisor ecam base: {:#x}", base);
HyperCallResult::Ok(0)
}

pub fn hv_ivc_info(&mut self, ivc_info_ipa: u64) -> HyperCallResult {
warn!("hv_ivc_info is not implemented for x86_64");
HyperCallResult::Ok(0)
Expand Down
2 changes: 2 additions & 0 deletions src/hypercall/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ numeric_enum! {
HvConfigCheck = 6,
HvVirtioPCI = 7,
HvZoneSetBootMode = 8,
HvGetEcamBase = 9,
}
}
pub const SGI_IPI_ID: u64 = 7;
Expand Down Expand Up @@ -105,6 +106,7 @@ impl<'a> HyperCall<'a> {
HyperCallCode::HvConfigCheck => self.hv_zone_config_check(arg0 as *mut u64),
HyperCallCode::HvVirtioPCI => self.hv_virtio_pci(arg0, arg1),
HyperCallCode::HvZoneSetBootMode => self.hv_zone_set_boot_mode(arg0, arg1),
HyperCallCode::HvGetEcamBase => self.hv_get_ecam_base(arg0 as *mut u64),
_ => {
warn!("hypercall id={} unsupported!", code as u64);
Ok(0)
Expand Down
Loading