All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/24] qom: Convert some properties to class properties
@ 2020-09-21 22:10 Eduardo Habkost
  2020-09-21 22:10 ` [PATCH 01/24] cryptodev-vhost-user: Register "chardev" as class property Eduardo Habkost
                   ` (26 more replies)
  0 siblings, 27 replies; 67+ messages in thread
From: Eduardo Habkost @ 2020-09-21 22:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: John Snow, Paolo Bonzini, Daniel P. Berrange

Class properties make QOM introspection simpler and easier, as it
doesn't require an object to be instantiated.  This series
converts a few existing object_property_add*() calls to register
class properties instead.

Eduardo Habkost (24):
  cryptodev-vhost-user: Register "chardev" as class property
  cryptodev-backend: Register "chardev" as class property
  rng-egd: Register "chardev" as class property
  rng-random: register "filename" as class property
  vhost-user: Register "chardev" as class property
  vexpress: Register "secure" as class property
  rng: Register "opened" as class property
  vexpress-a15: Register "virtualization" as class property
  input-linux: Register properties as class properties
  input-barrier: Register properties as class properties
  tmp421: Register properties as class properties
  s390x: Register all CPU properties as class properties
  i386: Register most CPU properties as class properties
  i386: Register feature bit properties as class properties
  arm/virt: Register most properties as class properties
  virt: Register "its" as class property
  cpu/core: Register core-id and nr-threads as class properties
  arm/cpu64: Register "aarch64" as class property
  xlnx-zcu102: Register properties as class properties
  machine: Register "memory-backend" as class property
  vga-pci: Register "big-endian-framebuffer" as class property
  i440fx: Register i440FX-pcihost properties as class properties
  sifive_e: Register "revb" as class property
  sifive_u: Register "start-in-flash" as class property

 target/s390x/internal.h         |  1 -
 backends/cryptodev-vhost-user.c | 13 ++---
 backends/cryptodev.c            |  8 +--
 backends/rng-egd.c              |  9 +--
 backends/rng-random.c           |  8 +--
 backends/rng.c                  |  8 +--
 backends/vhost-user.c           |  6 +-
 hw/arm/vexpress.c               | 25 +++++----
 hw/arm/virt.c                   | 88 ++++++++++++++++-------------
 hw/arm/xlnx-zcu102.c            | 25 +++++----
 hw/core/machine.c               | 12 ++--
 hw/cpu/core.c                   |  8 +--
 hw/display/vga-pci.c            | 12 ++--
 hw/misc/tmp421.c                | 30 +++++-----
 hw/pci-host/i440fx.c            | 32 +++++------
 hw/riscv/sifive_e.c             | 11 ++--
 hw/riscv/sifive_u.c             | 16 +++---
 target/arm/cpu64.c              | 16 ++----
 target/i386/cpu.c               | 99 +++++++++++++++++----------------
 target/s390x/cpu.c              |  1 -
 target/s390x/cpu_models.c       | 35 ++++++------
 ui/input-barrier.c              | 44 +++++++--------
 ui/input-linux.c                | 27 ++++-----
 23 files changed, 262 insertions(+), 272 deletions(-)

-- 
2.26.2



^ permalink raw reply	[flat|nested] 67+ messages in thread

* [PATCH 01/24] cryptodev-vhost-user: Register "chardev" as class property
  2020-09-21 22:10 [PATCH 00/24] qom: Convert some properties to class properties Eduardo Habkost
@ 2020-09-21 22:10 ` Eduardo Habkost
  2020-09-22  1:27   ` Gonglei (Arei)
  2020-09-21 22:10 ` [PATCH 02/24] cryptodev-backend: " Eduardo Habkost
                   ` (25 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Eduardo Habkost @ 2020-09-21 22:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: John Snow, Paolo Bonzini, Gonglei (Arei), Daniel P. Berrange

Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: "Gonglei (Arei)" <arei.gonglei@huawei.com>
Cc: qemu-devel@nongnu.org
---
 backends/cryptodev-vhost-user.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/backends/cryptodev-vhost-user.c b/backends/cryptodev-vhost-user.c
index 41089dede15..690738c6c95 100644
--- a/backends/cryptodev-vhost-user.c
+++ b/backends/cryptodev-vhost-user.c
@@ -336,13 +336,6 @@ cryptodev_vhost_user_get_chardev(Object *obj, Error **errp)
     return NULL;
 }
 
-static void cryptodev_vhost_user_instance_int(Object *obj)
-{
-    object_property_add_str(obj, "chardev",
-                            cryptodev_vhost_user_get_chardev,
-                            cryptodev_vhost_user_set_chardev);
-}
-
 static void cryptodev_vhost_user_finalize(Object *obj)
 {
     CryptoDevBackendVhostUser *s =
@@ -363,13 +356,17 @@ cryptodev_vhost_user_class_init(ObjectClass *oc, void *data)
     bc->create_session = cryptodev_vhost_user_sym_create_session;
     bc->close_session = cryptodev_vhost_user_sym_close_session;
     bc->do_sym_op = NULL;
+
+    object_class_property_add_str(oc, "chardev",
+                                  cryptodev_vhost_user_get_chardev,
+                                  cryptodev_vhost_user_set_chardev);
+
 }
 
 static const TypeInfo cryptodev_vhost_user_info = {
     .name = TYPE_CRYPTODEV_BACKEND_VHOST_USER,
     .parent = TYPE_CRYPTODEV_BACKEND,
     .class_init = cryptodev_vhost_user_class_init,
-    .instance_init = cryptodev_vhost_user_instance_int,
     .instance_finalize = cryptodev_vhost_user_finalize,
     .instance_size = sizeof(CryptoDevBackendVhostUser),
 };
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 67+ messages in thread

* [PATCH 02/24] cryptodev-backend: Register "chardev" as class property
  2020-09-21 22:10 [PATCH 00/24] qom: Convert some properties to class properties Eduardo Habkost
  2020-09-21 22:10 ` [PATCH 01/24] cryptodev-vhost-user: Register "chardev" as class property Eduardo Habkost
@ 2020-09-21 22:10 ` Eduardo Habkost
  2020-09-22  1:27   ` Gonglei (Arei)
  2020-09-21 22:10 ` [PATCH 03/24] rng-egd: " Eduardo Habkost
                   ` (24 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Eduardo Habkost @ 2020-09-21 22:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: John Snow, Paolo Bonzini, Gonglei (Arei), Daniel P. Berrange

Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: "Gonglei (Arei)" <arei.gonglei@huawei.com>
Cc: qemu-devel@nongnu.org
---
 backends/cryptodev.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/backends/cryptodev.c b/backends/cryptodev.c
index ada4ebe78b1..3f141f61ed6 100644
--- a/backends/cryptodev.c
+++ b/backends/cryptodev.c
@@ -206,10 +206,6 @@ cryptodev_backend_can_be_deleted(UserCreatable *uc)
 
 static void cryptodev_backend_instance_init(Object *obj)
 {
-    object_property_add(obj, "queues", "uint32",
-                          cryptodev_backend_get_queues,
-                          cryptodev_backend_set_queues,
-                          NULL, NULL);
     /* Initialize devices' queues property to 1 */
     object_property_set_int(obj, "queues", 1, NULL);
 }
@@ -230,6 +226,10 @@ cryptodev_backend_class_init(ObjectClass *oc, void *data)
     ucc->can_be_deleted = cryptodev_backend_can_be_deleted;
 
     QTAILQ_INIT(&crypto_clients);
+    object_class_property_add(oc, "queues", "uint32",
+                              cryptodev_backend_get_queues,
+                              cryptodev_backend_set_queues,
+                              NULL, NULL);
 }
 
 static const TypeInfo cryptodev_backend_info = {
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 67+ messages in thread

* [PATCH 03/24] rng-egd: Register "chardev" as class property
  2020-09-21 22:10 [PATCH 00/24] qom: Convert some properties to class properties Eduardo Habkost
  2020-09-21 22:10 ` [PATCH 01/24] cryptodev-vhost-user: Register "chardev" as class property Eduardo Habkost
  2020-09-21 22:10 ` [PATCH 02/24] cryptodev-backend: " Eduardo Habkost
@ 2020-09-21 22:10 ` Eduardo Habkost
  2020-09-23  9:59   ` Daniel P. Berrangé
  2020-09-21 22:10 ` [PATCH 04/24] rng-random: register "filename" " Eduardo Habkost
                   ` (23 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Eduardo Habkost @ 2020-09-21 22:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: John Snow, Paolo Bonzini, Daniel P. Berrange, Laurent Vivier, Amit Shah

Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: Laurent Vivier <lvivier@redhat.com>
Cc: Amit Shah <amit@kernel.org>
Cc: qemu-devel@nongnu.org
---
 backends/rng-egd.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/backends/rng-egd.c b/backends/rng-egd.c
index d905fe657c5..d3a8b1ebe2a 100644
--- a/backends/rng-egd.c
+++ b/backends/rng-egd.c
@@ -137,12 +137,6 @@ static char *rng_egd_get_chardev(Object *obj, Error **errp)
     return NULL;
 }
 
-static void rng_egd_init(Object *obj)
-{
-    object_property_add_str(obj, "chardev",
-                            rng_egd_get_chardev, rng_egd_set_chardev);
-}
-
 static void rng_egd_finalize(Object *obj)
 {
     RngEgd *s = RNG_EGD(obj);
@@ -157,6 +151,8 @@ static void rng_egd_class_init(ObjectClass *klass, void *data)
 
     rbc->request_entropy = rng_egd_request_entropy;
     rbc->opened = rng_egd_opened;
+    object_class_property_add_str(klass, "chardev",
+                                  rng_egd_get_chardev, rng_egd_set_chardev);
 }
 
 static const TypeInfo rng_egd_info = {
@@ -164,7 +160,6 @@ static const TypeInfo rng_egd_info = {
     .parent = TYPE_RNG_BACKEND,
     .instance_size = sizeof(RngEgd),
     .class_init = rng_egd_class_init,
-    .instance_init = rng_egd_init,
     .instance_finalize = rng_egd_finalize,
 };
 
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 67+ messages in thread

* [PATCH 04/24] rng-random: register "filename" as class property
  2020-09-21 22:10 [PATCH 00/24] qom: Convert some properties to class properties Eduardo Habkost
                   ` (2 preceding siblings ...)
  2020-09-21 22:10 ` [PATCH 03/24] rng-egd: " Eduardo Habkost
@ 2020-09-21 22:10 ` Eduardo Habkost
  2020-09-23  9:59   ` Daniel P. Berrangé
  2020-09-21 22:10 ` [PATCH 05/24] vhost-user: Register "chardev" " Eduardo Habkost
                   ` (22 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Eduardo Habkost @ 2020-09-21 22:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: John Snow, Paolo Bonzini, Daniel P. Berrange, Laurent Vivier, Amit Shah

Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: Laurent Vivier <lvivier@redhat.com>
Cc: Amit Shah <amit@kernel.org>
Cc: qemu-devel@nongnu.org
---
 backends/rng-random.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/backends/rng-random.c b/backends/rng-random.c
index 245b12ab245..7add272eddd 100644
--- a/backends/rng-random.c
+++ b/backends/rng-random.c
@@ -108,10 +108,6 @@ static void rng_random_init(Object *obj)
 {
     RngRandom *s = RNG_RANDOM(obj);
 
-    object_property_add_str(obj, "filename",
-                            rng_random_get_filename,
-                            rng_random_set_filename);
-
     s->filename = g_strdup("/dev/urandom");
     s->fd = -1;
 }
@@ -134,6 +130,10 @@ static void rng_random_class_init(ObjectClass *klass, void *data)
 
     rbc->request_entropy = rng_random_request_entropy;
     rbc->opened = rng_random_opened;
+    object_class_property_add_str(klass, "filename",
+                                  rng_random_get_filename,
+                                  rng_random_set_filename);
+
 }
 
 static const TypeInfo rng_random_info = {
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 67+ messages in thread

* [PATCH 05/24] vhost-user: Register "chardev" as class property
  2020-09-21 22:10 [PATCH 00/24] qom: Convert some properties to class properties Eduardo Habkost
                   ` (3 preceding siblings ...)
  2020-09-21 22:10 ` [PATCH 04/24] rng-random: register "filename" " Eduardo Habkost
@ 2020-09-21 22:10 ` Eduardo Habkost
  2020-10-08  6:58   ` Marc-André Lureau
                     ` (2 more replies)
  2020-09-21 22:10 ` [PATCH 06/24] vexpress: Register "secure" " Eduardo Habkost
                   ` (21 subsequent siblings)
  26 siblings, 3 replies; 67+ messages in thread
From: Eduardo Habkost @ 2020-09-21 22:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: John Snow, Paolo Bonzini, Daniel P. Berrange, Michael S. Tsirkin

Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: qemu-devel@nongnu.org
---
 backends/vhost-user.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/backends/vhost-user.c b/backends/vhost-user.c
index 9e6e1985465..858fdeae26c 100644
--- a/backends/vhost-user.c
+++ b/backends/vhost-user.c
@@ -175,9 +175,9 @@ static char *get_chardev(Object *obj, Error **errp)
     return NULL;
 }
 
-static void vhost_user_backend_init(Object *obj)
+static void vhost_user_backend_class_init(ObjectClass *oc, void *data)
 {
-    object_property_add_str(obj, "chardev", get_chardev, set_chardev);
+    object_class_property_add_str(oc, "chardev", get_chardev, set_chardev);
 }
 
 static void vhost_user_backend_finalize(Object *obj)
@@ -195,7 +195,7 @@ static const TypeInfo vhost_user_backend_info = {
     .name = TYPE_VHOST_USER_BACKEND,
     .parent = TYPE_OBJECT,
     .instance_size = sizeof(VhostUserBackend),
-    .instance_init = vhost_user_backend_init,
+    .class_init = vhost_user_backend_class_init,
     .instance_finalize = vhost_user_backend_finalize,
     .class_size = sizeof(VhostUserBackendClass),
 };
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 67+ messages in thread

* [PATCH 06/24] vexpress: Register "secure" as class property
  2020-09-21 22:10 [PATCH 00/24] qom: Convert some properties to class properties Eduardo Habkost
                   ` (4 preceding siblings ...)
  2020-09-21 22:10 ` [PATCH 05/24] vhost-user: Register "chardev" " Eduardo Habkost
@ 2020-09-21 22:10 ` Eduardo Habkost
  2020-09-21 22:10 ` [PATCH 07/24] rng: Register "opened" " Eduardo Habkost
                   ` (20 subsequent siblings)
  26 siblings, 0 replies; 67+ messages in thread
From: Eduardo Habkost @ 2020-09-21 22:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: John Snow, Paolo Bonzini, qemu-arm, Daniel P. Berrange, Peter Maydell

Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-arm@nongnu.org
Cc: qemu-devel@nongnu.org
---
 hw/arm/vexpress.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
index 01bb4bba1ec..0cc35749d7d 100644
--- a/hw/arm/vexpress.c
+++ b/hw/arm/vexpress.c
@@ -758,11 +758,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)
@@ -799,6 +794,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)
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 67+ messages in thread

* [PATCH 07/24] rng: Register "opened" as class property
  2020-09-21 22:10 [PATCH 00/24] qom: Convert some properties to class properties Eduardo Habkost
                   ` (5 preceding siblings ...)
  2020-09-21 22:10 ` [PATCH 06/24] vexpress: Register "secure" " Eduardo Habkost
@ 2020-09-21 22:10 ` Eduardo Habkost
  2020-09-23 10:00   ` Daniel P. Berrangé
  2020-09-21 22:10 ` [PATCH 08/24] vexpress-a15: Register "virtualization" " Eduardo Habkost
                   ` (19 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Eduardo Habkost @ 2020-09-21 22:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: John Snow, Paolo Bonzini, Daniel P. Berrange, Laurent Vivier, Amit Shah

Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: Laurent Vivier <lvivier@redhat.com>
Cc: Amit Shah <amit@kernel.org>
Cc: qemu-devel@nongnu.org
---
 backends/rng.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/backends/rng.c b/backends/rng.c
index 484f04e8916..3757b044855 100644
--- a/backends/rng.c
+++ b/backends/rng.c
@@ -105,10 +105,6 @@ static void rng_backend_init(Object *obj)
     RngBackend *s = RNG_BACKEND(obj);
 
     QSIMPLEQ_INIT(&s->requests);
-
-    object_property_add_bool(obj, "opened",
-                             rng_backend_prop_get_opened,
-                             rng_backend_prop_set_opened);
 }
 
 static void rng_backend_finalize(Object *obj)
@@ -123,6 +119,10 @@ static void rng_backend_class_init(ObjectClass *oc, void *data)
     UserCreatableClass *ucc = USER_CREATABLE_CLASS(oc);
 
     ucc->complete = rng_backend_complete;
+
+    object_class_property_add_bool(oc, "opened",
+                                   rng_backend_prop_get_opened,
+                                   rng_backend_prop_set_opened);
 }
 
 static const TypeInfo rng_backend_info = {
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 67+ messages in thread

* [PATCH 08/24] vexpress-a15: Register "virtualization" as class property
  2020-09-21 22:10 [PATCH 00/24] qom: Convert some properties to class properties Eduardo Habkost
                   ` (6 preceding siblings ...)
  2020-09-21 22:10 ` [PATCH 07/24] rng: Register "opened" " Eduardo Habkost
@ 2020-09-21 22:10 ` Eduardo Habkost
  2020-10-23 18:19   ` Igor Mammedov
  2020-09-21 22:10 ` [PATCH 09/24] input-linux: Register properties as class properties Eduardo Habkost
                   ` (18 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Eduardo Habkost @ 2020-09-21 22:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: John Snow, Paolo Bonzini, qemu-arm, Daniel P. Berrange, Peter Maydell

Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-arm@nongnu.org
Cc: qemu-devel@nongnu.org
---
 hw/arm/vexpress.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
index 0cc35749d7d..13339302af5 100644
--- a/hw/arm/vexpress.c
+++ b/hw/arm/vexpress.c
@@ -769,12 +769,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)
@@ -822,6 +816,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 = {
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 67+ messages in thread

* [PATCH 09/24] input-linux: Register properties as class properties
  2020-09-21 22:10 [PATCH 00/24] qom: Convert some properties to class properties Eduardo Habkost
                   ` (7 preceding siblings ...)
  2020-09-21 22:10 ` [PATCH 08/24] vexpress-a15: Register "virtualization" " Eduardo Habkost
@ 2020-09-21 22:10 ` Eduardo Habkost
  2020-09-23 10:01   ` Daniel P. Berrangé
  2020-09-21 22:10 ` [PATCH 10/24] input-barrier: " Eduardo Habkost
                   ` (17 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Eduardo Habkost @ 2020-09-21 22:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: John Snow, Paolo Bonzini, Daniel P. Berrange, Gerd Hoffmann

Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: qemu-devel@nongnu.org
---
 ui/input-linux.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/ui/input-linux.c b/ui/input-linux.c
index 5d501c8360c..cb86774a51e 100644
--- a/ui/input-linux.c
+++ b/ui/input-linux.c
@@ -489,19 +489,6 @@ static void input_linux_set_grab_toggle(Object *obj, int value,
 
 static void input_linux_instance_init(Object *obj)
 {
-    object_property_add_str(obj, "evdev",
-                            input_linux_get_evdev,
-                            input_linux_set_evdev);
-    object_property_add_bool(obj, "grab_all",
-                             input_linux_get_grab_all,
-                             input_linux_set_grab_all);
-    object_property_add_bool(obj, "repeat",
-                             input_linux_get_repeat,
-                             input_linux_set_repeat);
-    object_property_add_enum(obj, "grab-toggle", "GrabToggleKeys",
-                             &GrabToggleKeys_lookup,
-                             input_linux_get_grab_toggle,
-                             input_linux_set_grab_toggle);
 }
 
 static void input_linux_class_init(ObjectClass *oc, void *data)
@@ -509,6 +496,20 @@ static void input_linux_class_init(ObjectClass *oc, void *data)
     UserCreatableClass *ucc = USER_CREATABLE_CLASS(oc);
 
     ucc->complete = input_linux_complete;
+
+    object_class_property_add_str(oc, "evdev",
+                                  input_linux_get_evdev,
+                                  input_linux_set_evdev);
+    object_class_property_add_bool(oc, "grab_all",
+                                   input_linux_get_grab_all,
+                                   input_linux_set_grab_all);
+    object_class_property_add_bool(oc, "repeat",
+                                   input_linux_get_repeat,
+                                   input_linux_set_repeat);
+    object_class_property_add_enum(oc, "grab-toggle", "GrabToggleKeys",
+                                   &GrabToggleKeys_lookup,
+                                   input_linux_get_grab_toggle,
+                                   input_linux_set_grab_toggle);
 }
 
 static const TypeInfo input_linux_info = {
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 67+ messages in thread

* [PATCH 10/24] input-barrier: Register properties as class properties
  2020-09-21 22:10 [PATCH 00/24] qom: Convert some properties to class properties Eduardo Habkost
                   ` (8 preceding siblings ...)
  2020-09-21 22:10 ` [PATCH 09/24] input-linux: Register properties as class properties Eduardo Habkost
@ 2020-09-21 22:10 ` Eduardo Habkost
  2020-09-23 10:02   ` Daniel P. Berrangé
  2020-09-21 22:10 ` [PATCH 11/24] tmp421: " Eduardo Habkost
                   ` (16 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Eduardo Habkost @ 2020-09-21 22:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: John Snow, Paolo Bonzini, Daniel P. Berrange, Gerd Hoffmann

Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: qemu-devel@nongnu.org
---
 ui/input-barrier.c | 44 ++++++++++++++++++++++----------------------
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/ui/input-barrier.c b/ui/input-barrier.c
index 87543a33993..9a196d0a33d 100644
--- a/ui/input-barrier.c
+++ b/ui/input-barrier.c
@@ -689,28 +689,6 @@ static void input_barrier_instance_init(Object *obj)
     ib->y_origin = 0;
     ib->width = 1920;
     ib->height = 1080;
-
-    object_property_add_str(obj, "name",
-                            input_barrier_get_name,
-                            input_barrier_set_name);
-    object_property_add_str(obj, "server",
-                            input_barrier_get_server,
-                            input_barrier_set_server);
-    object_property_add_str(obj, "port",
-                            input_barrier_get_port,
-                            input_barrier_set_port);
-    object_property_add_str(obj, "x-origin",
-                            input_barrier_get_x_origin,
-                            input_barrier_set_x_origin);
-    object_property_add_str(obj, "y-origin",
-                            input_barrier_get_y_origin,
-                            input_barrier_set_y_origin);
-    object_property_add_str(obj, "width",
-                            input_barrier_get_width,
-                            input_barrier_set_width);
-    object_property_add_str(obj, "height",
-                            input_barrier_get_height,
-                            input_barrier_set_height);
 }
 
 static void input_barrier_class_init(ObjectClass *oc, void *data)
@@ -718,6 +696,28 @@ static void input_barrier_class_init(ObjectClass *oc, void *data)
     UserCreatableClass *ucc = USER_CREATABLE_CLASS(oc);
 
     ucc->complete = input_barrier_complete;
+
+    object_class_property_add_str(oc, "name",
+                                  input_barrier_get_name,
+                                  input_barrier_set_name);
+    object_class_property_add_str(oc, "server",
+                                  input_barrier_get_server,
+                                  input_barrier_set_server);
+    object_class_property_add_str(oc, "port",
+                                  input_barrier_get_port,
+                                  input_barrier_set_port);
+    object_class_property_add_str(oc, "x-origin",
+                                  input_barrier_get_x_origin,
+                                  input_barrier_set_x_origin);
+    object_class_property_add_str(oc, "y-origin",
+                                  input_barrier_get_y_origin,
+                                  input_barrier_set_y_origin);
+    object_class_property_add_str(oc, "width",
+                                  input_barrier_get_width,
+                                  input_barrier_set_width);
+    object_class_property_add_str(oc, "height",
+                                  input_barrier_get_height,
+                                  input_barrier_set_height);
 }
 
 static const TypeInfo input_barrier_info = {
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 67+ messages in thread

* [PATCH 11/24] tmp421: Register properties as class properties
  2020-09-21 22:10 [PATCH 00/24] qom: Convert some properties to class properties Eduardo Habkost
                   ` (9 preceding siblings ...)
  2020-09-21 22:10 ` [PATCH 10/24] input-barrier: " Eduardo Habkost
@ 2020-09-21 22:10 ` Eduardo Habkost
  2020-10-23 18:21   ` Igor Mammedov
  2020-09-21 22:10 ` [PATCH 12/24] s390x: Register all CPU " Eduardo Habkost
                   ` (15 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Eduardo Habkost @ 2020-09-21 22:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: John Snow, Paolo Bonzini, Daniel P. Berrange

Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: qemu-devel@nongnu.org
---
 hw/misc/tmp421.c | 30 +++++++++++++-----------------
 1 file changed, 13 insertions(+), 17 deletions(-)

diff --git a/hw/misc/tmp421.c b/hw/misc/tmp421.c
index 212d6e0e831..1c19a3a9713 100644
--- a/hw/misc/tmp421.c
+++ b/hw/misc/tmp421.c
@@ -340,22 +340,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);
@@ -368,6 +352,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 = {
@@ -375,7 +372,6 @@ static const TypeInfo tmp421_info = {
     .parent        = TYPE_I2C_SLAVE,
     .instance_size = sizeof(TMP421State),
     .class_size    = sizeof(TMP421Class),
-    .instance_init = tmp421_initfn,
     .abstract      = true,
 };
 
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 67+ messages in thread

* [PATCH 12/24] s390x: Register all CPU properties as class properties
  2020-09-21 22:10 [PATCH 00/24] qom: Convert some properties to class properties Eduardo Habkost
                   ` (10 preceding siblings ...)
  2020-09-21 22:10 ` [PATCH 11/24] tmp421: " Eduardo Habkost
@ 2020-09-21 22:10 ` Eduardo Habkost
  2020-09-22  6:47   ` David Hildenbrand
  2020-09-22  9:54   ` Cornelia Huck
  2020-09-21 22:10 ` [PATCH 13/24] i386: Register most " Eduardo Habkost
                   ` (14 subsequent siblings)
  26 siblings, 2 replies; 67+ messages in thread
From: Eduardo Habkost @ 2020-09-21 22:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, Daniel P. Berrange, David Hildenbrand,
	Cornelia Huck, Halil Pasic, Christian Borntraeger, qemu-s390x,
	Paolo Bonzini, John Snow, Richard Henderson

Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: Cornelia Huck <cohuck@redhat.com>
Cc: Thomas Huth <thuth@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: David Hildenbrand <david@redhat.com>
Cc: Halil Pasic <pasic@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: qemu-s390x@nongnu.org
Cc: qemu-devel@nongnu.org
---
 target/s390x/internal.h   |  1 -
 target/s390x/cpu.c        |  1 -
 target/s390x/cpu_models.c | 35 ++++++++++++++++-------------------
 3 files changed, 16 insertions(+), 21 deletions(-)

diff --git a/target/s390x/internal.h b/target/s390x/internal.h
index b1e0ebf67f8..bac0d3c67b2 100644
--- a/target/s390x/internal.h
+++ b/target/s390x/internal.h
@@ -260,7 +260,6 @@ static inline void s390_cpu_unhalt(S390CPU *cpu)
 
 
 /* cpu_models.c */
-void s390_cpu_model_register_props(Object *obj);
 void s390_cpu_model_class_register_props(ObjectClass *oc);
 void s390_realize_cpu_model(CPUState *cs, Error **errp);
 ObjectClass *s390_cpu_class_by_name(const char *name);
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
index 749cd548f0f..1dc45ca11b9 100644
--- a/target/s390x/cpu.c
+++ b/target/s390x/cpu.c
@@ -302,7 +302,6 @@ static void s390_cpu_initfn(Object *obj)
         timer_new_ns(QEMU_CLOCK_VIRTUAL, s390x_cpu_timer, cpu);
     s390_cpu_set_state(S390_CPU_STATE_STOPPED, cpu);
 #endif
-    s390_cpu_model_register_props(obj);
 }
 
 static void s390_cpu_finalize(Object *obj)
diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
index c2af2261743..b97e9596ab0 100644
--- a/target/s390x/cpu_models.c
+++ b/target/s390x/cpu_models.c
@@ -1089,25 +1089,6 @@ static void set_feature_group(Object *obj, Visitor *v, const char *name,
     }
 }
 
-void s390_cpu_model_register_props(Object *obj)
-{
-    S390FeatGroup group;
-    S390Feat feat;
-
-    for (feat = 0; feat < S390_FEAT_MAX; feat++) {
-        const S390FeatDef *def = s390_feat_def(feat);
-        object_property_add(obj, def->name, "bool", get_feature,
-                            set_feature, NULL, (void *) feat);
-        object_property_set_description(obj, def->name, def->desc);
-    }
-    for (group = 0; group < S390_FEAT_GROUP_MAX; group++) {
-        const S390FeatGroupDef *def = s390_feat_group_def(group);
-        object_property_add(obj, def->name, "bool", get_feature_group,
-                            set_feature_group, NULL, (void *) group);
-        object_property_set_description(obj, def->name, def->desc);
-    }
-}
-
 static void s390_cpu_model_initfn(Object *obj)
 {
     S390CPU *cpu = S390_CPU(obj);
@@ -1215,11 +1196,27 @@ static char *get_description(Object *obj, Error **errp)
 
 void s390_cpu_model_class_register_props(ObjectClass *oc)
 {
+    S390FeatGroup group;
+    S390Feat feat;
+
     object_class_property_add_bool(oc, "migration-safe", get_is_migration_safe,
                                    NULL);
     object_class_property_add_bool(oc, "static", get_is_static,
                                    NULL);
     object_class_property_add_str(oc, "description", get_description, NULL);
+
+    for (feat = 0; feat < S390_FEAT_MAX; feat++) {
+        const S390FeatDef *def = s390_feat_def(feat);
+        object_class_property_add(oc, def->name, "bool", get_feature,
+                                  set_feature, NULL, (void *) feat);
+        object_class_property_set_description(oc, def->name, def->desc);
+    }
+    for (group = 0; group < S390_FEAT_GROUP_MAX; group++) {
+        const S390FeatGroupDef *def = s390_feat_group_def(group);
+        object_class_property_add(oc, def->name, "bool", get_feature_group,
+                                  set_feature_group, NULL, (void *) group);
+        object_class_property_set_description(oc, def->name, def->desc);
+    }
 }
 
 #ifdef CONFIG_KVM
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 67+ messages in thread

* [PATCH 13/24] i386: Register most CPU properties as class properties
  2020-09-21 22:10 [PATCH 00/24] qom: Convert some properties to class properties Eduardo Habkost
                   ` (11 preceding siblings ...)
  2020-09-21 22:10 ` [PATCH 12/24] s390x: Register all CPU " Eduardo Habkost
@ 2020-09-21 22:10 ` Eduardo Habkost
  2020-09-22  6:41   ` Igor Mammedov
  2020-09-23  8:43   ` Igor Mammedov
  2020-09-21 22:10 ` [PATCH 14/24] i386: Register feature bit " Eduardo Habkost
                   ` (13 subsequent siblings)
  26 siblings, 2 replies; 67+ messages in thread
From: Eduardo Habkost @ 2020-09-21 22:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: John Snow, Paolo Bonzini, Daniel P. Berrange, Richard Henderson

Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: qemu-devel@nongnu.org
---
 target/i386/cpu.c | 66 ++++++++++++++++++++++++-----------------------
 1 file changed, 34 insertions(+), 32 deletions(-)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 1c58f764dcb..66792f28ba7 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -6922,44 +6922,12 @@ static void x86_cpu_initfn(Object *obj)
     env->nr_dies = 1;
     cpu_set_cpustate_pointers(cpu);
 
-    object_property_add(obj, "family", "int",
-                        x86_cpuid_version_get_family,
-                        x86_cpuid_version_set_family, NULL, NULL);
-    object_property_add(obj, "model", "int",
-                        x86_cpuid_version_get_model,
-                        x86_cpuid_version_set_model, NULL, NULL);
-    object_property_add(obj, "stepping", "int",
-                        x86_cpuid_version_get_stepping,
-                        x86_cpuid_version_set_stepping, NULL, NULL);
-    object_property_add_str(obj, "vendor",
-                            x86_cpuid_get_vendor,
-                            x86_cpuid_set_vendor);
-    object_property_add_str(obj, "model-id",
-                            x86_cpuid_get_model_id,
-                            x86_cpuid_set_model_id);
-    object_property_add(obj, "tsc-frequency", "int",
-                        x86_cpuid_get_tsc_freq,
-                        x86_cpuid_set_tsc_freq, NULL, NULL);
     object_property_add(obj, "feature-words", "X86CPUFeatureWordInfo",
                         x86_cpu_get_feature_words,
                         NULL, NULL, (void *)env->features);
     object_property_add(obj, "filtered-features", "X86CPUFeatureWordInfo",
                         x86_cpu_get_feature_words,
                         NULL, NULL, (void *)cpu->filtered_features);
-    /*
-     * The "unavailable-features" property has the same semantics as
-     * CpuDefinitionInfo.unavailable-features on the "query-cpu-definitions"
-     * QMP command: they list the features that would have prevented the
-     * CPU from running if the "enforce" flag was set.
-     */
-    object_property_add(obj, "unavailable-features", "strList",
-                        x86_cpu_get_unavailable_features,
-                        NULL, NULL, NULL);
-
-#if !defined(CONFIG_USER_ONLY)
-    object_property_add(obj, "crash-information", "GuestPanicInformation",
-                        x86_cpu_get_crash_info_qom, NULL, NULL, NULL);
-#endif
 
     for (w = 0; w < FEATURE_WORDS; w++) {
         int bitnr;
@@ -7308,6 +7276,40 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data)
     cc->disas_set_info = x86_disas_set_info;
 
     dc->user_creatable = true;
+
+    object_class_property_add(oc, "family", "int",
+                              x86_cpuid_version_get_family,
+                              x86_cpuid_version_set_family, NULL, NULL);
+    object_class_property_add(oc, "model", "int",
+                              x86_cpuid_version_get_model,
+                              x86_cpuid_version_set_model, NULL, NULL);
+    object_class_property_add(oc, "stepping", "int",
+                              x86_cpuid_version_get_stepping,
+                              x86_cpuid_version_set_stepping, NULL, NULL);
+    object_class_property_add_str(oc, "vendor",
+                                  x86_cpuid_get_vendor,
+                                  x86_cpuid_set_vendor);
+    object_class_property_add_str(oc, "model-id",
+                                  x86_cpuid_get_model_id,
+                                  x86_cpuid_set_model_id);
+    object_class_property_add(oc, "tsc-frequency", "int",
+                              x86_cpuid_get_tsc_freq,
+                              x86_cpuid_set_tsc_freq, NULL, NULL);
+    /*
+     * The "unavailable-features" property has the same semantics as
+     * CpuDefinitionInfo.unavailable-features on the "query-cpu-definitions"
+     * QMP command: they list the features that would have prevented the
+     * CPU from running if the "enforce" flag was set.
+     */
+    object_class_property_add(oc, "unavailable-features", "strList",
+                              x86_cpu_get_unavailable_features,
+                              NULL, NULL, NULL);
+
+#if !defined(CONFIG_USER_ONLY)
+    object_class_property_add(oc, "crash-information", "GuestPanicInformation",
+                              x86_cpu_get_crash_info_qom, NULL, NULL, NULL);
+#endif
+
 }
 
 static const TypeInfo x86_cpu_type_info = {
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 67+ messages in thread

* [PATCH 14/24] i386: Register feature bit properties as class properties
  2020-09-21 22:10 [PATCH 00/24] qom: Convert some properties to class properties Eduardo Habkost
                   ` (12 preceding siblings ...)
  2020-09-21 22:10 ` [PATCH 13/24] i386: Register most " Eduardo Habkost
@ 2020-09-21 22:10 ` Eduardo Habkost
  2020-09-22  6:47   ` Igor Mammedov
  2020-09-22 12:47   ` Eduardo Habkost
  2020-09-21 22:10 ` [PATCH 15/24] arm/virt: Register most " Eduardo Habkost
                   ` (12 subsequent siblings)
  26 siblings, 2 replies; 67+ messages in thread
From: Eduardo Habkost @ 2020-09-21 22:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: John Snow, Paolo Bonzini, Daniel P. Berrange, Richard Henderson

Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: qemu-devel@nongnu.org
---
 target/i386/cpu.c | 33 ++++++++++++++++-----------------
 1 file changed, 16 insertions(+), 17 deletions(-)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 66792f28ba7..1aba87e0a5b 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -6819,16 +6819,17 @@ static void x86_cpu_release_bit_prop(Object *obj, const char *name,
  * multiple bits in the same FeatureWord. In that case, the getter will return
  * true only if all bits are set.
  */
-static void x86_cpu_register_bit_prop(X86CPU *cpu,
+static void x86_cpu_register_bit_prop(X86CPUClass *xcc,
                                       const char *prop_name,
                                       FeatureWord w,
                                       int bitnr)
 {
+    ObjectClass *oc = OBJECT_CLASS(xcc);
     BitProperty *fp;
     ObjectProperty *op;
     uint64_t mask = (1ULL << bitnr);
 
-    op = object_property_find(OBJECT(cpu), prop_name, NULL);
+    op = object_class_property_find(oc, prop_name, NULL);
     if (op) {
         fp = op->opaque;
         assert(fp->w == w);
@@ -6837,14 +6838,14 @@ static void x86_cpu_register_bit_prop(X86CPU *cpu,
         fp = g_new0(BitProperty, 1);
         fp->w = w;
         fp->mask = mask;
-        object_property_add(OBJECT(cpu), prop_name, "bool",
-                            x86_cpu_get_bit_prop,
-                            x86_cpu_set_bit_prop,
-                            x86_cpu_release_bit_prop, fp);
+        object_class_property_add(oc, prop_name, "bool",
+                                  x86_cpu_get_bit_prop,
+                                  x86_cpu_set_bit_prop,
+                                  x86_cpu_release_bit_prop, fp);
     }
 }
 
-static void x86_cpu_register_feature_bit_props(X86CPU *cpu,
+static void x86_cpu_register_feature_bit_props(X86CPUClass *xcc,
                                                FeatureWord w,
                                                int bitnr)
 {
@@ -6863,7 +6864,7 @@ static void x86_cpu_register_feature_bit_props(X86CPU *cpu,
     /* aliases don't use "|" delimiters anymore, they are registered
      * manually using object_property_add_alias() */
     assert(!strchr(name, '|'));
-    x86_cpu_register_bit_prop(cpu, name, w, bitnr);
+    x86_cpu_register_bit_prop(xcc, name, w, bitnr);
 }
 
 #if !defined(CONFIG_USER_ONLY)
@@ -6917,7 +6918,6 @@ static void x86_cpu_initfn(Object *obj)
     X86CPU *cpu = X86_CPU(obj);
     X86CPUClass *xcc = X86_CPU_GET_CLASS(obj);
     CPUX86State *env = &cpu->env;
-    FeatureWord w;
 
     env->nr_dies = 1;
     cpu_set_cpustate_pointers(cpu);
@@ -6929,14 +6929,6 @@ static void x86_cpu_initfn(Object *obj)
                         x86_cpu_get_feature_words,
                         NULL, NULL, (void *)cpu->filtered_features);
 
-    for (w = 0; w < FEATURE_WORDS; w++) {
-        int bitnr;
-
-        for (bitnr = 0; bitnr < 64; bitnr++) {
-            x86_cpu_register_feature_bit_props(cpu, w, bitnr);
-        }
-    }
-
     object_property_add_alias(obj, "sse3", obj, "pni");
     object_property_add_alias(obj, "pclmuldq", obj, "pclmulqdq");
     object_property_add_alias(obj, "sse4-1", obj, "sse4.1");
@@ -7221,6 +7213,7 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data)
     X86CPUClass *xcc = X86_CPU_CLASS(oc);
     CPUClass *cc = CPU_CLASS(oc);
     DeviceClass *dc = DEVICE_CLASS(oc);
+    FeatureWord w;
 
     device_class_set_parent_realize(dc, x86_cpu_realizefn,
                                     &xcc->parent_realize);
@@ -7310,6 +7303,12 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data)
                               x86_cpu_get_crash_info_qom, NULL, NULL, NULL);
 #endif
 
+    for (w = 0; w < FEATURE_WORDS; w++) {
+        int bitnr;
+        for (bitnr = 0; bitnr < 64; bitnr++) {
+            x86_cpu_register_feature_bit_props(xcc, w, bitnr);
+        }
+    }
 }
 
 static const TypeInfo x86_cpu_type_info = {
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 67+ messages in thread

* [PATCH 15/24] arm/virt: Register most properties as class properties
  2020-09-21 22:10 [PATCH 00/24] qom: Convert some properties to class properties Eduardo Habkost
                   ` (13 preceding siblings ...)
  2020-09-21 22:10 ` [PATCH 14/24] i386: Register feature bit " Eduardo Habkost
@ 2020-09-21 22:10 ` Eduardo Habkost
  2020-10-23 18:26   ` Igor Mammedov
  2020-09-21 22:10 ` [PATCH 16/24] virt: Register "its" as class property Eduardo Habkost
                   ` (11 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Eduardo Habkost @ 2020-09-21 22:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: John Snow, Paolo Bonzini, qemu-arm, Daniel P. Berrange, Peter Maydell

Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-arm@nongnu.org
Cc: qemu-devel@nongnu.org
---
 hw/arm/virt.c | 76 +++++++++++++++++++++++++++------------------------
 1 file changed, 41 insertions(+), 35 deletions(-)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index acf9bfbecea..d1ab660fa60 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -2443,6 +2443,47 @@ 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");
 }
 
 static void virt_instance_init(Object *obj)
@@ -2455,34 +2496,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;
 
@@ -2500,26 +2520,12 @@ static void virt_instance_init(Object *obj)
 
     /* 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;
 
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 67+ messages in thread

* [PATCH 16/24] virt: Register "its" as class property
  2020-09-21 22:10 [PATCH 00/24] qom: Convert some properties to class properties Eduardo Habkost
                   ` (14 preceding siblings ...)
  2020-09-21 22:10 ` [PATCH 15/24] arm/virt: Register most " Eduardo Habkost
@ 2020-09-21 22:10 ` Eduardo Habkost
  2020-10-23 18:33   ` Igor Mammedov
  2020-11-02 11:12   ` Peter Maydell
  2020-09-21 22:10 ` [PATCH 17/24] cpu/core: Register core-id and nr-threads as class properties Eduardo Habkost
                   ` (10 subsequent siblings)
  26 siblings, 2 replies; 67+ messages in thread
From: Eduardo Habkost @ 2020-09-21 22:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: John Snow, Paolo Bonzini, qemu-arm, Daniel P. Berrange, Peter Maydell

Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.

Note: "its" is currently registered conditionally, but this makes
the feature be registered unconditionally.  The only side effect
is that it will be now possible to set its=on on virt-2.7 and
older.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-arm@nongnu.org
Cc: qemu-devel@nongnu.org
---
 hw/arm/virt.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index d1ab660fa60..986b75a6b89 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -2484,6 +2484,13 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
                                           "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)
@@ -2511,11 +2518,6 @@ 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 */
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 67+ messages in thread

* [PATCH 17/24] cpu/core: Register core-id and nr-threads as class properties
  2020-09-21 22:10 [PATCH 00/24] qom: Convert some properties to class properties Eduardo Habkost
                   ` (15 preceding siblings ...)
  2020-09-21 22:10 ` [PATCH 16/24] virt: Register "its" as class property Eduardo Habkost
@ 2020-09-21 22:10 ` Eduardo Habkost
  2020-09-22  6:48   ` Igor Mammedov
  2020-09-21 22:10 ` [PATCH 18/24] arm/cpu64: Register "aarch64" as class property Eduardo Habkost
                   ` (9 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Eduardo Habkost @ 2020-09-21 22:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: John Snow, Paolo Bonzini, Daniel P. Berrange

Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: qemu-devel@nongnu.org
---
 hw/cpu/core.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/cpu/core.c b/hw/cpu/core.c
index 3a659291eae..92d3b2fbad6 100644
--- a/hw/cpu/core.c
+++ b/hw/cpu/core.c
@@ -69,10 +69,6 @@ static void cpu_core_instance_init(Object *obj)
     MachineState *ms = MACHINE(qdev_get_machine());
     CPUCore *core = CPU_CORE(obj);
 
-    object_property_add(obj, "core-id", "int", core_prop_get_core_id,
-                        core_prop_set_core_id, NULL, NULL);
-    object_property_add(obj, "nr-threads", "int", core_prop_get_nr_threads,
-                        core_prop_set_nr_threads, NULL, NULL);
     core->nr_threads = ms->smp.threads;
 }
 
@@ -81,6 +77,10 @@ static void cpu_core_class_init(ObjectClass *oc, void *data)
     DeviceClass *dc = DEVICE_CLASS(oc);
 
     set_bit(DEVICE_CATEGORY_CPU, dc->categories);
+    object_class_property_add(oc, "core-id", "int", core_prop_get_core_id,
+                              core_prop_set_core_id, NULL, NULL);
+    object_class_property_add(oc, "nr-threads", "int", core_prop_get_nr_threads,
+                              core_prop_set_nr_threads, NULL, NULL);
 }
 
 static const TypeInfo cpu_core_type_info = {
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 67+ messages in thread

* [PATCH 18/24] arm/cpu64: Register "aarch64" as class property
  2020-09-21 22:10 [PATCH 00/24] qom: Convert some properties to class properties Eduardo Habkost
                   ` (16 preceding siblings ...)
  2020-09-21 22:10 ` [PATCH 17/24] cpu/core: Register core-id and nr-threads as class properties Eduardo Habkost
@ 2020-09-21 22:10 ` Eduardo Habkost
  2020-10-23 18:34   ` Igor Mammedov
  2020-09-21 22:10 ` [PATCH 19/24] xlnx-zcu102: Register properties as class properties Eduardo Habkost
                   ` (8 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Eduardo Habkost @ 2020-09-21 22:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: John Snow, Paolo Bonzini, qemu-arm, Daniel P. Berrange, Peter Maydell

Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-arm@nongnu.org
Cc: qemu-devel@nongnu.org
---
 target/arm/cpu64.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
index 3c2b3d95993..349c9fa3a3a 100644
--- a/target/arm/cpu64.c
+++ b/target/arm/cpu64.c
@@ -758,15 +758,6 @@ static void aarch64_cpu_set_aarch64(Object *obj, bool value, Error **errp)
     }
 }
 
-static void aarch64_cpu_initfn(Object *obj)
-{
-    object_property_add_bool(obj, "aarch64", aarch64_cpu_get_aarch64,
-                             aarch64_cpu_set_aarch64);
-    object_property_set_description(obj, "aarch64",
-                                    "Set on/off to enable/disable aarch64 "
-                                    "execution state ");
-}
-
 static void aarch64_cpu_finalizefn(Object *obj)
 {
 }
@@ -786,6 +777,12 @@ static void aarch64_cpu_class_init(ObjectClass *oc, void *data)
     cc->gdb_num_core_regs = 34;
     cc->gdb_core_xml_file = "aarch64-core.xml";
     cc->gdb_arch_name = aarch64_gdb_arch_name;
+
+    object_class_property_add_bool(oc, "aarch64", aarch64_cpu_get_aarch64,
+                                   aarch64_cpu_set_aarch64);
+    object_class_property_set_description(oc, "aarch64",
+                                          "Set on/off to enable/disable aarch64 "
+                                          "execution state ");
 }
 
 static void aarch64_cpu_instance_init(Object *obj)
@@ -823,7 +820,6 @@ static const TypeInfo aarch64_cpu_type_info = {
     .name = TYPE_AARCH64_CPU,
     .parent = TYPE_ARM_CPU,
     .instance_size = sizeof(ARMCPU),
-    .instance_init = aarch64_cpu_initfn,
     .instance_finalize = aarch64_cpu_finalizefn,
     .abstract = true,
     .class_size = sizeof(AArch64CPUClass),
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 67+ messages in thread

* [PATCH 19/24] xlnx-zcu102: Register properties as class properties
  2020-09-21 22:10 [PATCH 00/24] qom: Convert some properties to class properties Eduardo Habkost
                   ` (17 preceding siblings ...)
  2020-09-21 22:10 ` [PATCH 18/24] arm/cpu64: Register "aarch64" as class property Eduardo Habkost
@ 2020-09-21 22:10 ` Eduardo Habkost
  2020-09-22 16:44   ` Alistair Francis
  2020-09-21 22:10 ` [PATCH 20/24] machine: Register "memory-backend" as class property Eduardo Habkost
                   ` (7 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Eduardo Habkost @ 2020-09-21 22:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Daniel P. Berrange, Alistair Francis, qemu-arm,
	Edgar E. Iglesias, Paolo Bonzini, John Snow

Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: Alistair Francis <alistair@alistair23.me>
Cc: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-arm@nongnu.org
Cc: qemu-devel@nongnu.org
---
 hw/arm/xlnx-zcu102.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c
index 19d5a4d4e0e..4deb96bfcc1 100644
--- a/hw/arm/xlnx-zcu102.c
+++ b/hw/arm/xlnx-zcu102.c
@@ -208,20 +208,8 @@ static void xlnx_zcu102_machine_instance_init(Object *obj)
 
     /* Default to secure mode being disabled */
     s->secure = false;
-    object_property_add_bool(obj, "secure", zcu102_get_secure,
-                             zcu102_set_secure);
-    object_property_set_description(obj, "secure",
-                                    "Set on/off to enable/disable the ARM "
-                                    "Security Extensions (TrustZone)");
-
     /* Default to virt (EL2) being disabled */
     s->virt = false;
-    object_property_add_bool(obj, "virtualization", zcu102_get_virt,
-                             zcu102_set_virt);
-    object_property_set_description(obj, "virtualization",
-                                    "Set on/off to enable/disable emulating a "
-                                    "guest CPU which implements the ARM "
-                                    "Virtualization Extensions");
 }
 
 static void xlnx_zcu102_machine_class_init(ObjectClass *oc, void *data)
@@ -237,6 +225,19 @@ static void xlnx_zcu102_machine_class_init(ObjectClass *oc, void *data)
     mc->max_cpus = XLNX_ZYNQMP_NUM_APU_CPUS + XLNX_ZYNQMP_NUM_RPU_CPUS;
     mc->default_cpus = XLNX_ZYNQMP_NUM_APU_CPUS;
     mc->default_ram_id = "ddr-ram";
+
+    object_class_property_add_bool(oc, "secure", zcu102_get_secure,
+                                   zcu102_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", zcu102_get_virt,
+                                   zcu102_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");
 }
 
 static const TypeInfo xlnx_zcu102_machine_init_typeinfo = {
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 67+ messages in thread

* [PATCH 20/24] machine: Register "memory-backend" as class property
  2020-09-21 22:10 [PATCH 00/24] qom: Convert some properties to class properties Eduardo Habkost
                   ` (18 preceding siblings ...)
  2020-09-21 22:10 ` [PATCH 19/24] xlnx-zcu102: Register properties as class properties Eduardo Habkost
@ 2020-09-21 22:10 ` Eduardo Habkost
  2020-09-22  6:39   ` Igor Mammedov
  2020-09-21 22:10 ` [PATCH 21/24] vga-pci: Register "big-endian-framebuffer" " Eduardo Habkost
                   ` (6 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Eduardo Habkost @ 2020-09-21 22:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: John Snow, Paolo Bonzini, Daniel P. Berrange

Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Cc: qemu-devel@nongnu.org
---
 hw/core/machine.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/hw/core/machine.c b/hw/core/machine.c
index ea26d612374..675ca6d651c 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -874,6 +874,12 @@ static void machine_class_init(ObjectClass *oc, void *data)
         machine_get_memory_encryption, machine_set_memory_encryption);
     object_class_property_set_description(oc, "memory-encryption",
         "Set memory encryption object to use");
+
+    object_class_property_add_str(oc, "memory-backend",
+                                  machine_get_memdev, machine_set_memdev);
+    object_class_property_set_description(oc, "memory-backend",
+                                          "Set RAM backend"
+                                          "Valid value is ID of hostmem based backend");
 }
 
 static void machine_class_base_init(ObjectClass *oc, void *data)
@@ -925,12 +931,6 @@ static void machine_initfn(Object *obj)
                                         "Table (HMAT)");
     }
 
-    object_property_add_str(obj, "memory-backend",
-                            machine_get_memdev, machine_set_memdev);
-    object_property_set_description(obj, "memory-backend",
-                                    "Set RAM backend"
-                                    "Valid value is ID of hostmem based backend");
-
     /* Register notifier when init is done for sysbus sanity checks */
     ms->sysbus_notifier.notify = machine_init_notify;
     qemu_add_machine_init_done_notifier(&ms->sysbus_notifier);
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 67+ messages in thread

* [PATCH 21/24] vga-pci: Register "big-endian-framebuffer" as class property
  2020-09-21 22:10 [PATCH 00/24] qom: Convert some properties to class properties Eduardo Habkost
                   ` (19 preceding siblings ...)
  2020-09-21 22:10 ` [PATCH 20/24] machine: Register "memory-backend" as class property Eduardo Habkost
@ 2020-09-21 22:10 ` Eduardo Habkost
  2020-10-08  7:00   ` Marc-André Lureau
  2020-09-21 22:10 ` [PATCH 22/24] i440fx: Register i440FX-pcihost properties as class properties Eduardo Habkost
                   ` (5 subsequent siblings)
  26 siblings, 1 reply; 67+ messages in thread
From: Eduardo Habkost @ 2020-09-21 22:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: John Snow, Paolo Bonzini, Daniel P. Berrange, Gerd Hoffmann

Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: qemu-devel@nongnu.org
---
 hw/display/vga-pci.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/hw/display/vga-pci.c b/hw/display/vga-pci.c
index 3b45fa3bad0..b2a7d03c5d5 100644
--- a/hw/display/vga-pci.c
+++ b/hw/display/vga-pci.c
@@ -269,13 +269,6 @@ static void pci_std_vga_realize(PCIDevice *dev, Error **errp)
     }
 }
 
-static void pci_std_vga_init(Object *obj)
-{
-    /* Expose framebuffer byteorder via QOM */
-    object_property_add_bool(obj, "big-endian-framebuffer",
-                             vga_get_big_endian_fb, vga_set_big_endian_fb);
-}
-
 static void pci_secondary_vga_realize(PCIDevice *dev, Error **errp)
 {
     PCIVGAState *d = PCI_VGA(dev);
@@ -388,6 +381,10 @@ static void vga_class_init(ObjectClass *klass, void *data)
     k->class_id = PCI_CLASS_DISPLAY_VGA;
     device_class_set_props(dc, vga_pci_properties);
     dc->hotpluggable = false;
+
+    /* Expose framebuffer byteorder via QOM */
+    object_class_property_add_bool(klass, "big-endian-framebuffer",
+                                   vga_get_big_endian_fb, vga_set_big_endian_fb);
 }
 
 static void secondary_class_init(ObjectClass *klass, void *data)
@@ -405,7 +402,6 @@ static void secondary_class_init(ObjectClass *klass, void *data)
 static const TypeInfo vga_info = {
     .name          = "VGA",
     .parent        = TYPE_PCI_VGA,
-    .instance_init = pci_std_vga_init,
     .class_init    = vga_class_init,
 };
 
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 67+ messages in thread

* [PATCH 22/24] i440fx: Register i440FX-pcihost properties as class properties
  2020-09-21 22:10 [PATCH 00/24] qom: Convert some properties to class properties Eduardo Habkost
                   ` (20 preceding siblings ...)
  2020-09-21 22:10 ` [PATCH 21/24] vga-pci: Register "big-endian-framebuffer" " Eduardo Habkost
@ 2020-09-21 22:10 ` Eduardo Habkost
  2020-09-22  6:49   ` Igor Mammedov
  2020-10-30  8:56   ` Michael S. Tsirkin
  2020-09-21 22:10   ` Eduardo Habkost
                   ` (4 subsequent siblings)
  26 siblings, 2 replies; 67+ messages in thread
From: Eduardo Habkost @ 2020-09-21 22:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: John Snow, Paolo Bonzini, Daniel P. Berrange, Michael S. Tsirkin

Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Cc: qemu-devel@nongnu.org
---
 hw/pci-host/i440fx.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c
index 93c62235ca7..4454ba06621 100644
--- a/hw/pci-host/i440fx.c
+++ b/hw/pci-host/i440fx.c
@@ -212,22 +212,6 @@ static void i440fx_pcihost_initfn(Object *obj)
                           "pci-conf-idx", 4);
     memory_region_init_io(&s->data_mem, obj, &pci_host_data_le_ops, s,
                           "pci-conf-data", 4);
-
-    object_property_add(obj, PCI_HOST_PROP_PCI_HOLE_START, "uint32",
-                        i440fx_pcihost_get_pci_hole_start,
-                        NULL, NULL, NULL);
-
-    object_property_add(obj, PCI_HOST_PROP_PCI_HOLE_END, "uint32",
-                        i440fx_pcihost_get_pci_hole_end,
-                        NULL, NULL, NULL);
-
-    object_property_add(obj, PCI_HOST_PROP_PCI_HOLE64_START, "uint64",
-                        i440fx_pcihost_get_pci_hole64_start,
-                        NULL, NULL, NULL);
-
-    object_property_add(obj, PCI_HOST_PROP_PCI_HOLE64_END, "uint64",
-                        i440fx_pcihost_get_pci_hole64_end,
-                        NULL, NULL, NULL);
 }
 
 static void i440fx_pcihost_realize(DeviceState *dev, Error **errp)
@@ -403,6 +387,22 @@ static void i440fx_pcihost_class_init(ObjectClass *klass, void *data)
     device_class_set_props(dc, i440fx_props);
     /* Reason: needs to be wired up by pc_init1 */
     dc->user_creatable = false;
+
+    object_class_property_add(klass, PCI_HOST_PROP_PCI_HOLE_START, "uint32",
+                              i440fx_pcihost_get_pci_hole_start,
+                              NULL, NULL, NULL);
+
+    object_class_property_add(klass, PCI_HOST_PROP_PCI_HOLE_END, "uint32",
+                              i440fx_pcihost_get_pci_hole_end,
+                              NULL, NULL, NULL);
+
+    object_class_property_add(klass, PCI_HOST_PROP_PCI_HOLE64_START, "uint64",
+                              i440fx_pcihost_get_pci_hole64_start,
+                              NULL, NULL, NULL);
+
+    object_class_property_add(klass, PCI_HOST_PROP_PCI_HOLE64_END, "uint64",
+                              i440fx_pcihost_get_pci_hole64_end,
+                              NULL, NULL, NULL);
 }
 
 static const TypeInfo i440fx_pcihost_info = {
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 67+ messages in thread

* [PATCH 23/24] sifive_e: Register "revb" as class property
  2020-09-21 22:10 [PATCH 00/24] qom: Convert some properties to class properties Eduardo Habkost
@ 2020-09-21 22:10   ` Eduardo Habkost
  2020-09-21 22:10 ` [PATCH 02/24] cryptodev-backend: " Eduardo Habkost
                     ` (25 subsequent siblings)
  26 siblings, 0 replies; 67+ messages in thread
From: Eduardo Habkost @ 2020-09-21 22:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: Daniel P. Berrange, qemu-riscv, Sagar Karandikar,
	Bastian Koppelmann, Alistair Francis, Paolo Bonzini, John Snow,
	Palmer Dabbelt

Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Alistair Francis <Alistair.Francis@wdc.com>
Cc: Sagar Karandikar <sagark@eecs.berkeley.edu>
Cc: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Cc: qemu-riscv@nongnu.org
Cc: qemu-devel@nongnu.org
---
 hw/riscv/sifive_e.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/hw/riscv/sifive_e.c b/hw/riscv/sifive_e.c
index 40bbf530d49..9fe0c12df64 100644
--- a/hw/riscv/sifive_e.c
+++ b/hw/riscv/sifive_e.c
@@ -137,11 +137,6 @@ static void sifive_e_machine_instance_init(Object *obj)
     SiFiveEState *s = RISCV_E_MACHINE(obj);
 
     s->revb = false;
-    object_property_add_bool(obj, "revb", sifive_e_machine_get_revb,
-                             sifive_e_machine_set_revb);
-    object_property_set_description(obj, "revb",
-                                    "Set on to tell QEMU that it should model "
-                                    "the revB HiFive1 board");
 }
 
 static void sifive_e_machine_class_init(ObjectClass *oc, void *data)
@@ -152,6 +147,12 @@ static void sifive_e_machine_class_init(ObjectClass *oc, void *data)
     mc->init = sifive_e_machine_init;
     mc->max_cpus = 1;
     mc->default_cpu_type = SIFIVE_E_CPU;
