Commit graph

10340 commits

Author SHA1 Message Date
bunnie
76c1f9cb55 fix debug in precursor configs 2024-05-05 16:31:57 +08:00
bunnie
ad4f05bed5 fix address ordering bug; cleanup chip select timing 2024-05-05 16:31:21 +08:00
bunnie
0a3375722b add an experimental routine to try and print the exception vector
this is in the loader and only valid for the cramium-soc target.
2024-05-05 16:30:45 +08:00
bunnie
f2c877b7f7 add a sanity check around the aes patch
because we're doing shenanigans that we shouldn't be doing,
I think a sanity check on the environment is in order.
2024-05-05 16:28:33 +08:00
bunnie
02640db931 commit the other half of the AES patch
this creates a feature flag for cramium-soc targets. This
should be unset for builds that don't target cramium-soc,
and this discipline is managed by xtask.
2024-05-05 16:20:50 +08:00
bunnie
70ec91d917 work around broken AES accelerator in MPW silicon
Haven't dug into it, but the AES instruction is not working
correctly in MPW cramium target silicon. There isn't a great way
to selectively disable hardware acceleration for sub-targets of
patched crates. So, as a work-around, we use xtask to patch
the default arguments of the AES crate, just for cramium-soc
targets, to use software emulated AES. This allows us to move
on with bring-up. To wit, there is another AES accelerator
on-chip that could be much faster than RV32 AES acceleration
(and with better DPA characteristics), and to use that option,
we might have to use a patch like this anyways, because Rust
doesn't have a good way to pass feature flags through patched
crates like this.
2024-05-05 16:18:38 +08:00
bunnie
bb4b01b04b facilitate access for debug access to CSR by adding riscv package 2024-05-05 03:28:13 +08:00
bunnie
f510616e99 remove spim-test from boot since it's already done by swapper 2024-05-05 03:27:47 +08:00
bunnie
64f5531ae6 fix dummy cycle bug on SPIM flash read
bus is running at 50MHz (or less!), so we can use the shortest
dummy cycling
2024-05-05 03:27:01 +08:00
bunnie
82be129df1 fix typo 2024-05-05 03:26:21 +08:00
bunnie
5fa955f507 fix typo, enforce alignment on the RawPage structure
I think i recall somewhere that an alignment of 16 is required
for certain structures in Rust for the RV32 target; since anything
could be put in there, let's enforce that.
2024-05-05 03:25:08 +08:00
bunnie
7ebfdf3ecd shorten boot wait 2024-05-05 03:24:50 +08:00
bunnie
a0aeaae106 issue command to exit quad mode, in quad mode
if not in quad mode, command is ignored; but without this,
the command is never accepted if you are in quad mode.

the idea is you use this to reset the chip when you don't
know what mode it's in.
2024-05-05 03:23:37 +08:00
bunnie
62d16bb77f fix minor bugs 2024-05-04 22:07:16 +08:00
bunnie
dbd33ad220 don't commit the redacted fonts section
this is just for very early bringup to reduce blob size
and improve cycle time for experimentation.
2024-05-04 21:45:03 +08:00
bunnie
1f37d48ec8 add dependencies for swapper 2024-05-04 21:41:51 +08:00
bunnie
829ac28072 fixes for cramium target 2024-05-04 21:41:38 +08:00
bunnie
d3bbe54da7 convert cramium target to use swap 2024-05-04 21:41:15 +08:00
bunnie
61b781892e fixes for cramium target 2024-05-04 21:41:01 +08:00
bunnie
4db82e01d8 retrieve tid as well as pid when invoking swapper 2024-05-04 02:01:56 +08:00
bunnie
feefb57791 cleanup some debug output 2024-05-04 02:01:38 +08:00
bunnie
09b2b29074 remember tid for swap-read; do PID dance for resume abstraction
We want to use the finish_callback_and_resume() function because
it's well-tested and sets up everything just right, but it expects
that we're coming from another process. Unfortunately, in the
middle of all of this, we need to map a page back into the
destination process' memory space, so we end up starting from
the swapper's memory space, changing into the destination process'
memory space, then mapping the page, then changing back into
the swapper's memory space, then using the finish_callback_and_resume()
call.

