mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-19 09:00:54 +00:00
implement retry on SPIM failure
somehow, the retry still *fails* - to be looked into in the future
This commit is contained in:
parent
265805ac94
commit
d78899ca74
2 changed files with 32 additions and 17 deletions
|
|
@ -42,4 +42,4 @@ oom-doom = []
|
||||||
|
|
||||||
debug-print = []
|
debug-print = []
|
||||||
debug-verbose = []
|
debug-verbose = []
|
||||||
default = []
|
default = ["debug-print"]
|
||||||
|
|
|
||||||
|
|
@ -521,22 +521,37 @@ fn swap_handler(
|
||||||
// safety: this is only safe because the pointer we're passed from the kernel is guaranteed to be
|
// safety: this is only safe because the pointer we're passed from the kernel is guaranteed to be
|
||||||
// a valid u8-page in memory
|
// a valid u8-page in memory
|
||||||
let buf = unsafe { core::slice::from_raw_parts_mut(vaddr_in_swap as *mut u8, PAGE_SIZE) };
|
let buf = unsafe { core::slice::from_raw_parts_mut(vaddr_in_swap as *mut u8, PAGE_SIZE) };
|
||||||
match ss.hal.decrypt_swap_from(
|
// this is in a retry loop because the SPIM interface can timeout during high bus congestion
|
||||||
buf,
|
// periods.
|
||||||
ss.sct.counts[paddr_in_swap / PAGE_SIZE],
|
const TIMEOUT_RETRIES: usize = 3;
|
||||||
paddr_in_swap,
|
let mut retries = 0;
|
||||||
vaddr_in_pid,
|
while retries < TIMEOUT_RETRIES {
|
||||||
pid,
|
match ss.hal.decrypt_swap_from(
|
||||||
) {
|
buf,
|
||||||
Ok(_) => {}
|
ss.sct.counts[paddr_in_swap / PAGE_SIZE],
|
||||||
Err(e) => {
|
paddr_in_swap,
|
||||||
writeln!(
|
vaddr_in_pid,
|
||||||
DebugUart {},
|
pid,
|
||||||
"Decryption error: swap image corrupted, the tag does not match the data! {:?}",
|
) {
|
||||||
e
|
Ok(_) => {
|
||||||
)
|
break;
|
||||||
.ok();
|
}
|
||||||
panic!("Decryption error: swap image corrupted, the tag does not match the data!");
|
Err(e) => {
|
||||||
|
retries += 1;
|
||||||
|
writeln!(
|
||||||
|
DebugUart {},
|
||||||
|
"Decryption error: swap image corrupted, the tag does not match the data! {:?} (try {}/{})",
|
||||||
|
e,
|
||||||
|
retries,
|
||||||
|
TIMEOUT_RETRIES
|
||||||
|
)
|
||||||
|
.ok();
|
||||||
|
if retries >= TIMEOUT_RETRIES {
|
||||||
|
panic!(
|
||||||
|
"Decryption error: swap image corrupted, the tag does not match the data; retry count exceeded!"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// at this point, the `buf` has our desired data, we're done, modulo updating the count.
|
// at this point, the `buf` has our desired data, we're done, modulo updating the count.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue