aboutsummaryrefslogtreecommitdiff
path: root/hw/i386
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2020-09-11 19:26:51 +0100
committerPeter Maydell <peter.maydell@linaro.org>2020-09-11 19:26:51 +0100
commitf4ef8c9cc10b3bee829b9775879d4ff9f77c2442 (patch)
tree8245341c3ebfe98b9673bf7a8cb818b6d494c76f /hw/i386
parent2499453eb1cbb68a45d7562a180afd7659007fd4 (diff)
parentb84bf23c88699098973de3bdec316c796f1b3794 (diff)
downloadqemu-f4ef8c9cc10b3bee829b9775879d4ff9f77c2442.zip
qemu-f4ef8c9cc10b3bee829b9775879d4ff9f77c2442.tar.gz
qemu-f4ef8c9cc10b3bee829b9775879d4ff9f77c2442.tar.bz2
Merge remote-tracking branch 'remotes/ehabkost/tags/machine-next-pull-request' into staging
QOM boilerplate cleanup Documentation build fix: * memory: Remove kernel-doc comment marker (Eduardo Habkost) QOM cleanups: * Rename QOM macros for consistency between TYPE_* and type checking constants (Eduardo Habkost) QOM new macros: * OBJECT_DECLARE_* and OBJECT_DEFINE_* macros (Daniel P. Berrangé) * DECLARE_*_CHECKER macros (Eduardo Habkost) Automated QOM boilerplate changes: * Automated changes to use DECLARE_*_CHECKER (Eduardo Habkost * Automated changes to use OBJECT_DECLARE* (Eduardo Habkost) # gpg: Signature made Thu 10 Sep 2020 19:17:49 BST # gpg: using RSA key 5A322FD5ABC4D3DBACCFD1AA2807936F984DC5A6 # gpg: issuer "ehabkost@redhat.com" # gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>" [full] # Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF D1AA 2807 936F 984D C5A6 * remotes/ehabkost/tags/machine-next-pull-request: (33 commits) virtio-vga: Use typedef name for instance_size vhost-user-vga: Use typedef name for instance_size xilinx_axienet: Use typedef name for instance_size lpc_ich9: Use typedef name for instance_size omap_intc: Use typedef name for instance_size xilinx_axidma: Use typedef name for instance_size tusb6010: Rename TUSB to TUSB6010 pc87312: Rename TYPE_PC87312_SUPERIO to TYPE_PC87312 vfio: Rename PCI_VFIO to VFIO_PCI usb: Rename USB_SERIAL_DEV to USB_SERIAL sabre: Rename SABRE_DEVICE to SABRE rs6000_mc: Rename RS6000MC_DEVICE to RS6000MC filter-rewriter: Rename FILTER_COLO_REWRITER to FILTER_REWRITER esp: Rename ESP_STATE to ESP ahci: Rename ICH_AHCI to ICH9_AHCI vmgenid: Rename VMGENID_DEVICE to TYPE_VMGENID vfio: Rename VFIO_AP_DEVICE_TYPE to TYPE_VFIO_AP_DEVICE dev-smartcard-reader: Rename CCID_DEV_NAME to TYPE_USB_CCID_DEV ap-device: Rename AP_DEVICE_TYPE to TYPE_AP_DEVICE gpex: Fix type checking function name ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/i386')
-rw-r--r--hw/i386/amd_iommu.h10
-rw-r--r--hw/i386/kvm/clock.c9
-rw-r--r--hw/i386/kvm/i8254.c18
-rw-r--r--hw/i386/kvm/i8259.c12
-rw-r--r--hw/i386/kvmvapic.c9
-rw-r--r--hw/i386/port92.c9
-rw-r--r--hw/i386/vmmouse.c10
-rw-r--r--hw/i386/vmport.c9
-rw-r--r--hw/i386/xen/xen_platform.c10
-rw-r--r--hw/i386/xen/xen_pvdevice.c10
10 files changed, 63 insertions, 43 deletions
diff --git a/hw/i386/amd_iommu.h b/hw/i386/amd_iommu.h
index e05a4ef..fa5feb1 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,8 +297,9 @@ struct irte_ga {
};
#define TYPE_AMD_IOMMU_DEVICE "amd-iommu"
-#define AMD_IOMMU_DEVICE(obj)\
- OBJECT_CHECK(AMDVIState, (obj), TYPE_AMD_IOMMU_DEVICE)
+typedef struct AMDVIState AMDVIState;
+DECLARE_INSTANCE_CHECKER(AMDVIState, AMD_IOMMU_DEVICE,
+ TYPE_AMD_IOMMU_DEVICE)
#define TYPE_AMD_IOMMU_PCI "AMDVI-PCI"
@@ -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 6428335..37f4754 100644
--- a/hw/i386/kvm/clock.c
+++ b/hw/i386/kvm/clock.c
@@ -29,11 +29,14 @@
#include <linux/kvm.h>
#include "standard-headers/asm-x86/kvm_para.h"
+#include "qom/object.h"
#define TYPE_KVM_CLOCK "kvmclock"
-#define KVM_CLOCK(obj) OBJECT_CHECK(KVMClockState, (obj), TYPE_KVM_CLOCK)
+typedef struct KVMClockState KVMClockState;
+DECLARE_INSTANCE_CHECKER(KVMClockState, KVM_CLOCK,
+ TYPE_KVM_CLOCK)
-typedef struct KVMClockState {
+struct KVMClockState {
/*< private >*/
SysBusDevice busdev;
/*< public >*/
@@ -50,7 +53,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 876f5aa6..e18fd33 100644
--- a/hw/i386/kvm/i8254.c
+++ b/hw/i386/kvm/i8254.c
@@ -33,30 +33,30 @@
#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
-#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 KVMPITClass KVMPITClass;
+typedef struct KVMPITState KVMPITState;
+DECLARE_OBJ_CHECKERS(KVMPITState, KVMPITClass,
+ KVM_PIT, 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 e404fdc..3f8bf69 100644
--- a/hw/i386/kvm/i8259.c
+++ b/hw/i386/kvm/i8259.c
@@ -17,22 +17,22 @@
#include "hw/i386/apic_internal.h"
#include "hw/irq.h"
#include "sysemu/kvm.h"
+#include "qom/object.h"
#define TYPE_KVM_I8259 "kvm-i8259"
-#define KVM_PIC_CLASS(class) \
- OBJECT_CLASS_CHECK(KVMPICClass, (class), TYPE_KVM_I8259)
-#define KVM_PIC_GET_CLASS(obj) \
- OBJECT_GET_CLASS(KVMPICClass, (obj), TYPE_KVM_I8259)
+typedef struct KVMPICClass KVMPICClass;
+DECLARE_CLASS_CHECKERS(KVMPICClass, KVM_PIC,
+ TYPE_KVM_I8259)
/**
* 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 5163920..a4e05f0 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,10 +70,12 @@ 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)
+DECLARE_INSTANCE_CHECKER(VAPICROMState, VAPIC,
+ TYPE_VAPIC)
#define TPR_INSTR_ABS_MODRM 0x1
#define TPR_INSTR_MATCH_MODRM_REG 0x2
diff --git a/hw/i386/port92.c b/hw/i386/port92.c
index 19866c4..c00dcb2 100644
--- a/hw/i386/port92.c
+++ b/hw/i386/port92.c
@@ -12,16 +12,19 @@
#include "hw/irq.h"
#include "hw/i386/pc.h"
#include "trace.h"
+#include "qom/object.h"
-#define PORT92(obj) OBJECT_CHECK(Port92State, (obj), TYPE_PORT92)
+typedef struct Port92State Port92State;
+DECLARE_INSTANCE_CHECKER(Port92State, PORT92,
+ 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 ba5c987..ae4cbc7 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,11 @@
#endif
#define TYPE_VMMOUSE "vmmouse"
-#define VMMOUSE(obj) OBJECT_CHECK(VMMouseState, (obj), TYPE_VMMOUSE)
+typedef struct VMMouseState VMMouseState;
+DECLARE_INSTANCE_CHECKER(VMMouseState, VMMOUSE,
+ TYPE_VMMOUSE)
-typedef struct VMMouseState
-{
+struct VMMouseState {
ISADevice parent_obj;
uint32_t queue[VMMOUSE_QUEUE_SIZE];
@@ -63,7 +65,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 89bda91..df52b6f 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,11 @@
#define VCPU_INFO_LEGACY_X2APIC_BIT 3
#define VCPU_INFO_RESERVED_BIT 31
-#define VMPORT(obj) OBJECT_CHECK(VMPortState, (obj), TYPE_VMPORT)
+typedef struct VMPortState VMPortState;
+DECLARE_INSTANCE_CHECKER(VMPortState, VMPORT,
+ TYPE_VMPORT)
-typedef struct VMPortState {
+struct VMPortState {
ISADevice parent_obj;
MemoryRegion io;
@@ -75,7 +78,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 a1492fd..a8bbe8c 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,11 +68,12 @@ 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) \
- OBJECT_CHECK(PCIXenPlatformState, (obj), TYPE_XEN_PLATFORM)
+DECLARE_INSTANCE_CHECKER(PCIXenPlatformState, XEN_PLATFORM,
+ TYPE_XEN_PLATFORM)
#define XEN_PLATFORM_IOPORT 0x10
diff --git a/hw/i386/xen/xen_pvdevice.c b/hw/i386/xen/xen_pvdevice.c
index ee2610c..67f8361 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"
-#define XEN_PV_DEVICE(obj) \
- OBJECT_CHECK(XenPVDevice, (obj), TYPE_XEN_PV_DEVICE)
+typedef struct XenPVDevice XenPVDevice;
+DECLARE_INSTANCE_CHECKER(XenPVDevice, XEN_PV_DEVICE,
+ 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)