aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2020-10-01 12:23:19 +0100
committerPeter Maydell <peter.maydell@linaro.org>2020-10-01 12:23:19 +0100
commit37a712a0f969ca2df7f01182409a6c4825cebfb5 (patch)
tree6eeb0b7f0bde4c8a0f8e1115b990530c5c62e9fe /include
parentcbba3dc6ea3fc9aa66e9f9eb41051536e3ad7cd0 (diff)
parent37aeb7a28ddbf52dd25dd53ae1b8391bc2287858 (diff)
Merge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream' into staging
* SCSI fix (Dmitry, Li Feng, Li Qiang) * memory API fixes (Eduardo) * removal of deprecated '-numa node', 'cpu-add', '-smp' (Igor) * ACPI fix for VMBus (Jon) * relocatable install (myself) * always remove docker containers (myself) * serial cleanups (Philippe) * vmware cpuid leaf for tsc and apic frequency (Sunil) * KVM_FEATURE_ASYNC_PF_INT support (Vitaly) * i386 XSAVE bugfix (Xiaoyao) * QOM developer documentation in docs/devel (Eduardo) * new checkpatch tests (Dov) * x86_64 syscall fix (Douglas) * interrupt-based APF fix (Vitaly) * always create kvmclock (Vitaly) * fix bios-tables-test (Eduardo) * KVM PV features cleanup (myself) * CAN FD (Pavel) meson: * fixes (Marc-André, Max, Stefan, Alexander, myself) * moved libmpathpersist, cocoa, malloc tests (myself) * support for 0.56 introspected test dependencies (myself) # gpg: Signature made Wed 30 Sep 2020 18:11:45 BST # gpg: using RSA key F13338574B662389866C7682BFFBD25F78C7AE83 # gpg: issuer "pbonzini@redhat.com" # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full] # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" [full] # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * remotes/bonzini-gitlab/tags/for-upstream: (86 commits) hw/net/can: Correct Kconfig dependencies hw/net/can: Documentation for CTU CAN FD IP open hardware core emulation. hw/net/can: CTU CAN FD IP open hardware core emulation. hw/net/can/ctucafd: Add CTU CAN FD core register definitions. net/can: Add can_dlc2len and can_len2dlc for CAN FD. hw/net/can: sja1000 ignore CAN FD frames net/can: Initial host SocketCan support for CAN FD. target/i386: kvm: do not use kvm_check_extension to find paravirtual capabilities bios-tables-test: Remove kernel-irqchip=off option target/i386: always create kvmclock device target/i386: Fix VM migration when interrupt based APF is enabled helper_syscall x86_64: clear exception_is_int checkpatch: Detect '%#' or '%0#' in printf-style format strings typedefs: Restrict PCMachineState to 'hw/i386/pc.h' hw/xen: Split x86-specific declaration from generic hardware ones stubs: Split accelerator / hardware related stubs sysemu/xen: Add missing 'exec/cpu-common.h' header for ram_addr_t type hw/i386/xen: Rename X86/PC specific function as xen_hvm_init_pc() docs: Move object.h overview doc comment to qom.rst docs: Create docs/devel/qom.rst ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include')
-rw-r--r--include/exec/memory.h64
-rw-r--r--include/hw/boards.h2
-rw-r--r--include/hw/char/serial.h11
-rw-r--r--include/hw/i386/pc.h7
-rw-r--r--include/hw/kvm/clock.h4
-rw-r--r--include/hw/virtio/vhost-scsi-common.h2
-rw-r--r--include/hw/xen/xen-x86.h15
-rw-r--r--include/hw/xen/xen.h2
-rw-r--r--include/net/can_emu.h12
-rw-r--r--include/net/net.h4
-rw-r--r--include/qemu-common.h1
-rw-r--r--include/qemu/cutils.h12
-rw-r--r--include/qemu/osdep.h8
-rw-r--r--include/qemu/typedefs.h1
-rw-r--r--include/qom/object.h547
-rw-r--r--include/scsi/constants.h1
-rw-r--r--include/sysemu/numa.h4
-rw-r--r--include/sysemu/sysemu.h2
-rw-r--r--include/sysemu/xen.h2
19 files changed, 193 insertions, 508 deletions
diff --git a/include/exec/memory.h b/include/exec/memory.h
index 06b85e3a73..dee0985162 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -228,8 +228,11 @@ enum IOMMUMemoryRegionAttr {
* attributes and the output TLB entry depends on the transaction
* attributes, we represent this using IOMMU indexes. Each index
* selects a particular translation table that the IOMMU has:
+ *
* @attrs_to_index returns the IOMMU index for a set of transaction attributes
+ *
* @translate takes an input address and an IOMMU index
+ *
* and the mapping returned can only depend on the input address and the
* IOMMU index.
*
@@ -238,10 +241,13 @@ enum IOMMUMemoryRegionAttr {
* for secure transactions and one for non-secure transactions.
*/
struct IOMMUMemoryRegionClass {
- /* private */
+ /* private: */
MemoryRegionClass parent_class;
- /*
+ /* public: */
+ /**
+ * @translate:
+ *
* Return a TLB entry that contains a given address.
*
* The IOMMUAccessFlags indicated via @flag are optional and may
@@ -262,26 +268,38 @@ struct IOMMUMemoryRegionClass {
* information when the IOMMU mapping changes.
*
* @iommu: the IOMMUMemoryRegion
+ *
* @hwaddr: address to be translated within the memory region
- * @flag: requested access permissions
+ *
+ * @flag: requested access permission
+ *
* @iommu_idx: IOMMU index for the translation
*/
IOMMUTLBEntry (*translate)(IOMMUMemoryRegion *iommu, hwaddr addr,
IOMMUAccessFlags flag, int iommu_idx);
- /* Returns minimum supported page size in bytes.
+ /**
+ * @get_min_page_size:
+ *
+ * Returns minimum supported page size in bytes.
+ *
* If this method is not provided then the minimum is assumed to
* be TARGET_PAGE_SIZE.
*
* @iommu: the IOMMUMemoryRegion
*/
uint64_t (*get_min_page_size)(IOMMUMemoryRegion *iommu);
- /* Called when IOMMU Notifier flag changes (ie when the set of
+ /**
+ * @notify_flag_changed:
+ *
+ * Called when IOMMU Notifier flag changes (ie when the set of
* events which IOMMU users are requesting notification for changes).
* Optional method -- need not be provided if the IOMMU does not
* need to know exactly which events must be notified.
*
* @iommu: the IOMMUMemoryRegion
+ *
* @old_flags: events which previously needed to be notified
+ *
* @new_flags: events which now need to be notified
*
* Returns 0 on success, or a negative errno; in particular
@@ -293,7 +311,10 @@ struct IOMMUMemoryRegionClass {
IOMMUNotifierFlag old_flags,
IOMMUNotifierFlag new_flags,
Error **errp);
- /* Called to handle memory_region_iommu_replay().
+ /**
+ * @replay:
+ *
+ * Called to handle memory_region_iommu_replay().
*
* The default implementation of memory_region_iommu_replay() is to
* call the IOMMU translate method for every page in the address space
@@ -310,7 +331,10 @@ struct IOMMUMemoryRegionClass {
*/
void (*replay)(IOMMUMemoryRegion *iommu, IOMMUNotifier *notifier);
- /* Get IOMMU misc attributes. This is an optional method that
+ /**
+ * @get_attr:
+ *
+ * Get IOMMU misc attributes. This is an optional method that
* can be used to allow users of the IOMMU to get implementation-specific
* information. The IOMMU implements this method to handle calls
* by IOMMU users to memory_region_iommu_get_attr() by filling in
@@ -319,7 +343,9 @@ struct IOMMUMemoryRegionClass {
* memory_region_iommu_get_attr() will always return -EINVAL.
*
* @iommu: the IOMMUMemoryRegion
+ *
* @attr: attribute being queried
+ *
* @data: memory to fill in with the attribute data
*
* Returns 0 on success, or a negative errno; in particular
@@ -328,7 +354,10 @@ struct IOMMUMemoryRegionClass {
int (*get_attr)(IOMMUMemoryRegion *iommu, enum IOMMUMemoryRegionAttr attr,
void *data);
- /* Return the IOMMU index to use for a given set of transaction attributes.
+ /**
+ * @attrs_to_index:
+ *
+ * Return the IOMMU index to use for a given set of transaction attributes.
*
* Optional method: if an IOMMU only supports a single IOMMU index then
* the default implementation of memory_region_iommu_attrs_to_index()
@@ -341,7 +370,10 @@ struct IOMMUMemoryRegionClass {
*/
int (*attrs_to_index)(IOMMUMemoryRegion *iommu, MemTxAttrs attrs);
- /* Return the number of IOMMU indexes this IOMMU supports.
+ /**
+ * @num_indexes:
+ *
+ * Return the number of IOMMU indexes this IOMMU supports.
*
* Optional method: if this method is not provided, then
* memory_region_iommu_num_indexes() will return 1, indicating that
@@ -372,7 +404,6 @@ struct MemoryRegion {
bool nonvolatile;
bool rom_device;
bool flush_coalesced_mmio;
- bool global_locking;
uint8_t dirty_log_mask;
bool is_iommu;
RAMBlock *ram_block;
@@ -1707,19 +1738,6 @@ void memory_region_set_flush_coalesced(MemoryRegion *mr);
void memory_region_clear_flush_coalesced(MemoryRegion *mr);
/**
- * memory_region_clear_global_locking: Declares that access processing does
- * not depend on the QEMU global lock.
- *
- * By clearing this property, accesses to the memory region will be processed
- * outside of QEMU's global lock (unless the lock is held on when issuing the
- * access request). In this case, the device model implementing the access
- * handlers is responsible for synchronization of concurrency.
- *
- * @mr: the memory region to be updated.
- */
-void memory_region_clear_global_locking(MemoryRegion *mr);
-
-/**
* memory_region_add_eventfd: Request an eventfd to be triggered when a word
* is written to a location.
*
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 482d2833f6..bf53e8a16e 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -202,8 +202,6 @@ struct MachineClass {
strList *allowed_dynamic_sysbus_devices;
bool auto_enable_numa_with_memhp;
bool auto_enable_numa_with_memdev;
- void (*numa_auto_assign_ram)(MachineClass *mc, NodeInfo *nodes,
- int nb_nodes, ram_addr_t size);
bool ignore_boot_device_suffixes;
bool smbus_no_migration_support;
bool nvdimm_supported;
diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h
index db4f9af18c..8ba7eca3d6 100644
--- a/include/hw/char/serial.h
+++ b/include/hw/char/serial.h
@@ -61,7 +61,7 @@ struct SerialState {
uint32_t baudbase;
uint32_t tsr_retry;
guint watch_tag;
- uint32_t wakeup;
+ bool wakeup;
/* Time when the last byte was successfully sent out of the tsr */
uint64_t last_xmit_ts;
@@ -90,12 +90,6 @@ struct SerialMM {
uint8_t endianness;
};
-struct SerialIO {
- SysBusDevice parent;
-
- SerialState serial;
-};
-
extern const VMStateDescription vmstate_serial;
extern const MemoryRegionOps serial_io_ops;
@@ -107,9 +101,6 @@ OBJECT_DECLARE_SIMPLE_TYPE(SerialState, SERIAL)
#define TYPE_SERIAL_MM "serial-mm"
OBJECT_DECLARE_SIMPLE_TYPE(SerialMM, SERIAL_MM)
-#define TYPE_SERIAL_IO "serial-io"
-OBJECT_DECLARE_SIMPLE_TYPE(SerialIO, SERIAL_IO)
-
SerialMM *serial_mm_init(MemoryRegion *address_space,
hwaddr base, int regshift,
qemu_irq irq, int baudbase,
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index c71b02cafd..84639d0ebc 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -20,7 +20,7 @@
* @boot_cpus: number of present VCPUs
* @smp_dies: number of dies per one package
*/
-struct PCMachineState {
+typedef struct PCMachineState {
/*< private >*/
X86MachineState parent_obj;
@@ -50,7 +50,7 @@ struct PCMachineState {
/* ACPI Memory hotplug IO base address */
hwaddr memhp_io_base;
-};
+} PCMachineState;
#define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device"
#define PC_MACHINE_MAX_RAM_BELOW_4G "max-ram-below-4g"
@@ -118,6 +118,9 @@ struct PCMachineClass {
/* use PVH to load kernels that support this feature */
bool pvh_enabled;
+
+ /* create kvmclock device even when KVM PV features are not exposed */
+ bool kvmclock_create_always;
};
#define TYPE_PC_MACHINE "generic-pc-machine"
diff --git a/include/hw/kvm/clock.h b/include/hw/kvm/clock.h
index 81c66b2302..7994071c4f 100644
--- a/include/hw/kvm/clock.h
+++ b/include/hw/kvm/clock.h
@@ -15,11 +15,11 @@
#ifdef CONFIG_KVM
-void kvmclock_create(void);
+void kvmclock_create(bool create_always);
#else /* CONFIG_KVM */
-static inline void kvmclock_create(void)
+static inline void kvmclock_create(bool create_always)
{
}
diff --git a/include/hw/virtio/vhost-scsi-common.h b/include/hw/virtio/vhost-scsi-common.h
index 0c8909d12a..18f115527c 100644
--- a/include/hw/virtio/vhost-scsi-common.h
+++ b/include/hw/virtio/vhost-scsi-common.h
@@ -35,6 +35,8 @@ struct VHostSCSICommon {
int lun;
uint64_t host_features;
bool migratable;
+
+ struct vhost_inflight *inflight;
};
int vhost_scsi_common_start(VHostSCSICommon *vsc);
diff --git a/include/hw/xen/xen-x86.h b/include/hw/xen/xen-x86.h
new file mode 100644
index 0000000000..85e3db1b8d
--- /dev/null
+++ b/include/hw/xen/xen-x86.h
@@ -0,0 +1,15 @@
+/*
+ * Xen X86-specific
+ *
+ * Copyright 2020 Red Hat, Inc.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#ifndef QEMU_HW_XEN_X86_H
+#define QEMU_HW_XEN_X86_H
+
+#include "hw/i386/pc.h"
+
+void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegion **ram_memory);
+
+#endif /* QEMU_HW_XEN_X86_H */
diff --git a/include/hw/xen/xen.h b/include/hw/xen/xen.h
index 771dd447f2..1406648ca5 100644
--- a/include/hw/xen/xen.h
+++ b/include/hw/xen/xen.h
@@ -30,8 +30,6 @@ qemu_irq *xen_interrupt_controller_init(void);
void xenstore_store_pv_console_info(int i, struct Chardev *chr);
-void xen_hvm_init(PCMachineState *pcms, MemoryRegion **ram_memory);
-
void xen_register_framebuffer(struct MemoryRegion *mr);
#endif /* QEMU_HW_XEN_H */
diff --git a/include/net/can_emu.h b/include/net/can_emu.h
index 743c6647c1..6f9b206bb5 100644
--- a/include/net/can_emu.h
+++ b/include/net/can_emu.h
@@ -46,7 +46,8 @@ typedef uint32_t qemu_canid_t;
typedef struct qemu_can_frame {
qemu_canid_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */
uint8_t can_dlc; /* data length code: 0 .. 8 */
- uint8_t data[8] QEMU_ALIGNED(8);
+ uint8_t flags;
+ uint8_t data[64] QEMU_ALIGNED(8);
} qemu_can_frame;
/* Keep defines for QEMU separate from Linux ones for now */
@@ -58,6 +59,10 @@ typedef struct qemu_can_frame {
#define QEMU_CAN_SFF_MASK 0x000007FFU /* standard frame format (SFF) */
#define QEMU_CAN_EFF_MASK 0x1FFFFFFFU /* extended frame format (EFF) */
+#define QEMU_CAN_FRMF_BRS 0x01 /* bit rate switch (2nd bitrate for data) */
+#define QEMU_CAN_FRMF_ESI 0x02 /* error state ind. of transmitting node */
+#define QEMU_CAN_FRMF_TYPE_FD 0x10 /* internal bit ind. of CAN FD frame */
+
/**
* struct qemu_can_filter - CAN ID based filter in can_register().
* @can_id: relevant bits of CAN ID which are not masked out.
@@ -97,6 +102,7 @@ struct CanBusClientState {
char *model;
char *name;
void (*destructor)(CanBusClientState *);
+ bool fd_mode;
};
#define TYPE_CAN_BUS "can-bus"
@@ -116,4 +122,8 @@ int can_bus_client_set_filters(CanBusClientState *,
const struct qemu_can_filter *filters,
size_t filters_cnt);
+uint8_t can_dlc2len(uint8_t can_dlc);
+
+uint8_t can_len2dlc(uint8_t len);
+
#endif
diff --git a/include/net/net.h b/include/net/net.h
index e7ef42d62b..897b2d7595 100644
--- a/include/net/net.h
+++ b/include/net/net.h
@@ -209,8 +209,8 @@ void netdev_add(QemuOpts *opts, Error **errp);
int net_hub_id_for_client(NetClientState *nc, int *id);
NetClientState *net_hub_port_find(int hub_id);
-#define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup"
-#define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown"
+#define DEFAULT_NETWORK_SCRIPT CONFIG_SYSCONFDIR "/qemu-ifup"
+#define DEFAULT_NETWORK_DOWN_SCRIPT CONFIG_SYSCONFDIR "/qemu-ifdown"
#define DEFAULT_BRIDGE_HELPER CONFIG_QEMU_HELPERDIR "/qemu-bridge-helper"
#define DEFAULT_BRIDGE_INTERFACE "br0"
diff --git a/include/qemu-common.h b/include/qemu-common.h
index cc902b690d..fda7dc6ca7 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -131,7 +131,6 @@ char *qemu_find_file(int type, const char *name);
/* OS specific functions */
void os_setup_early_signal_handling(void);
-char *os_find_datadir(void);
int os_parse_cmd_args(int index, const char *optarg);
/*
diff --git a/include/qemu/cutils.h b/include/qemu/cutils.h
index eb59852dfd..3a86ec0321 100644
--- a/include/qemu/cutils.h
+++ b/include/qemu/cutils.h
@@ -184,4 +184,16 @@ int uleb128_decode_small(const uint8_t *in, uint32_t *n);
*/
int qemu_pstrcmp0(const char **str1, const char **str2);
+
+/**
+ * get_relocated_path:
+ * @dir: the directory (typically a `CONFIG_*DIR` variable) to be relocated.
+ *
+ * Returns a path for @dir that uses the directory of the running executable
+ * as the prefix. For example, if `bindir` is `/usr/bin` and @dir is
+ * `/usr/share/qemu`, the function will append `../share/qemu` to the
+ * directory that contains the running executable and return the result.
+ */
+char *get_relocated_path(const char *dir);
+
#endif
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index dad44be043..f9ec8c84e9 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -597,12 +597,8 @@ char *qemu_get_local_state_pathname(const char *relative_pathname);
* Try OS specific API first, if not working, parse from argv0. */
void qemu_init_exec_dir(const char *argv0);
-/* Get the saved exec dir.
- *
- * The caller is responsible for releasing the value returned with g_free()
- * after use.
- */
-char *qemu_get_exec_dir(void);
+/* Get the saved exec dir. */
+const char *qemu_get_exec_dir(void);
/**
* qemu_getauxval:
diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h
index 427027a970..6281eae3b5 100644
--- a/include/qemu/typedefs.h
+++ b/include/qemu/typedefs.h
@@ -90,7 +90,6 @@ typedef struct PCIExpressDevice PCIExpressDevice;
typedef struct PCIExpressHost PCIExpressHost;
typedef struct PCIHostDeviceAddress PCIHostDeviceAddress;
typedef struct PCIHostState PCIHostState;
-typedef struct PCMachineState PCMachineState;
typedef struct PostcopyDiscardState PostcopyDiscardState;
typedef struct Property Property;
typedef struct PropertyInfo PropertyInfo;
diff --git a/include/qom/object.h b/include/qom/object.h
index 9b01888726..27aaa67e63 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -28,399 +28,6 @@ typedef struct InterfaceInfo InterfaceInfo;
#define TYPE_OBJECT "object"
-/**
- * SECTION:object.h
- * @title:Base Object Type System
- * @short_description: interfaces for creating new types and objects
- *
- * The QEMU Object Model provides a framework for registering user creatable
- * types and instantiating objects from those types. QOM provides the following
- * features:
- *
- * - System for dynamically registering types
- * - Support for single-inheritance of types
- * - Multiple inheritance of stateless interfaces
- *
- * <example>
- * <title>Creating a minimal type</title>
- * <programlisting>
- * #include "qdev.h"
- *
- * #define TYPE_MY_DEVICE "my-device"
- *
- * // No new virtual functions: we can reuse the typedef for the
- * // superclass.
- * typedef DeviceClass MyDeviceClass;
- * typedef struct MyDevice
- * {
- * DeviceState parent;
- *
- * int reg0, reg1, reg2;
- * } MyDevice;
- *
- * static const TypeInfo my_device_info = {
- * .name = TYPE_MY_DEVICE,
- * .parent = TYPE_DEVICE,
- * .instance_size = sizeof(MyDevice),
- * };
- *
- * static void my_device_register_types(void)
- * {
- * type_register_static(&my_device_info);
- * }
- *
- * type_init(my_device_register_types)
- * </programlisting>
- * </example>
- *
- * In the above example, we create a simple type that is described by #TypeInfo.
- * #TypeInfo describes information about the type including what it inherits
- * from, the instance and class size, and constructor/destructor hooks.
- *
- * Alternatively several static types could be registered using helper macro
- * DEFINE_TYPES()
- *
- * <example>
- * <programlisting>
- * static const TypeInfo device_types_info[] = {
- * {
- * .name = TYPE_MY_DEVICE_A,
- * .parent = TYPE_DEVICE,
- * .instance_size = sizeof(MyDeviceA),
- * },
- * {
- * .name = TYPE_MY_DEVICE_B,
- * .parent = TYPE_DEVICE,
- * .instance_size = sizeof(MyDeviceB),
- * },
- * };
- *
- * DEFINE_TYPES(device_types_info)
- * </programlisting>
- * </example>
- *
- * Every type has an #ObjectClass associated with it. #ObjectClass derivatives
- * are instantiated dynamically but there is only ever one instance for any
- * given type. The #ObjectClass typically holds a table of function pointers
- * for the virtual methods implemented by this type.
- *
- * Using object_new(), a new #Object derivative will be instantiated. You can
- * cast an #Object to a subclass (or base-class) type using
- * object_dynamic_cast(). You typically want to define macro wrappers around
- * OBJECT_CHECK() and OBJECT_CLASS_CHECK() to make it easier to convert to a
- * specific type:
- *
- * <example>
- * <title>Typecasting macros</title>
- * <programlisting>
- * #define MY_DEVICE_GET_CLASS(obj) \
- * OBJECT_GET_CLASS(MyDeviceClass, obj, TYPE_MY_DEVICE)
- * #define MY_DEVICE_CLASS(klass) \
- * OBJECT_CLASS_CHECK(MyDeviceClass, klass, TYPE_MY_DEVICE)
- * #define MY_DEVICE(obj) \
- * OBJECT_CHECK(MyDevice, obj, TYPE_MY_DEVICE)
- * </programlisting>
- * </example>
- *
- * # Class Initialization #
- *
- * Before an object is initialized, the class for the object must be
- * initialized. There is only one class object for all instance objects
- * that is created lazily.
- *
- * Classes are initialized by first initializing any parent classes (if
- * necessary). After the parent class object has initialized, it will be
- * copied into the current class object and any additional storage in the
- * class object is zero filled.
- *
- * The effect of this is that classes automatically inherit any virtual
- * function pointers that the parent class has already initialized. All
- * other fields will be zero filled.
- *
- * Once all of the parent classes have been initialized, #TypeInfo::class_init
- * is called to let the class being instantiated provide default initialize for
- * its virtual functions. Here is how the above example might be modified
- * to introduce an overridden virtual function:
- *
- * <example>
- * <title>Overriding a virtual function</title>
- * <programlisting>
- * #include "qdev.h"
- *
- * void my_device_class_init(ObjectClass *klass, void *class_data)
- * {
- * DeviceClass *dc = DEVICE_CLASS(klass);
- * dc->reset = my_device_reset;
- * }
- *
- * static const TypeInfo my_device_info = {
- * .name = TYPE_MY_DEVICE,
- * .parent = TYPE_DEVICE,
- * .instance_size = sizeof(MyDevice),
- * .class_init = my_device_class_init,
- * };
- * </programlisting>
- * </example>
- *
- * Introducing new virtual methods requires a class to define its own
- * struct and to add a .class_size member to the #TypeInfo. Each method
- * will also have a wrapper function to call it easily:
- *
- * <example>
- * <title>Defining an abstract class</title>
- * <programlisting>
- * #include "qdev.h"
- *
- * typedef struct MyDeviceClass
- * {
- * DeviceClass parent;
- *
- * void (*frobnicate) (MyDevice *obj);
- * } MyDeviceClass;
- *
- * static const TypeInfo my_device_info = {
- * .name = TYPE_MY_DEVICE,
- * .parent = TYPE_DEVICE,
- * .instance_size = sizeof(MyDevice),
- * .abstract = true, // or set a default in my_device_class_init
- * .class_size = sizeof(MyDeviceClass),
- * };
- *
- * void my_device_frobnicate(MyDevice *obj)
- * {
- * MyDeviceClass *klass = MY_DEVICE_GET_CLASS(obj);
- *
- * klass->frobnicate(obj);
- * }
- * </programlisting>
- * </example>
- *
- * # Interfaces #
- *
- * Interfaces allow a limited form of multiple inheritance. Instances are
- * similar to normal types except for the fact that are only defined by
- * their classes and never carry any state. As a consequence, a pointer to
- * an interface instance should always be of incomplete type in order to be
- * sure it cannot be dereferenced. That is, you should define the
- * 'typedef struct SomethingIf SomethingIf' so that you can pass around
- * 'SomethingIf *si' arguments, but not define a 'struct SomethingIf { ... }'.
- * The only things you can validly do with a 'SomethingIf *' are to pass it as
- * an argument to a method on its corresponding SomethingIfClass, or to
- * dynamically cast it to an object that implements the interface.
- *
- * # Methods #
- *
- * A <emphasis>method</emphasis> is a function within the namespace scope of
- * a class. It usually operates on the object instance by passing it as a
- * strongly-typed first argument.
- * If it does not operate on an object instance, it is dubbed
- * <emphasis>class method</emphasis>.
- *
- * Methods cannot be overloaded. That is, the #ObjectClass and method name
- * uniquely identity the function to be called; the signature does not vary
- * except for trailing varargs.
- *
- * Methods are always <emphasis>virtual</emphasis>. Overriding a method in
- * #TypeInfo.class_init of a subclass leads to any user of the class obtained
- * via OBJECT_GET_CLASS() accessing the overridden function.
- * The original function is not automatically invoked. It is the responsibility
- * of the overriding class to determine whether and when to invoke the method
- * being overridden.
- *
- * To invoke the method being overridden, the preferred solution is to store
- * the original value in the overriding class before overriding the method.
- * This corresponds to |[ {super,base}.method(...) ]| in Java and C#
- * respectively; this frees the overriding class from hardcoding its parent
- * class, which someone might choose to change at some point.
- *
- * <example>
- * <title>Overriding a virtual method</title>
- * <programlisting>
- * typedef struct MyState MyState;
- *
- * typedef void (*MyDoSomething)(MyState *obj);
- *
- * typedef struct MyClass {
- * ObjectClass parent_class;
- *
- * MyDoSomething do_something;
- * } MyClass;
- *
- * static void my_do_something(MyState *obj)
- * {
- * // do something
- * }
- *
- * static void my_class_init(ObjectClass *oc, void *data)
- * {
- * MyClass *mc = MY_CLASS(oc);
- *
- * mc->do_something = my_do_something;
- * }
- *
- * static const TypeInfo my_type_info = {
- * .name = TYPE_MY,
- * .parent = TYPE_OBJECT,
- * .instance_size = sizeof(MyState),
- * .class_size = sizeof(MyClass),
- * .class_init = my_class_init,
- * };
- *
- * typedef struct DerivedClass {
- * MyClass parent_class;
- *
- * MyDoSomething parent_do_something;
- * } DerivedClass;
- *
- * static void derived_do_something(MyState *obj)
- * {
- * DerivedClass *dc = DERIVED_GET_CLASS(obj);
- *
- * // do something here
- * dc->parent_do_something(obj);
- * // do something else here
- * }
- *
- * static void derived_class_init(ObjectClass *oc, void *data)
- * {
- * MyClass *mc = MY_CLASS(oc);
- * DerivedClass *dc = DERIVED_CLASS(oc);
- *
- * dc->parent_do_something = mc->do_something;
- * mc->do_something = derived_do_something;
- * }
- *
- * static const TypeInfo derived_type_info = {
- * .name = TYPE_DERIVED,
- * .parent = TYPE_MY,
- * .class_size = sizeof(DerivedClass),
- * .class_init = derived_class_init,
- * };
- * </programlisting>
- * </example>
- *
- * Alternatively, object_class_by_name() can be used to obtain the class and
- * its non-overridden methods for a specific type. This would correspond to
- * |[ MyClass::method(...) ]| in C++.
- *
- * The first example of such a QOM method was #CPUClass.reset,
- * another example is #DeviceClass.realize.
- *
- * # Standard type declaration and definition macros #
- *
- * A lot of the code outlined above follows a standard pattern and naming
- * convention. To reduce the amount of boilerplate code that needs to be
- * written for a new type there are two sets of macros to generate the
- * common parts in a standard format.
- *
- * A type is declared using the OBJECT_DECLARE macro family. In types
- * which do not require any virtual functions in the class, the
- * OBJECT_DECLARE_SIMPLE_TYPE macro is suitable, and is commonly placed
- * in the header file:
- *
- * <example>
- * <title>Declaring a simple type</title>
- * <programlisting>
- * OBJECT_DECLARE_SIMPLE_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE)
- * </programlisting>
- * </example>
- *
- * This is equivalent to the following:
- *
- * <example>
- * <title>Expansion from declaring a simple type</title>
- * <programlisting>
- * typedef struct MyDevice MyDevice;
- * typedef struct MyDeviceClass MyDeviceClass;
- *
- * G_DEFINE_AUTOPTR_CLEANUP_FUNC(MyDeviceClass, object_unref)
- *
- * #define MY_DEVICE_GET_CLASS(void *obj) \
- * OBJECT_GET_CLASS(MyDeviceClass, obj, TYPE_MY_DEVICE)
- * #define MY_DEVICE_CLASS(void *klass) \
- * OBJECT_CLASS_CHECK(MyDeviceClass, klass, TYPE_MY_DEVICE)
- * #define MY_DEVICE(void *obj)
- * OBJECT_CHECK(MyDevice, obj, TYPE_MY_DEVICE)
- *
- * struct MyDeviceClass {
- * DeviceClass parent_class;
- * };
- * </programlisting>
- * </example>
- *
- * The 'struct MyDevice' needs to be declared separately.
- * If the type requires virtual functions to be declared in the class
- * struct, then the alternative OBJECT_DECLARE_TYPE() macro can be
- * used. This does the same as OBJECT_DECLARE_SIMPLE_TYPE(), but without
- * the 'struct MyDeviceClass' definition.
- *
- * To implement the type, the OBJECT_DEFINE macro family is available.
- * In the simple case the OBJECT_DEFINE_TYPE macro is suitable:
- *
- * <example>
- * <title>Defining a simple type</title>
- * <programlisting>
- * OBJECT_DEFINE_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE)
- * </programlisting>
- * </example>
- *
- * This is equivalent to the following:
- *
- * <example>
- * <title>Expansion from defining a simple type</title>
- * <programlisting>
- * static void my_device_finalize(Object *obj);
- * static void my_device_class_init(ObjectClass *oc, void *data);
- * static void my_device_init(Object *obj);
- *
- * static const TypeInfo my_device_info = {
- * .parent = TYPE_DEVICE,
- * .name = TYPE_MY_DEVICE,
- * .instance_size = sizeof(MyDevice),
- * .instance_init = my_device_init,
- * .instance_finalize = my_device_finalize,
- * .class_size = sizeof(MyDeviceClass),
- * .class_init = my_device_class_init,
- * };
- *
- * static void
- * my_device_register_types(void)
- * {
- * type_register_static(&my_device_info);
- * }
- * type_init(my_device_register_types);
- * </programlisting>
- * </example>
- *
- * This is sufficient to get the type registered with the type
- * system, and the three standard methods now need to be implemented
- * along with any other logic required for the type.
- *
- * If the type needs to implement one or more interfaces, then the
- * OBJECT_DEFINE_TYPE_WITH_INTERFACES() macro can be used instead.
- * This accepts an array of interface type names.
- *
- * <example>
- * <title>Defining a simple type implementing interfaces</title>
- * <programlisting>
- * OBJECT_DEFINE_TYPE_WITH_INTERFACES(MyDevice, my_device,
- * MY_DEVICE, DEVICE,
- * { TYPE_USER_CREATABLE }, { NULL })
- * </programlisting>
- * </example>
- *
- * If the type is not intended to be instantiated, then then
- * the OBJECT_DEFINE_ABSTRACT_TYPE() macro can be used instead:
- *
- * <example>
- * <title>Defining a simple type</title>
- * <programlisting>
- * OBJECT_DEFINE_ABSTRACT_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE)
- * </programlisting>
- * </example>
- */
-
-
typedef struct ObjectProperty ObjectProperty;
/**
@@ -520,7 +127,7 @@ typedef void (ObjectFree)(void *obj);
*/
struct ObjectClass
{
- /*< private >*/
+ /* private: */
Type type;
GSList *interfaces;
@@ -546,7 +153,7 @@ struct ObjectClass
*/
struct Object
{
- /*< private >*/
+ /* private: */
ObjectClass *class;
ObjectFree *free;
GHashTable *properties;
@@ -908,7 +515,7 @@ struct InterfaceInfo {
struct InterfaceClass
{
ObjectClass parent_class;
- /*< private >*/
+ /* private: */
ObjectClass *concrete_class;
Type interface_type;
};
@@ -980,27 +587,25 @@ Object *object_new(const char *typename);
* object will be marked complete once all the properties have been
* processed.
*
- * <example>
- * <title>Creating an object with properties</title>
- * <programlisting>
- * Error *err = NULL;
- * Object *obj;
- *
- * obj = object_new_with_props(TYPE_MEMORY_BACKEND_FILE,
- * object_get_objects_root(),
- * "hostmem0",
- * &err,
- * "share", "yes",
- * "mem-path", "/dev/shm/somefile",
- * "prealloc", "yes",
- * "size", "1048576",
- * NULL);
- *
- * if (!obj) {
- * error_reportf_err(err, "Cannot create memory backend: ");
- * }
- * </programlisting>
- * </example>
+ * .. code-block:: c
+ * :caption: Creating an object with properties
+ *
+ * Error *err = NULL;
+ * Object *obj;
+ *
+ * obj = object_new_with_props(TYPE_MEMORY_BACKEND_FILE,
+ * object_get_objects_root(),
+ * "hostmem0",
+ * &err,
+ * "share", "yes",
+ * "mem-path", "/dev/shm/somefile",
+ * "prealloc", "yes",
+ * "size", "1048576",
+ * NULL);
+ *
+ * if (!obj) {
+ * error_reportf_err(err, "Cannot create memory backend: ");
+ * }
*
* The returned object will have one stable reference maintained
* for as long as it is present in the object hierarchy.
@@ -1049,23 +654,21 @@ void object_apply_compat_props(Object *obj);
* strings. The propname of %NULL indicates the end of the property
* list.
*
- * <example>
- * <title>Update an object's properties</title>
- * <programlisting>
- * Error *err = NULL;
- * Object *obj = ...get / create object...;
- *
- * if (!object_set_props(obj,
- * &err,
- * "share", "yes",
- * "mem-path", "/dev/shm/somefile",
- * "prealloc", "yes",
- * "size", "1048576",
- * NULL)) {
- * error_reportf_err(err, "Cannot set properties: ");
- * }
- * </programlisting>
- * </example>
+ * .. code-block:: c
+ * :caption: Update an object's properties
+ *
+ * Error *err = NULL;
+ * Object *obj = ...get / create object...;
+ *
+ * if (!object_set_props(obj,
+ * &err,
+ * "share", "yes",
+ * "mem-path", "/dev/shm/somefile",
+ * "prealloc", "yes",
+ * "size", "1048576",
+ * NULL)) {
+ * error_reportf_err(err, "Cannot set properties: ");
+ * }
*
* The returned object will have one stable reference maintained
* for as long as it is present in the object hierarchy.
@@ -1153,10 +756,11 @@ bool object_initialize_child_with_propsv(Object *parentobj,
* object.
* @type: The name of the type of the object to instantiate.
*
- * This is like
- * object_initialize_child_with_props(parent, propname,
- * child, sizeof(*child), type,
- * &error_abort, NULL)
+ * This is like::
+ *
+ * object_initialize_child_with_props(parent, propname,
+ * child, sizeof(*child), type,
+ * &error_abort, NULL)
*/
#define object_initialize_child(parent, propname, child, type) \
object_initialize_child_internal((parent), (propname), \
@@ -1179,6 +783,11 @@ Object *object_dynamic_cast(Object *obj, const char *typename);
/**
* object_dynamic_cast_assert:
+ * @obj: The object to cast.
+ * @typename: The @typename to cast to.
+ * @file: Source code file where function was called
+ * @line: Source code line where function was called
+ * @func: Name of function where this function was called
*
* See object_dynamic_cast() for a description of the parameters of this
* function. The only difference in behavior is that this function asserts
@@ -1255,6 +864,9 @@ type_init(do_qemu_init_ ## type_array)
* object_class_dynamic_cast_assert:
* @klass: The #ObjectClass to attempt to cast.
* @typename: The QOM typename of the class to cast to.
+ * @file: Source code file where function was called
+ * @line: Source code line where function was called
+ * @func: Name of function where this function was called
*
* See object_class_dynamic_cast() for a description of the parameters
* of this function. The only difference in behavior is that this function
@@ -1406,6 +1018,23 @@ ObjectProperty *object_property_try_add(Object *obj, const char *name,
* object_property_add:
* Same as object_property_try_add() with @errp hardcoded to
* &error_abort.
+ *
+ * @obj: the object to add a property to
+ * @name: the name of the property. This can contain any character except for
+ * a forward slash. In general, you should use hyphens '-' instead of
+ * underscores '_' when naming properties.
+ * @type: the type name of the property. This namespace is pretty loosely
+ * defined. Sub namespaces are constructed by using a prefix and then
+ * to angle brackets. For instance, the type 'virtio-net-pci' in the
+ * 'link' namespace would be 'link<virtio-net-pci>'.
+ * @get: The getter to be called to read a property. If this is NULL, then
+ * the property cannot be read.
+ * @set: the setter to be called to write a property. If this is NULL,
+ * then the property cannot be written.
+ * @release: called when the property is removed from the object. This is
+ * meant to allow a property to free its opaque upon object
+ * destruction. This may be NULL.
+ * @opaque: an opaque pointer to pass to the callbacks for the property
*/
ObjectProperty *object_property_add(Object *obj, const char *name,
const char *type,
@@ -1517,6 +1146,7 @@ typedef struct ObjectPropertyIterator {
/**
* object_property_iter_init:
+ * @iter: the iterator instance
* @obj: the object
*
* Initializes an iterator for traversing all properties
@@ -1527,24 +1157,23 @@ typedef struct ObjectPropertyIterator {
*
* Typical usage pattern would be
*
- * <example>
- * <title>Using object property iterators</title>
- * <programlisting>
- * ObjectProperty *prop;
- * ObjectPropertyIterator iter;
+ * .. code-block:: c
+ * :caption: Using object property iterators
*
- * object_property_iter_init(&iter, obj);
- * while ((prop = object_property_iter_next(&iter))) {
- * ... do something with prop ...
- * }
- * </programlisting>
- * </example>
+ * ObjectProperty *prop;
+ * ObjectPropertyIterator iter;
+ *
+ * object_property_iter_init(&iter, obj);
+ * while ((prop = object_property_iter_next(&iter))) {
+ * ... do something with prop ...
+ * }
*/
void object_property_iter_init(ObjectPropertyIterator *iter,
Object *obj);
/**
* object_class_property_iter_init:
+ * @iter: the iterator instance
* @klass: the class
*
* Initializes an iterator for traversing all properties
@@ -1592,6 +1221,7 @@ bool object_property_get(Object *obj, const char *name, Visitor *v,
/**
* object_property_set_str:
+ * @obj: the object
* @name: the name of the property
* @value: the value to be written to the property
* @errp: returns an error if this function fails
@@ -1618,6 +1248,7 @@ char *object_property_get_str(Object *obj, const char *name,
/**
* object_property_set_link:
+ * @obj: the object
* @name: the name of the property
* @value: the value to be written to the property
* @errp: returns an error if this function fails
@@ -1648,6 +1279,7 @@ Object *object_property_get_link(Object *obj, const char *name,
/**
* object_property_set_bool:
+ * @obj: the object
* @name: the name of the property
* @value: the value to be written to the property
* @errp: returns an error if this function fails
@@ -1673,6 +1305,7 @@ bool object_property_get_bool(Object *obj, const char *name,
/**
* object_property_set_int:
+ * @obj: the object
* @name: the name of the property
* @value: the value to be written to the property
* @errp: returns an error if this function fails
@@ -1698,6 +1331,7 @@ int64_t object_property_get_int(Object *obj, const char *name,
/**
* object_property_set_uint:
+ * @obj: the object
* @name: the name of the property
* @value: the value to be written to the property
* @errp: returns an error if this function fails
@@ -1821,6 +1455,7 @@ Object *object_get_internal_root(void);
/**
* object_get_canonical_path_component:
+ * @obj: the object
*
* Returns: The final component in the object's canonical path. The canonical
* path is the path within the composition tree starting from the root.
@@ -1830,6 +1465,7 @@ const char *object_get_canonical_path_component(const Object *obj);
/**
* object_get_canonical_path:
+ * @obj: the object
*
* Returns: The canonical path for a object, newly allocated. This is
* the path within the composition tree starting from the root. Use
@@ -1919,6 +1555,10 @@ ObjectProperty *object_property_try_add_child(Object *obj, const char *name,
/**
* object_property_add_child:
+ * @obj: the object to add a property to
+ * @name: the name of the property
+ * @child: the child object
+ *
* Same as object_property_try_add_child() with @errp hardcoded to
* &error_abort
*/
@@ -1936,13 +1576,17 @@ typedef enum {
/**
* object_property_allow_set_link:
+ * @obj: the object to add a property to
+ * @name: the name of the property
+ * @child: the child object
+ * @errp: pointer to error object
*
* The default implementation of the object_property_add_link() check()
* callback function. It allows the link property to be set and never returns
* an error.
*/
-void object_property_allow_set_link(const Object *, const char *,
- Object *, Error **);
+void object_property_allow_set_link(const Object *obj, const char *name,
+ Object *child, Error **errp);
/**
* object_property_add_link:
@@ -2036,6 +1680,7 @@ ObjectProperty *object_class_property_add_bool(ObjectClass *klass,
* @obj: the object to add a property to
* @name: the name of the property
* @typename: the name of the enum data type
+ * @lookup: enum value namelookup table
* @get: the getter or %NULL if the property is write-only.
* @set: the setter or %NULL if the property is read-only
*
diff --git a/include/scsi/constants.h b/include/scsi/constants.h
index 874176019e..2a32c08b5e 100644
--- a/include/scsi/constants.h
+++ b/include/scsi/constants.h
@@ -218,6 +218,7 @@
#define TYPE_ENCLOSURE 0x0d /* Enclosure Services Device */
#define TYPE_RBC 0x0e /* Simplified Direct-Access Device */
#define TYPE_OSD 0x11 /* Object-storage Device */
+#define TYPE_ZBC 0x14 /* Host-managed Zoned SCSI Device */
#define TYPE_WLUN 0x1e /* Well known LUN */
#define TYPE_NOT_PRESENT 0x1f
#define TYPE_INACTIVE 0x20
diff --git a/include/sysemu/numa.h b/include/sysemu/numa.h
index ad58ee88f7..4173ef2afa 100644
--- a/include/sysemu/numa.h
+++ b/include/sysemu/numa.h
@@ -106,10 +106,6 @@ void parse_numa_hmat_cache(MachineState *ms, NumaHmatCacheOptions *node,
void numa_complete_configuration(MachineState *ms);
void query_numa_node_mem(NumaNodeMem node_mem[], MachineState *ms);
extern QemuOptsList qemu_numa_opts;
-void numa_legacy_auto_assign_ram(MachineClass *mc, NodeInfo *nodes,
- int nb_nodes, ram_addr_t size);
-void numa_default_auto_assign_ram(MachineClass *mc, NodeInfo *nodes,
- int nb_nodes, ram_addr_t size);
void numa_cpu_pre_plug(const struct CPUArchId *slot, DeviceState *dev,
Error **errp);
bool numa_uses_legacy_mem(void);
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 4b6a5c459c..817ff4cf75 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -14,7 +14,7 @@ extern const char *qemu_name;
extern QemuUUID qemu_uuid;
extern bool qemu_uuid_set;
-void qemu_add_data_dir(const char *path);
+void qemu_add_data_dir(char *path);
void qemu_add_exit_notifier(Notifier *notify);
void qemu_remove_exit_notifier(Notifier *notify);
diff --git a/include/sysemu/xen.h b/include/sysemu/xen.h
index 2c2c429ea8..0ca25697e4 100644
--- a/include/sysemu/xen.h
+++ b/include/sysemu/xen.h
@@ -8,6 +8,8 @@
#ifndef SYSEMU_XEN_H
#define SYSEMU_XEN_H
+#include "exec/cpu-common.h"
+
#ifdef NEED_CPU_H
# ifdef CONFIG_XEN
# define CONFIG_XEN_IS_POSSIBLE