From: Gleb Natapov <gleb@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] initialize unit id of IDE bus
Date: Mon, 25 Oct 2010 20:20:16 +0200 [thread overview]
Message-ID: <20101025182016.GC877@redhat.com> (raw)
In-Reply-To: <m3d3qyi1uy.fsf@blackfin.pond.sub.org>
On Mon, Oct 25, 2010 at 08:06:13PM +0200, Markus Armbruster wrote:
> Gleb Natapov <gleb@redhat.com> writes:
>
> > On Mon, Oct 25, 2010 at 06:22:12PM +0200, Markus Armbruster wrote:
> >> Gleb Natapov <gleb@redhat.com> writes:
> >>
> >> > On Mon, Oct 25, 2010 at 04:29:35PM +0200, Markus Armbruster wrote:
> >> >> Gleb Natapov <gleb@redhat.com> writes:
> >> >>
> >> >> > Without this patch both buses on PIIX3_IDE device have the same unit id.
> >> >>
> >> >> Are you sure that's wrong?
> >> >>
> >> > So how do I know which bus is it on PIIX3_IDE?
> >> [...]
> >>
> >> Let me try to explain the IDE pointer thicket.
> >>
> >> piix3-ide provides two IDE buses. pci_piix_ide_initfn() stores them in
> >> PCIIDEState member IDEBus bus[2]. Technically redundant, because qdev
> >> stores child buses in dev.qdev.child_bus.
> >>
> >> IDEBus points back: qbus.parent.
> >>
> >> Up to two IDE devices can sit on each IDE bus. The first one uses
> >> IDEBus members master and ifs[0], the second one uses slave and ifs[1].
> >>
> >> ifs[i].bus points back to the IDE bus.
> >>
> >> {master,slave}.qdev.parent_bus point back to the IDE bus.
> >>
> >> Say you got an IDEDevice and want to know which to which of the two
> >> buses it's connected. Let's call it d.
> >>
> >> d->qdev.parent_bus is the BusState.
> >>
> >> Upcast to IDEBus: b = DO_UPCAST(IDEBus, qbus, d->qdev.parent_bus).
> >>
> >> b->qbus.parent is the IDE controller.
> >>
> >> Upcast to PCIIDEState: c = DO_UPCAST(PCIIDEState, dev, n->qbus.parent);
> >>
> >> If c->bus[0] == b, it's on the first bus.
> >>
> >> Else it must be on the second bus, i.e. c->bus[1] == b.
> >>
> >> Hope I didn't screw this up too badly.
> > Will check tomorrow if this works, but why not have simple property on
> > IDEBus that says which one is it?
>
> Because nobody has needed it so far?
>
> Does the bus care whether it's first or second?
>
User that wants to address particular disk cares.
> > BTW what -device magic should I use to
> > create secondary disk on second IDE bus?
>
> Try -device ide-drive,bus=ide.1,unit=1,drive=...
Where ide.1 comes from? Why do I need to write ide.1 not just 1. Can I
instantiate ide-device on USB bus by doing -device ide-drive,bus=usb?
--
Gleb.
next prev parent reply other threads:[~2010-10-25 18:20 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-24 16:23 [Qemu-devel] [PATCH] initialize unit id of IDE bus Gleb Natapov
2010-10-25 14:29 ` Markus Armbruster
2010-10-25 15:42 ` Gleb Natapov
2010-10-25 16:22 ` Markus Armbruster
2010-10-25 16:49 ` Gleb Natapov
2010-10-25 18:06 ` Markus Armbruster
2010-10-25 18:20 ` Gleb Natapov [this message]
2010-10-26 9:29 ` Markus Armbruster
2010-10-26 10:23 ` Gleb Natapov
2010-10-26 11:59 ` Markus Armbruster
2010-10-26 12:32 ` Gleb Natapov
2010-10-26 7:28 ` Gleb Natapov
2010-10-26 9:14 ` Markus Armbruster
2010-10-26 10:15 ` Gleb Natapov
2010-10-26 11:20 ` Markus Armbruster
2010-10-26 12:12 ` Gleb Natapov
2010-10-26 12:39 ` Markus Armbruster
2010-10-26 13:03 ` Gleb Natapov
2010-10-26 14:15 ` Alex Williamson
2010-10-26 14:26 ` Gleb Natapov
2010-10-26 14:44 ` Alex Williamson
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=20101025182016.GC877@redhat.com \
--to=gleb@redhat.com \
--cc=armbru@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).