Commit Graph

196 Commits

Author SHA1 Message Date
June Tate-Gans
306d806d4a Merge "handle additional condition syntax in generators"
GitOrigin-RevId: f6b7f62233602191b02becd1d6873a1472b5831a
2022-10-06 18:41:46 +00:00
Sam Leffler
957f429c52 Mark KataOS components for special CAmkES processing.
Mark each component that depends on component.kataos.c features with a
"kataos" attribute.

Change-Id: I7e2e3f9010a7aa717d4fe3dfc2f088cbd1a66488
GitOrigin-RevId: 2967036cf4e70edc3f96d2ead45ecfe9e42fd7fa
2022-10-06 18:41:39 +00:00
Sam Leffler
72faf77df8 DebugConsole: allocate 64 empty CNode slots for test use.
Change-Id: I9bf2053edc81717e42ccbae29c7632225e6985fe
GitOrigin-RevId: 90747a3256ac8e96dabf46548dabf6784a6aba17
2022-10-06 18:41:31 +00:00
Sam Leffler
c0549c75e7 kata-os-model: correct slot calculation for untyped memory handoff
When calculating the landing spot for handing off the UntypedMemory
objects we need to take into account empty slots. Calculate the max
occupied slot # and add one. This works so long as empty slots have
not been allocated (by CAmkES) at the end of the CNode--which should
be safe since we control the MemoryManager CAmkES specification.

Change-Id: I5bfb75bd7134254c4475a91653d54e2aeb126721
GitOrigin-RevId: cf14850894ad21be97ea094f977c3420edf322ab
2022-10-06 18:41:24 +00:00
Sam Leffler
18c7660244 Add MemoryManager service.
The MemoryManager service allocates & frees seL4 objects. Requests can be
batched. Capabilities to dynamically allocated objects are moved in CNode
containers attached to IPC requests.

Specific changes:
- Add new CAmkES MemoryManager component.
- Add api's for allocating & freeing singleton objects (e.g.
  kata_cnode_alloc) and batches of objects (kata_object_alloc &
  kata_object_free).
- Add support to kata-os-rootserver to hand-off UntypedMemory objects
  just before terminating. The objects are placed directly in the
  MemoryManager's top-level CNode and a BootInfo frame is constructed
  that describes where the objects are.
- Switch the rootserver to kata-os-rootserver as the C version lacks
  the UntypedMemory hand-off.
- Add test_bootinfo kata-shell command to dump the MemoryManager BootInfo
  frame contents (broken for now because it directlry references the
  shared page).
- Add test_obj_alloc kata-shell command that exercises the MemoryManager
  singleton and batch api's

While here, did some cleanup of arg handling in kata-shell.

TODO: top-level object allocations use a simplistic capability allocator
TODO: move test_bootinfo to the MemoryManager and add an interface rpc

Change-Id: I778b2d5fe7f2f9b65ee642ff905cf56d4b2b02fd
GitOrigin-RevId: 7fc72d1927bba165234955e68f8b9ad1b556f6fb
2022-10-06 18:41:15 +00:00
Sam Leffler
4e5b8a4423 Merge "sel4-sys: rename arch/riscv.rs in preparation for 64-bit support"
GitOrigin-RevId: cc502e8cbae75e7825050ec37bd585f4d082f9dc
2022-10-06 18:41:08 +00:00
Sam Leffler
3e37996648 Merge "sel4-sys: make seL4_GetCapReceivePath more Rust-friendly"
GitOrigin-RevId: 8a14f93d1f13718784e8377056d50377187f2343
2022-10-06 18:41:01 +00:00
Sam Leffler
c24f1fc9d7 Merge "sel4-sys: add BootInfo serde support"
GitOrigin-RevId: a6191ecf1b2bddbe8c92dbe7d2e5ba0a65824117
2022-10-06 18:40:53 +00:00
Sam Leffler
a4a1ca9556 Merge "sel4-sys: add ObjectType sizing"
GitOrigin-RevId: 6484fdbf5e7fe9c004ed436debffa97bcc84c971
2022-10-06 18:40:46 +00:00
Sam Leffler
0088925a43 Merge "sel4-sys: remove unused files"
GitOrigin-RevId: b335379fb7efe392e1d7f7fbfa6816d8772e73f3
2022-10-06 18:40:38 +00:00
Adam Jesionowski
6ff6c95b3c Use local copies of cpio and xmas-elf crates.
Change-Id: I41ea714291d15caa2187315766322c41ead72e24
GitOrigin-RevId: c7ea56a9216972f51a21a2f59c7ee0987ee7b72d
2022-10-06 18:40:31 +00:00
Sam Leffler
0211cf3a9c Disable LTO for profile.dev when building CAmkES components.
This is a workaround for gdb complaints of the form:

Dwarf Error: Cannot find DIE at 0x5136b referenced from DIE at 0x57eed

Release builds continue to enable LTO.

BUG: 223253186

Change-Id: I137456045e842b2b93b32e0edd348ff916925c97
GitOrigin-RevId: 8ab2ab4fac615eb2a1a259a5a18aa410a4aae5fb
2022-10-06 18:40:25 +00:00
Cindy Liu
f47d252904 kata: vec_core: Update ITCM memory address
To match HW def in
3d05e14abb/hw/top_matcha/data/top_matcha.hjson (749)

Change-Id: I933db00d1e6702fb38544b6641dabcb0d6b6e390
GitOrigin-RevId: 31de9893d54e43db60d000f03561f22d59482ad4
2022-10-06 18:40:16 +00:00
Sam Leffler
4fe71acb97 rust.cmake: fix RELEASE handling
Cmake's list operator operates on the current scope so we were not
setting --release on the cargo cmd line.

Change-Id: I91aa8489869c3190d60c3f2dee374b3d9388ebda
GitOrigin-RevId: 36fa241862c1cb94b736be89d09e8127fefdfc4d
2022-10-06 18:40:08 +00:00
Adam Jesionowski
2749156acf Use read_volatile for reading from vc control
Without read_volatile the compiler may try to optimize reads, which
causes issues with renode simulation.

Change-Id: I8877798420cdecc2dece97d168db753adfe89163
GitOrigin-RevId: c7b3e2ee5500c993b48d9793f575758cb0c3a0ac
2022-10-06 18:40:00 +00:00
Sam Leffler
b584015157 Merge "kata-os-model: fix release build"
GitOrigin-RevId: 4ae1ca568f1cf3c6aac5c7ba975f0ae4d68798be
2022-10-06 18:39:52 +00:00
Marcin Witkowski
18474970dc processmanager: use rx_fifo_level in OpenTitanUARTDriver
Use RX_FIFO_LEVEL additionally to RX_EMPTY. This improves
performance a bit, as RX_EMPTY register and circular buffer
status don't have to be read for every byte.

Change-Id: Ib56b4c6a0dc5689b63941b449f476f3555421abb
GitOrigin-RevId: f7a46154afaf5be28feab173687cebd8b584e8f4
2022-10-06 18:39:45 +00:00
Sam Leffler
8961c75d25 Merge changes from topic "kata-os-rootserver"
* changes:
  capdl: calculate space used by a specification
  kata-os-model: fix MCS support
  kata-os-model: mark RISC-V non-executable pages with the NX bit
  kata-os-model: simplify & shrink page frame fills
  kata-os-model: merge vspace root collection into object creation
  kata-os-model: rust version of capdl-loader-app internals

GitOrigin-RevId: 44208d281ea021a671c90dc650389029baf9243e
2022-10-06 18:39:37 +00:00
Adam Jesionowski
3f121414ea Fix seL4 slowdown by increasing ELF space.
In order to allocate a frame for the ELF, the seL4 object creation
routine scans through addresses, allocating frame by frame. This is very
slow if the ELF MMIO is sized 0x300000 as it requires a smaller seL4 object
(12 bits). Thus it allocates a 0x1000 frame over and over through the
space from 0x3c40_0000 to 0x4600_0000. Paradoxically if we instead
allocate 0x1000_0000 for the ELF, this scans the address range faster as
it needs a seL4 object of 22 bit size, so it scans the address space by
0x040_0000 increments instead.

