qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 02/19] hw/qdev: Introduce qdev_prop_set_link()


From: Mark Cave-Ayland
Subject: Re: [PATCH 02/19] hw/qdev: Introduce qdev_prop_set_link()
Date: Sun, 5 Feb 2023 22:53:02 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0

On 03/02/2023 18:08, Philippe Mathieu-Daudé wrote:

Introduce qdev_prop_set_link(), equivalent of
object_property_set_link() for QDev objects.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
  hw/core/qdev-properties.c    | 5 +++++
  include/hw/qdev-properties.h | 1 +
  2 files changed, 6 insertions(+)

diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index 9789a2f5de..46236b1542 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -694,6 +694,11 @@ void error_set_from_qdev_prop_error(Error **errp, int ret, 
Object *obj,
      }
  }
+void qdev_prop_set_link(DeviceState *dev, const char *name, Object *value)
+{
+    object_property_set_link(OBJECT(dev), name, value, &error_abort);
+}
+
  void qdev_prop_set_bit(DeviceState *dev, const char *name, bool value)
  {
      object_property_set_bool(OBJECT(dev), name, value, &error_abort);
diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h
index 21f399e9a3..c16dbefb2f 100644
--- a/include/hw/qdev-properties.h
+++ b/include/hw/qdev-properties.h
@@ -191,6 +191,7 @@ bool qdev_prop_set_drive_err(DeviceState *dev, const char 
*name,
   * Set properties between creation and realization.
   * @value must be valid.  Each property may be set at most once.
   */
+void qdev_prop_set_link(DeviceState *dev, const char *name, Object *value);
  void qdev_prop_set_bit(DeviceState *dev, const char *name, bool value);
  void qdev_prop_set_uint8(DeviceState *dev, const char *name, uint8_t value);
  void qdev_prop_set_uint16(DeviceState *dev, const char *name, uint16_t value);

A general comment from me on this one: my feeling is that the main difference between QOM properties and qdev properties is that qdev properties are exposed to the user (for example they appear in the output of "-device foo,help") compared to QOM properties which tend to be used internally.

Following this thinking I'd always envisaged that an implementation of qdev_prop_set_link() would also be exposed to command line users so that you could set link properties from the command line similar to this:

  -device lance,id=lance0 -device ledma,dma=lance0

Of course this won't work in its current form (we don't have implicit ids for in-built devices as a starting point), but it does fit in with the recent discussions re: building machines completely from scratch. Certainly it feels to me as if this should be clarified before going ahead with a full-scale conversion for link properties as per this and your other related series.


ATB,

Mark.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]