[lxc-devel] [lxd/master] VM: GPU VGA mode passthrough from host

tomponline on Github lxc-bot at linuxcontainers.org
Mon Jun 15 13:19:37 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 361 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200615/9c2371a4/attachment.bin>
-------------- next part --------------
From e03b568c88b96247325c65b57fbe5368debfc5b6 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Mon, 15 Jun 2020 14:15:54 +0100
Subject: [PATCH] lxd/instance/drivers/driver/qemu: Pass-through GPU VGA mode
 status from host

Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
 lxd/instance/drivers/driver_qemu.go | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lxd/instance/drivers/driver_qemu.go b/lxd/instance/drivers/driver_qemu.go
index 785c927c1c..8721ea9e89 100644
--- a/lxd/instance/drivers/driver_qemu.go
+++ b/lxd/instance/drivers/driver_qemu.go
@@ -2061,6 +2061,9 @@ func (vm *qemu) addGPUDevConfig(sb *strings.Builder, bus *qemuBus, gpuConfig []d
 		}
 	}
 
+	// Pass-through VGA mode if enabled on the host device.
+	vgaMode := shared.PathExists(filepath.Join("/sys/bus/pci/devices", pciSlotName, "boot_vga"))
+
 	devBus, devAddr, multi := bus.allocate(fmt.Sprintf("lxd_%s", devName))
 	tplFields := map[string]interface{}{
 		"bus":           bus.name,
@@ -2070,7 +2073,7 @@ func (vm *qemu) addGPUDevConfig(sb *strings.Builder, bus *qemuBus, gpuConfig []d
 
 		"devName":     devName,
 		"pciSlotName": pciSlotName,
-		"vga":         true,
+		"vga":         vgaMode,
 	}
 
 	// Add main GPU device in VGA mode to qemu config.


More information about the lxc-devel mailing list