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 + QOM queue, 2020-10-06 * QOM documentation fixes and cleanups (Eduardo Habkost) * user-mode: Prune build dependencies (Philippe Mathieu-Daudé) * qom: Improve error message (Philippe Mathieu-Daudé) * numa: hmat: require parent cache description before the next level one (Igor Mammedov) # gpg: Signature made Tue 06 Oct 2020 23:09:03 BST # gpg: using RSA key 5A322FD5ABC4D3DBACCFD1AA2807936F984DC5A6 # gpg: issuer "ehabkost@redhat.com" # gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>" [full] # Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF D1AA 2807 936F 984D C5A6 * remotes/ehabkost/tags/machine-next-pull-request: (21 commits) numa: hmat: require parent cache description before the next level one kernel-doc: Remove $decl_type='type name' hack memory: Explicitly tag doc comments for structs qom: Explicitly tag doc comments for typedefs and structs kernel-doc: Handle function typedefs without asterisks kernel-doc: Handle function typedefs that return pointers docs/devel/qom: Avoid long lines docs/devel/qom: Remove usage of <code> docs/devel/qom: Use *emphasis* for emphasis docs/devel/qom: Fix indentation of code blocks docs/devel/qom: Fix indentation of bulleted list qom: Fix DECLARE_*CHECKER documentation qom: Improve error message displayed with missing object properties hw/core/cpu: Add missing 'exec/cpu-common.h' include hw/core/qdev-properties: Extract system-mode specific properties hw/core/qdev-properties: Export some integer-related functions hw/core/qdev-properties: Export qdev_prop_enum hw/core/qdev-properties: Export enum-related functions hw/core/qdev-properties: Fix code style hw/core/qdev-properties: Use qemu_strtoul() in set_pci_host_devaddr() ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
+45
-42
@@ -8,9 +8,9 @@ The QEMU Object Model provides a framework for registering user creatable
|
||||
types and instantiating objects from those types. QOM provides the following
|
||||
features:
|
||||
|
||||
- System for dynamically registering types
|
||||
- Support for single-inheritance of types
|
||||
- Multiple inheritance of stateless interfaces
|
||||
- System for dynamically registering types
|
||||
- Support for single-inheritance of types
|
||||
- Multiple inheritance of stateless interfaces
|
||||
|
||||
.. code-block:: c
|
||||
:caption: Creating a minimal type
|
||||
@@ -174,17 +174,17 @@ dynamically cast it to an object that implements the interface.
|
||||
Methods
|
||||
=======
|
||||
|
||||
A <emphasis>method</emphasis> is a function within the namespace scope of
|
||||
A *method* is a function within the namespace scope of
|
||||
a class. It usually operates on the object instance by passing it as a
|
||||
strongly-typed first argument.
|
||||
If it does not operate on an object instance, it is dubbed
|
||||
<emphasis>class method</emphasis>.
|
||||
*class method*.
|
||||
|
||||
Methods cannot be overloaded. That is, the #ObjectClass and method name
|
||||
uniquely identity the function to be called; the signature does not vary
|
||||
except for trailing varargs.
|
||||
|
||||
Methods are always <emphasis>virtual</emphasis>. Overriding a method in
|
||||
Methods are always *virtual*. Overriding a method in
|
||||
#TypeInfo.class_init of a subclass leads to any user of the class obtained
|
||||
via OBJECT_GET_CLASS() accessing the overridden function.
|
||||
The original function is not automatically invoked. It is the responsibility
|
||||
@@ -284,28 +284,29 @@ in the header file:
|
||||
.. code-block:: c
|
||||
:caption: Declaring a simple type
|
||||
|
||||
OBJECT_DECLARE_SIMPLE_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE)
|
||||
OBJECT_DECLARE_SIMPLE_TYPE(MyDevice, my_device,
|
||||
MY_DEVICE, DEVICE)
|
||||
|
||||
This is equivalent to the following:
|
||||
|
||||
.. code-block:: c
|
||||
:caption: Expansion from declaring a simple type
|
||||
|
||||
typedef struct MyDevice MyDevice;
|
||||
typedef struct MyDeviceClass MyDeviceClass;
|
||||
typedef struct MyDevice MyDevice;
|
||||
typedef struct MyDeviceClass MyDeviceClass;
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(MyDeviceClass, object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(MyDeviceClass, object_unref)
|
||||
|
||||
#define MY_DEVICE_GET_CLASS(void *obj) \
|
||||
OBJECT_GET_CLASS(MyDeviceClass, obj, TYPE_MY_DEVICE)
|
||||
#define MY_DEVICE_CLASS(void *klass) \
|
||||
OBJECT_CLASS_CHECK(MyDeviceClass, klass, TYPE_MY_DEVICE)
|
||||
#define MY_DEVICE(void *obj)
|
||||
OBJECT_CHECK(MyDevice, obj, TYPE_MY_DEVICE)
|
||||
#define MY_DEVICE_GET_CLASS(void *obj) \
|
||||
OBJECT_GET_CLASS(MyDeviceClass, obj, TYPE_MY_DEVICE)
|
||||
#define MY_DEVICE_CLASS(void *klass) \
|
||||
OBJECT_CLASS_CHECK(MyDeviceClass, klass, TYPE_MY_DEVICE)
|
||||
#define MY_DEVICE(void *obj)
|
||||
OBJECT_CHECK(MyDevice, obj, TYPE_MY_DEVICE)
|
||||
|
||||
struct MyDeviceClass {
|
||||
DeviceClass parent_class;
|
||||
};
|
||||
struct MyDeviceClass {
|
||||
DeviceClass parent_class;
|
||||
};
|
||||
|
||||
The 'struct MyDevice' needs to be declared separately.
|
||||
If the type requires virtual functions to be declared in the class
|
||||
@@ -319,33 +320,33 @@ In the simple case the OBJECT_DEFINE_TYPE macro is suitable:
|
||||
.. code-block:: c
|
||||
:caption: Defining a simple type
|
||||
|
||||
OBJECT_DEFINE_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE)
|
||||
OBJECT_DEFINE_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE)
|
||||
|
||||
This is equivalent to the following:
|
||||
|
||||
.. code-block:: c
|
||||
:caption: Expansion from defining a simple type
|
||||
|
||||
static void my_device_finalize(Object *obj);
|
||||
static void my_device_class_init(ObjectClass *oc, void *data);
|
||||
static void my_device_init(Object *obj);
|
||||
static void my_device_finalize(Object *obj);
|
||||
static void my_device_class_init(ObjectClass *oc, void *data);
|
||||
static void my_device_init(Object *obj);
|
||||
|
||||
static const TypeInfo my_device_info = {
|
||||
.parent = TYPE_DEVICE,
|
||||
.name = TYPE_MY_DEVICE,
|
||||
.instance_size = sizeof(MyDevice),
|
||||
.instance_init = my_device_init,
|
||||
.instance_finalize = my_device_finalize,
|
||||
.class_size = sizeof(MyDeviceClass),
|
||||
.class_init = my_device_class_init,
|
||||
};
|
||||
static const TypeInfo my_device_info = {
|
||||
.parent = TYPE_DEVICE,
|
||||
.name = TYPE_MY_DEVICE,
|
||||
.instance_size = sizeof(MyDevice),
|
||||
.instance_init = my_device_init,
|
||||
.instance_finalize = my_device_finalize,
|
||||
.class_size = sizeof(MyDeviceClass),
|
||||
.class_init = my_device_class_init,
|
||||
};
|
||||
|
||||
static void
|
||||
my_device_register_types(void)
|
||||
{
|
||||
type_register_static(&my_device_info);
|
||||
}
|
||||
type_init(my_device_register_types);
|
||||
static void
|
||||
my_device_register_types(void)
|
||||
{
|
||||
type_register_static(&my_device_info);
|
||||
}
|
||||
type_init(my_device_register_types);
|
||||
|
||||
This is sufficient to get the type registered with the type
|
||||
system, and the three standard methods now need to be implemented
|
||||
@@ -358,9 +359,10 @@ This accepts an array of interface type names.
|
||||
.. code-block:: c
|
||||
:caption: Defining a simple type implementing interfaces
|
||||
|
||||
OBJECT_DEFINE_TYPE_WITH_INTERFACES(MyDevice, my_device,
|
||||
MY_DEVICE, DEVICE,
|
||||
{ TYPE_USER_CREATABLE }, { NULL })
|
||||
OBJECT_DEFINE_TYPE_WITH_INTERFACES(MyDevice, my_device,
|
||||
MY_DEVICE, DEVICE,
|
||||
{ TYPE_USER_CREATABLE },
|
||||
{ NULL })
|
||||
|
||||
If the type is not intended to be instantiated, then then
|
||||
the OBJECT_DEFINE_ABSTRACT_TYPE() macro can be used instead:
|
||||
@@ -368,7 +370,8 @@ the OBJECT_DEFINE_ABSTRACT_TYPE() macro can be used instead:
|
||||
.. code-block:: c
|
||||
:caption: Defining a simple abstract type
|
||||
|
||||
OBJECT_DEFINE_ABSTRACT_TYPE(MyDevice, my_device, MY_DEVICE, DEVICE)
|
||||
OBJECT_DEFINE_ABSTRACT_TYPE(MyDevice, my_device,
|
||||
MY_DEVICE, DEVICE)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "qemu/log.h"
|
||||
#include "qemu/main-loop.h"
|
||||
#include "exec/log.h"
|
||||
#include "exec/cpu-common.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/qemu-print.h"
|
||||
#include "sysemu/tcg.h"
|
||||
|
||||
+7
-1
@@ -424,7 +424,13 @@ void parse_numa_hmat_cache(MachineState *ms, NumaHmatCacheOptions *node,
|
||||
}
|
||||
|
||||
if ((node->level > 1) &&
|
||||
ms->numa_state->hmat_cache[node->node_id][node->level - 1] &&
|
||||
ms->numa_state->hmat_cache[node->node_id][node->level - 1] == NULL) {
|
||||
error_setg(errp, "Cache level=%u shall be defined first",
|
||||
node->level - 1);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((node->level > 1) &&
|
||||
(node->size <=
|
||||
ms->numa_state->hmat_cache[node->node_id][node->level - 1]->size)) {
|
||||
error_setg(errp, "Invalid size=%" PRIu64 ", the size of level=%" PRIu8
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* qdev property parsing
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
||||
* See the COPYING file in the top-level directory.
|
||||
*/
|
||||
|
||||
#ifndef HW_CORE_QDEV_PROP_INTERNAL_H
|
||||
#define HW_CORE_QDEV_PROP_INTERNAL_H
|
||||
|
||||
void qdev_propinfo_get_enum(Object *obj, Visitor *v, const char *name,
|
||||
void *opaque, Error **errp);
|
||||
void qdev_propinfo_set_enum(Object *obj, Visitor *v, const char *name,
|
||||
void *opaque, Error **errp);
|
||||
|
||||
void qdev_propinfo_set_default_value_enum(ObjectProperty *op,
|
||||
const Property *prop);
|
||||
void qdev_propinfo_set_default_value_int(ObjectProperty *op,
|
||||
const Property *prop);
|
||||
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,
|
||||
void *opaque, Error **errp);
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
+39
-696
File diff suppressed because it is too large
Load Diff
@@ -443,7 +443,7 @@ struct IOMMUMemoryRegion {
|
||||
QLIST_FOREACH((n), &(mr)->iommu_notify, node)
|
||||
|
||||
/**
|
||||
* MemoryListener: callbacks structure for updates to the physical memory map
|
||||
* struct MemoryListener: callbacks structure for updates to the physical memory map
|
||||
*
|
||||
* Allows a component to adjust to changes in the guest-visible memory map.
|
||||
* Use with memory_listener_register() and memory_listener_unregister().
|
||||
@@ -681,7 +681,7 @@ struct MemoryListener {
|
||||
};
|
||||
|
||||
/**
|
||||
* AddressSpace: describes a mapping of addresses to #MemoryRegion objects
|
||||
* struct AddressSpace: describes a mapping of addresses to #MemoryRegion objects
|
||||
*/
|
||||
struct AddressSpace {
|
||||
/* private: */
|
||||
@@ -721,7 +721,7 @@ static inline FlatView *address_space_to_flatview(AddressSpace *as)
|
||||
|
||||
|
||||
/**
|
||||
* MemoryRegionSection: describes a fragment of a #MemoryRegion
|
||||
* struct MemoryRegionSection: describes a fragment of a #MemoryRegion
|
||||
*
|
||||
* @mr: the region, or %NULL if empty
|
||||
* @fv: the flat view of the address space the region is mapped in
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
extern const PropertyInfo qdev_prop_bit;
|
||||
extern const PropertyInfo qdev_prop_bit64;
|
||||
extern const PropertyInfo qdev_prop_bool;
|
||||
extern const PropertyInfo qdev_prop_enum;
|
||||
extern const PropertyInfo qdev_prop_uint8;
|
||||
extern const PropertyInfo qdev_prop_uint16;
|
||||
extern const PropertyInfo qdev_prop_uint32;
|
||||
|
||||
+19
-19
@@ -31,7 +31,7 @@ typedef struct InterfaceInfo InterfaceInfo;
|
||||
typedef struct ObjectProperty ObjectProperty;
|
||||
|
||||
/**
|
||||
* ObjectPropertyAccessor:
|
||||
* typedef ObjectPropertyAccessor:
|
||||
* @obj: the object that owns the property
|
||||
* @v: the visitor that contains the property data
|
||||
* @name: the name of the property
|
||||
@@ -47,7 +47,7 @@ typedef void (ObjectPropertyAccessor)(Object *obj,
|
||||
Error **errp);
|
||||
|
||||
/**
|
||||
* ObjectPropertyResolve:
|
||||
* typedef ObjectPropertyResolve:
|
||||
* @obj: the object that owns the property
|
||||
* @opaque: the opaque registered with the property
|
||||
* @part: the name of the property
|
||||
@@ -66,7 +66,7 @@ typedef Object *(ObjectPropertyResolve)(Object *obj,
|
||||
const char *part);
|
||||
|
||||
/**
|
||||
* ObjectPropertyRelease:
|
||||
* typedef ObjectPropertyRelease:
|
||||
* @obj: the object that owns the property
|
||||
* @name: the name of the property
|
||||
* @opaque: the opaque registered with the property
|
||||
@@ -78,7 +78,7 @@ typedef void (ObjectPropertyRelease)(Object *obj,
|
||||
void *opaque);
|
||||
|
||||
/**
|
||||
* ObjectPropertyInit:
|
||||
* typedef ObjectPropertyInit:
|
||||
* @obj: the object that owns the property
|
||||
* @prop: the property to set
|
||||
*
|
||||
@@ -101,7 +101,7 @@ struct ObjectProperty
|
||||
};
|
||||
|
||||
/**
|
||||
* ObjectUnparent:
|
||||
* typedef ObjectUnparent:
|
||||
* @obj: the object that is being removed from the composition tree
|
||||
*
|
||||
* Called when an object is being removed from the QOM composition tree.
|
||||
@@ -110,7 +110,7 @@ struct ObjectProperty
|
||||
typedef void (ObjectUnparent)(Object *obj);
|
||||
|
||||
/**
|
||||
* ObjectFree:
|
||||
* typedef ObjectFree:
|
||||
* @obj: the object being freed
|
||||
*
|
||||
* Called when an object's last reference is removed.
|
||||
@@ -120,7 +120,7 @@ typedef void (ObjectFree)(void *obj);
|
||||
#define OBJECT_CLASS_CAST_CACHE 4
|
||||
|
||||
/**
|
||||
* ObjectClass:
|
||||
* struct ObjectClass:
|
||||
*
|
||||
* The base for all classes. The only thing that #ObjectClass contains is an
|
||||
* integer type handle.
|
||||
@@ -140,7 +140,7 @@ struct ObjectClass
|
||||
};
|
||||
|
||||
/**
|
||||
* Object:
|
||||
* struct Object:
|
||||
*
|
||||
* The base for all objects. The first member of this object is a pointer to
|
||||
* a #ObjectClass. Since C guarantees that the first member of a structure
|
||||
@@ -170,7 +170,7 @@ struct Object
|
||||
* Direct usage of this macro should be avoided, and the complete
|
||||
* OBJECT_DECLARE_TYPE macro is recommended instead.
|
||||
*
|
||||
* This macro will provide the three standard type cast functions for a
|
||||
* This macro will provide the instance type cast functions for a
|
||||
* QOM type.
|
||||
*/
|
||||
#define DECLARE_INSTANCE_CHECKER(InstanceType, OBJ_NAME, TYPENAME) \
|
||||
@@ -187,7 +187,7 @@ struct Object
|
||||
* Direct usage of this macro should be avoided, and the complete
|
||||
* OBJECT_DECLARE_TYPE macro is recommended instead.
|
||||
*
|
||||
* This macro will provide the three standard type cast functions for a
|
||||
* This macro will provide the class type cast functions for a
|
||||
* QOM type.
|
||||
*/
|
||||
#define DECLARE_CLASS_CHECKERS(ClassType, OBJ_NAME, TYPENAME) \
|
||||
@@ -370,7 +370,7 @@ struct Object
|
||||
true, { NULL })
|
||||
|
||||
/**
|
||||
* TypeInfo:
|
||||
* struct TypeInfo:
|
||||
* @name: The name of the type.
|
||||
* @parent: The name of the parent type.
|
||||
* @instance_size: The size of the object (derivative of #Object). If
|
||||
@@ -496,7 +496,7 @@ struct TypeInfo
|
||||
OBJECT_CLASS_CHECK(class, object_get_class(OBJECT(obj)), name)
|
||||
|
||||
/**
|
||||
* InterfaceInfo:
|
||||
* struct InterfaceInfo:
|
||||
* @type: The name of the interface.
|
||||
*
|
||||
* The information associated with an interface.
|
||||
@@ -506,7 +506,7 @@ struct InterfaceInfo {
|
||||
};
|
||||
|
||||
/**
|
||||
* InterfaceClass:
|
||||
* struct InterfaceClass:
|
||||
* @parent_class: the base class
|
||||
*
|
||||
* The class for all interfaces. Subclasses of this class should only add
|
||||
@@ -1256,7 +1256,7 @@ char *object_property_get_str(Object *obj, const char *name,
|
||||
* Writes an object's canonical path to a property.
|
||||
*
|
||||
* If the link property was created with
|
||||
* <code>OBJ_PROP_LINK_STRONG</code> bit, the old target object is
|
||||
* %OBJ_PROP_LINK_STRONG bit, the old target object is
|
||||
* unreferenced, and a reference is added to the new target object.
|
||||
*
|
||||
* Returns: %true on success, %false on failure.
|
||||
@@ -1603,16 +1603,16 @@ void object_property_allow_set_link(const Object *obj, const char *name,
|
||||
*
|
||||
* Links form the graph in the object model.
|
||||
*
|
||||
* The <code>@check()</code> callback is invoked when
|
||||
* The @check() callback is invoked when
|
||||
* object_property_set_link() is called and can raise an error to prevent the
|
||||
* link being set. If <code>@check</code> is NULL, the property is read-only
|
||||
* link being set. If @check is NULL, the property is read-only
|
||||
* and cannot be set.
|
||||
*
|
||||
* Ownership of the pointer that @child points to is transferred to the
|
||||
* link property. The reference count for <code>*@child</code> is
|
||||
* link property. The reference count for *@child is
|
||||
* managed by the property from after the function returns till the
|
||||
* property is deleted with object_property_del(). If the
|
||||
* <code>@flags</code> <code>OBJ_PROP_LINK_STRONG</code> bit is set,
|
||||
* @flags %OBJ_PROP_LINK_STRONG bit is set,
|
||||
* the reference count is decremented when the property is deleted or
|
||||
* modified.
|
||||
*
|
||||
@@ -1823,7 +1823,7 @@ ObjectProperty *object_class_property_add_uint64_ptr(ObjectClass *klass,
|
||||
* Add an alias for a property on an object. This function will add a property
|
||||
* of the same type as the forwarded property.
|
||||
*
|
||||
* The caller must ensure that <code>@target_obj</code> stays alive as long as
|
||||
* The caller must ensure that @target_obj stays alive as long as
|
||||
* this property exists. In the case of a child object or an alias on the same
|
||||
* object this will be the case. For aliases to other objects the caller is
|
||||
* responsible for taking a reference.
|
||||
|
||||
+2
-1
@@ -1291,7 +1291,8 @@ ObjectProperty *object_property_find_err(Object *obj, const char *name,
|
||||
{
|
||||
ObjectProperty *prop = object_property_find(obj, name);
|
||||
if (!prop) {
|
||||
error_setg(errp, "Property '.%s' not found", name);
|
||||
error_setg(errp, "Property '%s.%s' not found",
|
||||
object_get_typename(obj), name);
|
||||
}
|
||||
return prop;
|
||||
}
|
||||
|
||||
+3
-13
@@ -1064,14 +1064,6 @@ sub output_blockhead {
|
||||
sub dump_declaration($$) {
|
||||
no strict 'refs';
|
||||
my ($prototype, $file) = @_;
|
||||
if ($decl_type eq 'type name') {
|
||||
if ($prototype =~ /^(enum|struct|union)\s+/) {
|
||||
$decl_type = $1;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
my $func = "dump_" . $decl_type;
|
||||
&$func(@_);
|
||||
}
|
||||
@@ -1318,8 +1310,8 @@ sub dump_typedef($$) {
|
||||
$x =~ s@/\*.*?\*/@@gos; # strip comments.
|
||||
|
||||
# Parse function prototypes
|
||||
if ($x =~ /typedef\s+(\w+)\s*\(\*\s*(\w\S+)\s*\)\s*\((.*)\);/ ||
|
||||
$x =~ /typedef\s+(\w+)\s*(\w\S+)\s*\s*\((.*)\);/) {
|
||||
if ($x =~ /typedef\s+(\w+\s*\**)\s*\(\*?\s*(\w\S+)\s*\)\s*\((.*)\);/ ||
|
||||
$x =~ /typedef\s+(\w+\s*\**)\s*(\w\S+)\s*\s*\((.*)\);/) {
|
||||
|
||||
# Function typedefs
|
||||
$return_type = $1;
|
||||
@@ -1928,9 +1920,7 @@ sub process_name($$) {
|
||||
++$warnings;
|
||||
}
|
||||
|
||||
if ($identifier =~ m/^[A-Z]/) {
|
||||
$decl_type = 'type name';
|
||||
} elsif ($identifier =~ m/^struct\b/) {
|
||||
if ($identifier =~ m/^struct\b/) {
|
||||
$decl_type = 'struct';
|
||||
} elsif ($identifier =~ m/^union\b/) {
|
||||
$decl_type = 'union';
|
||||
|
||||
Reference in New Issue
Block a user