I think the impact might not be *that* bad, mainly it's a TLB
miss and the PTW isn't super bad, and this comes after a disastrously
expensive decrypt-from-RAM operation -- so probably not worth it
to angonize over optimizing this bit at this point, and stick
with well-tested primitives.
2024-05-04 01:54:23 +08:00
bunnie
87e32687f1 allow xous-susres to function with swap enabled
the reason we're doing this is because the pre-emption timer
lives in this crate too. We don't (can't!) suspend/resume
with swap (yet!) but the pre-emption timer got stuck in susres
so it can be directly turned off without message passing/context
switching during the suspend and resume ops.
2024-05-04 01:50:13 +08:00
bunnie
978dd1bf38 cleanup warnings 2024-05-04 01:49:59 +08:00
bunnie
9cc80ccfb5 change timeout because i'm impatient 2024-05-04 01:47:06 +08:00
bunnie
f85f1a07f3 reserve ifram locs for swap and/or app uart 2024-05-04 01:46:38 +08:00
bunnie
a6a3d29836 more warning cleanup, moving around app_uart visbility part 2 2024-05-04 01:46:05 +08:00
bunnie
721129781a cleanup some warnings 2024-05-04 01:45:36 +08:00
bunnie
0b63979614 fix visibility of app uart for cramium config 2024-05-04 01:45:10 +08:00
bunnie
c5af025bb2 rework swap args for testing 2024-05-04 01:44:49 +08:00
bunnie
100e27db42 first block retrieval from swap in userspace now decrypting
that's a good, solid step forward. now need to figure out why
renode crashes after this starts working (o_O);;
2024-05-03 18:48:03 +08:00
bunnie
57bbc4b2e5 move debug into a separate file
also create a cramium debug target
2024-05-03 18:47:21 +08:00
bunnie
e3c244f48b add option for app-uart setup by loader 2024-05-03 18:46:33 +08:00
bunnie
8f0634845e add more userspace maps for loader-managed swap maps 2024-05-03 18:46:11 +08:00
bunnie
228558a722 add platform specific hw inits & key retrieval
- swap session key has to be stored so we can pass it on to
the kernel to access swap

- setup all PT maps necessary for swapper to be functional
before the swapper is started.

This is to break circular dependencies mapping pages inside the
swapper, especially during boot.

We might also need to statically map the LRU swap count structure,
not sure. We'll burn that bridge when we get there, right now,
let's just get a non count-managed swap even working...
2024-05-03 18:43:57 +08:00
bunnie
ef6a73d329 use the correct session key for swap ram
and also call platform-specific swap init
2024-05-03 18:43:19 +08:00
bunnie
085c31d378 add virtual memory map for the IFRAM access on the SPIM block 2024-05-03 16:11:05 +08:00
bunnie
ce20fdff8b refactor the swapper to absorb the HALs developed for the loader
Remove the stand-in swapper functions we put in...oh god, so many
weeks, months ago...and replace it with actual battle-tested APIs
from the loader.
2024-05-03 16:05:58 +08:00
bunnie
f708322a1e reserve the swap IFRAM buffer in the HAL. 2024-05-03 16:05:20 +08:00
bunnie
d434e70075 move the IFRAM specifiers to a more public location
The IFRAM allocation used by the loader is now exposed so
we can pick it up and use it in the actual HAL implementation
in usermode.
2024-05-03 16:04:37 +08:00
bunnie
c8d4123ed7 fix the debug printout to walk the virtual addresses in swap PT
The check of mapping sanity happens after the VA mapping, so this
undoes that. I think this is a good idea, because we're also
checking the PA->VA mapping of the PTEs as well now.
2024-05-03 16:03:14 +08:00
bunnie
be98a88a75 patch PTEs mapped to swapper with virtual addresses
The addresses put into the swapper's page table are physical
addresses, which are unusable by the swapper itself. This
patches the PTEs with the repsective virtual address, so we
don't have to do a PT walk inside the swapper when handling
a swap event.

Also fix an off-by-one on the processes count. This is sort of
an old architectural bug in the loader that would be nice to fix
someday.
2024-05-03 16:01:25 +08:00
bunnie
edf3e84fad reflect the dependency in the lockfile 2024-05-02 22:19:18 +08:00
bunnie
8ef3692bf5 make the loader a depedency of the swapper 2024-05-02 22:19:09 +08:00
bunnie
1bac53686c big refactor of the swapper
- debug UART is now a static object. Less safe, kinda gross, but
gets us debug access at any time! Probably fine, because once we
turn off the feature all taht ugliness goes away.

- use memory mapped structures for initialization of the swapper state
2024-05-02 22:18:01 +08:00
bunnie
433cc7dfb7 add platform dependent implementations
this allows us to get rid of traits. woo!
2024-05-02 22:16:55 +08:00
bunnie
b4d1b4e5bb add swap lib interface to loader
for use by the swapper
2024-05-02 22:15:32 +08:00
bunnie
67685db741 create the SwapSpec structure and mappings 2024-05-02 22:14:58 +08:00
bunnie
cd43157d1e refactor loader mac accessor interfaces
traits are kind of awful in Rust...it's true, they don't
know how big they are at compile time, so they have to be dyn,
reference, lifetimes, etc...

lot of baggage for a static structure. I guess there's probably
some idk bounds I could put on the traits to make it less poopy
but also just as easy to make it a static structure and not deal
with traits.
2024-05-02 22:13:11 +08:00
bunnie
51dd3b897b map arguments and rpt into loader memory space
this allows us to avoid the dance of getting args/values back
on boot through a syscall
2024-05-02 22:12:07 +08:00