Skip to contentSkip to conversation

hw: Reduce "qemu/accel.h" inclusion

PATCH Applied Philippe Mathieu-Daudé 5 participants 10 messages Nov 30, 2022

lore
Share & tools
lore
#0 lore raw

cover hw: Reduce "qemu/accel.h" inclusion

Another trivial series, restricting "qemu/accel.h".

Philippe Mathieu-Daudé (2):
typedefs: Forward-declare AccelState
hw: Reduce "qemu/accel.h" inclusion

 hw/core/machine.c       | 1 +
 include/hw/boards.h     | 1 -
 include/qemu/accel.h    | 4 ++--
 include/qemu/typedefs.h | 1 +
 4 files changed, 4 insertions(+), 3 deletions(-)
Signature · 1 line
2.38.1
#1 lore raw

PATCH 1/2 typedefs: Forward-declare AccelState

Forward-declare AccelState in "qemu/typedefs.h" so structures using a reference of it (like MachineState in "hw/boards.h") don't have to include "qemu/accel.h".

---
 include/qemu/accel.h    | 4 ++--
 include/qemu/typedefs.h | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)
include/qemu/accel.h +2 -2
index ce4747634a..e84db2e3e5 100644
@@ -26,10 +26,10 @@
 #include "qom/object.h"
 #include "exec/hwaddr.h"
 
-typedef struct AccelState {
+struct AccelState {
     /*< private >*/
     Object parent_obj;
-} AccelState;
+};
 
 typedef struct AccelClass {
     /*< private >*/
include/qemu/typedefs.h +1 -0
index 688408e048..073abab998 100644
@@ -21,6 +21,7 @@
  * Incomplete struct types
  * Please keep this list in case-insensitive alphabetical order.
  */
+typedef struct AccelState AccelState;
 typedef struct AdapterInfo AdapterInfo;
 typedef struct AddressSpace AddressSpace;
 typedef struct AioContext AioContext;
Signature · 1 line
2.38.1
Reviewed-by on v1 1/2
#3 lore raw

Re: [PATCH-for-8.0 1/2] typedefs: Forward-declare AccelState

In reply to Philippe Mathieu-Daudé
Quoted 9 lines · Philippe Mathieu-Daudé

Forward-declare AccelState in "qemu/typedefs.h" so structures using a reference of it (like MachineState in "hw/boards.h") don't have to include "qemu/accel.h".

---
  include/qemu/accel.h    | 4 ++--
  include/qemu/typedefs.h | 1 +
  2 files changed, 3 insertions(+), 2 deletions(-)

r~

#4 lore raw

PATCH 2/2 hw: Reduce "qemu/accel.h" inclusion

In reply to Philippe Mathieu-Daudé

Move "qemu/accel.h" include from the heavily included "hw/boards.h" to hw/core/machine.c, the single file using the AccelState definition.

---
 hw/core/machine.c   | 1 +
 include/hw/boards.h | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)
hw/core/machine.c +1 -0
index 8d34caa31d..42fc6f1e84 100644
@@ -12,6 +12,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu/option.h"
+#include "qemu/accel.h"
 #include "qapi/qmp/qerror.h"
 #include "sysemu/replay.h"
 #include "qemu/units.h"
include/hw/boards.h +0 -1
index 90f1dd3aeb..f00f74c5f4 100644
@@ -6,7 +6,6 @@
 #include "exec/memory.h"
 #include "sysemu/hostmem.h"
 #include "sysemu/blockdev.h"
-#include "qemu/accel.h"
 #include "qapi/qapi-types-machine.h"
 #include "qemu/module.h"
 #include "qom/object.h"
Signature · 1 line
2.38.1
Reviewed-by on v1 2/2
#5 lore raw
Quoted 3 lines · Philippe Mathieu-Daudé

Move "qemu/accel.h" include from the heavily included "hw/boards.h" to hw/core/machine.c, the single file using the AccelState definition.

Do you mean accel_init_interfaces() and ACCEL_GET_CLASS? I don't see AccelState explicitly.

Anyway,

Quoted 30 lines
---
 hw/core/machine.c   | 1 +
 include/hw/boards.h | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)
hw/core/machine.c +1 -0
index 8d34caa31d..42fc6f1e84 100644
@@ -12,6 +12,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu/option.h"
+#include "qemu/accel.h"
 #include "qapi/qmp/qerror.h"
 #include "sysemu/replay.h"
 #include "qemu/units.h"
include/hw/boards.h +0 -1
index 90f1dd3aeb..f00f74c5f4 100644
@@ -6,7 +6,6 @@
 #include "exec/memory.h"
 #include "sysemu/hostmem.h"
 #include "sysemu/blockdev.h"
-#include "qemu/accel.h"
 #include "qapi/qapi-types-machine.h"
 #include "qemu/module.h"
 #include "qom/object.h"
#6 lore raw
Quoted 8 lines · Fabiano Rosas
Quoted 3 lines · Philippe Mathieu-Daudé

Move "qemu/accel.h" include from the heavily included "hw/boards.h" to hw/core/machine.c, the single file using the AccelState definition.

Do you mean accel_init_interfaces() and ACCEL_GET_CLASS? I don't see AccelState explicitly.

Oops you are right...

Paolo, do you mind fixing with:

Move "qemu/accel.h" include from the heavily included "hw/boards.h" to hw/core/machine.c, the single file using accel-related definitions.

or do you want me to respin a v2?

Quoted 3 lines

Anyway,

Thanks!

Quoted 5 lines
Quoted 5 lines
---
  hw/core/machine.c   | 1 +
  include/hw/boards.h | 1 -
  2 files changed, 1 insertion(+), 1 deletion(-)
#7 lore raw
Quoted 8 lines · Philippe Mathieu-Daudé
Quoted 6 lines · Fabiano Rosas
Quoted 3 lines · Philippe Mathieu-Daudé

Move "qemu/accel.h" include from the heavily included "hw/boards.h" to hw/core/machine.c, the single file using the AccelState definition.

Quoted 8 lines
Quoted 2 lines

Do you mean accel_init_interfaces() and ACCEL_GET_CLASS? I don't see AccelState explicitly.

Paolo, do you mind fixing with:

Move "qemu/accel.h" include from the heavily included "hw/boards.h" to hw/core/machine.c, the single file using accel-related definitions.

Can do, thanks for the suggestion.

Paolo

Reviewed-by on v1 2/2
#8 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 10 lines · Philippe Mathieu-Daudé

Move "qemu/accel.h" include from the heavily included "hw/boards.h" to hw/core/machine.c, the single file using the AccelState definition.

---
 hw/core/machine.c   | 1 +
 include/hw/boards.h | 1 -

 2 files changed, 1 insertion(+), 1 deletion(-)
Quoted 24 lines
hw/core/machine.c +0 -0
index 8d34caa31d..42fc6f1e84 100644
@@ -12,6 +12,7 @@


 #include "qemu/osdep.h"
 #include "qemu/option.h"
+#include "qemu/accel.h"
 #include "qapi/qmp/qerror.h"
 #include "sysemu/replay.h"
 #include "qemu/units.h"

include/hw/boards.h +0 -1
index 90f1dd3aeb..f00f74c5f4 100644
@@ -6,7 +6,6 @@
  #include "exec/memory.h"
  #include "sysemu/hostmem.h"
  #include "sysemu/blockdev.h"
-#include "qemu/accel.h"
  #include "qapi/qapi-types-machine.h"
  #include "qemu/module.h"
  #include "qom/object.h"