Change-Id: Ic989e15eb0b2d65e26b141c7975d28cd611b5f79
GitOrigin-RevId: f1b27cc5b452247f8c15f4cb252a7a49fdcf12b9
2022-10-06 18:39:30 +00:00
Marcin Witkowski
b4e76a37b6 processmanager: update OpenTitanUARTDriver
Change-Id: I3fc395213fc0b254c87e9afefea61ad678fe578b
GitOrigin-RevId: 5d7c76ef1aeb552d0b6e270688e29cdf8114a9f8
2022-10-06 18:39:22 +00:00
Sam Leffler
2f4d3c8e35 Merge "processmanger: fix release builds"
GitOrigin-RevId: 18bd5b9b85ab3b264c5816327d34b0ba3d645204
2022-10-06 18:39:14 +00:00
Adam Jesionowski
336808a812 Update camkes to 1M ITCM
Change-Id: I6d265220843bd0e4b0251c42150b221af4b269b0
GitOrigin-RevId: 7bb11dd5f4898bef716118f545c557f3da1d20da
2022-10-06 18:39:06 +00:00
Adam Jesionowski
eae7aa7ab1 Update memory map.
Control block moved due to Secure Core PLIC moving.

Change-Id: If3dee2559503ad97e2f9917f416dd6abc9765732
GitOrigin-RevId: 16b0878c8b09c9610dfe0b50264b59d4aec5a2ae
2022-10-06 18:38:49 +00:00
Adam Jesionowski
d803859470 Merge "Re-map SMC UART and PLIC."
GitOrigin-RevId: 04a0dadc27218e9dfba4440c42630a5b34ab0c56
2022-10-06 18:38:42 +00:00
Lun Dong
0d610d1ca6 MLCoordinator: Increase ITCM size to 1M
Increase ITCM size to 1M.

BUG: 214092253
Change-Id: I6762b5b12ea268c43f558a31d8fce3725cb2bf22
GitOrigin-RevId: 6b520a0c77d33c38bf774b127a1cc76d5f7165fd
2022-10-06 18:38:35 +00:00
Adam Jesionowski
4ed5fc91fd Use CSR initialization for clearing ITCM.
Clears the ITCM in one go before loading an ELF file using the
hardware initialization CSRs.
DTCM is not cleared as it's temporarily larger than the CSRs can fit.

Tested manually.

Change-Id: Ie4620508404cebc8724771eb579c873fcc0cf0ee
GitOrigin-RevId: ef5de7003c22a1871ab0f74a23fce34593b73fe1
2022-10-06 18:38:28 +00:00
Marcin Witkowski
af833e8d19 sel4-sys: fix x86_64 target
There is small caveat, as the scratch register had to be
changed (rbx -> r14) as llvm is using it _for something_.
In practice, it should not change anything, though.

sel4test test suites with MCS disabled are passing.
There is bug in mainline with doesn't allow to compile
seL4 kernel with -DLibSel4FunctionAttributes=public so
MCS enabled kernel cannot be tested.

Change-Id: I66271277ceb6d6242ddec1225590f8911f09e946
GitOrigin-RevId: ca33ffff9ed9e52ed101270feb836d33f7a69d00
2022-10-06 18:38:22 +00:00
Marcin Witkowski
679f4e7acb sel4-sys: add support for aarch64
Add file with basic definitions needed for aarch64 target and
reorganize ARM files a bit.

Change-Id: I50336b2271bcc9ba63bcf48ca65d79ecca401f13
GitOrigin-RevId: 2b0143ebaaafdabb02a3b68da695d65b17e5a303
2022-10-06 18:38:15 +00:00
Marcin Witkowski
28f8a9d63d sel4-sys: fix aarch32 target
This fixes compiling and using sel4-sys for arm32 architecture --
tested on sabrelite seL4 taget.  There is some #[cfg(...)] ifology,
but that maybe could be partially moved to Cargo.toml using
feature dependency.

To fix TLS there is need to pass some rustc flags, but it seems that
it's impossible to do with build.rs, so currently it's only passed
by CMake when building for sel4test.

Additionally, the order of XML files had to be changed as the
syscalls identifiers were generated in wrong order.

Change-Id: I94d65284989b0e99d7b1843165ec88aa1a994be3
GitOrigin-RevId: b39b93e534a2df2b0b141f1b0dafa2f963827c28
2022-10-06 18:38:08 +00:00
Sam Leffler
9d2f298efa Add sel4-config build helper for syncing crates to an seL4 kernel build.
sel4-config is a build helper for keeping a crate's features in sync
with an seL4 kernel. sel4_config::get_sel4_features parses a gen_config.h
artifact from an seL4 build and returns the intersection of the feature
set with the features listed in the caller's Cargo.toml.

