From: Robin Voetter <robin@streamhpc.com>
To: qemu-devel@nongnu.org
Subject: PCIe atomics in pcie-root-port
Date: Thu, 6 Apr 2023 11:29:34 +0200 [thread overview]
Message-ID: <b30370f5-0b52-d2de-6e47-8f288a219a43@streamhpc.com> (raw)
Hello,
I am trying to use qemu to run ROCm in a virtual machine via GPU
passthrough with vfio-pci. While this mostly works out of the box, ROCm
requires PCIe atomics to function properly, and it seems like that this
is a feature that is missing in qemu. The setup is using a simple PCie
topology, where the GPU is connected to a pcie-root-port as follows:
-device pcie-root-port,id=pcie.1
-device vfio-pci,host=<host_pci_address>,bus=pcie.1
When the amdgpu kernel module is loaded in the guest, enabling PCIe
atomics fails because it requires that PCIe root ports support 32- and
64-bit atomic completion, see commits 430a2368 and 8e6d0b69 in Linux.
I patched the required flags into the DevCap2 register in qemu and
everything seems to work fine. I'm interested in getting this change
into qemu proper, but I have some questions about how to do that:
1. In order for PCIe atomics to be supported, every bridge in the path
between the root complex and the device in question needs to support the
routing capability, as well as the device being required to support the
atomic requester/completer capabilities of course. When a certain device
from the host is connected to a root port in qemu, that path will be
abstracted away into the virtual PCIe topology. Should this property
from the host be reflected into the virtual path in qemu, or is it
better to gate this behind a property of the pcie-root-port? For
example, the user could then simply pass -device
pcie-root-port,id=pcie.1,atomics=on to make the pcie-root-port report
that it supports these operations. If this should be reflected from the
host automatically, how should this be tested for? I checked around the
source for how for example the link speed is set, but it seems like that
is not reflected from the host system automatically either.
2. Is anything else required to support PCIe atomics, or did I just get
lucky that my programs work?
Thanks,
Robin Voetter, Stream HPC
next reply other threads:[~2023-04-06 13:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-06 9:29 Robin Voetter [this message]
2023-04-06 18:40 ` PCIe atomics in pcie-root-port Alex Williamson
2023-04-12 16:58 ` Robin Voetter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b30370f5-0b52-d2de-6e47-8f288a219a43@streamhpc.com \
--to=robin@streamhpc.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).