+
+    object_class_property_add_bool(oc, "revb", sifive_e_machine_get_revb,
+                                   sifive_e_machine_set_revb);
+    object_class_property_set_description(oc, "revb",
+                                          "Set on to tell QEMU that it should model "
+                                          "the revB HiFive1 board");
 }
 
 static const TypeInfo sifive_e_machine_typeinfo = {
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 67+ messages in thread

* [PATCH 23/24] sifive_e: Register "revb" as class property
@ 2020-09-21 22:10   ` Eduardo Habkost
  0 siblings, 0 replies; 67+ messages in thread
From: Eduardo Habkost @ 2020-09-21 22:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Daniel P. Berrange, John Snow, Palmer Dabbelt,
	Alistair Francis, Sagar Karandikar, Bastian Koppelmann,
	qemu-riscv

Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Alistair Francis <Alistair.Francis@wdc.com>
Cc: Sagar Karandikar <sagark@eecs.berkeley.edu>
Cc: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Cc: qemu-riscv@nongnu.org
Cc: qemu-devel@nongnu.org
---
 hw/riscv/sifive_e.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/hw/riscv/sifive_e.c b/hw/riscv/sifive_e.c
index 40bbf530d49..9fe0c12df64 100644
--- a/hw/riscv/sifive_e.c
+++ b/hw/riscv/sifive_e.c
@@ -137,11 +137,6 @@ static void sifive_e_machine_instance_init(Object *obj)
     SiFiveEState *s = RISCV_E_MACHINE(obj);
 
     s->revb = false;
-    object_property_add_bool(obj, "revb", sifive_e_machine_get_revb,
-                             sifive_e_machine_set_revb);
-    object_property_set_description(obj, "revb",
-                                    "Set on to tell QEMU that it should model "
-                                    "the revB HiFive1 board");
 }
 
 static void sifive_e_machine_class_init(ObjectClass *oc, void *data)
@@ -152,6 +147,12 @@ static void sifive_e_machine_class_init(ObjectClass *oc, void *data)
     mc->init = sifive_e_machine_init;
     mc->max_cpus = 1;
     mc->default_cpu_type = SIFIVE_E_CPU;
+
+    object_class_property_add_bool(oc, "revb", sifive_e_machine_get_revb,
+                                   sifive_e_machine_set_revb);
+    object_class_property_set_description(oc, "revb",
+                                          "Set on to tell QEMU that it should model "
+                                          "the revB HiFive1 board");
 }
 
 static const TypeInfo sifive_e_machine_typeinfo = {
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 67+ messages in thread

* [PATCH 24/24] sifive_u: Register "start-in-flash" as class property
  2020-09-21 22:10 [PATCH 00/24] qom: Convert some properties to class properties Eduardo Habkost
@ 2020-09-21 22:10   ` Eduardo Habkost
  2020-09-21 22:10 ` [PATCH 02/24] cryptodev-backend: " Eduardo Habkost
                     ` (25 subsequent siblings)
  26 siblings, 0 replies; 67+ messages in thread
From: Eduardo Habkost @ 2020-09-21 22:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: Daniel P. Berrange, qemu-riscv, Sagar Karandikar,
	Bastian Koppelmann, Alistair Francis, Paolo Bonzini, John Snow,
	Palmer Dabbelt

Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Alistair Francis <Alistair.Francis@wdc.com>
Cc: Sagar Karandikar <sagark@eecs.berkeley.edu>
Cc: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Cc: qemu-riscv@nongnu.org
Cc: qemu-devel@nongnu.org
---
 hw/riscv/sifive_u.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c
index 4f12a93188d..0f0fab9a47b 100644
--- a/hw/riscv/sifive_u.c
+++ b/hw/riscv/sifive_u.c
@@ -568,14 +568,6 @@ static void sifive_u_machine_instance_init(Object *obj)
     SiFiveUState *s = RISCV_U_MACHINE(obj);
 
     s->start_in_flash = false;
-    object_property_add_bool(obj, "start-in-flash",
-                             sifive_u_machine_get_start_in_flash,
-                             sifive_u_machine_set_start_in_flash);
-    object_property_set_description(obj, "start-in-flash",
-                                    "Set on to tell QEMU's ROM to jump to "
-                                    "flash. Otherwise QEMU will jump to DRAM "
-                                    "or L2LIM depending on the msel value");
-
     s->msel = 0;
     object_property_add(obj, "msel", "uint32",
                         sifive_u_machine_get_uint32_prop,
@@ -599,6 +591,14 @@ static void sifive_u_machine_class_init(ObjectClass *oc, void *data)
     mc->max_cpus = SIFIVE_U_MANAGEMENT_CPU_COUNT + SIFIVE_U_COMPUTE_CPU_COUNT;
     mc->min_cpus = SIFIVE_U_MANAGEMENT_CPU_COUNT + 1;
     mc->default_cpus = mc->min_cpus;
+
+    object_class_property_add_bool(oc, "start-in-flash",
+                                   sifive_u_machine_get_start_in_flash,
+                                   sifive_u_machine_set_start_in_flash);
+    object_class_property_set_description(oc, "start-in-flash",
+                                          "Set on to tell QEMU's ROM to jump to "
+                                          "flash. Otherwise QEMU will jump to DRAM "
+                                          "or L2LIM depending on the msel value");
 }
 
 static const TypeInfo sifive_u_machine_typeinfo = {
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 67+ messages in thread

* [PATCH 24/24] sifive_u: Register "start-in-flash" as class property
@ 2020-09-21 22:10   ` Eduardo Habkost
  0 siblings, 0 replies; 67+ messages in thread
From: Eduardo Habkost @ 2020-09-21 22:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Daniel P. Berrange, John Snow, Palmer Dabbelt,
	Alistair Francis, Sagar Karandikar, Bastian Koppelmann,
	qemu-riscv

Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Alistair Francis <Alistair.Francis@wdc.com>
Cc: Sagar Karandikar <sagark@eecs.berkeley.edu>
Cc: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Cc: qemu-riscv@nongnu.org
Cc: qemu-devel@nongnu.org
---
 hw/riscv/sifive_u.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c
index 4f12a93188d..0f0fab9a47b 100644
--- a/hw/riscv/sifive_u.c
+++ b/hw/riscv/sifive_u.c
@@ -568,14 +568,6 @@ static void sifive_u_machine_instance_init(Object *obj)
     SiFiveUState *s = RISCV_U_MACHINE(obj);
 
     s->start_in_flash = false;
-    object_property_add_bool(obj, "start-in-flash",
-                             sifive_u_machine_get_start_in_flash,
-                             sifive_u_machine_set_start_in_flash);
-    object_property_set_description(obj, "start-in-flash",
-                                    "Set on to tell QEMU's ROM to jump to "
-                                    "flash. Otherwise QEMU will jump to DRAM "
-                                    "or L2LIM depending on the msel value");
-
     s->msel = 0;
     object_property_add(obj, "msel", "uint32",
                         sifive_u_machine_get_uint32_prop,
@@ -599,6 +591,14 @@ static void sifive_u_machine_class_init(ObjectClass *oc, void *data)
     mc->max_cpus = SIFIVE_U_MANAGEMENT_CPU_COUNT + SIFIVE_U_COMPUTE_CPU_COUNT;
     mc->min_cpus = SIFIVE_U_MANAGEMENT_CPU_COUNT + 1;
     mc->default_cpus = mc->min_cpus;
+
+    object_class_property_add_bool(oc, "start-in-flash",
+                                   sifive_u_machine_get_start_in_flash,
+                                   sifive_u_machine_set_start_in_flash);
+    object_class_property_set_description(oc, "start-in-flash",
+                                          "Set on to tell QEMU's ROM to jump to "
+                                          "flash. Otherwise QEMU will jump to DRAM "
+                                          "or L2LIM depending on the msel value");
 }
 
 static const TypeInfo sifive_u_machine_typeinfo = {
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 67+ messages in thread

* RE: [PATCH 01/24] cryptodev-vhost-user: Register "chardev" as class property
  2020-09-21 22:10 ` [PATCH 01/24] cryptodev-vhost-user: Register "chardev" as class property Eduardo Habkost
@ 2020-09-22  1:27   ` Gonglei (Arei)
  0 siblings, 0 replies; 67+ messages in thread
From: Gonglei (Arei) @ 2020-09-22  1:27 UTC (permalink / raw)
  To: Eduardo Habkost, qemu-devel; +Cc: John Snow, Paolo Bonzini, Daniel P. Berrange



> -----Original Message-----
> From: Eduardo Habkost [mailto:ehabkost@redhat.com]
> Sent: Tuesday, September 22, 2020 6:10 AM
> To: qemu-devel@nongnu.org
> Cc: Paolo Bonzini <pbonzini@redhat.com>; Daniel P. Berrange
> <berrange@redhat.com>; John Snow <jsnow@redhat.com>; Gonglei (Arei)
> <arei.gonglei@huawei.com>
> Subject: [PATCH 01/24] cryptodev-vhost-user: Register "chardev" as class
> property
> 
> Class properties make QOM introspection simpler and easier, as they don't
> require an object to be instantiated.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> Cc: "Gonglei (Arei)" <arei.gonglei@huawei.com>
> Cc: qemu-devel@nongnu.org
> ---

Reviewed-by: Gonglei <arei.gonglei@huawei.com>

Regards,
-Gonglei

>  backends/cryptodev-vhost-user.c | 13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)
> 
> diff --git a/backends/cryptodev-vhost-user.c
> b/backends/cryptodev-vhost-user.c index 41089dede15..690738c6c95
> 100644
> --- a/backends/cryptodev-vhost-user.c
> +++ b/backends/cryptodev-vhost-user.c
> @@ -336,13 +336,6 @@ cryptodev_vhost_user_get_chardev(Object *obj,
> Error **errp)
>      return NULL;
>  }
> 
> -static void cryptodev_vhost_user_instance_int(Object *obj) -{
> -    object_property_add_str(obj, "chardev",
> -                            cryptodev_vhost_user_get_chardev,
> -                            cryptodev_vhost_user_set_chardev);
> -}
> -
>  static void cryptodev_vhost_user_finalize(Object *obj)  {
>      CryptoDevBackendVhostUser *s =
> @@ -363,13 +356,17 @@ cryptodev_vhost_user_class_init(ObjectClass *oc,
> void *data)
>      bc->create_session = cryptodev_vhost_user_sym_create_session;
>      bc->close_session = cryptodev_vhost_user_sym_close_session;
>      bc->do_sym_op = NULL;
> +
> +    object_class_property_add_str(oc, "chardev",
> +                                  cryptodev_vhost_user_get_chardev,
> +                                  cryptodev_vhost_user_set_chardev);
> +
>  }
> 
>  static const TypeInfo cryptodev_vhost_user_info = {
>      .name = TYPE_CRYPTODEV_BACKEND_VHOST_USER,
>      .parent = TYPE_CRYPTODEV_BACKEND,
>      .class_init = cryptodev_vhost_user_class_init,
> -    .instance_init = cryptodev_vhost_user_instance_int,
>      .instance_finalize = cryptodev_vhost_user_finalize,
>      .instance_size = sizeof(CryptoDevBackendVhostUser),
>  };
> --
> 2.26.2



^ permalink raw reply	[flat|nested] 67+ messages in thread

* RE: [PATCH 02/24] cryptodev-backend: Register "chardev" as class property
  2020-09-21 22:10 ` [PATCH 02/24] cryptodev-backend: " Eduardo Habkost
@ 2020-09-22  1:27   ` Gonglei (Arei)
  0 siblings, 0 replies; 67+ messages in thread
From: Gonglei (Arei) @ 2020-09-22  1:27 UTC (permalink / raw)
  To: Eduardo Habkost, qemu-devel; +Cc: John Snow, Paolo Bonzini, Daniel P. Berrange



> -----Original Message-----
> From: Eduardo Habkost [mailto:ehabkost@redhat.com]
> Sent: Tuesday, September 22, 2020 6:10 AM
> To: qemu-devel@nongnu.org
> Cc: Paolo Bonzini <pbonzini@redhat.com>; Daniel P. Berrange
> <berrange@redhat.com>; John Snow <jsnow@redhat.com>; Gonglei (Arei)
> <arei.gonglei@huawei.com>
> Subject: [PATCH 02/24] cryptodev-backend: Register "chardev" as class
> property
> 
> Class properties make QOM introspection simpler and easier, as they don't
> require an object to be instantiated.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> Cc: "Gonglei (Arei)" <arei.gonglei@huawei.com>
> Cc: qemu-devel@nongnu.org
> ---
>  backends/cryptodev.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 

Reviewed-by: Gonglei <arei.gonglei@huawei.com>

Regards,
-Gonglei


> diff --git a/backends/cryptodev.c b/backends/cryptodev.c index
> ada4ebe78b1..3f141f61ed6 100644
> --- a/backends/cryptodev.c
> +++ b/backends/cryptodev.c
> @@ -206,10 +206,6 @@ cryptodev_backend_can_be_deleted(UserCreatable
> *uc)
> 
>  static void cryptodev_backend_instance_init(Object *obj)  {
> -    object_property_add(obj, "queues", "uint32",
> -                          cryptodev_backend_get_queues,
> -                          cryptodev_backend_set_queues,
> -                          NULL, NULL);
>      /* Initialize devices' queues property to 1 */
>      object_property_set_int(obj, "queues", 1, NULL);  } @@ -230,6 +226,10
> @@ cryptodev_backend_class_init(ObjectClass *oc, void *data)
>      ucc->can_be_deleted = cryptodev_backend_can_be_deleted;
> 
>      QTAILQ_INIT(&crypto_clients);
> +    object_class_property_add(oc, "queues", "uint32",
> +                              cryptodev_backend_get_queues,
> +                              cryptodev_backend_set_queues,
> +                              NULL, NULL);
>  }
> 
>  static const TypeInfo cryptodev_backend_info = {
> --
> 2.26.2



^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 00/24] qom: Convert some properties to class properties
  2020-09-21 22:10 [PATCH 00/24] qom: Convert some properties to class properties Eduardo Habkost
                   ` (23 preceding siblings ...)
  2020-09-21 22:10   ` Eduardo Habkost
@ 2020-09-22  1:47 ` Li Qiang
  2020-09-22  4:31   ` Eduardo Habkost
  2020-09-22  3:02 ` no-reply
  2020-09-22 21:00   ` Eduardo Habkost
  26 siblings, 1 reply; 67+ messages in thread
From: Li Qiang @ 2020-09-22  1:47 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: Paolo Bonzini, Daniel P. Berrange, John Snow, Qemu Developers

Eduardo Habkost <ehabkost@redhat.com> 于2020年9月22日周二 上午6:11写道:
>
> Class properties make QOM introspection simpler and easier, as it
> doesn't require an object to be instantiated.  This series
> converts a few existing object_property_add*() calls to register
> class properties instead.
>

Hello Eduardo,

IIUC, most of the properties can be dev-spec or class-spec.
Do we have any principle or rule to specify the property to be dev or class?

Maybe if the property which is always the same between instances can
be a class-property?

Thanks,
Li Qiang



> Eduardo Habkost (24):
>   cryptodev-vhost-user: Register "chardev" as class property
>   cryptodev-backend: Register "chardev" as class property
>   rng-egd: Register "chardev" as class property
>   rng-random: register "filename" as class property
>   vhost-user: Register "chardev" as class property
>   vexpress: Register "secure" as class property
>   rng: Register "opened" as class property
>   vexpress-a15: Register "virtualization" as class property
>   input-linux: Register properties as class properties
>   input-barrier: Register properties as class properties
>   tmp421: Register properties as class properties
>   s390x: Register all CPU properties as class properties
>   i386: Register most CPU properties as class properties
>   i386: Register feature bit properties as class properties
>   arm/virt: Register most properties as class properties
>   virt: Register "its" as class property
>   cpu/core: Register core-id and nr-threads as class properties
>   arm/cpu64: Register "aarch64" as class property
>   xlnx-zcu102: Register properties as class properties
>   machine: Register "memory-backend" as class property
>   vga-pci: Register "big-endian-framebuffer" as class property
>   i440fx: Register i440FX-pcihost properties as class properties
>   sifive_e: Register "revb" as class property
>   sifive_u: Register "start-in-flash" as class property
>
>  target/s390x/internal.h         |  1 -
>  backends/cryptodev-vhost-user.c | 13 ++---
>  backends/cryptodev.c            |  8 +--
>  backends/rng-egd.c              |  9 +--
>  backends/rng-random.c           |  8 +--
>  backends/rng.c                  |  8 +--
>  backends/vhost-user.c           |  6 +-
>  hw/arm/vexpress.c               | 25 +++++----
>  hw/arm/virt.c                   | 88 ++++++++++++++++-------------
>  hw/arm/xlnx-zcu102.c            | 25 +++++----
>  hw/core/machine.c               | 12 ++--
>  hw/cpu/core.c                   |  8 +--
>  hw/display/vga-pci.c            | 12 ++--
>  hw/misc/tmp421.c                | 30 +++++-----
>  hw/pci-host/i440fx.c            | 32 +++++------
>  hw/riscv/sifive_e.c             | 11 ++--
>  hw/riscv/sifive_u.c             | 16 +++---
>  target/arm/cpu64.c              | 16 ++----
>  target/i386/cpu.c               | 99 +++++++++++++++++----------------
>  target/s390x/cpu.c              |  1 -
>  target/s390x/cpu_models.c       | 35 ++++++------
>  ui/input-barrier.c              | 44 +++++++--------
>  ui/input-linux.c                | 27 ++++-----
>  23 files changed, 262 insertions(+), 272 deletions(-)
>
> --
> 2.26.2
>
>


^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 00/24] qom: Convert some properties to class properties
  2020-09-21 22:10 [PATCH 00/24] qom: Convert some properties to class properties Eduardo Habkost
                   ` (24 preceding siblings ...)
  2020-09-22  1:47 ` [PATCH 00/24] qom: Convert some properties to class properties Li Qiang
@ 2020-09-22  3:02 ` no-reply
  2020-09-22 21:00   ` Eduardo Habkost
  26 siblings, 0 replies; 67+ messages in thread
From: no-reply @ 2020-09-22  3:02 UTC (permalink / raw)
  To: ehabkost; +Cc: pbonzini, berrange, jsnow, qemu-devel

Patchew URL: https://patchew.org/QEMU/20200921221045.699690-1-ehabkost@redhat.com/



Hi,

This series failed the docker-quick@centos7 build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

=== TEST SCRIPT BEGIN ===
#!/bin/bash
make docker-image-centos7 V=1 NETWORK=1
time make docker-test-quick@centos7 SHOW_ENV=1 J=14 NETWORK=1
=== TEST SCRIPT END ===

C linker for the host machine: cc ld.bfd 2.27-43
Host machine cpu family: x86_64
Host machine cpu: x86_64
../src/meson.build:10: WARNING: Module unstable-keyval has no backwards or forwards compatibility and might not exist in future releases.
Program sh found: YES
Program python3 found: YES (/usr/bin/python3)
Configuring ninjatool using configuration
---
Running test qtest-x86_64: qos-test
Broken pipe
../src/tests/qtest/libqtest.c:175: kill_qemu() detected QEMU death from signal 7 (Bus error) (core dumped)
ERROR qtest-x86_64: device-introspect-test - too few tests run (expected 6, got 5)
make: *** [run-test-151] Error 1
make: *** Waiting for unfinished jobs....

Looking for expected file 'tests/data/acpi/microvm/FACP'
---
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['sudo', '-n', 'docker', 'run', '--rm', '--label', 'com.qemu.instance.uuid=1012ee92264940698a9ece48329b2072', '-u', '1003', '--security-opt', 'seccomp=unconfined', '-e', 'TARGET_LIST=', '-e', 'EXTRA_CONFIGURE_OPTS=', '-e', 'V=', '-e', 'J=14', '-e', 'DEBUG=', '-e', 'SHOW_ENV=1', '-e', 'CCACHE_DIR=/var/tmp/ccache', '-v', '/home/patchew2/.cache/qemu-docker-ccache:/var/tmp/ccache:z', '-v', '/var/tmp/patchew-tester-tmp-h2ifbdcv/src/docker-src.2020-09-21-22.55.00.16625:/var/tmp/qemu:z,ro', 'qemu/centos7', '/var/tmp/qemu/run', 'test-quick']' returned non-zero exit status 2.
filter=--filter=label=com.qemu.instance.uuid=1012ee92264940698a9ece48329b2072
make[1]: *** [docker-run] Error 1
make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-h2ifbdcv/src'
make: *** [docker-run-test-quick@centos7] Error 2

real    7m22.647s
user    0m20.149s


The full log is available at
http://patchew.org/logs/20200921221045.699690-1-ehabkost@redhat.com/testing.docker-quick@centos7/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 00/24] qom: Convert some properties to class properties
  2020-09-22  1:47 ` [PATCH 00/24] qom: Convert some properties to class properties Li Qiang
@ 2020-09-22  4:31   ` Eduardo Habkost
  0 siblings, 0 replies; 67+ messages in thread
From: Eduardo Habkost @ 2020-09-22  4:31 UTC (permalink / raw)
  To: Li Qiang; +Cc: Paolo Bonzini, Daniel P. Berrange, John Snow, Qemu Developers

On Tue, Sep 22, 2020 at 09:47:57AM +0800, Li Qiang wrote:
> Eduardo Habkost <ehabkost@redhat.com> 于2020年9月22日周二 上午6:11写道:
> >
> > Class properties make QOM introspection simpler and easier, as it
> > doesn't require an object to be instantiated.  This series
> > converts a few existing object_property_add*() calls to register
> > class properties instead.
> >
> 
> Hello Eduardo,
> 
> IIUC, most of the properties can be dev-spec or class-spec.
> Do we have any principle or rule to specify the property to be dev or class?
> 
> Maybe if the property which is always the same between instances can
> be a class-property?

If you are talking about having the same value, this is not the
use case for class properties.  Registering a class property just
means all instances of the object will have that property (but
each instance can have the property set to a different value),
and makes this information available for introspection before
instantiating the object.

-- 
Eduardo



^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 20/24] machine: Register "memory-backend" as class property
  2020-09-21 22:10 ` [PATCH 20/24] machine: Register "memory-backend" as class property Eduardo Habkost
@ 2020-09-22  6:39   ` Igor Mammedov
  0 siblings, 0 replies; 67+ messages in thread
From: Igor Mammedov @ 2020-09-22  6:39 UTC (permalink / raw)
  To: Eduardo Habkost; +Cc: Paolo Bonzini, Daniel P. Berrange, John Snow, qemu-devel

On Mon, 21 Sep 2020 18:10:41 -0400
Eduardo Habkost <ehabkost@redhat.com> wrote:

> Class properties make QOM introspection simpler and easier, as
> they don't require an object to be instantiated.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> Cc: Eduardo Habkost <ehabkost@redhat.com>
> Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> Cc: qemu-devel@nongnu.org

Reviewed-by: Igor Mammedov <imammedo@redhat.com>

> ---
>  hw/core/machine.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/hw/core/machine.c b/hw/core/machine.c
> index ea26d612374..675ca6d651c 100644
> --- a/hw/core/machine.c
> +++ b/hw/core/machine.c
> @@ -874,6 +874,12 @@ static void machine_class_init(ObjectClass *oc, void *data)
>          machine_get_memory_encryption, machine_set_memory_encryption);
>      object_class_property_set_description(oc, "memory-encryption",
>          "Set memory encryption object to use");
> +
> +    object_class_property_add_str(oc, "memory-backend",
> +                                  machine_get_memdev, machine_set_memdev);
> +    object_class_property_set_description(oc, "memory-backend",
> +                                          "Set RAM backend"
> +                                          "Valid value is ID of hostmem based backend");
>  }
>  
>  static void machine_class_base_init(ObjectClass *oc, void *data)
> @@ -925,12 +931,6 @@ static void machine_initfn(Object *obj)
>                                          "Table (HMAT)");
>      }
>  
> -    object_property_add_str(obj, "memory-backend",
> -                            machine_get_memdev, machine_set_memdev);
> -    object_property_set_description(obj, "memory-backend",
> -                                    "Set RAM backend"
> -                                    "Valid value is ID of hostmem based backend");
> -
>      /* Register notifier when init is done for sysbus sanity checks */
>      ms->sysbus_notifier.notify = machine_init_notify;
>      qemu_add_machine_init_done_notifier(&ms->sysbus_notifier);



^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 13/24] i386: Register most CPU properties as class properties
  2020-09-21 22:10 ` [PATCH 13/24] i386: Register most " Eduardo Habkost
@ 2020-09-22  6:41   ` Igor Mammedov
  2020-09-22 12:44     ` Eduardo Habkost
  2020-09-23  8:43   ` Igor Mammedov
  1 sibling, 1 reply; 67+ messages in thread
From: Igor Mammedov @ 2020-09-22  6:41 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: Paolo Bonzini, Daniel P. Berrange, John Snow, qemu-devel,
	Richard Henderson

On Mon, 21 Sep 2020 18:10:34 -0400
Eduardo Habkost <ehabkost@redhat.com> wrote:

> Class properties make QOM introspection simpler and easier, as
> they don't require an object to be instantiated.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Richard Henderson <rth@twiddle.net>
> Cc: Eduardo Habkost <ehabkost@redhat.com>
> Cc: qemu-devel@nongnu.org
> ---
>  target/i386/cpu.c | 66 ++++++++++++++++++++++++-----------------------
>  1 file changed, 34 insertions(+), 32 deletions(-)
> 
> diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> index 1c58f764dcb..66792f28ba7 100644
> --- a/target/i386/cpu.c
> +++ b/target/i386/cpu.c
> @@ -6922,44 +6922,12 @@ static void x86_cpu_initfn(Object *obj)
>      env->nr_dies = 1;
>      cpu_set_cpustate_pointers(cpu);
>  
> -    object_property_add(obj, "family", "int",
> -                        x86_cpuid_version_get_family,
> -                        x86_cpuid_version_set_family, NULL, NULL);
> -    object_property_add(obj, "model", "int",
> -                        x86_cpuid_version_get_model,
> -                        x86_cpuid_version_set_model, NULL, NULL);
> -    object_property_add(obj, "stepping", "int",
> -                        x86_cpuid_version_get_stepping,
> -                        x86_cpuid_version_set_stepping, NULL, NULL);
> -    object_property_add_str(obj, "vendor",
> -                            x86_cpuid_get_vendor,
> -                            x86_cpuid_set_vendor);
> -    object_property_add_str(obj, "model-id",
> -                            x86_cpuid_get_model_id,
> -                            x86_cpuid_set_model_id);
> -    object_property_add(obj, "tsc-frequency", "int",
> -                        x86_cpuid_get_tsc_freq,
> -                        x86_cpuid_set_tsc_freq, NULL, NULL);


>      object_property_add(obj, "feature-words", "X86CPUFeatureWordInfo",
>                          x86_cpu_get_feature_words,
>                          NULL, NULL, (void *)env->features);
>      object_property_add(obj, "filtered-features", "X86CPUFeatureWordInfo",
>                          x86_cpu_get_feature_words,
>                          NULL, NULL, (void *)cpu->filtered_features);

I'm just curious why these weren't moved as well?

> -    /*
> -     * The "unavailable-features" property has the same semantics as
> -     * CpuDefinitionInfo.unavailable-features on the "query-cpu-definitions"
> -     * QMP command: they list the features that would have prevented the
> -     * CPU from running if the "enforce" flag was set.
> -     */
> -    object_property_add(obj, "unavailable-features", "strList",
> -                        x86_cpu_get_unavailable_features,
> -                        NULL, NULL, NULL);
> -
> -#if !defined(CONFIG_USER_ONLY)
> -    object_property_add(obj, "crash-information", "GuestPanicInformation",
> -                        x86_cpu_get_crash_info_qom, NULL, NULL, NULL);
> -#endif
>  
>      for (w = 0; w < FEATURE_WORDS; w++) {
>          int bitnr;
> @@ -7308,6 +7276,40 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data)
>      cc->disas_set_info = x86_disas_set_info;
>  
>      dc->user_creatable = true;
> +
> +    object_class_property_add(oc, "family", "int",
> +                              x86_cpuid_version_get_family,
> +                              x86_cpuid_version_set_family, NULL, NULL);
> +    object_class_property_add(oc, "model", "int",
> +                              x86_cpuid_version_get_model,
> +                              x86_cpuid_version_set_model, NULL, NULL);
> +    object_class_property_add(oc, "stepping", "int",
> +                              x86_cpuid_version_get_stepping,
> +                              x86_cpuid_version_set_stepping, NULL, NULL);
> +    object_class_property_add_str(oc, "vendor",
> +                                  x86_cpuid_get_vendor,
> +                                  x86_cpuid_set_vendor);
> +    object_class_property_add_str(oc, "model-id",
> +                                  x86_cpuid_get_model_id,
> +                                  x86_cpuid_set_model_id);
> +    object_class_property_add(oc, "tsc-frequency", "int",
> +                              x86_cpuid_get_tsc_freq,
> +                              x86_cpuid_set_tsc_freq, NULL, NULL);
> +    /*
> +     * The "unavailable-features" property has the same semantics as
> +     * CpuDefinitionInfo.unavailable-features on the "query-cpu-definitions"
> +     * QMP command: they list the features that would have prevented the
> +     * CPU from running if the "enforce" flag was set.
> +     */
> +    object_class_property_add(oc, "unavailable-features", "strList",
> +                              x86_cpu_get_unavailable_features,
> +                              NULL, NULL, NULL);
> +
> +#if !defined(CONFIG_USER_ONLY)
> +    object_class_property_add(oc, "crash-information", "GuestPanicInformation",
> +                              x86_cpu_get_crash_info_qom, NULL, NULL, NULL);
> +#endif
> +
>  }
>  
>  static const TypeInfo x86_cpu_type_info = {



^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 14/24] i386: Register feature bit properties as class properties
  2020-09-21 22:10 ` [PATCH 14/24] i386: Register feature bit " Eduardo Habkost
@ 2020-09-22  6:47   ` Igor Mammedov
  2020-09-22 12:47   ` Eduardo Habkost
  1 sibling, 0 replies; 67+ messages in thread
From: Igor Mammedov @ 2020-09-22  6:47 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: Paolo Bonzini, Daniel P. Berrange, John Snow, qemu-devel,
	Richard Henderson

On Mon, 21 Sep 2020 18:10:35 -0400
Eduardo Habkost <ehabkost@redhat.com> wrote:

> Class properties make QOM introspection simpler and easier, as
> they don't require an object to be instantiated.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Richard Henderson <rth@twiddle.net>
> Cc: Eduardo Habkost <ehabkost@redhat.com>
> Cc: qemu-devel@nongnu.org

Reviewed-by: Igor Mammedov <imammedo@redhat.com>

> ---
>  target/i386/cpu.c | 33 ++++++++++++++++-----------------
>  1 file changed, 16 insertions(+), 17 deletions(-)
> 
> diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> index 66792f28ba7..1aba87e0a5b 100644
> --- a/target/i386/cpu.c
> +++ b/target/i386/cpu.c
> @@ -6819,16 +6819,17 @@ static void x86_cpu_release_bit_prop(Object *obj, const char *name,
>   * multiple bits in the same FeatureWord. In that case, the getter will return
>   * true only if all bits are set.
>   */
> -static void x86_cpu_register_bit_prop(X86CPU *cpu,
> +static void x86_cpu_register_bit_prop(X86CPUClass *xcc,
>                                        const char *prop_name,
>                                        FeatureWord w,
>                                        int bitnr)
>  {
> +    ObjectClass *oc = OBJECT_CLASS(xcc);
>      BitProperty *fp;
>      ObjectProperty *op;
>      uint64_t mask = (1ULL << bitnr);
>  
> -    op = object_property_find(OBJECT(cpu), prop_name, NULL);
> +    op = object_class_property_find(oc, prop_name, NULL);
>      if (op) {
>          fp = op->opaque;
>          assert(fp->w == w);
> @@ -6837,14 +6838,14 @@ static void x86_cpu_register_bit_prop(X86CPU *cpu,
>          fp = g_new0(BitProperty, 1);
>          fp->w = w;
>          fp->mask = mask;
> -        object_property_add(OBJECT(cpu), prop_name, "bool",
> -                            x86_cpu_get_bit_prop,
> -                            x86_cpu_set_bit_prop,
> -                            x86_cpu_release_bit_prop, fp);
> +        object_class_property_add(oc, prop_name, "bool",
> +                                  x86_cpu_get_bit_prop,
> +                                  x86_cpu_set_bit_prop,
> +                                  x86_cpu_release_bit_prop, fp);
>      }
>  }
>  
> -static void x86_cpu_register_feature_bit_props(X86CPU *cpu,
> +static void x86_cpu_register_feature_bit_props(X86CPUClass *xcc,
>                                                 FeatureWord w,
>                                                 int bitnr)
>  {
> @@ -6863,7 +6864,7 @@ static void x86_cpu_register_feature_bit_props(X86CPU *cpu,
>      /* aliases don't use "|" delimiters anymore, they are registered
>       * manually using object_property_add_alias() */
>      assert(!strchr(name, '|'));
> -    x86_cpu_register_bit_prop(cpu, name, w, bitnr);
> +    x86_cpu_register_bit_prop(xcc, name, w, bitnr);
>  }
>  
>  #if !defined(CONFIG_USER_ONLY)
> @@ -6917,7 +6918,6 @@ static void x86_cpu_initfn(Object *obj)
>      X86CPU *cpu = X86_CPU(obj);
>      X86CPUClass *xcc = X86_CPU_GET_CLASS(obj);
>      CPUX86State *env = &cpu->env;
> -    FeatureWord w;
>  
>      env->nr_dies = 1;
>      cpu_set_cpustate_pointers(cpu);
> @@ -6929,14 +6929,6 @@ static void x86_cpu_initfn(Object *obj)
>                          x86_cpu_get_feature_words,
>                          NULL, NULL, (void *)cpu->filtered_features);
>  
> -    for (w = 0; w < FEATURE_WORDS; w++) {
> -        int bitnr;
> -
> -        for (bitnr = 0; bitnr < 64; bitnr++) {
> -            x86_cpu_register_feature_bit_props(cpu, w, bitnr);
> -        }
> -    }
> -
>      object_property_add_alias(obj, "sse3", obj, "pni");
>      object_property_add_alias(obj, "pclmuldq", obj, "pclmulqdq");
>      object_property_add_alias(obj, "sse4-1", obj, "sse4.1");
> @@ -7221,6 +7213,7 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data)
>      X86CPUClass *xcc = X86_CPU_CLASS(oc);
>      CPUClass *cc = CPU_CLASS(oc);
>      DeviceClass *dc = DEVICE_CLASS(oc);
> +    FeatureWord w;
>  
>      device_class_set_parent_realize(dc, x86_cpu_realizefn,
>                                      &xcc->parent_realize);
> @@ -7310,6 +7303,12 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data)
>                                x86_cpu_get_crash_info_qom, NULL, NULL, NULL);
>  #endif
>  
> +    for (w = 0; w < FEATURE_WORDS; w++) {
> +        int bitnr;
> +        for (bitnr = 0; bitnr < 64; bitnr++) {
> +            x86_cpu_register_feature_bit_props(xcc, w, bitnr);
> +        }
> +    }
>  }
>  
>  static const TypeInfo x86_cpu_type_info = {



^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 12/24] s390x: Register all CPU properties as class properties
  2020-09-21 22:10 ` [PATCH 12/24] s390x: Register all CPU " Eduardo Habkost
@ 2020-09-22  6:47   ` David Hildenbrand
  2020-09-22  9:54   ` Cornelia Huck
  1 sibling, 0 replies; 67+ messages in thread
From: David Hildenbrand @ 2020-09-22  6:47 UTC (permalink / raw)
  To: Eduardo Habkost, qemu-devel
  Cc: Thomas Huth, Daniel P. Berrange, Cornelia Huck, Halil Pasic,
	Christian Borntraeger, qemu-s390x, Paolo Bonzini, John Snow,
	Richard Henderson

On 22.09.20 00:10, Eduardo Habkost wrote:
> Class properties make QOM introspection simpler and easier, as
> they don't require an object to be instantiated.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> Cc: Cornelia Huck <cohuck@redhat.com>
> Cc: Thomas Huth <thuth@redhat.com>
> Cc: Richard Henderson <rth@twiddle.net>
> Cc: David Hildenbrand <david@redhat.com>
> Cc: Halil Pasic <pasic@linux.ibm.com>
> Cc: Christian Borntraeger <borntraeger@de.ibm.com>
> Cc: qemu-s390x@nongnu.org
> Cc: qemu-devel@nongnu.org
> ---
>  target/s390x/internal.h   |  1 -
>  target/s390x/cpu.c        |  1 -
>  target/s390x/cpu_models.c | 35 ++++++++++++++++-------------------
>  3 files changed, 16 insertions(+), 21 deletions(-)
> 
> diff --git a/target/s390x/internal.h b/target/s390x/internal.h
> index b1e0ebf67f8..bac0d3c67b2 100644
> --- a/target/s390x/internal.h
> +++ b/target/s390x/internal.h
> @@ -260,7 +260,6 @@ static inline void s390_cpu_unhalt(S390CPU *cpu)
>  
>  
>  /* cpu_models.c */
> -void s390_cpu_model_register_props(Object *obj);
>  void s390_cpu_model_class_register_props(ObjectClass *oc);
>  void s390_realize_cpu_model(CPUState *cs, Error **errp);
>  ObjectClass *s390_cpu_class_by_name(const char *name);
> diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
> index 749cd548f0f..1dc45ca11b9 100644
> --- a/target/s390x/cpu.c
> +++ b/target/s390x/cpu.c
> @@ -302,7 +302,6 @@ static void s390_cpu_initfn(Object *obj)
>          timer_new_ns(QEMU_CLOCK_VIRTUAL, s390x_cpu_timer, cpu);
>      s390_cpu_set_state(S390_CPU_STATE_STOPPED, cpu);
>  #endif
> -    s390_cpu_model_register_props(obj);
>  }
>  
>  static void s390_cpu_finalize(Object *obj)
> diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
> index c2af2261743..b97e9596ab0 100644
> --- a/target/s390x/cpu_models.c
> +++ b/target/s390x/cpu_models.c
> @@ -1089,25 +1089,6 @@ static void set_feature_group(Object *obj, Visitor *v, const char *name,
>      }
>  }
>  
> -void s390_cpu_model_register_props(Object *obj)
> -{
> -    S390FeatGroup group;
> -    S390Feat feat;
> -
> -    for (feat = 0; feat < S390_FEAT_MAX; feat++) {
> -        const S390FeatDef *def = s390_feat_def(feat);
> -        object_property_add(obj, def->name, "bool", get_feature,
> -                            set_feature, NULL, (void *) feat);
> -        object_property_set_description(obj, def->name, def->desc);
> -    }
> -    for (group = 0; group < S390_FEAT_GROUP_MAX; group++) {
> -        const S390FeatGroupDef *def = s390_feat_group_def(group);
> -        object_property_add(obj, def->name, "bool", get_feature_group,
> -                            set_feature_group, NULL, (void *) group);
> -        object_property_set_description(obj, def->name, def->desc);
> -    }
> -}
> -
>  static void s390_cpu_model_initfn(Object *obj)
>  {
>      S390CPU *cpu = S390_CPU(obj);
> @@ -1215,11 +1196,27 @@ static char *get_description(Object *obj, Error **errp)
>  
>  void s390_cpu_model_class_register_props(ObjectClass *oc)
>  {
> +    S390FeatGroup group;
> +    S390Feat feat;
> +
>      object_class_property_add_bool(oc, "migration-safe", get_is_migration_safe,
>                                     NULL);
>      object_class_property_add_bool(oc, "static", get_is_static,
>                                     NULL);
>      object_class_property_add_str(oc, "description", get_description, NULL);
> +
> +    for (feat = 0; feat < S390_FEAT_MAX; feat++) {
> +        const S390FeatDef *def = s390_feat_def(feat);
> +        object_class_property_add(oc, def->name, "bool", get_feature,
> +                                  set_feature, NULL, (void *) feat);
> +        object_class_property_set_description(oc, def->name, def->desc);
> +    }
> +    for (group = 0; group < S390_FEAT_GROUP_MAX; group++) {
> +        const S390FeatGroupDef *def = s390_feat_group_def(group);
> +        object_class_property_add(oc, def->name, "bool", get_feature_group,
> +                                  set_feature_group, NULL, (void *) group);
> +        object_class_property_set_description(oc, def->name, def->desc);
> +    }

It would be even nicer to only register what's actually valid for a CPU
generation - but it's tricky for host/max, where that is determined
later at runtime.

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 
Thanks,

David / dhildenb



^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 17/24] cpu/core: Register core-id and nr-threads as class properties
  2020-09-21 22:10 ` [PATCH 17/24] cpu/core: Register core-id and nr-threads as class properties Eduardo Habkost
@ 2020-09-22  6:48   ` Igor Mammedov
  0 siblings, 0 replies; 67+ messages in thread
From: Igor Mammedov @ 2020-09-22  6:48 UTC (permalink / raw)
  To: Eduardo Habkost; +Cc: Paolo Bonzini, Daniel P. Berrange, John Snow, qemu-devel

On Mon, 21 Sep 2020 18:10:38 -0400
Eduardo Habkost <ehabkost@redhat.com> wrote:

> Class properties make QOM introspection simpler and easier, as
> they don't require an object to be instantiated.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Reviewed-by: Igor Mammedov <imammedo@redhat.com>

> ---
> Cc: qemu-devel@nongnu.org
> ---
>  hw/cpu/core.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/cpu/core.c b/hw/cpu/core.c
> index 3a659291eae..92d3b2fbad6 100644
> --- a/hw/cpu/core.c
> +++ b/hw/cpu/core.c
> @@ -69,10 +69,6 @@ static void cpu_core_instance_init(Object *obj)
>      MachineState *ms = MACHINE(qdev_get_machine());
>      CPUCore *core = CPU_CORE(obj);
>  
> -    object_property_add(obj, "core-id", "int", core_prop_get_core_id,
> -                        core_prop_set_core_id, NULL, NULL);
> -    object_property_add(obj, "nr-threads", "int", core_prop_get_nr_threads,
> -                        core_prop_set_nr_threads, NULL, NULL);
>      core->nr_threads = ms->smp.threads;
>  }
>  
> @@ -81,6 +77,10 @@ static void cpu_core_class_init(ObjectClass *oc, void *data)
>      DeviceClass *dc = DEVICE_CLASS(oc);
>  
>      set_bit(DEVICE_CATEGORY_CPU, dc->categories);
> +    object_class_property_add(oc, "core-id", "int", core_prop_get_core_id,
> +                              core_prop_set_core_id, NULL, NULL);
> +    object_class_property_add(oc, "nr-threads", "int", core_prop_get_nr_threads,
> +                              core_prop_set_nr_threads, NULL, NULL);
>  }
>  
>  static const TypeInfo cpu_core_type_info = {



^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 22/24] i440fx: Register i440FX-pcihost properties as class properties
  2020-09-21 22:10 ` [PATCH 22/24] i440fx: Register i440FX-pcihost properties as class properties Eduardo Habkost
@ 2020-09-22  6:49   ` Igor Mammedov
  2020-10-30  8:56   ` Michael S. Tsirkin
  1 sibling, 0 replies; 67+ messages in thread
From: Igor Mammedov @ 2020-09-22  6:49 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: Paolo Bonzini, Daniel P. Berrange, John Snow, qemu-devel,
	Michael S. Tsirkin

On Mon, 21 Sep 2020 18:10:43 -0400
Eduardo Habkost <ehabkost@redhat.com> wrote:

> Class properties make QOM introspection simpler and easier, as
> they don't require an object to be instantiated.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> Cc: qemu-devel@nongnu.org

Reviewed-by: Igor Mammedov <imammedo@redhat.com>

> ---
>  hw/pci-host/i440fx.c | 32 ++++++++++++++++----------------
>  1 file changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c
> index 93c62235ca7..4454ba06621 100644
> --- a/hw/pci-host/i440fx.c
> +++ b/hw/pci-host/i440fx.c
> @@ -212,22 +212,6 @@ static void i440fx_pcihost_initfn(Object *obj)
>                            "pci-conf-idx", 4);
>      memory_region_init_io(&s->data_mem, obj, &pci_host_data_le_ops, s,
>                            "pci-conf-data", 4);
> -
> -    object_property_add(obj, PCI_HOST_PROP_PCI_HOLE_START, "uint32",
> -                        i440fx_pcihost_get_pci_hole_start,
> -                        NULL, NULL, NULL);
> -
> -    object_property_add(obj, PCI_HOST_PROP_PCI_HOLE_END, "uint32",
> -                        i440fx_pcihost_get_pci_hole_end,
> -                        NULL, NULL, NULL);
> -
> -    object_property_add(obj, PCI_HOST_PROP_PCI_HOLE64_START, "uint64",
> -                        i440fx_pcihost_get_pci_hole64_start,
> -                        NULL, NULL, NULL);
> -
> -    object_property_add(obj, PCI_HOST_PROP_PCI_HOLE64_END, "uint64",
> -                        i440fx_pcihost_get_pci_hole64_end,
> -                        NULL, NULL, NULL);
>  }
>  
>  static void i440fx_pcihost_realize(DeviceState *dev, Error **errp)
> @@ -403,6 +387,22 @@ static void i440fx_pcihost_class_init(ObjectClass *klass, void *data)
>      device_class_set_props(dc, i440fx_props);
>      /* Reason: needs to be wired up by pc_init1 */
>      dc->user_creatable = false;
> +
> +    object_class_property_add(klass, PCI_HOST_PROP_PCI_HOLE_START, "uint32",
> +                              i440fx_pcihost_get_pci_hole_start,
> +                              NULL, NULL, NULL);
> +
> +    object_class_property_add(klass, PCI_HOST_PROP_PCI_HOLE_END, "uint32",
> +                              i440fx_pcihost_get_pci_hole_end,
> +                              NULL, NULL, NULL);
> +
> +    object_class_property_add(klass, PCI_HOST_PROP_PCI_HOLE64_START, "uint64",
> +                              i440fx_pcihost_get_pci_hole64_start,
> +                              NULL, NULL, NULL);
> +
> +    object_class_property_add(klass, PCI_HOST_PROP_PCI_HOLE64_END, "uint64",
> +                              i440fx_pcihost_get_pci_hole64_end,
> +                              NULL, NULL, NULL);
>  }
>  
>  static const TypeInfo i440fx_pcihost_info = {



^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 12/24] s390x: Register all CPU properties as class properties
  2020-09-21 22:10 ` [PATCH 12/24] s390x: Register all CPU " Eduardo Habkost
  2020-09-22  6:47   ` David Hildenbrand
