diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index ea9431fa31..c82f5bc2c6 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4052,6 +4052,11 @@ qemuBuildCommandLine(virConnectPtr conn,
if (enableKVM)
virCommandAddArg(cmd, "-enable-kvm");
+ if (def->os.loader) {
+ virCommandAddArg(cmd, "-bios");
+ virCommandAddArg(cmd, def->os.loader);
+ }
+
/* Set '-m MB' based on maxmem, because the lower 'memory' limit
* is set post-startup using the balloon driver. If balloon driver
* is not supported, then they're out of luck anyway. Update the
@@ -7581,6 +7586,10 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps,
WANT_VALUE();
if (!(def->os.kernel = strdup(val)))
goto no_memory;
+ } else if (STREQ(arg, "-bios")) {
+ WANT_VALUE();
+ if (!(def->os.loader = strdup(val)))
+ goto no_memory;
} else if (STREQ(arg, "-initrd")) {
WANT_VALUE();
if (!(def->os.initrd = strdup(val)))
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-bios.args b/tests/qemuxml2argvdata/qemuxml2argv-bios.args
index f9727c436d..ac980006c1 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-bios.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-bios.args
@@ -1,5 +1,6 @@
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
-/usr/bin/qemu -S -M pc -m 1024 -smp 1 -nodefaults -device sga \
+/usr/bin/qemu -S -M pc -bios /usr/share/seabios/bios.bin \
+-m 1024 -smp 1 -nodefaults -device sga \
-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
-hda /dev/HostVG/QEMUGuest1 -serial pty \
-usb -device usb-tablet,id=input0 -vnc 127.0.0.1:0 \
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-bios.xml b/tests/qemuxml2argvdata/qemuxml2argv-bios.xml
index cfc558710d..ac15d45b6b 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-bios.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-bios.xml
@@ -6,6 +6,7 @@
1
hvm
+ /usr/share/seabios/bios.bin