Commit graph

8564 commits

Author SHA1 Message Date
bunnie
788efb3056 cleanup dirty-bit attempt to track pages 2025-05-18 04:23:20 +08:00
bunnie
3f3f64788c intermediate config on baosec target for debugging the flash writing 2025-05-17 16:30:06 +08:00
bunnie
0bf3366911 attempted cleanup on the sync api to improve the race condition
unfortunately this doesn't get us all the way there. There
is always a chance that the call that marks a page as dirty
is not coupled closely enough to the actual update of the page
data. Without actual hardware support for this we can't use this
approach.
2025-05-17 16:28:57 +08:00
bunnie
7cad369a82 test cases for flash writing on real hardware
reading works fine

writing is still a work in progress.
2025-05-17 16:28:24 +08:00
bunnie
3a8e00eb3c map in the SPIM FLASH IFRAM pages to the swapper 2025-05-17 16:28:02 +08:00
bunnie
1a5a0a1388 attempt to fix race conditions is dirty/flush loop in swapper
this ultimately failed, we're going to try a different approach
2025-05-17 16:27:17 +08:00
bunnie
979ce7a589 add missing args to flush syscall 2025-05-17 16:26:51 +08:00
bunnie
d5d5f8bb74 lockfile changes due to prior commit 2025-05-16 19:18:46 +08:00
bunnie
5db2b3449e remove unused "spinor" implementation now that access is delegated to swapper
the explicity "spinor" interface is no longer needed (or even
compatible!) because we now have the swap-mapped spinor layer

the main concern I have at this point is there is a potential race
condition between marking a page as dirty and when the data is actually
updated on the page. Some locking might be necessary to fix this,
but possibly it might be sufficient just to mark a page as dirty
immediately before it's written?

another option might be to handle the writes in an interrupt context
so that the write data + dirty mark are atomic. Need to think about
this a bit.
2025-05-16 19:16:20 +08:00
bunnie
ca61545ad4 implement syscall wrappers for marking dirty and sync of flash 2025-05-16 19:13:20 +08:00
bunnie
724b2b7c86 update deps is lockfile for swapper changes 2025-05-16 19:11:20 +08:00
bunnie
b86612f614 implement WriteToFlash on the kernel side 2025-05-16 19:11:05 +08:00
bunnie
75073aab99 add functions for marking pages as dirty in the RPT
this is what ultimately allows us to decide whether or not a
page can be flushed from memory safely
2025-05-16 19:09:53 +08:00
bunnie
432c2a528e implement dealloc dirty and write to flash
These routines provide for two types of behaviors:

1. deallocating dirty pages. Here, pages are unmapped from RAM
after they are committed to FLASH.