@ 2020-09-22  9:54   ` Cornelia Huck
  1 sibling, 0 replies; 67+ messages in thread
From: Cornelia Huck @ 2020-09-22  9:54 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: Thomas Huth, Daniel P. Berrange, David Hildenbrand, qemu-devel,
	Halil Pasic, Christian Borntraeger, qemu-s390x, Paolo Bonzini,
	John Snow, Richard Henderson

On Mon, 21 Sep 2020 18:10:33 -0400
Eduardo Habkost <ehabkost@redhat.com> wrote:

> Class properties make QOM introspection simpler and easier, as
> they don't require an object to be instantiated.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> Cc: Cornelia Huck <cohuck@redhat.com>
> Cc: Thomas Huth <thuth@redhat.com>
> Cc: Richard Henderson <rth@twiddle.net>
> Cc: David Hildenbrand <david@redhat.com>
> Cc: Halil Pasic <pasic@linux.ibm.com>
> Cc: Christian Borntraeger <borntraeger@de.ibm.com>
> Cc: qemu-s390x@nongnu.org
> Cc: qemu-devel@nongnu.org
> ---
>  target/s390x/internal.h   |  1 -
>  target/s390x/cpu.c        |  1 -
>  target/s390x/cpu_models.c | 35 ++++++++++++++++-------------------
>  3 files changed, 16 insertions(+), 21 deletions(-)

I presume that this patch is supposed to go with the complete series?
(Have not looked.)

Acked-by: Cornelia Huck <cohuck@redhat.com>



^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 13/24] i386: Register most CPU properties as class properties
  2020-09-22  6:41   ` Igor Mammedov
@ 2020-09-22 12:44     ` Eduardo Habkost
  0 siblings, 0 replies; 67+ messages in thread
From: Eduardo Habkost @ 2020-09-22 12:44 UTC (permalink / raw)
  To: Igor Mammedov
  Cc: Paolo Bonzini, Daniel P. Berrange, John Snow, qemu-devel,
	Richard Henderson

On Tue, Sep 22, 2020 at 08:41:49AM +0200, Igor Mammedov wrote:
> On Mon, 21 Sep 2020 18:10:34 -0400
> Eduardo Habkost <ehabkost@redhat.com> wrote:
> 
> > Class properties make QOM introspection simpler and easier, as
> > they don't require an object to be instantiated.
> > 
> > Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> > ---
> > Cc: Paolo Bonzini <pbonzini@redhat.com>
> > Cc: Richard Henderson <rth@twiddle.net>
> > Cc: Eduardo Habkost <ehabkost@redhat.com>
> > Cc: qemu-devel@nongnu.org
> > ---
> >  target/i386/cpu.c | 66 ++++++++++++++++++++++++-----------------------
> >  1 file changed, 34 insertions(+), 32 deletions(-)
> > 
> > diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> > index 1c58f764dcb..66792f28ba7 100644
> > --- a/target/i386/cpu.c
> > +++ b/target/i386/cpu.c
> > @@ -6922,44 +6922,12 @@ static void x86_cpu_initfn(Object *obj)
> >      env->nr_dies = 1;
> >      cpu_set_cpustate_pointers(cpu);
> >  
> > -    object_property_add(obj, "family", "int",
> > -                        x86_cpuid_version_get_family,
> > -                        x86_cpuid_version_set_family, NULL, NULL);
> > -    object_property_add(obj, "model", "int",
> > -                        x86_cpuid_version_get_model,
> > -                        x86_cpuid_version_set_model, NULL, NULL);
> > -    object_property_add(obj, "stepping", "int",
> > -                        x86_cpuid_version_get_stepping,
> > -                        x86_cpuid_version_set_stepping, NULL, NULL);
> > -    object_property_add_str(obj, "vendor",
> > -                            x86_cpuid_get_vendor,
> > -                            x86_cpuid_set_vendor);
> > -    object_property_add_str(obj, "model-id",
> > -                            x86_cpuid_get_model_id,
> > -                            x86_cpuid_set_model_id);
> > -    object_property_add(obj, "tsc-frequency", "int",
> > -                        x86_cpuid_get_tsc_freq,
> > -                        x86_cpuid_set_tsc_freq, NULL, NULL);
> 
> 
> >      object_property_add(obj, "feature-words", "X86CPUFeatureWordInfo",
> >                          x86_cpu_get_feature_words,
> >                          NULL, NULL, (void *)env->features);
> >      object_property_add(obj, "filtered-features", "X86CPUFeatureWordInfo",
> >                          x86_cpu_get_feature_words,
> >                          NULL, NULL, (void *)cpu->filtered_features);
> 
> I'm just curious why these weren't moved as well?

Because of the (void*) arguments that need a pointer to the
instance.

-- 
Eduardo



^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 14/24] i386: Register feature bit properties as class properties
  2020-09-21 22:10 ` [PATCH 14/24] i386: Register feature bit " Eduardo Habkost
  2020-09-22  6:47   ` Igor Mammedov
@ 2020-09-22 12:47   ` Eduardo Habkost
  1 sibling, 0 replies; 67+ messages in thread
From: Eduardo Habkost @ 2020-09-22 12:47 UTC (permalink / raw)
  To: qemu-devel
  Cc: John Snow, Paolo Bonzini, Daniel P. Berrange, Richard Henderson

