Machine queue, 2020-12-23
Cleanup: * qdev code cleanup (Eduardo Habkost) Bug fix: * hostmem: Free host_nodes list right after visited (Keqian Zhu) -----BEGIN PGP SIGNATURE----- iQJIBAABCAAyFiEEWjIv1avE09usz9GqKAeTb5hNxaYFAl/jteYUHGVoYWJrb3N0 QHJlZGhhdC5jb20ACgkQKAeTb5hNxaZUHw//c40nRlYdGSV5j6w3ZCSlmZRFxZTU UiLK51Z3hI9Q9kyLcoIQitEYlQTIbgp0qlIJ6evDd/HvQvZ+P4P0Lzm1UGOZhD0h nJk5+bBkP/mzMh0P9oiN20DSLk6a3Wvdiu/bQR8gm/WdLvTM1Zjek1ns5tL06ZvA MziG6gIypgScu2FeNxD0zC8sDO16oVrzKq7mjZcQe6XYFRsJmYjZw84v+uu/Bdf7 MBxolkA8vYwwBJNdVsAf7I0Gw3BeArgPUOwbWyt8/tuGIOZxYjdKIj55S7j2fuju 524sg8Di+YzxmLZaNAGksEBMj9uY39nwdHGhNElMtWCM9oOPumlps9eyLtpTagfM wmiVrMGWVlXV6c4kZo8R2NSF8hcDr02S7eyrUpITrh09p4nT6fBGG2ufEYiCyNao o9ZqMf7NUO5J60zM5EOfdGxpaN2O0M5pXCCN48NtmqvO0wIAfTc9l/OkCrrfVbEO Q/X1jqbj6ZcilSIl9OeLAPi7Xjx26jMeeLPUQtoZnkqDvpk/Vz6Ka1RgGG86QA5z 2W/KCAoVrg6dO4f9vY3x84rf0Ta5kJtp2LezPgG8d++4bMSf2jN00wYvAQuCyqqW zbm8f57YST3vm8XMHPlmtnlKfiLI4wbVUmrDYu3rNI+JgdvhdXseGoErt15ejAcL B5IH2SK4AwMpSsk= =bnjc -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/ehabkost-gl/tags/machine-next-pull-request' into staging Machine queue, 2020-12-23 Cleanup: * qdev code cleanup (Eduardo Habkost) Bug fix: * hostmem: Free host_nodes list right after visited (Keqian Zhu) # gpg: Signature made Wed 23 Dec 2020 21:25:58 GMT # 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-gl/tags/machine-next-pull-request: bugfix: hostmem: Free host_nodes list right after visited qdev: Avoid unnecessary DeviceState* variable at set_prop_arraylen() qdev: Rename qdev_get_prop_ptr() to object_field_prop_ptr() qdev: Move qdev_prop_tpm declaration to tpm_prop.h qdev: Make qdev_class_add_property() more flexible qdev: Make PropertyInfo.create return ObjectProperty* qdev: Move dev->realized check to qdev_property_set() qdev: Wrap getters and setters in separate helpers qdev: Add name argument to PropertyInfo.create method qdev: Add name parameter to qdev_class_add_property() qdev: Avoid using prop->name unnecessarily qdev: Get just property name at error_set_from_qdev_prop_error() sparc: Use DEFINE_PROP for nwindows property qdev: Reuse DEFINE_PROP in all DEFINE_PROP_* macros qdev: Move softmmu properties to qdev-properties-system.h Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
41192db338
|
@ -28,6 +28,7 @@
|
||||||
#include "qemu/queue.h"
|
#include "qemu/queue.h"
|
||||||
#include "qapi/qapi-types-audio.h"
|
#include "qapi/qapi-types-audio.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
|
|
||||||
typedef void (*audio_callback_fn) (void *opaque, int avail);
|
typedef void (*audio_callback_fn) (void *opaque, int avail);
|
||||||
|
|
||||||
|
|
|
@ -105,6 +105,7 @@ host_memory_backend_get_host_nodes(Object *obj, Visitor *v, const char *name,
|
||||||
|
|
||||||
ret:
|
ret:
|
||||||
visit_type_uint16List(v, name, &host_nodes, errp);
|
visit_type_uint16List(v, name, &host_nodes, errp);
|
||||||
|
qapi_free_uint16List(host_nodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
static void get_tpm(Object *obj, Visitor *v, const char *name, void *opaque,
|
static void get_tpm(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
TPMBackend **be = qdev_get_prop_ptr(obj, opaque);
|
TPMBackend **be = object_field_prop_ptr(obj, opaque);
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
p = g_strdup(*be ? (*be)->id : "");
|
p = g_strdup(*be ? (*be)->id : "");
|
||||||
|
@ -46,16 +46,10 @@ static void get_tpm(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||||
static void set_tpm(Object *obj, Visitor *v, const char *name, void *opaque,
|
static void set_tpm(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(obj);
|
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
TPMBackend *s, **be = qdev_get_prop_ptr(obj, prop);
|
TPMBackend *s, **be = object_field_prop_ptr(obj, prop);
|
||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
if (dev->realized) {
|
|
||||||
qdev_prop_set_after_realize(dev, name, errp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!visit_type_str(v, name, &str, errp)) {
|
if (!visit_type_str(v, name, &str, errp)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -63,7 +57,7 @@ static void set_tpm(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||||
s = qemu_find_tpm_be(str);
|
s = qemu_find_tpm_be(str);
|
||||||
if (s == NULL) {
|
if (s == NULL) {
|
||||||
error_setg(errp, "Property '%s.%s' can't find value '%s'",
|
error_setg(errp, "Property '%s.%s' can't find value '%s'",
|
||||||
object_get_typename(obj), prop->name, str);
|
object_get_typename(obj), name, str);
|
||||||
} else if (tpm_backend_init(s, TPM_IF(obj), errp) == 0) {
|
} else if (tpm_backend_init(s, TPM_IF(obj), errp) == 0) {
|
||||||
*be = s; /* weak reference, avoid cyclic ref */
|
*be = s; /* weak reference, avoid cyclic ref */
|
||||||
}
|
}
|
||||||
|
@ -73,7 +67,7 @@ static void set_tpm(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||||
static void release_tpm(Object *obj, const char *name, void *opaque)
|
static void release_tpm(Object *obj, const char *name, void *opaque)
|
||||||
{
|
{
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
TPMBackend **be = qdev_get_prop_ptr(obj, prop);
|
TPMBackend **be = object_field_prop_ptr(obj, prop);
|
||||||
|
|
||||||
if (*be) {
|
if (*be) {
|
||||||
tpm_backend_reset(*be);
|
tpm_backend_reset(*be);
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "hw/acpi/vmgenid.h"
|
#include "hw/acpi/vmgenid.h"
|
||||||
#include "hw/nvram/fw_cfg.h"
|
#include "hw/nvram/fw_cfg.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "migration/vmstate.h"
|
#include "migration/vmstate.h"
|
||||||
#include "sysemu/reset.h"
|
#include "sysemu/reset.h"
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "hw/i2c/i2c.h"
|
#include "hw/i2c/i2c.h"
|
||||||
#include "hw/irq.h"
|
#include "hw/irq.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "hw/ssi/ssi.h"
|
#include "hw/ssi/ssi.h"
|
||||||
#include "hw/sd/sd.h"
|
#include "hw/sd/sd.h"
|
||||||
#include "chardev/char-fe.h"
|
#include "chardev/char-fe.h"
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include "hw/boards.h"
|
#include "hw/boards.h"
|
||||||
#include "hw/irq.h"
|
#include "hw/irq.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "hw/sysbus.h"
|
#include "hw/sysbus.h"
|
||||||
#include "migration/vmstate.h"
|
#include "migration/vmstate.h"
|
||||||
#include "strongarm.h"
|
#include "strongarm.h"
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include "hw/irq.h"
|
#include "hw/irq.h"
|
||||||
#include "hw/isa/isa.h"
|
#include "hw/isa/isa.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "hw/sysbus.h"
|
#include "hw/sysbus.h"
|
||||||
#include "migration/vmstate.h"
|
#include "migration/vmstate.h"
|
||||||
#include "hw/block/block.h"
|
#include "hw/block/block.h"
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "qemu/units.h"
|
#include "qemu/units.h"
|
||||||
#include "sysemu/block-backend.h"
|
#include "sysemu/block-backend.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "hw/ssi/ssi.h"
|
#include "hw/ssi/ssi.h"
|
||||||
#include "migration/vmstate.h"
|
#include "migration/vmstate.h"
|
||||||
#include "qemu/bitops.h"
|
#include "qemu/bitops.h"
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "hw/hw.h"
|
#include "hw/hw.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "hw/block/flash.h"
|
#include "hw/block/flash.h"
|
||||||
#include "sysemu/block-backend.h"
|
#include "sysemu/block-backend.h"
|
||||||
#include "migration/vmstate.h"
|
#include "migration/vmstate.h"
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "hw/block/flash.h"
|
#include "hw/block/flash.h"
|
||||||
#include "hw/irq.h"
|
#include "hw/irq.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "sysemu/block-backend.h"
|
#include "sysemu/block-backend.h"
|
||||||
#include "exec/memory.h"
|
#include "exec/memory.h"
|
||||||
#include "hw/sysbus.h"
|
#include "hw/sysbus.h"
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include "hw/block/block.h"
|
#include "hw/block/block.h"
|
||||||
#include "hw/block/flash.h"
|
#include "hw/block/flash.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "sysemu/block-backend.h"
|
#include "sysemu/block-backend.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include "hw/block/block.h"
|
#include "hw/block/block.h"
|
||||||
#include "hw/block/flash.h"
|
#include "hw/block/flash.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
#include "qemu/bitmap.h"
|
#include "qemu/bitmap.h"
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "qemu/cutils.h"
|
#include "qemu/cutils.h"
|
||||||
#include "hw/qdev-core.h"
|
#include "hw/qdev-core.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "hw/virtio/vhost.h"
|
#include "hw/virtio/vhost.h"
|
||||||
#include "hw/virtio/vhost-user-blk.h"
|
#include "hw/virtio/vhost-user-blk.h"
|
||||||
#include "hw/virtio/virtio.h"
|
#include "hw/virtio/virtio.h"
|
||||||
|
|
|
@ -336,7 +336,7 @@ static void xen_block_get_vdev(Object *obj, Visitor *v, const char *name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
XenBlockVdev *vdev = qdev_get_prop_ptr(obj, prop);
|
XenBlockVdev *vdev = object_field_prop_ptr(obj, prop);
|
||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
switch (vdev->type) {
|
switch (vdev->type) {
|
||||||
|
@ -395,17 +395,11 @@ static int vbd_name_to_disk(const char *name, const char **endp,
|
||||||
static void xen_block_set_vdev(Object *obj, Visitor *v, const char *name,
|
static void xen_block_set_vdev(Object *obj, Visitor *v, const char *name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(obj);
|
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
XenBlockVdev *vdev = qdev_get_prop_ptr(obj, prop);
|
XenBlockVdev *vdev = object_field_prop_ptr(obj, prop);
|
||||||
char *str, *p;
|
char *str, *p;
|
||||||
const char *end;
|
const char *end;
|
||||||
|
|
||||||
if (dev->realized) {
|
|
||||||
qdev_prop_set_after_realize(dev, name, errp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!visit_type_str(v, name, &str, errp)) {
|
if (!visit_type_str(v, name, &str, errp)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "qemu/log.h"
|
#include "qemu/log.h"
|
||||||
#include "hw/irq.h"
|
#include "hw/irq.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
|
|
||||||
static int avr_usart_can_receive(void *opaque)
|
static int avr_usart_can_receive(void *opaque)
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "hw/char/bcm2835_aux.h"
|
#include "hw/char/bcm2835_aux.h"
|
||||||
#include "hw/irq.h"
|
#include "hw/irq.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "migration/vmstate.h"
|
#include "migration/vmstate.h"
|
||||||
#include "qemu/log.h"
|
#include "qemu/log.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include "hw/char/cadence_uart.h"
|
#include "hw/char/cadence_uart.h"
|
||||||
#include "hw/irq.h"
|
#include "hw/irq.h"
|
||||||
#include "hw/qdev-clock.h"
|
#include "hw/qdev-clock.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|
||||||
#ifdef CADENCE_UART_ERR_DEBUG
|
#ifdef CADENCE_UART_ERR_DEBUG
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "chardev/char-serial.h"
|
#include "chardev/char-serial.h"
|
||||||
#include "hw/char/cmsdk-apb-uart.h"
|
#include "hw/char/cmsdk-apb-uart.h"
|
||||||
#include "hw/irq.h"
|
#include "hw/irq.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
|
|
||||||
REG32(DATA, 0)
|
REG32(DATA, 0)
|
||||||
REG32(STATE, 4)
|
REG32(STATE, 4)
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "chardev/char-fe.h"
|
#include "chardev/char-fe.h"
|
||||||
#include "hw/isa/isa.h"
|
#include "hw/isa/isa.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "qom/object.h"
|
#include "qom/object.h"
|
||||||
|
|
||||||
#define TYPE_ISA_DEBUGCON_DEVICE "isa-debugcon"
|
#define TYPE_ISA_DEBUGCON_DEVICE "isa-debugcon"
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
|
|
||||||
#include "hw/char/digic-uart.h"
|
#include "hw/char/digic-uart.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
ST_RX_RDY = (1 << 0),
|
ST_RX_RDY = (1 << 0),
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "hw/irq.h"
|
#include "hw/irq.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "hw/sysbus.h"
|
#include "hw/sysbus.h"
|
||||||
#include "migration/vmstate.h"
|
#include "migration/vmstate.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "hw/irq.h"
|
#include "hw/irq.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "hw/sysbus.h"
|
#include "hw/sysbus.h"
|
||||||
#include "chardev/char-fe.h"
|
#include "chardev/char-fe.h"
|
||||||
#include "qemu/log.h"
|
#include "qemu/log.h"
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include "hw/arm/exynos4210.h"
|
#include "hw/arm/exynos4210.h"
|
||||||
#include "hw/irq.h"
|
#include "hw/irq.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
|
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "qom/object.h"
|
#include "qom/object.h"
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "hw/irq.h"
|
#include "hw/irq.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "hw/sparc/grlib.h"
|
#include "hw/sparc/grlib.h"
|
||||||
#include "hw/sysbus.h"
|
#include "hw/sysbus.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "hw/irq.h"
|
#include "hw/irq.h"
|
||||||
#include "hw/qdev-clock.h"
|
#include "hw/qdev-clock.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "migration/vmstate.h"
|
#include "migration/vmstate.h"
|
||||||
#include "qemu/log.h"
|
#include "qemu/log.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "hw/char/imx_serial.h"
|
#include "hw/char/imx_serial.h"
|
||||||
#include "hw/irq.h"
|
#include "hw/irq.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "migration/vmstate.h"
|
#include "migration/vmstate.h"
|
||||||
#include "qemu/log.h"
|
#include "qemu/log.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "hw/ipack/ipack.h"
|
#include "hw/ipack/ipack.h"
|
||||||
#include "hw/irq.h"
|
#include "hw/irq.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "migration/vmstate.h"
|
#include "migration/vmstate.h"
|
||||||
#include "qemu/bitops.h"
|
#include "qemu/bitops.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
#include "hw/char/lm32_juart.h"
|
#include "hw/char/lm32_juart.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "qom/object.h"
|
#include "qom/object.h"
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "hw/irq.h"
|
#include "hw/irq.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "hw/sysbus.h"
|
#include "hw/sysbus.h"
|
||||||
#include "migration/vmstate.h"
|
#include "migration/vmstate.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "hw/m68k/mcf.h"
|
#include "hw/m68k/mcf.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "chardev/char-fe.h"
|
#include "chardev/char-fe.h"
|
||||||
#include "qom/object.h"
|
#include "qom/object.h"
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "hw/irq.h"
|
#include "hw/irq.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "hw/sysbus.h"
|
#include "hw/sysbus.h"
|
||||||
#include "migration/vmstate.h"
|
#include "migration/vmstate.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "hw/char/nrf51_uart.h"
|
#include "hw/char/nrf51_uart.h"
|
||||||
#include "hw/irq.h"
|
#include "hw/irq.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "migration/vmstate.h"
|
#include "migration/vmstate.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include "hw/irq.h"
|
#include "hw/irq.h"
|
||||||
#include "hw/isa/isa.h"
|
#include "hw/isa/isa.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "migration/vmstate.h"
|
#include "migration/vmstate.h"
|
||||||
#include "hw/char/parallel.h"
|
#include "hw/char/parallel.h"
|
||||||
#include "sysemu/reset.h"
|
#include "sysemu/reset.h"
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "hw/irq.h"
|
#include "hw/irq.h"
|
||||||
#include "hw/sysbus.h"
|
#include "hw/sysbus.h"
|
||||||
#include "hw/qdev-clock.h"
|
#include "hw/qdev-clock.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "migration/vmstate.h"
|
#include "migration/vmstate.h"
|
||||||
#include "chardev/char-fe.h"
|
#include "chardev/char-fe.h"
|
||||||
#include "qemu/log.h"
|
#include "qemu/log.h"
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "hw/irq.h"
|
#include "hw/irq.h"
|
||||||
#include "hw/registerfields.h"
|
#include "hw/registerfields.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "hw/char/renesas_sci.h"
|
#include "hw/char/renesas_sci.h"
|
||||||
#include "migration/vmstate.h"
|
#include "migration/vmstate.h"
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "migration/vmstate.h"
|
#include "migration/vmstate.h"
|
||||||
#include "hw/s390x/event-facility.h"
|
#include "hw/s390x/event-facility.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "hw/s390x/ebcdic.h"
|
#include "hw/s390x/ebcdic.h"
|
||||||
#include "qom/object.h"
|
#include "qom/object.h"
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "hw/s390x/sclp.h"
|
#include "hw/s390x/sclp.h"
|
||||||
#include "migration/vmstate.h"
|
#include "migration/vmstate.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "hw/s390x/event-facility.h"
|
#include "hw/s390x/event-facility.h"
|
||||||
#include "chardev/char-fe.h"
|
#include "chardev/char-fe.h"
|
||||||
#include "qom/object.h"
|
#include "qom/object.h"
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include "hw/irq.h"
|
#include "hw/irq.h"
|
||||||
#include "hw/pci/pci.h"
|
#include "hw/pci/pci.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "migration/vmstate.h"
|
#include "migration/vmstate.h"
|
||||||
|
|
||||||
#define PCI_SERIAL_MAX_PORTS 4
|
#define PCI_SERIAL_MAX_PORTS 4
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
|
|
||||||
#define UART_LCR_DLAB 0x80 /* Divisor latch access bit */
|
#define UART_LCR_DLAB 0x80 /* Divisor latch access bit */
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "hw/ppc/spapr.h"
|
#include "hw/ppc/spapr.h"
|
||||||
#include "hw/ppc/spapr_vio.h"
|
#include "hw/ppc/spapr_vio.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "qom/object.h"
|
#include "qom/object.h"
|
||||||
|
|
||||||
#define VTERM_BUFSIZE 16
|
#define VTERM_BUFSIZE 16
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "hw/char/stm32f2xx_usart.h"
|
#include "hw/char/stm32f2xx_usart.h"
|
||||||
#include "hw/irq.h"
|
#include "hw/irq.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "qemu/log.h"
|
#include "qemu/log.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
#include "chardev/char-fe.h"
|
#include "chardev/char-fe.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "hw/s390x/3270-ccw.h"
|
#include "hw/s390x/3270-ccw.h"
|
||||||
#include "qom/object.h"
|
#include "qom/object.h"
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "hw/virtio/virtio-serial.h"
|
#include "hw/virtio/virtio-serial.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "qapi/qapi-events-char.h"
|
#include "qapi/qapi-events-char.h"
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "qemu/log.h"
|
#include "qemu/log.h"
|
||||||
#include "hw/irq.h"
|
#include "hw/irq.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "hw/sysbus.h"
|
#include "hw/sysbus.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
#include "chardev/char-fe.h"
|
#include "chardev/char-fe.h"
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "qapi/visitor.h"
|
#include "qapi/visitor.h"
|
||||||
#include "qapi/qapi-types-block.h"
|
#include "qapi/qapi-types-block.h"
|
||||||
|
@ -61,7 +62,7 @@ static void get_drive(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
void **ptr = qdev_get_prop_ptr(obj, prop);
|
void **ptr = object_field_prop_ptr(obj, prop);
|
||||||
const char *value;
|
const char *value;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
|
@ -87,17 +88,12 @@ static void set_drive_helper(Object *obj, Visitor *v, const char *name,
|
||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(obj);
|
DeviceState *dev = DEVICE(obj);
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
void **ptr = qdev_get_prop_ptr(obj, prop);
|
void **ptr = object_field_prop_ptr(obj, prop);
|
||||||
char *str;
|
char *str;
|
||||||
BlockBackend *blk;
|
BlockBackend *blk;
|
||||||
bool blk_created = false;
|
bool blk_created = false;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (dev->realized) {
|
|
||||||
qdev_prop_set_after_realize(dev, name, errp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!visit_type_str(v, name, &str, errp)) {
|
if (!visit_type_str(v, name, &str, errp)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -140,7 +136,7 @@ static void set_drive_helper(Object *obj, Visitor *v, const char *name,
|
||||||
}
|
}
|
||||||
if (!blk) {
|
if (!blk) {
|
||||||
error_setg(errp, "Property '%s.%s' can't find value '%s'",
|
error_setg(errp, "Property '%s.%s' can't find value '%s'",
|
||||||
object_get_typename(OBJECT(dev)), prop->name, str);
|
object_get_typename(OBJECT(dev)), name, str);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
if (blk_attach_dev(blk, dev) < 0) {
|
if (blk_attach_dev(blk, dev) < 0) {
|
||||||
|
@ -185,7 +181,7 @@ static void release_drive(Object *obj, const char *name, void *opaque)
|
||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(obj);
|
DeviceState *dev = DEVICE(obj);
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
BlockBackend **ptr = qdev_get_prop_ptr(obj, prop);
|
BlockBackend **ptr = object_field_prop_ptr(obj, prop);
|
||||||
|
|
||||||
if (*ptr) {
|
if (*ptr) {
|
||||||
AioContext *ctx = blk_get_aio_context(*ptr);
|
AioContext *ctx = blk_get_aio_context(*ptr);
|
||||||
|
@ -218,7 +214,7 @@ const PropertyInfo qdev_prop_drive_iothread = {
|
||||||
static void get_chr(Object *obj, Visitor *v, const char *name, void *opaque,
|
static void get_chr(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
CharBackend *be = qdev_get_prop_ptr(obj, opaque);
|
CharBackend *be = object_field_prop_ptr(obj, opaque);
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
p = g_strdup(be->chr && be->chr->label ? be->chr->label : "");
|
p = g_strdup(be->chr && be->chr->label ? be->chr->label : "");
|
||||||
|
@ -229,17 +225,11 @@ static void get_chr(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||||
static void set_chr(Object *obj, Visitor *v, const char *name, void *opaque,
|
static void set_chr(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(obj);
|
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
CharBackend *be = qdev_get_prop_ptr(obj, prop);
|
CharBackend *be = object_field_prop_ptr(obj, prop);
|
||||||
Chardev *s;
|
Chardev *s;
|
||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
if (dev->realized) {
|
|
||||||
qdev_prop_set_after_realize(dev, name, errp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!visit_type_str(v, name, &str, errp)) {
|
if (!visit_type_str(v, name, &str, errp)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -261,10 +251,10 @@ static void set_chr(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||||
s = qemu_chr_find(str);
|
s = qemu_chr_find(str);
|
||||||
if (s == NULL) {
|
if (s == NULL) {
|
||||||
error_setg(errp, "Property '%s.%s' can't find value '%s'",
|
error_setg(errp, "Property '%s.%s' can't find value '%s'",
|
||||||
object_get_typename(obj), prop->name, str);
|
object_get_typename(obj), name, str);
|
||||||
} else if (!qemu_chr_fe_init(be, s, errp)) {
|
} else if (!qemu_chr_fe_init(be, s, errp)) {
|
||||||
error_prepend(errp, "Property '%s.%s' can't take value '%s': ",
|
error_prepend(errp, "Property '%s.%s' can't take value '%s': ",
|
||||||
object_get_typename(obj), prop->name, str);
|
object_get_typename(obj), name, str);
|
||||||
}
|
}
|
||||||
g_free(str);
|
g_free(str);
|
||||||
}
|
}
|
||||||
|
@ -272,7 +262,7 @@ static void set_chr(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||||
static void release_chr(Object *obj, const char *name, void *opaque)
|
static void release_chr(Object *obj, const char *name, void *opaque)
|
||||||
{
|
{
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
CharBackend *be = qdev_get_prop_ptr(obj, prop);
|
CharBackend *be = object_field_prop_ptr(obj, prop);
|
||||||
|
|
||||||
qemu_chr_fe_deinit(be, false);
|
qemu_chr_fe_deinit(be, false);
|
||||||
}
|
}
|
||||||
|
@ -296,7 +286,7 @@ static void get_mac(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
MACAddr *mac = qdev_get_prop_ptr(obj, prop);
|
MACAddr *mac = object_field_prop_ptr(obj, prop);
|
||||||
char buffer[2 * 6 + 5 + 1];
|
char buffer[2 * 6 + 5 + 1];
|
||||||
char *p = buffer;
|
char *p = buffer;
|
||||||
|
|
||||||
|
@ -310,18 +300,12 @@ static void get_mac(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||||
static void set_mac(Object *obj, Visitor *v, const char *name, void *opaque,
|
static void set_mac(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(obj);
|
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
MACAddr *mac = qdev_get_prop_ptr(obj, prop);
|
MACAddr *mac = object_field_prop_ptr(obj, prop);
|
||||||
int i, pos;
|
int i, pos;
|
||||||
char *str;
|
char *str;
|
||||||
const char *p;
|
const char *p;
|
||||||
|
|
||||||
if (dev->realized) {
|
|
||||||
qdev_prop_set_after_realize(dev, name, errp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!visit_type_str(v, name, &str, errp)) {
|
if (!visit_type_str(v, name, &str, errp)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -353,7 +337,7 @@ static void set_mac(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
inval:
|
inval:
|
||||||
error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str);
|
error_set_from_qdev_prop_error(errp, EINVAL, obj, name, str);
|
||||||
g_free(str);
|
g_free(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -379,7 +363,7 @@ static void get_netdev(Object *obj, Visitor *v, const char *name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
NICPeers *peers_ptr = qdev_get_prop_ptr(obj, prop);
|
NICPeers *peers_ptr = object_field_prop_ptr(obj, prop);
|
||||||
char *p = g_strdup(peers_ptr->ncs[0] ? peers_ptr->ncs[0]->name : "");
|
char *p = g_strdup(peers_ptr->ncs[0] ? peers_ptr->ncs[0]->name : "");
|
||||||
|
|
||||||
visit_type_str(v, name, &p, errp);
|
visit_type_str(v, name, &p, errp);
|
||||||
|
@ -389,19 +373,13 @@ static void get_netdev(Object *obj, Visitor *v, const char *name,
|
||||||
static void set_netdev(Object *obj, Visitor *v, const char *name,
|
static void set_netdev(Object *obj, Visitor *v, const char *name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(obj);
|
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
NICPeers *peers_ptr = qdev_get_prop_ptr(obj, prop);
|
NICPeers *peers_ptr = object_field_prop_ptr(obj, prop);
|
||||||
NetClientState **ncs = peers_ptr->ncs;
|
NetClientState **ncs = peers_ptr->ncs;
|
||||||
NetClientState *peers[MAX_QUEUE_NUM];
|
NetClientState *peers[MAX_QUEUE_NUM];
|
||||||
int queues, err = 0, i = 0;
|
int queues, err = 0, i = 0;
|
||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
if (dev->realized) {
|
|
||||||
qdev_prop_set_after_realize(dev, name, errp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!visit_type_str(v, name, &str, errp)) {
|
if (!visit_type_str(v, name, &str, errp)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -441,7 +419,7 @@ static void set_netdev(Object *obj, Visitor *v, const char *name,
|
||||||
peers_ptr->queues = queues;
|
peers_ptr->queues = queues;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
error_set_from_qdev_prop_error(errp, err, obj, prop, str);
|
error_set_from_qdev_prop_error(errp, err, obj, name, str);
|
||||||
g_free(str);
|
g_free(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -458,7 +436,7 @@ static void get_audiodev(Object *obj, Visitor *v, const char* name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
QEMUSoundCard *card = qdev_get_prop_ptr(obj, prop);
|
QEMUSoundCard *card = object_field_prop_ptr(obj, prop);
|
||||||
char *p = g_strdup(audio_get_id(card));
|
char *p = g_strdup(audio_get_id(card));
|
||||||
|
|
||||||
visit_type_str(v, name, &p, errp);
|
visit_type_str(v, name, &p, errp);
|
||||||
|
@ -468,18 +446,12 @@ static void get_audiodev(Object *obj, Visitor *v, const char* name,
|
||||||
static void set_audiodev(Object *obj, Visitor *v, const char* name,
|
static void set_audiodev(Object *obj, Visitor *v, const char* name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(obj);
|
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
QEMUSoundCard *card = qdev_get_prop_ptr(obj, prop);
|
QEMUSoundCard *card = object_field_prop_ptr(obj, prop);
|
||||||
AudioState *state;
|
AudioState *state;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
if (dev->realized) {
|
|
||||||
qdev_prop_set_after_realize(dev, name, errp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!visit_type_str(v, name, &str, errp)) {
|
if (!visit_type_str(v, name, &str, errp)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -493,7 +465,7 @@ static void set_audiodev(Object *obj, Visitor *v, const char* name,
|
||||||
card->state = state;
|
card->state = state;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
error_set_from_qdev_prop_error(errp, err, obj, prop, str);
|
error_set_from_qdev_prop_error(errp, err, obj, name, str);
|
||||||
g_free(str);
|
g_free(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -577,15 +549,10 @@ static void set_blocksize(Object *obj, Visitor *v, const char *name,
|
||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(obj);
|
DeviceState *dev = DEVICE(obj);
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
uint32_t *ptr = qdev_get_prop_ptr(obj, prop);
|
uint32_t *ptr = object_field_prop_ptr(obj, prop);
|
||||||
uint64_t value;
|
uint64_t value;
|
||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
|
|
||||||
if (dev->realized) {
|
|
||||||
qdev_prop_set_after_realize(dev, name, errp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!visit_type_size(v, name, &value, errp)) {
|
if (!visit_type_size(v, name, &value, errp)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -670,7 +637,7 @@ static void get_reserved_region(Object *obj, Visitor *v, const char *name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
ReservedRegion *rr = qdev_get_prop_ptr(obj, prop);
|
ReservedRegion *rr = object_field_prop_ptr(obj, prop);
|
||||||
char buffer[64];
|
char buffer[64];
|
||||||
char *p = buffer;
|
char *p = buffer;
|
||||||
int rc;
|
int rc;
|
||||||
|
@ -685,19 +652,13 @@ static void get_reserved_region(Object *obj, Visitor *v, const char *name,
|
||||||
static void set_reserved_region(Object *obj, Visitor *v, const char *name,
|
static void set_reserved_region(Object *obj, Visitor *v, const char *name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(obj);
|
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
ReservedRegion *rr = qdev_get_prop_ptr(obj, prop);
|
ReservedRegion *rr = object_field_prop_ptr(obj, prop);
|
||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
const char *endptr;
|
const char *endptr;
|
||||||
char *str;
|
char *str;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (dev->realized) {
|
|
||||||
qdev_prop_set_after_realize(dev, name, errp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
visit_type_str(v, name, &str, &local_err);
|
visit_type_str(v, name, &str, &local_err);
|
||||||
if (local_err) {
|
if (local_err) {
|
||||||
error_propagate(errp, local_err);
|
error_propagate(errp, local_err);
|
||||||
|
@ -753,17 +714,11 @@ const PropertyInfo qdev_prop_reserved_region = {
|
||||||
static void set_pci_devfn(Object *obj, Visitor *v, const char *name,
|
static void set_pci_devfn(Object *obj, Visitor *v, const char *name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(obj);
|
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
int32_t value, *ptr = qdev_get_prop_ptr(obj, prop);
|
int32_t value, *ptr = object_field_prop_ptr(obj, prop);
|
||||||
unsigned int slot, fn, n;
|
unsigned int slot, fn, n;
|
||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
if (dev->realized) {
|
|
||||||
qdev_prop_set_after_realize(dev, name, errp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!visit_type_str(v, name, &str, NULL)) {
|
if (!visit_type_str(v, name, &str, NULL)) {
|
||||||
if (!visit_type_int32(v, name, &value, errp)) {
|
if (!visit_type_int32(v, name, &value, errp)) {
|
||||||
return;
|
return;
|
||||||
|
@ -791,14 +746,14 @@ static void set_pci_devfn(Object *obj, Visitor *v, const char *name,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
invalid:
|
invalid:
|
||||||
error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str);
|
error_set_from_qdev_prop_error(errp, EINVAL, obj, name, str);
|
||||||
g_free(str);
|
g_free(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int print_pci_devfn(Object *obj, Property *prop, char *dest,
|
static int print_pci_devfn(Object *obj, Property *prop, char *dest,
|
||||||
size_t len)
|
size_t len)
|
||||||
{
|
{
|
||||||
int32_t *ptr = qdev_get_prop_ptr(obj, prop);
|
int32_t *ptr = object_field_prop_ptr(obj, prop);
|
||||||
|
|
||||||
if (*ptr == -1) {
|
if (*ptr == -1) {
|
||||||
return snprintf(dest, len, "<unset>");
|
return snprintf(dest, len, "<unset>");
|
||||||
|
@ -822,7 +777,7 @@ static void get_pci_host_devaddr(Object *obj, Visitor *v, const char *name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
PCIHostDeviceAddress *addr = qdev_get_prop_ptr(obj, prop);
|
PCIHostDeviceAddress *addr = object_field_prop_ptr(obj, prop);
|
||||||
char buffer[] = "ffff:ff:ff.f";
|
char buffer[] = "ffff:ff:ff.f";
|
||||||
char *p = buffer;
|
char *p = buffer;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
@ -847,20 +802,14 @@ static void get_pci_host_devaddr(Object *obj, Visitor *v, const char *name,
|
||||||
static void set_pci_host_devaddr(Object *obj, Visitor *v, const char *name,
|
static void set_pci_host_devaddr(Object *obj, Visitor *v, const char *name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(obj);
|
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
PCIHostDeviceAddress *addr = qdev_get_prop_ptr(obj, prop);
|
PCIHostDeviceAddress *addr = object_field_prop_ptr(obj, prop);
|
||||||
char *str, *p;
|
char *str, *p;
|
||||||
char *e;
|
char *e;
|
||||||
unsigned long val;
|
unsigned long val;
|
||||||
unsigned long dom = 0, bus = 0;
|
unsigned long dom = 0, bus = 0;
|
||||||
unsigned int slot = 0, func = 0;
|
unsigned int slot = 0, func = 0;
|
||||||
|
|
||||||
if (dev->realized) {
|
|
||||||
qdev_prop_set_after_realize(dev, name, errp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!visit_type_str(v, name, &str, errp)) {
|
if (!visit_type_str(v, name, &str, errp)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -915,7 +864,7 @@ static void set_pci_host_devaddr(Object *obj, Visitor *v, const char *name,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
inval:
|
inval:
|
||||||
error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str);
|
error_set_from_qdev_prop_error(errp, EINVAL, obj, name, str);
|
||||||
g_free(str);
|
g_free(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -944,7 +893,7 @@ static void get_prop_pcielinkspeed(Object *obj, Visitor *v, const char *name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
PCIExpLinkSpeed *p = qdev_get_prop_ptr(obj, prop);
|
PCIExpLinkSpeed *p = object_field_prop_ptr(obj, prop);
|
||||||
int speed;
|
int speed;
|
||||||
|
|
||||||
switch (*p) {
|
switch (*p) {
|
||||||
|
@ -965,23 +914,17 @@ static void get_prop_pcielinkspeed(Object *obj, Visitor *v, const char *name,
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
visit_type_enum(v, prop->name, &speed, prop->info->enum_table, errp);
|
visit_type_enum(v, name, &speed, prop->info->enum_table, errp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_prop_pcielinkspeed(Object *obj, Visitor *v, const char *name,
|
static void set_prop_pcielinkspeed(Object *obj, Visitor *v, const char *name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(obj);
|
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
PCIExpLinkSpeed *p = qdev_get_prop_ptr(obj, prop);
|
PCIExpLinkSpeed *p = object_field_prop_ptr(obj, prop);
|
||||||
int speed;
|
int speed;
|
||||||
|
|
||||||
if (dev->realized) {
|
if (!visit_type_enum(v, name, &speed, prop->info->enum_table,
|
||||||
qdev_prop_set_after_realize(dev, name, errp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!visit_type_enum(v, prop->name, &speed, prop->info->enum_table,
|
|
||||||
errp)) {
|
errp)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1020,7 +963,7 @@ static void get_prop_pcielinkwidth(Object *obj, Visitor *v, const char *name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
PCIExpLinkWidth *p = qdev_get_prop_ptr(obj, prop);
|
PCIExpLinkWidth *p = object_field_prop_ptr(obj, prop);
|
||||||
int width;
|
int width;
|
||||||
|
|
||||||
switch (*p) {
|
switch (*p) {
|
||||||
|
@ -1050,23 +993,17 @@ static void get_prop_pcielinkwidth(Object *obj, Visitor *v, const char *name,
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
visit_type_enum(v, prop->name, &width, prop->info->enum_table, errp);
|
visit_type_enum(v, name, &width, prop->info->enum_table, errp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_prop_pcielinkwidth(Object *obj, Visitor *v, const char *name,
|
static void set_prop_pcielinkwidth(Object *obj, Visitor *v, const char *name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(obj);
|
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
PCIExpLinkWidth *p = qdev_get_prop_ptr(obj, prop);
|
PCIExpLinkWidth *p = object_field_prop_ptr(obj, prop);
|
||||||
int width;
|
int width;
|
||||||
|
|
||||||
if (dev->realized) {
|
if (!visit_type_enum(v, name, &width, prop->info->enum_table,
|
||||||
qdev_prop_set_after_realize(dev, name, errp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!visit_type_enum(v, prop->name, &width, prop->info->enum_table,
|
|
||||||
errp)) {
|
errp)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1114,7 +1051,7 @@ static void get_uuid(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
QemuUUID *uuid = qdev_get_prop_ptr(obj, prop);
|
QemuUUID *uuid = object_field_prop_ptr(obj, prop);
|
||||||
char buffer[UUID_FMT_LEN + 1];
|
char buffer[UUID_FMT_LEN + 1];
|
||||||
char *p = buffer;
|
char *p = buffer;
|
||||||
|
|
||||||
|
@ -1128,16 +1065,10 @@ static void get_uuid(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||||
static void set_uuid(Object *obj, Visitor *v, const char *name, void *opaque,
|
static void set_uuid(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(obj);
|
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
QemuUUID *uuid = qdev_get_prop_ptr(obj, prop);
|
QemuUUID *uuid = object_field_prop_ptr(obj, prop);
|
||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
if (dev->realized) {
|
|
||||||
qdev_prop_set_after_realize(dev, name, errp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!visit_type_str(v, name, &str, errp)) {
|
if (!visit_type_str(v, name, &str, errp)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1145,7 +1076,7 @@ static void set_uuid(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||||
if (!strcmp(str, UUID_VALUE_AUTO)) {
|
if (!strcmp(str, UUID_VALUE_AUTO)) {
|
||||||
qemu_uuid_generate(uuid);
|
qemu_uuid_generate(uuid);
|
||||||
} else if (qemu_uuid_parse(str, uuid) < 0) {
|
} else if (qemu_uuid_parse(str, uuid) < 0) {
|
||||||
error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str);
|
error_set_from_qdev_prop_error(errp, EINVAL, obj, name, str);
|
||||||
}
|
}
|
||||||
g_free(str);
|
g_free(str);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,19 @@ void qdev_prop_set_after_realize(DeviceState *dev, const char *name,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* returns: true if property is allowed to be set, false otherwise */
|
||||||
|
static bool qdev_prop_allow_set(Object *obj, const char *name,
|
||||||
|
Error **errp)
|
||||||
|
{
|
||||||
|
DeviceState *dev = DEVICE(obj);
|
||||||
|
|
||||||
|
if (dev->realized) {
|
||||||
|
qdev_prop_set_after_realize(dev, name, errp);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void qdev_prop_allow_set_link_before_realize(const Object *obj,
|
void qdev_prop_allow_set_link_before_realize(const Object *obj,
|
||||||
const char *name,
|
const char *name,
|
||||||
Object *val, Error **errp)
|
Object *val, Error **errp)
|
||||||
|
@ -37,35 +50,68 @@ void qdev_prop_allow_set_link_before_realize(const Object *obj,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void *qdev_get_prop_ptr(Object *obj, Property *prop)
|
void *object_field_prop_ptr(Object *obj, Property *prop)
|
||||||
{
|
{
|
||||||
void *ptr = obj;
|
void *ptr = obj;
|
||||||
ptr += prop->offset;
|
ptr += prop->offset;
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void field_prop_get(Object *obj, Visitor *v, const char *name,
|
||||||
|
void *opaque, Error **errp)
|
||||||
|
{
|
||||||
|
Property *prop = opaque;
|
||||||
|
return prop->info->get(obj, v, name, opaque, errp);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* field_prop_getter: Return getter function to be used for property
|
||||||
|
*
|
||||||
|
* Return value can be NULL if @info has no getter function.
|
||||||
|
*/
|
||||||
|
static ObjectPropertyAccessor *field_prop_getter(const PropertyInfo *info)
|
||||||
|
{
|
||||||
|
return info->get ? field_prop_get : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void field_prop_set(Object *obj, Visitor *v, const char *name,
|
||||||
|
void *opaque, Error **errp)
|
||||||
|
{
|
||||||
|
Property *prop = opaque;
|
||||||
|
|
||||||
|
if (!qdev_prop_allow_set(obj, name, errp)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return prop->info->set(obj, v, name, opaque, errp);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* field_prop_setter: Return setter function to be used for property
|
||||||
|
*
|
||||||
|
* Return value can be NULL if @info has not setter function.
|
||||||
|
*/
|
||||||
|
static ObjectPropertyAccessor *field_prop_setter(const PropertyInfo *info)
|
||||||
|
{
|
||||||
|
return info->set ? field_prop_set : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void qdev_propinfo_get_enum(Object *obj, Visitor *v, const char *name,
|
void qdev_propinfo_get_enum(Object *obj, Visitor *v, const char *name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
int *ptr = qdev_get_prop_ptr(obj, prop);
|
int *ptr = object_field_prop_ptr(obj, prop);
|
||||||
|
|
||||||
visit_type_enum(v, prop->name, ptr, prop->info->enum_table, errp);
|
visit_type_enum(v, name, ptr, prop->info->enum_table, errp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void qdev_propinfo_set_enum(Object *obj, Visitor *v, const char *name,
|
void qdev_propinfo_set_enum(Object *obj, Visitor *v, const char *name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(obj);
|
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
int *ptr = qdev_get_prop_ptr(obj, prop);
|
int *ptr = object_field_prop_ptr(obj, prop);
|
||||||
|
|
||||||
if (dev->realized) {
|
visit_type_enum(v, name, ptr, prop->info->enum_table, errp);
|
||||||
qdev_prop_set_after_realize(dev, name, errp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
visit_type_enum(v, prop->name, ptr, prop->info->enum_table, errp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void qdev_propinfo_set_default_value_enum(ObjectProperty *op,
|
void qdev_propinfo_set_default_value_enum(ObjectProperty *op,
|
||||||
|
@ -92,7 +138,7 @@ static uint32_t qdev_get_prop_mask(Property *prop)
|
||||||
|
|
||||||
static void bit_prop_set(Object *obj, Property *props, bool val)
|
static void bit_prop_set(Object *obj, Property *props, bool val)
|
||||||
{
|
{
|
||||||
uint32_t *p = qdev_get_prop_ptr(obj, props);
|
uint32_t *p = object_field_prop_ptr(obj, props);
|
||||||
uint32_t mask = qdev_get_prop_mask(props);
|
uint32_t mask = qdev_get_prop_mask(props);
|
||||||
if (val) {
|
if (val) {
|
||||||
*p |= mask;
|
*p |= mask;
|
||||||
|
@ -105,7 +151,7 @@ static void prop_get_bit(Object *obj, Visitor *v, const char *name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
uint32_t *p = qdev_get_prop_ptr(obj, prop);
|
uint32_t *p = object_field_prop_ptr(obj, prop);
|
||||||
bool value = (*p & qdev_get_prop_mask(prop)) != 0;
|
bool value = (*p & qdev_get_prop_mask(prop)) != 0;
|
||||||
|
|
||||||
visit_type_bool(v, name, &value, errp);
|
visit_type_bool(v, name, &value, errp);
|
||||||
|
@ -114,15 +160,9 @@ static void prop_get_bit(Object *obj, Visitor *v, const char *name,
|
||||||
static void prop_set_bit(Object *obj, Visitor *v, const char *name,
|
static void prop_set_bit(Object *obj, Visitor *v, const char *name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(obj);
|
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
bool value;
|
bool value;
|
||||||
|
|
||||||
if (dev->realized) {
|
|
||||||
qdev_prop_set_after_realize(dev, name, errp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!visit_type_bool(v, name, &value, errp)) {
|
if (!visit_type_bool(v, name, &value, errp)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -152,7 +192,7 @@ static uint64_t qdev_get_prop_mask64(Property *prop)
|
||||||
|
|
||||||
static void bit64_prop_set(Object *obj, Property *props, bool val)
|
static void bit64_prop_set(Object *obj, Property *props, bool val)
|
||||||
{
|
{
|
||||||
uint64_t *p = qdev_get_prop_ptr(obj, props);
|
uint64_t *p = object_field_prop_ptr(obj, props);
|
||||||
uint64_t mask = qdev_get_prop_mask64(props);
|
uint64_t mask = qdev_get_prop_mask64(props);
|
||||||
if (val) {
|
if (val) {
|
||||||
*p |= mask;
|
*p |= mask;
|
||||||
|
@ -165,7 +205,7 @@ static void prop_get_bit64(Object *obj, Visitor *v, const char *name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
uint64_t *p = qdev_get_prop_ptr(obj, prop);
|
uint64_t *p = object_field_prop_ptr(obj, prop);
|
||||||
bool value = (*p & qdev_get_prop_mask64(prop)) != 0;
|
bool value = (*p & qdev_get_prop_mask64(prop)) != 0;
|
||||||
|
|
||||||
visit_type_bool(v, name, &value, errp);
|
visit_type_bool(v, name, &value, errp);
|
||||||
|
@ -174,15 +214,9 @@ static void prop_get_bit64(Object *obj, Visitor *v, const char *name,
|
||||||
static void prop_set_bit64(Object *obj, Visitor *v, const char *name,
|
static void prop_set_bit64(Object *obj, Visitor *v, const char *name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(obj);
|
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
bool value;
|
bool value;
|
||||||
|
|
||||||
if (dev->realized) {
|
|
||||||
qdev_prop_set_after_realize(dev, name, errp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!visit_type_bool(v, name, &value, errp)) {
|
if (!visit_type_bool(v, name, &value, errp)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -203,7 +237,7 @@ static void get_bool(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
bool *ptr = qdev_get_prop_ptr(obj, prop);
|
bool *ptr = object_field_prop_ptr(obj, prop);
|
||||||
|
|
||||||
visit_type_bool(v, name, ptr, errp);
|
visit_type_bool(v, name, ptr, errp);
|
||||||
}
|
}
|
||||||
|
@ -211,14 +245,8 @@ static void get_bool(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||||
static void set_bool(Object *obj, Visitor *v, const char *name, void *opaque,
|
static void set_bool(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(obj);
|
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
bool *ptr = qdev_get_prop_ptr(obj, prop);
|
bool *ptr = object_field_prop_ptr(obj, prop);
|
||||||
|
|
||||||
if (dev->realized) {
|
|
||||||
qdev_prop_set_after_realize(dev, name, errp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
visit_type_bool(v, name, ptr, errp);
|
visit_type_bool(v, name, ptr, errp);
|
||||||
}
|
}
|
||||||
|
@ -236,7 +264,7 @@ static void get_uint8(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
uint8_t *ptr = qdev_get_prop_ptr(obj, prop);
|
uint8_t *ptr = object_field_prop_ptr(obj, prop);
|
||||||
|
|
||||||
visit_type_uint8(v, name, ptr, errp);
|
visit_type_uint8(v, name, ptr, errp);
|
||||||
}
|
}
|
||||||
|
@ -244,14 +272,8 @@ static void get_uint8(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||||
static void set_uint8(Object *obj, Visitor *v, const char *name, void *opaque,
|
static void set_uint8(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(obj);
|
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
uint8_t *ptr = qdev_get_prop_ptr(obj, prop);
|
uint8_t *ptr = object_field_prop_ptr(obj, prop);
|
||||||
|
|
||||||
if (dev->realized) {
|
|
||||||
qdev_prop_set_after_realize(dev, name, errp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
visit_type_uint8(v, name, ptr, errp);
|
visit_type_uint8(v, name, ptr, errp);
|
||||||
}
|
}
|
||||||
|
@ -281,7 +303,7 @@ static void get_uint16(Object *obj, Visitor *v, const char *name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
uint16_t *ptr = qdev_get_prop_ptr(obj, prop);
|
uint16_t *ptr = object_field_prop_ptr(obj, prop);
|
||||||
|
|
||||||
visit_type_uint16(v, name, ptr, errp);
|
visit_type_uint16(v, name, ptr, errp);
|
||||||
}
|
}
|
||||||
|
@ -289,14 +311,8 @@ static void get_uint16(Object *obj, Visitor *v, const char *name,
|
||||||
static void set_uint16(Object *obj, Visitor *v, const char *name,
|
static void set_uint16(Object *obj, Visitor *v, const char *name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(obj);
|
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
uint16_t *ptr = qdev_get_prop_ptr(obj, prop);
|
uint16_t *ptr = object_field_prop_ptr(obj, prop);
|
||||||
|
|
||||||
if (dev->realized) {
|
|
||||||
qdev_prop_set_after_realize(dev, name, errp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
visit_type_uint16(v, name, ptr, errp);
|
visit_type_uint16(v, name, ptr, errp);
|
||||||
}
|
}
|
||||||
|
@ -314,7 +330,7 @@ static void get_uint32(Object *obj, Visitor *v, const char *name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
uint32_t *ptr = qdev_get_prop_ptr(obj, prop);
|
uint32_t *ptr = object_field_prop_ptr(obj, prop);
|
||||||
|
|
||||||
visit_type_uint32(v, name, ptr, errp);
|
visit_type_uint32(v, name, ptr, errp);
|
||||||
}
|
}
|
||||||
|
@ -322,14 +338,8 @@ static void get_uint32(Object *obj, Visitor *v, const char *name,
|
||||||
static void set_uint32(Object *obj, Visitor *v, const char *name,
|
static void set_uint32(Object *obj, Visitor *v, const char *name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(obj);
|
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
uint32_t *ptr = qdev_get_prop_ptr(obj, prop);
|
uint32_t *ptr = object_field_prop_ptr(obj, prop);
|
||||||
|
|
||||||
if (dev->realized) {
|
|
||||||
qdev_prop_set_after_realize(dev, name, errp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
visit_type_uint32(v, name, ptr, errp);
|
visit_type_uint32(v, name, ptr, errp);
|
||||||
}
|
}
|
||||||
|
@ -338,7 +348,7 @@ void qdev_propinfo_get_int32(Object *obj, Visitor *v, const char *name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
int32_t *ptr = qdev_get_prop_ptr(obj, prop);
|
int32_t *ptr = object_field_prop_ptr(obj, prop);
|
||||||
|
|
||||||
visit_type_int32(v, name, ptr, errp);
|
visit_type_int32(v, name, ptr, errp);
|
||||||
}
|
}
|
||||||
|
@ -346,14 +356,8 @@ void qdev_propinfo_get_int32(Object *obj, Visitor *v, const char *name,
|
||||||
static void set_int32(Object *obj, Visitor *v, const char *name, void *opaque,
|
static void set_int32(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(obj);
|
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
int32_t *ptr = qdev_get_prop_ptr(obj, prop);
|
int32_t *ptr = object_field_prop_ptr(obj, prop);
|
||||||
|
|
||||||
if (dev->realized) {
|
|
||||||
qdev_prop_set_after_realize(dev, name, errp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
visit_type_int32(v, name, ptr, errp);
|
visit_type_int32(v, name, ptr, errp);
|
||||||
}
|
}
|
||||||
|
@ -378,7 +382,7 @@ static void get_uint64(Object *obj, Visitor *v, const char *name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
uint64_t *ptr = qdev_get_prop_ptr(obj, prop);
|
uint64_t *ptr = object_field_prop_ptr(obj, prop);
|
||||||
|
|
||||||
visit_type_uint64(v, name, ptr, errp);
|
visit_type_uint64(v, name, ptr, errp);
|
||||||
}
|
}
|
||||||
|
@ -386,14 +390,8 @@ static void get_uint64(Object *obj, Visitor *v, const char *name,
|
||||||
static void set_uint64(Object *obj, Visitor *v, const char *name,
|
static void set_uint64(Object *obj, Visitor *v, const char *name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(obj);
|
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
uint64_t *ptr = qdev_get_prop_ptr(obj, prop);
|
uint64_t *ptr = object_field_prop_ptr(obj, prop);
|
||||||
|
|
||||||
if (dev->realized) {
|
|
||||||
qdev_prop_set_after_realize(dev, name, errp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
visit_type_uint64(v, name, ptr, errp);
|
visit_type_uint64(v, name, ptr, errp);
|
||||||
}
|
}
|
||||||
|
@ -402,7 +400,7 @@ static void get_int64(Object *obj, Visitor *v, const char *name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
int64_t *ptr = qdev_get_prop_ptr(obj, prop);
|
int64_t *ptr = object_field_prop_ptr(obj, prop);
|
||||||
|
|
||||||
visit_type_int64(v, name, ptr, errp);
|
visit_type_int64(v, name, ptr, errp);
|
||||||
}
|
}
|
||||||
|
@ -410,14 +408,8 @@ static void get_int64(Object *obj, Visitor *v, const char *name,
|
||||||
static void set_int64(Object *obj, Visitor *v, const char *name,
|
static void set_int64(Object *obj, Visitor *v, const char *name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(obj);
|
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
int64_t *ptr = qdev_get_prop_ptr(obj, prop);
|
int64_t *ptr = object_field_prop_ptr(obj, prop);
|
||||||
|
|
||||||
if (dev->realized) {
|
|
||||||
qdev_prop_set_after_realize(dev, name, errp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
visit_type_int64(v, name, ptr, errp);
|
visit_type_int64(v, name, ptr, errp);
|
||||||
}
|
}
|
||||||
|
@ -441,14 +433,14 @@ const PropertyInfo qdev_prop_int64 = {
|
||||||
static void release_string(Object *obj, const char *name, void *opaque)
|
static void release_string(Object *obj, const char *name, void *opaque)
|
||||||
{
|
{
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
g_free(*(char **)qdev_get_prop_ptr(obj, prop));
|
g_free(*(char **)object_field_prop_ptr(obj, prop));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_string(Object *obj, Visitor *v, const char *name,
|
static void get_string(Object *obj, Visitor *v, const char *name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
char **ptr = qdev_get_prop_ptr(obj, prop);
|
char **ptr = object_field_prop_ptr(obj, prop);
|
||||||
|
|
||||||
if (!*ptr) {
|
if (!*ptr) {
|
||||||
char *str = (char *)"";
|
char *str = (char *)"";
|
||||||
|
@ -461,16 +453,10 @@ static void get_string(Object *obj, Visitor *v, const char *name,
|
||||||
static void set_string(Object *obj, Visitor *v, const char *name,
|
static void set_string(Object *obj, Visitor *v, const char *name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(obj);
|
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
char **ptr = qdev_get_prop_ptr(obj, prop);
|
char **ptr = object_field_prop_ptr(obj, prop);
|
||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
if (dev->realized) {
|
|
||||||
qdev_prop_set_after_realize(dev, name, errp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!visit_type_str(v, name, &str, errp)) {
|
if (!visit_type_str(v, name, &str, errp)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -502,7 +488,7 @@ void qdev_propinfo_get_size32(Object *obj, Visitor *v, const char *name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
uint32_t *ptr = qdev_get_prop_ptr(obj, prop);
|
uint32_t *ptr = object_field_prop_ptr(obj, prop);
|
||||||
uint64_t value = *ptr;
|
uint64_t value = *ptr;
|
||||||
|
|
||||||
visit_type_size(v, name, &value, errp);
|
visit_type_size(v, name, &value, errp);
|
||||||
|
@ -511,16 +497,10 @@ void qdev_propinfo_get_size32(Object *obj, Visitor *v, const char *name,
|
||||||
static void set_size32(Object *obj, Visitor *v, const char *name, void *opaque,
|
static void set_size32(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(obj);
|
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
uint32_t *ptr = qdev_get_prop_ptr(obj, prop);
|
uint32_t *ptr = object_field_prop_ptr(obj, prop);
|
||||||
uint64_t value;
|
uint64_t value;
|
||||||
|
|
||||||
if (dev->realized) {
|
|
||||||
qdev_prop_set_after_realize(dev, name, errp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!visit_type_size(v, name, &value, errp)) {
|
if (!visit_type_size(v, name, &value, errp)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -579,18 +559,13 @@ static void set_prop_arraylen(Object *obj, Visitor *v, const char *name,
|
||||||
* array-length field in the device struct, we have to create the
|
* array-length field in the device struct, we have to create the
|
||||||
* array itself and dynamically add the corresponding properties.
|
* array itself and dynamically add the corresponding properties.
|
||||||
*/
|
*/
|
||||||
DeviceState *dev = DEVICE(obj);
|
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
uint32_t *alenptr = qdev_get_prop_ptr(obj, prop);
|
uint32_t *alenptr = object_field_prop_ptr(obj, prop);
|
||||||
void **arrayptr = (void *)dev + prop->arrayoffset;
|
void **arrayptr = (void *)obj + prop->arrayoffset;
|
||||||
void *eltptr;
|
void *eltptr;
|
||||||
const char *arrayname;
|
const char *arrayname;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (dev->realized) {
|
|
||||||
qdev_prop_set_after_realize(dev, name, errp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (*alenptr) {
|
if (*alenptr) {
|
||||||
error_setg(errp, "array size property %s may not be set more than once",
|
error_setg(errp, "array size property %s may not be set more than once",
|
||||||
name);
|
name);
|
||||||
|
@ -626,12 +601,12 @@ static void set_prop_arraylen(Object *obj, Visitor *v, const char *name,
|
||||||
* they get the right answer despite the array element not actually
|
* they get the right answer despite the array element not actually
|
||||||
* being inside the device struct.
|
* being inside the device struct.
|
||||||
*/
|
*/
|
||||||
arrayprop->prop.offset = eltptr - (void *)dev;
|
arrayprop->prop.offset = eltptr - (void *)obj;
|
||||||
assert(qdev_get_prop_ptr(obj, &arrayprop->prop) == eltptr);
|
assert(object_field_prop_ptr(obj, &arrayprop->prop) == eltptr);
|
||||||
object_property_add(obj, propname,
|
object_property_add(obj, propname,
|
||||||
arrayprop->prop.info->name,
|
arrayprop->prop.info->name,
|
||||||
arrayprop->prop.info->get,
|
field_prop_getter(arrayprop->prop.info),
|
||||||
arrayprop->prop.info->set,
|
field_prop_setter(arrayprop->prop.info),
|
||||||
array_element_release,
|
array_element_release,
|
||||||
arrayprop);
|
arrayprop);
|
||||||
}
|
}
|
||||||
|
@ -679,21 +654,21 @@ static Property *qdev_prop_find(DeviceState *dev, const char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
void error_set_from_qdev_prop_error(Error **errp, int ret, Object *obj,
|
void error_set_from_qdev_prop_error(Error **errp, int ret, Object *obj,
|
||||||
Property *prop, const char *value)
|
const char *name, const char *value)
|
||||||
{
|
{
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
case -EEXIST:
|
case -EEXIST:
|
||||||
error_setg(errp, "Property '%s.%s' can't take value '%s', it's in use",
|
error_setg(errp, "Property '%s.%s' can't take value '%s', it's in use",
|
||||||
object_get_typename(obj), prop->name, value);
|
object_get_typename(obj), name, value);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
case -EINVAL:
|
case -EINVAL:
|
||||||
error_setg(errp, QERR_PROPERTY_VALUE_BAD,
|
error_setg(errp, QERR_PROPERTY_VALUE_BAD,
|
||||||
object_get_typename(obj), prop->name, value);
|
object_get_typename(obj), name, value);
|
||||||
break;
|
break;
|
||||||
case -ENOENT:
|
case -ENOENT:
|
||||||
error_setg(errp, "Property '%s.%s' can't find value '%s'",
|
error_setg(errp, "Property '%s.%s' can't find value '%s'",
|
||||||
object_get_typename(obj), prop->name, value);
|
object_get_typename(obj), name, value);
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
break;
|
break;
|
||||||
|
@ -822,7 +797,7 @@ static void get_size(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
uint64_t *ptr = qdev_get_prop_ptr(obj, prop);
|
uint64_t *ptr = object_field_prop_ptr(obj, prop);
|
||||||
|
|
||||||
visit_type_size(v, name, ptr, errp);
|
visit_type_size(v, name, ptr, errp);
|
||||||
}
|
}
|
||||||
|
@ -830,14 +805,8 @@ static void get_size(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||||
static void set_size(Object *obj, Visitor *v, const char *name, void *opaque,
|
static void set_size(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(obj);
|
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
uint64_t *ptr = qdev_get_prop_ptr(obj, prop);
|
uint64_t *ptr = object_field_prop_ptr(obj, prop);
|
||||||
|
|
||||||
if (dev->realized) {
|
|
||||||
qdev_prop_set_after_realize(dev, name, errp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
visit_type_size(v, name, ptr, errp);
|
visit_type_size(v, name, ptr, errp);
|
||||||
}
|
}
|
||||||
|
@ -851,9 +820,10 @@ const PropertyInfo qdev_prop_size = {
|
||||||
|
|
||||||
/* --- object link property --- */
|
/* --- object link property --- */
|
||||||
|
|
||||||
static void create_link_property(ObjectClass *oc, Property *prop)
|
static ObjectProperty *create_link_property(ObjectClass *oc, const char *name,
|
||||||
|
Property *prop)
|
||||||
{
|
{
|
||||||
object_class_property_add_link(oc, prop->name, prop->link_type,
|
return object_class_property_add_link(oc, name, prop->link_type,
|
||||||
prop->offset,
|
prop->offset,
|
||||||
qdev_prop_allow_set_link_before_realize,
|
qdev_prop_allow_set_link_before_realize,
|
||||||
OBJ_PROP_LINK_STRONG);
|
OBJ_PROP_LINK_STRONG);
|
||||||
|
@ -872,7 +842,8 @@ void qdev_property_add_static(DeviceState *dev, Property *prop)
|
||||||
assert(!prop->info->create);
|
assert(!prop->info->create);
|
||||||
|
|
||||||
op = object_property_add(obj, prop->name, prop->info->name,
|
op = object_property_add(obj, prop->name, prop->info->name,
|
||||||
prop->info->get, prop->info->set,
|
field_prop_getter(prop->info),
|
||||||
|
field_prop_setter(prop->info),
|
||||||
prop->info->release,
|
prop->info->release,
|
||||||
prop);
|
prop);
|
||||||
|
|
||||||
|
@ -887,26 +858,26 @@ void qdev_property_add_static(DeviceState *dev, Property *prop)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qdev_class_add_property(DeviceClass *klass, Property *prop)
|
static void qdev_class_add_property(DeviceClass *klass, const char *name,
|
||||||
|
Property *prop)
|
||||||
{
|
{
|
||||||
ObjectClass *oc = OBJECT_CLASS(klass);
|
ObjectClass *oc = OBJECT_CLASS(klass);
|
||||||
|
|
||||||
if (prop->info->create) {
|
|
||||||
prop->info->create(oc, prop);
|
|
||||||
} else {
|
|
||||||
ObjectProperty *op;
|
ObjectProperty *op;
|
||||||
|
|
||||||
|
if (prop->info->create) {
|
||||||
|
op = prop->info->create(oc, name, prop);
|
||||||
|
} else {
|
||||||
op = object_class_property_add(oc,
|
op = object_class_property_add(oc,
|
||||||
prop->name, prop->info->name,
|
name, prop->info->name,
|
||||||
prop->info->get, prop->info->set,
|
field_prop_getter(prop->info),
|
||||||
|
field_prop_setter(prop->info),
|
||||||
prop->info->release,
|
prop->info->release,
|
||||||
prop);
|
prop);
|
||||||
|
}
|
||||||
if (prop->set_default) {
|
if (prop->set_default) {
|
||||||
prop->info->set_default_value(op, prop);
|
prop->info->set_default_value(op, prop);
|
||||||
}
|
}
|
||||||
}
|
object_class_property_set_description(oc, name, prop->info->description);
|
||||||
object_class_property_set_description(oc, prop->name,
|
|
||||||
prop->info->description);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -962,7 +933,7 @@ void device_class_set_props(DeviceClass *dc, Property *props)
|
||||||
dc->props_ = props;
|
dc->props_ = props;
|
||||||
for (prop = props; prop && prop->name; prop++) {
|
for (prop = props; prop && prop->name; prop++) {
|
||||||
qdev_class_add_legacy_property(dc, prop);
|
qdev_class_add_legacy_property(dc, prop);
|
||||||
qdev_class_add_property(dc, prop);
|
qdev_class_add_property(dc, prop->name, prop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "migration/vmstate.h"
|
#include "migration/vmstate.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "hw/hyperv/hyperv.h"
|
#include "hw/hyperv/hyperv.h"
|
||||||
#include "hw/hyperv/vmbus.h"
|
#include "hw/hyperv/vmbus.h"
|
||||||
#include "hw/hyperv/vmbus-bridge.h"
|
#include "hw/hyperv/vmbus-bridge.h"
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include "sysemu/runstate.h"
|
#include "sysemu/runstate.h"
|
||||||
#include "hw/timer/i8254.h"
|
#include "hw/timer/i8254.h"
|
||||||
#include "hw/timer/i8254_internal.h"
|
#include "hw/timer/i8254_internal.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "sysemu/kvm.h"
|
#include "sysemu/kvm.h"
|
||||||
#include "qom/object.h"
|
#include "qom/object.h"
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
#include "hw/ide/internal.h"
|
#include "hw/ide/internal.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "sysemu/block-backend.h"
|
#include "sysemu/block-backend.h"
|
||||||
#include "sysemu/blockdev.h"
|
#include "sysemu/blockdev.h"
|
||||||
#include "hw/block/block.h"
|
#include "hw/block/block.h"
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include "chardev/char-fe.h"
|
#include "chardev/char-fe.h"
|
||||||
#include "hw/ipmi/ipmi.h"
|
#include "hw/ipmi/ipmi.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "migration/vmstate.h"
|
#include "migration/vmstate.h"
|
||||||
#include "qom/object.h"
|
#include "qom/object.h"
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
#include "hw/loader.h"
|
#include "hw/loader.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "migration/vmstate.h"
|
#include "migration/vmstate.h"
|
||||||
|
|
||||||
#define IPMI_NETFN_CHASSIS 0x00
|
#define IPMI_NETFN_CHASSIS 0x00
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "qemu/guest-random.h"
|
#include "qemu/guest-random.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "hw/misc/allwinner-sid.h"
|
#include "hw/misc/allwinner-sid.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "qemu/cutils.h"
|
#include "qemu/cutils.h"
|
||||||
#include "hw/pci/pci.h"
|
#include "hw/pci/pci.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "hw/pci/msi.h"
|
#include "hw/pci/msi.h"
|
||||||
#include "hw/pci/msix.h"
|
#include "hw/pci/msix.h"
|
||||||
#include "sysemu/kvm.h"
|
#include "sysemu/kvm.h"
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "qemu/cutils.h"
|
#include "qemu/cutils.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "sysemu/block-backend.h"
|
#include "sysemu/block-backend.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "qemu/log.h"
|
#include "qemu/log.h"
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "hw/sysbus.h"
|
#include "hw/sysbus.h"
|
||||||
#include "qemu/log.h"
|
#include "qemu/log.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "hw/pci/pci.h"
|
#include "hw/pci/pci.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "migration/vmstate.h"
|
#include "migration/vmstate.h"
|
||||||
#include "hw/pci/msix.h"
|
#include "hw/pci/msix.h"
|
||||||
#include "net/net.h"
|
#include "net/net.h"
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
#include "hw/i2c/i2c.h"
|
#include "hw/i2c/i2c.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "sysemu/block-backend.h"
|
#include "sysemu/block-backend.h"
|
||||||
#include "qom/object.h"
|
#include "qom/object.h"
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
#include "hw/ppc/spapr.h"
|
#include "hw/ppc/spapr.h"
|
||||||
#include "hw/ppc/spapr_vio.h"
|
#include "hw/ppc/spapr_vio.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "qom/object.h"
|
#include "qom/object.h"
|
||||||
|
|
||||||
struct SpaprNvram {
|
struct SpaprNvram {
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "hw/pci/msix.h"
|
#include "hw/pci/msix.h"
|
||||||
#include "hw/pci/pcie_port.h"
|
#include "hw/pci/pcie_port.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "migration/vmstate.h"
|
#include "migration/vmstate.h"
|
||||||
#include "qom/object.h"
|
#include "qom/object.h"
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include "hw/pci/pci_bus.h"
|
#include "hw/pci/pci_bus.h"
|
||||||
#include "hw/pci/pci_host.h"
|
#include "hw/pci/pci_host.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "migration/qemu-file-types.h"
|
#include "migration/qemu-file-types.h"
|
||||||
#include "migration/vmstate.h"
|
#include "migration/vmstate.h"
|
||||||
#include "monitor/monitor.h"
|
#include "monitor/monitor.h"
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "hw/loader.h"
|
#include "hw/loader.h"
|
||||||
#include "hw/ppc/pnv_pnor.h"
|
#include "hw/ppc/pnv_pnor.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
|
|
||||||
static uint64_t pnv_pnor_read(void *opaque, hwaddr addr, unsigned size)
|
static uint64_t pnv_pnor_read(void *opaque, hwaddr addr, unsigned size)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "hw/pci/msi.h"
|
#include "hw/pci/msi.h"
|
||||||
#include "hw/pci/msix.h"
|
#include "hw/pci/msix.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "monitor/monitor.h"
|
#include "monitor/monitor.h"
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "hw/acpi/aml-build.h"
|
#include "hw/acpi/aml-build.h"
|
||||||
#include "hw/irq.h"
|
#include "hw/irq.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "qemu/timer.h"
|
#include "qemu/timer.h"
|
||||||
#include "sysemu/sysemu.h"
|
#include "sysemu/sysemu.h"
|
||||||
#include "sysemu/replay.h"
|
#include "sysemu/replay.h"
|
||||||
|
|
|
@ -2344,7 +2344,7 @@ static void get_css_devid(Object *obj, Visitor *v, const char *name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
CssDevId *dev_id = qdev_get_prop_ptr(obj, prop);
|
CssDevId *dev_id = object_field_prop_ptr(obj, prop);
|
||||||
char buffer[] = "xx.x.xxxx";
|
char buffer[] = "xx.x.xxxx";
|
||||||
char *p = buffer;
|
char *p = buffer;
|
||||||
int r;
|
int r;
|
||||||
|
@ -2372,25 +2372,19 @@ static void get_css_devid(Object *obj, Visitor *v, const char *name,
|
||||||
static void set_css_devid(Object *obj, Visitor *v, const char *name,
|
static void set_css_devid(Object *obj, Visitor *v, const char *name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(obj);
|
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
CssDevId *dev_id = qdev_get_prop_ptr(obj, prop);
|
CssDevId *dev_id = object_field_prop_ptr(obj, prop);
|
||||||
char *str;
|
char *str;
|
||||||
int num, n1, n2;
|
int num, n1, n2;
|
||||||
unsigned int cssid, ssid, devid;
|
unsigned int cssid, ssid, devid;
|
||||||
|
|
||||||
if (dev->realized) {
|
|
||||||
qdev_prop_set_after_realize(dev, name, errp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!visit_type_str(v, name, &str, errp)) {
|
if (!visit_type_str(v, name, &str, errp)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
num = sscanf(str, "%2x.%1x%n.%4x%n", &cssid, &ssid, &n1, &devid, &n2);
|
num = sscanf(str, "%2x.%1x%n.%4x%n", &cssid, &ssid, &n1, &devid, &n2);
|
||||||
if (num != 3 || (n2 - n1) != 5 || strlen(str) != n2) {
|
if (num != 3 || (n2 - n1) != 5 || strlen(str) != n2) {
|
||||||
error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str);
|
error_set_from_qdev_prop_error(errp, EINVAL, obj, name, str);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if ((cssid > MAX_CSSID) || (ssid > MAX_SSID)) {
|
if ((cssid > MAX_CSSID) || (ssid > MAX_SSID)) {
|
||||||
|
|
|
@ -1330,7 +1330,7 @@ static void s390_pci_get_fid(Object *obj, Visitor *v, const char *name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
uint32_t *ptr = qdev_get_prop_ptr(obj, prop);
|
uint32_t *ptr = object_field_prop_ptr(obj, prop);
|
||||||
|
|
||||||
visit_type_uint32(v, name, ptr, errp);
|
visit_type_uint32(v, name, ptr, errp);
|
||||||
}
|
}
|
||||||
|
@ -1338,15 +1338,9 @@ static void s390_pci_get_fid(Object *obj, Visitor *v, const char *name,
|
||||||
static void s390_pci_set_fid(Object *obj, Visitor *v, const char *name,
|
static void s390_pci_set_fid(Object *obj, Visitor *v, const char *name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(obj);
|
|
||||||
S390PCIBusDevice *zpci = S390_PCI_DEVICE(obj);
|
S390PCIBusDevice *zpci = S390_PCI_DEVICE(obj);
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
uint32_t *ptr = qdev_get_prop_ptr(obj, prop);
|
uint32_t *ptr = object_field_prop_ptr(obj, prop);
|
||||||
|
|
||||||
if (dev->realized) {
|
|
||||||
qdev_prop_set_after_realize(dev, name, errp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!visit_type_uint32(v, name, ptr, errp)) {
|
if (!visit_type_uint32(v, name, ptr, errp)) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include "sysemu/blockdev.h"
|
#include "sysemu/blockdev.h"
|
||||||
#include "hw/block/block.h"
|
#include "hw/block/block.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "sysemu/dma.h"
|
#include "sysemu/dma.h"
|
||||||
#include "sysemu/sysemu.h"
|
#include "sysemu/sysemu.h"
|
||||||
#include "qemu/cutils.h"
|
#include "qemu/cutils.h"
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "hw/scsi/scsi.h"
|
#include "hw/scsi/scsi.h"
|
||||||
#include "migration/qemu-file-types.h"
|
#include "migration/qemu-file-types.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "hw/scsi/emulation.h"
|
#include "hw/scsi/emulation.h"
|
||||||
#include "sysemu/block-backend.h"
|
#include "sysemu/block-backend.h"
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "hw/fw-path-provider.h"
|
#include "hw/fw-path-provider.h"
|
||||||
#include "hw/qdev-core.h"
|
#include "hw/qdev-core.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "hw/virtio/vhost.h"
|
#include "hw/virtio/vhost.h"
|
||||||
#include "hw/virtio/vhost-backend.h"
|
#include "hw/virtio/vhost-backend.h"
|
||||||
#include "hw/virtio/vhost-user-scsi.h"
|
#include "hw/virtio/vhost-user-scsi.h"
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "qemu/bitmap.h"
|
#include "qemu/bitmap.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
#include "qemu/timer.h"
|
#include "qemu/timer.h"
|
||||||
#include "qemu/log.h"
|
#include "qemu/log.h"
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
#include "sysemu/tpm_backend.h"
|
#include "sysemu/tpm_backend.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
|
||||||
|
extern const PropertyInfo qdev_prop_tpm;
|
||||||
|
|
||||||
#define DEFINE_PROP_TPMBE(_n, _s, _f) \
|
#define DEFINE_PROP_TPMBE(_n, _s, _f) \
|
||||||
DEFINE_PROP(_n, _s, _f, qdev_prop_tpm, TPMBackend *)
|
DEFINE_PROP(_n, _s, _f, qdev_prop_tpm, TPMBackend *)
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include <libcacard.h>
|
#include <libcacard.h>
|
||||||
#include "chardev/char-fe.h"
|
#include "chardev/char-fe.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "migration/vmstate.h"
|
#include "migration/vmstate.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "hw/usb.h"
|
#include "hw/usb.h"
|
||||||
#include "migration/vmstate.h"
|
#include "migration/vmstate.h"
|
||||||
#include "desc.h"
|
#include "desc.h"
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#include <usbredirfilter.h>
|
#include <usbredirfilter.h>
|
||||||
|
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "hw/usb.h"
|
#include "hw/usb.h"
|
||||||
#include "migration/qemu-file-types.h"
|
#include "migration/qemu-file-types.h"
|
||||||
#include "migration/vmstate.h"
|
#include "migration/vmstate.h"
|
||||||
|
|
|
@ -1489,7 +1489,7 @@ static void get_nv_gpudirect_clique_id(Object *obj, Visitor *v,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
uint8_t *ptr = qdev_get_prop_ptr(obj, prop);
|
uint8_t *ptr = object_field_prop_ptr(obj, prop);
|
||||||
|
|
||||||
visit_type_uint8(v, name, ptr, errp);
|
visit_type_uint8(v, name, ptr, errp);
|
||||||
}
|
}
|
||||||
|
@ -1498,14 +1498,8 @@ static void set_nv_gpudirect_clique_id(Object *obj, Visitor *v,
|
||||||
const char *name, void *opaque,
|
const char *name, void *opaque,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(obj);
|
|
||||||
Property *prop = opaque;
|
Property *prop = opaque;
|
||||||
uint8_t value, *ptr = qdev_get_prop_ptr(obj, prop);
|
uint8_t value, *ptr = object_field_prop_ptr(obj, prop);
|
||||||
|
|
||||||
if (dev->realized) {
|
|
||||||
qdev_prop_set_after_realize(dev, name, errp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!visit_type_uint8(v, name, &value, errp)) {
|
if (!visit_type_uint8(v, name, &value, errp)) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "hw/pci/msix.h"
|
#include "hw/pci/msix.h"
|
||||||
#include "hw/pci/pci_bridge.h"
|
#include "hw/pci/pci_bridge.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "migration/vmstate.h"
|
#include "migration/vmstate.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
#include "qemu/main-loop.h"
|
#include "qemu/main-loop.h"
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "standard-headers/linux/virtio_fs.h"
|
#include "standard-headers/linux/virtio_fs.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "hw/virtio/virtio-bus.h"
|
#include "hw/virtio/virtio-bus.h"
|
||||||
#include "hw/virtio/virtio-access.h"
|
#include "hw/virtio/virtio-access.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "hw/virtio/vhost-user-vsock.h"
|
#include "hw/virtio/vhost-user-vsock.h"
|
||||||
|
|
||||||
static const int user_feature_bits[] = {
|
static const int user_feature_bits[] = {
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include "virtio-pci.h"
|
#include "virtio-pci.h"
|
||||||
#include "hw/virtio/virtio-iommu.h"
|
#include "hw/virtio/virtio-iommu.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
#include "hw/boards.h"
|
#include "hw/boards.h"
|
||||||
#include "qom/object.h"
|
#include "qom/object.h"
|
||||||
|
|
|
@ -58,6 +58,7 @@
|
||||||
|
|
||||||
#include "hw/pci/pci.h"
|
#include "hw/pci/pci.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "hw/xen/xen.h"
|
#include "hw/xen/xen.h"
|
||||||
#include "hw/i386/pc.h"
|
#include "hw/i386/pc.h"
|
||||||
#include "hw/xen/xen-legacy-backend.h"
|
#include "hw/xen/xen-legacy-backend.h"
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
#include "exec/hwaddr.h"
|
#include "exec/hwaddr.h"
|
||||||
#include "qapi/qapi-types-block-core.h"
|
#include "qapi/qapi-types-block-core.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
|
|
||||||
/* Configuration */
|
/* Configuration */
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,77 @@
|
||||||
|
#ifndef HW_QDEV_PROPERTIES_SYSTEM_H
|
||||||
|
#define HW_QDEV_PROPERTIES_SYSTEM_H
|
||||||
|
|
||||||
|
#include "hw/qdev-properties.h"
|
||||||
|
|
||||||
|
extern const PropertyInfo qdev_prop_chr;
|
||||||
|
extern const PropertyInfo qdev_prop_macaddr;
|
||||||
|
extern const PropertyInfo qdev_prop_reserved_region;
|
||||||
|
extern const PropertyInfo qdev_prop_multifd_compression;
|
||||||
|
extern const PropertyInfo qdev_prop_losttickpolicy;
|
||||||
|
extern const PropertyInfo qdev_prop_blockdev_on_error;
|
||||||
|
extern const PropertyInfo qdev_prop_bios_chs_trans;
|
||||||
|
extern const PropertyInfo qdev_prop_fdc_drive_type;
|
||||||
|
extern const PropertyInfo qdev_prop_drive;
|
||||||
|
extern const PropertyInfo qdev_prop_drive_iothread;
|
||||||
|
extern const PropertyInfo qdev_prop_netdev;
|
||||||
|
extern const PropertyInfo qdev_prop_pci_devfn;
|
||||||
|
extern const PropertyInfo qdev_prop_blocksize;
|
||||||
|
extern const PropertyInfo qdev_prop_pci_host_devaddr;
|
||||||
|
extern const PropertyInfo qdev_prop_uuid;
|
||||||
|
extern const PropertyInfo qdev_prop_audiodev;
|
||||||
|
extern const PropertyInfo qdev_prop_off_auto_pcibar;
|
||||||
|
extern const PropertyInfo qdev_prop_pcie_link_speed;
|
||||||
|
extern const PropertyInfo qdev_prop_pcie_link_width;
|
||||||
|
|
||||||
|
#define DEFINE_PROP_PCI_DEVFN(_n, _s, _f, _d) \
|
||||||
|
DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_pci_devfn, int32_t)
|
||||||
|
|
||||||
|
#define DEFINE_PROP_CHR(_n, _s, _f) \
|
||||||
|
DEFINE_PROP(_n, _s, _f, qdev_prop_chr, CharBackend)
|
||||||
|
#define DEFINE_PROP_NETDEV(_n, _s, _f) \
|
||||||
|
DEFINE_PROP(_n, _s, _f, qdev_prop_netdev, NICPeers)
|
||||||
|
#define DEFINE_PROP_DRIVE(_n, _s, _f) \
|
||||||
|
DEFINE_PROP(_n, _s, _f, qdev_prop_drive, BlockBackend *)
|
||||||
|
#define DEFINE_PROP_DRIVE_IOTHREAD(_n, _s, _f) \
|
||||||
|
DEFINE_PROP(_n, _s, _f, qdev_prop_drive_iothread, BlockBackend *)
|
||||||
|
#define DEFINE_PROP_MACADDR(_n, _s, _f) \
|
||||||
|
DEFINE_PROP(_n, _s, _f, qdev_prop_macaddr, MACAddr)
|
||||||
|
#define DEFINE_PROP_RESERVED_REGION(_n, _s, _f) \
|
||||||
|
DEFINE_PROP(_n, _s, _f, qdev_prop_reserved_region, ReservedRegion)
|
||||||
|
#define DEFINE_PROP_MULTIFD_COMPRESSION(_n, _s, _f, _d) \
|
||||||
|
DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_multifd_compression, \
|
||||||
|
MultiFDCompression)
|
||||||
|
#define DEFINE_PROP_LOSTTICKPOLICY(_n, _s, _f, _d) \
|
||||||
|
DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_losttickpolicy, \
|
||||||
|
LostTickPolicy)
|
||||||
|
#define DEFINE_PROP_BLOCKDEV_ON_ERROR(_n, _s, _f, _d) \
|
||||||
|
DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_blockdev_on_error, \
|
||||||
|
BlockdevOnError)
|
||||||
|
#define DEFINE_PROP_BIOS_CHS_TRANS(_n, _s, _f, _d) \
|
||||||
|
DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_bios_chs_trans, int)
|
||||||
|
#define DEFINE_PROP_BLOCKSIZE(_n, _s, _f) \
|
||||||
|
DEFINE_PROP_UNSIGNED(_n, _s, _f, 0, qdev_prop_blocksize, uint32_t)
|
||||||
|
#define DEFINE_PROP_PCI_HOST_DEVADDR(_n, _s, _f) \
|
||||||
|
DEFINE_PROP(_n, _s, _f, qdev_prop_pci_host_devaddr, PCIHostDeviceAddress)
|
||||||
|
#define DEFINE_PROP_OFF_AUTO_PCIBAR(_n, _s, _f, _d) \
|
||||||
|
DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_off_auto_pcibar, \
|
||||||
|
OffAutoPCIBAR)
|
||||||
|
#define DEFINE_PROP_PCIE_LINK_SPEED(_n, _s, _f, _d) \
|
||||||
|
DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_pcie_link_speed, \
|
||||||
|
PCIExpLinkSpeed)
|
||||||
|
#define DEFINE_PROP_PCIE_LINK_WIDTH(_n, _s, _f, _d) \
|
||||||
|
DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_pcie_link_width, \
|
||||||
|
PCIExpLinkWidth)
|
||||||
|
|
||||||
|
#define DEFINE_PROP_UUID(_name, _state, _field) \
|
||||||
|
DEFINE_PROP(_name, _state, _field, qdev_prop_uuid, QemuUUID, \
|
||||||
|
.set_default = true)
|
||||||
|
|
||||||
|
#define DEFINE_PROP_AUDIODEV(_n, _s, _f) \
|
||||||
|
DEFINE_PROP(_n, _s, _f, qdev_prop_audiodev, QEMUSoundCard)
|
||||||
|
|
||||||
|
#define DEFINE_PROP_UUID_NODEFAULT(_name, _state, _field) \
|
||||||
|
DEFINE_PROP(_name, _state, _field, qdev_prop_uuid, QemuUUID)
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
|
@ -34,7 +34,8 @@ struct PropertyInfo {
|
||||||
const QEnumLookup *enum_table;
|
const QEnumLookup *enum_table;
|
||||||
int (*print)(Object *obj, Property *prop, char *dest, size_t len);
|
int (*print)(Object *obj, Property *prop, char *dest, size_t len);
|
||||||
void (*set_default_value)(ObjectProperty *op, const Property *prop);
|
void (*set_default_value)(ObjectProperty *op, const Property *prop);
|
||||||
void (*create)(ObjectClass *oc, Property *prop);
|
ObjectProperty *(*create)(ObjectClass *oc, const char *name,
|
||||||
|
Property *prop);
|
||||||
ObjectPropertyAccessor *get;
|
ObjectPropertyAccessor *get;
|
||||||
ObjectPropertyAccessor *set;
|
ObjectPropertyAccessor *set;
|
||||||
ObjectPropertyRelease *release;
|
ObjectPropertyRelease *release;
|
||||||
|
@ -55,98 +56,51 @@ extern const PropertyInfo qdev_prop_uint64;
|
||||||
extern const PropertyInfo qdev_prop_int64;
|
extern const PropertyInfo qdev_prop_int64;
|
||||||
extern const PropertyInfo qdev_prop_size;
|
extern const PropertyInfo qdev_prop_size;
|
||||||
extern const PropertyInfo qdev_prop_string;
|
extern const PropertyInfo qdev_prop_string;
|
||||||
extern const PropertyInfo qdev_prop_chr;
|
|
||||||
extern const PropertyInfo qdev_prop_tpm;
|
|
||||||
extern const PropertyInfo qdev_prop_macaddr;
|
|
||||||
extern const PropertyInfo qdev_prop_reserved_region;
|
|
||||||
extern const PropertyInfo qdev_prop_on_off_auto;
|
extern const PropertyInfo qdev_prop_on_off_auto;
|
||||||
extern const PropertyInfo qdev_prop_multifd_compression;
|
|
||||||
extern const PropertyInfo qdev_prop_losttickpolicy;
|
|
||||||
extern const PropertyInfo qdev_prop_blockdev_on_error;
|
|
||||||
extern const PropertyInfo qdev_prop_bios_chs_trans;
|
|
||||||
extern const PropertyInfo qdev_prop_fdc_drive_type;
|
|
||||||
extern const PropertyInfo qdev_prop_drive;
|
|
||||||
extern const PropertyInfo qdev_prop_drive_iothread;
|
|
||||||
extern const PropertyInfo qdev_prop_netdev;
|
|
||||||
extern const PropertyInfo qdev_prop_pci_devfn;
|
|
||||||
extern const PropertyInfo qdev_prop_size32;
|
extern const PropertyInfo qdev_prop_size32;
|
||||||
extern const PropertyInfo qdev_prop_blocksize;
|
|
||||||
extern const PropertyInfo qdev_prop_pci_host_devaddr;
|
|
||||||
extern const PropertyInfo qdev_prop_uuid;
|
|
||||||
extern const PropertyInfo qdev_prop_arraylen;
|
extern const PropertyInfo qdev_prop_arraylen;
|
||||||
extern const PropertyInfo qdev_prop_audiodev;
|
|
||||||
extern const PropertyInfo qdev_prop_link;
|
extern const PropertyInfo qdev_prop_link;
|
||||||
extern const PropertyInfo qdev_prop_off_auto_pcibar;
|
|
||||||
extern const PropertyInfo qdev_prop_pcie_link_speed;
|
|
||||||
extern const PropertyInfo qdev_prop_pcie_link_width;
|
|
||||||
|
|
||||||
#define DEFINE_PROP(_name, _state, _field, _prop, _type) { \
|
#define DEFINE_PROP(_name, _state, _field, _prop, _type, ...) { \
|
||||||
.name = (_name), \
|
.name = (_name), \
|
||||||
.info = &(_prop), \
|
.info = &(_prop), \
|
||||||
.offset = offsetof(_state, _field) \
|
.offset = offsetof(_state, _field) \
|
||||||
+ type_check(_type, typeof_field(_state, _field)), \
|
+ type_check(_type, typeof_field(_state, _field)), \
|
||||||
|
__VA_ARGS__ \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DEFINE_PROP_SIGNED(_name, _state, _field, _defval, _prop, _type) { \
|
#define DEFINE_PROP_SIGNED(_name, _state, _field, _defval, _prop, _type) \
|
||||||
.name = (_name), \
|
DEFINE_PROP(_name, _state, _field, _prop, _type, \
|
||||||
.info = &(_prop), \
|
|
||||||
.offset = offsetof(_state, _field) \
|
|
||||||
+ type_check(_type,typeof_field(_state, _field)), \
|
|
||||||
.set_default = true, \
|
.set_default = true, \
|
||||||
.defval.i = (_type)_defval, \
|
.defval.i = (_type)_defval)
|
||||||
}
|
|
||||||
|
|
||||||
#define DEFINE_PROP_SIGNED_NODEFAULT(_name, _state, _field, _prop, _type) { \
|
#define DEFINE_PROP_SIGNED_NODEFAULT(_name, _state, _field, _prop, _type) \
|
||||||
.name = (_name), \
|
DEFINE_PROP(_name, _state, _field, _prop, _type)
|
||||||
.info = &(_prop), \
|
|
||||||
.offset = offsetof(_state, _field) \
|
|
||||||
+ type_check(_type, typeof_field(_state, _field)), \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define DEFINE_PROP_BIT(_name, _state, _field, _bit, _defval) { \
|
#define DEFINE_PROP_BIT(_name, _state, _field, _bit, _defval) \
|
||||||
.name = (_name), \
|
DEFINE_PROP(_name, _state, _field, qdev_prop_bit, uint32_t, \
|
||||||
.info = &(qdev_prop_bit), \
|
|
||||||
.bitnr = (_bit), \
|
.bitnr = (_bit), \
|
||||||
.offset = offsetof(_state, _field) \
|
|
||||||
+ type_check(uint32_t,typeof_field(_state, _field)), \
|
|
||||||
.set_default = true, \
|
.set_default = true, \
|
||||||
.defval.u = (bool)_defval, \
|
.defval.u = (bool)_defval)
|
||||||
}
|
|
||||||
|
|
||||||
#define DEFINE_PROP_UNSIGNED(_name, _state, _field, _defval, _prop, _type) { \
|
#define DEFINE_PROP_UNSIGNED(_name, _state, _field, _defval, _prop, _type) \
|
||||||
.name = (_name), \
|
DEFINE_PROP(_name, _state, _field, _prop, _type, \
|
||||||
.info = &(_prop), \
|
|
||||||
.offset = offsetof(_state, _field) \
|
|
||||||
+ type_check(_type, typeof_field(_state, _field)), \
|
|
||||||
.set_default = true, \
|
.set_default = true, \
|
||||||
.defval.u = (_type)_defval, \
|
.defval.u = (_type)_defval)
|
||||||
}
|
|
||||||
|
|
||||||
#define DEFINE_PROP_UNSIGNED_NODEFAULT(_name, _state, _field, _prop, _type) { \
|
#define DEFINE_PROP_UNSIGNED_NODEFAULT(_name, _state, _field, _prop, _type) \
|
||||||
.name = (_name), \
|
DEFINE_PROP(_name, _state, _field, _prop, _type)
|
||||||
.info = &(_prop), \
|
|
||||||
.offset = offsetof(_state, _field) \
|
|
||||||
+ type_check(_type, typeof_field(_state, _field)), \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define DEFINE_PROP_BIT64(_name, _state, _field, _bit, _defval) { \
|
#define DEFINE_PROP_BIT64(_name, _state, _field, _bit, _defval) \
|
||||||
.name = (_name), \
|
DEFINE_PROP(_name, _state, _field, qdev_prop_bit64, uint64_t, \
|
||||||
.info = &(qdev_prop_bit64), \
|
|
||||||
.bitnr = (_bit), \
|
.bitnr = (_bit), \
|
||||||
.offset = offsetof(_state, _field) \
|
|
||||||
+ type_check(uint64_t, typeof_field(_state, _field)), \
|
|
||||||
.set_default = true, \
|
.set_default = true, \
|
||||||
.defval.u = (bool)_defval, \
|
.defval.u = (bool)_defval)
|
||||||
}
|
|
||||||
|
|
||||||
#define DEFINE_PROP_BOOL(_name, _state, _field, _defval) { \
|
#define DEFINE_PROP_BOOL(_name, _state, _field, _defval) \
|
||||||
.name = (_name), \
|
DEFINE_PROP(_name, _state, _field, qdev_prop_bool, bool, \
|
||||||
.info = &(qdev_prop_bool), \
|
|
||||||
.offset = offsetof(_state, _field) \
|
|
||||||
+ type_check(bool, typeof_field(_state, _field)), \
|
|
||||||
.set_default = true, \
|
.set_default = true, \
|
||||||
.defval.u = (bool)_defval, \
|
.defval.u = (bool)_defval)
|
||||||
}
|
|
||||||
|
|
||||||
#define PROP_ARRAY_LEN_PREFIX "len-"
|
#define PROP_ARRAY_LEN_PREFIX "len-"
|
||||||
|
|
||||||
|
@ -175,25 +129,18 @@ extern const PropertyInfo qdev_prop_pcie_link_width;
|
||||||
* @_arrayfield memory.
|
* @_arrayfield memory.
|
||||||
*/
|
*/
|
||||||
#define DEFINE_PROP_ARRAY(_name, _state, _field, \
|
#define DEFINE_PROP_ARRAY(_name, _state, _field, \
|
||||||
_arrayfield, _arrayprop, _arraytype) { \
|
_arrayfield, _arrayprop, _arraytype) \
|
||||||
.name = (PROP_ARRAY_LEN_PREFIX _name), \
|
DEFINE_PROP((PROP_ARRAY_LEN_PREFIX _name), \
|
||||||
.info = &(qdev_prop_arraylen), \
|
_state, _field, qdev_prop_arraylen, uint32_t, \
|
||||||
.set_default = true, \
|
.set_default = true, \
|
||||||
.defval.u = 0, \
|
.defval.u = 0, \
|
||||||
.offset = offsetof(_state, _field) \
|
|
||||||
+ type_check(uint32_t, typeof_field(_state, _field)), \
|
|
||||||
.arrayinfo = &(_arrayprop), \
|
.arrayinfo = &(_arrayprop), \
|
||||||
.arrayfieldsize = sizeof(_arraytype), \
|
.arrayfieldsize = sizeof(_arraytype), \
|
||||||
.arrayoffset = offsetof(_state, _arrayfield), \
|
.arrayoffset = offsetof(_state, _arrayfield))
|
||||||
}
|
|
||||||
|
|
||||||
#define DEFINE_PROP_LINK(_name, _state, _field, _type, _ptr_type) { \
|
#define DEFINE_PROP_LINK(_name, _state, _field, _type, _ptr_type) \
|
||||||
.name = (_name), \
|
DEFINE_PROP(_name, _state, _field, qdev_prop_link, _ptr_type, \
|
||||||
.info = &(qdev_prop_link), \
|
.link_type = _type)
|
||||||
.offset = offsetof(_state, _field) \
|
|
||||||
+ type_check(_ptr_type, typeof_field(_state, _field)), \
|
|
||||||
.link_type = _type, \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define DEFINE_PROP_UINT8(_n, _s, _f, _d) \
|
#define DEFINE_PROP_UINT8(_n, _s, _f, _d) \
|
||||||
DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_uint8, uint8_t)
|
DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_uint8, uint8_t)
|
||||||
|
@ -209,68 +156,12 @@ extern const PropertyInfo qdev_prop_pcie_link_width;
|
||||||
DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_int64, int64_t)
|
DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_int64, int64_t)
|
||||||
#define DEFINE_PROP_SIZE(_n, _s, _f, _d) \
|
#define DEFINE_PROP_SIZE(_n, _s, _f, _d) \
|
||||||
DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_size, uint64_t)
|
DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_size, uint64_t)
|
||||||
#define DEFINE_PROP_PCI_DEVFN(_n, _s, _f, _d) \
|
|
||||||
DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_pci_devfn, int32_t)
|
|
||||||
|
|
||||||
#define DEFINE_PROP_CHR(_n, _s, _f) \
|
|
||||||
DEFINE_PROP(_n, _s, _f, qdev_prop_chr, CharBackend)
|
|
||||||
#define DEFINE_PROP_STRING(_n, _s, _f) \
|
#define DEFINE_PROP_STRING(_n, _s, _f) \
|
||||||
DEFINE_PROP(_n, _s, _f, qdev_prop_string, char*)
|
DEFINE_PROP(_n, _s, _f, qdev_prop_string, char*)
|
||||||
#define DEFINE_PROP_NETDEV(_n, _s, _f) \
|
|
||||||
DEFINE_PROP(_n, _s, _f, qdev_prop_netdev, NICPeers)
|
|
||||||
#define DEFINE_PROP_DRIVE(_n, _s, _f) \
|
|
||||||
DEFINE_PROP(_n, _s, _f, qdev_prop_drive, BlockBackend *)
|
|
||||||
#define DEFINE_PROP_DRIVE_IOTHREAD(_n, _s, _f) \
|
|
||||||
DEFINE_PROP(_n, _s, _f, qdev_prop_drive_iothread, BlockBackend *)
|
|
||||||
#define DEFINE_PROP_MACADDR(_n, _s, _f) \
|
|
||||||
DEFINE_PROP(_n, _s, _f, qdev_prop_macaddr, MACAddr)
|
|
||||||
#define DEFINE_PROP_RESERVED_REGION(_n, _s, _f) \
|
|
||||||
DEFINE_PROP(_n, _s, _f, qdev_prop_reserved_region, ReservedRegion)
|
|
||||||
#define DEFINE_PROP_ON_OFF_AUTO(_n, _s, _f, _d) \
|
#define DEFINE_PROP_ON_OFF_AUTO(_n, _s, _f, _d) \
|
||||||
DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_on_off_auto, OnOffAuto)
|
DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_on_off_auto, OnOffAuto)
|
||||||
#define DEFINE_PROP_MULTIFD_COMPRESSION(_n, _s, _f, _d) \
|
|
||||||
DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_multifd_compression, \
|
|
||||||
MultiFDCompression)
|
|
||||||
#define DEFINE_PROP_LOSTTICKPOLICY(_n, _s, _f, _d) \
|
|
||||||
DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_losttickpolicy, \
|
|
||||||
LostTickPolicy)
|
|
||||||
#define DEFINE_PROP_BLOCKDEV_ON_ERROR(_n, _s, _f, _d) \
|
|
||||||
DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_blockdev_on_error, \
|
|
||||||
BlockdevOnError)
|
|
||||||
#define DEFINE_PROP_BIOS_CHS_TRANS(_n, _s, _f, _d) \
|
|
||||||
DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_bios_chs_trans, int)
|
|
||||||
#define DEFINE_PROP_SIZE32(_n, _s, _f, _d) \
|
#define DEFINE_PROP_SIZE32(_n, _s, _f, _d) \
|
||||||
DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_size32, uint32_t)
|
DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_size32, uint32_t)
|
||||||
#define DEFINE_PROP_BLOCKSIZE(_n, _s, _f) \
|
|
||||||
DEFINE_PROP_UNSIGNED(_n, _s, _f, 0, qdev_prop_blocksize, uint32_t)
|
|
||||||
#define DEFINE_PROP_PCI_HOST_DEVADDR(_n, _s, _f) \
|
|
||||||
DEFINE_PROP(_n, _s, _f, qdev_prop_pci_host_devaddr, PCIHostDeviceAddress)
|
|
||||||
#define DEFINE_PROP_OFF_AUTO_PCIBAR(_n, _s, _f, _d) \
|
|
||||||
DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_off_auto_pcibar, \
|
|
||||||
OffAutoPCIBAR)
|
|
||||||
#define DEFINE_PROP_PCIE_LINK_SPEED(_n, _s, _f, _d) \
|
|
||||||
DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_pcie_link_speed, \
|
|
||||||
PCIExpLinkSpeed)
|
|
||||||
#define DEFINE_PROP_PCIE_LINK_WIDTH(_n, _s, _f, _d) \
|
|
||||||
DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_pcie_link_width, \
|
|
||||||
PCIExpLinkWidth)
|
|
||||||
|
|
||||||
#define DEFINE_PROP_UUID(_name, _state, _field) { \
|
|
||||||
.name = (_name), \
|
|
||||||
.info = &qdev_prop_uuid, \
|
|
||||||
.offset = offsetof(_state, _field) \
|
|
||||||
+ type_check(QemuUUID, typeof_field(_state, _field)), \
|
|
||||||
.set_default = true, \
|
|
||||||
}
|
|
||||||
#define DEFINE_PROP_AUDIODEV(_n, _s, _f) \
|
|
||||||
DEFINE_PROP(_n, _s, _f, qdev_prop_audiodev, QEMUSoundCard)
|
|
||||||
|
|
||||||
#define DEFINE_PROP_UUID_NODEFAULT(_name, _state, _field) { \
|
|
||||||
.name = (_name), \
|
|
||||||
.info = &qdev_prop_uuid, \
|
|
||||||
.offset = offsetof(_state, _field) \
|
|
||||||
+ type_check(QemuUUID, typeof_field(_state, _field)), \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define DEFINE_PROP_END_OF_LIST() \
|
#define DEFINE_PROP_END_OF_LIST() \
|
||||||
{}
|
{}
|
||||||
|
@ -302,7 +193,7 @@ void qdev_prop_set_macaddr(DeviceState *dev, const char *name,
|
||||||
const uint8_t *value);
|
const uint8_t *value);
|
||||||
void qdev_prop_set_enum(DeviceState *dev, const char *name, int value);
|
void qdev_prop_set_enum(DeviceState *dev, const char *name, int value);
|
||||||
|
|
||||||
void *qdev_get_prop_ptr(Object *obj, Property *prop);
|
void *object_field_prop_ptr(Object *obj, Property *prop);
|
||||||
|
|
||||||
void qdev_prop_register_global(GlobalProperty *prop);
|
void qdev_prop_register_global(GlobalProperty *prop);
|
||||||
const GlobalProperty *qdev_find_global_prop(Object *obj,
|
const GlobalProperty *qdev_find_global_prop(Object *obj,
|
||||||
|
@ -310,7 +201,7 @@ const GlobalProperty *qdev_find_global_prop(Object *obj,
|
||||||
int qdev_prop_check_globals(void);
|
int qdev_prop_check_globals(void);
|
||||||
void qdev_prop_set_globals(DeviceState *dev);
|
void qdev_prop_set_globals(DeviceState *dev);
|
||||||
void error_set_from_qdev_prop_error(Error **errp, int ret, Object *obj,
|
void error_set_from_qdev_prop_error(Error **errp, int ret, Object *obj,
|
||||||
Property *prop, const char *value);
|
const char *name, const char *value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* qdev_property_add_static:
|
* qdev_property_add_static:
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "qemu/queue.h"
|
#include "qemu/queue.h"
|
||||||
#include "qapi/qapi-types-net.h"
|
#include "qapi/qapi-types-net.h"
|
||||||
#include "net/queue.h"
|
#include "net/queue.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
|
|
||||||
#define MAC_FMT "%02X:%02X:%02X:%02X:%02X:%02X"
|
#define MAC_FMT "%02X:%02X:%02X:%02X:%02X:%02X"
|
||||||
#define MAC_ARG(x) ((uint8_t *)(x))[0], ((uint8_t *)(x))[1], \
|
#define MAC_ARG(x) ((uint8_t *)(x))[0], ((uint8_t *)(x))[1], \
|
||||||
|
|
|
@ -52,6 +52,7 @@
|
||||||
#include "migration/colo.h"
|
#include "migration/colo.h"
|
||||||
#include "hw/boards.h"
|
#include "hw/boards.h"
|
||||||
#include "hw/qdev-properties.h"
|
#include "hw/qdev-properties.h"
|
||||||
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "monitor/monitor.h"
|
#include "monitor/monitor.h"
|
||||||
#include "net/announce.h"
|
#include "net/announce.h"
|
||||||
#include "qemu/queue.h"
|
#include "qemu/queue.h"
|
||||||
|
|
|
@ -798,17 +798,11 @@ static void sparc_get_nwindows(Object *obj, Visitor *v, const char *name,
|
||||||
static void sparc_set_nwindows(Object *obj, Visitor *v, const char *name,
|
static void sparc_set_nwindows(Object *obj, Visitor *v, const char *name,
|
||||||
void *opaque, Error **errp)
|
void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
DeviceState *dev = DEVICE(obj);
|
|
||||||
const int64_t min = MIN_NWINDOWS;
|
const int64_t min = MIN_NWINDOWS;
|
||||||
const int64_t max = MAX_NWINDOWS;
|
const int64_t max = MAX_NWINDOWS;
|
||||||
SPARCCPU *cpu = SPARC_CPU(obj);
|
SPARCCPU *cpu = SPARC_CPU(obj);
|
||||||
int64_t value;
|
int64_t value;
|
||||||
|
|
||||||
if (dev->realized) {
|
|
||||||
qdev_prop_set_after_realize(dev, name, errp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!visit_type_int(v, name, &value, errp)) {
|
if (!visit_type_int(v, name, &value, errp)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -848,7 +842,8 @@ static Property sparc_cpu_properties[] = {
|
||||||
qdev_prop_uint64, target_ulong),
|
qdev_prop_uint64, target_ulong),
|
||||||
DEFINE_PROP_UINT32("fpu-version", SPARCCPU, env.def.fpu_version, 0),
|
DEFINE_PROP_UINT32("fpu-version", SPARCCPU, env.def.fpu_version, 0),
|
||||||
DEFINE_PROP_UINT32("mmu-version", SPARCCPU, env.def.mmu_version, 0),
|
DEFINE_PROP_UINT32("mmu-version", SPARCCPU, env.def.mmu_version, 0),
|
||||||
{ .name = "nwindows", .info = &qdev_prop_nwindows },
|
DEFINE_PROP("nwindows", SPARCCPU, env.def.nwindows,
|
||||||
|
qdev_prop_nwindows, uint32_t),
|
||||||
DEFINE_PROP_END_OF_LIST()
|
DEFINE_PROP_END_OF_LIST()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue