On Wed, May 14, 2025 at 04:40:57PM -0700, Pierrick Bouvier wrote: > From: Daniel P. Berrangé <berra...@redhat.com> > > This removes the TARGET_I386 condition from the rtc-reset-reinjection > command. This requires providing a QMP command stub for non-i386 target. > This in turn requires moving the command out of misc-target.json, since > that will trigger symbol poisoning errors when built from target > independent code. > > Rather than putting the command into misc.json, it is proposed to create > misc-$TARGET.json files to hold commands whose impl is conceptually > only applicable to a single target. This gives an obvious docs hint to > consumers that the command is only useful in relation a specific target, > while misc.json is for commands applicable to 2 or more targets. > > The current impl of qmp_rtc_reset_reinject() is a no-op if the i386 > RTC is disabled in Kconfig, or if the running machine type lack any > RTC device. Thus the stub impl for non-i386 targets retains this > no-op behaviour, instead of reporting a Error which is the more usual > choice for commands invoked against unsupported configurations. > > Signed-off-by: Daniel P. Berrangé <berra...@redhat.com> > Signed-off-by: Pierrick Bouvier <pierrick.bouv...@linaro.org> > --- > qapi/misc-i386.json | 24 ++++++++++++++++++++++++ > qapi/misc-target.json | 17 ----------------- > qapi/qapi-schema.json | 1 + > hw/i386/monitor.c | 2 +- > stubs/monitor-i386-rtc.c | 14 ++++++++++++++ > qapi/meson.build | 1 + > stubs/meson.build | 1 + > 7 files changed, 42 insertions(+), 18 deletions(-) > create mode 100644 qapi/misc-i386.json > create mode 100644 stubs/monitor-i386-rtc.c
> diff --git a/stubs/monitor-i386-rtc.c b/stubs/monitor-i386-rtc.c > new file mode 100644 > index 00000000000..e78757b24f2 > --- /dev/null > +++ b/stubs/monitor-i386-rtc.c > @@ -0,0 +1,14 @@ > +/* SPDX-License-Identifier: GPL-2.0-or-later */ > + > +#include "qemu/osdep.h" > +#include "qapi/error.h" > +#include "qapi/qapi-commands-misc-i386.h" > + > +void qmp_rtc_reset_reinjection(Error **errp) > +{ > + /* > + * Use of this command is only applicable for x86 machines with an RTC, > + * and on other machines will silently return without performing any > + * action. > + */ > +} Based on Markus' feedback, I think we need to report an error here rather than silently ignore the code. The existing real impl of this method can also benefit from removing the assert, but that's not in scope of this series With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|