qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] 33f0c0: hw/i386/pc: Use qdev_prop_set_array()


From: Alex Bennée
Subject: [Qemu-commits] [qemu/qemu] 33f0c0: hw/i386/pc: Use qdev_prop_set_array()
Date: Sat, 11 Nov 2023 01:52:43 -0800

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 33f0c061287fcb8c4ae97802374a6208778684a4
      
https://github.com/qemu/qemu/commit/33f0c061287fcb8c4ae97802374a6208778684a4
  Author: Kevin Wolf <kwolf@redhat.com>
  Date:   2023-11-10 (Fri, 10 Nov 2023)

  Changed paths:
    M hw/i386/pc.c

  Log Message:
  -----------
  hw/i386/pc: Use qdev_prop_set_array()

Instead of manually setting "foo-len" and "foo[i]" properties, build a
QList and use the new qdev_prop_set_array() helper to set the whole
array property with a single call.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-ID: <20231109174240.72376-2-kwolf@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: 31805a0aa46d8806fcdac7e1473251f40ca5b993
      
https://github.com/qemu/qemu/commit/31805a0aa46d8806fcdac7e1473251f40ca5b993
  Author: Kevin Wolf <kwolf@redhat.com>
  Date:   2023-11-10 (Fri, 10 Nov 2023)

  Changed paths:
    M hw/arm/mps2-tz.c

  Log Message:
  -----------
  hw/arm/mps2-tz: Use qdev_prop_set_array()

Instead of manually setting "foo-len" and "foo[i]" properties, build a
QList and use the new qdev_prop_set_array() helper to set the whole
array property with a single call.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-ID: <20231109174240.72376-3-kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: 80e09151c202d5a5b740cf1b25ea59fac342f879
      
https://github.com/qemu/qemu/commit/80e09151c202d5a5b740cf1b25ea59fac342f879
  Author: Kevin Wolf <kwolf@redhat.com>
  Date:   2023-11-10 (Fri, 10 Nov 2023)

  Changed paths:
    M hw/arm/mps2.c

  Log Message:
  -----------
  hw/arm/mps2: Use qdev_prop_set_array()

Instead of manually setting "foo-len" and "foo[i]" properties, build a
QList and use the new qdev_prop_set_array() helper to set the whole
array property with a single call.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-ID: <20231109174240.72376-4-kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: d210fa2f055bc1528cfb32c1b644cebbe36ff220
      
https://github.com/qemu/qemu/commit/d210fa2f055bc1528cfb32c1b644cebbe36ff220
  Author: Kevin Wolf <kwolf@redhat.com>
  Date:   2023-11-10 (Fri, 10 Nov 2023)

  Changed paths:
    M hw/arm/sbsa-ref.c

  Log Message:
  -----------
  hw/arm/sbsa-ref: Use qdev_prop_set_array()

Instead of manually setting "foo-len" and "foo[i]" properties, build a
QList and use the new qdev_prop_set_array() helper to set the whole
array property with a single call.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-ID: <20231109174240.72376-5-kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: 50ab8648c0ae513ca882b07571837b41668655fd
      
https://github.com/qemu/qemu/commit/50ab8648c0ae513ca882b07571837b41668655fd
  Author: Kevin Wolf <kwolf@redhat.com>
  Date:   2023-11-10 (Fri, 10 Nov 2023)

  Changed paths:
    M hw/arm/vexpress.c

  Log Message:
  -----------
  hw/arm/vexpress: Use qdev_prop_set_array()

Instead of manually setting "foo-len" and "foo[i]" properties, build a
QList and use the new qdev_prop_set_array() helper to set the whole
array property with a single call.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-ID: <20231109174240.72376-6-kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: 3c86b9dadc378db207d36f6f9c988d6886c8a2e3
      
https://github.com/qemu/qemu/commit/3c86b9dadc378db207d36f6f9c988d6886c8a2e3
  Author: Kevin Wolf <kwolf@redhat.com>
  Date:   2023-11-10 (Fri, 10 Nov 2023)

  Changed paths:
    M hw/arm/virt.c

  Log Message:
  -----------
  hw/arm/virt: Use qdev_prop_set_array()

Instead of manually setting "foo-len" and "foo[i]" properties, build a
QList and use the new qdev_prop_set_array() helper to set the whole
array property with a single call.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-ID: <20231109174240.72376-7-kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: 2394c782a9040891429d0f160cf695bf00379a0d
      
https://github.com/qemu/qemu/commit/2394c782a9040891429d0f160cf695bf00379a0d
  Author: Kevin Wolf <kwolf@redhat.com>
  Date:   2023-11-10 (Fri, 10 Nov 2023)

  Changed paths:
    M hw/arm/xlnx-versal.c

  Log Message:
  -----------
  hw/arm/xlnx-versal: Use qdev_prop_set_array()

Instead of manually setting "foo-len" and "foo[i]" properties, build a
QList and use the new qdev_prop_set_array() helper to set the whole
array property with a single call.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-ID: <20231109174240.72376-8-kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: 670581f932d9415e843de8a5e31e041938248237
      
https://github.com/qemu/qemu/commit/670581f932d9415e843de8a5e31e041938248237
  Author: Kevin Wolf <kwolf@redhat.com>
  Date:   2023-11-10 (Fri, 10 Nov 2023)

  Changed paths:
    M hw/rx/rx62n.c

  Log Message:
  -----------
  hw/rx/rx62n: Use qdev_prop_set_array()

Instead of manually setting "foo-len" and "foo[i]" properties, build a
QList and use the new qdev_prop_set_array() helper to set the whole
array property with a single call.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20231109174240.72376-9-kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: 125062e791258c68109f3a59cb7aca3dadbdb5a3
      
https://github.com/qemu/qemu/commit/125062e791258c68109f3a59cb7aca3dadbdb5a3
  Author: Kevin Wolf <kwolf@redhat.com>
  Date:   2023-11-10 (Fri, 10 Nov 2023)

  Changed paths:
    M include/qom/object.h
    M qom/object.c

  Log Message:
  -----------
  qom: Add object_property_set_default_list()

This function provides a default for properties that are accessed using
the list visitor interface. The default is always an empty list.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-ID: <20231109174240.72376-10-kwolf@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: 3257b854d81ca3ebe6f14375e83a0ed2db3c7562
      
https://github.com/qemu/qemu/commit/3257b854d81ca3ebe6f14375e83a0ed2db3c7562
  Author: Kevin Wolf <kwolf@redhat.com>
  Date:   2023-11-10 (Fri, 10 Nov 2023)

  Changed paths:
    M hw/core/qdev-properties-system.c

  Log Message:
  -----------
  qdev: Make netdev properties work as list elements

The 'name' parameter of QOM setters is primarily used to specify the name
of the currently parsed input element in the visitor interface. For
top-level qdev properties, this is always set and matches 'prop->name'.

However, for list elements it is NULL, because each element of a list
doesn't have a separate name. Passing a non-NULL value runs into
assertion failures in the visitor code.

Therefore, using 'name' in error messages is not right for property
types that are used in lists, because "(null)" (or even a segfault)
isn't very helpful to identify what QEMU is complaining about.

Change netdev properties to use 'prop->name' instead, which will contain
the name of the array property after switching array properties to lists
in the external interface. (This is still not perfect, as it doesn't
identify which element in the list caused the error, but strictly better
than before.)

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20231109174240.72376-11-kwolf@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: b06f8b500da2a5a73dfb15de17cd96ad2385fdc7
      
https://github.com/qemu/qemu/commit/b06f8b500da2a5a73dfb15de17cd96ad2385fdc7
  Author: Kevin Wolf <kwolf@redhat.com>
  Date:   2023-11-10 (Fri, 10 Nov 2023)

  Changed paths:
    M hw/core/qdev-properties.c
    M include/hw/qdev-properties.h

  Log Message:
  -----------
  qdev: Rework array properties based on list visitor

Until now, array properties are actually implemented with a hack that
uses multiple properties on the QOM level: a static "foo-len" property
and after it is set, dynamically created "foo[i]" properties.

