* [PATCH v3 1/6] hw/s390x/event-facility: Replace DO_UPCAST(SCLPEvent) by SCLP_EVENT()
2023-02-13 17:01 [PATCH v3 0/6] hw/vfio/ccw: hw: Use QOM macros and remove DO_UPCAST() uses Philippe Mathieu-Daudé
@ 2023-02-13 17:01 ` Philippe Mathieu-Daudé
2023-02-13 17:01 ` [PATCH v3 2/6] hw/vfio/ccw: Simplify using DEVICE() macro Philippe Mathieu-Daudé
` (5 subsequent siblings)
6 siblings, 0 replies; 15+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-13 17:01 UTC (permalink / raw)
To: Eduardo Habkost, Eric Farman, qemu-devel
Cc: Richard Henderson, qemu-s390x, Alex Williamson, David Hildenbrand,
Thomas Huth, Matthew Rosato, Christian Borntraeger, Halil Pasic,
Ilya Leoshkevich, Philippe Mathieu-Daudé
Use the SCLP_EVENT() QOM type-checking macro to avoid DO_UPCAST().
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
---
hw/s390x/event-facility.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/hw/s390x/event-facility.c b/hw/s390x/event-facility.c
index faa51aa4c7..6891e3cd73 100644
--- a/hw/s390x/event-facility.c
+++ b/hw/s390x/event-facility.c
@@ -64,8 +64,7 @@ static bool event_pending(SCLPEventFacility *ef)
SCLPEventClass *event_class;
QTAILQ_FOREACH(kid, &ef->sbus.qbus.children, sibling) {
- DeviceState *qdev = kid->child;
- event = DO_UPCAST(SCLPEvent, qdev, qdev);
+ event = SCLP_EVENT(kid->child);
event_class = SCLP_EVENT_GET_CLASS(event);
if (event->event_pending &&
event_class->get_send_mask() & ef->receive_mask) {
--
2.38.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v3 2/6] hw/vfio/ccw: Simplify using DEVICE() macro
2023-02-13 17:01 [PATCH v3 0/6] hw/vfio/ccw: hw: Use QOM macros and remove DO_UPCAST() uses Philippe Mathieu-Daudé
2023-02-13 17:01 ` [PATCH v3 1/6] hw/s390x/event-facility: Replace DO_UPCAST(SCLPEvent) by SCLP_EVENT() Philippe Mathieu-Daudé
@ 2023-02-13 17:01 ` Philippe Mathieu-Daudé
2023-02-13 18:38 ` Eric Farman
2023-02-13 17:01 ` [PATCH v3 3/6] hw/vfio/ccw: Use intermediate S390CCWDevice variable Philippe Mathieu-Daudé
` (4 subsequent siblings)
6 siblings, 1 reply; 15+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-13 17:01 UTC (permalink / raw)
To: Eduardo Habkost, Eric Farman, qemu-devel
Cc: Richard Henderson, qemu-s390x, Alex Williamson, David Hildenbrand,
Thomas Huth, Matthew Rosato, Christian Borntraeger, Halil Pasic,
Ilya Leoshkevich, Philippe Mathieu-Daudé
QOM parenthood relationship is:
VFIOCCWDevice -> S390CCWDevice -> CcwDevice -> DeviceState
We can directly use the QOM DEVICE() macro to get the parent object.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/vfio/ccw.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c
index 0354737666..503de94ce1 100644
--- a/hw/vfio/ccw.c
+++ b/hw/vfio/ccw.c
@@ -618,7 +618,7 @@ static void vfio_ccw_get_device(VFIOGroup *group, VFIOCCWDevice *vcdev,
vcdev->vdev.ops = &vfio_ccw_ops;
vcdev->vdev.type = VFIO_DEVICE_TYPE_CCW;
vcdev->vdev.name = name;
- vcdev->vdev.dev = &vcdev->cdev.parent_obj.parent_obj;
+ vcdev->vdev.dev = DEVICE(vcdev);
return;
--
2.38.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH v3 2/6] hw/vfio/ccw: Simplify using DEVICE() macro
2023-02-13 17:01 ` [PATCH v3 2/6] hw/vfio/ccw: Simplify using DEVICE() macro Philippe Mathieu-Daudé
@ 2023-02-13 18:38 ` Eric Farman
0 siblings, 0 replies; 15+ messages in thread
From: Eric Farman @ 2023-02-13 18:38 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, Eduardo Habkost, qemu-devel
Cc: Richard Henderson, qemu-s390x, Alex Williamson, David Hildenbrand,
Thomas Huth, Matthew Rosato, Christian Borntraeger, Halil Pasic,
Ilya Leoshkevich
On Mon, 2023-02-13 at 18:01 +0100, Philippe Mathieu-Daudé wrote:
> QOM parenthood relationship is:
>
> VFIOCCWDevice -> S390CCWDevice -> CcwDevice -> DeviceState
>
> We can directly use the QOM DEVICE() macro to get the parent object.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
> ---
> hw/vfio/ccw.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c
> index 0354737666..503de94ce1 100644
> --- a/hw/vfio/ccw.c
> +++ b/hw/vfio/ccw.c
> @@ -618,7 +618,7 @@ static void vfio_ccw_get_device(VFIOGroup *group,
> VFIOCCWDevice *vcdev,
> vcdev->vdev.ops = &vfio_ccw_ops;
> vcdev->vdev.type = VFIO_DEVICE_TYPE_CCW;
> vcdev->vdev.name = name;
> - vcdev->vdev.dev = &vcdev->cdev.parent_obj.parent_obj;
> + vcdev->vdev.dev = DEVICE(vcdev);
>
> return;
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3 3/6] hw/vfio/ccw: Use intermediate S390CCWDevice variable
2023-02-13 17:01 [PATCH v3 0/6] hw/vfio/ccw: hw: Use QOM macros and remove DO_UPCAST() uses Philippe Mathieu-Daudé
2023-02-13 17:01 ` [PATCH v3 1/6] hw/s390x/event-facility: Replace DO_UPCAST(SCLPEvent) by SCLP_EVENT() Philippe Mathieu-Daudé
2023-02-13 17:01 ` [PATCH v3 2/6] hw/vfio/ccw: Simplify using DEVICE() macro Philippe Mathieu-Daudé
@ 2023-02-13 17:01 ` Philippe Mathieu-Daudé
2023-02-13 18:40 ` Eric Farman
2023-02-13 17:01 ` [PATCH v3 4/6] hw/vfio/ccw: Replace DO_UPCAST(S390CCWDevice) by S390_CCW_DEVICE() Philippe Mathieu-Daudé
` (3 subsequent siblings)
6 siblings, 1 reply; 15+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-13 17:01 UTC (permalink / raw)
To: Eduardo Habkost, Eric Farman, qemu-devel
Cc: Richard Henderson, qemu-s390x, Alex Williamson, David Hildenbrand,
Thomas Huth, Matthew Rosato, Christian Borntraeger, Halil Pasic,
Ilya Leoshkevich, Philippe Mathieu-Daudé
'cdev' is VFIOCCWDevice's private parent object.
Access it using the S390_CCW_DEVICE() QOM macro.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/vfio/ccw.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c
index 503de94ce1..2c20e3c202 100644
--- a/hw/vfio/ccw.c
+++ b/hw/vfio/ccw.c
@@ -588,9 +588,10 @@ static void vfio_ccw_put_device(VFIOCCWDevice *vcdev)
static void vfio_ccw_get_device(VFIOGroup *group, VFIOCCWDevice *vcdev,
Error **errp)
{
- char *name = g_strdup_printf("%x.%x.%04x", vcdev->cdev.hostid.cssid,
- vcdev->cdev.hostid.ssid,
- vcdev->cdev.hostid.devid);
+ S390CCWDevice *cdev = S390_CCW_DEVICE(vcdev);
+ char *name = g_strdup_printf("%x.%x.%04x", cdev->hostid.cssid,
+ cdev->hostid.ssid,
+ cdev->hostid.devid);
VFIODevice *vbasedev;
QLIST_FOREACH(vbasedev, &group->device_list, next) {
@@ -611,7 +612,7 @@ static void vfio_ccw_get_device(VFIOGroup *group, VFIOCCWDevice *vcdev,
*/
vcdev->vdev.ram_block_discard_allowed = true;
- if (vfio_get_device(group, vcdev->cdev.mdevid, &vcdev->vdev, errp)) {
+ if (vfio_get_device(group, cdev->mdevid, &vcdev->vdev, errp)) {
goto out_err;
}
--
2.38.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH v3 3/6] hw/vfio/ccw: Use intermediate S390CCWDevice variable
2023-02-13 17:01 ` [PATCH v3 3/6] hw/vfio/ccw: Use intermediate S390CCWDevice variable Philippe Mathieu-Daudé
@ 2023-02-13 18:40 ` Eric Farman
0 siblings, 0 replies; 15+ messages in thread
From: Eric Farman @ 2023-02-13 18:40 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, Eduardo Habkost, qemu-devel
Cc: Richard Henderson, qemu-s390x, Alex Williamson, David Hildenbrand,
Thomas Huth, Matthew Rosato, Christian Borntraeger, Halil Pasic,
Ilya Leoshkevich
On Mon, 2023-02-13 at 18:01 +0100, Philippe Mathieu-Daudé wrote:
> 'cdev' is VFIOCCWDevice's private parent object.
> Access it using the S390_CCW_DEVICE() QOM macro.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
> ---
> hw/vfio/ccw.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c
> index 503de94ce1..2c20e3c202 100644
> --- a/hw/vfio/ccw.c
> +++ b/hw/vfio/ccw.c
> @@ -588,9 +588,10 @@ static void vfio_ccw_put_device(VFIOCCWDevice
> *vcdev)
> static void vfio_ccw_get_device(VFIOGroup *group, VFIOCCWDevice
> *vcdev,
> Error **errp)
> {
> - char *name = g_strdup_printf("%x.%x.%04x", vcdev-
> >cdev.hostid.cssid,
> - vcdev->cdev.hostid.ssid,
> - vcdev->cdev.hostid.devid);
> + S390CCWDevice *cdev = S390_CCW_DEVICE(vcdev);
> + char *name = g_strdup_printf("%x.%x.%04x", cdev->hostid.cssid,
> + cdev->hostid.ssid,
> + cdev->hostid.devid);
> VFIODevice *vbasedev;
>
> QLIST_FOREACH(vbasedev, &group->device_list, next) {
> @@ -611,7 +612,7 @@ static void vfio_ccw_get_device(VFIOGroup *group,
> VFIOCCWDevice *vcdev,
> */
> vcdev->vdev.ram_block_discard_allowed = true;
>
> - if (vfio_get_device(group, vcdev->cdev.mdevid, &vcdev->vdev,
> errp)) {
> + if (vfio_get_device(group, cdev->mdevid, &vcdev->vdev, errp)) {
> goto out_err;
> }
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3 4/6] hw/vfio/ccw: Replace DO_UPCAST(S390CCWDevice) by S390_CCW_DEVICE()
2023-02-13 17:01 [PATCH v3 0/6] hw/vfio/ccw: hw: Use QOM macros and remove DO_UPCAST() uses Philippe Mathieu-Daudé
` (2 preceding siblings ...)
2023-02-13 17:01 ` [PATCH v3 3/6] hw/vfio/ccw: Use intermediate S390CCWDevice variable Philippe Mathieu-Daudé
@ 2023-02-13 17:01 ` Philippe Mathieu-Daudé
2023-02-13 17:05 ` Philippe Mathieu-Daudé
2023-02-16 14:18 ` Thomas Huth
2023-02-13 17:01 ` [PATCH v3 5/6] hw/vfio/ccw: Remove pointless S390CCWDevice variable Philippe Mathieu-Daudé
` (2 subsequent siblings)
6 siblings, 2 replies; 15+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-13 17:01 UTC (permalink / raw)
To: Eduardo Habkost, Eric Farman, qemu-devel
Cc: Richard Henderson, qemu-s390x, Alex Williamson, David Hildenbrand,
Thomas Huth, Matthew Rosato, Christian Borntraeger, Halil Pasic,
Ilya Leoshkevich, Philippe Mathieu-Daudé
Use the S390_CCW_DEVICE() QOM type-checking macro to avoid DO_UPCAST().
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/vfio/ccw.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c
index 2c20e3c202..2ea7b4a63c 100644
--- a/hw/vfio/ccw.c
+++ b/hw/vfio/ccw.c
@@ -251,8 +251,7 @@ again:
static void vfio_ccw_reset(DeviceState *dev)
{
- CcwDevice *ccw_dev = DO_UPCAST(CcwDevice, parent_obj, dev);
- S390CCWDevice *cdev = DO_UPCAST(S390CCWDevice, parent_obj, ccw_dev);
+ S390CCWDevice *cdev = S390_CCW_DEVICE(dev);
VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev);
ioctl(vcdev->vdev.fd, VFIO_DEVICE_RESET);
@@ -657,8 +656,7 @@ static VFIOGroup *vfio_ccw_get_group(S390CCWDevice *cdev, Error **errp)
static void vfio_ccw_realize(DeviceState *dev, Error **errp)
{
VFIOGroup *group;
- CcwDevice *ccw_dev = DO_UPCAST(CcwDevice, parent_obj, dev);
- S390CCWDevice *cdev = DO_UPCAST(S390CCWDevice, parent_obj, ccw_dev);
+ S390CCWDevice *cdev = S390_CCW_DEVICE(dev);
VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev);
S390CCWDeviceClass *cdc = S390_CCW_DEVICE_GET_CLASS(cdev);
Error *err = NULL;
@@ -729,8 +727,7 @@ out_err_propagate:
static void vfio_ccw_unrealize(DeviceState *dev)
{
- CcwDevice *ccw_dev = DO_UPCAST(CcwDevice, parent_obj, dev);
- S390CCWDevice *cdev = DO_UPCAST(S390CCWDevice, parent_obj, ccw_dev);
+ S390CCWDevice *cdev = S390_CCW_DEVICE(dev);
VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev);
S390CCWDeviceClass *cdc = S390_CCW_DEVICE_GET_CLASS(cdev);
VFIOGroup *group = vcdev->vdev.group;
--
2.38.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH v3 4/6] hw/vfio/ccw: Replace DO_UPCAST(S390CCWDevice) by S390_CCW_DEVICE()
2023-02-13 17:01 ` [PATCH v3 4/6] hw/vfio/ccw: Replace DO_UPCAST(S390CCWDevice) by S390_CCW_DEVICE() Philippe Mathieu-Daudé
@ 2023-02-13 17:05 ` Philippe Mathieu-Daudé
2023-02-16 14:18 ` Thomas Huth
1 sibling, 0 replies; 15+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-13 17:05 UTC (permalink / raw)
To: Eduardo Habkost, Eric Farman, qemu-devel
Cc: Richard Henderson, qemu-s390x, Alex Williamson, David Hildenbrand,
Thomas Huth, Matthew Rosato, Christian Borntraeger, Halil Pasic,
Ilya Leoshkevich
On 13/2/23 18:01, Philippe Mathieu-Daudé wrote:
> Use the S390_CCW_DEVICE() QOM type-checking macro to avoid DO_UPCAST().
>
I forgot Eric R-b here:
Reviewed-by: Eric Farman <farman@linux.ibm.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> hw/vfio/ccw.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c
> index 2c20e3c202..2ea7b4a63c 100644
> --- a/hw/vfio/ccw.c
> +++ b/hw/vfio/ccw.c
> @@ -251,8 +251,7 @@ again:
>
> static void vfio_ccw_reset(DeviceState *dev)
> {
> - CcwDevice *ccw_dev = DO_UPCAST(CcwDevice, parent_obj, dev);
> - S390CCWDevice *cdev = DO_UPCAST(S390CCWDevice, parent_obj, ccw_dev);
> + S390CCWDevice *cdev = S390_CCW_DEVICE(dev);
> VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev);
>
> ioctl(vcdev->vdev.fd, VFIO_DEVICE_RESET);
> @@ -657,8 +656,7 @@ static VFIOGroup *vfio_ccw_get_group(S390CCWDevice *cdev, Error **errp)
> static void vfio_ccw_realize(DeviceState *dev, Error **errp)
> {
> VFIOGroup *group;
> - CcwDevice *ccw_dev = DO_UPCAST(CcwDevice, parent_obj, dev);
> - S390CCWDevice *cdev = DO_UPCAST(S390CCWDevice, parent_obj, ccw_dev);
> + S390CCWDevice *cdev = S390_CCW_DEVICE(dev);
> VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev);
> S390CCWDeviceClass *cdc = S390_CCW_DEVICE_GET_CLASS(cdev);
> Error *err = NULL;
> @@ -729,8 +727,7 @@ out_err_propagate:
>
> static void vfio_ccw_unrealize(DeviceState *dev)
> {
> - CcwDevice *ccw_dev = DO_UPCAST(CcwDevice, parent_obj, dev);
> - S390CCWDevice *cdev = DO_UPCAST(S390CCWDevice, parent_obj, ccw_dev);
> + S390CCWDevice *cdev = S390_CCW_DEVICE(dev);
> VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev);
> S390CCWDeviceClass *cdc = S390_CCW_DEVICE_GET_CLASS(cdev);
> VFIOGroup *group = vcdev->vdev.group;
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 4/6] hw/vfio/ccw: Replace DO_UPCAST(S390CCWDevice) by S390_CCW_DEVICE()
2023-02-13 17:01 ` [PATCH v3 4/6] hw/vfio/ccw: Replace DO_UPCAST(S390CCWDevice) by S390_CCW_DEVICE() Philippe Mathieu-Daudé
2023-02-13 17:05 ` Philippe Mathieu-Daudé
@ 2023-02-16 14:18 ` Thomas Huth
1 sibling, 0 replies; 15+ messages in thread
From: Thomas Huth @ 2023-02-16 14:18 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, Eduardo Habkost, Eric Farman,
qemu-devel, Cedric Le Goater
Cc: Richard Henderson, qemu-s390x, Alex Williamson, David Hildenbrand,
Matthew Rosato, Christian Borntraeger, Halil Pasic,
Ilya Leoshkevich
On 13/02/2023 18.01, Philippe Mathieu-Daudé wrote:
> Use the S390_CCW_DEVICE() QOM type-checking macro to avoid DO_UPCAST().
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> hw/vfio/ccw.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c
> index 2c20e3c202..2ea7b4a63c 100644
> --- a/hw/vfio/ccw.c
> +++ b/hw/vfio/ccw.c
> @@ -251,8 +251,7 @@ again:
>
> static void vfio_ccw_reset(DeviceState *dev)
> {
> - CcwDevice *ccw_dev = DO_UPCAST(CcwDevice, parent_obj, dev);
> - S390CCWDevice *cdev = DO_UPCAST(S390CCWDevice, parent_obj, ccw_dev);
> + S390CCWDevice *cdev = S390_CCW_DEVICE(dev);
> VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev);
>
> ioctl(vcdev->vdev.fd, VFIO_DEVICE_RESET);
> @@ -657,8 +656,7 @@ static VFIOGroup *vfio_ccw_get_group(S390CCWDevice *cdev, Error **errp)
> static void vfio_ccw_realize(DeviceState *dev, Error **errp)
> {
> VFIOGroup *group;
> - CcwDevice *ccw_dev = DO_UPCAST(CcwDevice, parent_obj, dev);
> - S390CCWDevice *cdev = DO_UPCAST(S390CCWDevice, parent_obj, ccw_dev);
> + S390CCWDevice *cdev = S390_CCW_DEVICE(dev);
> VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev);
> S390CCWDeviceClass *cdc = S390_CCW_DEVICE_GET_CLASS(cdev);
> Error *err = NULL;
> @@ -729,8 +727,7 @@ out_err_propagate:
>
> static void vfio_ccw_unrealize(DeviceState *dev)
> {
> - CcwDevice *ccw_dev = DO_UPCAST(CcwDevice, parent_obj, dev);
> - S390CCWDevice *cdev = DO_UPCAST(S390CCWDevice, parent_obj, ccw_dev);
> + S390CCWDevice *cdev = S390_CCW_DEVICE(dev);
> VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev);
> S390CCWDeviceClass *cdc = S390_CCW_DEVICE_GET_CLASS(cdev);
> VFIOGroup *group = vcdev->vdev.group;
Reviewed-by: Thomas Huth <thuth@redhat.com>
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3 5/6] hw/vfio/ccw: Remove pointless S390CCWDevice variable
2023-02-13 17:01 [PATCH v3 0/6] hw/vfio/ccw: hw: Use QOM macros and remove DO_UPCAST() uses Philippe Mathieu-Daudé
` (3 preceding siblings ...)
2023-02-13 17:01 ` [PATCH v3 4/6] hw/vfio/ccw: Replace DO_UPCAST(S390CCWDevice) by S390_CCW_DEVICE() Philippe Mathieu-Daudé
@ 2023-02-13 17:01 ` Philippe Mathieu-Daudé
2023-02-13 18:40 ` Eric Farman
2023-02-13 17:01 ` [PATCH v3 6/6] hw/vfio/ccw: Replace DO_UPCAST(VFIOCCWDevice) by VFIO_CCW() Philippe Mathieu-Daudé
2023-02-27 11:15 ` [PATCH v3 0/6] hw/vfio/ccw: hw: Use QOM macros and remove DO_UPCAST() uses Philippe Mathieu-Daudé
6 siblings, 1 reply; 15+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-13 17:01 UTC (permalink / raw)
To: Eduardo Habkost, Eric Farman, qemu-devel
Cc: Richard Henderson, qemu-s390x, Alex Williamson, David Hildenbrand,
Thomas Huth, Matthew Rosato, Christian Borntraeger, Halil Pasic,
Ilya Leoshkevich, Philippe Mathieu-Daudé
QOM parenthood relationship is:
VFIOCCWDevice -> S390CCWDevice -> CcwDevice -> DeviceState
No need to double-cast, call CCW_DEVICE() on VFIOCCWDevice.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/vfio/ccw.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c
index 2ea7b4a63c..cd66b66742 100644
--- a/hw/vfio/ccw.c
+++ b/hw/vfio/ccw.c
@@ -314,8 +314,7 @@ static void vfio_ccw_io_notifier_handler(void *opaque)
{
VFIOCCWDevice *vcdev = opaque;
struct ccw_io_region *region = vcdev->io_region;
- S390CCWDevice *cdev = S390_CCW_DEVICE(vcdev);
- CcwDevice *ccw_dev = CCW_DEVICE(cdev);
+ CcwDevice *ccw_dev = CCW_DEVICE(vcdev);
SubchDev *sch = ccw_dev->sch;
SCHIB *schib = &sch->curr_status;
SCSW s;
--
2.38.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH v3 5/6] hw/vfio/ccw: Remove pointless S390CCWDevice variable
2023-02-13 17:01 ` [PATCH v3 5/6] hw/vfio/ccw: Remove pointless S390CCWDevice variable Philippe Mathieu-Daudé
@ 2023-02-13 18:40 ` Eric Farman
0 siblings, 0 replies; 15+ messages in thread
From: Eric Farman @ 2023-02-13 18:40 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, Eduardo Habkost, qemu-devel
Cc: Richard Henderson, qemu-s390x, Alex Williamson, David Hildenbrand,
Thomas Huth, Matthew Rosato, Christian Borntraeger, Halil Pasic,
Ilya Leoshkevich
On Mon, 2023-02-13 at 18:01 +0100, Philippe Mathieu-Daudé wrote:
> QOM parenthood relationship is:
>
> VFIOCCWDevice -> S390CCWDevice -> CcwDevice -> DeviceState
>
> No need to double-cast, call CCW_DEVICE() on VFIOCCWDevice.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
> ---
> hw/vfio/ccw.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c
> index 2ea7b4a63c..cd66b66742 100644
> --- a/hw/vfio/ccw.c
> +++ b/hw/vfio/ccw.c
> @@ -314,8 +314,7 @@ static void vfio_ccw_io_notifier_handler(void
> *opaque)
> {
> VFIOCCWDevice *vcdev = opaque;
> struct ccw_io_region *region = vcdev->io_region;
> - S390CCWDevice *cdev = S390_CCW_DEVICE(vcdev);
> - CcwDevice *ccw_dev = CCW_DEVICE(cdev);
> + CcwDevice *ccw_dev = CCW_DEVICE(vcdev);
> SubchDev *sch = ccw_dev->sch;
> SCHIB *schib = &sch->curr_status;
> SCSW s;
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3 6/6] hw/vfio/ccw: Replace DO_UPCAST(VFIOCCWDevice) by VFIO_CCW()
2023-02-13 17:01 [PATCH v3 0/6] hw/vfio/ccw: hw: Use QOM macros and remove DO_UPCAST() uses Philippe Mathieu-Daudé
` (4 preceding siblings ...)
2023-02-13 17:01 ` [PATCH v3 5/6] hw/vfio/ccw: Remove pointless S390CCWDevice variable Philippe Mathieu-Daudé
@ 2023-02-13 17:01 ` Philippe Mathieu-Daudé
2023-02-27 11:15 ` [PATCH v3 0/6] hw/vfio/ccw: hw: Use QOM macros and remove DO_UPCAST() uses Philippe Mathieu-Daudé
6 siblings, 0 replies; 15+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-13 17:01 UTC (permalink / raw)
To: Eduardo Habkost, Eric Farman, qemu-devel
Cc: Richard Henderson, qemu-s390x, Alex Williamson, David Hildenbrand,
Thomas Huth, Matthew Rosato, Christian Borntraeger, Halil Pasic,
Ilya Leoshkevich, Philippe Mathieu-Daudé
Use the VFIO_CCW() QOM type-checking macro to avoid DO_UPCAST().
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/vfio/ccw.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c
index cd66b66742..1e2fce83b0 100644
--- a/hw/vfio/ccw.c
+++ b/hw/vfio/ccw.c
@@ -76,8 +76,7 @@ struct VFIODeviceOps vfio_ccw_ops = {
static IOInstEnding vfio_ccw_handle_request(SubchDev *sch)
{
- S390CCWDevice *cdev = sch->driver_data;
- VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev);
+ VFIOCCWDevice *vcdev = VFIO_CCW(sch->driver_data);
struct ccw_io_region *region = vcdev->io_region;
int ret;
@@ -125,8 +124,7 @@ again:
static IOInstEnding vfio_ccw_handle_store(SubchDev *sch)
{
- S390CCWDevice *cdev = sch->driver_data;
- VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev);
+ VFIOCCWDevice *vcdev = VFIO_CCW(sch->driver_data);
SCHIB *schib = &sch->curr_status;
struct ccw_schib_region *region = vcdev->schib_region;
SCHIB *s;
@@ -170,8 +168,7 @@ static IOInstEnding vfio_ccw_handle_store(SubchDev *sch)
static int vfio_ccw_handle_clear(SubchDev *sch)
{
- S390CCWDevice *cdev = sch->driver_data;
- VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev);
+ VFIOCCWDevice *vcdev = VFIO_CCW(sch->driver_data);
struct ccw_cmd_region *region = vcdev->async_cmd_region;
int ret;
@@ -210,8 +207,7 @@ again:
static int vfio_ccw_handle_halt(SubchDev *sch)
{
- S390CCWDevice *cdev = sch->driver_data;
- VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev);
+ VFIOCCWDevice *vcdev = VFIO_CCW(sch->driver_data);
struct ccw_cmd_region *region = vcdev->async_cmd_region;
int ret;
@@ -251,8 +247,7 @@ again:
static void vfio_ccw_reset(DeviceState *dev)
{
- S390CCWDevice *cdev = S390_CCW_DEVICE(dev);
- VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev);
+ VFIOCCWDevice *vcdev = VFIO_CCW(dev);
ioctl(vcdev->vdev.fd, VFIO_DEVICE_RESET);
}
@@ -656,7 +651,7 @@ static void vfio_ccw_realize(DeviceState *dev, Error **errp)
{
VFIOGroup *group;
S390CCWDevice *cdev = S390_CCW_DEVICE(dev);
- VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev);
+ VFIOCCWDevice *vcdev = VFIO_CCW(cdev);
S390CCWDeviceClass *cdc = S390_CCW_DEVICE_GET_CLASS(cdev);
Error *err = NULL;
@@ -727,7 +722,7 @@ out_err_propagate:
static void vfio_ccw_unrealize(DeviceState *dev)
{
S390CCWDevice *cdev = S390_CCW_DEVICE(dev);
- VFIOCCWDevice *vcdev = DO_UPCAST(VFIOCCWDevice, cdev, cdev);
+ VFIOCCWDevice *vcdev = VFIO_CCW(cdev);
S390CCWDeviceClass *cdc = S390_CCW_DEVICE_GET_CLASS(cdev);
VFIOGroup *group = vcdev->vdev.group;
--
2.38.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH v3 0/6] hw/vfio/ccw: hw: Use QOM macros and remove DO_UPCAST() uses
2023-02-13 17:01 [PATCH v3 0/6] hw/vfio/ccw: hw: Use QOM macros and remove DO_UPCAST() uses Philippe Mathieu-Daudé
` (5 preceding siblings ...)
2023-02-13 17:01 ` [PATCH v3 6/6] hw/vfio/ccw: Replace DO_UPCAST(VFIOCCWDevice) by VFIO_CCW() Philippe Mathieu-Daudé
@ 2023-02-27 11:15 ` Philippe Mathieu-Daudé
2023-02-27 11:46 ` Thomas Huth
6 siblings, 1 reply; 15+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-27 11:15 UTC (permalink / raw)
To: qemu-devel, Alex Williamson
Cc: Eric Farman, Eduardo Habkost, Richard Henderson, qemu-s390x,
David Hildenbrand, Thomas Huth, Matthew Rosato,
Christian Borntraeger, Halil Pasic, Ilya Leoshkevich
Hi Alex,
On 13/2/23 18:01, Philippe Mathieu-Daudé wrote:
> QOM housekeeping series which replace the DO_UPCAST() macro
> uses by equivalent QOM ones (and few more trivial cleanups).
>
> Since v2:
> - Split of bigger series
> - Split in simpler patches
> - Added Eric R-b tags
>
> v2:
> https://lore.kernel.org/qemu-devel/20230213070820.76881-17-philmd@linaro.org/
>
> Philippe Mathieu-Daudé (6):
> hw/s390x/event-facility: Replace DO_UPCAST(SCLPEvent) by SCLP_EVENT()
Thomas took the first patch,
> hw/vfio/ccw: Simplify using DEVICE() macro
> hw/vfio/ccw: Use intermediate S390CCWDevice variable
> hw/vfio/ccw: Replace DO_UPCAST(S390CCWDevice) by S390_CCW_DEVICE()
> hw/vfio/ccw: Remove pointless S390CCWDevice variable
> hw/vfio/ccw: Replace DO_UPCAST(VFIOCCWDevice) by VFIO_CCW()
Could you take the other ones via your VFIO tree?
(all patches reviewed).
Thanks,
Phil.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 0/6] hw/vfio/ccw: hw: Use QOM macros and remove DO_UPCAST() uses
2023-02-27 11:15 ` [PATCH v3 0/6] hw/vfio/ccw: hw: Use QOM macros and remove DO_UPCAST() uses Philippe Mathieu-Daudé
@ 2023-02-27 11:46 ` Thomas Huth
2023-02-27 12:30 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 15+ messages in thread
From: Thomas Huth @ 2023-02-27 11:46 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel, Alex Williamson
Cc: Eric Farman, Eduardo Habkost, Richard Henderson, qemu-s390x,
David Hildenbrand, Matthew Rosato, Christian Borntraeger,
Halil Pasic, Ilya Leoshkevich
On 27/02/2023 12.15, Philippe Mathieu-Daudé wrote:
> Hi Alex,
>
> On 13/2/23 18:01, Philippe Mathieu-Daudé wrote:
>> QOM housekeeping series which replace the DO_UPCAST() macro
>> uses by equivalent QOM ones (and few more trivial cleanups).
>>
>> Since v2:
>> - Split of bigger series
>> - Split in simpler patches
>> - Added Eric R-b tags
>>
>> v2:
>> https://lore.kernel.org/qemu-devel/20230213070820.76881-17-philmd@linaro.org/
>>
>> Philippe Mathieu-Daudé (6):
>> hw/s390x/event-facility: Replace DO_UPCAST(SCLPEvent) by SCLP_EVENT()
>
> Thomas took the first patch,
>
>> hw/vfio/ccw: Simplify using DEVICE() macro
>> hw/vfio/ccw: Use intermediate S390CCWDevice variable
>> hw/vfio/ccw: Replace DO_UPCAST(S390CCWDevice) by S390_CCW_DEVICE()
>> hw/vfio/ccw: Remove pointless S390CCWDevice variable
>> hw/vfio/ccw: Replace DO_UPCAST(VFIOCCWDevice) by VFIO_CCW()
>
> Could you take the other ones via your VFIO tree?
> (all patches reviewed).
I've picked the other patches now, too (since they've got a Reviewed-by by
one of the vfio-ccw maintainers now).
Thomas
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 0/6] hw/vfio/ccw: hw: Use QOM macros and remove DO_UPCAST() uses
2023-02-27 11:46 ` Thomas Huth
@ 2023-02-27 12:30 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 15+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-02-27 12:30 UTC (permalink / raw)
To: Thomas Huth, qemu-devel, Alex Williamson
Cc: Eric Farman, Eduardo Habkost, Richard Henderson, qemu-s390x,
David Hildenbrand, Matthew Rosato, Christian Borntraeger,
Halil Pasic, Ilya Leoshkevich
On 27/2/23 12:46, Thomas Huth wrote:
> On 27/02/2023 12.15, Philippe Mathieu-Daudé wrote:
>> Hi Alex,
>> Could you take the other ones via your VFIO tree?
>> (all patches reviewed).
>
> I've picked the other patches now, too (since they've got a Reviewed-by
> by one of the vfio-ccw maintainers now).
Thank you :)
^ permalink raw reply [flat|nested] 15+ messages in thread