From: Laszlo Ersek <lersek@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Kevin Wolf" <kwolf@redhat.com>,
"Daniel P . Berrange" <berrange@redhat.com>,
qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Eduardo Habkost <ehabkost@redhat.com>,
qemu-block@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [RFC PATCH 1/3] qom: Always register FW_CFG_DATA_GENERATOR_INTERFACE
Date: Tue, 6 Oct 2020 10:28:23 +0200 [thread overview]
Message-ID: <ab0313b0-57e1-c6ab-0415-1d0c3bde05df@redhat.com> (raw)
In-Reply-To: <20201005105442.2093105-2-philmd@redhat.com>
On 10/05/20 12:54, Philippe Mathieu-Daudé wrote:
> While the FW_CFG_DATA_GENERATOR_INTERFACE is only consumed
> by a device only available using system-mode (fw_cfg), it is
> implemented by a crypto component (tls-cipher-suites) which
> is always available when crypto is used.
>
> Commit 69699f3055 introduced the following error in the
> qemu-storage-daemon binary:
>
> $ echo -e \
> '{"execute": "qmp_capabilities"}\r\n{"execute": "qom-list-types"}\r\n{"execute": "quit"}\r\n' \
> | storage-daemon/qemu-storage-daemon --chardev stdio,id=qmp0 --monitor qmp0
> {"QMP": {"version": {"qemu": {"micro": 50, "minor": 1, "major": 5}, "package": ""}, "capabilities": ["oob"]}}
> {"return": {}}
> missing interface 'fw_cfg-data-generator' for object 'tls-creds'
> Aborted (core dumped)
>
> Since QOM dependencies are resolved at runtime, this issue
> could not be triggered at linktime,
O_o
I'll defer the review of this work to others with actual QOM knowledge.
Please ping me when the series is otherwise ready; I'll be happy to ACK
the fw_cfg parts (if any).
Laszlo
> and we don't have test
> running the qemu-storage-daemon binary.
>
> Fix by always registering the QOM interface.
>
> Reported-by: Kevin Wolf <kwolf@redhat.com>
> Fixes: 69699f3055 ("crypto/tls-cipher-suites: Produce fw_cfg consumable blob")
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> I first used:
>
> +if config_host.has_key('CONFIG_GNUTLS') or have_system
> + qom_ss.add(files('fw_cfg_interface.c'))
> +endif
>
> but then realized anything could implement a QOM interface,
> so better keep this generic.
> ---
> hw/nvram/fw_cfg.c | 7 -------
> qom/fw_cfg_interface.c | 15 +++++++++++++++
> MAINTAINERS | 1 +
> qom/meson.build | 5 +++++
> 4 files changed, 21 insertions(+), 7 deletions(-)
> create mode 100644 qom/fw_cfg_interface.c
>
> diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
> index 0e95d057fd..08539a1aab 100644
> --- a/hw/nvram/fw_cfg.c
> +++ b/hw/nvram/fw_cfg.c
> @@ -1360,18 +1360,11 @@ static const TypeInfo fw_cfg_mem_info = {
> .class_init = fw_cfg_mem_class_init,
> };
>
> -static const TypeInfo fw_cfg_data_generator_interface_info = {
> - .parent = TYPE_INTERFACE,
> - .name = TYPE_FW_CFG_DATA_GENERATOR_INTERFACE,
> - .class_size = sizeof(FWCfgDataGeneratorClass),
> -};
> -
> static void fw_cfg_register_types(void)
> {
> type_register_static(&fw_cfg_info);
> type_register_static(&fw_cfg_io_info);
> type_register_static(&fw_cfg_mem_info);
> - type_register_static(&fw_cfg_data_generator_interface_info);
> }
>
> type_init(fw_cfg_register_types)
> diff --git a/qom/fw_cfg_interface.c b/qom/fw_cfg_interface.c
> new file mode 100644
> index 0000000000..2b19502ffe
> --- /dev/null
> +++ b/qom/fw_cfg_interface.c
> @@ -0,0 +1,15 @@
> +#include "qemu/osdep.h"
> +#include "hw/nvram/fw_cfg.h"
> +
> +static const TypeInfo fw_cfg_data_generator_interface_info = {
> + .parent = TYPE_INTERFACE,
> + .name = TYPE_FW_CFG_DATA_GENERATOR_INTERFACE,
> + .class_size = sizeof(FWCfgDataGeneratorClass),
> +};
> +
> +static void fw_cfg_register_types(void)
> +{
> + type_register_static(&fw_cfg_data_generator_interface_info);
> +}
> +
> +type_init(fw_cfg_register_types)
> diff --git a/MAINTAINERS b/MAINTAINERS
> index b76fb31861..9c89d54b41 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -2055,6 +2055,7 @@ R: Gerd Hoffmann <kraxel@redhat.com>
> S: Supported
> F: docs/specs/fw_cfg.txt
> F: hw/nvram/fw_cfg.c
> +F: qom/fw_cfg_interface.c
> F: stubs/fw_cfg.c
> F: include/hw/nvram/fw_cfg.h
> F: include/standard-headers/linux/qemu_fw_cfg.h
> diff --git a/qom/meson.build b/qom/meson.build
> index a1cd03c82c..7335f8c8a2 100644
> --- a/qom/meson.build
> +++ b/qom/meson.build
> @@ -7,6 +7,11 @@ qom_ss.add(files(
> 'qom-qobject.c',
> ))
>
> +# interfaces any object might implement
> +qom_ss.add(files(
> + 'fw_cfg_interface.c',
> +))
> +
> qmp_ss.add(files('qom-qmp-cmds.c'))
> softmmu_ss.add(files('qom-hmp-cmds.c'))
>
>
next prev parent reply other threads:[~2020-10-06 8:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-05 10:54 [RFC PATCH 0/3] qom: Fix missing interface in qemu-storage-daemon Philippe Mathieu-Daudé
2020-10-05 10:54 ` [RFC PATCH 1/3] qom: Always register FW_CFG_DATA_GENERATOR_INTERFACE Philippe Mathieu-Daudé
2020-10-05 13:22 ` Daniel P. Berrangé
2020-10-06 9:50 ` Philippe Mathieu-Daudé
2020-10-06 8:28 ` Laszlo Ersek [this message]
2020-10-05 10:54 ` [RFC PATCH 2/3] tests: Only build socket_scm_helper when a softmmu target is available Philippe Mathieu-Daudé
2020-10-05 10:54 ` [RFC PATCH 3/3] tests: Add a trivial qemu-storage-daemon test Philippe Mathieu-Daudé
2020-10-05 13:19 ` Paolo Bonzini
2020-10-05 11:00 ` [RFC PATCH 0/3] qom: Fix missing interface in qemu-storage-daemon no-reply
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=ab0313b0-57e1-c6ab-0415-1d0c3bde05df@redhat.com \
--to=lersek@redhat.com \
--cc=berrange@redhat.com \
--cc=ehabkost@redhat.com \
--cc=kraxel@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@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).