In external interfaces (-device on the command line and device_add in
QMP), this interface was broken by commit f3558b1b ('qdev: Base object
creation on QDict rather than QemuOpts') because QDicts are unordered
and therefore it could happen that QEMU tried to set the indexed
properties before setting the length, which fails and effectively makes
array properties inaccessible. In particular, this affects the 'ports'
property of the 'rocker' device, which used to be configured like this:

-device rocker,len-ports=2,ports[0]=dev0,ports[1]=dev1

This patch reworks the external interface so that instead of using a
separate top-level property for the length and for each element, we use
a single true array property that accepts a list value. In the external
interfaces, this is naturally expressed as a JSON list and makes array
properties accessible again. The new syntax looks like this:

-device '{"driver":"rocker","ports":["dev0","dev1"]}'

Creating an array property on the command line without using JSON format
is currently not possible. This could be fixed by switching from
QemuOpts to a keyval parser, which however requires consideration of the
compatibility implications.

All internal users of devices with array properties go through
qdev_prop_set_array() at this point, so updating it takes care of all of
them.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1090
Fixes: f3558b1b763683bb877f7dd5b282469cdadc65c3
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20231109174240.72376-12-kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: 69680740eafa1838527c90155a7432d51b8ff203
      
https://github.com/qemu/qemu/commit/69680740eafa1838527c90155a7432d51b8ff203
  Author: Stefan Hajnoczi <stefanha@redhat.com>
  Date:   2023-11-11 (Sat, 11 Nov 2023)

  Changed paths:
    M hw/arm/mps2-tz.c
    M hw/arm/mps2.c
    M hw/arm/sbsa-ref.c
    M hw/arm/vexpress.c
    M hw/arm/virt.c
    M hw/arm/xlnx-versal.c
    M hw/core/qdev-properties-system.c
    M hw/core/qdev-properties.c
    M hw/i386/pc.c
    M hw/rx/rx62n.c
    M include/hw/qdev-properties.h
    M include/qom/object.h
    M qom/object.c

  Log Message:
  -----------
  Merge tag 'qdev-array-prop' of https://repo.or.cz/qemu/kevin into staging

qdev: Make array properties user accessible again

# -----BEGIN PGP SIGNATURE-----
#
# iQJFBAABCAAvFiEE3D3rFZqa+V09dFb+fwmycsiPL9YFAmVOZicRHGt3b2xmQHJl
# ZGhhdC5jb20ACgkQfwmycsiPL9arpw/+NKGRhSMrSq9Az+z5+ANUfw5SNLJYf1hH
# jm5ITA1Gr9htqHtBfEOdkms2wef6m7onF72rHVUlBKdqCPNMGLme5B0oQ8PZ1X1t
# OxAZ8KYwlO98QvOYl617SA/8wxc0U4/zi192kJpbRkKF6KdbbMGtLKjHyEitA/Yv
# izx1vkKOgQyMFGF1JgIyG4R3WmsKQW1XLqb3emVNRzCqmJpkvMJZQG8tnyEAXlIS
# gkY69cTpaKVaM1OxdB45gjlKTGzLWC/3tTGH+u8q356fvgm/QIgrokCirCZFPIl0
# C8hvzPm/L8hkvWtUb3EZx0DLiunWcAGvoLgBNODHojKRtQ6X9TRTrjJ41ZCLXVqv
# tVJm+XGKC0CZ/WW5yqVOmnzfPH4z8ubzSoRv5ryz3xDb5B/Zr10+ScE+/Ee24wJ2
# HIehxc1LgVGGpikP88/Ns/nAlIVUQxxYvSJ23R5D1+UpP6FCy6Y1pKyRtZGzPCIe
# N4Y+52GtelBR8gOjay5INn/Yf8Fh6sFxX556BW0XKYcbQgvl2bxASe/KVnAVZ1NB
# 8DsaAWlK+hPGopwyp2lDRuGd4kusNbzQvIUZ0mr1g9HQ/iSnT/9RFdExsj+K6QTr
# pX42QCe4mWHPAKx38cez+Bhx4TEOw+GmHuTp/oLdBRuY8DPu/I0Ny364uiW+At/R
# 8jF+jt5uVZc=
# =MV6O
# -----END PGP SIGNATURE-----
# gpg: Signature made Sat 11 Nov 2023 01:19:35 HKT
# gpg:                using RSA key DC3DEB159A9AF95D3D7456FE7F09B272C88F2FD6
# gpg:                issuer "kwolf@redhat.com"
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" [full]
# Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6

* tag 'qdev-array-prop' of https://repo.or.cz/qemu/kevin:
  qdev: Rework array properties based on list visitor
  qdev: Make netdev properties work as list elements
  qom: Add object_property_set_default_list()
  hw/rx/rx62n: Use qdev_prop_set_array()
  hw/arm/xlnx-versal: Use qdev_prop_set_array()
  hw/arm/virt: Use qdev_prop_set_array()
  hw/arm/vexpress: Use qdev_prop_set_array()
  hw/arm/sbsa-ref: Use qdev_prop_set_array()
  hw/arm/mps2: Use qdev_prop_set_array()
  hw/arm/mps2-tz: Use qdev_prop_set_array()
  hw/i386/pc: Use qdev_prop_set_array()

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>


Compare: https://github.com/qemu/qemu/compare/ea10c3817814...69680740eafa



reply via email to

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