-
Notifications
You must be signed in to change notification settings - Fork 161
Open
Labels
feature-requestNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Description
Summary
Some platforms expose UART (and other device) MMIO regions that are not page aligned. For example, as noted in #181, all Raspberry Pi 4 UARTs except UART0 are misaligned. This PR proposes a platform-defined offset to make these regions mappable, but that approach is platform-specific and not very portable.
Problem
- If we only support page-aligned device mappings, certain platforms (RPi4 et al.) become awkward to support without "hacks", such as the one presented in FIX: PL011 UART driver's configuration for RPi4 #181.
- Allowing non-aligned device mappings is feasible at the hypervisor level, but the memory subsystem will necessarily perform the mapping with a page-aligned allocation that extends outside the requested device region.
- While the hypervisor itself can tolerate this, it becomes a correctness and safety issue for device regions provided via the config: we must not silently map beyond what the config declares.
Proposed direction
- Update device mapping functions to allow misaligned device regions: round to page boundaries internally, but return only the requested subrange (i.e., the misaligned memory region base address).
- Add config validation that enforces page alignment for device regions declared in the
config(or alternatively, reject/flag misaligned entries with a clear error). This prevents accidental over-mapping.
Tasks
-
Support non–page-aligned device mappings in the hypervisor
- Round start down / end up to page boundaries for the actual mapping.
- Ensure unmap logic respects the original requested subrange.
-
Validate config device regions are page aligned
- On config load/parse, check that each device MMIO region’s base and size are page aligned.
- If not aligned, fail with an error message (include offending region and required alignment).
Metadata
Metadata
Assignees
Labels
feature-requestNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers