Skip to content

Switch to two level cnodes#538

Merged
midnightveil merged 3 commits into
seL4:mainfrom
au-ts:switch-to-two-level-cnodes
Jun 29, 2026
Merged

Switch to two level cnodes#538
midnightveil merged 3 commits into
seL4:mainfrom
au-ts:switch-to-two-level-cnodes

Conversation

@terryzbai

@terryzbai terryzbai commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

This PR makes the CSpace of each PD as a two-level CNodes, which brings more flexibility for cspace management. This is useful for capability sharing.

Now each PD has a smaller root CNode having 64 slots in total. The original Microkit CNode is moved to the root CNode's slot 0 to make sure all existing stuff work. All shared capabilities are moved to the root CNode and addressed by shifting the slot index.

This PR also fixes the capability creation for shared VSpace and CSpace, and adds rules for quick QEMU tests in cap_sharing example.

This PR is also based on the branch rust_sel4_update_to_main, and should be cherry-picked when being merged.(already merged)

@midnightveil midnightveil left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to also add the check to prevent people from placing extra caps in the Microkit CNode, yeah? (not permitted slot 0?)

Comment thread example/cap_sharing/Makefile
Comment thread tool/microkit/src/capdl/builder.rs Outdated
@terryzbai terryzbai force-pushed the switch-to-two-level-cnodes branch from 6061f18 to 04bef0b Compare June 26, 2026 06:38
@terryzbai

Copy link
Copy Markdown
Contributor Author

yes, I have added the check and a test case for it.

This adds a smaller CNode as PD's cspace and moves
the original Microkit resource CNode to the root's
first slot, as this makes the CSpace management more
flexible. The changes are:
- size of root CNode: 64
- size of Microkit CNode: 1024 -> 512
- guard size of root CNode: 0
- guard size of Microkit CNode: seL4_WordBits - 6 - 9

This also fixes the capability creation for shared
VSpace and CSpace.

Signed-off-by: Terry Bai <tianyi.bai@unsw.edu.au>
This adds rules for QEMU tests on x86 and enables the
'capdl_spec.json' file generation for analysis.

Signed-off-by: Terry Bai <tianyi.bai@unsw.edu.au>
This checks if people try to place extra caps in slot 0,
which is reserved for Microkit CNode, and adds a test
case for it.

Signed-off-by: Terry Bai <tianyi.bai@unsw.edu.au>
@terryzbai terryzbai force-pushed the switch-to-two-level-cnodes branch from 04bef0b to 48e4486 Compare June 29, 2026 07:09
@terryzbai terryzbai marked this pull request as ready for review June 29, 2026 07:13
@terryzbai terryzbai mentioned this pull request Jun 29, 2026
@midnightveil

Copy link
Copy Markdown
Collaborator

LGTM once it builds.

@midnightveil midnightveil merged commit 1a5815c into seL4:main Jun 29, 2026
11 checks passed
@midnightveil midnightveil deleted the switch-to-two-level-cnodes branch June 29, 2026 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants