qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/3] Remove arch_init SMBIOS and ACPI code
@ 2017-01-17 19:30 Eduardo Habkost
  2017-01-17 19:30 ` [Qemu-devel] [PATCH 1/3] stubs: Add smbios_entry_add() stub Eduardo Habkost
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Eduardo Habkost @ 2017-01-17 19:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Michael S. Tsirkin, Igor Mammedov

This creates stubs for SMBIOS and ACPI option parsing functions,
so that we don't need arch-specific #ifdefs in arch_init just for
calling the option parsers.

Eduardo Habkost (3):
  stubs: Add smbios_entry_add() stub
  stubs: acpi_table_add() stub
  arch_init: Move acpi_table_add() call back to vl.c

 include/sysemu/arch_init.h |  2 --
 arch_init.c                | 20 --------------------
 stubs/acpi.c               |  7 +++++++
 stubs/smbios.c             |  7 +++++++
 vl.c                       |  9 +++++++--
 stubs/Makefile.objs        |  2 ++
 6 files changed, 23 insertions(+), 24 deletions(-)
 create mode 100644 stubs/acpi.c
 create mode 100644 stubs/smbios.c

-- 
2.11.0.259.g40922b1

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

* [Qemu-devel] [PATCH 1/3] stubs: Add smbios_entry_add() stub
  2017-01-17 19:30 [Qemu-devel] [PATCH 0/3] Remove arch_init SMBIOS and ACPI code Eduardo Habkost
@ 2017-01-17 19:30 ` Eduardo Habkost
  2017-01-17 19:30 ` [Qemu-devel] [PATCH 2/3] stubs: acpi_table_add() stub Eduardo Habkost
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Eduardo Habkost @ 2017-01-17 19:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Michael S. Tsirkin, Igor Mammedov

Instead of using an #ifdef in arch_init.c, add a
smbios_entry_add() stub. The stub will never be called because
the -smbios option is defined as arch-specific in
qemu-options.hx.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 include/sysemu/arch_init.h | 1 -
 arch_init.c                | 7 -------
 stubs/smbios.c             | 7 +++++++
 vl.c                       | 2 +-
 stubs/Makefile.objs        | 1 +
 5 files changed, 9 insertions(+), 9 deletions(-)
 create mode 100644 stubs/smbios.c

diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h
index 1c9dad1b72..88dcf77a62 100644
--- a/include/sysemu/arch_init.h
+++ b/include/sysemu/arch_init.h
@@ -29,7 +29,6 @@ extern const uint32_t arch_type;
 
 void select_soundhw(const char *optarg);
 void do_acpitable_option(const QemuOpts *opts);
-void do_smbios_option(QemuOpts *opts);
 void audio_init(void);
 int kvm_available(void);
 int xen_available(void);
diff --git a/arch_init.c b/arch_init.c
index 5cc58b2c35..9647c8d337 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -248,13 +248,6 @@ void do_acpitable_option(const QemuOpts *opts)
 #endif
 }
 
-void do_smbios_option(QemuOpts *opts)
-{
-#ifdef TARGET_I386
-    smbios_entry_add(opts);
-#endif
-}
-
 int kvm_available(void)
 {
 #ifdef CONFIG_KVM
diff --git a/stubs/smbios.c b/stubs/smbios.c
new file mode 100644
index 0000000000..e86e8f821c
--- /dev/null
+++ b/stubs/smbios.c
@@ -0,0 +1,7 @@
+#include "qemu/osdep.h"
+#include "hw/smbios/smbios.h"
+
+void smbios_entry_add(QemuOpts *opts)
+{
+    abort(); /* must never be called */
+}
diff --git a/vl.c b/vl.c
index c643d3ff3a..38d812286a 100644
--- a/vl.c
+++ b/vl.c
@@ -3707,7 +3707,7 @@ int main(int argc, char **argv, char **envp)
                 if (!opts) {
                     exit(1);
                 }
-                do_smbios_option(opts);
+                smbios_entry_add(opts);
                 break;
             case QEMU_OPTION_fwcfg:
                 opts = qemu_opts_parse_noisily(qemu_find_opts("fw_cfg"),
diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
index 2b5bb74fce..83ddcad3c3 100644
--- a/stubs/Makefile.objs
+++ b/stubs/Makefile.objs
@@ -50,3 +50,4 @@ stub-obj-y += smbios_type_38.o
 stub-obj-y += ipmi.o
 stub-obj-y += pc_madt_cpu_entry.o
 stub-obj-y += migration-colo.o
+stub-obj-y += smbios.o
-- 
2.11.0.259.g40922b1

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

* [Qemu-devel] [PATCH 2/3] stubs: acpi_table_add() stub
  2017-01-17 19:30 [Qemu-devel] [PATCH 0/3] Remove arch_init SMBIOS and ACPI code Eduardo Habkost
  2017-01-17 19:30 ` [Qemu-devel] [PATCH 1/3] stubs: Add smbios_entry_add() stub Eduardo Habkost
@ 2017-01-17 19:30 ` Eduardo Habkost
  2017-01-17 19:30 ` [Qemu-devel] [PATCH 3/3] arch_init: Move acpi_table_add() call back to vl.c Eduardo Habkost
  2017-01-18  9:07 ` [Qemu-devel] [PATCH 0/3] Remove arch_init SMBIOS and ACPI code Paolo Bonzini
  3 siblings, 0 replies; 5+ messages in thread
From: Eduardo Habkost @ 2017-01-17 19:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Michael S. Tsirkin, Igor Mammedov

Create a stub to avoid an #ifdef in do_acpitable_option().

The stub should never be called because -acpitable is defined as
arch-specific in qemu-options.hx.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 arch_init.c         | 2 --
 stubs/acpi.c        | 7 +++++++
 stubs/Makefile.objs | 1 +
 3 files changed, 8 insertions(+), 2 deletions(-)
 create mode 100644 stubs/acpi.c

diff --git a/arch_init.c b/arch_init.c
index 9647c8d337..0416d84211 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -237,7 +237,6 @@ void audio_init(void)
 
 void do_acpitable_option(const QemuOpts *opts)
 {
-#ifdef TARGET_I386
     Error *err = NULL;
 
     acpi_table_add(opts, &err);
@@ -245,7 +244,6 @@ void do_acpitable_option(const QemuOpts *opts)
         error_reportf_err(err, "Wrong acpi table provided: ");
         exit(1);
     }
-#endif
 }
 
 int kvm_available(void)
diff --git a/stubs/acpi.c b/stubs/acpi.c
new file mode 100644
index 0000000000..65ef2d7086
--- /dev/null
+++ b/stubs/acpi.c
@@ -0,0 +1,7 @@
+#include "qemu/osdep.h"
+#include "hw/acpi/acpi.h"
+
+void acpi_table_add(const QemuOpts *opts, Error **errp)
+{
+    abort(); /* must never be called */
+}
diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
index 83ddcad3c3..18236935d5 100644
--- a/stubs/Makefile.objs
+++ b/stubs/Makefile.objs
@@ -51,3 +51,4 @@ stub-obj-y += ipmi.o
 stub-obj-y += pc_madt_cpu_entry.o
 stub-obj-y += migration-colo.o
 stub-obj-y += smbios.o
+stub-obj-y += acpi.o
-- 
2.11.0.259.g40922b1

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

* [Qemu-devel] [PATCH 3/3] arch_init: Move acpi_table_add() call back to vl.c
  2017-01-17 19:30 [Qemu-devel] [PATCH 0/3] Remove arch_init SMBIOS and ACPI code Eduardo Habkost
  2017-01-17 19:30 ` [Qemu-devel] [PATCH 1/3] stubs: Add smbios_entry_add() stub Eduardo Habkost
  2017-01-17 19:30 ` [Qemu-devel] [PATCH 2/3] stubs: acpi_table_add() stub Eduardo Habkost
@ 2017-01-17 19:30 ` Eduardo Habkost
  2017-01-18  9:07 ` [Qemu-devel] [PATCH 0/3] Remove arch_init SMBIOS and ACPI code Paolo Bonzini
  3 siblings, 0 replies; 5+ messages in thread
From: Eduardo Habkost @ 2017-01-17 19:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Michael S. Tsirkin, Igor Mammedov

Now that the code is not arch-dependent anymore, it can be moved
back to vl.c.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 include/sysemu/arch_init.h |  1 -
 arch_init.c                | 11 -----------
 vl.c                       |  7 ++++++-
 3 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h
index 88dcf77a62..20b01e3004 100644
--- a/include/sysemu/arch_init.h
+++ b/include/sysemu/arch_init.h
@@ -28,7 +28,6 @@ enum {
 extern const uint32_t arch_type;
 
 void select_soundhw(const char *optarg);
-void do_acpitable_option(const QemuOpts *opts);
 void audio_init(void);
 int kvm_available(void);
 int xen_available(void);
diff --git a/arch_init.c b/arch_init.c
index 0416d84211..591afe6e2c 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -235,17 +235,6 @@ void audio_init(void)
     }
 }
 
-void do_acpitable_option(const QemuOpts *opts)
-{
-    Error *err = NULL;
-
-    acpi_table_add(opts, &err);
-    if (err) {
-        error_reportf_err(err, "Wrong acpi table provided: ");
-        exit(1);
-    }
-}
-
 int kvm_available(void)
 {
 #ifdef CONFIG_KVM
diff --git a/vl.c b/vl.c
index 38d812286a..9571b17eb6 100644
--- a/vl.c
+++ b/vl.c
@@ -65,6 +65,7 @@ int main(int argc, char **argv)
 #include "hw/bt.h"
 #include "sysemu/watchdog.h"
 #include "hw/smbios/smbios.h"
+#include "hw/acpi/acpi.h"
 #include "hw/xen/xen.h"
 #include "hw/qdev.h"
 #include "hw/loader.h"
@@ -3699,7 +3700,11 @@ int main(int argc, char **argv, char **envp)
                 if (!opts) {
                     exit(1);
                 }
-                do_acpitable_option(opts);
+                acpi_table_add(opts, &err);
+                if (err) {
+                    error_reportf_err(err, "Wrong acpi table provided: ");
+                    exit(1);
+                }
                 break;
             case QEMU_OPTION_smbios:
                 opts = qemu_opts_parse_noisily(qemu_find_opts("smbios"),
-- 
2.11.0.259.g40922b1

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

* Re: [Qemu-devel] [PATCH 0/3] Remove arch_init SMBIOS and ACPI code
  2017-01-17 19:30 [Qemu-devel] [PATCH 0/3] Remove arch_init SMBIOS and ACPI code Eduardo Habkost
                   ` (2 preceding siblings ...)
  2017-01-17 19:30 ` [Qemu-devel] [PATCH 3/3] arch_init: Move acpi_table_add() call back to vl.c Eduardo Habkost
@ 2017-01-18  9:07 ` Paolo Bonzini
  3 siblings, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2017-01-18  9:07 UTC (permalink / raw)
  To: Eduardo Habkost, qemu-devel; +Cc: Igor Mammedov, Michael S. Tsirkin



