qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>,
	Marcel Apfelbaum <marcel@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	libvir-list@redhat.com, Laine Stump <laine@redhat.com>,
	David Gibson <david@gibson.dropbear.id.au>,
	"Jason J. Herne" <jjherne@us.ibm.com>
Subject: Re: [Qemu-devel] [RFC v2] qmp: query-device-slots command
Date: Thu, 15 Dec 2016 10:36:17 +0100	[thread overview]
Message-ID: <20161215103617.071b418d@nial.brq.redhat.com> (raw)
In-Reply-To: <1481744348-8868-1-git-send-email-ehabkost@redhat.com>

On Wed, 14 Dec 2016 17:39:08 -0200
Eduardo Habkost <ehabkost@redhat.com> wrote:

> This adds a new command to QMP: query-device-slots. It will allow
> management software to query possible slots where devices can be
> plugged.
> 
> This implementation of the command will return:
> 
> * Multiple PCI slots per bus, in the case of PCI buses;
> * One slot per bus for the other buses (that don't
>   implement slot enumeration yet);
> * One slot for each entry from query-hotpluggable-cpus.
Perhaps command should handle slots enumeration for DIMM/NV-DIMM
devices as well which are also bus-less as cpus but don't have
dedicated command for possible slots enumeration.

[...]
> +##
> +# @DeviceSlotInfo:
> +#
> +# Information on a slot where devices can be plugged.
> +#
> +# @type: type of device slot.
> +#
> +# @accepted-device-types: List of device types accepted by the slot.
> +#                         Any device plugged to the slot should implement
> +#                         one of the accepted device types.
> +#
> +# @available: If false, the slot is not available for plugging any device.
> +#             This value can change at runtime if condition changes
> +#             (e.g. if the slot becomes full, or if the machine
> +#             was already initialized and the slot doesn't support
> +#             hotplug).
or slot has been freed as result of unplug action


> +# @hotpluggable: If true, the slot accepts hotplugged devices.
> +#
> +# @props: The arguments that should be given to @device_add if plugging
> +#         a device to this slot.
Could it be a list of arbitrary properties?
What do we gain making it a union of fixed types which are in the end just property lists?

[...]
> +{
> +    SlotListState s = { };
> +    MachineState *ms = MACHINE(qdev_get_machine());
> +    MachineClass *mc = MACHINE_GET_CLASS(ms);
> +
> +    s.machine = ms;
> +    s.next = &s.result;
> +
> +    /* We build the device slot list from two sources:
> +     * 1) Calling the BusClass::enumerate_slots() method on all buses;
> +     * 2) The return value of MachineClass::query_hotpluggable_cpus()
> +     */
> +
> +
> +    object_child_foreach_recursive(qdev_get_machine(), walk_bus, &s);
> +    if (s.err) {
> +        goto out;
> +    }
> +
> +    if (mc->query_hotpluggable_cpus) {
> +        HotpluggableCPUList *hcl = mc->query_hotpluggable_cpus(ms);
> +        HotpluggableCPUList *i;
> +
> +        for (i = hcl; i; i = i->next) {
> +            DeviceSlotInfoList *r = g_new0(DeviceSlotInfoList, 1);
> +            HotpluggableCPU *hc = i->value;
> +            r->value = g_new0(DeviceSlotInfo, 1);
> +            r->value->type = DEVICE_SLOT_TYPE_CPU;
> +            r->value->accepted_device_types = g_new0(strList, 1);
> +            r->value->accepted_device_types->value = g_strdup(hc->type);
> +            r->value->available = !hc->has_qom_path;
> +            /*TODO: should it be always true? */
> +            r->value->hotpluggable = true;
it shouldn't be true for BSP, and for the rest of x86 cpus it's true
provided machine versions supports cpu hotplug.

But it might be another story for SPAPR or s390,
CCing maintainers.

> +
> +            r->value->u.cpu.props = QAPI_CLONE(CpuInstanceProperties,
> +                                               hc->props);
> +            *s.next = r;
> +            s.next = & r->next;
> +        }
> +
> +        qapi_free_HotpluggableCPUList(hcl);
> +    }
> +
> +out:
> +    error_propagate(errp, s.err);
> +    return s.result;
> +}
> +
>  
>  #define qdev_printf(fmt, ...) monitor_printf(mon, "%*s" fmt, indent, "", ## __VA_ARGS__)
>  static void qbus_print(Monitor *mon, BusState *bus, int indent);

  reply	other threads:[~2016-12-15  9:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-14 19:39 [Qemu-devel] [RFC v2] qmp: query-device-slots command Eduardo Habkost
2016-12-15  9:36 ` Igor Mammedov [this message]
2016-12-15 17:53   ` Eduardo Habkost
2016-12-15 12:39 ` Markus Armbruster
2016-12-15 19:31   ` 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=20161215103617.071b418d@nial.brq.redhat.com \
    --to=imammedo@redhat.com \
    --cc=armbru@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=ehabkost@redhat.com \
    --cc=jjherne@us.ibm.com \
    --cc=laine@redhat.com \
    --cc=libvir-list@redhat.com \
    --cc=marcel@redhat.com \
    --cc=mst@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).