On Mon, Sep 21, 2020 at 06:10:35PM -0400, Eduardo Habkost wrote:
> Class properties make QOM introspection simpler and easier, as
> they don't require an object to be instantiated.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Richard Henderson <rth@twiddle.net>
> Cc: Eduardo Habkost <ehabkost@redhat.com>
> Cc: qemu-devel@nongnu.org
> ---
>  target/i386/cpu.c | 33 ++++++++++++++++-----------------
>  1 file changed, 16 insertions(+), 17 deletions(-)
> 
> diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> index 66792f28ba7..1aba87e0a5b 100644
> --- a/target/i386/cpu.c
> +++ b/target/i386/cpu.c
> @@ -6819,16 +6819,17 @@ static void x86_cpu_release_bit_prop(Object *obj, const char *name,
>   * multiple bits in the same FeatureWord. In that case, the getter will return
>   * true only if all bits are set.
>   */
> -static void x86_cpu_register_bit_prop(X86CPU *cpu,
> +static void x86_cpu_register_bit_prop(X86CPUClass *xcc,
>                                        const char *prop_name,
>                                        FeatureWord w,
>                                        int bitnr)
>  {
> +    ObjectClass *oc = OBJECT_CLASS(xcc);
>      BitProperty *fp;
>      ObjectProperty *op;
>      uint64_t mask = (1ULL << bitnr);
>  
> -    op = object_property_find(OBJECT(cpu), prop_name, NULL);
> +    op = object_class_property_find(oc, prop_name, NULL);
>      if (op) {
>          fp = op->opaque;
>          assert(fp->w == w);
> @@ -6837,14 +6838,14 @@ static void x86_cpu_register_bit_prop(X86CPU *cpu,
>          fp = g_new0(BitProperty, 1);
>          fp->w = w;
>          fp->mask = mask;
> -        object_property_add(OBJECT(cpu), prop_name, "bool",
> -                            x86_cpu_get_bit_prop,
> -                            x86_cpu_set_bit_prop,
> -                            x86_cpu_release_bit_prop, fp);
> +        object_class_property_add(oc, prop_name, "bool",
> +                                  x86_cpu_get_bit_prop,
> +                                  x86_cpu_set_bit_prop,
> +                                  x86_cpu_release_bit_prop, fp);

This one is broken.  x86_cpu_release_bit_prop() frees fp, and
now fp should never be freed.  The release function shouldn't be
set.

I will send a new version of this patch later.

> [...]

-- 
Eduardo



^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 24/24] sifive_u: Register "start-in-flash" as class property
  2020-09-21 22:10   ` Eduardo Habkost
@ 2020-09-22 16:44     ` Alistair Francis
  -1 siblings, 0 replies; 67+ messages in thread
From: Alistair Francis @ 2020-09-22 16:44 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: open list:RISC-V, Sagar Karandikar, Bastian Koppelmann,
	qemu-devel@nongnu.org Developers, Alistair Francis,
	Paolo Bonzini, Daniel P. Berrange, John Snow, Palmer Dabbelt

On Mon, Sep 21, 2020 at 3:21 PM Eduardo Habkost <ehabkost@redhat.com> wrote:
>
> Class properties make QOM introspection simpler and easier, as
> they don't require an object to be instantiated.
>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
> Cc: Palmer Dabbelt <palmer@dabbelt.com>
> Cc: Alistair Francis <Alistair.Francis@wdc.com>
> Cc: Sagar Karandikar <sagark@eecs.berkeley.edu>
> Cc: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
> Cc: qemu-riscv@nongnu.org
> Cc: qemu-devel@nongnu.org
> ---
>  hw/riscv/sifive_u.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c
> index 4f12a93188d..0f0fab9a47b 100644
> --- a/hw/riscv/sifive_u.c
> +++ b/hw/riscv/sifive_u.c
> @@ -568,14 +568,6 @@ static void sifive_u_machine_instance_init(Object *obj)
>      SiFiveUState *s = RISCV_U_MACHINE(obj);
>
>      s->start_in_flash = false;
> -    object_property_add_bool(obj, "start-in-flash",
> -                             sifive_u_machine_get_start_in_flash,
> -                             sifive_u_machine_set_start_in_flash);
> -    object_property_set_description(obj, "start-in-flash",
> -                                    "Set on to tell QEMU's ROM to jump to "
> -                                    "flash. Otherwise QEMU will jump to DRAM "
> -                                    "or L2LIM depending on the msel value");
> -
>      s->msel = 0;
>      object_property_add(obj, "msel", "uint32",
>                          sifive_u_machine_get_uint32_prop,
> @@ -599,6 +591,14 @@ static void sifive_u_machine_class_init(ObjectClass *oc, void *data)
>      mc->max_cpus = SIFIVE_U_MANAGEMENT_CPU_COUNT + SIFIVE_U_COMPUTE_CPU_COUNT;
>      mc->min_cpus = SIFIVE_U_MANAGEMENT_CPU_COUNT + 1;
>      mc->default_cpus = mc->min_cpus;
> +
> +    object_class_property_add_bool(oc, "start-in-flash",
> +                                   sifive_u_machine_get_start_in_flash,
> +                                   sifive_u_machine_set_start_in_flash);
> +    object_class_property_set_description(oc, "start-in-flash",
> +                                          "Set on to tell QEMU's ROM to jump to "
> +                                          "flash. Otherwise QEMU will jump to DRAM "
> +                                          "or L2LIM depending on the msel value");
>  }
>
>  static const TypeInfo sifive_u_machine_typeinfo = {
> --
> 2.26.2
>
>


^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 24/24] sifive_u: Register "start-in-flash" as class property
@ 2020-09-22 16:44     ` Alistair Francis
  0 siblings, 0 replies; 67+ messages in thread
From: Alistair Francis @ 2020-09-22 16:44 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: qemu-devel@nongnu.org Developers, Daniel P. Berrange,
	open list:RISC-V, Sagar Karandikar, Bastian Koppelmann,
	Alistair Francis, Paolo Bonzini, John Snow, Palmer Dabbelt

On Mon, Sep 21, 2020 at 3:21 PM Eduardo Habkost <ehabkost@redhat.com> wrote:
>
> Class properties make QOM introspection simpler and easier, as
> they don't require an object to be instantiated.
>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
> Cc: Palmer Dabbelt <palmer@dabbelt.com>
> Cc: Alistair Francis <Alistair.Francis@wdc.com>
> Cc: Sagar Karandikar <sagark@eecs.berkeley.edu>
> Cc: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
> Cc: qemu-riscv@nongnu.org
> Cc: qemu-devel@nongnu.org
> ---
>  hw/riscv/sifive_u.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c
> index 4f12a93188d..0f0fab9a47b 100644
> --- a/hw/riscv/sifive_u.c
> +++ b/hw/riscv/sifive_u.c
> @@ -568,14 +568,6 @@ static void sifive_u_machine_instance_init(Object *obj)
>      SiFiveUState *s = RISCV_U_MACHINE(obj);
>
>      s->start_in_flash = false;
> -    object_property_add_bool(obj, "start-in-flash",
> -                             sifive_u_machine_get_start_in_flash,
> -                             sifive_u_machine_set_start_in_flash);
> -    object_property_set_description(obj, "start-in-flash",
> -                                    "Set on to tell QEMU's ROM to jump to "
> -                                    "flash. Otherwise QEMU will jump to DRAM "
> -                                    "or L2LIM depending on the msel value");
> -
>      s->msel = 0;
>      object_property_add(obj, "msel", "uint32",
>                          sifive_u_machine_get_uint32_prop,
> @@ -599,6 +591,14 @@ static void sifive_u_machine_class_init(ObjectClass *oc, void *data)
>      mc->max_cpus = SIFIVE_U_MANAGEMENT_CPU_COUNT + SIFIVE_U_COMPUTE_CPU_COUNT;
>      mc->min_cpus = SIFIVE_U_MANAGEMENT_CPU_COUNT + 1;
>      mc->default_cpus = mc->min_cpus;
> +
> +    object_class_property_add_bool(oc, "start-in-flash",
> +                                   sifive_u_machine_get_start_in_flash,
> +                                   sifive_u_machine_set_start_in_flash);
> +    object_class_property_set_description(oc, "start-in-flash",
> +                                          "Set on to tell QEMU's ROM to jump to "
> +                                          "flash. Otherwise QEMU will jump to DRAM "
> +                                          "or L2LIM depending on the msel value");
>  }
>
>  static const TypeInfo sifive_u_machine_typeinfo = {
> --
> 2.26.2
>
>


^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 19/24] xlnx-zcu102: Register properties as class properties
  2020-09-21 22:10 ` [PATCH 19/24] xlnx-zcu102: Register properties as class properties Eduardo Habkost
@ 2020-09-22 16:44   ` Alistair Francis
  0 siblings, 0 replies; 67+ messages in thread
From: Alistair Francis @ 2020-09-22 16:44 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: Peter Maydell, Daniel P. Berrange, Alistair Francis,
	qemu-devel@nongnu.org Developers, qemu-arm, Paolo Bonzini,
	Edgar E. Iglesias, John Snow

On Mon, Sep 21, 2020 at 3:28 PM Eduardo Habkost <ehabkost@redhat.com> wrote:
>
> Class properties make QOM introspection simpler and easier, as
> they don't require an object to be instantiated.
>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
> Cc: Alistair Francis <alistair@alistair23.me>
> Cc: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
> Cc: Peter Maydell <peter.maydell@linaro.org>
> Cc: qemu-arm@nongnu.org
> Cc: qemu-devel@nongnu.org
> ---
>  hw/arm/xlnx-zcu102.c | 25 +++++++++++++------------
>  1 file changed, 13 insertions(+), 12 deletions(-)
>
> diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c
> index 19d5a4d4e0e..4deb96bfcc1 100644
> --- a/hw/arm/xlnx-zcu102.c
> +++ b/hw/arm/xlnx-zcu102.c
> @@ -208,20 +208,8 @@ static void xlnx_zcu102_machine_instance_init(Object *obj)
>
>      /* Default to secure mode being disabled */
>      s->secure = false;
> -    object_property_add_bool(obj, "secure", zcu102_get_secure,
> -                             zcu102_set_secure);
> -    object_property_set_description(obj, "secure",
> -                                    "Set on/off to enable/disable the ARM "
> -                                    "Security Extensions (TrustZone)");
> -
>      /* Default to virt (EL2) being disabled */
>      s->virt = false;
> -    object_property_add_bool(obj, "virtualization", zcu102_get_virt,
> -                             zcu102_set_virt);
> -    object_property_set_description(obj, "virtualization",
> -                                    "Set on/off to enable/disable emulating a "
> -                                    "guest CPU which implements the ARM "
> -                                    "Virtualization Extensions");
>  }
>
>  static void xlnx_zcu102_machine_class_init(ObjectClass *oc, void *data)
> @@ -237,6 +225,19 @@ static void xlnx_zcu102_machine_class_init(ObjectClass *oc, void *data)
>      mc->max_cpus = XLNX_ZYNQMP_NUM_APU_CPUS + XLNX_ZYNQMP_NUM_RPU_CPUS;
>      mc->default_cpus = XLNX_ZYNQMP_NUM_APU_CPUS;
>      mc->default_ram_id = "ddr-ram";
> +
> +    object_class_property_add_bool(oc, "secure", zcu102_get_secure,
> +                                   zcu102_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", zcu102_get_virt,
> +                                   zcu102_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");
>  }
>
>  static const TypeInfo xlnx_zcu102_machine_init_typeinfo = {
> --
> 2.26.2
>
>


^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 23/24] sifive_e: Register "revb" as class property
  2020-09-21 22:10   ` Eduardo Habkost
@ 2020-09-22 16:45     ` Alistair Francis
  -1 siblings, 0 replies; 67+ messages in thread
From: Alistair Francis @ 2020-09-22 16:45 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: open list:RISC-V, Sagar Karandikar, Bastian Koppelmann,
	qemu-devel@nongnu.org Developers, Alistair Francis,
	Paolo Bonzini, Daniel P. Berrange, John Snow, Palmer Dabbelt

On Mon, Sep 21, 2020 at 3:30 PM Eduardo Habkost <ehabkost@redhat.com> wrote:
>
> Class properties make QOM introspection simpler and easier, as
> they don't require an object to be instantiated.
>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
> Cc: Palmer Dabbelt <palmer@dabbelt.com>
> Cc: Alistair Francis <Alistair.Francis@wdc.com>
> Cc: Sagar Karandikar <sagark@eecs.berkeley.edu>
> Cc: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
> Cc: qemu-riscv@nongnu.org
> Cc: qemu-devel@nongnu.org
> ---
>  hw/riscv/sifive_e.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/hw/riscv/sifive_e.c b/hw/riscv/sifive_e.c
> index 40bbf530d49..9fe0c12df64 100644
> --- a/hw/riscv/sifive_e.c
> +++ b/hw/riscv/sifive_e.c
> @@ -137,11 +137,6 @@ static void sifive_e_machine_instance_init(Object *obj)
>      SiFiveEState *s = RISCV_E_MACHINE(obj);
>
>      s->revb = false;
> -    object_property_add_bool(obj, "revb", sifive_e_machine_get_revb,
> -                             sifive_e_machine_set_revb);
> -    object_property_set_description(obj, "revb",
> -                                    "Set on to tell QEMU that it should model "
> -                                    "the revB HiFive1 board");
>  }
>
>  static void sifive_e_machine_class_init(ObjectClass *oc, void *data)
> @@ -152,6 +147,12 @@ static void sifive_e_machine_class_init(ObjectClass *oc, void *data)
>      mc->init = sifive_e_machine_init;
>      mc->max_cpus = 1;
>      mc->default_cpu_type = SIFIVE_E_CPU;
> +
> +    object_class_property_add_bool(oc, "revb", sifive_e_machine_get_revb,
> +                                   sifive_e_machine_set_revb);
> +    object_class_property_set_description(oc, "revb",
> +                                          "Set on to tell QEMU that it should model "
> +                                          "the revB HiFive1 board");
>  }
>
>  static const TypeInfo sifive_e_machine_typeinfo = {
> --
> 2.26.2
>
>


^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 23/24] sifive_e: Register "revb" as class property
@ 2020-09-22 16:45     ` Alistair Francis
  0 siblings, 0 replies; 67+ messages in thread
From: Alistair Francis @ 2020-09-22 16:45 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: qemu-devel@nongnu.org Developers, Daniel P. Berrange,
	open list:RISC-V, Sagar Karandikar, Bastian Koppelmann,
	Alistair Francis, Paolo Bonzini, John Snow, Palmer Dabbelt

On Mon, Sep 21, 2020 at 3:30 PM Eduardo Habkost <ehabkost@redhat.com> wrote:
>
> Class properties make QOM introspection simpler and easier, as
> they don't require an object to be instantiated.
>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
> Cc: Palmer Dabbelt <palmer@dabbelt.com>
> Cc: Alistair Francis <Alistair.Francis@wdc.com>
> Cc: Sagar Karandikar <sagark@eecs.berkeley.edu>
> Cc: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
> Cc: qemu-riscv@nongnu.org
> Cc: qemu-devel@nongnu.org
> ---
>  hw/riscv/sifive_e.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/hw/riscv/sifive_e.c b/hw/riscv/sifive_e.c
> index 40bbf530d49..9fe0c12df64 100644
> --- a/hw/riscv/sifive_e.c
> +++ b/hw/riscv/sifive_e.c
> @@ -137,11 +137,6 @@ static void sifive_e_machine_instance_init(Object *obj)
>      SiFiveEState *s = RISCV_E_MACHINE(obj);
>
>      s->revb = false;
> -    object_property_add_bool(obj, "revb", sifive_e_machine_get_revb,
> -                             sifive_e_machine_set_revb);
> -    object_property_set_description(obj, "revb",
> -                                    "Set on to tell QEMU that it should model "
> -                                    "the revB HiFive1 board");
>  }
>
>  static void sifive_e_machine_class_init(ObjectClass *oc, void *data)
> @@ -152,6 +147,12 @@ static void sifive_e_machine_class_init(ObjectClass *oc, void *data)
>      mc->init = sifive_e_machine_init;
>      mc->max_cpus = 1;
>      mc->default_cpu_type = SIFIVE_E_CPU;
> +
> +    object_class_property_add_bool(oc, "revb", sifive_e_machine_get_revb,
> +                                   sifive_e_machine_set_revb);
> +    object_class_property_set_description(oc, "revb",
> +                                          "Set on to tell QEMU that it should model "
> +                                          "the revB HiFive1 board");
>  }
>
>  static const TypeInfo sifive_e_machine_typeinfo = {
> --
> 2.26.2
>
>


^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 00/24] qom: Convert some properties to class properties
  2020-09-21 22:10 [PATCH 00/24] qom: Convert some properties to class properties Eduardo Habkost
@ 2020-09-22 21:00   ` Eduardo Habkost
  2020-09-21 22:10 ` [PATCH 02/24] cryptodev-backend: " Eduardo Habkost
                     ` (25 subsequent siblings)
  26 siblings, 0 replies; 67+ messages in thread
From: Eduardo Habkost @ 2020-09-22 21:00 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Sagar Karandikar, David Hildenbrand,
	Alistair Francis, Gerd Hoffmann, Edgar E. Iglesias, qemu-riscv,
	Michael S. Tsirkin, Li Qiang, Halil Pasic, Christian Borntraeger,
	Gonglei (Arei),
	Laurent Vivier, Thomas Huth, Amit Shah, Alistair Francis,
	qemu-s390x, qemu-arm, Igor Mammedov, Alistair Francis, John Snow,
	Richard Henderson, Daniel P. Berrange, Bastian Koppelmann,
	Cornelia Huck, Palmer Dabbelt, Paolo Bonzini

On Mon, Sep 21, 2020 at 06:10:21PM -0400, Eduardo Habkost wrote:
> Class properties make QOM introspection simpler and easier, as it
> doesn't require an object to be instantiated.  This series
> converts a few existing object_property_add*() calls to register
> class properties instead.
> 
> Eduardo Habkost (24):
>   cryptodev-vhost-user: Register "chardev" as class property
>   cryptodev-backend: Register "chardev" as class property
>   rng-egd: Register "chardev" as class property
>   rng-random: register "filename" as class property
>   vhost-user: Register "chardev" as class property
>   vexpress: Register "secure" as class property
>   rng: Register "opened" as class property
>   vexpress-a15: Register "virtualization" as class property
>   input-linux: Register properties as class properties
>   input-barrier: Register properties as class properties
>   tmp421: Register properties as class properties
>   s390x: Register all CPU properties as class properties
>   i386: Register most CPU properties as class properties
>   i386: Register feature bit properties as class properties
>   arm/virt: Register most properties as class properties
>   virt: Register "its" as class property
>   cpu/core: Register core-id and nr-threads as class properties
>   arm/cpu64: Register "aarch64" as class property
>   xlnx-zcu102: Register properties as class properties
>   machine: Register "memory-backend" as class property
>   vga-pci: Register "big-endian-framebuffer" as class property
>   i440fx: Register i440FX-pcihost properties as class properties
>   sifive_e: Register "revb" as class property
>   sifive_u: Register "start-in-flash" as class property

I'm queueing the following:

[PATCH 01/24] cryptodev-vhost-user: Register "chardev" as class property
[PATCH 02/24] cryptodev-backend: Register "chardev" as class property
[PATCH 12/24] s390x: Register all CPU properties as class properties
[PATCH 17/24] cpu/core: Register core-id and nr-threads as class properties
[PATCH 19/24] xlnx-zcu102: Register properties as class properties
[PATCH 20/24] machine: Register "memory-backend" as class property
[PATCH 22/24] i440fx: Register i440FX-pcihost properties as class properties
[PATCH 23/24] sifive_e: Register "revb" as class property
[PATCH 24/24] sifive_u: Register "start-in-flash" as class property

The remaining patches still need reviews.

-- 
Eduardo



^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 00/24] qom: Convert some properties to class properties
@ 2020-09-22 21:00   ` Eduardo Habkost
  0 siblings, 0 replies; 67+ messages in thread
From: Eduardo Habkost @ 2020-09-22 21:00 UTC (permalink / raw)
  To: qemu-devel
  Cc: Gonglei (Arei),
	Li Qiang, Igor Mammedov, David Hildenbrand, Cornelia Huck,
	Alistair Francis, Paolo Bonzini, Daniel P. Berrange, John Snow,
	Laurent Vivier, Amit Shah, Michael S. Tsirkin, Peter Maydell,
	qemu-arm, Gerd Hoffmann, Marcel Apfelbaum, Thomas Huth,
	Richard Henderson, Halil Pasic, Christian Borntraeger,
	qemu-s390x, Palmer Dabbelt, Alistair Francis, Sagar Karandikar,
	Bastian Koppelmann, qemu-riscv, Alistair Francis,
	Edgar E. Iglesias

On Mon, Sep 21, 2020 at 06:10:21PM -0400, Eduardo Habkost wrote:
> Class properties make QOM introspection simpler and easier, as it
> doesn't require an object to be instantiated.  This series
> converts a few existing object_property_add*() calls to register
> class properties instead.
> 
> Eduardo Habkost (24):
>   cryptodev-vhost-user: Register "chardev" as class property
>   cryptodev-backend: Register "chardev" as class property
>   rng-egd: Register "chardev" as class property
>   rng-random: register "filename" as class property
>   vhost-user: Register "chardev" as class property
>   vexpress: Register "secure" as class property
>   rng: Register "opened" as class property
>   vexpress-a15: Register "virtualization" as class property
>   input-linux: Register properties as class properties
>   input-barrier: Register properties as class properties
>   tmp421: Register properties as class properties
>   s390x: Register all CPU properties as class properties
>   i386: Register most CPU properties as class properties
>   i386: Register feature bit properties as class properties
>   arm/virt: Register most properties as class properties
>   virt: Register "its" as class property
>   cpu/core: Register core-id and nr-threads as class properties
>   arm/cpu64: Register "aarch64" as class property
>   xlnx-zcu102: Register properties as class properties
>   machine: Register "memory-backend" as class property
>   vga-pci: Register "big-endian-framebuffer" as class property
>   i440fx: Register i440FX-pcihost properties as class properties
>   sifive_e: Register "revb" as class property
>   sifive_u: Register "start-in-flash" as class property

I'm queueing the following:

[PATCH 01/24] cryptodev-vhost-user: Register "chardev" as class property
[PATCH 02/24] cryptodev-backend: Register "chardev" as class property
[PATCH 12/24] s390x: Register all CPU properties as class properties
[PATCH 17/24] cpu/core: Register core-id and nr-threads as class properties
[PATCH 19/24] xlnx-zcu102: Register properties as class properties
[PATCH 20/24] machine: Register "memory-backend" as class property
[PATCH 22/24] i440fx: Register i440FX-pcihost properties as class properties
[PATCH 23/24] sifive_e: Register "revb" as class property
[PATCH 24/24] sifive_u: Register "start-in-flash" as class property

The remaining patches still need reviews.

-- 
Eduardo



^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 13/24] i386: Register most CPU properties as class properties
  2020-09-21 22:10 ` [PATCH 13/24] i386: Register most " Eduardo Habkost
  2020-09-22  6:41   ` Igor Mammedov
@ 2020-09-23  8:43   ` Igor Mammedov
  1 sibling, 0 replies; 67+ messages in thread
From: Igor Mammedov @ 2020-09-23  8:43 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: Paolo Bonzini, Daniel P. Berrange, John Snow, qemu-devel,
	Richard Henderson

On Mon, 21 Sep 2020 18:10:34 -0400
Eduardo Habkost <ehabkost@redhat.com> wrote:

> Class properties make QOM introspection simpler and easier, as
> they don't require an object to be instantiated.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Reviewed-by: Igor Mammedov <imammedo@redhat.com>

> ---
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Richard Henderson <rth@twiddle.net>
> Cc: Eduardo Habkost <ehabkost@redhat.com>
> Cc: qemu-devel@nongnu.org
> ---
>  target/i386/cpu.c | 66 ++++++++++++++++++++++++-----------------------
>  1 file changed, 34 insertions(+), 32 deletions(-)
> 
> diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> index 1c58f764dcb..66792f28ba7 100644
> --- a/target/i386/cpu.c
> +++ b/target/i386/cpu.c
> @@ -6922,44 +6922,12 @@ static void x86_cpu_initfn(Object *obj)
>      env->nr_dies = 1;
>      cpu_set_cpustate_pointers(cpu);
>  
> -    object_property_add(obj, "family", "int",
> -                        x86_cpuid_version_get_family,
> -                        x86_cpuid_version_set_family, NULL, NULL);
> -    object_property_add(obj, "model", "int",
> -                        x86_cpuid_version_get_model,
> -                        x86_cpuid_version_set_model, NULL, NULL);
> -    object_property_add(obj, "stepping", "int",
> -                        x86_cpuid_version_get_stepping,
> -                        x86_cpuid_version_set_stepping, NULL, NULL);
> -    object_property_add_str(obj, "vendor",
> -                            x86_cpuid_get_vendor,
> -                            x86_cpuid_set_vendor);
> -    object_property_add_str(obj, "model-id",
> -                            x86_cpuid_get_model_id,
> -                            x86_cpuid_set_model_id);
> -    object_property_add(obj, "tsc-frequency", "int",
> -                        x86_cpuid_get_tsc_freq,
> -                        x86_cpuid_set_tsc_freq, NULL, NULL);
>      object_property_add(obj, "feature-words", "X86CPUFeatureWordInfo",
>                          x86_cpu_get_feature_words,
>                          NULL, NULL, (void *)env->features);
>      object_property_add(obj, "filtered-features", "X86CPUFeatureWordInfo",
>                          x86_cpu_get_feature_words,
>                          NULL, NULL, (void *)cpu->filtered_features);
> -    /*
> -     * The "unavailable-features" property has the same semantics as
> -     * CpuDefinitionInfo.unavailable-features on the "query-cpu-definitions"
> -     * QMP command: they list the features that would have prevented the
> -     * CPU from running if the "enforce" flag was set.
> -     */
> -    object_property_add(obj, "unavailable-features", "strList",
> -                        x86_cpu_get_unavailable_features,
> -                        NULL, NULL, NULL);
> -
> -#if !defined(CONFIG_USER_ONLY)
> -    object_property_add(obj, "crash-information", "GuestPanicInformation",
> -                        x86_cpu_get_crash_info_qom, NULL, NULL, NULL);
> -#endif
>  
>      for (w = 0; w < FEATURE_WORDS; w++) {
>          int bitnr;
> @@ -7308,6 +7276,40 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data)
>      cc->disas_set_info = x86_disas_set_info;
>  
>      dc->user_creatable = true;
> +
> +    object_class_property_add(oc, "family", "int",
> +                              x86_cpuid_version_get_family,
> +                              x86_cpuid_version_set_family, NULL, NULL);
> +    object_class_property_add(oc, "model", "int",
> +                              x86_cpuid_version_get_model,
> +                              x86_cpuid_version_set_model, NULL, NULL);
> +    object_class_property_add(oc, "stepping", "int",
> +                              x86_cpuid_version_get_stepping,
> +                              x86_cpuid_version_set_stepping, NULL, NULL);
> +    object_class_property_add_str(oc, "vendor",
> +                                  x86_cpuid_get_vendor,
> +                                  x86_cpuid_set_vendor);
> +    object_class_property_add_str(oc, "model-id",
> +                                  x86_cpuid_get_model_id,
> +                                  x86_cpuid_set_model_id);
> +    object_class_property_add(oc, "tsc-frequency", "int",
> +                              x86_cpuid_get_tsc_freq,
> +                              x86_cpuid_set_tsc_freq, NULL, NULL);
> +    /*
> +     * The "unavailable-features" property has the same semantics as
> +     * CpuDefinitionInfo.unavailable-features on the "query-cpu-definitions"
> +     * QMP command: they list the features that would have prevented the
> +     * CPU from running if the "enforce" flag was set.
> +     */
> +    object_class_property_add(oc, "unavailable-features", "strList",
> +                              x86_cpu_get_unavailable_features,
> +                              NULL, NULL, NULL);
> +
> +#if !defined(CONFIG_USER_ONLY)
> +    object_class_property_add(oc, "crash-information", "GuestPanicInformation",
> +                              x86_cpu_get_crash_info_qom, NULL, NULL, NULL);
> +#endif
> +
>  }
>  
>  static const TypeInfo x86_cpu_type_info = {



^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 03/24] rng-egd: Register "chardev" as class property
  2020-09-21 22:10 ` [PATCH 03/24] rng-egd: " Eduardo Habkost
@ 2020-09-23  9:59   ` Daniel P. Berrangé
  0 siblings, 0 replies; 67+ messages in thread
From: Daniel P. Berrangé @ 2020-09-23  9:59 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: Laurent Vivier, Paolo Bonzini, John Snow, qemu-devel, Amit Shah

On Mon, Sep 21, 2020 at 06:10:24PM -0400, Eduardo Habkost wrote:
> Class properties make QOM introspection simpler and easier, as
> they don't require an object to be instantiated.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> Cc: Laurent Vivier <lvivier@redhat.com>
> Cc: Amit Shah <amit@kernel.org>
> Cc: qemu-devel@nongnu.org
> ---
>  backends/rng-egd.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 04/24] rng-random: register "filename" as class property
  2020-09-21 22:10 ` [PATCH 04/24] rng-random: register "filename" " Eduardo Habkost
@ 2020-09-23  9:59   ` Daniel P. Berrangé
  0 siblings, 0 replies; 67+ messages in thread
From: Daniel P. Berrangé @ 2020-09-23  9:59 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: Laurent Vivier, Paolo Bonzini, John Snow, qemu-devel, Amit Shah

On Mon, Sep 21, 2020 at 06:10:25PM -0400, Eduardo Habkost wrote:
> Class properties make QOM introspection simpler and easier, as
> they don't require an object to be instantiated.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> Cc: Laurent Vivier <lvivier@redhat.com>
> Cc: Amit Shah <amit@kernel.org>
> Cc: qemu-devel@nongnu.org
> ---
>  backends/rng-random.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 07/24] rng: Register "opened" as class property
  2020-09-21 22:10 ` [PATCH 07/24] rng: Register "opened" " Eduardo Habkost
@ 2020-09-23 10:00   ` Daniel P. Berrangé
  0 siblings, 0 replies; 67+ messages in thread
From: Daniel P. Berrangé @ 2020-09-23 10:00 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: Laurent Vivier, Paolo Bonzini, John Snow, qemu-devel, Amit Shah

On Mon, Sep 21, 2020 at 06:10:28PM -0400, Eduardo Habkost wrote:
> Class properties make QOM introspection simpler and easier, as
> they don't require an object to be instantiated.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> Cc: Laurent Vivier <lvivier@redhat.com>
> Cc: Amit Shah <amit@kernel.org>
> Cc: qemu-devel@nongnu.org
> ---
>  backends/rng.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 09/24] input-linux: Register properties as class properties
  2020-09-21 22:10 ` [PATCH 09/24] input-linux: Register properties as class properties Eduardo Habkost
@ 2020-09-23 10:01   ` Daniel P. Berrangé
  0 siblings, 0 replies; 67+ messages in thread
From: Daniel P. Berrangé @ 2020-09-23 10:01 UTC (permalink / raw)
  To: Eduardo Habkost; +Cc: Paolo Bonzini, John Snow, qemu-devel, Gerd Hoffmann

On Mon, Sep 21, 2020 at 06:10:30PM -0400, Eduardo Habkost wrote:
> Class properties make QOM introspection simpler and easier, as
> they don't require an object to be instantiated.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: qemu-devel@nongnu.org
> ---
>  ui/input-linux.c | 27 ++++++++++++++-------------
>  1 file changed, 14 insertions(+), 13 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 10/24] input-barrier: Register properties as class properties
  2020-09-21 22:10 ` [PATCH 10/24] input-barrier: " Eduardo Habkost
@ 2020-09-23 10:02   ` Daniel P. Berrangé
  0 siblings, 0 replies; 67+ messages in thread
From: Daniel P. Berrangé @ 2020-09-23 10:02 UTC (permalink / raw)
  To: Eduardo Habkost; +Cc: Paolo Bonzini, John Snow, qemu-devel, Gerd Hoffmann

On Mon, Sep 21, 2020 at 06:10:31PM -0400, Eduardo Habkost wrote:
> Class properties make QOM introspection simpler and easier, as
> they don't require an object to be instantiated.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: qemu-devel@nongnu.org
> ---
>  ui/input-barrier.c | 44 ++++++++++++++++++++++----------------------
>  1 file changed, 22 insertions(+), 22 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 00/24] qom: Convert some properties to class properties
  2020-09-22 21:00   ` Eduardo Habkost
@ 2020-10-07 22:26     ` Eduardo Habkost
  -1 siblings, 0 replies; 67+ messages in thread
From: Eduardo Habkost @ 2020-10-07 22:26 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Sagar Karandikar, David Hildenbrand,
	Alistair Francis, Gerd Hoffmann, Edgar E. Iglesias, qemu-riscv,
	Michael S. Tsirkin, Li Qiang, Halil Pasic, Christian Borntraeger,
	Gonglei (Arei),
	Marc-André Lureau, Laurent Vivier, Thomas Huth, Amit Shah,
	Alistair Francis, qemu-s390x, qemu-arm, Igor Mammedov,
	Alistair Francis, John Snow, Richard Henderson,
	Daniel P. Berrange, Bastian Koppelmann, Cornelia Huck,
	Palmer Dabbelt, Paolo Bonzini

On Tue, Sep 22, 2020 at 05:00:40PM -0400, Eduardo Habkost wrote:
> On Mon, Sep 21, 2020 at 06:10:21PM -0400, Eduardo Habkost wrote:
> > Class properties make QOM introspection simpler and easier, as it
> > doesn't require an object to be instantiated.  This series
> > converts a few existing object_property_add*() calls to register
> > class properties instead.
> > 
> > Eduardo Habkost (24):
> >   cryptodev-vhost-user: Register "chardev" as class property
> >   cryptodev-backend: Register "chardev" as class property
> >   rng-egd: Register "chardev" as class property
> >   rng-random: register "filename" as class property
> >   vhost-user: Register "chardev" as class property
> >   vexpress: Register "secure" as class property
> >   rng: Register "opened" as class property
> >   vexpress-a15: Register "virtualization" as class property
> >   input-linux: Register properties as class properties
> >   input-barrier: Register properties as class properties
> >   tmp421: Register properties as class properties
> >   s390x: Register all CPU properties as class properties
> >   i386: Register most CPU properties as class properties
> >   i386: Register feature bit properties as class properties
> >   arm/virt: Register most properties as class properties
> >   virt: Register "its" as class property
> >   cpu/core: Register core-id and nr-threads as class properties
> >   arm/cpu64: Register "aarch64" as class property
> >   xlnx-zcu102: Register properties as class properties
> >   machine: Register "memory-backend" as class property
> >   vga-pci: Register "big-endian-framebuffer" as class property
> >   i440fx: Register i440FX-pcihost properties as class properties
> >   sifive_e: Register "revb" as class property
> >   sifive_u: Register "start-in-flash" as class property
> 
> I'm queueing the following:
> 
> [PATCH 01/24] cryptodev-vhost-user: Register "chardev" as class property
> [PATCH 02/24] cryptodev-backend: Register "chardev" as class property
> [PATCH 12/24] s390x: Register all CPU properties as class properties
> [PATCH 17/24] cpu/core: Register core-id and nr-threads as class properties
> [PATCH 19/24] xlnx-zcu102: Register properties as class properties
> [PATCH 20/24] machine: Register "memory-backend" as class property
> [PATCH 22/24] i440fx: Register i440FX-pcihost properties as class properties
> [PATCH 23/24] sifive_e: Register "revb" as class property
> [PATCH 24/24] sifive_u: Register "start-in-flash" as class property
> 
> The remaining patches still need reviews.

Queueing:

[PATCH 03/24] rng-egd: Register "chardev" as class property
[PATCH 04/24] rng-random: register "filename" as class property
[PATCH 07/24] rng: Register "opened" as class property
[PATCH 09/24] input-linux: Register properties as class properties
[PATCH 10/24] input-barrier: Register properties as class properties
[PATCH 13/24] i386: Register most CPU properties as class properties
[PATCH 14/24] i386: Register feature bit properties as class properties

Waiting for reviews on:

[PATCH 05/24] vhost-user: Register "chardev" as class property
[PATCH 06/24] vexpress: Register "secure" as class property
[PATCH 08/24] vexpress-a15: Register "virtualization" as class property
[PATCH 11/24] tmp421: Register properties as class properties
[PATCH 15/24] arm/virt: Register most properties as class properties
[PATCH 16/24] virt: Register "its" as class property
[PATCH 18/24] arm/cpu64: Register "aarch64" as class property
[PATCH 21/24] vga-pci: Register "big-endian-framebuffer" as class property

-- 
Eduardo



^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 00/24] qom: Convert some properties to class properties
@ 2020-10-07 22:26     ` Eduardo Habkost
  0 siblings, 0 replies; 67+ messages in thread
From: Eduardo Habkost @ 2020-10-07 22:26 UTC (permalink / raw)
  To: qemu-devel
  Cc: Gonglei (Arei),
	Li Qiang, Igor Mammedov, David Hildenbrand, Cornelia Huck,
	Alistair Francis, Paolo Bonzini, Daniel P. Berrange, John Snow,
	Laurent Vivier, Amit Shah, Michael S. Tsirkin, Peter Maydell,
	qemu-arm, Gerd Hoffmann, Marcel Apfelbaum, Thomas Huth,
	Richard Henderson, Halil Pasic, Christian Borntraeger,
	qemu-s390x, Palmer Dabbelt, Alistair Francis, Sagar Karandikar,
	Bastian Koppelmann, qemu-riscv, Alistair Francis,
	Edgar E. Iglesias, Marc-André Lureau

On Tue, Sep 22, 2020 at 05:00:40PM -0400, Eduardo Habkost wrote:
> On Mon, Sep 21, 2020 at 06:10:21PM -0400, Eduardo Habkost wrote:
> > Class properties make QOM introspection simpler and easier, as it
> > doesn't require an object to be instantiated.  This series
> > converts a few existing object_property_add*() calls to register
> > class properties instead.
> > 
> > Eduardo Habkost (24):
> >   cryptodev-vhost-user: Register "chardev" as class property
> >   cryptodev-backend: Register "chardev" as class property
> >   rng-egd: Register "chardev" as class property
> >   rng-random: register "filename" as class property
> >   vhost-user: Register "chardev" as class property
> >   vexpress: Register "secure" as class property
> >   rng: Register "opened" as class property
> >   vexpress-a15: Register "virtualization" as class property
> >   input-linux: Register properties as class properties
> >   input-barrier: Register properties as class properties
> >   tmp421: Register properties as class properties
> >   s390x: Register all CPU properties as class properties
> >   i386: Register most CPU properties as class properties
> >   i386: Register feature bit properties as class properties
> >   arm/virt: Register most properties as class properties
> >   virt: Register "its" as class property
> >   cpu/core: Register core-id and nr-threads as class properties
> >   arm/cpu64: Register "aarch64" as class property
> >   xlnx-zcu102: Register properties as class properties
> >   machine: Register "memory-backend" as class property
> >   vga-pci: Register "big-endian-framebuffer" as class property
> >   i440fx: Register i440FX-pcihost properties as class properties
> >   sifive_e: Register "revb" as class property
> >   sifive_u: Register "start-in-flash" as class property
> 
> I'm queueing the following:
> 
> [PATCH 01/24] cryptodev-vhost-user: Register "chardev" as class property
> [PATCH 02/24] cryptodev-backend: Register "chardev" as class property
> [PATCH 12/24] s390x: Register all CPU properties as class properties
> [PATCH 17/24] cpu/core: Register core-id and nr-threads as class properties
> [PATCH 19/24] xlnx-zcu102: Register properties as class properties
> [PATCH 20/24] machine: Register "memory-backend" as class property
> [PATCH 22/24] i440fx: Register i440FX-pcihost properties as class properties
> [PATCH 23/24] sifive_e: Register "revb" as class property
> [PATCH 24/24] sifive_u: Register "start-in-flash" as class property
> 
> The remaining patches still need reviews.

Queueing:

[PATCH 03/24] rng-egd: Register "chardev" as class property
[PATCH 04/24] rng-random: register "filename" as class property
[PATCH 07/24] rng: Register "opened" as class property
[PATCH 09/24] input-linux: Register properties as class properties
[PATCH 10/24] input-barrier: Register properties as class properties
[PATCH 13/24] i386: Register most CPU properties as class properties
[PATCH 14/24] i386: Register feature bit properties as class properties

Waiting for reviews on:

[PATCH 05/24] vhost-user: Register "chardev" as class property
[PATCH 06/24] vexpress: Register "secure" as class property
[PATCH 08/24] vexpress-a15: Register "virtualization" as class property
[PATCH 11/24] tmp421: Register properties as class properties
[PATCH 15/24] arm/virt: Register most properties as class properties
[PATCH 16/24] virt: Register "its" as class property
[PATCH 18/24] arm/cpu64: Register "aarch64" as class property
[PATCH 21/24] vga-pci: Register "big-endian-framebuffer" as class property

-- 
Eduardo



^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 05/24] vhost-user: Register "chardev" as class property
  2020-09-21 22:10 ` [PATCH 05/24] vhost-user: Register "chardev" " Eduardo Habkost
@ 2020-10-08  6:58   ` Marc-André Lureau
  2020-10-23 18:16   ` Igor Mammedov
  2020-10-30  8:56   ` Michael S. Tsirkin
  2 siblings, 0 replies; 67+ messages in thread