On 17/01/2017 20:30, Eduardo Habkost wrote:
> This creates stubs for SMBIOS and ACPI option parsing functions,
> so that we don't need arch-specific #ifdefs in arch_init just for
> calling the option parsers.
> 
> Eduardo Habkost (3):
>   stubs: Add smbios_entry_add() stub
>   stubs: acpi_table_add() stub
>   arch_init: Move acpi_table_add() call back to vl.c
> 
>  include/sysemu/arch_init.h |  2 --
>  arch_init.c                | 20 --------------------
>  stubs/acpi.c               |  7 +++++++
>  stubs/smbios.c             |  7 +++++++
>  vl.c                       |  9 +++++++--
>  stubs/Makefile.objs        |  2 ++
>  6 files changed, 23 insertions(+), 24 deletions(-)
>  create mode 100644 stubs/acpi.c
>  create mode 100644 stubs/smbios.c
> 

Pretty much the same patches are in my pending pull request.

Paolo

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

end of thread, other threads:[~2017-01-18  9:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-17 19:30 [Qemu-devel] [PATCH 0/3] Remove arch_init SMBIOS and ACPI code Eduardo Habkost
2017-01-17 19:30 ` [Qemu-devel] [PATCH 1/3] stubs: Add smbios_entry_add() stub Eduardo Habkost
2017-01-17 19:30 ` [Qemu-devel] [PATCH 2/3] stubs: acpi_table_add() stub Eduardo Habkost
2017-01-17 19:30 ` [Qemu-devel] [PATCH 3/3] arch_init: Move acpi_table_add() call back to vl.c Eduardo Habkost
2017-01-18  9:07 ` [Qemu-devel] [PATCH 0/3] Remove arch_init SMBIOS and ACPI code Paolo Bonzini

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).