]> git.ipfire.org Git - thirdparty/qemu.git/commit
system/vl.c: Fix handling of '-serial none -serial something'
authorPeter Maydell <peter.maydell@linaro.org>
Mon, 22 Jan 2024 16:36:06 +0000 (16:36 +0000)
committerMichael Tokarev <mjt@tls.msk.ru>
Sat, 3 Feb 2024 13:43:46 +0000 (16:43 +0300)
commit597a9a2b4b18323c20538008cd3ded85de76e9fa
tree7474694e107f43487c4427229e43ec03dd1d9859
parentd9b2dc2ffad4b763074883b70731a2272ee8e141
system/vl.c: Fix handling of '-serial none -serial something'

Currently if the user passes multiple -serial options on the command
line, we mostly treat those as applying to the different serial
devices in order, so that for example
 -serial stdio -serial file:filename
will connect the first serial port to stdio and the second to the
named file.

The exception to this is the '-serial none' serial device type.  This
means "don't allocate this serial device", but a bug means that
following -serial options are not correctly handled, so that
 -serial none -serial stdio
has the unexpected effect that stdio is connected to the first serial
port, not the second.

This is a very long-standing bug that dates back at least as far as
commit 998bbd74b9d81 from 2009.

Make the 'none' serial type move forward in the indexing of serial
devices like all the other serial types, so that any subsequent
-serial options are correctly handled.

Note that if your commandline mistakenly had a '-serial none' that
was being overridden by a following '-serial something' option, you
should delete the unnecessary '-serial none'.  This will give you the
same behaviour as before, on QEMU versions both with and without this
bug fix.

Cc: qemu-stable@nongnu.org
Reported-by: Bohdan Kostiv <bohdan.kostiv@tii.ae>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20240122163607.459769-2-peter.maydell@linaro.org
Fixes: 998bbd74b9d81 ("default devices: core code & serial lines")
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit d2019a9d0c34a4fdcb5b5df550d73040dc0637d9)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
softmmu/vl.c