Commit graph

58 commits

Author SHA1 Message Date
bunnie
9972291fca prevent future formatting of in-line assembly section 2024-01-14 22:43:34 +08:00
bunnie
c1897a3738 format services/spinor 2024-01-14 22:43:05 +08:00
bunnie
680c8b88c7 fix missing init() methods in hosted mode emulation structures 2023-07-16 18:31:14 +08:00
bunnie
17a13f2aff apply deferred init + Box idiom to spinor 2023-07-16 17:35:01 +08:00
bunnie
5f5e3a2ada don't monitor connection count on spinor block during hosted mode
this makes it a little more flexible to do diagnostics/debugging
in hosted mode. It's not secure, but hosted mode is not meant to be
secure.
2023-05-21 17:19:45 +08:00
Gianguido Sorà
b10a51a3bd spinor: make hosted and non-hosted new() signature the same 2023-04-24 20:19:12 +02:00
bunnie
a63993963b fix ECC status register clearing
have to write the WREN register first!
2023-02-15 22:55:57 +08:00
bunnie
787525fd6d increase cache flush margin
this seems to help #321. At the very least, on my test unit
an image without this crashes fairly reliably, and with this,
it can complete a few tries consecutively without fail
2023-02-14 00:12:27 +08:00
bunnie
89500015a7 try to fix regression from #284
still hitting cache coherence edge cases. expanding the flush
set read by one more way.
2022-12-15 17:52:55 +08:00
bunnie
0c7c90fb78 have the core spinor routines automatically retry on failure
normally we never see these failures, but, as we are seeing
flash wear-out on the CI machine the writes can take
long enough that we get some concurrent requests. As a work-around,
just automatically retry a few times before throwing the error
back to the caller.
2022-10-28 02:55:42 +08:00
bunnie
67fc21fbdd harmonize hosted mode selection, but retain an explicit hosted flag
In general, hosted mode is assumed "by default" if the target
is not Xous. This allows packages to be built cleanly on command
lines that don't know to pass a --feature flag to specify a target.

However, an explicit "hosted" flag is still retained so that we
can confirm the build system intent. This saves us from the failure
mode that we thought we were building for target A, but accidentally
ommitted the flag, and instead we've been silently building for
"hosted" mode without any warning. The main consumer of the "hosted"
flag is now just the build.rs script inside of the utralib.
2022-10-25 17:21:02 +08:00
bunnie
63a4e08a80 uh-oh...saw a CI fail on cache flush again. back to the drawing board. 2022-10-21 03:18:35 +08:00
bunnie
47a6305264 reduce flush to instruction + fence
remove the nops because maybe the bug is fixed in this core version
2022-10-20 13:45:08 +08:00
bunnie
320097a29d toggle out core assembly when soft flush is used 2022-10-20 04:20:03 +08:00
bunnie
c90bbb6276 make the extra buffer flush a feature, so we can experiment more easily 2022-10-19 23:42:19 +08:00
bunnie
4263bfd6b4 clean up the cache flushing, routine; don't use the custom vex instruction
suspect maybe the custom vex routine for cache flush has a subtle
issue, so fall back to first-principles read-region flush.

remove excess calls to flushing as well, turns out we effectively
duplicated the call because it was both in the core patch routine
and outside of it too.
2022-10-19 21:41:59 +08:00
bunnie
78e72e6ef4 re-institute manual cache flushing because we're seeing a CI error triggered by a cache flush failure... 2022-10-09 19:50:19 +08:00
bunnie
97895fd9c9 fix cache coherence issue with FLASH
after updating a piece of FLASH memory, there is an inherent
cache coherence issue. This is because the write happens through
a side channel that is outside of the memory model of the system:
writes happen through a CSR that feed data to pages of FLASH.
Reads happen through direct-mapped memory regions that are unaware
of write mutations.

Thus, after writing a page of memory, if you try to access it,
sometimes you'll read the old cached value instead of the new
updated value.

This patch introduces a mandatory dcache flush after every
FLASH write, so that any cached FLASH regions are re-fetched.
2022-10-07 18:50:51 +08:00
bunnie
4e40ae6c5d move from target selectors to feature selectors for back-ends
This will allow for e.g. xous on riscv32-imac but not a precursor
target, for example: by using feature selectors we get to have
a bigger range of targets that we support, such as for implementations
that haven't been upstreamed or have official target-triples.

The downsides are:

- patch override libraries don't absorb feature flags. so, for
example, the AES crate that is used to patch other crates won't
be aware of the target features without modifying the referencing
crates.