From: Marc-André Lureau @ 2020-10-08  6:58 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: Paolo Bonzini, Daniel P. Berrange, John Snow, QEMU, Michael S. Tsirkin

[-- Attachment #1: Type: text/plain, Size: 1602 bytes --]

On Tue, Sep 22, 2020 at 2:13 AM Eduardo Habkost <ehabkost@redhat.com> wrote:

> Class properties make QOM introspection simpler and easier, as
> they don't require an object to be instantiated.
>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

---
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: qemu-devel@nongnu.org
> ---
>  backends/vhost-user.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/backends/vhost-user.c b/backends/vhost-user.c
> index 9e6e1985465..858fdeae26c 100644
> --- a/backends/vhost-user.c
> +++ b/backends/vhost-user.c
> @@ -175,9 +175,9 @@ static char *get_chardev(Object *obj, Error **errp)
>      return NULL;
>  }
>
> -static void vhost_user_backend_init(Object *obj)
> +static void vhost_user_backend_class_init(ObjectClass *oc, void *data)
>  {
> -    object_property_add_str(obj, "chardev", get_chardev, set_chardev);
> +    object_class_property_add_str(oc, "chardev", get_chardev,
> set_chardev);
>  }
>
>  static void vhost_user_backend_finalize(Object *obj)
> @@ -195,7 +195,7 @@ static const TypeInfo vhost_user_backend_info = {
>      .name = TYPE_VHOST_USER_BACKEND,
>      .parent = TYPE_OBJECT,
>      .instance_size = sizeof(VhostUserBackend),
> -    .instance_init = vhost_user_backend_init,
> +    .class_init = vhost_user_backend_class_init,
>      .instance_finalize = vhost_user_backend_finalize,
>      .class_size = sizeof(VhostUserBackendClass),
>  };
> --
> 2.26.2
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 2525 bytes --]

^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 21/24] vga-pci: Register "big-endian-framebuffer" as class property
  2020-09-21 22:10 ` [PATCH 21/24] vga-pci: Register "big-endian-framebuffer" " Eduardo Habkost
@ 2020-10-08  7:00   ` Marc-André Lureau
  0 siblings, 0 replies; 67+ messages in thread
From: Marc-André Lureau @ 2020-10-08  7:00 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: Paolo Bonzini, Daniel P. Berrange, John Snow, QEMU, Gerd Hoffmann

[-- Attachment #1: Type: text/plain, Size: 2019 bytes --]

On Tue, Sep 22, 2020 at 2:28 AM Eduardo Habkost <ehabkost@redhat.com> wrote:

> Class properties make QOM introspection simpler and easier, as
> they don't require an object to be instantiated.
>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
>


Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

---
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: qemu-devel@nongnu.org
> ---
>  hw/display/vga-pci.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/hw/display/vga-pci.c b/hw/display/vga-pci.c
> index 3b45fa3bad0..b2a7d03c5d5 100644
> --- a/hw/display/vga-pci.c
> +++ b/hw/display/vga-pci.c
> @@ -269,13 +269,6 @@ static void pci_std_vga_realize(PCIDevice *dev, Error
> **errp)
>      }
>  }
>
> -static void pci_std_vga_init(Object *obj)
> -{
> -    /* Expose framebuffer byteorder via QOM */
> -    object_property_add_bool(obj, "big-endian-framebuffer",
> -                             vga_get_big_endian_fb,
> vga_set_big_endian_fb);
> -}
> -
>  static void pci_secondary_vga_realize(PCIDevice *dev, Error **errp)
>  {
>      PCIVGAState *d = PCI_VGA(dev);
> @@ -388,6 +381,10 @@ static void vga_class_init(ObjectClass *klass, void
> *data)
>      k->class_id = PCI_CLASS_DISPLAY_VGA;
>      device_class_set_props(dc, vga_pci_properties);
>      dc->hotpluggable = false;
> +
> +    /* Expose framebuffer byteorder via QOM */
> +    object_class_property_add_bool(klass, "big-endian-framebuffer",
> +                                   vga_get_big_endian_fb,
> vga_set_big_endian_fb);
>  }
>
>  static void secondary_class_init(ObjectClass *klass, void *data)
> @@ -405,7 +402,6 @@ static void secondary_class_init(ObjectClass *klass,
> void *data)
>  static const TypeInfo vga_info = {
>      .name          = "VGA",
>      .parent        = TYPE_PCI_VGA,
> -    .instance_init = pci_std_vga_init,
>      .class_init    = vga_class_init,
>  };
>
> --
> 2.26.2
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 3071 bytes --]

^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 05/24] vhost-user: Register "chardev" as class property
  2020-09-21 22:10 ` [PATCH 05/24] vhost-user: Register "chardev" " Eduardo Habkost
  2020-10-08  6:58   ` Marc-André Lureau
@ 2020-10-23 18:16   ` Igor Mammedov
  2020-10-30  8:56   ` Michael S. Tsirkin
  2 siblings, 0 replies; 67+ messages in thread
From: Igor Mammedov @ 2020-10-23 18:16 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: Paolo Bonzini, Daniel P. Berrange, John Snow, qemu-devel,
	Michael S. Tsirkin

On Mon, 21 Sep 2020 18:10:26 -0400
Eduardo Habkost <ehabkost@redhat.com> wrote:

