-
Notifications
You must be signed in to change notification settings - Fork 47
feat(PCIE): PCIE Device Passthrough Refactoring #236
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
base: dev
Are you sure you want to change the base?
Conversation
Merge new features to main for hvisor-v0.1.2 release
…files (hvisor.bin), and improved startup speed
2.for loongarch, pCI can now access HT with the correct address header 3.correctly traverse the next bridge, which is a device with the next function 4.only function0 is checked to determine if it is a multifunction device
|
I believe that PCI configuration log information should use hexadecimal format for easier manual debugging. For example: info!("begin enumerate {:#x?}", e);will be better than info!("begin enumerate {:#?}", e); |
| let _ = dev.write_bar(i as u8, value as u32); | ||
| i += 1; | ||
| bararr[i].set_virtual_value(value); | ||
| let _ = dev.write_bar(i as u8, (value >> 32) as u32); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there is no allocator, we don't need to call dev.write_bar, because the value is already the same.
| let value = bararr[i].get_value64(); | ||
| bararr[i].set_virtual_value(value); | ||
| let _ = dev.write_bar(i as u8, value as u32); | ||
| i += 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For BARs with type PciMemType::High, their value now only stores high 32-bit instead of a complete u64, so we shall add something like let value = bararr[i].get_value64(); after i += 1.
| i += 1; | ||
| } | ||
| PciMemType::Io => { | ||
| writeln!(f, " IO @ 0x{:x}", bar.value)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should change to
write!(f, "\n IO @ 0x{:x}", bar.value)?;| f, | ||
| "\n slot {} [mem 0x{:x}-0x{:x} 64bit", | ||
| i, | ||
| address, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because bar.value now only stores low 32-bit in Mem64Low BAR, so we should read value of self.bararr[i+1] to calculate the complete u64 address.
| node.set_parent_bdf(parent_bdf); | ||
| self.next(match node.config_value.get_class().0 { | ||
| // class code 0x6 is bridge and class.1 0x0 is host bridge | ||
| 0x6 if node.config_value.get_class().1 != 0x0 => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shall use the specific class code (0x6, 0x4):
0x6 if node.config_value.get_class().1 == 0x4 => {Because there might be other bridges like ISA bridge (0x6, 0x1), that shall not be count as PCI bridge.
1.Adjusted PCIe config format (magic version is 0x5). Please update hvisor-tool accordingly.
2.Added support for PCIe systems on x86/arm64/riscv/loongarch64 platforms.
3.Implemented three PCIe mechanisms: ECAM/DWC/loongarch64_pcie.
Fixes:
Fixes #209 (PCIe passthrough refactoring)
Fixes #234 (Resolved PCIe handler deadlock issue)
Fixes #228 (Deadlocks in hvisor)