mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge remote-tracking branch 'remotes/ehabkost/tags/machine-next-pull-request' into staging
Machine queue, 2020-12-15 * qdev code cleanup * Convert some QOM instance properties to class properties * Update git URLs on MAINTAINERS # gpg: Signature made Tue 15 Dec 2020 15:18:47 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/tags/machine-next-pull-request: (25 commits) MAINTAINERS: Update my git repository URLs qdev: Move UUID property to qdev-properties-system.c qdev: Make qdev_propinfo_get_uint16() static qdev: Make error_set_from_qdev_prop_error() get Object* argument qdev: Make check_prop_still_unset() get Object* argument qdev: Make qdev_find_global_prop() get Object* argument qdev: Make qdev_get_prop_ptr() get Object* arg qdev: Make bit_prop_set() get Object* argument qdev: Make PropertyInfo.print method get Object* argument qdev: Don't use dev->id on set_size32() error message sparc: Check dev->realized at sparc_set_nwindows() qdev: Check dev->realized at set_size() qdev: Move property code to qdev-properties.[ch] cpu: Move cpu_common_props to hw/core/cpu.c cs4231: Get rid of empty property array netfilter: Use class properties netfilter: Reorder functions can_host: Use class properties arm/cpu64: Register "aarch64" as class property virt: Register "its" as class property ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
+3
-3
@@ -344,7 +344,7 @@ F: tests/tcg/x86_64/
|
||||
F: hw/i386/
|
||||
F: disas/i386.c
|
||||
F: docs/system/cpu-models-x86.rst.inc
|
||||
T: git https://github.com/ehabkost/qemu.git x86-next
|
||||
T: git https://gitlab.com/ehabkost/qemu.git x86-next
|
||||
|
||||
Xtensa TCG CPUs
|
||||
M: Max Filippov <jcmvbkbc@gmail.com>
|
||||
@@ -1557,7 +1557,7 @@ F: include/hw/boards.h
|
||||
F: include/hw/core/cpu.h
|
||||
F: include/hw/cpu/cluster.h
|
||||
F: include/sysemu/numa.h
|
||||
T: git https://github.com/ehabkost/qemu.git machine-next
|
||||
T: git https://gitlab.com/ehabkost/qemu.git machine-next
|
||||
|
||||
Xtensa Machines
|
||||
---------------
|
||||
@@ -2412,7 +2412,7 @@ M: Igor Mammedov <imammedo@redhat.com>
|
||||
S: Maintained
|
||||
F: backends/hostmem*.c
|
||||
F: include/sysemu/hostmem.h
|
||||
T: git https://github.com/ehabkost/qemu.git machine-next
|
||||
T: git https://gitlab.com/ehabkost/qemu.git machine-next
|
||||
|
||||
Cryptodev Backends
|
||||
M: Gonglei <arei.gonglei@huawei.com>
|
||||
|
||||
@@ -35,8 +35,7 @@
|
||||
static void get_tpm(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
TPMBackend **be = qdev_get_prop_ptr(dev, opaque);
|
||||
TPMBackend **be = qdev_get_prop_ptr(obj, opaque);
|
||||
char *p;
|
||||
|
||||
p = g_strdup(*be ? (*be)->id : "");
|
||||
@@ -49,7 +48,7 @@ static void set_tpm(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
Property *prop = opaque;
|
||||
TPMBackend *s, **be = qdev_get_prop_ptr(dev, prop);
|
||||
TPMBackend *s, **be = qdev_get_prop_ptr(obj, prop);
|
||||
char *str;
|
||||
|
||||
if (dev->realized) {
|
||||
@@ -73,9 +72,8 @@ static void set_tpm(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||
|
||||
static void release_tpm(Object *obj, const char *name, void *opaque)
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
Property *prop = opaque;
|
||||
TPMBackend **be = qdev_get_prop_ptr(dev, prop);
|
||||
TPMBackend **be = qdev_get_prop_ptr(obj, prop);
|
||||
|
||||
if (*be) {
|
||||
tpm_backend_reset(*be);
|
||||
|
||||
@@ -144,21 +144,6 @@ void cpu_exec_unrealizefn(CPUState *cpu)
|
||||
#endif
|
||||
}
|
||||
|
||||
Property cpu_common_props[] = {
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
/* Create a memory property for softmmu CPU object,
|
||||
* so users can wire up its memory. (This can't go in hw/core/cpu.c
|
||||
* because that file is compiled only once for both user-mode
|
||||
* and system builds.) The default if no link is set up is to use
|
||||
* the system address space.
|
||||
*/
|
||||
DEFINE_PROP_LINK("memory", CPUState, memory, TYPE_MEMORY_REGION,
|
||||
MemoryRegion *),
|
||||
#endif
|
||||
DEFINE_PROP_BOOL("start-powered-off", CPUState, start_powered_off, false),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
void cpu_exec_initfn(CPUState *cpu)
|
||||
{
|
||||
cpu->as = NULL;
|
||||
|
||||
+14
-11
@@ -756,11 +756,6 @@ static void vexpress_instance_init(Object *obj)
|
||||
|
||||
/* EL3 is enabled by default on vexpress */
|
||||
vms->secure = true;
|
||||
object_property_add_bool(obj, "secure", vexpress_get_secure,
|
||||
vexpress_set_secure);
|
||||
object_property_set_description(obj, "secure",
|
||||
"Set on/off to enable/disable the ARM "
|
||||
"Security Extensions (TrustZone)");
|
||||
}
|
||||
|
||||
static void vexpress_a15_instance_init(Object *obj)
|
||||
@@ -772,12 +767,6 @@ static void vexpress_a15_instance_init(Object *obj)
|
||||
* but can also be specifically set to on or off.
|
||||
*/
|
||||
vms->virt = true;
|
||||
object_property_add_bool(obj, "virtualization", vexpress_get_virt,
|
||||
vexpress_set_virt);
|
||||
object_property_set_description(obj, "virtualization",
|
||||
"Set on/off to enable/disable the ARM "
|
||||
"Virtualization Extensions "
|
||||
"(defaults to same as 'secure')");
|
||||
}
|
||||
|
||||
static void vexpress_a9_instance_init(Object *obj)
|
||||
@@ -797,6 +786,12 @@ static void vexpress_class_init(ObjectClass *oc, void *data)
|
||||
mc->max_cpus = 4;
|
||||
mc->ignore_memory_transaction_failures = true;
|
||||
mc->default_ram_id = "vexpress.highmem";
|
||||
|
||||
object_class_property_add_bool(oc, "secure", vexpress_get_secure,
|
||||
vexpress_set_secure);
|
||||
object_class_property_set_description(oc, "secure",
|
||||
"Set on/off to enable/disable the ARM "
|
||||
"Security Extensions (TrustZone)");
|
||||
}
|
||||
|
||||
static void vexpress_a9_class_init(ObjectClass *oc, void *data)
|
||||
@@ -819,6 +814,14 @@ static void vexpress_a15_class_init(ObjectClass *oc, void *data)
|
||||
mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a15");
|
||||
|
||||
vmc->daughterboard = &a15_daughterboard;
|
||||
|
||||
object_class_property_add_bool(oc, "virtualization", vexpress_get_virt,
|
||||
vexpress_set_virt);
|
||||
object_class_property_set_description(oc, "virtualization",
|
||||
"Set on/off to enable/disable the ARM "
|
||||
"Virtualization Extensions "
|
||||
"(defaults to same as 'secure')");
|
||||
|
||||
}
|
||||
|
||||
static const TypeInfo vexpress_info = {
|
||||
|
||||
+48
-40
@@ -2490,6 +2490,54 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
|
||||
NULL, NULL);
|
||||
object_class_property_set_description(oc, "acpi",
|
||||
"Enable ACPI");
|
||||
object_class_property_add_bool(oc, "secure", virt_get_secure,
|
||||
virt_set_secure);
|
||||
object_class_property_set_description(oc, "secure",
|
||||
"Set on/off to enable/disable the ARM "
|
||||
"Security Extensions (TrustZone)");
|
||||
|
||||
object_class_property_add_bool(oc, "virtualization", virt_get_virt,
|
||||
virt_set_virt);
|
||||
object_class_property_set_description(oc, "virtualization",
|
||||
"Set on/off to enable/disable emulating a "
|
||||
"guest CPU which implements the ARM "
|
||||
"Virtualization Extensions");
|
||||
|
||||
object_class_property_add_bool(oc, "highmem", virt_get_highmem,
|
||||
virt_set_highmem);
|
||||
object_class_property_set_description(oc, "highmem",
|
||||
"Set on/off to enable/disable using "
|
||||
"physical address space above 32 bits");
|
||||
|
||||
object_class_property_add_str(oc, "gic-version", virt_get_gic_version,
|
||||
virt_set_gic_version);
|
||||
object_class_property_set_description(oc, "gic-version",
|
||||
"Set GIC version. "
|
||||
"Valid values are 2, 3, host and max");
|
||||
|
||||
object_class_property_add_str(oc, "iommu", virt_get_iommu, virt_set_iommu);
|
||||
object_class_property_set_description(oc, "iommu",
|
||||
"Set the IOMMU type. "
|
||||
"Valid values are none and smmuv3");
|
||||
|
||||
object_class_property_add_bool(oc, "ras", virt_get_ras,
|
||||
virt_set_ras);
|
||||
object_class_property_set_description(oc, "ras",
|
||||
"Set on/off to enable/disable reporting host memory errors "
|
||||
"to a KVM guest using ACPI and guest external abort exceptions");
|
||||
|
||||
object_class_property_add_bool(oc, "mte", virt_get_mte, virt_set_mte);
|
||||
object_class_property_set_description(oc, "mte",
|
||||
"Set on/off to enable/disable emulating a "
|
||||
"guest CPU which implements the ARM "
|
||||
"Memory Tagging Extension");
|
||||
|
||||
object_class_property_add_bool(oc, "its", virt_get_its,
|
||||
virt_set_its);
|
||||
object_class_property_set_description(oc, "its",
|
||||
"Set on/off to enable/disable "
|
||||
"ITS instantiation");
|
||||
|
||||
}
|
||||
|
||||
static void virt_instance_init(Object *obj)
|
||||
@@ -2502,34 +2550,13 @@ static void virt_instance_init(Object *obj)
|
||||
* boot UEFI blobs which assume no TrustZone support.
|
||||
*/
|
||||
vms->secure = false;
|
||||
object_property_add_bool(obj, "secure", virt_get_secure,
|
||||
virt_set_secure);
|
||||
object_property_set_description(obj, "secure",
|
||||
"Set on/off to enable/disable the ARM "
|
||||
"Security Extensions (TrustZone)");
|
||||
|
||||
/* EL2 is also disabled by default, for similar reasons */
|
||||
vms->virt = false;
|
||||
object_property_add_bool(obj, "virtualization", virt_get_virt,
|
||||
virt_set_virt);
|
||||
object_property_set_description(obj, "virtualization",
|
||||
"Set on/off to enable/disable emulating a "
|
||||
"guest CPU which implements the ARM "
|
||||
"Virtualization Extensions");
|
||||
|
||||
/* High memory is enabled by default */
|
||||
vms->highmem = true;
|
||||
object_property_add_bool(obj, "highmem", virt_get_highmem,
|
||||
virt_set_highmem);
|
||||
object_property_set_description(obj, "highmem",
|
||||
"Set on/off to enable/disable using "
|
||||
"physical address space above 32 bits");
|
||||
vms->gic_version = VIRT_GIC_VERSION_NOSEL;
|
||||
object_property_add_str(obj, "gic-version", virt_get_gic_version,
|
||||
virt_set_gic_version);
|
||||
object_property_set_description(obj, "gic-version",
|
||||
"Set GIC version. "
|
||||
"Valid values are 2, 3, host and max");
|
||||
|
||||
vms->highmem_ecam = !vmc->no_highmem_ecam;
|
||||
|
||||
@@ -2538,35 +2565,16 @@ static void virt_instance_init(Object *obj)
|
||||
} else {
|
||||
/* Default allows ITS instantiation */
|
||||
vms->its = true;
|
||||
object_property_add_bool(obj, "its", virt_get_its,
|
||||
virt_set_its);
|
||||
object_property_set_description(obj, "its",
|
||||
"Set on/off to enable/disable "
|
||||
"ITS instantiation");
|
||||
}
|
||||
|
||||
/* Default disallows iommu instantiation */
|
||||
vms->iommu = VIRT_IOMMU_NONE;
|
||||
object_property_add_str(obj, "iommu", virt_get_iommu, virt_set_iommu);
|
||||
object_property_set_description(obj, "iommu",
|
||||
"Set the IOMMU type. "
|
||||
"Valid values are none and smmuv3");
|
||||
|
||||
/* Default disallows RAS instantiation */
|
||||
vms->ras = false;
|
||||
object_property_add_bool(obj, "ras", virt_get_ras,
|
||||
virt_set_ras);
|
||||
object_property_set_description(obj, "ras",
|
||||
"Set on/off to enable/disable reporting host memory errors "
|
||||
"to a KVM guest using ACPI and guest external abort exceptions");
|
||||
|
||||
/* MTE is disabled by default. */
|
||||
vms->mte = false;
|
||||
object_property_add_bool(obj, "mte", virt_get_mte, virt_set_mte);
|
||||
object_property_set_description(obj, "mte",
|
||||
"Set on/off to enable/disable emulating a "
|
||||
"guest CPU which implements the ARM "
|
||||
"Memory Tagging Extension");
|
||||
|
||||
vms->irqmap = a15irqmap;
|
||||
|
||||
|
||||
@@ -335,9 +335,8 @@ static char *disk_to_vbd_name(unsigned int disk)
|
||||
static void xen_block_get_vdev(Object *obj, Visitor *v, const char *name,
|
||||
void *opaque, Error **errp)
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
Property *prop = opaque;
|
||||
XenBlockVdev *vdev = qdev_get_prop_ptr(dev, prop);
|
||||
XenBlockVdev *vdev = qdev_get_prop_ptr(obj, prop);
|
||||
char *str;
|
||||
|
||||
switch (vdev->type) {
|
||||
@@ -398,7 +397,7 @@ static void xen_block_set_vdev(Object *obj, Visitor *v, const char *name,
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
Property *prop = opaque;
|
||||
XenBlockVdev *vdev = qdev_get_prop_ptr(dev, prop);
|
||||
XenBlockVdev *vdev = qdev_get_prop_ptr(obj, prop);
|
||||
char *str, *p;
|
||||
const char *end;
|
||||
|
||||
|
||||
@@ -393,6 +393,21 @@ static vaddr cpu_adjust_watchpoint_address(CPUState *cpu, vaddr addr, int len)
|
||||
return addr;
|
||||
}
|
||||
|
||||
static Property cpu_common_props[] = {
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
/* Create a memory property for softmmu CPU object,
|
||||
* so users can wire up its memory. (This can't go in hw/core/cpu.c
|
||||
* because that file is compiled only once for both user-mode
|
||||
* and system builds.) The default if no link is set up is to use
|
||||
* the system address space.
|
||||
*/
|
||||
DEFINE_PROP_LINK("memory", CPUState, memory, TYPE_MEMORY_REGION,
|
||||
MemoryRegion *),
|
||||
#endif
|
||||
DEFINE_PROP_BOOL("start-powered-off", CPUState, start_powered_off, false),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
static void cpu_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
|
||||
@@ -20,8 +20,6 @@ void qdev_propinfo_set_default_value_int(ObjectProperty *op,
|
||||
void qdev_propinfo_set_default_value_uint(ObjectProperty *op,
|
||||
const Property *prop);
|
||||
|
||||
void qdev_propinfo_get_uint16(Object *obj, Visitor *v, const char *name,
|
||||
void *opaque, Error **errp);
|
||||
void qdev_propinfo_get_int32(Object *obj, Visitor *v, const char *name,
|
||||
void *opaque, Error **errp);
|
||||
void qdev_propinfo_get_size32(Object *obj, Visitor *v, const char *name,
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "qemu/ctype.h"
|
||||
#include "qemu/cutils.h"
|
||||
#include "qemu/units.h"
|
||||
#include "qemu/uuid.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qdev-prop-internal.h"
|
||||
|
||||
@@ -32,11 +33,11 @@
|
||||
#include "hw/pci/pci.h"
|
||||
#include "util/block-helpers.h"
|
||||
|
||||
static bool check_prop_still_unset(DeviceState *dev, const char *name,
|
||||
static bool check_prop_still_unset(Object *obj, const char *name,
|
||||
const void *old_val, const char *new_val,
|
||||
Error **errp)
|
||||
{
|
||||
const GlobalProperty *prop = qdev_find_global_prop(dev, name);
|
||||
const GlobalProperty *prop = qdev_find_global_prop(obj, name);
|
||||
|
||||
if (!old_val) {
|
||||
return true;
|
||||
@@ -59,9 +60,8 @@ static bool check_prop_still_unset(DeviceState *dev, const char *name,
|
||||
static void get_drive(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
Property *prop = opaque;
|
||||
void **ptr = qdev_get_prop_ptr(dev, prop);
|
||||
void **ptr = qdev_get_prop_ptr(obj, prop);
|
||||
const char *value;
|
||||
char *p;
|
||||
|
||||
@@ -87,7 +87,7 @@ static void set_drive_helper(Object *obj, Visitor *v, const char *name,
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
Property *prop = opaque;
|
||||
void **ptr = qdev_get_prop_ptr(dev, prop);
|
||||
void **ptr = qdev_get_prop_ptr(obj, prop);
|
||||
char *str;
|
||||
BlockBackend *blk;
|
||||
bool blk_created = false;
|
||||
@@ -106,7 +106,7 @@ static void set_drive_helper(Object *obj, Visitor *v, const char *name,
|
||||
* TODO Should this really be an error? If no, the old value
|
||||
* needs to be released before we store the new one.
|
||||
*/
|
||||
if (!check_prop_still_unset(dev, name, *ptr, str, errp)) {
|
||||
if (!check_prop_still_unset(obj, name, *ptr, str, errp)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ static void release_drive(Object *obj, const char *name, void *opaque)
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
Property *prop = opaque;
|
||||
BlockBackend **ptr = qdev_get_prop_ptr(dev, prop);
|
||||
BlockBackend **ptr = qdev_get_prop_ptr(obj, prop);
|
||||
|
||||
if (*ptr) {
|
||||
AioContext *ctx = blk_get_aio_context(*ptr);
|
||||
@@ -218,8 +218,7 @@ const PropertyInfo qdev_prop_drive_iothread = {
|
||||
static void get_chr(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
CharBackend *be = qdev_get_prop_ptr(dev, opaque);
|
||||
CharBackend *be = qdev_get_prop_ptr(obj, opaque);
|
||||
char *p;
|
||||
|
||||
p = g_strdup(be->chr && be->chr->label ? be->chr->label : "");
|
||||
@@ -232,7 +231,7 @@ static void set_chr(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
Property *prop = opaque;
|
||||
CharBackend *be = qdev_get_prop_ptr(dev, prop);
|
||||
CharBackend *be = qdev_get_prop_ptr(obj, prop);
|
||||
Chardev *s;
|
||||
char *str;
|
||||
|
||||
@@ -249,7 +248,7 @@ static void set_chr(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||
* TODO Should this really be an error? If no, the old value
|
||||
* needs to be released before we store the new one.
|
||||
*/
|
||||
if (!check_prop_still_unset(dev, name, be->chr, str, errp)) {
|
||||
if (!check_prop_still_unset(obj, name, be->chr, str, errp)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -272,9 +271,8 @@ static void set_chr(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||
|
||||
static void release_chr(Object *obj, const char *name, void *opaque)
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
Property *prop = opaque;
|
||||
CharBackend *be = qdev_get_prop_ptr(dev, prop);
|
||||
CharBackend *be = qdev_get_prop_ptr(obj, prop);
|
||||
|
||||
qemu_chr_fe_deinit(be, false);
|
||||
}
|
||||
@@ -297,9 +295,8 @@ const PropertyInfo qdev_prop_chr = {
|
||||
static void get_mac(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
Property *prop = opaque;
|
||||
MACAddr *mac = qdev_get_prop_ptr(dev, prop);
|
||||
MACAddr *mac = qdev_get_prop_ptr(obj, prop);
|
||||
char buffer[2 * 6 + 5 + 1];
|
||||
char *p = buffer;
|
||||
|
||||
@@ -315,7 +312,7 @@ static void set_mac(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
Property *prop = opaque;
|
||||
MACAddr *mac = qdev_get_prop_ptr(dev, prop);
|
||||
MACAddr *mac = qdev_get_prop_ptr(obj, prop);
|
||||
int i, pos;
|
||||
char *str;
|
||||
const char *p;
|
||||
@@ -356,7 +353,7 @@ static void set_mac(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||
return;
|
||||
|
||||
inval:
|
||||
error_set_from_qdev_prop_error(errp, EINVAL, dev, prop, str);
|
||||
error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str);
|
||||
g_free(str);
|
||||
}
|
||||
|
||||
@@ -381,9 +378,8 @@ void qdev_prop_set_macaddr(DeviceState *dev, const char *name,
|
||||
static void get_netdev(Object *obj, Visitor *v, const char *name,
|
||||
void *opaque, Error **errp)
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
Property *prop = opaque;
|
||||
NICPeers *peers_ptr = qdev_get_prop_ptr(dev, prop);
|
||||
NICPeers *peers_ptr = qdev_get_prop_ptr(obj, prop);
|
||||
char *p = g_strdup(peers_ptr->ncs[0] ? peers_ptr->ncs[0]->name : "");
|
||||
|
||||
visit_type_str(v, name, &p, errp);
|
||||
@@ -395,7 +391,7 @@ static void set_netdev(Object *obj, Visitor *v, const char *name,
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
Property *prop = opaque;
|
||||
NICPeers *peers_ptr = qdev_get_prop_ptr(dev, prop);
|
||||
NICPeers *peers_ptr = qdev_get_prop_ptr(obj, prop);
|
||||
NetClientState **ncs = peers_ptr->ncs;
|
||||
NetClientState *peers[MAX_QUEUE_NUM];
|
||||
int queues, err = 0, i = 0;
|
||||
@@ -434,7 +430,7 @@ static void set_netdev(Object *obj, Visitor *v, const char *name,
|
||||
* TODO Should this really be an error? If no, the old value
|
||||
* needs to be released before we store the new one.
|
||||
*/
|
||||
if (!check_prop_still_unset(dev, name, ncs[i], str, errp)) {
|
||||
if (!check_prop_still_unset(obj, name, ncs[i], str, errp)) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -445,7 +441,7 @@ static void set_netdev(Object *obj, Visitor *v, const char *name,
|
||||
peers_ptr->queues = queues;
|
||||
|
||||
out:
|
||||
error_set_from_qdev_prop_error(errp, err, dev, prop, str);
|
||||
error_set_from_qdev_prop_error(errp, err, obj, prop, str);
|
||||
g_free(str);
|
||||
}
|
||||
|
||||
@@ -461,9 +457,8 @@ const PropertyInfo qdev_prop_netdev = {
|
||||
static void get_audiodev(Object *obj, Visitor *v, const char* name,
|
||||
void *opaque, Error **errp)
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
Property *prop = opaque;
|
||||
QEMUSoundCard *card = qdev_get_prop_ptr(dev, prop);
|
||||
QEMUSoundCard *card = qdev_get_prop_ptr(obj, prop);
|
||||
char *p = g_strdup(audio_get_id(card));
|
||||
|
||||
visit_type_str(v, name, &p, errp);
|
||||
@@ -475,7 +470,7 @@ static void set_audiodev(Object *obj, Visitor *v, const char* name,
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
Property *prop = opaque;
|
||||
QEMUSoundCard *card = qdev_get_prop_ptr(dev, prop);
|
||||
QEMUSoundCard *card = qdev_get_prop_ptr(obj, prop);
|
||||
AudioState *state;
|
||||
int err = 0;
|
||||
char *str;
|
||||
@@ -498,7 +493,7 @@ static void set_audiodev(Object *obj, Visitor *v, const char* name,
|
||||
card->state = state;
|
||||
|
||||
out:
|
||||
error_set_from_qdev_prop_error(errp, err, dev, prop, str);
|
||||
error_set_from_qdev_prop_error(errp, err, obj, prop, str);
|
||||
g_free(str);
|
||||
}
|
||||
|
||||
@@ -582,7 +577,7 @@ static void set_blocksize(Object *obj, Visitor *v, const char *name,
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
Property *prop = opaque;
|
||||
uint32_t *ptr = qdev_get_prop_ptr(dev, prop);
|
||||
uint32_t *ptr = qdev_get_prop_ptr(obj, prop);
|
||||
uint64_t value;
|
||||
Error *local_err = NULL;
|
||||
|
||||
@@ -674,9 +669,8 @@ const PropertyInfo qdev_prop_multifd_compression = {
|
||||
static void get_reserved_region(Object *obj, Visitor *v, const char *name,
|
||||
void *opaque, Error **errp)
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
Property *prop = opaque;
|
||||
ReservedRegion *rr = qdev_get_prop_ptr(dev, prop);
|
||||
ReservedRegion *rr = qdev_get_prop_ptr(obj, prop);
|
||||
char buffer[64];
|
||||
char *p = buffer;
|
||||
int rc;
|
||||
@@ -693,7 +687,7 @@ static void set_reserved_region(Object *obj, Visitor *v, const char *name,
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
Property *prop = opaque;
|
||||
ReservedRegion *rr = qdev_get_prop_ptr(dev, prop);
|
||||
ReservedRegion *rr = qdev_get_prop_ptr(obj, prop);
|
||||
Error *local_err = NULL;
|
||||
const char *endptr;
|
||||
char *str;
|
||||
@@ -761,7 +755,7 @@ static void set_pci_devfn(Object *obj, Visitor *v, const char *name,
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
Property *prop = opaque;
|
||||
int32_t value, *ptr = qdev_get_prop_ptr(dev, prop);
|
||||
int32_t value, *ptr = qdev_get_prop_ptr(obj, prop);
|
||||
unsigned int slot, fn, n;
|
||||
char *str;
|
||||
|
||||
@@ -797,14 +791,14 @@ static void set_pci_devfn(Object *obj, Visitor *v, const char *name,
|
||||
return;
|
||||
|
||||
invalid:
|
||||
error_set_from_qdev_prop_error(errp, EINVAL, dev, prop, str);
|
||||
error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str);
|
||||
g_free(str);
|
||||
}
|
||||
|
||||
static int print_pci_devfn(DeviceState *dev, Property *prop, char *dest,
|
||||
static int print_pci_devfn(Object *obj, Property *prop, char *dest,
|
||||
size_t len)
|
||||
{
|
||||
int32_t *ptr = qdev_get_prop_ptr(dev, prop);
|
||||
int32_t *ptr = qdev_get_prop_ptr(obj, prop);
|
||||
|
||||
if (*ptr == -1) {
|
||||
return snprintf(dest, len, "<unset>");
|
||||
@@ -827,9 +821,8 @@ const PropertyInfo qdev_prop_pci_devfn = {
|
||||
static void get_pci_host_devaddr(Object *obj, Visitor *v, const char *name,
|
||||
void *opaque, Error **errp)
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
Property *prop = opaque;
|
||||
PCIHostDeviceAddress *addr = qdev_get_prop_ptr(dev, prop);
|
||||
PCIHostDeviceAddress *addr = qdev_get_prop_ptr(obj, prop);
|
||||
char buffer[] = "ffff:ff:ff.f";
|
||||
char *p = buffer;
|
||||
int rc = 0;
|
||||
@@ -856,7 +849,7 @@ static void set_pci_host_devaddr(Object *obj, Visitor *v, const char *name,
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
Property *prop = opaque;
|
||||
PCIHostDeviceAddress *addr = qdev_get_prop_ptr(dev, prop);
|
||||
PCIHostDeviceAddress *addr = qdev_get_prop_ptr(obj, prop);
|
||||
char *str, *p;
|
||||
char *e;
|
||||
unsigned long val;
|
||||
@@ -922,7 +915,7 @@ static void set_pci_host_devaddr(Object *obj, Visitor *v, const char *name,
|
||||
return;
|
||||
|
||||
inval:
|
||||
error_set_from_qdev_prop_error(errp, EINVAL, dev, prop, str);
|
||||
error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str);
|
||||
g_free(str);
|
||||
}
|
||||
|
||||
@@ -950,9 +943,8 @@ const PropertyInfo qdev_prop_off_auto_pcibar = {
|
||||
static void get_prop_pcielinkspeed(Object *obj, Visitor *v, const char *name,
|
||||
void *opaque, Error **errp)
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
Property *prop = opaque;
|
||||
PCIExpLinkSpeed *p = qdev_get_prop_ptr(dev, prop);
|
||||
PCIExpLinkSpeed *p = qdev_get_prop_ptr(obj, prop);
|
||||
int speed;
|
||||
|
||||
switch (*p) {
|
||||
@@ -981,7 +973,7 @@ static void set_prop_pcielinkspeed(Object *obj, Visitor *v, const char *name,
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
Property *prop = opaque;
|
||||
PCIExpLinkSpeed *p = qdev_get_prop_ptr(dev, prop);
|
||||
PCIExpLinkSpeed *p = qdev_get_prop_ptr(obj, prop);
|
||||
int speed;
|
||||
|
||||
if (dev->realized) {
|
||||
@@ -1027,9 +1019,8 @@ const PropertyInfo qdev_prop_pcie_link_speed = {
|
||||
static void get_prop_pcielinkwidth(Object *obj, Visitor *v, const char *name,
|
||||
void *opaque, Error **errp)
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
Property *prop = opaque;
|
||||
PCIExpLinkWidth *p = qdev_get_prop_ptr(dev, prop);
|
||||
PCIExpLinkWidth *p = qdev_get_prop_ptr(obj, prop);
|
||||
int width;
|
||||
|
||||
switch (*p) {
|
||||
@@ -1067,7 +1058,7 @@ static void set_prop_pcielinkwidth(Object *obj, Visitor *v, const char *name,
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
Property *prop = opaque;
|
||||
PCIExpLinkWidth *p = qdev_get_prop_ptr(dev, prop);
|
||||
PCIExpLinkWidth *p = qdev_get_prop_ptr(obj, prop);
|
||||
int width;
|
||||
|
||||
if (dev->realized) {
|
||||
@@ -1116,3 +1107,59 @@ const PropertyInfo qdev_prop_pcie_link_width = {
|
||||
.set = set_prop_pcielinkwidth,
|
||||
.set_default_value = qdev_propinfo_set_default_value_enum,
|
||||
};
|
||||
|
||||
/* --- UUID --- */
|
||||
|
||||
static void get_uuid(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
Property *prop = opaque;
|
||||
QemuUUID *uuid = qdev_get_prop_ptr(obj, prop);
|
||||
char buffer[UUID_FMT_LEN + 1];
|
||||
char *p = buffer;
|
||||
|
||||
qemu_uuid_unparse(uuid, buffer);
|
||||
|
||||
visit_type_str(v, name, &p, errp);
|
||||
}
|
||||
|
||||
#define UUID_VALUE_AUTO "auto"
|
||||
|
||||
static void set_uuid(Object *obj, Visitor *v, const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
Property *prop = opaque;
|
||||
QemuUUID *uuid = qdev_get_prop_ptr(obj, prop);
|
||||
char *str;
|
||||
|
||||
if (dev->realized) {
|
||||
qdev_prop_set_after_realize(dev, name, errp);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!visit_type_str(v, name, &str, errp)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strcmp(str, UUID_VALUE_AUTO)) {
|
||||
qemu_uuid_generate(uuid);
|
||||
} else if (qemu_uuid_parse(str, uuid) < 0) {
|
||||
error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str);
|
||||
}
|
||||
g_free(str);
|
||||
}
|
||||
|
||||
static void set_default_uuid_auto(ObjectProperty *op, const Property *prop)
|
||||
{
|
||||
object_property_set_default_str(op, UUID_VALUE_AUTO);
|
||||
}
|
||||
|
||||
const PropertyInfo qdev_prop_uuid = {
|
||||
.name = "str",
|
||||
.description = "UUID (aka GUID) or \"" UUID_VALUE_AUTO
|
||||
"\" for random value (default)",
|
||||
.get = get_uuid,
|
||||
.set = set_uuid,
|
||||
.set_default_value = set_default_uuid_auto,
|
||||
};
|
||||
|
||||
+169
-116
File diff suppressed because it is too large
Load Diff
-120
@@ -705,115 +705,6 @@ char *qdev_get_dev_path(DeviceState *dev)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Legacy property handling
|
||||
*/
|
||||
|
||||
static void qdev_get_legacy_property(Object *obj, Visitor *v,
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
Property *prop = opaque;
|
||||
|
||||
char buffer[1024];
|
||||
char *ptr = buffer;
|
||||
|
||||
prop->info->print(dev, prop, buffer, sizeof(buffer));
|
||||
visit_type_str(v, name, &ptr, errp);
|
||||
}
|
||||
|
||||
/**
|
||||
* qdev_class_add_legacy_property:
|
||||
* @dev: Device to add the property to.
|
||||
* @prop: The qdev property definition.
|
||||
*
|
||||
* Add a legacy QOM property to @dev for qdev property @prop.
|
||||
*
|
||||
* Legacy properties are string versions of QOM properties. The format of
|
||||
* the string depends on the property type. Legacy properties are only
|
||||
* needed for "info qtree".
|
||||
*
|
||||
* Do not use this in new code! QOM Properties added through this interface
|
||||
* will be given names in the "legacy" namespace.
|
||||
*/
|
||||
static void qdev_class_add_legacy_property(DeviceClass *dc, Property *prop)
|
||||
{
|
||||
g_autofree char *name = NULL;
|
||||
|
||||
/* Register pointer properties as legacy properties */
|
||||
if (!prop->info->print && prop->info->get) {
|
||||
return;
|
||||
}
|
||||
|
||||
name = g_strdup_printf("legacy-%s", prop->name);
|
||||
object_class_property_add(OBJECT_CLASS(dc), name, "str",
|
||||
prop->info->print ? qdev_get_legacy_property : prop->info->get,
|
||||
NULL, NULL, prop);
|
||||
}
|
||||
|
||||
void qdev_property_add_static(DeviceState *dev, Property *prop)
|
||||
{
|
||||
Object *obj = OBJECT(dev);
|
||||
ObjectProperty *op;
|
||||
|
||||
assert(!prop->info->create);
|
||||
|
||||
op = object_property_add(obj, prop->name, prop->info->name,
|
||||
prop->info->get, prop->info->set,
|
||||
prop->info->release,
|
||||
prop);
|
||||
|
||||
object_property_set_description(obj, prop->name,
|
||||
prop->info->description);
|
||||
|
||||
if (prop->set_default) {
|
||||
prop->info->set_default_value(op, prop);
|
||||
if (op->init) {
|
||||
op->init(obj, op);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void qdev_class_add_property(DeviceClass *klass, Property *prop)
|
||||
{
|
||||
ObjectClass *oc = OBJECT_CLASS(klass);
|
||||
|
||||
if (prop->info->create) {
|
||||
prop->info->create(oc, prop);
|
||||
} else {
|
||||
ObjectProperty *op;
|
||||
|
||||
op = object_class_property_add(oc,
|
||||
prop->name, prop->info->name,
|
||||
prop->info->get, prop->info->set,
|
||||
prop->info->release,
|
||||
prop);
|
||||
if (prop->set_default) {
|
||||
prop->info->set_default_value(op, prop);
|
||||
}
|
||||
}
|
||||
object_class_property_set_description(oc, prop->name,
|
||||
prop->info->description);
|
||||
}
|
||||
|
||||
void qdev_alias_all_properties(DeviceState *target, Object *source)
|
||||
{
|
||||
ObjectClass *class;
|
||||
Property *prop;
|
||||
|
||||
class = object_get_class(OBJECT(target));
|
||||
do {
|
||||
DeviceClass *dc = DEVICE_CLASS(class);
|
||||
|
||||
for (prop = dc->props_; prop && prop->name; prop++) {
|
||||
object_property_add_alias(source, prop->name,
|
||||
OBJECT(target), prop->name);
|
||||
}
|
||||
class = object_class_get_parent(class);
|
||||
} while (class != object_class_by_name(TYPE_DEVICE));
|
||||
}
|
||||
|
||||
static bool device_get_realized(Object *obj, Error **errp)
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
@@ -1208,17 +1099,6 @@ static void device_class_init(ObjectClass *class, void *data)
|
||||
offsetof(DeviceState, parent_bus), NULL, 0);
|
||||
}
|
||||
|
||||
void device_class_set_props(DeviceClass *dc, Property *props)
|
||||
{
|
||||
Property *prop;
|
||||
|
||||
dc->props_ = props;
|
||||
for (prop = props; prop && prop->name; prop++) {
|
||||
qdev_class_add_legacy_property(dc, prop);
|
||||
qdev_class_add_property(dc, prop);
|
||||
}
|
||||
}
|
||||
|
||||
void device_class_set_parent_reset(DeviceClass *dc,
|
||||
DeviceReset dev_reset,
|
||||
DeviceReset *parent_reset)
|
||||
|
||||
+13
-17
@@ -337,22 +337,6 @@ static void tmp421_realize(DeviceState *dev, Error **errp)
|
||||
tmp421_reset(&s->i2c);
|
||||
}
|
||||
|
||||
static void tmp421_initfn(Object *obj)
|
||||
{
|
||||
object_property_add(obj, "temperature0", "int",
|
||||
tmp421_get_temperature,
|
||||
tmp421_set_temperature, NULL, NULL);
|
||||
object_property_add(obj, "temperature1", "int",
|
||||
tmp421_get_temperature,
|
||||
tmp421_set_temperature, NULL, NULL);
|
||||
object_property_add(obj, "temperature2", "int",
|
||||
tmp421_get_temperature,
|
||||
tmp421_set_temperature, NULL, NULL);
|
||||
object_property_add(obj, "temperature3", "int",
|
||||
tmp421_get_temperature,
|
||||
tmp421_set_temperature, NULL, NULL);
|
||||
}
|
||||
|
||||
static void tmp421_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
@@ -365,6 +349,19 @@ static void tmp421_class_init(ObjectClass *klass, void *data)
|
||||
k->send = tmp421_tx;
|
||||
dc->vmsd = &vmstate_tmp421;
|
||||
sc->dev = (DeviceInfo *) data;
|
||||
|
||||
object_class_property_add(klass, "temperature0", "int",
|
||||
tmp421_get_temperature,
|
||||
tmp421_set_temperature, NULL, NULL);
|
||||
object_class_property_add(klass, "temperature1", "int",
|
||||
tmp421_get_temperature,
|
||||
tmp421_set_temperature, NULL, NULL);
|
||||
object_class_property_add(klass, "temperature2", "int",
|
||||
tmp421_get_temperature,
|
||||
tmp421_set_temperature, NULL, NULL);
|
||||
object_class_property_add(klass, "temperature3", "int",
|
||||
tmp421_get_temperature,
|
||||
tmp421_set_temperature, NULL, NULL);
|
||||
}
|
||||
|
||||
static const TypeInfo tmp421_info = {
|
||||
@@ -372,7 +369,6 @@ static const TypeInfo tmp421_info = {
|
||||
.parent = TYPE_I2C_SLAVE,
|
||||
.instance_size = sizeof(TMP421State),
|
||||
.class_size = sizeof(TMP421Class),
|
||||
.instance_init = tmp421_initfn,
|
||||
.abstract = true,
|
||||
};
|
||||
|
||||
|
||||
+3
-4
@@ -2343,9 +2343,8 @@ void css_reset(void)
|
||||
static void get_css_devid(Object *obj, Visitor *v, const char *name,
|
||||
void *opaque, Error **errp)
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
Property *prop = opaque;
|
||||
CssDevId *dev_id = qdev_get_prop_ptr(dev, prop);
|
||||
CssDevId *dev_id = qdev_get_prop_ptr(obj, prop);
|
||||
char buffer[] = "xx.x.xxxx";
|
||||
char *p = buffer;
|
||||
int r;
|
||||
@@ -2375,7 +2374,7 @@ static void set_css_devid(Object *obj, Visitor *v, const char *name,
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
Property *prop = opaque;
|
||||
CssDevId *dev_id = qdev_get_prop_ptr(dev, prop);
|
||||
CssDevId *dev_id = qdev_get_prop_ptr(obj, prop);
|
||||
char *str;
|
||||
int num, n1, n2;
|
||||
unsigned int cssid, ssid, devid;
|
||||
@@ -2391,7 +2390,7 @@ static void set_css_devid(Object *obj, Visitor *v, const char *name,
|
||||
|
||||
num = sscanf(str, "%2x.%1x%n.%4x%n", &cssid, &ssid, &n1, &devid, &n2);
|
||||
if (num != 3 || (n2 - n1) != 5 || strlen(str) != n2) {
|
||||
error_set_from_qdev_prop_error(errp, EINVAL, dev, prop, str);
|
||||
error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str);
|
||||
goto out;
|
||||
}
|
||||
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)
|
||||
{
|
||||
Property *prop = opaque;
|
||||
uint32_t *ptr = qdev_get_prop_ptr(DEVICE(obj), prop);
|
||||
uint32_t *ptr = qdev_get_prop_ptr(obj, prop);
|
||||
|
||||
visit_type_uint32(v, name, ptr, errp);
|
||||
}
|
||||
@@ -1341,7 +1341,7 @@ static void s390_pci_set_fid(Object *obj, Visitor *v, const char *name,
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
S390PCIBusDevice *zpci = S390_PCI_DEVICE(obj);
|
||||
Property *prop = opaque;
|
||||
uint32_t *ptr = qdev_get_prop_ptr(dev, prop);
|
||||
uint32_t *ptr = qdev_get_prop_ptr(obj, prop);
|
||||
|
||||
if (dev->realized) {
|
||||
qdev_prop_set_after_realize(dev, name, errp);
|
||||
|
||||
@@ -1488,9 +1488,8 @@ static void get_nv_gpudirect_clique_id(Object *obj, Visitor *v,
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
Property *prop = opaque;
|
||||
uint8_t *ptr = qdev_get_prop_ptr(dev, prop);
|
||||
uint8_t *ptr = qdev_get_prop_ptr(obj, prop);
|
||||
|
||||
visit_type_uint8(v, name, ptr, errp);
|
||||
}
|
||||
@@ -1501,7 +1500,7 @@ static void set_nv_gpudirect_clique_id(Object *obj, Visitor *v,
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
Property *prop = opaque;
|
||||
uint8_t value, *ptr = qdev_get_prop_ptr(dev, prop);
|
||||
uint8_t value, *ptr = qdev_get_prop_ptr(obj, prop);
|
||||
|
||||
if (dev->realized) {
|
||||
qdev_prop_set_after_realize(dev, name, errp);
|
||||
|
||||
@@ -1111,7 +1111,6 @@ AddressSpace *cpu_get_address_space(CPUState *cpu, int asidx);
|
||||
|
||||
void QEMU_NORETURN cpu_abort(CPUState *cpu, const char *fmt, ...)
|
||||
GCC_FMT_ATTR(2, 3);
|
||||
extern Property cpu_common_props[];
|
||||
void cpu_exec_initfn(CPUState *cpu);
|
||||
void cpu_exec_realizefn(CPUState *cpu, Error **errp);
|
||||
void cpu_exec_unrealizefn(CPUState *cpu);
|
||||
|
||||
@@ -276,43 +276,6 @@ struct BusState {
|
||||
ResettableState reset;
|
||||
};
|
||||
|
||||
/**
|
||||
* Property:
|
||||
* @set_default: true if the default value should be set from @defval,
|
||||
* in which case @info->set_default_value must not be NULL
|
||||
* (if false then no default value is set by the property system
|
||||
* and the field retains whatever value it was given by instance_init).
|
||||
* @defval: default value for the property. This is used only if @set_default
|
||||
* is true.
|
||||
*/
|
||||
struct Property {
|
||||
const char *name;
|
||||
const PropertyInfo *info;
|
||||
ptrdiff_t offset;
|
||||
uint8_t bitnr;
|
||||
bool set_default;
|
||||
union {
|
||||
int64_t i;
|
||||
uint64_t u;
|
||||
} defval;
|
||||
int arrayoffset;
|
||||
const PropertyInfo *arrayinfo;
|
||||
int arrayfieldsize;
|
||||
const char *link_type;
|
||||
};
|
||||
|
||||
struct PropertyInfo {
|
||||
const char *name;
|
||||
const char *description;
|
||||
const QEnumLookup *enum_table;
|
||||
int (*print)(DeviceState *dev, Property *prop, char *dest, size_t len);
|
||||
void (*set_default_value)(ObjectProperty *op, const Property *prop);
|
||||
void (*create)(ObjectClass *oc, Property *prop);
|
||||
ObjectPropertyAccessor *get;
|
||||
ObjectPropertyAccessor *set;
|
||||
ObjectPropertyRelease *release;
|
||||
};
|
||||
|
||||
/**
|
||||
* GlobalProperty:
|
||||
* @used: Set to true if property was used when initializing a device.
|
||||
|
||||
@@ -3,6 +3,44 @@
|
||||
|
||||
#include "hw/qdev-core.h"
|
||||
|
||||
/**
|
||||
* Property:
|
||||
* @set_default: true if the default value should be set from @defval,
|
||||
* in which case @info->set_default_value must not be NULL
|
||||
* (if false then no default value is set by the property system
|
||||
* and the field retains whatever value it was given by instance_init).
|
||||
* @defval: default value for the property. This is used only if @set_default
|
||||
* is true.
|
||||
*/
|
||||
struct Property {
|
||||
const char *name;
|
||||
const PropertyInfo *info;
|
||||
ptrdiff_t offset;
|
||||
uint8_t bitnr;
|
||||
bool set_default;
|
||||
union {
|
||||
int64_t i;
|
||||
uint64_t u;
|
||||
} defval;
|
||||
int arrayoffset;
|
||||
const PropertyInfo *arrayinfo;
|
||||
int arrayfieldsize;
|
||||
const char *link_type;
|
||||
};
|
||||
|
||||
struct PropertyInfo {
|
||||
const char *name;
|
||||
const char *description;
|
||||
const QEnumLookup *enum_table;
|
||||
int (*print)(Object *obj, Property *prop, char *dest, size_t len);
|
||||
void (*set_default_value)(ObjectProperty *op, const Property *prop);
|
||||
void (*create)(ObjectClass *oc, Property *prop);
|
||||
ObjectPropertyAccessor *get;
|
||||
ObjectPropertyAccessor *set;
|
||||
ObjectPropertyRelease *release;
|
||||
};
|
||||
|
||||
|
||||
/*** qdev-properties.c ***/
|
||||
|
||||
extern const PropertyInfo qdev_prop_bit;
|
||||
@@ -264,14 +302,14 @@ void qdev_prop_set_macaddr(DeviceState *dev, const char *name,
|
||||
const uint8_t *value);
|
||||
void qdev_prop_set_enum(DeviceState *dev, const char *name, int value);
|
||||
|
||||
void *qdev_get_prop_ptr(DeviceState *dev, Property *prop);
|
||||
void *qdev_get_prop_ptr(Object *obj, Property *prop);
|
||||
|
||||
void qdev_prop_register_global(GlobalProperty *prop);
|
||||
const GlobalProperty *qdev_find_global_prop(DeviceState *dev,
|
||||
const GlobalProperty *qdev_find_global_prop(Object *obj,
|
||||
const char *name);
|
||||
int qdev_prop_check_globals(void);
|
||||
void qdev_prop_set_globals(DeviceState *dev);
|
||||
void error_set_from_qdev_prop_error(Error **errp, int ret, DeviceState *dev,
|
||||
void error_set_from_qdev_prop_error(Error **errp, int ret, Object *obj,
|
||||
Property *prop, const char *value);
|
||||
|
||||
/**
|
||||
|
||||
+5
-11
@@ -77,21 +77,16 @@ static void can_host_complete(UserCreatable *uc, Error **errp)
|
||||
can_host_connect(CAN_HOST(uc), errp);
|
||||
}
|
||||
|
||||
static void can_host_instance_init(Object *obj)
|
||||
{
|
||||
CanHostState *ch = CAN_HOST(obj);
|
||||
|
||||
object_property_add_link(obj, "canbus", TYPE_CAN_BUS,
|
||||
(Object **)&ch->bus,
|
||||
object_property_allow_set_link,
|
||||
OBJ_PROP_LINK_STRONG);
|
||||
}
|
||||
|
||||
static void can_host_class_init(ObjectClass *klass,
|
||||
void *class_data G_GNUC_UNUSED)
|
||||
{
|
||||
UserCreatableClass *uc_klass = USER_CREATABLE_CLASS(klass);
|
||||
|
||||
object_class_property_add_link(klass, "canbus", TYPE_CAN_BUS,
|
||||
offsetof(CanHostState, bus),
|
||||
object_property_allow_set_link,
|
||||
OBJ_PROP_LINK_STRONG);
|
||||
|
||||
klass->unparent = can_host_unparent;
|
||||
uc_klass->complete = can_host_complete;
|
||||
}
|
||||
@@ -102,7 +97,6 @@ static const TypeInfo can_host_info = {
|
||||
.instance_size = sizeof(CanHostState),
|
||||
.class_size = sizeof(CanHostClass),
|
||||
.abstract = true,
|
||||
.instance_init = can_host_instance_init,
|
||||
.class_init = can_host_class_init,
|
||||
.interfaces = (InterfaceInfo[]) {
|
||||
{ TYPE_USER_CREATABLE },
|
||||
|
||||
+5
-5
@@ -224,11 +224,6 @@ static void filter_dump_instance_init(Object *obj)
|
||||
NetFilterDumpState *nfds = FILTER_DUMP(obj);
|
||||
|
||||
nfds->maxlen = 65536;
|
||||
|
||||
object_property_add(obj, "maxlen", "uint32", filter_dump_get_maxlen,
|
||||
filter_dump_set_maxlen, NULL, NULL);
|
||||
object_property_add_str(obj, "file", file_dump_get_filename,
|
||||
file_dump_set_filename);
|
||||
}
|
||||
|
||||
static void filter_dump_instance_finalize(Object *obj)
|
||||
@@ -242,6 +237,11 @@ static void filter_dump_class_init(ObjectClass *oc, void *data)
|
||||
{
|
||||
NetFilterClass *nfc = NETFILTER_CLASS(oc);
|
||||
|
||||
object_class_property_add(oc, "maxlen", "uint32", filter_dump_get_maxlen,
|
||||
filter_dump_set_maxlen, NULL, NULL);
|
||||
object_class_property_add_str(oc, "file", file_dump_get_filename,
|
||||
file_dump_set_filename);
|
||||
|
||||
nfc->setup = filter_dump_setup;
|
||||
nfc->cleanup = filter_dump_cleanup;
|
||||
nfc->receive_iov = filter_dump_receive_iov;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user