* [PATCH 00/13] remove some types from typedefs.h
@ 2024-05-02 15:53 Paolo Bonzini
2024-05-02 15:53 ` [PATCH 01/13] fw_cfg: remove useless declarations " Paolo Bonzini
` (12 more replies)
0 siblings, 13 replies; 24+ messages in thread
From: Paolo Bonzini @ 2024-05-02 15:53 UTC (permalink / raw)
To: qemu-devel
The main reason for typedefs.h to exist is to avoid the need for
"struct Foo;" forward declarations of types that are needed in function
prototypes. It avoids the infamous "struct declared inside parameter list
will not be visible outside of this definition or declaration" warning.
Another less common use is when the struct is used as a pointer in
another struct (when the struct is embedded by value, the typedef is
obviously not enough).
This series is a first pass removing unnecessary typedefs. In most
cases, the users are actually already including it. In a few patches
towards the end, new includes are introduced but not in files that
already "rebuild the world" when changed.
Personally, I think that in many cases the uses are so limited
(often they only appear only in the few non-qdev boards that are
left) that they could use forward declarations of structs. I did
that for patch 12 (tcg) because there are already a couple of
forward declataions in include/hw/core/cpu.h, but that's more as
food for thought than anything else.
Paolo
Paolo Bonzini (13):
fw_cfg: remove useless declarations from typedefs.h
qdev-core: remove DeviceListener from typedefs.h
numa: remove types from typedefs.h
net: remove AnnounceTimer from typedefs.h
qemu-option: remove QemuOpt from typedefs.h
intc: remove PICCommonState from typedefs.h
lockable: remove QemuLockable from typedefs.h
migration: remove PostcopyDiscardState from typedefs.h
monitor: remove MonitorDef from typedefs.h
qapi/machine: remove types from typedefs.h
display: remove GraphicHwOps from typedefs.h
tcg: remove CPU* types from typedefs.h
pci: remove some types from typedefs.h
accel/tcg/tb-jmp-cache.h | 4 ++--
hw/display/vga_int.h | 1 +
include/hw/core/cpu.h | 11 +++++++++--
include/hw/intc/i8259.h | 2 ++
include/hw/nvram/fw_cfg.h | 2 ++
include/hw/pci/pcie.h | 3 +++
include/hw/pci/pcie_aer.h | 38 ++++++++++++++++++------------------
include/hw/pci/pcie_sriov.h | 8 ++++----
include/hw/qdev-core.h | 1 +
include/monitor/hmp-target.h | 11 +++++++----
include/net/announce.h | 4 ++--
include/qemu/coroutine.h | 4 ++--
include/qemu/lockable.h | 4 ++--
include/qemu/option.h | 2 ++
include/qemu/typedefs.h | 23 ----------------------
include/sysemu/numa.h | 8 ++++----
migration/postcopy-ram.c | 4 ++--
stubs/target-monitor-defs.c | 3 +--
system/physmem.c | 4 ++--
19 files changed, 67 insertions(+), 70 deletions(-)
--
2.44.0
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 01/13] fw_cfg: remove useless declarations from typedefs.h
2024-05-02 15:53 [PATCH 00/13] remove some types from typedefs.h Paolo Bonzini
@ 2024-05-02 15:53 ` Paolo Bonzini
2024-05-03 7:27 ` Philippe Mathieu-Daudé
2024-05-02 15:53 ` [PATCH 02/13] qdev-core: remove DeviceListener " Paolo Bonzini
` (11 subsequent siblings)
12 siblings, 1 reply; 24+ messages in thread
From: Paolo Bonzini @ 2024-05-02 15:53 UTC (permalink / raw)
To: qemu-devel
Only FWCfgState is used as part of APIs such as acpi_ghes_add_fw_cfg.
Everything else need not be in typedefs.h.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
include/hw/nvram/fw_cfg.h | 2 ++
include/qemu/typedefs.h | 3 ---
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h
index c1f81a5f13a..d173998803c 100644
--- a/include/hw/nvram/fw_cfg.h
+++ b/include/hw/nvram/fw_cfg.h
@@ -59,6 +59,8 @@ typedef struct fw_cfg_dma_access FWCfgDmaAccess;
typedef void (*FWCfgCallback)(void *opaque);
typedef void (*FWCfgWriteCallback)(void *opaque, off_t start, size_t len);
+typedef struct FWCfgEntry FWCfgEntry;
+
struct FWCfgState {
/*< private >*/
SysBusDevice parent_obj;
diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h
index 50c277cf0b4..949d3e1daf9 100644
--- a/include/qemu/typedefs.h
+++ b/include/qemu/typedefs.h
@@ -56,9 +56,6 @@ typedef struct DumpState DumpState;
typedef struct Error Error;
typedef struct EventNotifier EventNotifier;
typedef struct FlatView FlatView;
-typedef struct FWCfgEntry FWCfgEntry;
-typedef struct FWCfgIoState FWCfgIoState;
-typedef struct FWCfgMemState FWCfgMemState;
typedef struct FWCfgState FWCfgState;
typedef struct GraphicHwOps GraphicHwOps;
typedef struct HostMemoryBackend HostMemoryBackend;
--
2.44.0
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 02/13] qdev-core: remove DeviceListener from typedefs.h
2024-05-02 15:53 [PATCH 00/13] remove some types from typedefs.h Paolo Bonzini
2024-05-02 15:53 ` [PATCH 01/13] fw_cfg: remove useless declarations " Paolo Bonzini
@ 2024-05-02 15:53 ` Paolo Bonzini
2024-05-03 7:28 ` Philippe Mathieu-Daudé
2024-05-02 15:53 ` [PATCH 03/13] numa: remove types " Paolo Bonzini
` (10 subsequent siblings)
12 siblings, 1 reply; 24+ messages in thread
From: Paolo Bonzini @ 2024-05-02 15:53 UTC (permalink / raw)
To: qemu-devel
It is needed in very few places, which already depend on other parts of
qdev-core.h files. The benefit of having it in typedefs.h is small.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
include/hw/qdev-core.h | 1 +
include/qemu/typedefs.h | 1 -
2 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index 9228e96c87e..5336728a23f 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -294,6 +294,7 @@ struct DeviceState {
MemReentrancyGuard mem_reentrancy_guard;
};
+typedef struct DeviceListener DeviceListener;
struct DeviceListener {
void (*realize)(DeviceListener *listener, DeviceState *dev);
void (*unrealize)(DeviceListener *listener, DeviceState *dev);
diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h
index 949d3e1daf9..66f0b146c8c 100644
--- a/include/qemu/typedefs.h
+++ b/include/qemu/typedefs.h
@@ -47,7 +47,6 @@ typedef struct CpuInfoFast CpuInfoFast;
typedef struct CPUJumpCache CPUJumpCache;
typedef struct CPUState CPUState;
typedef struct CPUTLBEntryFull CPUTLBEntryFull;
-typedef struct DeviceListener DeviceListener;
typedef struct DeviceState DeviceState;
typedef struct DirtyBitmapSnapshot DirtyBitmapSnapshot;
typedef struct DisplayChangeListener DisplayChangeListener;
--
2.44.0
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 03/13] numa: remove types from typedefs.h
2024-05-02 15:53 [PATCH 00/13] remove some types from typedefs.h Paolo Bonzini
2024-05-02 15:53 ` [PATCH 01/13] fw_cfg: remove useless declarations " Paolo Bonzini
2024-05-02 15:53 ` [PATCH 02/13] qdev-core: remove DeviceListener " Paolo Bonzini
@ 2024-05-02 15:53 ` Paolo Bonzini
2024-05-03 7:29 ` Philippe Mathieu-Daudé
2024-05-02 15:53 ` [PATCH 04/13] net: remove AnnounceTimer " Paolo Bonzini
` (9 subsequent siblings)
12 siblings, 1 reply; 24+ messages in thread
From: Paolo Bonzini @ 2024-05-02 15:53 UTC (permalink / raw)
To: qemu-devel
Exactly nobody needs them there. Place the typedef in the header
that defines the struct.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
include/qemu/typedefs.h | 2 --
include/sysemu/numa.h | 8 ++++----
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h
index 66f0b146c8c..e0a0bc31e7f 100644
--- a/include/qemu/typedefs.h
+++ b/include/qemu/typedefs.h
@@ -81,8 +81,6 @@ typedef struct MSIMessage MSIMessage;
typedef struct NetClientState NetClientState;
typedef struct NetFilterState NetFilterState;
typedef struct NICInfo NICInfo;
-typedef struct NodeInfo NodeInfo;
-typedef struct NumaNodeMem NumaNodeMem;
typedef struct Object Object;
typedef struct ObjectClass ObjectClass;
typedef struct PCIBridge PCIBridge;
diff --git a/include/sysemu/numa.h b/include/sysemu/numa.h
index 825cfe86bc1..04676141470 100644
--- a/include/sysemu/numa.h
+++ b/include/sysemu/numa.h
@@ -36,7 +36,7 @@ enum {
#define UINT16_BITS 16
-struct NodeInfo {
+typedef struct NodeInfo {
uint64_t node_mem;
struct HostMemoryBackend *node_memdev;
bool present;
@@ -45,12 +45,12 @@ struct NodeInfo {
uint8_t lb_info_provided;
uint16_t initiator;
uint8_t distance[MAX_NODES];
-};
+} NodeInfo;
-struct NumaNodeMem {
+typedef struct NumaNodeMem {
uint64_t node_mem;
uint64_t node_plugged_mem;
-};
+} NumaNodeMem;
struct HMAT_LB_Data {
uint8_t initiator;
--
2.44.0
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 04/13] net: remove AnnounceTimer from typedefs.h
2024-05-02 15:53 [PATCH 00/13] remove some types from typedefs.h Paolo Bonzini
` (2 preceding siblings ...)
2024-05-02 15:53 ` [PATCH 03/13] numa: remove types " Paolo Bonzini
@ 2024-05-02 15:53 ` Paolo Bonzini
2024-05-03 8:44 ` Philippe Mathieu-Daudé
2024-05-02 15:53 ` [PATCH 05/13] qemu-option: remove QemuOpt " Paolo Bonzini
` (8 subsequent siblings)
12 siblings, 1 reply; 24+ messages in thread
From: Paolo Bonzini @ 2024-05-02 15:53 UTC (permalink / raw)
To: qemu-devel
Exactly nobody needs it there. Place the typedef in the header
that defines the struct.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
include/net/announce.h | 4 ++--
include/qemu/typedefs.h | 1 -
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/include/net/announce.h b/include/net/announce.h
index 3d90c83c237..72e7e501f7e 100644
--- a/include/net/announce.h
+++ b/include/net/announce.h
@@ -12,12 +12,12 @@
#include "qapi/qapi-types-net.h"
#include "qemu/timer.h"
-struct AnnounceTimer {
+typedef struct AnnounceTimer {
QEMUTimer *tm;
AnnounceParameters params;
QEMUClockType type;
int round;
-};
+} AnnounceTimer;
/* Returns: update the timer to the next time point */
int64_t qemu_announce_timer_step(AnnounceTimer *timer);
diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h
index e0a0bc31e7f..520f421397b 100644
--- a/include/qemu/typedefs.h
+++ b/include/qemu/typedefs.h
@@ -27,7 +27,6 @@ typedef struct AdapterInfo AdapterInfo;
typedef struct AddressSpace AddressSpace;
typedef struct AioContext AioContext;
typedef struct Aml Aml;
-typedef struct AnnounceTimer AnnounceTimer;
typedef struct ArchCPU ArchCPU;
typedef struct BdrvDirtyBitmap BdrvDirtyBitmap;
typedef struct BdrvDirtyBitmapIter BdrvDirtyBitmapIter;
--
2.44.0
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 05/13] qemu-option: remove QemuOpt from typedefs.h
2024-05-02 15:53 [PATCH 00/13] remove some types from typedefs.h Paolo Bonzini
` (3 preceding siblings ...)
2024-05-02 15:53 ` [PATCH 04/13] net: remove AnnounceTimer " Paolo Bonzini
@ 2024-05-02 15:53 ` Paolo Bonzini
2024-05-03 8:45 ` Philippe Mathieu-Daudé
2024-05-02 15:53 ` [PATCH 06/13] intc: remove PICCommonState " Paolo Bonzini
` (7 subsequent siblings)
12 siblings, 1 reply; 24+ messages in thread
From: Paolo Bonzini @ 2024-05-02 15:53 UTC (permalink / raw)
To: qemu-devel
QemuOpt is basically an internal data structure. It has no business
being defined except if you need functions from include/qemu/option.h.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
include/qemu/option.h | 2 ++
include/qemu/typedefs.h | 1 -
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/qemu/option.h b/include/qemu/option.h
index b3498287823..01e673ae03f 100644
--- a/include/qemu/option.h
+++ b/include/qemu/option.h
@@ -54,6 +54,8 @@ enum QemuOptType {
QEMU_OPT_SIZE, /* size, accepts (K)ilo, (M)ega, (G)iga, (T)era postfix */
};
+typedef struct QemuOpt QemuOpt;
+
typedef struct QemuOptDesc {
const char *name;
enum QemuOptType type;
diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h
index 520f421397b..4519f0cd613 100644
--- a/include/qemu/typedefs.h
+++ b/include/qemu/typedefs.h
@@ -108,7 +108,6 @@ typedef struct QEMUCursor QEMUCursor;
typedef struct QEMUFile QEMUFile;
typedef struct QemuLockable QemuLockable;
typedef struct QemuMutex QemuMutex;
-typedef struct QemuOpt QemuOpt;
typedef struct QemuOpts QemuOpts;
typedef struct QemuOptsList QemuOptsList;
typedef struct QEMUSGList QEMUSGList;
--
2.44.0
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 06/13] intc: remove PICCommonState from typedefs.h
2024-05-02 15:53 [PATCH 00/13] remove some types from typedefs.h Paolo Bonzini
` (4 preceding siblings ...)
2024-05-02 15:53 ` [PATCH 05/13] qemu-option: remove QemuOpt " Paolo Bonzini
@ 2024-05-02 15:53 ` Paolo Bonzini
2024-05-03 8:43 ` Philippe Mathieu-Daudé
2024-05-02 15:53 ` [PATCH 07/13] lockable: remove QemuLockable " Paolo Bonzini
` (6 subsequent siblings)
12 siblings, 1 reply; 24+ messages in thread
From: Paolo Bonzini @ 2024-05-02 15:53 UTC (permalink / raw)
To: qemu-devel
Move it to the existing "PIC related things" header, hw/intc/i8259.h.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
include/hw/intc/i8259.h | 2 ++
include/qemu/typedefs.h | 1 -
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/hw/intc/i8259.h b/include/hw/intc/i8259.h
index c4125757753..1f2420231f1 100644
--- a/include/hw/intc/i8259.h
+++ b/include/hw/intc/i8259.h
@@ -3,6 +3,8 @@
/* i8259.c */
+typedef struct PICCommonState PICCommonState;
+
extern PICCommonState *isa_pic;
/*
diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h
index 4519f0cd613..090e219248a 100644
--- a/include/qemu/typedefs.h
+++ b/include/qemu/typedefs.h
@@ -96,7 +96,6 @@ typedef struct PCIExpressDevice PCIExpressDevice;
typedef struct PCIExpressHost PCIExpressHost;
typedef struct PCIHostDeviceAddress PCIHostDeviceAddress;
typedef struct PCIHostState PCIHostState;
-typedef struct PICCommonState PICCommonState;
typedef struct PostcopyDiscardState PostcopyDiscardState;
typedef struct Property Property;
typedef struct PropertyInfo PropertyInfo;
--
2.44.0
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 07/13] lockable: remove QemuLockable from typedefs.h
2024-05-02 15:53 [PATCH 00/13] remove some types from typedefs.h Paolo Bonzini
` (5 preceding siblings ...)
2024-05-02 15:53 ` [PATCH 06/13] intc: remove PICCommonState " Paolo Bonzini
@ 2024-05-02 15:53 ` Paolo Bonzini
2024-05-03 8:41 ` Philippe Mathieu-Daudé
2024-05-02 15:53 ` [PATCH 08/13] migration: remove PostcopyDiscardState " Paolo Bonzini
` (5 subsequent siblings)
12 siblings, 1 reply; 24+ messages in thread
From: Paolo Bonzini @ 2024-05-02 15:53 UTC (permalink / raw)
To: qemu-devel
Using QemuLockable almost always requires going through QEMU_MAKE_LOCKABLE().
Therefore, there is little point in having the typedef always present. Move
it to lockable.h, with only a small adjustment to coroutine.h (which has
a tricky co-dependency with lockable.h due to defining CoMutex *and*
using QemuLockable as a part of the CoQueue API).
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
include/qemu/coroutine.h | 4 ++--
include/qemu/lockable.h | 4 ++--
include/qemu/typedefs.h | 1 -
3 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/include/qemu/coroutine.h b/include/qemu/coroutine.h
index e6aff453017..ff3084538b8 100644
--- a/include/qemu/coroutine.h
+++ b/include/qemu/coroutine.h
@@ -84,6 +84,8 @@ static inline coroutine_fn void qemu_co_mutex_assert_locked(CoMutex *mutex)
mutex->holder == qemu_coroutine_self());
}
+#include "qemu/lockable.h"
+
/**
* CoQueues are a mechanism to queue coroutines in order to continue executing
* them later. They are similar to condition variables, but they need help
@@ -281,8 +283,6 @@ void qemu_coroutine_inc_pool_size(unsigned int additional_pool_size);
*/
void qemu_coroutine_dec_pool_size(unsigned int additional_pool_size);
-#include "qemu/lockable.h"
-
/**
* Sends a (part of) iovec down a socket, yielding when the socket is full, or
* Receives data into a (part of) iovec from a socket,
diff --git a/include/qemu/lockable.h b/include/qemu/lockable.h
index 9823220446d..62110d2eb74 100644
--- a/include/qemu/lockable.h
+++ b/include/qemu/lockable.h
@@ -18,11 +18,11 @@
typedef void QemuLockUnlockFunc(void *);
-struct QemuLockable {
+typedef struct QemuLockable {
void *object;
QemuLockUnlockFunc *lock;
QemuLockUnlockFunc *unlock;
-};
+} QemuLockable;
static inline __attribute__((__always_inline__)) QemuLockable *
qemu_make_lockable(void *x, QemuLockable *lockable)
diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h
index 090e219248a..ab24ca2876c 100644
--- a/include/qemu/typedefs.h
+++ b/include/qemu/typedefs.h
@@ -105,7 +105,6 @@ typedef struct QEMUBH QEMUBH;
typedef struct QemuConsole QemuConsole;
typedef struct QEMUCursor QEMUCursor;
typedef struct QEMUFile QEMUFile;
-typedef struct QemuLockable QemuLockable;
typedef struct QemuMutex QemuMutex;
typedef struct QemuOpts QemuOpts;
typedef struct QemuOptsList QemuOptsList;
--
2.44.0
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 08/13] migration: remove PostcopyDiscardState from typedefs.h
2024-05-02 15:53 [PATCH 00/13] remove some types from typedefs.h Paolo Bonzini
` (6 preceding siblings ...)
2024-05-02 15:53 ` [PATCH 07/13] lockable: remove QemuLockable " Paolo Bonzini
@ 2024-05-02 15:53 ` Paolo Bonzini
2024-05-03 8:45 ` Philippe Mathieu-Daudé
2024-05-02 15:53 ` [PATCH 09/13] monitor: remove MonitorDef " Paolo Bonzini
` (4 subsequent siblings)
12 siblings, 1 reply; 24+ messages in thread
From: Paolo Bonzini @ 2024-05-02 15:53 UTC (permalink / raw)
To: qemu-devel
It is defined and referred to exclusively from a .c file.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
include/qemu/typedefs.h | 1 -
migration/postcopy-ram.c | 4 ++--
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h
index ab24ca2876c..2b1948a19ac 100644
--- a/include/qemu/typedefs.h
+++ b/include/qemu/typedefs.h
@@ -96,7 +96,6 @@ typedef struct PCIExpressDevice PCIExpressDevice;
typedef struct PCIExpressHost PCIExpressHost;
typedef struct PCIHostDeviceAddress PCIHostDeviceAddress;
typedef struct PCIHostState PCIHostState;
-typedef struct PostcopyDiscardState PostcopyDiscardState;
typedef struct Property Property;
typedef struct PropertyInfo PropertyInfo;
typedef struct QBool QBool;
diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index eccff499cb2..34197795482 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -44,7 +44,7 @@
*/
#define MAX_DISCARDS_PER_COMMAND 12
-struct PostcopyDiscardState {
+typedef struct PostcopyDiscardState {
const char *ramblock_name;
uint16_t cur_entry;
/*
@@ -54,7 +54,7 @@ struct PostcopyDiscardState {
uint64_t length_list[MAX_DISCARDS_PER_COMMAND];
unsigned int nsentwords;
unsigned int nsentcmds;
-};
+} PostcopyDiscardState;
static NotifierWithReturnList postcopy_notifier_list;
--
2.44.0
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 09/13] monitor: remove MonitorDef from typedefs.h
2024-05-02 15:53 [PATCH 00/13] remove some types from typedefs.h Paolo Bonzini
` (7 preceding siblings ...)
2024-05-02 15:53 ` [PATCH 08/13] migration: remove PostcopyDiscardState " Paolo Bonzini
@ 2024-05-02 15:53 ` Paolo Bonzini
2024-05-03 8:38 ` Philippe Mathieu-Daudé
2024-05-02 15:53 ` [PATCH 10/13] qapi/machine: remove types " Paolo Bonzini
` (3 subsequent siblings)
12 siblings, 1 reply; 24+ messages in thread
From: Paolo Bonzini @ 2024-05-02 15:53 UTC (permalink / raw)
To: qemu-devel
MonitorDef is defined by hmp-target.h, and all users except one already
include it; the reason why the stubs do not include it, is because
hmp-target.h currently can only be used in files that are compiled
per target. However, that is easily fixed. Because the benefit of
having MonitorDef in typedefs.h is very small, do it and remove the
type from typedefs.h.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
include/monitor/hmp-target.h | 11 +++++++----
include/qemu/typedefs.h | 1 -
stubs/target-monitor-defs.c | 3 +--
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/include/monitor/hmp-target.h b/include/monitor/hmp-target.h
index d78e979f053..b679aaebbff 100644
--- a/include/monitor/hmp-target.h
+++ b/include/monitor/hmp-target.h
@@ -25,11 +25,10 @@
#ifndef MONITOR_HMP_TARGET_H
#define MONITOR_HMP_TARGET_H
+typedef struct MonitorDef MonitorDef;
+
+#ifdef COMPILING_PER_TARGET
#include "cpu.h"
-
-#define MD_TLONG 0
-#define MD_I32 1
-
struct MonitorDef {
const char *name;
int offset;
@@ -37,6 +36,10 @@ struct MonitorDef {
int val);
int type;
};
+#endif
+
+#define MD_TLONG 0
+#define MD_I32 1
const MonitorDef *target_monitor_defs(void);
int target_get_monitor_def(CPUState *cs, const char *name, uint64_t *pval);
diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h
index 2b1948a19ac..b71a36d02b2 100644
--- a/include/qemu/typedefs.h
+++ b/include/qemu/typedefs.h
@@ -75,7 +75,6 @@ typedef struct MemoryRegionSection MemoryRegionSection;
typedef struct MigrationIncomingState MigrationIncomingState;
typedef struct MigrationState MigrationState;
typedef struct Monitor Monitor;
-typedef struct MonitorDef MonitorDef;
typedef struct MSIMessage MSIMessage;
typedef struct NetClientState NetClientState;
typedef struct NetFilterState NetFilterState;
diff --git a/stubs/target-monitor-defs.c b/stubs/target-monitor-defs.c
index ac07b19064c..35a0a342772 100644
--- a/stubs/target-monitor-defs.c
+++ b/stubs/target-monitor-defs.c
@@ -1,6 +1,5 @@
#include "qemu/osdep.h"
-
-const MonitorDef *target_monitor_defs(void);
+#include "monitor/hmp-target.h"
const MonitorDef *target_monitor_defs(void)
{
--
2.44.0
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 10/13] qapi/machine: remove types from typedefs.h
2024-05-02 15:53 [PATCH 00/13] remove some types from typedefs.h Paolo Bonzini
` (8 preceding siblings ...)
2024-05-02 15:53 ` [PATCH 09/13] monitor: remove MonitorDef " Paolo Bonzini
@ 2024-05-02 15:53 ` Paolo Bonzini
2024-05-02 15:53 ` [PATCH 11/13] display: remove GraphicHwOps " Paolo Bonzini
` (2 subsequent siblings)
12 siblings, 0 replies; 24+ messages in thread
From: Paolo Bonzini @ 2024-05-02 15:53 UTC (permalink / raw)
To: qemu-devel
They are needed in very few places, which already depends on other generated QAPI
files. The benefit of having these types in typedefs.h is small.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
include/hw/core/cpu.h | 1 +
include/qemu/typedefs.h | 2 --
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index 46b99a7ea55..a23d39f6a0c 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -28,6 +28,7 @@
#include "exec/memattrs.h"
#include "exec/mmu-access-type.h"
#include "exec/tlb-common.h"
+#include "qapi/qapi-types-machine.h"
#include "qapi/qapi-types-run-state.h"
#include "qemu/bitmap.h"
#include "qemu/rcu_queue.h"
diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h
index b71a36d02b2..78598f27f32 100644
--- a/include/qemu/typedefs.h
+++ b/include/qemu/typedefs.h
@@ -37,12 +37,10 @@ typedef struct BusClass BusClass;
typedef struct BusState BusState;
typedef struct Chardev Chardev;
typedef struct Clock Clock;
-typedef struct CompatProperty CompatProperty;
typedef struct ConfidentialGuestSupport ConfidentialGuestSupport;
typedef struct CPUAddressSpace CPUAddressSpace;
typedef struct CPUArchState CPUArchState;
typedef struct CPUPluginState CPUPluginState;
-typedef struct CpuInfoFast CpuInfoFast;
typedef struct CPUJumpCache CPUJumpCache;
typedef struct CPUState CPUState;
typedef struct CPUTLBEntryFull CPUTLBEntryFull;
--
2.44.0
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 11/13] display: remove GraphicHwOps from typedefs.h
2024-05-02 15:53 [PATCH 00/13] remove some types from typedefs.h Paolo Bonzini
` (9 preceding siblings ...)
2024-05-02 15:53 ` [PATCH 10/13] qapi/machine: remove types " Paolo Bonzini
@ 2024-05-02 15:53 ` Paolo Bonzini
2024-05-03 7:30 ` Philippe Mathieu-Daudé
2024-05-02 15:53 ` [PATCH 12/13] tcg: remove CPU* types " Paolo Bonzini
2024-05-02 15:53 ` [PATCH 13/13] pci: remove some " Paolo Bonzini
12 siblings, 1 reply; 24+ messages in thread
From: Paolo Bonzini @ 2024-05-02 15:53 UTC (permalink / raw)
To: qemu-devel
Basically all uses of GraphicHwOps are defining an instance of it, which requires the
full definition of the struct. It is pointless to have it in typedefs.h.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/display/vga_int.h | 1 +
include/qemu/typedefs.h | 1 -
2 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/display/vga_int.h b/hw/display/vga_int.h
index 876a1d3697b..f77c1c11457 100644
--- a/hw/display/vga_int.h
+++ b/hw/display/vga_int.h
@@ -25,6 +25,7 @@
#ifndef HW_VGA_INT_H
#define HW_VGA_INT_H
+#include "ui/console.h"
#include "exec/ioport.h"
#include "exec/memory.h"
diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h
index 78598f27f32..7e3597e94c5 100644
--- a/include/qemu/typedefs.h
+++ b/include/qemu/typedefs.h
@@ -53,7 +53,6 @@ typedef struct Error Error;
typedef struct EventNotifier EventNotifier;
typedef struct FlatView FlatView;
typedef struct FWCfgState FWCfgState;
-typedef struct GraphicHwOps GraphicHwOps;
typedef struct HostMemoryBackend HostMemoryBackend;
typedef struct I2CBus I2CBus;
typedef struct I2SCodec I2SCodec;
--
2.44.0
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 12/13] tcg: remove CPU* types from typedefs.h
2024-05-02 15:53 [PATCH 00/13] remove some types from typedefs.h Paolo Bonzini
` (10 preceding siblings ...)
2024-05-02 15:53 ` [PATCH 11/13] display: remove GraphicHwOps " Paolo Bonzini
@ 2024-05-02 15:53 ` Paolo Bonzini
2024-05-02 15:53 ` [PATCH 13/13] pci: remove some " Paolo Bonzini
12 siblings, 0 replies; 24+ messages in thread
From: Paolo Bonzini @ 2024-05-02 15:53 UTC (permalink / raw)
To: qemu-devel
hw/core/cpu.h is already using struct forward declarations in some cases
to avoid inclusions, and otherwise CPUAddressSpace and CPUJumpCache
are only used together with their definition. CPUTLBEntryFull is
always used when their definition is available. Remove all three
from typedefs.h.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
accel/tcg/tb-jmp-cache.h | 4 ++--
include/hw/core/cpu.h | 10 ++++++++--
include/qemu/typedefs.h | 3 ---
system/physmem.c | 4 ++--
4 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/accel/tcg/tb-jmp-cache.h b/accel/tcg/tb-jmp-cache.h
index 184bb3e3e2e..c3a505e394a 100644
--- a/accel/tcg/tb-jmp-cache.h
+++ b/accel/tcg/tb-jmp-cache.h
@@ -22,12 +22,12 @@
* non-NULL value of 'tb'. Strictly speaking pc is only needed for
* CF_PCREL, but it's used always for simplicity.
*/
-struct CPUJumpCache {
+typedef struct CPUJumpCache {
struct rcu_head rcu;
struct {
TranslationBlock *tb;
vaddr pc;
} array[TB_JMP_CACHE_SIZE];
-};
+} CPUJumpCache;
#endif /* ACCEL_TCG_TB_JMP_CACHE_H */
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index a23d39f6a0c..1382a986158 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -85,6 +85,12 @@ DECLARE_CLASS_CHECKERS(CPUClass, CPU,
typedef struct CPUWatchpoint CPUWatchpoint;
+/* see physmem.c */
+struct CPUAddressSpace;
+
+/* see accel/tcg/tb-jmp-cache.h */
+struct CPUJumpCache;
+
/* see accel-cpu.h */
struct AccelCPUClass;
@@ -473,12 +479,12 @@ struct CPUState {
QemuMutex work_mutex;
QSIMPLEQ_HEAD(, qemu_work_item) work_list;
- CPUAddressSpace *cpu_ases;
+ struct CPUAddressSpace *cpu_ases;
int num_ases;
AddressSpace *as;
MemoryRegion *memory;
- CPUJumpCache *tb_jmp_cache;
+ struct CPUJumpCache *tb_jmp_cache;
GArray *gdb_regs;
int gdb_num_regs;
diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h
index 7e3597e94c5..d23020ed232 100644
--- a/include/qemu/typedefs.h
+++ b/include/qemu/typedefs.h
@@ -38,12 +38,9 @@ typedef struct BusState BusState;
typedef struct Chardev Chardev;
typedef struct Clock Clock;
typedef struct ConfidentialGuestSupport ConfidentialGuestSupport;
-typedef struct CPUAddressSpace CPUAddressSpace;
typedef struct CPUArchState CPUArchState;
typedef struct CPUPluginState CPUPluginState;
-typedef struct CPUJumpCache CPUJumpCache;
typedef struct CPUState CPUState;
-typedef struct CPUTLBEntryFull CPUTLBEntryFull;
typedef struct DeviceState DeviceState;
typedef struct DirtyBitmapSnapshot DirtyBitmapSnapshot;
typedef struct DisplayChangeListener DisplayChangeListener;
diff --git a/system/physmem.c b/system/physmem.c
index 1a81c226bae..6dc58b34bbb 100644
--- a/system/physmem.c
+++ b/system/physmem.c
@@ -158,12 +158,12 @@ static void tcg_commit(MemoryListener *listener);
* @memory_dispatch: its dispatch pointer (cached, RCU protected)
* @tcg_as_listener: listener for tracking changes to the AddressSpace
*/
-struct CPUAddressSpace {
+typedef struct CPUAddressSpace {
CPUState *cpu;
AddressSpace *as;
struct AddressSpaceDispatch *memory_dispatch;
MemoryListener tcg_as_listener;
-};
+} CPUAddressSpace;
struct DirtyBitmapSnapshot {
ram_addr_t start;
--
2.44.0
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 13/13] pci: remove some types from typedefs.h
2024-05-02 15:53 [PATCH 00/13] remove some types from typedefs.h Paolo Bonzini
` (11 preceding siblings ...)
2024-05-02 15:53 ` [PATCH 12/13] tcg: remove CPU* types " Paolo Bonzini
@ 2024-05-02 15:53 ` Paolo Bonzini
12 siblings, 0 replies; 24+ messages in thread
From: Paolo Bonzini @ 2024-05-02 15:53 UTC (permalink / raw)
To: qemu-devel
For types that are embedded in structs defined by pci.h, the definition
is pretty much required to be available. Remove them from typedefs.h.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
include/hw/pci/pcie.h | 3 +++
include/hw/pci/pcie_aer.h | 38 ++++++++++++++++++-------------------
include/hw/pci/pcie_sriov.h | 8 ++++----
include/qemu/typedefs.h | 5 -----
4 files changed, 26 insertions(+), 28 deletions(-)
diff --git a/include/hw/pci/pcie.h b/include/hw/pci/pcie.h
index 11f5a91bbb7..5eddb909769 100644
--- a/include/hw/pci/pcie.h
+++ b/include/hw/pci/pcie.h
@@ -27,6 +27,9 @@
#include "hw/pci/pcie_sriov.h"
#include "hw/hotplug.h"
+typedef struct PCIEPort PCIEPort;
+typedef struct PCIESlot PCIESlot;
+
typedef enum {
/* these bits must match the bits in Slot Control/Status registers.
* PCI_EXP_HP_EV_xxx = PCI_EXP_SLTCTL_xxxE = PCI_EXP_SLTSTA_xxx
diff --git a/include/hw/pci/pcie_aer.h b/include/hw/pci/pcie_aer.h
index 4a9f0ea69dc..4d8c0e05077 100644
--- a/include/hw/pci/pcie_aer.h
+++ b/include/hw/pci/pcie_aer.h
@@ -25,8 +25,23 @@
/* definitions which PCIExpressDevice uses */
+/* error */
+typedef struct PCIEAERErr {
+ uint32_t status; /* error status bits */
+ uint16_t source_id; /* bdf */
+
+#define PCIE_AER_ERR_IS_CORRECTABLE 0x1 /* correctable/uncorrectable */
+#define PCIE_AER_ERR_MAYBE_ADVISORY 0x2 /* maybe advisory non-fatal */
+#define PCIE_AER_ERR_HEADER_VALID 0x4 /* TLP header is logged */
+#define PCIE_AER_ERR_TLP_PREFIX_PRESENT 0x8 /* TLP Prefix is logged */
+ uint16_t flags;
+
+ uint32_t header[4]; /* TLP header */
+ uint32_t prefix[4]; /* TLP header prefix */
+} PCIEAERErr;
+
/* AER log */
-struct PCIEAERLog {
+typedef struct PCIEAERLog {
/* This structure is saved/loaded.
So explicitly size them instead of unsigned int */
@@ -48,11 +63,11 @@ struct PCIEAERLog {
/* Error log. log_max-sized array */
PCIEAERErr *log;
-};
+} PCIEAERLog;
/* aer error message: error signaling message has only error severity and
source id. See 2.2.8.3 error signaling messages */
-struct PCIEAERMsg {
+typedef struct PCIEAERMsg {
/*
* PCI_ERR_ROOT_CMD_{COR, NONFATAL, FATAL}_EN
* = PCI_EXP_DEVCTL_{CERE, NFERE, FERE}
@@ -60,7 +75,7 @@ struct PCIEAERMsg {
uint32_t severity;
uint16_t source_id; /* bdf */
-};
+} PCIEAERMsg;
static inline bool
pcie_aer_msg_is_uncor(const PCIEAERMsg *msg)
@@ -69,21 +84,6 @@ pcie_aer_msg_is_uncor(const PCIEAERMsg *msg)
msg->severity == PCI_ERR_ROOT_CMD_FATAL_EN;
}
-/* error */
-struct PCIEAERErr {
- uint32_t status; /* error status bits */
- uint16_t source_id; /* bdf */
-
-#define PCIE_AER_ERR_IS_CORRECTABLE 0x1 /* correctable/uncorrectable */
-#define PCIE_AER_ERR_MAYBE_ADVISORY 0x2 /* maybe advisory non-fatal */
-#define PCIE_AER_ERR_HEADER_VALID 0x4 /* TLP header is logged */
-#define PCIE_AER_ERR_TLP_PREFIX_PRESENT 0x8 /* TLP Prefix is logged */
- uint16_t flags;
-
- uint32_t header[4]; /* TLP header */
- uint32_t prefix[4]; /* TLP header prefix */
-};
-
extern const VMStateDescription vmstate_pcie_aer_log;
int pcie_aer_init(PCIDevice *dev, uint8_t cap_ver, uint16_t offset,
diff --git a/include/hw/pci/pcie_sriov.h b/include/hw/pci/pcie_sriov.h
index b77eb7bf58a..450cbef6c20 100644
--- a/include/hw/pci/pcie_sriov.h
+++ b/include/hw/pci/pcie_sriov.h
@@ -15,17 +15,17 @@
#include "hw/pci/pci.h"
-struct PCIESriovPF {
+typedef struct PCIESriovPF {
uint16_t num_vfs; /* Number of virtual functions created */
uint8_t vf_bar_type[PCI_NUM_REGIONS]; /* Store type for each VF bar */
const char *vfname; /* Reference to the device type used for the VFs */
PCIDevice **vf; /* Pointer to an array of num_vfs VF devices */
-};
+} PCIESriovPF;
-struct PCIESriovVF {
+typedef struct PCIESriovVF {
PCIDevice *pf; /* Pointer back to owner physical function */
uint16_t vf_number; /* Logical VF number of this function */
-};
+} PCIESriovVF;
void pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset,
const char *vfname, uint16_t vf_dev_id,
diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h
index d23020ed232..5d999e20d7c 100644
--- a/include/qemu/typedefs.h
+++ b/include/qemu/typedefs.h
@@ -78,13 +78,8 @@ typedef struct ObjectClass ObjectClass;
typedef struct PCIBridge PCIBridge;
typedef struct PCIBus PCIBus;
typedef struct PCIDevice PCIDevice;
-typedef struct PCIEAERErr PCIEAERErr;
-typedef struct PCIEAERLog PCIEAERLog;
-typedef struct PCIEAERMsg PCIEAERMsg;
typedef struct PCIEPort PCIEPort;
typedef struct PCIESlot PCIESlot;
-typedef struct PCIESriovPF PCIESriovPF;
-typedef struct PCIESriovVF PCIESriovVF;
typedef struct PCIExpressDevice PCIExpressDevice;
typedef struct PCIExpressHost PCIExpressHost;
typedef struct PCIHostDeviceAddress PCIHostDeviceAddress;
--
2.44.0
^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH 01/13] fw_cfg: remove useless declarations from typedefs.h
2024-05-02 15:53 ` [PATCH 01/13] fw_cfg: remove useless declarations " Paolo Bonzini
@ 2024-05-03 7:27 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-05-03 7:27 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel
On 2/5/24 17:53, Paolo Bonzini wrote:
> Only FWCfgState is used as part of APIs such as acpi_ghes_add_fw_cfg.
> Everything else need not be in typedefs.h.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> include/hw/nvram/fw_cfg.h | 2 ++
> include/qemu/typedefs.h | 3 ---
> 2 files changed, 2 insertions(+), 3 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 02/13] qdev-core: remove DeviceListener from typedefs.h
2024-05-02 15:53 ` [PATCH 02/13] qdev-core: remove DeviceListener " Paolo Bonzini
@ 2024-05-03 7:28 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-05-03 7:28 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel
On 2/5/24 17:53, Paolo Bonzini wrote:
> It is needed in very few places, which already depend on other parts of
> qdev-core.h files. The benefit of having it in typedefs.h is small.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> include/hw/qdev-core.h | 1 +
> include/qemu/typedefs.h | 1 -
> 2 files changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 03/13] numa: remove types from typedefs.h
2024-05-02 15:53 ` [PATCH 03/13] numa: remove types " Paolo Bonzini
@ 2024-05-03 7:29 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-05-03 7:29 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel
On 2/5/24 17:53, Paolo Bonzini wrote:
> Exactly nobody needs them there. Place the typedef in the header
> that defines the struct.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> include/qemu/typedefs.h | 2 --
> include/sysemu/numa.h | 8 ++++----
> 2 files changed, 4 insertions(+), 6 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 11/13] display: remove GraphicHwOps from typedefs.h
2024-05-02 15:53 ` [PATCH 11/13] display: remove GraphicHwOps " Paolo Bonzini
@ 2024-05-03 7:30 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-05-03 7:30 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel
On 2/5/24 17:53, Paolo Bonzini wrote:
> Basically all uses of GraphicHwOps are defining an instance of it, which requires the
> full definition of the struct. It is pointless to have it in typedefs.h.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> hw/display/vga_int.h | 1 +
> include/qemu/typedefs.h | 1 -
> 2 files changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 09/13] monitor: remove MonitorDef from typedefs.h
2024-05-02 15:53 ` [PATCH 09/13] monitor: remove MonitorDef " Paolo Bonzini
@ 2024-05-03 8:38 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-05-03 8:38 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel
On 2/5/24 17:53, Paolo Bonzini wrote:
> MonitorDef is defined by hmp-target.h, and all users except one already
> include it; the reason why the stubs do not include it, is because
> hmp-target.h currently can only be used in files that are compiled
> per target. However, that is easily fixed. Because the benefit of
> having MonitorDef in typedefs.h is very small, do it and remove the
> type from typedefs.h.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> include/monitor/hmp-target.h | 11 +++++++----
> include/qemu/typedefs.h | 1 -
> stubs/target-monitor-defs.c | 3 +--
> 3 files changed, 8 insertions(+), 7 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 07/13] lockable: remove QemuLockable from typedefs.h
2024-05-02 15:53 ` [PATCH 07/13] lockable: remove QemuLockable " Paolo Bonzini
@ 2024-05-03 8:41 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-05-03 8:41 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel
On 2/5/24 17:53, Paolo Bonzini wrote:
> Using QemuLockable almost always requires going through QEMU_MAKE_LOCKABLE().
> Therefore, there is little point in having the typedef always present. Move
> it to lockable.h, with only a small adjustment to coroutine.h (which has
> a tricky co-dependency with lockable.h due to defining CoMutex *and*
> using QemuLockable as a part of the CoQueue API).
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> include/qemu/coroutine.h | 4 ++--
> include/qemu/lockable.h | 4 ++--
> include/qemu/typedefs.h | 1 -
> 3 files changed, 4 insertions(+), 5 deletions(-)
Possibly squash:
-- >8 --
diff --git a/tests/unit/test-coroutine.c b/tests/unit/test-coroutine.c
index 49d4d9b251..32f2f5a746 100644
--- a/tests/unit/test-coroutine.c
+++ b/tests/unit/test-coroutine.c
@@ -13,6 +13,7 @@
#include "qemu/osdep.h"
#include "qemu/coroutine_int.h"
+#include "qemu/lockable.h"
/*
* Check that qemu_in_coroutine() works
---
to avoid the implicit inclusion via "qemu/coroutine_int.h".
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH 06/13] intc: remove PICCommonState from typedefs.h
2024-05-02 15:53 ` [PATCH 06/13] intc: remove PICCommonState " Paolo Bonzini
@ 2024-05-03 8:43 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-05-03 8:43 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel
On 2/5/24 17:53, Paolo Bonzini wrote:
> Move it to the existing "PIC related things" header, hw/intc/i8259.h.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> include/hw/intc/i8259.h | 2 ++
> include/qemu/typedefs.h | 1 -
> 2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/include/hw/intc/i8259.h b/include/hw/intc/i8259.h
> index c4125757753..1f2420231f1 100644
> --- a/include/hw/intc/i8259.h
> +++ b/include/hw/intc/i8259.h
> @@ -3,6 +3,8 @@
>
> /* i8259.c */
>
> +typedef struct PICCommonState PICCommonState;
I'd rather move from "hw/isa/i8259_internal.h" to here:
#define TYPE_PIC_COMMON "pic-common"
OBJECT_DECLARE_TYPE(PICCommonState, PICCommonClass, PIC_COMMON)
struct PICCommonState {
...
};
Can be done later, so meanwhile:
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 04/13] net: remove AnnounceTimer from typedefs.h
2024-05-02 15:53 ` [PATCH 04/13] net: remove AnnounceTimer " Paolo Bonzini
@ 2024-05-03 8:44 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-05-03 8:44 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel
On 2/5/24 17:53, Paolo Bonzini wrote:
> Exactly nobody needs it there. Place the typedef in the header
> that defines the struct.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> include/net/announce.h | 4 ++--
> include/qemu/typedefs.h | 1 -
> 2 files changed, 2 insertions(+), 3 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 05/13] qemu-option: remove QemuOpt from typedefs.h
2024-05-02 15:53 ` [PATCH 05/13] qemu-option: remove QemuOpt " Paolo Bonzini
@ 2024-05-03 8:45 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-05-03 8:45 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel
On 2/5/24 17:53, Paolo Bonzini wrote:
> QemuOpt is basically an internal data structure. It has no business
> being defined except if you need functions from include/qemu/option.h.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> include/qemu/option.h | 2 ++
> include/qemu/typedefs.h | 1 -
> 2 files changed, 2 insertions(+), 1 deletion(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 08/13] migration: remove PostcopyDiscardState from typedefs.h
2024-05-02 15:53 ` [PATCH 08/13] migration: remove PostcopyDiscardState " Paolo Bonzini
@ 2024-05-03 8:45 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 24+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-05-03 8:45 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel
On 2/5/24 17:53, Paolo Bonzini wrote:
> It is defined and referred to exclusively from a .c file.
Ahah what a shame :)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> include/qemu/typedefs.h | 1 -
> migration/postcopy-ram.c | 4 ++--
> 2 files changed, 2 insertions(+), 3 deletions(-)
^ permalink raw reply [flat|nested] 24+ messages in thread
end of thread, other threads:[~2024-05-03 8:46 UTC | newest]
Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-02 15:53 [PATCH 00/13] remove some types from typedefs.h Paolo Bonzini
2024-05-02 15:53 ` [PATCH 01/13] fw_cfg: remove useless declarations " Paolo Bonzini
2024-05-03 7:27 ` Philippe Mathieu-Daudé
2024-05-02 15:53 ` [PATCH 02/13] qdev-core: remove DeviceListener " Paolo Bonzini
2024-05-03 7:28 ` Philippe Mathieu-Daudé
2024-05-02 15:53 ` [PATCH 03/13] numa: remove types " Paolo Bonzini
2024-05-03 7:29 ` Philippe Mathieu-Daudé
2024-05-02 15:53 ` [PATCH 04/13] net: remove AnnounceTimer " Paolo Bonzini
2024-05-03 8:44 ` Philippe Mathieu-Daudé
2024-05-02 15:53 ` [PATCH 05/13] qemu-option: remove QemuOpt " Paolo Bonzini
2024-05-03 8:45 ` Philippe Mathieu-Daudé
2024-05-02 15:53 ` [PATCH 06/13] intc: remove PICCommonState " Paolo Bonzini
2024-05-03 8:43 ` Philippe Mathieu-Daudé
2024-05-02 15:53 ` [PATCH 07/13] lockable: remove QemuLockable " Paolo Bonzini
2024-05-03 8:41 ` Philippe Mathieu-Daudé
2024-05-02 15:53 ` [PATCH 08/13] migration: remove PostcopyDiscardState " Paolo Bonzini
2024-05-03 8:45 ` Philippe Mathieu-Daudé
2024-05-02 15:53 ` [PATCH 09/13] monitor: remove MonitorDef " Paolo Bonzini
2024-05-03 8:38 ` Philippe Mathieu-Daudé
2024-05-02 15:53 ` [PATCH 10/13] qapi/machine: remove types " Paolo Bonzini
2024-05-02 15:53 ` [PATCH 11/13] display: remove GraphicHwOps " Paolo Bonzini
2024-05-03 7:30 ` Philippe Mathieu-Daudé
2024-05-02 15:53 ` [PATCH 12/13] tcg: remove CPU* types " Paolo Bonzini
2024-05-02 15:53 ` [PATCH 13/13] pci: remove some " 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).