|
@@ -1,6 +1,7 @@
|
|
#ifndef QDEV_CORE_H
|
|
#ifndef QDEV_CORE_H
|
|
#define QDEV_CORE_H
|
|
#define QDEV_CORE_H
|
|
|
|
|
|
|
|
+#include "qemu/atomic.h"
|
|
#include "qemu/queue.h"
|
|
#include "qemu/queue.h"
|
|
#include "qemu/bitmap.h"
|
|
#include "qemu/bitmap.h"
|
|
#include "qemu/rcu.h"
|
|
#include "qemu/rcu.h"
|
|
@@ -168,9 +169,6 @@ typedef struct {
|
|
|
|
|
|
/**
|
|
/**
|
|
* DeviceState:
|
|
* DeviceState:
|
|
- * @realized: Indicates whether the device has been fully constructed.
|
|
|
|
- * When accessed outside big qemu lock, must be accessed with
|
|
|
|
- * qatomic_load_acquire()
|
|
|
|
* @reset: ResettableState for the device; handled by Resettable interface.
|
|
* @reset: ResettableState for the device; handled by Resettable interface.
|
|
*
|
|
*
|
|
* This structure should not be accessed directly. We declare it here
|
|
* This structure should not be accessed directly. We declare it here
|
|
@@ -339,6 +337,19 @@ DeviceState *qdev_new(const char *name);
|
|
*/
|
|
*/
|
|
DeviceState *qdev_try_new(const char *name);
|
|
DeviceState *qdev_try_new(const char *name);
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * qdev_is_realized:
|
|
|
|
+ * @dev: The device to check.
|
|
|
|
+ *
|
|
|
|
+ * May be called outside big qemu lock.
|
|
|
|
+ *
|
|
|
|
+ * Returns: %true% if the device has been fully constructed, %false% otherwise.
|
|
|
|
+ */
|
|
|
|
+static inline bool qdev_is_realized(DeviceState *dev)
|
|
|
|
+{
|
|
|
|
+ return qatomic_load_acquire(&dev->realized);
|
|
|
|
+}
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* qdev_realize: Realize @dev.
|
|
* qdev_realize: Realize @dev.
|
|
* @dev: device to realize
|
|
* @dev: device to realize
|