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
6 changes: 0 additions & 6 deletions src/arch/aarch64/hypercall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
// Authors:
// ForeverYolo <2572131118@qq.com>

use crate::arch::cpu::this_cpu_id;
use crate::arch::ivc::{IvcInfo, IVC_INFOS};
use crate::config::CONFIG_MAGIC_VERSION;
use crate::cpu_data::this_zone;
Expand Down Expand Up @@ -76,11 +75,6 @@ impl<'a> HyperCall<'a> {
return list_addr;
}

pub fn check_cpu_id(&self) {
let cpuid = this_cpu_id();
trace!("CPU ID: {} Start Zone", cpuid);
}

pub fn hv_virtio_get_irq(&self, _virtio_irq: *mut u32) -> HyperCallResult {
trace!("hv_virtio_get_irq is not need for AArch64");
HyperCallResult::Ok(0)
Expand Down
9 changes: 5 additions & 4 deletions src/arch/aarch64/ipi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,15 @@
//

use crate::device::irqchip::gic_send_event;

pub fn arch_send_event(cpu_id: u64, sgi_num: u64) {
gic_send_event(cpu_id, sgi_num);
}

pub fn arch_notify_event(cpu_id: u64, sgi_num: u64, _event_id: usize, _queue_was_empty: bool) {
arch_send_event(cpu_id, sgi_num);
}

pub fn arch_check_events(event: Option<usize>) {
match event {
_ => {
Expand All @@ -29,7 +34,3 @@ pub fn arch_check_events(event: Option<usize>) {
}
}
}

pub fn arch_prepare_send_event(_cpu_id: usize, _ipi_int_id: usize, _event_id: usize) {
debug!("aarch64 arch_prepare_send_event: do nothing now.")
}
11 changes: 7 additions & 4 deletions src/arch/loongarch64/cpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,18 @@ impl ArchCpu {
for i in 0..32 {
self.ctx.x[i] = 0;
}
// set all zone's GCSR.CPUID to 0 beacuse linux running on it will believe it's CPU0
// - wheatfox 2025.5.20
self.ctx.gcsr_cpuid = 0;
let physical_cpu = this_cpu_data().id;
self.ctx.gcsr_cpuid = this_cpu_data()
.zone
.as_ref()
.and_then(|zone| zone.read().phys_to_guest_cpu(physical_cpu))
.unwrap_or(0);
info!(
"[[CPU virtualization]] CPU{} run@{:#x}",
self.get_cpuid(),
self.ctx.sepc
);
info!("loongarch64: @{:#x?}", self);
debug!("loongarch64: @{:#x?}", self);
// step 1: enable guest mode
// step 2: set guest entry to era
// step 3: run ertn and enter guest mode
Expand Down
14 changes: 0 additions & 14 deletions src/arch/loongarch64/hypercall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@
// Authors:
// ForeverYolo <2572131118@qq.com>

use crate::arch::cpu::this_cpu_id;
use crate::config::HvZoneConfig;
use crate::config::CONFIG_MAGIC_VERSION;
use crate::device::virtio_trampoline::MAX_DEVS;
use crate::hypercall::HyperCall;
use crate::hypercall::HyperCallResult;
impl<'a> HyperCall<'a> {
Expand All @@ -30,13 +28,6 @@ impl<'a> HyperCall<'a> {
HyperCallResult::Ok(0)
}

pub fn wait_for_interrupt(&mut self, irq_list: &mut [u64; MAX_DEVS + 1]) {
use crate::device::irqchip::ls7a2000::*;
let status = GLOBAL_IRQ_INJECT_STATUS.lock();
drop(status);
irq_list[0] = 0; // CAUTION: this is a workaround for loongarch64
}

pub fn hv_zone_config_check(&self, magic_version: *mut u64) -> HyperCallResult {
let magic_version_raw = magic_version as u64;
let magic_version_hva = magic_version_raw | crate::arch::mm::LOONGARCH64_CACHED_DMW_PREFIX;
Expand All @@ -62,11 +53,6 @@ impl<'a> HyperCall<'a> {
return list_addr;
}

pub fn check_cpu_id(&self) {
let cpuid = this_cpu_id();
assert_eq!(cpuid, 0);
}

pub fn hv_virtio_get_irq(&self, virtio_irq: *mut u32) -> HyperCallResult {
trace!("hv_virtio_get_irq is not need for LoongArch64");
HyperCallResult::Ok(0)
Expand Down
Loading
Loading