All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Cc: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
	qemu-devel@nongnu.org, "Peter Maydell" <peter.maydell@linaro.org>,
	eblake@redhat.com, eduardo@habkost.net, berrange@redhat.com,
	pbonzini@redhat.com, marcel.apfelbaum@gmail.com, mst@redhat.com,
	den-plotnikov@yandex-team.ru
Subject: Re: [PATCH v3 14/15] qapi: introduce DEVICE_ON event
Date: Mon, 13 Feb 2023 10:30:54 +0100	[thread overview]
Message-ID: <873579x67l.fsf@pond.sub.org> (raw)
In-Reply-To: <ad626b08-1bc4-7e3b-cc69-e5384a3dc6e3@yandex-team.ru> (Vladimir Sementsov-Ogievskiy's message of "Fri, 10 Feb 2023 16:49:18 +0300")

Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> writes:

> On 10.02.23 00:37, Philippe Mathieu-Daudé wrote:
>> On 9/2/23 21:08, Vladimir Sementsov-Ogievskiy wrote:
>>> We have DEVICE_DELETED event, that signals that device_del command is
>>> actually complited. But we don't have a counter-part for device_add.
>>> Still it's sensible for SHPC and PCIe-native hotplug, as there are time
>>> when the device in some intermediate state. Let's add an event that say
>>> that the device is finally powered on, power indicator is on and
>>> everything is OK for next manipulation on that device.
>>>
>>> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
>>> ---
>>>   qapi/qdev.json | 24 ++++++++++++++++++++++++
>>>   hw/pci/pcie.c  | 12 ++++++++++++
>>>   hw/pci/shpc.c  | 12 ++++++++++++
>>>   3 files changed, 48 insertions(+)
>>>
>>> diff --git a/qapi/qdev.json b/qapi/qdev.json
>>> index 40dc34f091..94da7ca228 100644
>>> --- a/qapi/qdev.json
>>> +++ b/qapi/qdev.json
>>> @@ -220,3 +220,27 @@
>>>   ##
>>>   { 'event': 'HOTPLUG_STATE',
>>>     'data': 'HotplugState' }
>>> +
>>> +
>>> +##
>>> +# @DEVICE_ON:
>>> +#
>>> +# Emitted whenever the device insertion completion is acknowledged by the guest.
>>> +# For now only emitted for SHPC and PCIe-native hotplug.
>>> +#
>>> +# @device: device name

Make that "the device's ID if it has one", and ...

>>> +#
>>> +# @path: device path

... "the device's QOM path", please.

>>> +#
>>> +# Since: 8.0
>>> +#
>>> +# Example:
>>> +#
>>> +# <- { "event": "DEVICE_ON",
>>> +#      "data": { "device": "virtio-net-pci-0",
>>> +#                "path": "/machine/peripheral/virtio-net-pci-0" },
>>
>> Why provide both device & path? Could the type_name be helpful?
>
> I just follow DEVICE_DELETED event. Not sure that it's the best thing to do)

The device ID is redundant, since the QOM path of a device with an ID is
/machine/peripheral/ID.

Fine print: code could conceivably violate this invariant.  But code
should *not* create devices with IDs.  IDs are strictly for the user.

We commonly send both device ID and QOM path, mostly for historical
reasons: the former precede the latter.

There are exceptions, such as query-cpus-fast.  Can't say offhand
whether CPUs can be created with IDs.

It's probably best to remain consistent with DEVICE_DELETED here.

I'd be in favour of deprecating and deleting redundant device IDs in QMP
output.

[...]



  reply	other threads:[~2023-02-13  9:35 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-09 20:07 [PATCH v3 00/15] pci hotplug tracking Vladimir Sementsov-Ogievskiy
2023-02-09 20:07 ` [PATCH v3 01/15] pci/shpc: set attention led to OFF on reset Vladimir Sementsov-Ogievskiy
2023-02-09 20:07 ` [PATCH v3 02/15] pci/shpc: change shpc_get_status() return type to uint8_t Vladimir Sementsov-Ogievskiy
2023-02-09 20:07 ` [PATCH v3 03/15] pci/shpc: shpc_slot_command(): handle PWRONLY -> ENABLED transition Vladimir Sementsov-Ogievskiy
2023-02-09 20:07 ` [PATCH v3 04/15] pci/shpc: more generic handle hot-unplug in shpc_slot_command() Vladimir Sementsov-Ogievskiy
2023-02-09 20:07 ` [PATCH v3 05/15] pci/shpc: pass PCIDevice pointer to shpc_slot_command() Vladimir Sementsov-Ogievskiy
2023-02-09 20:07 ` [PATCH v3 06/15] pcie: pcie_cap_slot_write_config(): use correct macro Vladimir Sementsov-Ogievskiy
2023-02-09 20:08 ` [PATCH v3 07/15] pcie_regs: drop duplicated indicator value macros Vladimir Sementsov-Ogievskiy
2023-02-09 20:08 ` [PATCH v3 08/15] pcie: drop unused PCIExpressIndicator Vladimir Sementsov-Ogievskiy
2023-02-09 20:08 ` [PATCH v3 09/15] pcie: pcie_cap_slot_enable_power() use correct helper Vladimir Sementsov-Ogievskiy
2023-02-09 20:08 ` [PATCH v3 10/15] pcie: introduce pcie_sltctl_powered_off() helper Vladimir Sementsov-Ogievskiy
2023-02-09 21:23   ` Philippe Mathieu-Daudé
2023-02-09 20:08 ` [PATCH v3 11/15] pcie: set power indicator to off on reset by default Vladimir Sementsov-Ogievskiy
2023-02-09 20:08 ` [PATCH v3 12/15] pci: introduce pci_find_the_only_child() Vladimir Sementsov-Ogievskiy
2023-02-09 20:08 ` [PATCH v3 13/15] qapi: add HOTPLUG_STATE event Vladimir Sementsov-Ogievskiy
2023-02-09 21:28   ` Philippe Mathieu-Daudé
2023-02-10 10:47     ` Vladimir Sementsov-Ogievskiy
2023-02-10 11:20       ` Philippe Mathieu-Daudé
2023-02-10 10:23   ` Markus Armbruster
2023-02-10 11:36     ` Vladimir Sementsov-Ogievskiy
2023-02-10 12:01       ` Markus Armbruster
2023-02-10 13:38         ` Vladimir Sementsov-Ogievskiy
2023-02-09 20:08 ` [PATCH v3 14/15] qapi: introduce DEVICE_ON event Vladimir Sementsov-Ogievskiy
2023-02-09 21:37   ` Philippe Mathieu-Daudé
2023-02-10 13:49     ` Vladimir Sementsov-Ogievskiy
2023-02-13  9:30       ` Markus Armbruster [this message]
2023-02-13 11:43         ` Vladimir Sementsov-Ogievskiy
2023-02-09 20:08 ` [PATCH v3 15/15] qapi: introduce query-hotplug command Vladimir Sementsov-Ogievskiy
2023-02-10 10:09   ` Markus Armbruster
2023-02-10 13:51     ` Vladimir Sementsov-Ogievskiy

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=873579x67l.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=den-plotnikov@yandex-team.ru \
    --cc=eblake@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@yandex-team.ru \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.