qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>,
	Eric Blake <eblake@redhat.com>,
	qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Marcel Apfelbaum <marcel@redhat.com>,
	Laine Stump <laine@redhat.com>
Cc: qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [RFC v4 08/13] ide: enumerate_slots implementation
Date: Wed, 16 Aug 2017 17:46:18 -0400	[thread overview]
Message-ID: <7327f3f6-16fb-e9c6-4f2a-eed6144f2282@redhat.com> (raw)
In-Reply-To: <20170814215748.5158-9-ehabkost@redhat.com>



On 08/14/2017 05:57 PM, Eduardo Habkost wrote:
> Example output when using "-machine q35":
> 
>   {
>     "available": true,
>     "count": 1,
>     "device-types": [
>       "ide-device"
>     ],
>     "hotpluggable": false,
>     "opts": [
>       { "option": "unit", "values": 0 },
>       { "option": "bus", "values": "ide.2" }
>     ],
>     "opts-complete": true
>   }
>   {
>     "available": false,
>     "count": 1,
>     "device": "/machine/unattached/device[19]",
>     "device-types": [
>       "ide-device"
>     ],
>     "hotpluggable": false,
>     "opts": [
>       { "option": "unit", "values": 1 },
>       { "option": "bus", "values": "ide.2" } ],
>     "opts-complete": true
>   }
>   {
>     "available": true,
>     "count": 10,
>     "device-types": [
>       "ide-device"
>     ],
>     "hotpluggable": false,
>     "opts": [
>       { "option": "unit", "values": [ [ 0, 1 ] ] },

Hm, these unit values aren't really correct -- we do not support
primary/secondary semantics for IDE buses on the AHCI device. I guess
they technically exist, but you cannot use them for anything.

Should I do something to "disable" or otherwise hide the unusable
secondary unit slots for AHCI devices?

--js

>       { "option": "bus", "values": [ "ide.4", "ide.3", "ide.5", "ide.0", "ide.1" ] }
>     ],
>     "opts-complete": true
>   }
> 
> Cc: John Snow <jsnow@redhat.com>
> Cc: qemu-block@nongnu.org
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
>  hw/ide/qdev.c | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
> 
> diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
> index f17da1f..cc96f6f 100644
> --- a/hw/ide/qdev.c
> +++ b/hw/ide/qdev.c
> @@ -25,6 +25,7 @@
>  #include "sysemu/block-backend.h"
>  #include "sysemu/blockdev.h"
>  #include "hw/block/block.h"
> +#include "hw/qdev-slotinfo.h"
>  #include "sysemu/sysemu.h"
>  #include "qapi/visitor.h"
>  
> @@ -38,6 +39,30 @@ static Property ide_props[] = {
>      DEFINE_PROP_END_OF_LIST(),
>  };
>  
> +static DeviceSlotInfoList *ide_bus_enumerate_slots(BusState *bus)
> +{
> +    int unit;
> +    DeviceSlotInfoList *r = NULL;
> +    IDEBus *ib = IDE_BUS(bus);
> +
> +    for (unit = 0; unit < 2; unit++) {
> +        DeviceSlotInfo *s = make_slot(bus);
> +        IDEDevice *dev = (unit ? ib->master : ib->slave);
> +        slot_add_opt_int(s, "unit", unit);
> +        s->opts_complete = true;
> +        s->has_count = true;
> +        s->count = 1;
> +        if (dev) {
> +            s->available = false;
> +            s->has_device = true;
> +            s->device = object_get_canonical_path(OBJECT(dev));
> +        }
> +        slot_list_add_slot(&r, s);
> +    }
> +
> +    return r;
> +}
> +
>  static void ide_bus_class_init(ObjectClass *klass, void *data)
>  {
>      BusClass *k = BUS_CLASS(klass);
> @@ -45,6 +70,7 @@ static void ide_bus_class_init(ObjectClass *klass, void *data)
>      k->get_fw_dev_path = idebus_get_fw_dev_path;
>      k->unrealize = idebus_unrealize;
>      k->device_type = TYPE_IDE_DEVICE;
> +    k->enumerate_slots = ide_bus_enumerate_slots;
>  }
>  
>  static void idebus_unrealize(BusState *bus, Error **errp)
> 

  reply	other threads:[~2017-08-16 21:46 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-14 21:57 [Qemu-devel] [RFC v4 00/13] qmp: query-device-slots command Eduardo Habkost
2017-08-14 21:57 ` [Qemu-devel] [RFC v4 01/13] qmp: Define " Eduardo Habkost
2017-08-14 21:57 ` [Qemu-devel] [RFC v4 02/13] qapi: qobject_compare() helper Eduardo Habkost
2017-08-15 16:16   ` Eric Blake
2017-08-15 17:59     ` Eduardo Habkost
2017-08-14 21:57 ` [Qemu-devel] [RFC v4 03/13] qdev: Add BusClass::device_type field Eduardo Habkost
2017-08-14 21:57 ` [Qemu-devel] [RFC v4 04/13] qdev: Slot info helpers Eduardo Habkost
2017-08-14 21:57 ` [Qemu-devel] [RFC v4 05/13] query-device-slots: Collapse similar entries Eduardo Habkost
2017-08-14 21:57 ` [Qemu-devel] [RFC v4 06/13] qdev core: generic enumerate_slots implementation Eduardo Habkost
2017-08-14 21:57 ` [Qemu-devel] [RFC v4 07/13] qdev: Enumerate CPU slots on query-device-slots Eduardo Habkost
2017-08-14 21:57 ` [Qemu-devel] [RFC v4 08/13] ide: enumerate_slots implementation Eduardo Habkost
2017-08-16 21:46   ` John Snow [this message]
2017-08-17  4:54     ` Markus Armbruster
2017-08-17 18:40       ` John Snow
2017-08-18 16:57     ` Eduardo Habkost
2017-08-21 21:46       ` John Snow
2017-08-14 21:57 ` [Qemu-devel] [RFC v4 09/13] pci: pci_bus_has_pcie_upstream_port() function Eduardo Habkost
2017-08-14 21:57 ` [Qemu-devel] [RFC v4 10/13] pci: device-number & function properties Eduardo Habkost
2017-08-14 21:57 ` [Qemu-devel] [RFC v4 11/13] pci: enumerate_slots implementation Eduardo Habkost
2017-08-14 21:57 ` [Qemu-devel] [RFC v4 12/13] usb: " Eduardo Habkost
2017-08-21 11:44   ` Gerd Hoffmann
2017-08-23 17:17     ` Eduardo Habkost
2017-08-14 21:57 ` [Qemu-devel] [RFC v4 13/13] tests: Experimental query-device-slots test code Eduardo Habkost
2017-08-14 22:37 ` [Qemu-devel] [libvirt] [RFC v4 00/13] qmp: query-device-slots command no-reply
2017-08-15 18:57 ` [Qemu-devel] " Eric Blake
2017-08-15 19:44   ` Eduardo Habkost

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=7327f3f6-16fb-e9c6-4f2a-eed6144f2282@redhat.com \
    --to=jsnow@redhat.com \
    --cc=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=laine@redhat.com \
    --cc=marcel@redhat.com \
    --cc=mst@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).