Received: from [140.186.70.92] (port=39811 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P5eSp-00074X-3h for qemu-devel@nongnu.org; Tue, 12 Oct 2010 09:00:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P5eSo-000468-9Z for qemu-devel@nongnu.org; Tue, 12 Oct 2010 09:00:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:4624) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P5eSo-000463-2c for qemu-devel@nongnu.org; Tue, 12 Oct 2010 09:00:18 -0400 From: Markus Armbruster References: Date: Tue, 12 Oct 2010 15:00:13 +0200 In-Reply-To: (Markus Armbruster's message of "Tue, 12 Oct 2010 14:50:52 +0200") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: [Qemu-devel] qdev: Some ISA devices don't handle second instantiation gracefully (was: isa-applesmc doesn't handle second instantiation gracefully) List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf , "Richard W. M. Jones" , "H. Peter Anvin" , Gerd Hoffmann Cc: qemu-devel@nongnu.org Markus Armbruster writes: > When I try -device isa-applesmc -device isa-applesmc, I get > > WARNING: Using AppleSMC with invalid key > qemu: hardware error: register_ioport_read: invalid opaque > [...] > > and a core dump. > > I know nothing about this device. Instantiating twice may well make no > sense. But hw_error() is not a nice way to reject a command line > option. Actually, ib700 and isa-debugcon fail the same way. They call register_ioport_write(), which aborts via hw_error() when the port is already in use. This is okay for non-configurable parts of a board emulation, but not okay for a qdev device, unless it has no_user set. Related: when isa_init_irq() finds the requested IRQ already in use, it fails with exit(1). Maybe register_ioport_write() & friends should do that as well. Or maybe qdev device models should have an "at most one" flag.