Message ID | 20250307151543.8156-3-philmd@linaro.org |
---|---|
State | Superseded |
Headers | show |
Series | hw/virtio: Build virtio-mem.c once | expand |
On Fri, Mar 7, 2025 at 8:46 PM Philippe Mathieu-Daudé <philmd@linaro.org> wrote: > > acpi_builtin() can be used to check at runtime whether > the ACPI subsystem is built in a qemu-system binary. > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Ah, very similar to something I did recently. Reviewed-by: Ani Sinha <anisinha@redhat.com> > --- > include/hw/acpi/acpi.h | 3 +++ > hw/acpi/acpi-stub.c | 5 +++++ > hw/acpi/core.c | 5 +++++ > 3 files changed, 13 insertions(+) > > diff --git a/include/hw/acpi/acpi.h b/include/hw/acpi/acpi.h > index e0e51e85b41..d1a4fa2af84 100644 > --- a/include/hw/acpi/acpi.h > +++ b/include/hw/acpi/acpi.h > @@ -150,6 +150,9 @@ struct ACPIREGS { > Notifier wakeup; > }; > > +/* Return whether ACPI subsystem is built in */ > +bool acpi_builtin(void); > + > /* PM_TMR */ > void acpi_pm_tmr_update(ACPIREGS *ar, bool enable); > void acpi_pm_tmr_calc_overflow_time(ACPIREGS *ar); > diff --git a/hw/acpi/acpi-stub.c b/hw/acpi/acpi-stub.c > index e268ce9b1a9..790bf509e5d 100644 > --- a/hw/acpi/acpi-stub.c > +++ b/hw/acpi/acpi-stub.c > @@ -25,3 +25,8 @@ void acpi_table_add(const QemuOpts *opts, Error **errp) > { > g_assert_not_reached(); > } > + > +bool acpi_builtin(void) > +{ > + return false; > +} > diff --git a/hw/acpi/core.c b/hw/acpi/core.c > index 870391ed7c8..58f8964e130 100644 > --- a/hw/acpi/core.c > +++ b/hw/acpi/core.c > @@ -78,6 +78,11 @@ static void acpi_register_config(void) > > opts_init(acpi_register_config); > > +bool acpi_builtin(void) > +{ > + return true; > +} > + > static int acpi_checksum(const uint8_t *data, int len) > { > int sum, i; > -- > 2.47.1 >
diff --git a/include/hw/acpi/acpi.h b/include/hw/acpi/acpi.h index e0e51e85b41..d1a4fa2af84 100644 --- a/include/hw/acpi/acpi.h +++ b/include/hw/acpi/acpi.h @@ -150,6 +150,9 @@ struct ACPIREGS { Notifier wakeup; }; +/* Return whether ACPI subsystem is built in */ +bool acpi_builtin(void); + /* PM_TMR */ void acpi_pm_tmr_update(ACPIREGS *ar, bool enable); void acpi_pm_tmr_calc_overflow_time(ACPIREGS *ar); diff --git a/hw/acpi/acpi-stub.c b/hw/acpi/acpi-stub.c index e268ce9b1a9..790bf509e5d 100644 --- a/hw/acpi/acpi-stub.c +++ b/hw/acpi/acpi-stub.c @@ -25,3 +25,8 @@ void acpi_table_add(const QemuOpts *opts, Error **errp) { g_assert_not_reached(); } + +bool acpi_builtin(void) +{ + return false; +} diff --git a/hw/acpi/core.c b/hw/acpi/core.c index 870391ed7c8..58f8964e130 100644 --- a/hw/acpi/core.c +++ b/hw/acpi/core.c @@ -78,6 +78,11 @@ static void acpi_register_config(void) opts_init(acpi_register_config); +bool acpi_builtin(void) +{ + return true; +} + static int acpi_checksum(const uint8_t *data, int len) { int sum, i;
acpi_builtin() can be used to check at runtime whether the ACPI subsystem is built in a qemu-system binary. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- include/hw/acpi/acpi.h | 3 +++ hw/acpi/acpi-stub.c | 5 +++++ hw/acpi/core.c | 5 +++++ 3 files changed, 13 insertions(+)