-
Notifications
You must be signed in to change notification settings - Fork 164
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
Enable Vfio multifunction devices #4394
Enable Vfio multifunction devices #4394
Conversation
cb4bf8f
to
1ab1f42
Compare
@christoph-zededa , FYI, Lenovo SE70 (based on Jetson Xavier NX) is a good candidate to test these changes on arm64... it has some peripherals on PCIe bus and it implements SMMU.... |
@@ -387,12 +387,19 @@ const qemuRootPortPciPassthruTemplate = ` | |||
addr = "{{printf "0x%x" .PCIId}}" | |||
` | |||
|
|||
const qemuPCIPassthruBridgeTemplate = ` | |||
[device "pcie-bridge.{{.PCIId}}"] | |||
driver = "pcie-pci-bridge" |
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.
why pcir-pci and no pcie-pcie? Shown PCIe device ans PCI has consequences and usually not a good idea
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.
pcie-pcie
does not exist according to https://github.com/qemu/qemu/blob/master/docs/pcie.txt#L39
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.
sure, because there is no need to translate. You either create a dedicated port to control BDF assignments or plug device into a PCIe switch
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.
I tried this:
[device "pci.7"]
driver = "pcie-root-port"
port = "17"
chassis = "7"
bus = "pcie.0"
multifunction = "on"
addr = "0x7"
slot = "7"
[device "upstream_port.1"]
driver = "x3130-upstream"
bus = "pci.7"
[device "downstream_port1"]
driver = "xio3130-downstream"
bus = "upstream_port.1"
slot = "71"
[device "downstream_port2"]
driver = "xio3130-downstream"
bus = "upstream_port.1"
slot = "72"
#[device "pcie-bridge.7"]
# driver = "pcie-pci-bridge"
# bus = "pci.7"
# addr = "0x0"
[device]
driver = "vfio-pci"
host = "00:0d.0"
# bus = "pcie-bridge.7"
bus = "downstream_port1"
addr = "0x1"
[device]
driver = "vfio-pci"
host = "00:0d.2"
# bus = "pcie-bridge.7"
bus = "downstream_port2"
addr = "0x2"
but I get the same error message:
qemu-system-x86_64:xen1.cfg:264: vfio 0000:00:0d.2: group 7 used in multiple address spaces
1ab1f42
to
00464e3
Compare
00464e3
to
e0c9d50
Compare
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.
My only real concern I put to the comment on line 1099 (#4394 (comment)); the rest are mostly recommendations and questions.
|
||
for i, dev := range pciDevices.devs { | ||
if p.ioType == dev.ioType && p.pciLong == dev.pciLong { | ||
return i |
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 depend on the slice remaining unmodified and unsorted after it is created. If we remove an element from it, the indices can change. Currently, we don't have this behaviour, but it would be beneficial to explicitly state the requirement that the slice remains unmodified. A comment added to the slice would be a good solution.
e0c9d50
to
f6d50bc
Compare
f6d50bc
to
c93808d
Compare
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.
In general, it looks fine to me.
I hope @christoph-zededa retest it with the latest changes, and we can run the automated tests as well.
@christoph-zededa could you please rebase onto the latest master? It should fix the Eden tests run. =) |
It would also be nice to document the trick with the bridge and explain why it's necessary... But I don't see any document where we have our passthrough approach explained. So I don't know where to add it =( |
template for future restructuring Signed-off-by: Christoph Ostarek <[email protected]>
into separate function to make it easier to test it Signed-off-by: Christoph Ostarek <[email protected]>
c93808d
to
d6f685c
Compare
add support for multifunction pci devices Signed-off-by: Christoph Ostarek <[email protected]>
d6f685c
to
f489f47
Compare
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.
Release the Kraken!
(run the Eden tests!)
"You have reached your pull rate limit." >=( |
Another test fails with
UPD. Three of them failed with this. |
at least Eden onboard issue is gone :
|
@christoph-zededa, all green. Merging. But if you have any thoughts regarding the failure, would be nice to figure out the reason. |
see also #3369