Re: [PATCH v9 07/17] vfio-user: define vfio-user-server object
On Tue, May 03, 2022 at 10:16:48AM -0400, Jagannathan Raman wrote: > Define vfio-user object which is remote process server for QEMU. Setup > object initialization functions and properties necessary to instantiate > the object > > Signed-off-by: Elena Ufimtseva > Signed-off-by: John G Johnson > Signed-off-by: Jagannathan Raman > --- > qapi/qom.json | 20 +++- > include/hw/remote/machine.h | 2 + > hw/remote/machine.c | 27 + > hw/remote/vfio-user-obj.c | 210 > MAINTAINERS | 1 + > hw/remote/meson.build | 1 + > hw/remote/trace-events | 3 + > 7 files changed, 262 insertions(+), 2 deletions(-) > create mode 100644 hw/remote/vfio-user-obj.c Reviewed-by: Stefan Hajnoczi signature.asc Description: PGP signature
Re: [PATCH v9 07/17] vfio-user: define vfio-user-server object
> On May 5, 2022, at 11:22 AM, Markus Armbruster wrote: > > Stefan Hajnoczi writes: > >> On Wed, May 04, 2022 at 01:45:07PM +0200, Markus Armbruster wrote: >>> Jagannathan Raman writes: >>> Define vfio-user object which is remote process server for QEMU. Setup object initialization functions and properties necessary to instantiate the object Signed-off-by: Elena Ufimtseva Signed-off-by: John G Johnson Signed-off-by: Jagannathan Raman --- qapi/qom.json | 20 +++- include/hw/remote/machine.h | 2 + hw/remote/machine.c | 27 + hw/remote/vfio-user-obj.c | 210 MAINTAINERS | 1 + hw/remote/meson.build | 1 + hw/remote/trace-events | 3 + 7 files changed, 262 insertions(+), 2 deletions(-) create mode 100644 hw/remote/vfio-user-obj.c diff --git a/qapi/qom.json b/qapi/qom.json index eeb5395ff3..582def0522 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -703,6 +703,20 @@ { 'struct': 'RemoteObjectProperties', 'data': { 'fd': 'str', 'devid': 'str' } } +## +# @VfioUserServerProperties: +# +# Properties for x-vfio-user-server objects. +# +# @socket: socket to be used by the libvfio-user library +# +# @device: the id of the device to be emulated at the server >>> >>> Suggest "the ID", because "id" is not a word. >> >> id (noun) >> 1. In Freudian theory, the division of the psyche that is totally >> unconscious and serves as the source of instinctual impulses and demands for >> immediate satisfaction of primitive needs. >> 2. In Weismann's doctrine of germ-plasm, the substance of inheritance or the >> bearer , in the germ-plasm, of the hereditary qualities of a single complete >> organism. >> 3. In the somatic idioplasm of the hereditary qualities of a group of cells >> or a part of a developing embryo or growing organism. >> https://duckduckgo.com/?q=define+id&ia=definition >> >> :D :D :D > > I stand corrected! > > %-) You guys are funny. :) >
Re: [PATCH v9 07/17] vfio-user: define vfio-user-server object
Stefan Hajnoczi writes: > On Wed, May 04, 2022 at 01:45:07PM +0200, Markus Armbruster wrote: >> Jagannathan Raman writes: >> >> > Define vfio-user object which is remote process server for QEMU. Setup >> > object initialization functions and properties necessary to instantiate >> > the object >> > >> > Signed-off-by: Elena Ufimtseva >> > Signed-off-by: John G Johnson >> > Signed-off-by: Jagannathan Raman >> > --- >> > qapi/qom.json | 20 +++- >> > include/hw/remote/machine.h | 2 + >> > hw/remote/machine.c | 27 + >> > hw/remote/vfio-user-obj.c | 210 >> > MAINTAINERS | 1 + >> > hw/remote/meson.build | 1 + >> > hw/remote/trace-events | 3 + >> > 7 files changed, 262 insertions(+), 2 deletions(-) >> > create mode 100644 hw/remote/vfio-user-obj.c >> > >> > diff --git a/qapi/qom.json b/qapi/qom.json >> > index eeb5395ff3..582def0522 100644 >> > --- a/qapi/qom.json >> > +++ b/qapi/qom.json >> > @@ -703,6 +703,20 @@ >> > { 'struct': 'RemoteObjectProperties', >> >'data': { 'fd': 'str', 'devid': 'str' } } >> > >> > +## >> > +# @VfioUserServerProperties: >> > +# >> > +# Properties for x-vfio-user-server objects. >> > +# >> > +# @socket: socket to be used by the libvfio-user library >> > +# >> > +# @device: the id of the device to be emulated at the server >> >> Suggest "the ID", because "id" is not a word. > > id (noun) > 1. In Freudian theory, the division of the psyche that is totally unconscious > and serves as the source of instinctual impulses and demands for immediate > satisfaction of primitive needs. > 2. In Weismann's doctrine of germ-plasm, the substance of inheritance or the > bearer , in the germ-plasm, of the hereditary qualities of a single complete > organism. > 3. In the somatic idioplasm of the hereditary qualities of a group of cells > or a part of a developing embryo or growing organism. > https://duckduckgo.com/?q=define+id&ia=definition > > :D :D :D I stand corrected! %-)
Re: [PATCH v9 07/17] vfio-user: define vfio-user-server object
On Wed, May 04, 2022 at 01:45:07PM +0200, Markus Armbruster wrote: > Jagannathan Raman writes: > > > Define vfio-user object which is remote process server for QEMU. Setup > > object initialization functions and properties necessary to instantiate > > the object > > > > Signed-off-by: Elena Ufimtseva > > Signed-off-by: John G Johnson > > Signed-off-by: Jagannathan Raman > > --- > > qapi/qom.json | 20 +++- > > include/hw/remote/machine.h | 2 + > > hw/remote/machine.c | 27 + > > hw/remote/vfio-user-obj.c | 210 > > MAINTAINERS | 1 + > > hw/remote/meson.build | 1 + > > hw/remote/trace-events | 3 + > > 7 files changed, 262 insertions(+), 2 deletions(-) > > create mode 100644 hw/remote/vfio-user-obj.c > > > > diff --git a/qapi/qom.json b/qapi/qom.json > > index eeb5395ff3..582def0522 100644 > > --- a/qapi/qom.json > > +++ b/qapi/qom.json > > @@ -703,6 +703,20 @@ > > { 'struct': 'RemoteObjectProperties', > >'data': { 'fd': 'str', 'devid': 'str' } } > > > > +## > > +# @VfioUserServerProperties: > > +# > > +# Properties for x-vfio-user-server objects. > > +# > > +# @socket: socket to be used by the libvfio-user library > > +# > > +# @device: the id of the device to be emulated at the server > > Suggest "the ID", because "id" is not a word. id (noun) 1. In Freudian theory, the division of the psyche that is totally unconscious and serves as the source of instinctual impulses and demands for immediate satisfaction of primitive needs. 2. In Weismann's doctrine of germ-plasm, the substance of inheritance or the bearer , in the germ-plasm, of the hereditary qualities of a single complete organism. 3. In the somatic idioplasm of the hereditary qualities of a group of cells or a part of a developing embryo or growing organism. https://duckduckgo.com/?q=define+id&ia=definition :D :D :D Stefan signature.asc Description: PGP signature
Re: [PATCH v9 07/17] vfio-user: define vfio-user-server object
Jag Raman writes: >> On May 4, 2022, at 7:45 AM, Markus Armbruster wrote: >> >> Jagannathan Raman writes: >> >>> Define vfio-user object which is remote process server for QEMU. Setup >>> object initialization functions and properties necessary to instantiate >>> the object >>> >>> Signed-off-by: Elena Ufimtseva >>> Signed-off-by: John G Johnson >>> Signed-off-by: Jagannathan Raman >>> --- >>> qapi/qom.json | 20 +++- >>> include/hw/remote/machine.h | 2 + >>> hw/remote/machine.c | 27 + >>> hw/remote/vfio-user-obj.c | 210 >>> MAINTAINERS | 1 + >>> hw/remote/meson.build | 1 + >>> hw/remote/trace-events | 3 + >>> 7 files changed, 262 insertions(+), 2 deletions(-) >>> create mode 100644 hw/remote/vfio-user-obj.c >>> >>> diff --git a/qapi/qom.json b/qapi/qom.json >>> index eeb5395ff3..582def0522 100644 >>> --- a/qapi/qom.json >>> +++ b/qapi/qom.json >>> @@ -703,6 +703,20 @@ >>> { 'struct': 'RemoteObjectProperties', >>> 'data': { 'fd': 'str', 'devid': 'str' } } >>> >>> +## >>> +# @VfioUserServerProperties: >>> +# >>> +# Properties for x-vfio-user-server objects. >>> +# >>> +# @socket: socket to be used by the libvfio-user library >>> +# >>> +# @device: the id of the device to be emulated at the server >> >> Suggest "the ID", because "id" is not a word. >> >> What kind of ID is this? The kind set with -device id=...? > > Yes, it’s the “id” sub-option of the “-device” option. Will update this > comment. I was just double-checking. I think the comment is okay with "the ID". > Thank you! You're welcome!
Re: [PATCH v9 07/17] vfio-user: define vfio-user-server object
> On May 4, 2022, at 7:45 AM, Markus Armbruster wrote: > > Jagannathan Raman writes: > >> Define vfio-user object which is remote process server for QEMU. Setup >> object initialization functions and properties necessary to instantiate >> the object >> >> Signed-off-by: Elena Ufimtseva >> Signed-off-by: John G Johnson >> Signed-off-by: Jagannathan Raman >> --- >> qapi/qom.json | 20 +++- >> include/hw/remote/machine.h | 2 + >> hw/remote/machine.c | 27 + >> hw/remote/vfio-user-obj.c | 210 >> MAINTAINERS | 1 + >> hw/remote/meson.build | 1 + >> hw/remote/trace-events | 3 + >> 7 files changed, 262 insertions(+), 2 deletions(-) >> create mode 100644 hw/remote/vfio-user-obj.c >> >> diff --git a/qapi/qom.json b/qapi/qom.json >> index eeb5395ff3..582def0522 100644 >> --- a/qapi/qom.json >> +++ b/qapi/qom.json >> @@ -703,6 +703,20 @@ >> { 'struct': 'RemoteObjectProperties', >> 'data': { 'fd': 'str', 'devid': 'str' } } >> >> +## >> +# @VfioUserServerProperties: >> +# >> +# Properties for x-vfio-user-server objects. >> +# >> +# @socket: socket to be used by the libvfio-user library >> +# >> +# @device: the id of the device to be emulated at the server > > Suggest "the ID", because "id" is not a word. > > What kind of ID is this? The kind set with -device id=...? Yes, it’s the “id” sub-option of the “-device” option. Will update this comment. Thank you! -- Jag > >> +# >> +# Since: 7.1 >> +## >> +{ 'struct': 'VfioUserServerProperties', >> + 'data': { 'socket': 'SocketAddress', 'device': 'str' } } >> + >> ## >> # @RngProperties: >> # >> @@ -842,7 +856,8 @@ >> 'tls-creds-psk', >> 'tls-creds-x509', >> 'tls-cipher-suites', >> - { 'name': 'x-remote-object', 'features': [ 'unstable' ] } >> + { 'name': 'x-remote-object', 'features': [ 'unstable' ] }, >> + { 'name': 'x-vfio-user-server', 'features': [ 'unstable' ] } >> ] } >> >> ## >> @@ -905,7 +920,8 @@ >> 'tls-creds-psk': 'TlsCredsPskProperties', >> 'tls-creds-x509': 'TlsCredsX509Properties', >> 'tls-cipher-suites': 'TlsCredsProperties', >> - 'x-remote-object': 'RemoteObjectProperties' >> + 'x-remote-object': 'RemoteObjectProperties', >> + 'x-vfio-user-server': 'VfioUserServerProperties' >> } } >> >> ## > > [...]
Re: [PATCH v9 07/17] vfio-user: define vfio-user-server object
Jagannathan Raman writes: > Define vfio-user object which is remote process server for QEMU. Setup > object initialization functions and properties necessary to instantiate > the object > > Signed-off-by: Elena Ufimtseva > Signed-off-by: John G Johnson > Signed-off-by: Jagannathan Raman > --- > qapi/qom.json | 20 +++- > include/hw/remote/machine.h | 2 + > hw/remote/machine.c | 27 + > hw/remote/vfio-user-obj.c | 210 > MAINTAINERS | 1 + > hw/remote/meson.build | 1 + > hw/remote/trace-events | 3 + > 7 files changed, 262 insertions(+), 2 deletions(-) > create mode 100644 hw/remote/vfio-user-obj.c > > diff --git a/qapi/qom.json b/qapi/qom.json > index eeb5395ff3..582def0522 100644 > --- a/qapi/qom.json > +++ b/qapi/qom.json > @@ -703,6 +703,20 @@ > { 'struct': 'RemoteObjectProperties', >'data': { 'fd': 'str', 'devid': 'str' } } > > +## > +# @VfioUserServerProperties: > +# > +# Properties for x-vfio-user-server objects. > +# > +# @socket: socket to be used by the libvfio-user library > +# > +# @device: the id of the device to be emulated at the server Suggest "the ID", because "id" is not a word. What kind of ID is this? The kind set with -device id=...? > +# > +# Since: 7.1 > +## > +{ 'struct': 'VfioUserServerProperties', > + 'data': { 'socket': 'SocketAddress', 'device': 'str' } } > + > ## > # @RngProperties: > # > @@ -842,7 +856,8 @@ > 'tls-creds-psk', > 'tls-creds-x509', > 'tls-cipher-suites', > -{ 'name': 'x-remote-object', 'features': [ 'unstable' ] } > +{ 'name': 'x-remote-object', 'features': [ 'unstable' ] }, > +{ 'name': 'x-vfio-user-server', 'features': [ 'unstable' ] } >] } > > ## > @@ -905,7 +920,8 @@ >'tls-creds-psk': 'TlsCredsPskProperties', >'tls-creds-x509': 'TlsCredsX509Properties', >'tls-cipher-suites': 'TlsCredsProperties', > - 'x-remote-object':'RemoteObjectProperties' > + 'x-remote-object':'RemoteObjectProperties', > + 'x-vfio-user-server': 'VfioUserServerProperties' >} } > > ## [...]
[PATCH v9 07/17] vfio-user: define vfio-user-server object
Define vfio-user object which is remote process server for QEMU. Setup object initialization functions and properties necessary to instantiate the object Signed-off-by: Elena Ufimtseva Signed-off-by: John G Johnson Signed-off-by: Jagannathan Raman --- qapi/qom.json | 20 +++- include/hw/remote/machine.h | 2 + hw/remote/machine.c | 27 + hw/remote/vfio-user-obj.c | 210 MAINTAINERS | 1 + hw/remote/meson.build | 1 + hw/remote/trace-events | 3 + 7 files changed, 262 insertions(+), 2 deletions(-) create mode 100644 hw/remote/vfio-user-obj.c diff --git a/qapi/qom.json b/qapi/qom.json index eeb5395ff3..582def0522 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -703,6 +703,20 @@ { 'struct': 'RemoteObjectProperties', 'data': { 'fd': 'str', 'devid': 'str' } } +## +# @VfioUserServerProperties: +# +# Properties for x-vfio-user-server objects. +# +# @socket: socket to be used by the libvfio-user library +# +# @device: the id of the device to be emulated at the server +# +# Since: 7.1 +## +{ 'struct': 'VfioUserServerProperties', + 'data': { 'socket': 'SocketAddress', 'device': 'str' } } + ## # @RngProperties: # @@ -842,7 +856,8 @@ 'tls-creds-psk', 'tls-creds-x509', 'tls-cipher-suites', -{ 'name': 'x-remote-object', 'features': [ 'unstable' ] } +{ 'name': 'x-remote-object', 'features': [ 'unstable' ] }, +{ 'name': 'x-vfio-user-server', 'features': [ 'unstable' ] } ] } ## @@ -905,7 +920,8 @@ 'tls-creds-psk': 'TlsCredsPskProperties', 'tls-creds-x509': 'TlsCredsX509Properties', 'tls-cipher-suites': 'TlsCredsProperties', - 'x-remote-object':'RemoteObjectProperties' + 'x-remote-object':'RemoteObjectProperties', + 'x-vfio-user-server': 'VfioUserServerProperties' } } ## diff --git a/include/hw/remote/machine.h b/include/hw/remote/machine.h index 8d0fa98d33..ac32fda387 100644 --- a/include/hw/remote/machine.h +++ b/include/hw/remote/machine.h @@ -24,6 +24,8 @@ struct RemoteMachineState { RemoteIOHubState iohub; bool vfio_user; + +bool auto_shutdown; }; /* Used to pass to co-routine device and ioc. */ diff --git a/hw/remote/machine.c b/hw/remote/machine.c index 9f3cdc55c3..4d008ed721 100644 --- a/hw/remote/machine.c +++ b/hw/remote/machine.c @@ -77,6 +77,28 @@ static void remote_machine_set_vfio_user(Object *obj, bool value, Error **errp) s->vfio_user = value; } +static bool remote_machine_get_auto_shutdown(Object *obj, Error **errp) +{ +RemoteMachineState *s = REMOTE_MACHINE(obj); + +return s->auto_shutdown; +} + +static void remote_machine_set_auto_shutdown(Object *obj, bool value, + Error **errp) +{ +RemoteMachineState *s = REMOTE_MACHINE(obj); + +s->auto_shutdown = value; +} + +static void remote_machine_instance_init(Object *obj) +{ +RemoteMachineState *s = REMOTE_MACHINE(obj); + +s->auto_shutdown = true; +} + static void remote_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); @@ -90,12 +112,17 @@ static void remote_machine_class_init(ObjectClass *oc, void *data) object_class_property_add_bool(oc, "vfio-user", remote_machine_get_vfio_user, remote_machine_set_vfio_user); + +object_class_property_add_bool(oc, "auto-shutdown", + remote_machine_get_auto_shutdown, + remote_machine_set_auto_shutdown); } static const TypeInfo remote_machine = { .name = TYPE_REMOTE_MACHINE, .parent = TYPE_MACHINE, .instance_size = sizeof(RemoteMachineState), +.instance_init = remote_machine_instance_init, .class_init = remote_machine_class_init, .interfaces = (InterfaceInfo[]) { { TYPE_HOTPLUG_HANDLER }, diff --git a/hw/remote/vfio-user-obj.c b/hw/remote/vfio-user-obj.c new file mode 100644 index 00..bc49adcc27 --- /dev/null +++ b/hw/remote/vfio-user-obj.c @@ -0,0 +1,210 @@ +/** + * QEMU vfio-user-server server object + * + * Copyright © 2022 Oracle and/or its affiliates. + * + * This work is licensed under the terms of the GNU GPL-v2, version 2 or later. + * + * See the COPYING file in the top-level directory. + * + */ + +/** + * Usage: add options: + * -machine x-remote,vfio-user=on,auto-shutdown=on + * -device ,id= + * -object x-vfio-user-server,id=,type=unix,path=, + * device= + * + * Note that x-vfio-user-server object must be used with x-remote machine only. + * This server could only support PCI devices for now. + * + * type - SocketAddress type - presently "unix" alone is supported. Required + *option + * + * path - named unix socket, it will be created by the server. It is + *a required option + * + * d