[Bug 288848] bhyve GPU passthru for NVIDIA not working
- In reply to: bugzilla-noreply_a_freebsd.org: "[Bug 288848] bhyve GPU passthru for NVIDIA not working"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 14 Aug 2025 15:24:16 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=288848
--- Comment #4 from Vincent <vincent@landgrafx.de> ---
I applied the patches against 14.3 and can confirm it works! I only had to do a
minor change to the Makefile. Thanks again Corvin!
--- 8< ---
diff --git a/usr.sbin/bhyve/Makefile b/usr.sbin/bhyve/Makefile
index f4dae2f09904..1ec4623375a1 100644
--- a/usr.sbin/bhyve/Makefile
+++ b/usr.sbin/bhyve/Makefile
@@ -41,6 +41,7 @@ SRCS= \
pci_hostbridge.c \
pci_nvme.c \
pci_passthru.c \
+ pci_passthru_quirks.c \
pci_virtio_9p.c \
pci_virtio_block.c \
pci_virtio_console.c \
diff --git a/usr.sbin/bhyve/pci_passthru_quirks.c
b/usr.sbin/bhyve/pci_passthru_quirks.c
new file mode 100644
index 000000000000..805e469303ba
--- /dev/null
+++ b/usr.sbin/bhyve/pci_passthru_quirks.c
@@ -0,0 +1,49 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2025 Beckhoff Automation GmbH & Co. KG
+ * Author: Corvin Köhne <c.koehne@beckhoff.com>
+ */
+
+#include <dev/pci/pcireg.h>
+
+#include <errno.h>
+
+#include "pci_passthru.h"
+
+#define PCI_VENDOR_NVIDIA 0x10DE
+
+static int
+nvidia_gpu_probe(struct pci_devinst *const pi)
+{
+ struct passthru_softc *sc;
+ uint16_t vendor;
+ uint8_t class;
+
+ sc = pi->pi_arg;
+
+ vendor = pci_host_read_config(passthru_get_sel(sc), PCIR_VENDOR, 0x02);
+ if (vendor != PCI_VENDOR_NVIDIA)
+ return (ENXIO);
+
+ class = pci_host_read_config(passthru_get_sel(sc), PCIR_CLASS, 0x01);
+ if (class != PCIC_DISPLAY)
+ return (ENXIO);
+
+ return (0);
+}
--
You are receiving this mail because:
You are the assignee for the bug.