[lxc-devel] [lxd/master] lxd/vm: Fix PCIe slot for physical/sriov nic

stgraber on Github lxc-bot at linuxcontainers.org
Tue Jun 9 20:44:54 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 354 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200609/88d151a7/attachment.bin>
-------------- next part --------------
From beaf493c71f3df6f1a22dadebb3a0b19b0c33e17 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Tue, 9 Jun 2020 16:44:08 -0400
Subject: [PATCH] lxd/vm: Fix PCIe slot for physical/sriov nic
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: St├ęphane Graber <stgraber at ubuntu.com>
---
 lxd/instance/drivers/driver_qemu_templates.go | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/lxd/instance/drivers/driver_qemu_templates.go b/lxd/instance/drivers/driver_qemu_templates.go
index beccc89c66..69e80ac8cc 100644
--- a/lxd/instance/drivers/driver_qemu_templates.go
+++ b/lxd/instance/drivers/driver_qemu_templates.go
@@ -380,9 +380,26 @@ fd = "{{.tapFD}}"
 
 // Devices use "lxd_" prefix indicating that this is a user named device.
 var qemuNetdevPhysical = template.Must(template.New("qemuNetdevPhysical").Parse(`
+{{if eq .architecture "x86_64" "aarch64" -}}
+[device "qemu_pcie{{.chassisIndex}}"]
+driver = "pcie-root-port"
+port = "0x{{.nicIndex}}"
+chassis = "{{.chassisIndex}}"
+bus = "pcie.0"
+addr = "0x4.0x{{.nicIndex}}"
+multifunction = "on"
+{{- end }}
+
 # Network card ("{{.devName}}" device)
 [device "dev-lxd_{{.devName}}"]
 driver = "vfio-pci"
 host = "{{.pciSlotName}}"
 bootindex = "{{.bootIndex}}"
+{{if eq .architecture "ppc64le" -}}
+bus = "pci.0"
+{{else -}}
+bus = "qemu_pcie{{.chassisIndex}}"
+addr = "0x0"
+{{end -}}
+
 `))


More information about the lxc-devel mailing list