qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [Qemu-block] [RFC] nvme: how to support multiple namesp


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [Qemu-block] [RFC] nvme: how to support multiple namespaces
Date: Wed, 26 Jun 2019 12:14:15 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0

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 via email to

[Prev in Thread] Current Thread [Next in Thread]