qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Markus Armbruster <armbru@redhat.com>, qemu-devel@nongnu.org
Cc: "Kevin Wolf" <kwolf@redhat.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	qemu-block@nongnu.org, "Max Reitz" <mreitz@redhat.com>,
	"Keith Busch" <keith.busch@intel.com>,
	"Laszlo Ersek" <lersek@redhat.com>
Subject: Re: [Qemu-devel] [Qemu-block] [RFC] nvme: how to support multiple namespaces
Date: Wed, 26 Jun 2019 12:14:15 +0200	[thread overview]
Message-ID: <3d94d5af-002a-d079-4e23-8a8b06c11152@redhat.com> (raw)
In-Reply-To: <87o92lkl6x.fsf@dusky.pond.sub.org>

On 26/06/19 06:46, Markus Armbruster wrote:
>> I'm not sure how to wire it together without the bus abstraction? So
>> I'll stick with the bus for now. It *is* extremely convenient!
> 
> As far as I can tell offhand, a common use of bus-less connections
> between devices is wiring together composite devices.  Example:
> 
>     static void designware_pcie_host_init(Object *obj)
>     {
>         DesignwarePCIEHost *s = DESIGNWARE_PCIE_HOST(obj);
>         DesignwarePCIERoot *root = &s->root;
> 
>         object_initialize_child(obj, "root",  root, sizeof(*root),
>                                 TYPE_DESIGNWARE_PCIE_ROOT, &error_abort, NULL);
>         qdev_prop_set_int32(DEVICE(root), "addr", PCI_DEVFN(0, 0));
>         qdev_prop_set_bit(DEVICE(root), "multifunction", false);
>     }
> 
> This creates a TYPE_DESIGNWARE_PCIE_ROOT device "within" the
> TYPE_DESIGNWARE_PCIE_HOST device.
> 
> Bus-less connections between separate devices (i.e. neither device is a
> part of the other) are also possible.  But I'm failing at grep right
> now.  Here's an example for connecting a device to a machine:
> 
>     static void mch_realize(PCIDevice *d, Error **errp)
>     {
>         int i;
>         MCHPCIState *mch = MCH_PCI_DEVICE(d);
> 
>         [...]
>         object_property_add_const_link(qdev_get_machine(), "smram",
>                                        OBJECT(&mch->smram), &error_abort);
>         [...]
>     }

This is a link to a memory region.  A connection to a separate device
can be found in hw/dma/xilinx_axidma.c and hw/net/xilinx_axienet.c,
where you have

         data stream <------------> data stream
       /                                        \
   dma                                            enet
       \                                        /
         control stream <------> control stream

where the horizontal links in the middle are set up by board code, while
the diagonal lines on the side are set up by device code.

> Paolo, can you provide guidance on when to use a bus, and when not to?

I would definitely use a bus if 1) it is common for the user (and not
for machine code) to set up the connection 2) the relationship is
parent-child.  Link properties are basically unused on the command line,
and it only makes sense to make something different if the connection is
some kind of graph so bus-child does not cut it.

Paolo


  reply	other threads:[~2019-06-26 10:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-17  8:12 [Qemu-devel] [RFC] nvme: how to support multiple namespaces Klaus Birkelund
2019-06-20 15:37 ` Laszlo Ersek
2019-06-24  8:01   ` [Qemu-devel] [Qemu-block] " Klaus Birkelund
2019-06-24 10:18     ` Kevin Wolf
2019-06-24 20:46       ` Laszlo Ersek
2019-06-25  5:51         ` Markus Armbruster
2019-06-25 16:47           ` Klaus Birkelund
2019-06-26  4:46             ` Markus Armbruster
2019-06-26 10:14               ` Paolo Bonzini [this message]
2019-06-26 16:57                 ` Klaus Birkelund
2019-06-25  7:24         ` Kevin Wolf
2019-06-25 16:45       ` Klaus Birkelund
2019-06-26  4:54         ` Markus Armbruster

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=3d94d5af-002a-d079-4e23-8a8b06c11152@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=keith.busch@intel.com \
    --cc=kwolf@redhat.com \
    --cc=lersek@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --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).