> On Apr 22, 2022, at 1:14 AM, Markus Armbruster <arm...@redhat.com> wrote:
> 
> Jag Raman <jag.ra...@oracle.com> writes:
> 
>>> On Apr 21, 2022, at 10:59 AM, Markus Armbruster <arm...@redhat.com> wrote:
>>> 
>>> Jagannathan Raman <jag.ra...@oracle.com> writes:
>>> 
>>>> Setup a handler to run vfio-user context. The context is driven by
>>>> messages to the file descriptor associated with it - get the fd for
>>>> the context and hook up the handler with it
>>>> 
>>>> Signed-off-by: Elena Ufimtseva <elena.ufimts...@oracle.com>
>>>> Signed-off-by: John G Johnson <john.g.john...@oracle.com>
>>>> Signed-off-by: Jagannathan Raman <jag.ra...@oracle.com>
>>>> Reviewed-by: Stefan Hajnoczi <stefa...@redhat.com>
>>>> ---
>>>> qapi/misc.json            | 23 ++++++++++
>>>> hw/remote/vfio-user-obj.c | 95 ++++++++++++++++++++++++++++++++++++++-
>>>> 2 files changed, 117 insertions(+), 1 deletion(-)
>>>> 
>>>> diff --git a/qapi/misc.json b/qapi/misc.json
>>>> index b83cc39029..f3cc4a4854 100644
>>>> --- a/qapi/misc.json
>>>> +++ b/qapi/misc.json
>>>> @@ -553,3 +553,26 @@
>>>> ##
>>>> { 'event': 'RTC_CHANGE',
>>>>  'data': { 'offset': 'int', 'qom-path': 'str' } }
>>>> +
>>>> +##
>>>> +# @VFU_CLIENT_HANGUP:
>>>> +#
>>>> +# Emitted when the client of a TYPE_VFIO_USER_SERVER closes the
>>>> +# communication channel
>>>> +#
>>>> +# @id: ID of the TYPE_VFIO_USER_SERVER object
>>>> +#
>>>> +# @device: ID of attached PCI device
>>> 
>>> Is this the ID set with -device id=... and such?
>> 
>> Yes, that is correct. It’s the ID set with the “-device id=…” option/
> 
> What happens when the device was added *without* id=...?  DeviceState
> member @id is null then.

I’m sorry, the @id member in the event is the same as DeviceState->id, but
it’s not directly derived from it. It derived from  VfuObject->device, which is
a property of TYPE_VFU_OBJECT that the user sets.

This will not be NULL, as  TYPE_VFU_OBJECT will not initialize without it.

> 
> I figure we need to make @device optional here, present if the device
> has an ID.  I recommend to also add a member @qom-path, like we did for
> MEMORY_DEVICE_SIZE_CHANGE in commit d89dd28f0e2.

OK, will add it.

Thank you!
--
Jag

> 

Reply via email to