mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2026-08-28 11:56:03 +00:00
feat: Use dynamic PCI bus configuration (#1352)
This commit is contained in:
+5
-2
@@ -41,9 +41,12 @@ configureMachine() {
|
||||
|
||||
configureVirtioDevices() {
|
||||
|
||||
DEV_OPTS="-device virtio-balloon-pci,id=balloon0,bus=pcie.0,addr=0x4"
|
||||
local bus
|
||||
bus=$(getPciBus)
|
||||
|
||||
DEV_OPTS="-device virtio-balloon-pci,id=balloon0,bus=$bus,addr=0x4"
|
||||
DEV_OPTS+=" -object rng-random,id=objrng0,filename=/dev/urandom"
|
||||
DEV_OPTS+=" -device virtio-rng-pci,rng=objrng0,id=rng0,bus=pcie.0,addr=0x1c"
|
||||
DEV_OPTS+=" -device virtio-rng-pci,rng=objrng0,id=rng0,bus=$bus,addr=0x1c"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
+2
-4
@@ -518,11 +518,9 @@ createDevice () {
|
||||
local diskCache="$7"
|
||||
local diskSerial="$8"
|
||||
local diskSectors="$9"
|
||||
local bus="${PCI_BUS:-pcie.0}"
|
||||
|
||||
# q35 uses pcie.0, while legacy pc/i440fx machines expose their devices on
|
||||
# pci.0 unless the caller supplied an explicit bus.
|
||||
[[ -z "${PCI_BUS:-}" && ( "${MACHINE,,}" == pc || "${MACHINE,,}" == pc-i440fx* ) ]] && bus="pci.0"
|
||||
local bus
|
||||
bus=$(getPciBus)
|
||||
|
||||
local options=""
|
||||
[ -n "$DISK_OPTIONS" ] && options=",${DISK_OPTIONS#,}"
|
||||
|
||||
+4
-1
@@ -111,6 +111,9 @@ waitForSocket() {
|
||||
|
||||
configureSerialPorts() {
|
||||
|
||||
local bus
|
||||
bus=$(getPciBus)
|
||||
|
||||
# Managed interactive mode separates the console and QEMU monitor into
|
||||
# reconnecting sockets; other runs keep the simple combined stdio monitor.
|
||||
if enabled "${SHUTDOWN:-Y}" && interactive; then
|
||||
@@ -130,7 +133,7 @@ configureSerialPorts() {
|
||||
fi
|
||||
|
||||
SERIAL_OPTS+=" \
|
||||
-device virtio-serial-pci,id=virtio-serial0,bus=pcie.0,addr=0x3 \
|
||||
-device virtio-serial-pci,id=virtio-serial0,bus=$bus,addr=0x3 \
|
||||
-chardev socket,id=charchannel0,path=$HOST_AGENT_SOCKET,reconnect-ms=1000 \
|
||||
-device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=vchannel"
|
||||
|
||||
|
||||
@@ -49,6 +49,23 @@ isAmdCpu() {
|
||||
[[ "$vendor" == "AuthenticAMD" ]]
|
||||
}
|
||||
|
||||
getPciBus() {
|
||||
|
||||
local machine="${1:-${MACHINE:-q35}}"
|
||||
|
||||
if [ -n "${PCI_BUS:-}" ]; then
|
||||
echo "$PCI_BUS"
|
||||
return 0
|
||||
fi
|
||||
|
||||
case "${machine,,}" in
|
||||
pc|pc-i440fx*) echo "pci.0" ;;
|
||||
*) echo "pcie.0" ;;
|
||||
esac
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
interactive() {
|
||||
|
||||
# A TTY on stdin is insufficient when /dev/tty is unavailable; require both
|
||||
|
||||
Reference in New Issue
Block a user