Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement MMIO gap #38

Closed
wants to merge 2 commits into from
Closed

Implement MMIO gap #38

wants to merge 2 commits into from

Conversation

nponsard
Copy link
Member

@nponsard nponsard commented Mar 3, 2023

This PR adds a GAP at the end of 32-bit guest memory space to allocate MMIO devices.
The sizes is an arbitrary one, I didn't find any resource explaining which size to choose.

This PR fixes #34.

lucido-simon and others added 2 commits February 15, 2023 16:21
Signed-off-by: Simon LUCIDO <[email protected]>
An arbitrary value for the gap size has been chosen for now.

Signed-off-by: Nils Ponsard <[email protected]>
Copy link
Contributor

@sameo sameo left a comment

Choose a reason for hiding this comment

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

Please rebase the PR and remove the code formatting part and we'll get that merged.

/// Size of the MMIO gap
const MMIO_GAP_SIZE: usize = 32 << 20;
/// Start of the MMIO gap
const MMIO_GAP_START: usize = MMIO_GAP_END - MMIO_GAP_SIZE;
Copy link
Contributor

Choose a reason for hiding this comment

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

FWIW, placing the MMIO gap under 32 bits is meant for supporting 32-bit architecture. The PCI memory hole (Which MMIO is taking advantage of) is a legacy burden that's carried over to support MMIO based devices on 32-bit CPUs.

It does not matter where you place it, and at the end of the 32-bit address space is fine. But you should know that this could be placed e.g. way further in the 64-bit address space, and leave RAM unfragmented.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think we need to support 32bit OSes ? Then we could instead use something like an allocator to place the MMIO devices after the guest's memory ?

&mut self,
console_path: Option<String>
) -> Result<()> {
pub fn configure_console(&mut self, console_path: Option<String>) -> Result<()> {
Copy link
Contributor

Choose a reason for hiding this comment

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

unneeded reformatting.

mem_size_mb: u32,
kernel_path: &str,
console: Option<String>,
) -> Result<()> {
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto.

@nponsard
Copy link
Member Author

replaced by #41

@nponsard nponsard closed this Mar 23, 2023
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.

virtio-net : add MMIO gap
3 participants