Change sel4-sys to use sel4-config to collect features (instead of
depending only on features from Cargo.toml). sel4-sys finds the directory
with kernel artifacts using an SEL4_OUT_DIR environment variable. If
that's not set it falls back to ${ROOTDIR}/out/kata/kernel.

Change workspace crates to use resolver="2" to deal with cargo's
mishandling of dependent features (target build of serde polluted by
std build-dep indirect through cargo_toml).

While here make sel4-sys fall back to ${ROOTDIR}/kata/kernel when SEL4_DIR
is not set in the environment.

Change-Id: I47cf2eab4aa8cd2e502f741738f587c222e94716
GitOrigin-RevId: b661f0b78c0bfe70861965a420d25add8a128cb7
2022-10-06 18:38:00 +00:00
Sam Leffler
164a27b601 sel4-sys: documentation cleanups
Change-Id: Ic6a2440c492f2c1ca5a034cf2abfe4015ce3deaa
GitOrigin-RevId: 97ede65dfb940af050cbb7e5e9a4e99703ab7931
2022-10-06 18:37:52 +00:00
Sam Leffler
36f2577a40 rust.cmake: fixups
- add a default TARGET argument for RustAddLibrary and remove TARGET
  params from the calls--we were already overriding any specified
  TARGET and all the specified TARGETS had bitrot'd
- make CARGO_OPTIONS a CACHE variable so it's scope-independent and
  set the variable to avoid duplicate options (which cargo rejects)

Change-Id: I37eaa421d99834deeb87242aa9acea7e49bed8e3
GitOrigin-RevId: c667372e2961cd052b358abce9602cc888e46daf
2022-10-06 18:37:45 +00:00
Sam Leffler
840c348e94 rust.cmake: force Rust TLS model to local-exec
Rust's tls-model must be consistent with what CAmkES uses or the ipc
buffer used by sel4-sys for system calls will not be found.

Change-Id: I79fde1c08013544959ca7d037c806ce2093391f8
GitOrigin-RevId: 1da18875c28107ca2dab127990cd973b4ffafb6f
2022-10-06 18:37:38 +00:00
Sam Leffler
222aeda532 sel4-sys: use static_assertions
- use the static_assertions crate instead of the hand-rolled hack
- set edition (worked before only 'cuz there were no dependencies)

Change-Id: Iad7ee4ec16e7c8a9fd5d97963e0b6b465a18c559
GitOrigin-RevId: 599eb6e6c154118fe4967edd32369bc69c9c4faa
2022-10-06 18:37:30 +00:00
Sam Leffler
8d7b9fecf7 processmanager: enable seL4 MCS support
Change-Id: Ifa716124c0f965c48375c2fd8944a4134d3a8306
GitOrigin-RevId: 5f723fa77db0c2ff7d63b5470ec09f8da8d2f1e5
2022-10-06 18:37:24 +00:00
Adam Jesionowski
4db610b909 Merge "Add continuous run mode."
GitOrigin-RevId: 64cd0a116569996c4573d6bb8f11d29644678de3
2022-10-06 18:37:16 +00:00
Adam Jesionowski
17ad8e19ef Merge "Rename kata-ml-core kata-vec-core."
GitOrigin-RevId: 061514fe640b164bb9206b477c8d6e46aa2e5fd2
2022-10-06 18:37:08 +00:00
Sam Leffler
3c29f1cd57 sel4-sys: fix MCS support for risc-v
- add missing MCS defs needed by kata-os-rootserver
- add arch object types to seL4_ObjectType so it effectively replaces
  seL4_ArchObjectType
- add seL4_ObjectTypeCount so kata-os-rootserver can construct
  CDL_ObjectType like the C code
- add trait to convert seL4_ObjectType -> seL4_Word for passing
  syscall arguments
- fix feature flag check

Change-Id: Ia4f8656c360aee4e792dca9b55c4d55cac7f43a8
GitOrigin-RevId: 101fe3d373f1179ba8d64d7536f360a7d5723d9e
2022-10-06 18:37:00 +00:00
Sam Leffler
b5a2cdb8a7 Merge "processmanager: add MCS config knob"
GitOrigin-RevId: 15bb0b52de990f0c556fc577ad0c902750d30ed9
2022-10-06 18:36:51 +00:00
Adam Jesionowski
acdd562e40 Implement Rust MLCore driver and remove C driver.
This change adds the kata-ml-core crate. vc_top is generated
programatically, with the script going to be reviewed next if the format here
looks good. The library replaces the VectorCoreDriver c-code.

Change-Id: Id3f083e2498ea29481db49af5e87d47fe8414a71
GitOrigin-RevId: 40d43b0288e995d215997fc8973e18a41a4d5844
2022-10-06 18:36:43 +00:00
Sam Leffler
a9bdb64616 system.camkes: track flash layout change for kata-os-rootserver
Change-Id: I975ab1278e3552ffff91029fd10e5c214bafaabf
GitOrigin-RevId: c03f2465562c9f5e103b3dac6857fbdfabb18e29
2022-10-06 18:36:36 +00:00
Sam Leffler
75ca0a4254 sel4-sys: expose struct internals for generated shared types
Make the structs generated for shared types expose access to the internal
seL4_Words. This is important for capdl parsing that had no way to
convert CDL_CapData_Guard to an seL4_Word (for passing to the kernel).

While here do some minor cleanups of generated code (there are many
opportunities).

Change-Id: I179df84f3e863da4a82675a989c4faeb38f3f669
GitOrigin-RevId: d5ab16a05ab9e85ee45227278c7a776f77821369
2022-10-06 18:36:26 +00:00
Sam Leffler
0548098405 sel4-sys: fix pointer mutability in syscall stubs
Change-Id: I2c3139f7c3fb0d0390970f0a388a8ee5bc692bd3
GitOrigin-RevId: ac3853a5ea171e9948aad70b036757ece1aea657
2022-10-06 18:36:16 +00:00
Sam Leffler
06f2d60e94 sel4-sys: fix seL4_BootInfo definitions
- do not pack struct's, the C code does not
- replace the explicit padding in seL4_UntypedDesc (which was wrong) with the rust alignment idiom
- correct initThreadCNodeSizeBits type
- add extended header defs

Change-Id: I4a3fcbe470dd0a18b3c9b1ccf8af9634076e89fb
GitOrigin-RevId: f99eeed563d2d430381f0ad1a5fbe096a13c68f0
2022-10-06 18:36:09 +00:00
Sam Leffler
1048e6f765 sel4-sys: fix invocation label numbering
Cannot assigned field numbers to the enum members; must let the
compiler do this based on the kernel configuration. Fixes numbering of
architecture-specific labels (e.g. RISCVUnmap).

Change-Id: Ie38fad38fe66c8cc8ddb460ff7c851140b6b9d25
GitOrigin-RevId: 5f7fc5be679aa9bfed39293cd08dfaead0d3d07a
2022-10-06 18:36:01 +00:00
Sam Leffler
c36bae9f1f sel4-sys: merge more stuff from capdl
Change-Id: If7a7b4ab4e6fee1d0df3fd5f6e84ccdfaca6275b
GitOrigin-RevId: 2db9e128e347c19030d280141949e4831681e6c7
2022-10-06 18:35:54 +00:00
Sam Leffler
87caf7e4a8 sel4-sys: add helper for seL4_UntypedDesc
Change-Id: I2bb3d0c5278d316ed02eecf7385e80f769dbad4d
GitOrigin-RevId: 185f323a36b70c3d15751b3bab090742fb2e367d
2022-10-06 18:35:46 +00:00
Sam Leffler
82ed381ddb sel4-sys: change syscall stubs to return seL4_Result
Change-Id: I60e53a7ab8a96bddc0833aeb581f8bbecc8e20d5
GitOrigin-RevId: 5ee752094a7562c0e07b5abb22b5fc4fac3e7294
2022-10-06 18:35:39 +00:00
Sam Leffler
f31340b0bc sel4-sys: root thread slot assignments are const, not static
Change-Id: I7ac579a313f94fa4c194f1a608ca3098f792aab0
GitOrigin-RevId: 9bdb59a84dd54aff0a4ce074cf5b127c0fd8b658
2022-10-06 18:35:32 +00:00
Sam Leffler
77f71b6de7 Fix rust build breakage caused by bare-io package being yanked.
Didn't find an explanation for why all versions of bare-io were yanked
but core2 has the Cursor support and is by the same author.

Change-Id: Id27adaa568a8e1b7b5825c8f81aa489a96675969
GitOrigin-RevId: 7fb8950938c9536a9c795b246d240fca756b3499
2022-10-06 18:35:19 +00:00