> Class properties make QOM introspection simpler and easier, as
> they don't require an object to be instantiated.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Reviewed-by: Igor Mammedov <imammedo@redhat.com>

> ---
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: qemu-devel@nongnu.org
> ---
>  backends/vhost-user.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/backends/vhost-user.c b/backends/vhost-user.c
> index 9e6e1985465..858fdeae26c 100644
> --- a/backends/vhost-user.c
> +++ b/backends/vhost-user.c
> @@ -175,9 +175,9 @@ static char *get_chardev(Object *obj, Error **errp)
>      return NULL;
>  }
>  
> -static void vhost_user_backend_init(Object *obj)
> +static void vhost_user_backend_class_init(ObjectClass *oc, void *data)
>  {
> -    object_property_add_str(obj, "chardev", get_chardev, set_chardev);
> +    object_class_property_add_str(oc, "chardev", get_chardev, set_chardev);
>  }
>  
>  static void vhost_user_backend_finalize(Object *obj)
> @@ -195,7 +195,7 @@ static const TypeInfo vhost_user_backend_info = {
>      .name = TYPE_VHOST_USER_BACKEND,
>      .parent = TYPE_OBJECT,
>      .instance_size = sizeof(VhostUserBackend),
> -    .instance_init = vhost_user_backend_init,
> +    .class_init = vhost_user_backend_class_init,
>      .instance_finalize = vhost_user_backend_finalize,
>      .class_size = sizeof(VhostUserBackendClass),
>  };



^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 08/24] vexpress-a15: Register "virtualization" as class property
  2020-09-21 22:10 ` [PATCH 08/24] vexpress-a15: Register "virtualization" " Eduardo Habkost
@ 2020-10-23 18:19   ` Igor Mammedov
  0 siblings, 0 replies; 67+ messages in thread
From: Igor Mammedov @ 2020-10-23 18:19 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: Peter Maydell, Daniel P. Berrange, qemu-devel, qemu-arm,
	Paolo Bonzini, John Snow

On Mon, 21 Sep 2020 18:10:29 -0400
Eduardo Habkost <ehabkost@redhat.com> wrote:

> Class properties make QOM introspection simpler and easier, as
> they don't require an object to be instantiated.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Reviewed-by: Igor Mammedov <imammedo@redhat.com>

> ---
> Cc: Peter Maydell <peter.maydell@linaro.org>
> Cc: qemu-arm@nongnu.org
> Cc: qemu-devel@nongnu.org
> ---
>  hw/arm/vexpress.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
> index 0cc35749d7d..13339302af5 100644
> --- a/hw/arm/vexpress.c
> +++ b/hw/arm/vexpress.c
> @@ -769,12 +769,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)
> @@ -822,6 +816,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 = {



^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 11/24] tmp421: Register properties as class properties
  2020-09-21 22:10 ` [PATCH 11/24] tmp421: " Eduardo Habkost
@ 2020-10-23 18:21   ` Igor Mammedov
  0 siblings, 0 replies; 67+ messages in thread
From: Igor Mammedov @ 2020-10-23 18:21 UTC (permalink / raw)
  To: Eduardo Habkost; +Cc: Paolo Bonzini, Daniel P. Berrange, John Snow, qemu-devel

On Mon, 21 Sep 2020 18:10:32 -0400
Eduardo Habkost <ehabkost@redhat.com> wrote:

> Class properties make QOM introspection simpler and easier, as
> they don't require an object to be instantiated.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Reviewed-by: Igor Mammedov <imammedo@redhat.com>

> ---
> Cc: qemu-devel@nongnu.org
> ---
>  hw/misc/tmp421.c | 30 +++++++++++++-----------------
>  1 file changed, 13 insertions(+), 17 deletions(-)
> 
> diff --git a/hw/misc/tmp421.c b/hw/misc/tmp421.c
> index 212d6e0e831..1c19a3a9713 100644
> --- a/hw/misc/tmp421.c
> +++ b/hw/misc/tmp421.c
> @@ -340,22 +340,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);
> @@ -368,6 +352,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 = {
> @@ -375,7 +372,6 @@ static const TypeInfo tmp421_info = {
>      .parent        = TYPE_I2C_SLAVE,
>      .instance_size = sizeof(TMP421State),
>      .class_size    = sizeof(TMP421Class),
> -    .instance_init = tmp421_initfn,
>      .abstract      = true,
>  };
>  



^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 15/24] arm/virt: Register most properties as class properties
  2020-09-21 22:10 ` [PATCH 15/24] arm/virt: Register most " Eduardo Habkost
@ 2020-10-23 18:26   ` Igor Mammedov
  0 siblings, 0 replies; 67+ messages in thread
From: Igor Mammedov @ 2020-10-23 18:26 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: Peter Maydell, Daniel P. Berrange, qemu-devel, qemu-arm,
	Paolo Bonzini, John Snow

On Mon, 21 Sep 2020 18:10:36 -0400
Eduardo Habkost <ehabkost@redhat.com> wrote:

> Class properties make QOM introspection simpler and easier, as
> they don't require an object to be instantiated.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Reviewed-by: Igor Mammedov <imammedo@redhat.com>

> ---
> Cc: Peter Maydell <peter.maydell@linaro.org>
> Cc: qemu-arm@nongnu.org
> Cc: qemu-devel@nongnu.org
> ---
>  hw/arm/virt.c | 76 +++++++++++++++++++++++++++------------------------
>  1 file changed, 41 insertions(+), 35 deletions(-)
> 
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index acf9bfbecea..d1ab660fa60 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -2443,6 +2443,47 @@ 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");
>  }
>  
>  static void virt_instance_init(Object *obj)
> @@ -2455,34 +2496,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;
>  
> @@ -2500,26 +2520,12 @@ static void virt_instance_init(Object *obj)
>  
>      /* 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;
>  



^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 16/24] virt: Register "its" as class property
  2020-09-21 22:10 ` [PATCH 16/24] virt: Register "its" as class property Eduardo Habkost
@ 2020-10-23 18:33   ` Igor Mammedov
  2020-11-02 11:12   ` Peter Maydell
  1 sibling, 0 replies; 67+ messages in thread
From: Igor Mammedov @ 2020-10-23 18:33 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: Peter Maydell, Daniel P. Berrange, qemu-devel, qemu-arm,
	Paolo Bonzini, John Snow

On Mon, 21 Sep 2020 18:10:37 -0400
Eduardo Habkost <ehabkost@redhat.com> wrote:

> Class properties make QOM introspection simpler and easier, as
> they don't require an object to be instantiated.
> 
> Note: "its" is currently registered conditionally, but this makes
> the feature be registered unconditionally.  The only side effect
> is that it will be now possible to set its=on on virt-2.7 and
> older.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Reviewed-by: Igor Mammedov <imammedo@redhat.com>

> ---
> Cc: Peter Maydell <peter.maydell@linaro.org>
> Cc: qemu-arm@nongnu.org
> Cc: qemu-devel@nongnu.org
> ---
>  hw/arm/virt.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index d1ab660fa60..986b75a6b89 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -2484,6 +2484,13 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
>                                            "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)
> @@ -2511,11 +2518,6 @@ 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 */



^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 18/24] arm/cpu64: Register "aarch64" as class property
  2020-09-21 22:10 ` [PATCH 18/24] arm/cpu64: Register "aarch64" as class property Eduardo Habkost
@ 2020-10-23 18:34   ` Igor Mammedov
  0 siblings, 0 replies; 67+ messages in thread
From: Igor Mammedov @ 2020-10-23 18:34 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: Peter Maydell, Daniel P. Berrange, qemu-devel, qemu-arm,
	Paolo Bonzini, John Snow

On Mon, 21 Sep 2020 18:10:39 -0400
Eduardo Habkost <ehabkost@redhat.com> wrote:

> Class properties make QOM introspection simpler and easier, as
> they don't require an object to be instantiated.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Reviewed-by: Igor Mammedov <imammedo@redhat.com>

> ---
> Cc: Peter Maydell <peter.maydell@linaro.org>
> Cc: qemu-arm@nongnu.org
> Cc: qemu-devel@nongnu.org
> ---
>  target/arm/cpu64.c | 16 ++++++----------
>  1 file changed, 6 insertions(+), 10 deletions(-)
> 
> diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
> index 3c2b3d95993..349c9fa3a3a 100644
> --- a/target/arm/cpu64.c
> +++ b/target/arm/cpu64.c
> @@ -758,15 +758,6 @@ static void aarch64_cpu_set_aarch64(Object *obj, bool value, Error **errp)
>      }
>  }
>  
> -static void aarch64_cpu_initfn(Object *obj)
> -{
> -    object_property_add_bool(obj, "aarch64", aarch64_cpu_get_aarch64,
> -                             aarch64_cpu_set_aarch64);
> -    object_property_set_description(obj, "aarch64",
> -                                    "Set on/off to enable/disable aarch64 "
> -                                    "execution state ");
> -}
> -
>  static void aarch64_cpu_finalizefn(Object *obj)
>  {
>  }
> @@ -786,6 +777,12 @@ static void aarch64_cpu_class_init(ObjectClass *oc, void *data)
>      cc->gdb_num_core_regs = 34;
>      cc->gdb_core_xml_file = "aarch64-core.xml";
>      cc->gdb_arch_name = aarch64_gdb_arch_name;
> +
> +    object_class_property_add_bool(oc, "aarch64", aarch64_cpu_get_aarch64,
> +                                   aarch64_cpu_set_aarch64);
> +    object_class_property_set_description(oc, "aarch64",
> +                                          "Set on/off to enable/disable aarch64 "
> +                                          "execution state ");
>  }
>  
>  static void aarch64_cpu_instance_init(Object *obj)
> @@ -823,7 +820,6 @@ static const TypeInfo aarch64_cpu_type_info = {
>      .name = TYPE_AARCH64_CPU,
>      .parent = TYPE_ARM_CPU,
>      .instance_size = sizeof(ARMCPU),
> -    .instance_init = aarch64_cpu_initfn,
>      .instance_finalize = aarch64_cpu_finalizefn,
>      .abstract = true,
>      .class_size = sizeof(AArch64CPUClass),



^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 05/24] vhost-user: Register "chardev" as class property
  2020-09-21 22:10 ` [PATCH 05/24] vhost-user: Register "chardev" " Eduardo Habkost
  2020-10-08  6:58   ` Marc-André Lureau
  2020-10-23 18:16   ` Igor Mammedov
@ 2020-10-30  8:56   ` Michael S. Tsirkin
  2 siblings, 0 replies; 67+ messages in thread
From: Michael S. Tsirkin @ 2020-10-30  8:56 UTC (permalink / raw)
  To: Eduardo Habkost; +Cc: John Snow, Paolo Bonzini, Daniel P. Berrange, qemu-devel

On Mon, Sep 21, 2020 at 06:10:26PM -0400, Eduardo Habkost wrote:
> Class properties make QOM introspection simpler and easier, as
> they don't require an object to be instantiated.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Reviewed-by: Michael S. Tsirkin <mst@redhat.com>

> ---
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: qemu-devel@nongnu.org
> ---
>  backends/vhost-user.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/backends/vhost-user.c b/backends/vhost-user.c
> index 9e6e1985465..858fdeae26c 100644
> --- a/backends/vhost-user.c
> +++ b/backends/vhost-user.c
> @@ -175,9 +175,9 @@ static char *get_chardev(Object *obj, Error **errp)
>      return NULL;
>  }
>  
> -static void vhost_user_backend_init(Object *obj)
> +static void vhost_user_backend_class_init(ObjectClass *oc, void *data)
>  {
> -    object_property_add_str(obj, "chardev", get_chardev, set_chardev);
> +    object_class_property_add_str(oc, "chardev", get_chardev, set_chardev);
>  }
>  
>  static void vhost_user_backend_finalize(Object *obj)
> @@ -195,7 +195,7 @@ static const TypeInfo vhost_user_backend_info = {
>      .name = TYPE_VHOST_USER_BACKEND,
>      .parent = TYPE_OBJECT,
>      .instance_size = sizeof(VhostUserBackend),
> -    .instance_init = vhost_user_backend_init,
> +    .class_init = vhost_user_backend_class_init,
>      .instance_finalize = vhost_user_backend_finalize,
>      .class_size = sizeof(VhostUserBackendClass),
>  };
> -- 
> 2.26.2



^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 22/24] i440fx: Register i440FX-pcihost properties as class properties
  2020-09-21 22:10 ` [PATCH 22/24] i440fx: Register i440FX-pcihost properties as class properties Eduardo Habkost
  2020-09-22  6:49   ` Igor Mammedov
@ 2020-10-30  8:56   ` Michael S. Tsirkin
  1 sibling, 0 replies; 67+ messages in thread
From: Michael S. Tsirkin @ 2020-10-30  8:56 UTC (permalink / raw)
  To: Eduardo Habkost; +Cc: John Snow, Paolo Bonzini, Daniel P. Berrange, qemu-devel

On Mon, Sep 21, 2020 at 06:10:43PM -0400, Eduardo Habkost wrote:
> Class properties make QOM introspection simpler and easier, as
> they don't require an object to be instantiated.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Reviewed-by: Michael S. Tsirkin <mst@redhat.com>


> ---
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> Cc: qemu-devel@nongnu.org
> ---
>  hw/pci-host/i440fx.c | 32 ++++++++++++++++----------------
>  1 file changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c
> index 93c62235ca7..4454ba06621 100644
> --- a/hw/pci-host/i440fx.c
> +++ b/hw/pci-host/i440fx.c
> @@ -212,22 +212,6 @@ static void i440fx_pcihost_initfn(Object *obj)
>                            "pci-conf-idx", 4);
>      memory_region_init_io(&s->data_mem, obj, &pci_host_data_le_ops, s,
>                            "pci-conf-data", 4);
> -
> -    object_property_add(obj, PCI_HOST_PROP_PCI_HOLE_START, "uint32",
> -                        i440fx_pcihost_get_pci_hole_start,
> -                        NULL, NULL, NULL);
> -
> -    object_property_add(obj, PCI_HOST_PROP_PCI_HOLE_END, "uint32",
> -                        i440fx_pcihost_get_pci_hole_end,
> -                        NULL, NULL, NULL);
> -
> -    object_property_add(obj, PCI_HOST_PROP_PCI_HOLE64_START, "uint64",
> -                        i440fx_pcihost_get_pci_hole64_start,
> -                        NULL, NULL, NULL);
> -
> -    object_property_add(obj, PCI_HOST_PROP_PCI_HOLE64_END, "uint64",
> -                        i440fx_pcihost_get_pci_hole64_end,
> -                        NULL, NULL, NULL);
>  }
>  
>  static void i440fx_pcihost_realize(DeviceState *dev, Error **errp)
> @@ -403,6 +387,22 @@ static void i440fx_pcihost_class_init(ObjectClass *klass, void *data)
>      device_class_set_props(dc, i440fx_props);
>      /* Reason: needs to be wired up by pc_init1 */
>      dc->user_creatable = false;
> +
> +    object_class_property_add(klass, PCI_HOST_PROP_PCI_HOLE_START, "uint32",
> +                              i440fx_pcihost_get_pci_hole_start,
> +                              NULL, NULL, NULL);
> +
> +    object_class_property_add(klass, PCI_HOST_PROP_PCI_HOLE_END, "uint32",
> +                              i440fx_pcihost_get_pci_hole_end,
> +                              NULL, NULL, NULL);
> +
> +    object_class_property_add(klass, PCI_HOST_PROP_PCI_HOLE64_START, "uint64",
> +                              i440fx_pcihost_get_pci_hole64_start,
> +                              NULL, NULL, NULL);
> +
> +    object_class_property_add(klass, PCI_HOST_PROP_PCI_HOLE64_END, "uint64",
> +                              i440fx_pcihost_get_pci_hole64_end,
> +                              NULL, NULL, NULL);
>  }
>  
>  static const TypeInfo i440fx_pcihost_info = {
> -- 
> 2.26.2



^ permalink raw reply	[flat|nested] 67+ messages in thread

* Re: [PATCH 16/24] virt: Register "its" as class property
  2020-09-21 22:10 ` [PATCH 16/24] virt: Register "its" as class property Eduardo Habkost
  2020-10-23 18:33   ` Igor Mammedov
@ 2020-11-02 11:12   ` Peter Maydell
  1 sibling, 0 replies; 67+ messages in thread
From: Peter Maydell @ 2020-11-02 11:12 UTC (permalink / raw)
  To: Eduardo Habkost
  Cc: John Snow, Paolo Bonzini, qemu-arm, Daniel P. Berrange, QEMU Developers

On Mon, 21 Sep 2020 at 23:11, Eduardo Habkost <ehabkost@redhat.com> wrote:
>
> Class properties make QOM introspection simpler and easier, as
> they don't require an object to be instantiated.
>
> Note: "its" is currently registered conditionally, but this makes
> the feature be registered unconditionally.  The only side effect
> is that it will be now possible to set its=on on virt-2.7 and
> older.
>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> Cc: Peter Maydell <peter.maydell@linaro.org>
> Cc: qemu-arm@nongnu.org
> Cc: qemu-devel@nongnu.org
> ---
>  hw/arm/virt.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index d1ab660fa60..986b75a6b89 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -2484,6 +2484,13 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
>                                            "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)
> @@ -2511,11 +2518,6 @@ 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");
>      }

This leaves the code reading
  if (vmc->no_its) {
      vms->its = false;
  } else {
      vms->its = true;
  }

which is more simply written "vms->its = !vmc->no_its;"

thanks
-- PMM


^ permalink raw reply	[flat|nested] 67+ messages in thread

end of thread, other threads:[~2020-11-02 11:14 UTC | newest]

Thread overview: 67+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-21 22:10 [PATCH 00/24] qom: Convert some properties to class properties Eduardo Habkost
2020-09-21 22:10 ` [PATCH 01/24] cryptodev-vhost-user: Register "chardev" as class property Eduardo Habkost
2020-09-22  1:27   ` Gonglei (Arei)
2020-09-21 22:10 ` [PATCH 02/24] cryptodev-backend: " Eduardo Habkost
2020-09-22  1:27   ` Gonglei (Arei)
2020-09-21 22:10 ` [PATCH 03/24] rng-egd: " Eduardo Habkost
2020-09-23  9:59   ` Daniel P. Berrangé
2020-09-21 22:10 ` [PATCH 04/24] rng-random: register "filename" " Eduardo Habkost
2020-09-23  9:59   ` Daniel P. Berrangé
2020-09-21 22:10 ` [PATCH 05/24] vhost-user: Register "chardev" " Eduardo Habkost
2020-10-08  6:58   ` Marc-André Lureau
2020-10-23 18:16   ` Igor Mammedov
2020-10-30  8:56   ` Michael S. Tsirkin
2020-09-21 22:10 ` [PATCH 06/24] vexpress: Register "secure" " Eduardo Habkost
2020-09-21 22:10 ` [PATCH 07/24] rng: Register "opened" " Eduardo Habkost
2020-09-23 10:00   ` Daniel P. Berrangé
2020-09-21 22:10 ` [PATCH 08/24] vexpress-a15: Register "virtualization" " Eduardo Habkost
2020-10-23 18:19   ` Igor Mammedov
2020-09-21 22:10 ` [PATCH 09/24] input-linux: Register properties as class properties Eduardo Habkost
2020-09-23 10:01   ` Daniel P. Berrangé
2020-09-21 22:10 ` [PATCH 10/24] input-barrier: " Eduardo Habkost
2020-09-23 10:02   ` Daniel P. Berrangé
2020-09-21 22:10 ` [PATCH 11/24] tmp421: " Eduardo Habkost
2020-10-23 18:21   ` Igor Mammedov
2020-09-21 22:10 ` [PATCH 12/24] s390x: Register all CPU " Eduardo Habkost
2020-09-22  6:47   ` David Hildenbrand
2020-09-22  9:54   ` Cornelia Huck
2020-09-21 22:10 ` [PATCH 13/24] i386: Register most " Eduardo Habkost
2020-09-22  6:41   ` Igor Mammedov
2020-09-22 12:44     ` Eduardo Habkost
2020-09-23  8:43   ` Igor Mammedov
2020-09-21 22:10 ` [PATCH 14/24] i386: Register feature bit " Eduardo Habkost
2020-09-22  6:47   ` Igor Mammedov
2020-09-22 12:47   ` Eduardo Habkost
2020-09-21 22:10 ` [PATCH 15/24] arm/virt: Register most " Eduardo Habkost
2020-10-23 18:26   ` Igor Mammedov
2020-09-21 22:10 ` [PATCH 16/24] virt: Register "its" as class property Eduardo Habkost
2020-10-23 18:33   ` Igor Mammedov
2020-11-02 11:12   ` Peter Maydell
2020-09-21 22:10 ` [PATCH 17/24] cpu/core: Register core-id and nr-threads as class properties Eduardo Habkost
2020-09-22  6:48   ` Igor Mammedov
2020-09-21 22:10 ` [PATCH 18/24] arm/cpu64: Register "aarch64" as class property Eduardo Habkost
2020-10-23 18:34   ` Igor Mammedov
2020-09-21 22:10 ` [PATCH 19/24] xlnx-zcu102: Register properties as class properties Eduardo Habkost
2020-09-22 16:44   ` Alistair Francis
2020-09-21 22:10 ` [PATCH 20/24] machine: Register "memory-backend" as class property Eduardo Habkost
2020-09-22  6:39   ` Igor Mammedov
2020-09-21 22:10 ` [PATCH 21/24] vga-pci: Register "big-endian-framebuffer" " Eduardo Habkost
2020-10-08  7:00   ` Marc-André Lureau
2020-09-21 22:10 ` [PATCH 22/24] i440fx: Register i440FX-pcihost properties as class properties Eduardo Habkost
2020-09-22  6:49   ` Igor Mammedov
2020-10-30  8:56   ` Michael S. Tsirkin
2020-09-21 22:10 ` [PATCH 23/24] sifive_e: Register "revb" as class property Eduardo Habkost
2020-09-21 22:10   ` Eduardo Habkost
2020-09-22 16:45   ` Alistair Francis
2020-09-22 16:45     ` Alistair Francis
2020-09-21 22:10 ` [PATCH 24/24] sifive_u: Register "start-in-flash" " Eduardo Habkost
2020-09-21 22:10   ` Eduardo Habkost
2020-09-22 16:44   ` Alistair Francis
2020-09-22 16:44     ` Alistair Francis
2020-09-22  1:47 ` [PATCH 00/24] qom: Convert some properties to class properties Li Qiang
2020-09-22  4:31   ` Eduardo Habkost
2020-09-22  3:02 ` no-reply
2020-09-22 21:00 ` Eduardo Habkost
2020-09-22 21:00   ` Eduardo Habkost
2020-10-07 22:26   ` Eduardo Habkost
2020-10-07 22:26     ` Eduardo Habkost

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.