Skip to content

Commit 7a91895

Browse files
committed
fix(prototyper): temporarily remove pmpm module in prototyper; will be added back in the future
Signed-off-by: Zhouqi Jiang <[email protected]>
1 parent 95f169d commit 7a91895

File tree

7 files changed

+3
-246
lines changed

7 files changed

+3
-246
lines changed

prototyper/prototyper/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ rustsbi = { version = "0.4.0", features = [
2121
sbi-spec = { version = "0.0.8", features = [
2222
"legacy",
2323
], path = "../../library/sbi-spec" }
24-
pmpm = { version = "0.0.0", path = "../../library/pmpm" }
2524
serde = { version = "1.0.202", default-features = false, features = ["derive"] }
2625
aclint = { git = "https://github.com/rustsbi/aclint", rev = "b2136a66" }
2726
fast-trap = { git = "https://github.com/rustsbi/fast-trap", rev = "8d855afa", features = ["riscv-m"] }

prototyper/prototyper/src/firmware/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ cfg_if::cfg_if! {
1111
}
1212
}
1313

14-
use crate::fail;
1514
use alloc::{format, vec};
1615
#[allow(unused)]
1716
use core::arch::{asm, naked_asm};
18-
use core::{ops::Range, usize};
17+
use core::ops::Range;
18+
19+
use crate::fail;
1920

2021
use riscv::register::mstatus;
2122
use serde::Serialize;

prototyper/prototyper/src/sbi/hart_context.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use crate::sbi::features::HartFeatures;
22
use crate::sbi::features::PrivilegedVersion;
33
use crate::sbi::hsm::HsmCell;
4-
use crate::sbi::pmpm::PmpSyncCell;
54
use crate::sbi::rfence::RFenceCell;
65
use core::ptr::NonNull;
76
use core::sync::atomic::AtomicU8;
@@ -19,8 +18,6 @@ pub(crate) struct HartContext {
1918
pub hsm: HsmCell<NextStage>,
2019
/// Remote fence synchronization cell.
2120
pub rfence: RFenceCell,
22-
/// PMP synchronization cell.
23-
pub pmpsync: PmpSyncCell,
2421
/// Type of inter-processor interrupt pending.
2522
pub ipi_type: AtomicU8,
2623
/// Supported hart features.

prototyper/prototyper/src/sbi/ipi.rs

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use crate::riscv::csr::stimecmp;
44
use crate::riscv::current_hartid;
55
use crate::sbi::features::{Extension, hart_extension_probe};
66
use crate::sbi::hsm::remote_hsm;
7-
use crate::sbi::pmpm;
87
use crate::sbi::rfence;
98
use crate::sbi::trap_stack::hart_context;
109
use alloc::boxed::Box;
@@ -17,8 +16,6 @@ use spin::Mutex;
1716
pub(crate) const IPI_TYPE_SSOFT: u8 = 1 << 0;
1817
/// IPI type for memory fence operations.
1918
pub(crate) const IPI_TYPE_FENCE: u8 = 1 << 1;
20-
/// IPI type for PMP configuration synchronization.
21-
pub(crate) const IPI_TYPE_PMP: u8 = 1 << 2;
2219

2320
/// Trait defining interface for inter-processor interrupt device
2421
#[allow(unused)]
@@ -194,59 +191,6 @@ impl SbiIpi {
194191
SbiRet::success(0)
195192
}
196193

197-
/// Send IPI for PMP configuration synchronous.
198-
pub fn send_ipi_by_pmpsync(&self, ctx: pmpm::PmpSyncContext) -> SbiRet {
199-
let mut hart_mask = hart_mask_clear(HartMask::all(), current_hartid());
200-
201-
for hart_id in 0..=self.max_hart_id {
202-
if !hart_mask.has_bit(hart_id) {
203-
continue;
204-
}
205-
206-
// There are 2 situation to return invalid_param:
207-
// 1. We can not get hsm, which usually means this hart_id is bigger than MAX_HART_ID.
208-
// 2. BOARD hasn't init or this hart_id is not enabled by device tree.
209-
// In the next loop, we'll assume that all of above situation will not happened and
210-
// directly send ipi.
211-
let Some(hsm) = remote_hsm(hart_id) else {
212-
return SbiRet::invalid_param();
213-
};
214-
215-
if unsafe {
216-
PLATFORM
217-
.info
218-
.cpu_enabled
219-
.is_none_or(|list| list.get(hart_id).is_none_or(|res| !(*res)))
220-
} {
221-
return SbiRet::invalid_param();
222-
}
223-
224-
if !hsm.allow_ipi() {
225-
hart_mask = hart_mask_clear(hart_mask, hart_id);
226-
}
227-
}
228-
229-
let sender = pmpm::local_pmpctx().unwrap();
230-
// Send fence operations to target harts
231-
for hart_id in 0..=self.max_hart_id {
232-
if !hart_mask.has_bit(hart_id) {
233-
continue;
234-
}
235-
sender.add();
236-
if let Some(receiver) = pmpm::remote_pmpctx(hart_id) {
237-
receiver.set(ctx);
238-
if set_ipi_type(hart_id, IPI_TYPE_PMP) == 0 {
239-
self.set_msip(hart_id);
240-
}
241-
}
242-
}
243-
244-
// Wait for all hart complete handle
245-
while !sender.is_sync() {}
246-
247-
SbiRet::success(0)
248-
}
249-
250194
/// Get lower 32 bits of machine time.
251195
#[inline]
252196
pub fn get_time(&self) -> usize {

prototyper/prototyper/src/sbi/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ pub mod fifo;
1414
pub mod hart_context;
1515
pub mod heap;
1616
pub mod logger;
17-
pub mod pmpm;
1817
pub mod trap;
1918
pub mod trap_stack;
2019

prototyper/prototyper/src/sbi/pmpm.rs

Lines changed: 0 additions & 178 deletions
This file was deleted.

prototyper/prototyper/src/sbi/trap/handler.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use crate::riscv::current_hartid;
1010
use crate::sbi::console;
1111
use crate::sbi::hsm::local_hsm;
1212
use crate::sbi::ipi;
13-
use crate::sbi::pmpm;
1413
use crate::sbi::pmu::pmu_firmware_counter_increment;
1514
use crate::sbi::rfence;
1615

@@ -46,10 +45,6 @@ pub fn msoft_ipi_handler() {
4645
if (ipi_type & ipi::IPI_TYPE_FENCE) != 0 {
4746
rfence::rfence_handler();
4847
}
49-
// Handle PMP synchronous operation.
50-
if (ipi_type & ipi::IPI_TYPE_PMP) != 0 {
51-
pmpm::pmpsync_handler();
52-
}
5348
}
5449

5550
#[inline]

0 commit comments

Comments
 (0)