All of lore.kernel.org
 help / color / mirror / Atom feed
* Can we unpoison CONFIG_FOO macros?
@ 2023-02-07 15:39 Markus Armbruster
  2023-02-07 15:50 ` Peter Maydell
  2023-02-07 20:54 ` Thomas Huth
  0 siblings, 2 replies; 5+ messages in thread
From: Markus Armbruster @ 2023-02-07 15:39 UTC (permalink / raw)
  To: qemu-devel
  Cc: Philippe Mathieu-Daudé, Thomas Huth, Peter Maydell,
	Paolo Bonzini, Daniel P. Berrange, Eduardo Habkost,
	Cédric Le Goater, Mark Cave-Ayland, Mark Burton, Luc Michel,
	Bernhard Beschow, Bin Meng, Alistair Francis

We have a boatload of CONFIG_FOO macros that may only be used in
target-dependent code.  We use generated config-poison.h to enforce.

This is a bit annoying in the QAPI schema.  Let me demonstrate with an
example: QMP commands query-rocker, query-rocker-ports, and so forth.
These commands are useful only with "rocker" devices.  They are
compile-time optional.  hw/net/Kconfig:

    config ROCKER
        bool
        default y if PCI_DEVICES
        depends on PCI && MSI_NONBROKEN

The rocker device and QMP code is actually target-independent:
hw/net/meson.build puts it into softmmu_ss.

Disabling the "rocker" device type ideally disables the rocker QMP
commands, too.  Should be easy enough: 'if': 'CONFIG_FOO' in the QAPI
schema.

Except that makes the entire code QAPI generates for rocker.json
device-dependent: it now contains #if defined(CONFIG_ROCKER), and
CONFIG_ROCKER is poisoned.  The rocker code implementing monitor
commands also becomes device-dependent, because it includes generated
headers.  We compile all that per target for no sane reason at all.
That's why we don't actually disable the commands.

Not disabling them creates another problem: we have the commands always,
but their implementation depends on CONFIG_ROCKER.  So we provide stubs
that always fail for use when CONFIG_ROCKER is off.  Drawbacks: we
generate, compile and link useless code, and QAPI/QMP introspection is
less useful than it could be.

This isn't terrible.  It still annoys me.  I wonder whether Philippe's
work on having a single qemu-system binary could improve things here.

Comments?



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-02-09 10:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-07 15:39 Can we unpoison CONFIG_FOO macros? Markus Armbruster
2023-02-07 15:50 ` Peter Maydell
2023-02-09 10:43   ` Markus Armbruster
2023-02-07 20:54 ` Thomas Huth
2023-02-09 10:57   ` Markus Armbruster

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.