qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org, "H. Peter Anvin" <hpa@linux.intel.com>,
	"Richard W. M. Jones" <rjones@redhat.com>,
	Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] Re: qdev: Some ISA devices don't handle second instantiation gracefully (was: isa-applesmc doesn't handle second instantiation gracefully)
Date: Tue, 12 Oct 2010 15:04:01 +0200	[thread overview]
Message-ID: <3D29523C-48CB-41B3-BCBE-901EAEE2779E@suse.de> (raw)
In-Reply-To: <m3aamjk1lu.fsf@blackfin.pond.sub.org>


On 12.10.2010, at 15:00, Markus Armbruster wrote:

> Markus Armbruster <armbru@redhat.com> 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.

There can be multiple of these devices on different ports, but a single PIO port can still only be managed by a single device. By creating the same device twice without giving it a PIO option, you put two devices on the same PIO port which can't work.

As this is a configuration error, I'd guess the best way to deal with it is to return an error for register_ioport which makes the qdev init fail. Then the respective instantiator can do what is fit. If the device is passed in on the cmdline, it'd refuse to create the machine and exit. If it's a hotplug event, it would fail to hotplug.


Alex

  reply	other threads:[~2010-10-12 13:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-12 12:50 [Qemu-devel] isa-applesmc doesn't handle second instantiation gracefully Markus Armbruster
2010-10-12 12:57 ` [Qemu-devel] " Alexander Graf
2010-10-12 13:00 ` [Qemu-devel] qdev: Some ISA devices don't handle second instantiation gracefully (was: isa-applesmc doesn't handle second instantiation gracefully) Markus Armbruster
2010-10-12 13:04   ` Alexander Graf [this message]
2010-10-12 14:52     ` [Qemu-devel] Re: qdev: Some ISA devices don't handle second instantiation gracefully Gerd Hoffmann
2010-10-12 13:27   ` [Qemu-devel] " Anthony Liguori
2010-10-12 13:54     ` Markus Armbruster
2010-10-12 14:24       ` Anthony Liguori
2010-10-13 12:47   ` [Qemu-devel] Re: qdev: Some ISA devices don't handle second instantiation gracefully (was: isa-applesmc doesn't handle second instantiation gracefully) Richard W.M. Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3D29523C-48CB-41B3-BCBE-901EAEE2779E@suse.de \
    --to=agraf@suse.de \
    --cc=armbru@redhat.com \
    --cc=hpa@linux.intel.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rjones@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).