IOMMU: Refactor the memory module#7
Conversation
26a6f14 to
c8c04e3
Compare
3580597 to
d543258
Compare
af71760 to
2a462da
Compare
43b0567 to
dd66aeb
Compare
4df0221 to
4121642
Compare
| #endif | ||
|
|
||
| #ifdef VTD_PT_INDEX_BITS | ||
| MICROKIT_CONSTANT(io_page_table_index_bits, VTD_PT_INDEX_BITS) |
There was a problem hiding this comment.
Oh, you seem to have changed this in PR 8.
| min_untyped_bits: seL4_MinUntypedBits | ||
| max_untyped_bits: seL4_MaxUntypedBits | ||
| vspace: seL4_VSpaceBits | ||
| #define MICROKIT_CONSTANT(name, value) microkit_constant name value |
There was a problem hiding this comment.
What's the point of these changes? I don't understand them
There was a problem hiding this comment.
Made the parsing simple when I had to dig down to get the VTD information, but with the libsel4 fix I should be able to revert
| // We expect the PD ELFs to be first and the monitor ELF last in the list of ELFs. | ||
| let mon_elf_id = elfs.len() - 1; | ||
| assert!(elfs.len() == system.protection_domains.len() + 1); | ||
| let monitor_tcb_obj_id = { |
There was a problem hiding this comment.
What's the point of this change? You just removed monitor_elf afaict.
There was a problem hiding this comment.
This just uses the new return value of add_elf_to_spec, which is both the tcb obj id and the address space
| device_regions, | ||
| normal_regions, | ||
| object_sizes, | ||
| object_sizes: Some(object_sizes_json.object_sizes), |
There was a problem hiding this comment.
I think this should be split out into object_sizes and address_space_constants, as 2 different preprocessed files or something
There was a problem hiding this comment.
yep will fix, I was just following how it was before (mixed), take it back I misinterpreted the original (asid pool index bits seems like a special case), have fixed this
|
|
||
| /* | ||
| * The Microkit tool needs to know the sizes of kernel objects. | ||
| * The Microkit tool needs to know the sizes of kernel objects and a small |
There was a problem hiding this comment.
Your third commit, 'IOMMU: Remove constants retrievable from seL4' has nothing to do with the IOMMU, and could be its own PR done standalone, which would make it easier to review.
| } | ||
|
|
||
| fn read(&self) -> bool { | ||
| matches!(self.perms, SysIOMapPerms::Read | SysIOMapPerms::ReadWrite) |
There was a problem hiding this comment.
What's the point of defininng separate SysIOMapPerms then? What do these permissions do differently than the original SysMapPerms?
There was a problem hiding this comment.
SysIOMapPerms can only represent valid perms in the type system, while the other can the anything. The better improvement would be to fix SysMapPerms too... Should I do that?
| /// Kernel object sizes, used for kernel boot emulation and untyped allocation. | ||
| pub object_sizes: Option<ObjectSizes>, | ||
| pub page_table_index_bits: u64, | ||
| /// Only emitted for aarch builds |
There was a problem hiding this comment.
emitted or omitted? If the former, I'd prefer included, and be specific that it is AArch64.
| Arch::Riscv64 => 0x0000003fffffefff, | ||
| Arch::X86_64 => 0x7fffffffefff, | ||
| } | ||
| self.user_top |
There was a problem hiding this comment.
If this is just a constant now we should have pub vspace_user_top: u64 and use that. No need for this extra function.
| /// The two remaining fields are only valid on ARM and RISC-V | ||
| pub device_regions: Option<Vec<PlatformConfigRegion>>, | ||
| pub normal_regions: Option<Vec<PlatformConfigRegion>>, | ||
| /// Emitted on all builds corresponds to seL4_UserVSpaceTop. |
| match (self.arch, self.iommu) { | ||
| (Arch::X86_64, true) => self | ||
| .io_page_table_index_bits | ||
| .expect("Error: An x86 VT-D build should have VTD_PT_INDEX_BITS defined by seL4, captured in tool/microkit/object_sizes.h"), |
There was a problem hiding this comment.
Please reformat over multiple lines.
4121642 to
6539123
Compare
6539123 to
c4643ad
Compare
c4b6467 to
fd6dab8
Compare
c4643ad to
d2d3d33
Compare
5e715bd to
dfc3853
Compare
d2d3d33 to
112cc18
Compare
dfc3853 to
7070554
Compare
112cc18 to
51f97b2
Compare
Add domain ids to microkit system descriptions. Signed-off-by: Callum <c.berry@student.unsw.edu.au>
7070554 to
d13bf6b
Compare
Minor adjustments to the prior sdf work to do with how permissions are handled. Previously I implemented read and write functions as part of the SysIOMapPerms enum, however the old SysMapPerms did not do this. Given these types are meant to exhibit similar behaviour extracting this common logic into the Map trait provides a streamlined interface to check if a permission is set. Signed-off-by: Callum <c.berry@student.unsw.edu.au>
This commit is meant to preserve original functionality. The memory.rs file previously was a collection of functions that allowed the mapping of pages into vspaces. This commit refactors this logic into an AddressSpace type. This will allow us to simply support new variants of address spaces, including IO Address Spaces for devices. The majority of changes are made to allow the old functions to be reusued in a more generic way. The changes to the builder.rs reflect the changes to memory.rs or make use of the trait Map as trait bounds to handle both normal Mappings and IOMappings. Signed-off-by: Callum <c.berry@student.unsw.edu.au>
This commit integrates the improved config to the memory module. This commit removes some of the duplicated constants definitions that seL4 already exports. Signed-off-by: Callum <c.berry@student.unsw.edu.au>
2af2aab to
9ecdac4
Compare
d13bf6b to
ad35214
Compare
This PR makes a small change to the SDF work previously completed.
It then refactors the memory.rs module in preparation for adding support for IO Address Spaces. The refactor primarily introduces an address space abstraction that can allow simpler handling of different address space variants.
It also removes the pre-existing duplicated constants that are already defined by seL4. This commit extracts those and includes them in the Config struct that the tool passes around.
This PR preserves the existing behaviour.