aboutsummaryrefslogtreecommitdiff
path: root/hw/i386
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2020-09-03 16:43:22 -0400
committerEduardo Habkost <ehabkost@redhat.com>2020-09-09 09:26:43 -0400
commitdb1015e92e04835c9eb50c29625fe566d1202dbd (patch)
tree41fbc0bf3e3f29b7ecb339224a049e3f2a7db8fa /hw/i386
parent1c8eef0227e2942264063f22f10a06b84e0d3fa9 (diff)
Move QOM typedefs and add missing includes
Some typedefs and macros are defined after the type check macros. This makes it difficult to automatically replace their definitions with OBJECT_DECLARE_TYPE. Patch generated using: $ ./scripts/codeconverter/converter.py -i \ --pattern=QOMStructTypedefSplit $(git grep -l '' -- '*.[ch]') which will split "typdef struct { ... } TypedefName" declarations. Followed by: $ ./scripts/codeconverter/converter.py -i --pattern=MoveSymbols \ $(git grep -l '' -- '*.[ch]') which will: - move the typedefs and #defines above the type check macros - add missing #include "qom/object.h" lines if necessary Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Message-Id: <20200831210740.126168-9-ehabkost@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Message-Id: <20200831210740.126168-10-ehabkost@redhat.com> Message-Id: <20200831210740.126168-11-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'hw/i386')
-rw-r--r--hw/i386/amd_iommu.h6
-rw-r--r--hw/i386/kvm/clock.c6
-rw-r--r--hw/i386/kvm/i8254.c11
-rw-r--r--hw/i386/kvm/i8259.c6
-rw-r--r--hw/i386/kvmvapic.c6
-rw-r--r--hw/i386/port92.c6
-rw-r--r--hw/i386/vmmouse.c7
-rw-r--r--hw/i386/vmport.c6
-rw-r--r--hw/i386/xen/xen_platform.c6
-rw-r--r--hw/i386/xen/xen_pvdevice.c6
10 files changed, 43 insertions, 23 deletions
diff --git a/hw/i386/amd_iommu.h b/hw/i386/amd_iommu.h
index e05a4eff5d..85860c36dd 100644
--- a/hw/i386/amd_iommu.h
+++ b/hw/i386/amd_iommu.h
@@ -23,6 +23,7 @@
#include "hw/pci/pci.h"
#include "hw/i386/x86-iommu.h"
+#include "qom/object.h"
/* Capability registers */
#define AMDVI_CAPAB_BAR_LOW 0x04
@@ -296,6 +297,7 @@ struct irte_ga {
};
#define TYPE_AMD_IOMMU_DEVICE "amd-iommu"
+typedef struct AMDVIState AMDVIState;
#define AMD_IOMMU_DEVICE(obj)\
OBJECT_CHECK(AMDVIState, (obj), TYPE_AMD_IOMMU_DEVICE)
@@ -310,7 +312,7 @@ typedef struct AMDVIPCIState {
PCIDevice dev; /* The PCI device itself */
} AMDVIPCIState;
-typedef struct AMDVIState {
+struct AMDVIState {
X86IOMMUState iommu; /* IOMMU bus device */
AMDVIPCIState pci; /* IOMMU PCI device */
@@ -367,6 +369,6 @@ typedef struct AMDVIState {
/* Interrupt remapping */
bool ga_enabled;
-} AMDVIState;
+};
#endif
diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c
index 64283358f9..94ece445af 100644
--- a/hw/i386/kvm/clock.c
+++ b/hw/i386/kvm/clock.c
@@ -29,11 +29,13 @@
#include <linux/kvm.h>
#include "standard-headers/asm-x86/kvm_para.h"
+#include "qom/object.h"
#define TYPE_KVM_CLOCK "kvmclock"
+typedef struct KVMClockState KVMClockState;
#define KVM_CLOCK(obj) OBJECT_CHECK(KVMClockState, (obj), TYPE_KVM_CLOCK)
-typedef struct KVMClockState {
+struct KVMClockState {
/*< private >*/
SysBusDevice busdev;
/*< public >*/
@@ -50,7 +52,7 @@ typedef struct KVMClockState {
/* whether the 'clock' value was obtained in a host with
* reliable KVM_GET_CLOCK */
bool clock_is_reliable;
-} KVMClockState;
+};
struct pvclock_vcpu_time_info {
uint32_t version;
diff --git a/hw/i386/kvm/i8254.c b/hw/i386/kvm/i8254.c
index 876f5aa6fa..d3e4142b16 100644
--- a/hw/i386/kvm/i8254.c
+++ b/hw/i386/kvm/i8254.c
@@ -33,30 +33,33 @@
#include "hw/timer/i8254.h"
#include "hw/timer/i8254_internal.h"
#include "sysemu/kvm.h"
+#include "qom/object.h"
#define KVM_PIT_REINJECT_BIT 0
#define CALIBRATION_ROUNDS 3
+typedef struct KVMPITClass KVMPITClass;
+typedef struct KVMPITState KVMPITState;
#define KVM_PIT(obj) OBJECT_CHECK(KVMPITState, (obj), TYPE_KVM_I8254)
#define KVM_PIT_CLASS(class) \
OBJECT_CLASS_CHECK(KVMPITClass, (class), TYPE_KVM_I8254)
#define KVM_PIT_GET_CLASS(obj) \
OBJECT_GET_CLASS(KVMPITClass, (obj), TYPE_KVM_I8254)
-typedef struct KVMPITState {
+struct KVMPITState {
PITCommonState parent_obj;
LostTickPolicy lost_tick_policy;
bool vm_stopped;
int64_t kernel_clock_offset;
-} KVMPITState;
+};
-typedef struct KVMPITClass {
+struct KVMPITClass {
PITCommonClass parent_class;
DeviceRealize parent_realize;
-} KVMPITClass;
+};
static int64_t abs64(int64_t v)
{
diff --git a/hw/i386/kvm/i8259.c b/hw/i386/kvm/i8259.c
index e404fdcdac..b256f97c83 100644
--- a/hw/i386/kvm/i8259.c
+++ b/hw/i386/kvm/i8259.c
@@ -17,8 +17,10 @@
#include "hw/i386/apic_internal.h"
#include "hw/irq.h"
#include "sysemu/kvm.h"
+#include "qom/object.h"
#define TYPE_KVM_I8259 "kvm-i8259"
+typedef struct KVMPICClass KVMPICClass;
#define KVM_PIC_CLASS(class) \
OBJECT_CLASS_CHECK(KVMPICClass, (class), TYPE_KVM_I8259)
#define KVM_PIC_GET_CLASS(obj) \
@@ -28,11 +30,11 @@
* KVMPICClass:
* @parent_realize: The parent's realizefn.
*/
-typedef struct KVMPICClass {
+struct KVMPICClass {
PICCommonClass parent_class;
DeviceRealize parent_realize;
-} KVMPICClass;
+};
static void kvm_pic_get(PICCommonState *s)
{
diff --git a/hw/i386/kvmvapic.c b/hw/i386/kvmvapic.c
index 51639202c2..857d9f4a61 100644
--- a/hw/i386/kvmvapic.c
+++ b/hw/i386/kvmvapic.c
@@ -22,6 +22,7 @@
#include "hw/boards.h"
#include "migration/vmstate.h"
#include "tcg/tcg.h"
+#include "qom/object.h"
#define VAPIC_IO_PORT 0x7e
@@ -56,7 +57,7 @@ typedef struct GuestROMState {
VAPICHandlers mp;
} QEMU_PACKED GuestROMState;
-typedef struct VAPICROMState {
+struct VAPICROMState {
SysBusDevice busdev;
MemoryRegion io;
MemoryRegion rom;
@@ -69,7 +70,8 @@ typedef struct VAPICROMState {
size_t rom_size;
bool rom_mapped_writable;
VMChangeStateEntry *vmsentry;
-} VAPICROMState;
+};
+typedef struct VAPICROMState VAPICROMState;
#define TYPE_VAPIC "kvmvapic"
#define VAPIC(obj) OBJECT_CHECK(VAPICROMState, (obj), TYPE_VAPIC)
diff --git a/hw/i386/port92.c b/hw/i386/port92.c
index 19866c44ef..48200def5d 100644
--- a/hw/i386/port92.c
+++ b/hw/i386/port92.c
@@ -12,16 +12,18 @@
#include "hw/irq.h"
#include "hw/i386/pc.h"
#include "trace.h"
+#include "qom/object.h"
+typedef struct Port92State Port92State;
#define PORT92(obj) OBJECT_CHECK(Port92State, (obj), TYPE_PORT92)
-typedef struct Port92State {
+struct Port92State {
ISADevice parent_obj;
MemoryRegion io;
uint8_t outport;
qemu_irq a20_out;
-} Port92State;
+};
static void port92_write(void *opaque, hwaddr addr, uint64_t val,
unsigned size)
diff --git a/hw/i386/vmmouse.c b/hw/i386/vmmouse.c
index ba5c987bd2..d187de3745 100644
--- a/hw/i386/vmmouse.c
+++ b/hw/i386/vmmouse.c
@@ -30,6 +30,7 @@
#include "hw/qdev-properties.h"
#include "migration/vmstate.h"
#include "cpu.h"
+#include "qom/object.h"
/* debug only vmmouse */
//#define DEBUG_VMMOUSE
@@ -50,10 +51,10 @@
#endif
#define TYPE_VMMOUSE "vmmouse"
+typedef struct VMMouseState VMMouseState;
#define VMMOUSE(obj) OBJECT_CHECK(VMMouseState, (obj), TYPE_VMMOUSE)
-typedef struct VMMouseState
-{
+struct VMMouseState {
ISADevice parent_obj;
uint32_t queue[VMMOUSE_QUEUE_SIZE];
@@ -63,7 +64,7 @@ typedef struct VMMouseState
uint8_t absolute;
QEMUPutMouseEntry *entry;
ISAKBDState *i8042;
-} VMMouseState;
+};
static void vmmouse_get_data(uint32_t *data)
{
diff --git a/hw/i386/vmport.c b/hw/i386/vmport.c
index 89bda9108e..3720834630 100644
--- a/hw/i386/vmport.c
+++ b/hw/i386/vmport.c
@@ -38,6 +38,7 @@
#include "qemu/log.h"
#include "cpu.h"
#include "trace.h"
+#include "qom/object.h"
#define VMPORT_MAGIC 0x564D5868
@@ -62,9 +63,10 @@
#define VCPU_INFO_LEGACY_X2APIC_BIT 3
#define VCPU_INFO_RESERVED_BIT 31
+typedef struct VMPortState VMPortState;
#define VMPORT(obj) OBJECT_CHECK(VMPortState, (obj), TYPE_VMPORT)
-typedef struct VMPortState {
+struct VMPortState {
ISADevice parent_obj;
MemoryRegion io;
@@ -75,7 +77,7 @@ typedef struct VMPortState {
uint8_t vmware_vmx_type;
uint32_t compat_flags;
-} VMPortState;
+};
static VMPortState *port_state;
diff --git a/hw/i386/xen/xen_platform.c b/hw/i386/xen/xen_platform.c
index a1492fdecd..e8dbd580c5 100644
--- a/hw/i386/xen/xen_platform.c
+++ b/hw/i386/xen/xen_platform.c
@@ -39,6 +39,7 @@
#include "qemu/module.h"
#include <xenguest.h>
+#include "qom/object.h"
//#define DEBUG_PLATFORM
@@ -52,7 +53,7 @@
#define PFFLAG_ROM_LOCK 1 /* Sets whether ROM memory area is RW or RO */
-typedef struct PCIXenPlatformState {
+struct PCIXenPlatformState {
/*< private >*/
PCIDevice parent_obj;
/*< public >*/
@@ -67,7 +68,8 @@ typedef struct PCIXenPlatformState {
/* Log from guest drivers */
char log_buffer[4096];
int log_buffer_off;
-} PCIXenPlatformState;
+};
+typedef struct PCIXenPlatformState PCIXenPlatformState;
#define TYPE_XEN_PLATFORM "xen-platform"
#define XEN_PLATFORM(obj) \
diff --git a/hw/i386/xen/xen_pvdevice.c b/hw/i386/xen/xen_pvdevice.c
index ee2610c7a0..518c66d0bf 100644
--- a/hw/i386/xen/xen_pvdevice.c
+++ b/hw/i386/xen/xen_pvdevice.c
@@ -36,13 +36,15 @@
#include "hw/qdev-properties.h"
#include "migration/vmstate.h"
#include "trace.h"
+#include "qom/object.h"
#define TYPE_XEN_PV_DEVICE "xen-pvdevice"
+typedef struct XenPVDevice XenPVDevice;
#define XEN_PV_DEVICE(obj) \
OBJECT_CHECK(XenPVDevice, (obj), TYPE_XEN_PV_DEVICE)
-typedef struct XenPVDevice {
+struct XenPVDevice {
/*< private >*/
PCIDevice parent_obj;
/*< public >*/
@@ -51,7 +53,7 @@ typedef struct XenPVDevice {
uint8_t revision;
uint32_t size;
MemoryRegion mmio;
-} XenPVDevice;
+};
static uint64_t xen_pv_mmio_read(void *opaque, hwaddr addr,
unsigned size)