2. write dirty pages to flash. Here, pages are kept mapped in RAM
for future use, but the dirty bit is cleared. This allows the
pages to be quickly released in case of memory pressure.
2025-05-16 19:07:07 +08:00
bunnie
5e2472fa7f add dummy routines so code compiles for precursor target 2025-05-16 19:06:40 +08:00
bunnie
c68d8b1a77 prelim take at a HAL for cramium targets for flash read/write 2025-05-16 19:06:17 +08:00
bunnie
22a72125bd add precursor-hal to dependencies for xous-swapper 2025-05-16 19:05:52 +08:00
bunnie
7533e09f70 move swap abi into lib section; add syscall wrappers for dirty/sync 2025-05-16 19:05:09 +08:00
bunnie
3f96f876c7 more renode tests for flash access 2025-05-16 19:04:30 +08:00
bunnie
e47ed41726 add some prelim test routines for flash access 2025-05-16 19:04:12 +08:00
bunnie
3872ae2a1c fix comment typo 2025-05-16 19:03:56 +08:00
bunnie
450c9153f2 fix usage comments on ifram allocation for flash 2025-05-16 19:03:28 +08:00
bunnie
250bf4553e add routines for manipulating the dirty field 2025-05-16 19:03:02 +08:00
bunnie
769616e266 fix the FLG_DIRTY field so that it's not sitting in the PID area 2025-05-16 19:02:37 +08:00
bunnie
230c577af0 update progress 2025-05-15 11:58:44 +08:00
bunnie
e34dbb4e6f implement a demonstration of successful map decoding of the spi flash request
this just puts dummy data in, next set of commits will do "live"
ROM access.
2025-05-15 11:58:03 +08:00
bunnie
2c90103fd8 update the renode-swap config for bringup of the spi flash map 2025-05-15 11:57:15 +08:00
bunnie
148679af42 more constants location cleanup 2025-05-15 11:56:51 +08:00
bunnie
409e381c2d fix some bit-rotted constants in xous-swapper debug 2025-05-15 11:56:28 +08:00
bunnie
b962bfe26d add some test code for spi flash mapping
this is just to facilitate renode-based testing
2025-05-15 11:55:25 +08:00
bunnie
c8b3fa9aad if swap is turned on bodge a extra page buffer on the memory clear
this prevents some key loader constants from being zeroed out
2025-05-15 11:54:26 +08:00
bunnie
75fbcd5be8 fix some bit-rotted constant locations in the precursor target 2025-05-15 11:54:02 +08:00
bunnie
b8c30c32ac fix bug where pages were not marked as belonging to USER
it's assumed the kernel would never want to access the flash
directly, so no mode is implemented to support this possibility.
2025-05-15 11:52:41 +08:00
bunnie
3f0b833b90 add swapped flag to flag translation 2025-05-15 11:51:53 +08:00
bunnie
170285468d update dependency hashes 2025-05-11 15:50:18 +08:00
bunnie
59bdc08075 commit pins 2025-05-11 15:41:17 +08:00
bunnie
e2379821e6 republish xous-rs to fix cargo test 2025-05-11 15:36:17 +08:00
bunnie
041369b059 add missing defines to the arch target of test/mem.rs 2025-05-11 15:34:30 +08:00
bunnie
c0b6965adc update pins 2025-05-11 15:06:54 +08:00
bunnie
8a4959056b bump version for xous crate update - commit so we can publish crates 2025-05-11 14:45:24 +08:00
bunnie
ed345ba4d7 cleanup dependency hacks from debbuging pddb issue 2025-05-11 14:42:26 +08:00
bunnie
6d858e9fce cleanup out of place/duplicated constant definitions 2025-05-11 14:42:08 +08:00
bunnie
28793c2d71 remove legacy dependency 2025-05-11 14:41:51 +08:00
bunnie
f76dd23067 fix weird PDDB dependency issue
more of a work-around than anything else. the observation is
the PDDB_A* series of constants aren't used outide of the crate
for gen2-targets and so we just remove it as a dependency in
the lib.rs side of things.

This clears up the cargo error we're getting. still don't know
why the dependency tree is not working for that particular target,
but someone is pulling a pddb dependency and it's not obvious who.
2025-05-11 14:40:19 +08:00
bunnie
fbcb59c69e migrations applied to pddb
still broken, there is a weird dependency problem on
board-baosec target that is still to be debugged, but
wanted to get everything committed so i can try bigger
experiments without losing state
2025-05-11 12:59:00 +08:00
bunnie
7af009be78 migrations for moving constants out of xous-rs/kernel and into board/platform
this is a fairly major re-org of where key constants go that
define platform features. things that were in xous-rs that were
platform specific (namely precursor) were moved into a boards file,
and things that are generic to the system (like PAGE_SIZE) are moved
to a public location in xous-rs::arch.
2025-05-11 12:50:02 +08:00
bunnie
63e4319314 add partial support for memory mapped flash (alloc virt without phys backing) 2025-05-11 12:49:23 +08:00
bunnie
f5315dc014 incorporate partial support for virtual-only alloc swap into kernel
also has migrations for constant locations
2025-05-11 12:46:56 +08:00
bunnie
52ee66e1a5 migrate kernel-to-board platform constants for swapper 2025-05-11 12:46:01 +08:00
bunnie
805ebd22a3 revert a couple things that were not meant to be committed 2025-05-11 12:45:29 +08:00