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

config: add MMIO layout #339

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gaojiaqi7
Copy link
Contributor

The new configuration file contains the address and size of MMIO space and PCIE config space.

Closes #115

@gaojiaqi7 gaojiaqi7 force-pushed the 0211/add_mmio_layout_config branch 2 times, most recently from d72b805 to e82de11 Compare February 11, 2025 07:40
@jyao1
Copy link
Contributor

jyao1 commented Feb 12, 2025

Can we add additional check for overlap between MMIO and physical RAM?

Just panic!() if this happens.

@gaojiaqi7 gaojiaqi7 force-pushed the 0211/add_mmio_layout_config branch 2 times, most recently from dadcedd to f0b6e32 Compare February 13, 2025 01:45
}

// Ensure that the MMIO64 range does not overlap with the MMIO32 space.
if config.mmio64_start > config.mmio32_start as u64
Copy link
Contributor

@jyao1 jyao1 Feb 13, 2025

Choose a reason for hiding this comment

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

Can we just simply make sure mmio64 > 4GB?

The rule is:

  1. mmio32 < 4GB
  2. mmio64 > 4GB
  3. PCIe should not overlap with them

u32::MAX as u64 + 1
};
if (end_of_ram > MMIO32_START as u64 && end_of_ram < (MMIO32_START + MMIO32_SIZE) as u64)
|| end_of_ram > MMIO64_START
Copy link
Contributor

@jyao1 jyao1 Feb 13, 2025

Choose a reason for hiding this comment

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

we need 2 end_of_ram value.

  1. top of low usable memory (< 4GB memory), not overlap with mmio32 range.
  2. top of up usable memory (> 4GB memory), not overlap with mmio64 range.

The new configuration file contains the address and size of MMIO space and
PCIE config space.

Signed-off-by: Jiaqi Gao <[email protected]>
@gaojiaqi7 gaojiaqi7 force-pushed the 0211/add_mmio_layout_config branch from f0b6e32 to 0b1da35 Compare February 13, 2025 10:18

pub const MMIO32_START: u32 = 0xC000_0000;
pub const MMIO32_SIZE: u32 = 0x2000_0000;
use crate::{PciError, Result, MMIO32_SIZE, MMIO32_START, MMIO64_START};

Check warning

Code scanning / clippy

unused import: MMIO32_SIZE Warning

unused import: MMIO32\_SIZE
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.

remove PCIE config access and hardcoded PCIE base
2 participants