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

NVIDIA gpu support #165

Merged
merged 3 commits into from
Sep 30, 2024
Merged

NVIDIA gpu support #165

merged 3 commits into from
Sep 30, 2024

Conversation

ianm-nv
Copy link
Contributor

@ianm-nv ianm-nv commented Sep 30, 2024

This PR enables gpu passthrough with virtme-ng. It adds a new paramemeter "--nvgpu' which is used to provide the PCI address of the gpu. There are included instructions in the README for enabling VFIO passthrough support.

Copy link
Owner

@arighi arighi left a comment

Choose a reason for hiding this comment

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

Looks great overall, thanks for working on this!

I just left a small comment about running vng as regular user, but we can definitely merge it and address this later in-tree.

# Load VFIO module
$ sudo modprobe vfio-pci
# Pass PCI address to virtme-ng
$ sudo vng --nvgpu "01:00.0" -r linux
Copy link
Owner

Choose a reason for hiding this comment

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

Do we really need sudo permission here to run vng? That might be the case because we need to access pci directly I guess... do you get an permission error if you try to run vng as regular user?

@arighi arighi merged commit bcf6589 into arighi:main Sep 30, 2024
4 checks passed
@SPYFF
Copy link
Contributor

SPYFF commented Oct 3, 2024

While this is a good addition, I wonder if it can be generalised. I used to pass-through the network interface with VFIO and the steps were almost identical. I'm afraid there are driver and device specific quirks, but the basic steps were the same as in this case:

  1. Find the PCIe address and device ID of the device
    2a. Unbind it from its driver (on a running system)
    2b. Blacklist the driver (if runtime unbind failed)
  2. Load the vfio-pci driver
  3. Map the device to the vfio-pci driver
  4. May or may not be visible and usable in QEMU

Sure, success is highly device and host dependent (e.g. the same i225 NIC worked in the VM on an Intel host, but not on an AMD, etc.), but a generic PCIe passthrough feature might be worth considering.

@arighi
Copy link
Owner

arighi commented Oct 3, 2024

Absolutely, I totally agree on generalizing the concept of PCI passthrough and I think we can improve this in-tree. At this stage even if we break the API (command options) is not so critical as long as we don't break any previous behavior or option (maybe we should have a way to mark new options as "unstable"?). But I think it's good to have "something" merged, a lot of people have been asking me this feature for a while, so at least now people can start using it and improving it. 🙂

That said, I'll think about a proper interface for a generic PCI passthrough and maybe we can discuss it here or better create a separate issue.

Thanks!

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.

3 participants