From d71b22bb6ae281e66dfa17733105468f830a8c6a Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 25 Mar 2015 09:29:20 +0100 Subject: hw: Mark devices picking up char backends actively FIXME MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Character devices defined with -serial and -parallel are for board initialization to wire up. Board code examines serial_hds[] and parallel_hds[] to find them, and creates devices with their qdev chardev properties set accordingly. Except a few devices go on a fishing expedition for a suitable backend instead of exposing a chardev property for board code to set: they use serial_hds[] (often via qemu_char_get_next_serial()) or parallel_hds[] in their realize() or init() method to connect to a backend. Picking up backends that way works when the devices are created by board code. But it's inappropriate for -device or device_add. Not only is it inconsistent with how the other characrer device models work (they connect to a backend explicitly identified by a "chardev" property), it breaks when the backend has been picked up by the board or a previous -device / device_add already. Example: $ qemu-system-ppc64 -M bamboo -S -device i82378 -device pc87312 -device pc87312 qemu-system-ppc64: -device pc87312: Property 'isa-parallel.chardev' can't take value 'parallel0', it's in use Mark them with suitable FIXME comments. Cc: Li Guang Cc: Peter Crosthwaite Cc: Antony Pavlov Cc: "Edgar E. Iglesias" Cc: Michael Walle Cc: Peter Crosthwaite Cc: "Andreas Färber" Signed-off-by: Markus Armbruster --- hw/char/cadence_uart.c | 1 + 1 file changed, 1 insertion(+) (limited to 'hw/char/cadence_uart.c') diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c index a5dc2a4366..4f38f0c6a5 100644 --- a/hw/char/cadence_uart.c +++ b/hw/char/cadence_uart.c @@ -483,6 +483,7 @@ static void cadence_uart_realize(DeviceState *dev, Error **errp) s->fifo_trigger_handle = timer_new_ns(QEMU_CLOCK_VIRTUAL, fifo_trigger_update, s); + /* FIXME use a qdev chardev prop instead of qemu_char_get_next_serial() */ s->chr = qemu_char_get_next_serial(); if (s->chr) { -- cgit v1.2.3