- features are normally meant to be additive, but target features
are mutually exclusive. The mutex is enforced by a check in
utralib that throws a panic on build if two targets are accidentally
selected at the same time.
2022-10-02 02:56:44 +08:00
bunnie
c08bb6a3f9 add notes about the second ECC error reported 2022-07-13 04:43:20 +08:00
bunnie
02c886bf84 attempt to fix-up ECC error by clearing both ECC registers
this doesn't seem to fix it tho, when we hit the error
the chip just returns 0xFF's eternally.
2022-07-13 04:38:06 +08:00
Sean Cross
0dd382b66a Merge branch 'libstd-fs'
Signed-off-by: Sean Cross <sean@xobs.io>
2022-06-27 15:28:27 +08:00
Sean Cross
4410c2a1b3 spinor: add discriminants to api calls
Signed-off-by: Sean Cross <sean@xobs.io>
2022-06-27 15:27:15 +08:00
bunnie
03d13cc758 add the archive log and link for future reference 2022-06-27 15:00:24 +08:00
bunnie
8a63e57862 improve ECC failure reporting on SPINOR
finally saw a failure in the wild, so we have something
to test against.
2022-06-27 14:58:36 +08:00
bunnie
c46579117b add the "trusted init" check to hosted mode
need to debug a problem with the IMEF connecting/disconnecting
causing trusted init to fail when there is more than one
plugin in the system.
2022-06-18 01:30:49 +08:00
Sean Cross
3ae9d8abf0 apps/services: remove xous::xous_main macro usage
This macro will be removed, since it is no longer necessary. Remove this
macro across the project and replace it with a standard `main()`
function.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-05-31 13:33:30 +08:00
bunnie
c503316c3d refactor suspend/resume ordering
Add a "Later" stage, and have exactly one "Last" stage.

"Last" to suspend is the ticktimer -- this is crucial for
basically everything else to work. The other really
low level stuff that needs to work to the last minute is
now in the "Later" bin.
2022-03-30 02:30:39 +08:00
Sean Cross
5402582f97 spinor: fix incorrect ecc write into softirq block
The init code tried to set up the ECC block to report errors by writing
into the softirq block. Correct the block so that it goes into the
spinor block instead.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-02-14 17:32:20 +08:00
bunnie
30910dbd4f add keyboard layout setting and retention
Keyboard setting is "the one and only" exception to user settings
that are saved without encryption. This is because you need your
keyboard layout to be set in order for you to type your password.
Thus, this needed a bit of a special-case to handle its storage record.

We decided to lop off 1 page from the loader and have it store
the keyboard layout code.

Let's hope we can have the discipline to really just store that
one word of information and not later be like "gee wally, you have
a whoooole 4092 unused bytes of space we can cram unencrypted
user settings in, sure would be a waste to not put those use those".
2022-02-03 02:46:37 +08:00
bunnie
827888ccbb fix up the REFCOUNT on connections
Was doing disjoint loads and stores on an Atomic, really, should
be using the fetch_add, fetch_sub variants to be proper.

Didn't seem to impact anything but maybe there's a future version
of me that high fives me for doing this.
2022-01-31 23:13:10 +08:00
bunnie
994e3d7cfb refactor llio crate (phase 1): organize files into sub-systems 2022-01-11 12:02:27 +08:00
bunnie
c5fe1bc99b add sequencing to suspend/resume order of operations
this is necessary because we want to make sure that the SPINOR
service does not shut down before the PDDB service finishes syncing
its disks.
2022-01-10 13:45:56 +08:00
bunnie
489a26dd11 fix an issue where we don't decrement the connection counter on drop 2022-01-05 20:01:54 +08:00
bunnie
3a0dfe5c3b add bulk erase command to accelerate PDDB init 2022-01-04 21:57:47 +08:00
bunnie
dd14dfc4c6 retrofit the seed into an atomicu64 so we can set it elsewhere 2021-12-27 02:49:08 +08:00
bunnie
0bd110c163 determinism achieved for testing. now to squash some bugs. 2021-12-26 01:50:30 +08:00
bunnie
66606ed3e0 initial attempt to make hosted mode more deterministic
replace all threadRng with a seeded Rng
2021-12-25 15:58:27 +08:00
bunnie
56e82f37d3 more thoughts on the pddb.
this is definitely a rough-draft implementation and is going to
need a v2 or v3 to plug all the serious holes.
2021-11-05 03:58:58 +08:00
bunnie
353311b987 fix USB update flow 2021-08-15 16:03:18 +08:00
bunnie
a19fc87687 clean up warnings, and fix some hosted mode issues 2021-08-15 00:46:16 +08:00
bunnie
cf3ed935e7 add staging location lockout and xous-names completion checking 2021-08-10 04:30:45 +08:00
bunnie
bc6ec8caf4 initial key provisioning demo working 2021-08-07 22:21:49 +08:00
bunnie
82aaeb072f gateware HMAC verification now working! 2021-08-06 02:33:52 +08:00
bunnie
68ea69c2ed Merge branch 'bunnie-dev' into main 2021-08-03 17:22:10 +08:00
bunnie
01d6c61bb6 commit before merging main stuff
want to capture in the libstd improvements before we get too much
version drift
2021-08-03 16:54:42 +08:00
Sean Cross
b86e0a65cd services: recognize xous as a hardware OS
Support `xous` as a valid OS. This allows us to build the entire kernel
under this target.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-08-02 18:11:48 +08:00
bunnie
e362e2579f un-break hosted mode 2021-07-18 18:29:24 +08:00
bunnie
d98f296499 fixed ordering bug in spinor driver
works now!
2021-07-18 18:02:46 +08:00
bunnie
7257dbcaef add cache flush after array write 2021-07-18 16:04:44 +08:00