public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] vfio-ccw bugfixs
@ 2017-07-18  1:49 Dong Jia Shi
  2017-07-18  1:49 ` [PATCH 1/2] vfio/ccw: allocate irq info with the right size Dong Jia Shi
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Dong Jia Shi @ 2017-07-18  1:49 UTC (permalink / raw)
  To: linux-s390, kvm, qemu-devel; +Cc: cohuck, borntraeger, bjsdjshi

Dear Conny,

Here we got two bugfix patches for vfio-ccw:
- fix commit 7da624e2 which missed to initialize a new introduced
  pointer for the vfio-ccw case
- fix a memory allocation that used a wrong size for an irq info
  variable

Dong Jia Shi (1):
  vfio/ccw: fix initialization of the Object DeviceState pointer in the
    common base-device

Jing Zhang (1):
  vfio/ccw: allocate irq info with the right size

 hw/vfio/ccw.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

-- 
2.11.2

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

* [PATCH 1/2] vfio/ccw: allocate irq info with the right size
  2017-07-18  1:49 [PATCH 0/2] vfio-ccw bugfixs Dong Jia Shi
@ 2017-07-18  1:49 ` Dong Jia Shi
  2017-07-18  8:32   ` Cornelia Huck
  2017-07-18  1:49 ` [PATCH 2/2] vfio/ccw: fix initialization of the Object DeviceState pointer in the common base-device Dong Jia Shi
  2017-07-18  9:26 ` [PATCH 0/2] vfio-ccw bugfixs Cornelia Huck
  2 siblings, 1 reply; 8+ messages in thread
From: Dong Jia Shi @ 2017-07-18  1:49 UTC (permalink / raw)
  To: linux-s390, kvm, qemu-devel; +Cc: cohuck, borntraeger, bjsdjshi, Jing Zhang

From: Jing Zhang <bjzhjing@linux.vnet.ibm.com>

When allocating memory for the vfio_irq_info parameter of the
VFIO_DEVICE_GET_IRQ_INFO ioctl, we used the wrong size. Let's
fix it by using the right size.

Reviewed-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
Signed-off-by: Jing Zhang <bjzhjing@linux.vnet.ibm.com>
Signed-off-by: Dong Jia Shi <bjsdjshi@linux.vnet.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 12d0262336..8d97b53e77 100644
--- a/hw/vfio/ccw.c
+++ b/hw/vfio/ccw.c
@@ -168,7 +168,7 @@ static void vfio_ccw_register_io_notifier(VFIOCCWDevice *vcdev, Error **errp)
         return;
     }
 
-    argsz = sizeof(*irq_set);
+    argsz = sizeof(*irq_info);
     irq_info = g_malloc0(argsz);
     irq_info->index = VFIO_CCW_IO_IRQ_INDEX;
     irq_info->argsz = argsz;
-- 
2.11.2

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

* [PATCH 2/2] vfio/ccw: fix initialization of the Object DeviceState pointer in the common base-device
  2017-07-18  1:49 [PATCH 0/2] vfio-ccw bugfixs Dong Jia Shi
  2017-07-18  1:49 ` [PATCH 1/2] vfio/ccw: allocate irq info with the right size Dong Jia Shi
@ 2017-07-18  1:49 ` Dong Jia Shi
  2017-07-18  2:26   ` Alex Williamson
  2017-07-18  8:37   ` Cornelia Huck
  2017-07-18  9:26 ` [PATCH 0/2] vfio-ccw bugfixs Cornelia Huck
  2 siblings, 2 replies; 8+ messages in thread
From: Dong Jia Shi @ 2017-07-18  1:49 UTC (permalink / raw)
  To: linux-s390, kvm, qemu-devel
  Cc: cohuck, borntraeger, bjsdjshi, Alex Williamson

Commit 7da624e2 ("vfio: Test realized when using VFIOGroup.device_list
iterator") introduced a pointer to the Object DeviceState in the VFIO
common base-device and skiped non-realized devices as we iterate
VFIOGroup.device_list. While it missed to initialize the pointer for
the vfio-ccw case. Let's fix it.

Fixes: 7da624e2 ("vfio: Test realized when using VFIOGroup.device_list
                  iterator")

Cc: Alex Williamson <alex.williamson@redhat.com>
Reviewed-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Signed-off-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
---
 hw/vfio/ccw.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c
index 8d97b53e77..a8baadf57a 100644
--- a/hw/vfio/ccw.c
+++ b/hw/vfio/ccw.c
@@ -338,6 +338,7 @@ static void vfio_ccw_realize(DeviceState *dev, Error **errp)
     vcdev->vdev.type = VFIO_DEVICE_TYPE_CCW;
     vcdev->vdev.name = g_strdup_printf("%x.%x.%04x", cdev->hostid.cssid,
                                        cdev->hostid.ssid, cdev->hostid.devid);
+    vcdev->vdev.dev = dev;
     QLIST_FOREACH(vbasedev, &group->device_list, next) {
         if (strcmp(vbasedev->name, vcdev->vdev.name) == 0) {
             error_setg(&err, "vfio: subchannel %s has already been attached",
-- 
2.11.2

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

* Re: [PATCH 2/2] vfio/ccw: fix initialization of the Object DeviceState pointer in the common base-device
  2017-07-18  1:49 ` [PATCH 2/2] vfio/ccw: fix initialization of the Object DeviceState pointer in the common base-device Dong Jia Shi
@ 2017-07-18  2:26   ` Alex Williamson
  2017-07-18  8:37   ` Cornelia Huck
  1 sibling, 0 replies; 8+ messages in thread
From: Alex Williamson @ 2017-07-18  2:26 UTC (permalink / raw)
  To: Dong Jia Shi; +Cc: linux-s390, kvm, qemu-devel, cohuck, borntraeger

On Tue, 18 Jul 2017 03:49:26 +0200
Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com> wrote:

> Commit 7da624e2 ("vfio: Test realized when using VFIOGroup.device_list
> iterator") introduced a pointer to the Object DeviceState in the VFIO
> common base-device and skiped non-realized devices as we iterate
> VFIOGroup.device_list. While it missed to initialize the pointer for
> the vfio-ccw case. Let's fix it.
> 
> Fixes: 7da624e2 ("vfio: Test realized when using VFIOGroup.device_list
>                   iterator")

Sorry for that.

Reviewed-by: Alex Williamson <alex.williamson@redhat.com>

> Cc: Alex Williamson <alex.williamson@redhat.com>
> Reviewed-by: Halil Pasic <pasic@linux.vnet.ibm.com>
> Signed-off-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
> ---
>  hw/vfio/ccw.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c
> index 8d97b53e77..a8baadf57a 100644
> --- a/hw/vfio/ccw.c
> +++ b/hw/vfio/ccw.c
> @@ -338,6 +338,7 @@ static void vfio_ccw_realize(DeviceState *dev, Error **errp)
>      vcdev->vdev.type = VFIO_DEVICE_TYPE_CCW;
>      vcdev->vdev.name = g_strdup_printf("%x.%x.%04x", cdev->hostid.cssid,
>                                         cdev->hostid.ssid, cdev->hostid.devid);
> +    vcdev->vdev.dev = dev;
>      QLIST_FOREACH(vbasedev, &group->device_list, next) {
>          if (strcmp(vbasedev->name, vcdev->vdev.name) == 0) {
>              error_setg(&err, "vfio: subchannel %s has already been attached",

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

* Re: [PATCH 1/2] vfio/ccw: allocate irq info with the right size
  2017-07-18  1:49 ` [PATCH 1/2] vfio/ccw: allocate irq info with the right size Dong Jia Shi
@ 2017-07-18  8:32   ` Cornelia Huck
       [not found]     ` <20170718084943.GC15985@bjsdjshi@linux.vnet.ibm.com>
  0 siblings, 1 reply; 8+ messages in thread
From: Cornelia Huck @ 2017-07-18  8:32 UTC (permalink / raw)
  To: Dong Jia Shi; +Cc: linux-s390, kvm, qemu-devel, borntraeger, Jing Zhang

On Tue, 18 Jul 2017 03:49:25 +0200
Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com> wrote:

> From: Jing Zhang <bjzhjing@linux.vnet.ibm.com>
> 
> When allocating memory for the vfio_irq_info parameter of the
> VFIO_DEVICE_GET_IRQ_INFO ioctl, we used the wrong size. Let's
> fix it by using the right size.
> 
> Reviewed-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
> Signed-off-by: Jing Zhang <bjzhjing@linux.vnet.ibm.com>
> Signed-off-by: Dong Jia Shi <bjsdjshi@linux.vnet.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 12d0262336..8d97b53e77 100644
> --- a/hw/vfio/ccw.c
> +++ b/hw/vfio/ccw.c
> @@ -168,7 +168,7 @@ static void vfio_ccw_register_io_notifier(VFIOCCWDevice *vcdev, Error **errp)
>          return;
>      }
>  
> -    argsz = sizeof(*irq_set);
> +    argsz = sizeof(*irq_info);
>      irq_info = g_malloc0(argsz);
>      irq_info->index = VFIO_CCW_IO_IRQ_INDEX;
>      irq_info->argsz = argsz;

irq_set is larger than irq_info, but yes, let's do this correctly.

Out of curiosity, how did you spot this?

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

* Re: [PATCH 2/2] vfio/ccw: fix initialization of the Object DeviceState pointer in the common base-device
  2017-07-18  1:49 ` [PATCH 2/2] vfio/ccw: fix initialization of the Object DeviceState pointer in the common base-device Dong Jia Shi
  2017-07-18  2:26   ` Alex Williamson
@ 2017-07-18  8:37   ` Cornelia Huck
  1 sibling, 0 replies; 8+ messages in thread
From: Cornelia Huck @ 2017-07-18  8:37 UTC (permalink / raw)
  To: Dong Jia Shi; +Cc: linux-s390, kvm, qemu-devel, borntraeger, Alex Williamson

On Tue, 18 Jul 2017 03:49:26 +0200
Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com> wrote:

> Commit 7da624e2 ("vfio: Test realized when using VFIOGroup.device_list
> iterator") introduced a pointer to the Object DeviceState in the VFIO
> common base-device and skiped non-realized devices as we iterate

s/skiped/skipped/

I'll fix this while applying.

> VFIOGroup.device_list. While it missed to initialize the pointer for
> the vfio-ccw case. Let's fix it.
> 
> Fixes: 7da624e2 ("vfio: Test realized when using VFIOGroup.device_list
>                   iterator")
> 
> Cc: Alex Williamson <alex.williamson@redhat.com>
> Reviewed-by: Halil Pasic <pasic@linux.vnet.ibm.com>
> Signed-off-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
> ---
>  hw/vfio/ccw.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c
> index 8d97b53e77..a8baadf57a 100644
> --- a/hw/vfio/ccw.c
> +++ b/hw/vfio/ccw.c
> @@ -338,6 +338,7 @@ static void vfio_ccw_realize(DeviceState *dev, Error **errp)
>      vcdev->vdev.type = VFIO_DEVICE_TYPE_CCW;
>      vcdev->vdev.name = g_strdup_printf("%x.%x.%04x", cdev->hostid.cssid,
>                                         cdev->hostid.ssid, cdev->hostid.devid);
> +    vcdev->vdev.dev = dev;
>      QLIST_FOREACH(vbasedev, &group->device_list, next) {
>          if (strcmp(vbasedev->name, vcdev->vdev.name) == 0) {
>              error_setg(&err, "vfio: subchannel %s has already been attached",

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

* Re: [PATCH 1/2] vfio/ccw: allocate irq info with the right size
       [not found]     ` <20170718084943.GC15985@bjsdjshi@linux.vnet.ibm.com>
@ 2017-07-18  9:07       ` Cornelia Huck
  0 siblings, 0 replies; 8+ messages in thread
From: Cornelia Huck @ 2017-07-18  9:07 UTC (permalink / raw)
  To: Dong Jia Shi; +Cc: linux-s390, kvm, qemu-devel, borntraeger, Jing Zhang

On Tue, 18 Jul 2017 16:49:43 +0800
Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com> wrote:

> * Cornelia Huck <cohuck@redhat.com> [2017-07-18 10:32:13 +0200]:
> 
> > On Tue, 18 Jul 2017 03:49:25 +0200
> > Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com> wrote:
> >   
> > > From: Jing Zhang <bjzhjing@linux.vnet.ibm.com>
> > > 
> > > When allocating memory for the vfio_irq_info parameter of the
> > > VFIO_DEVICE_GET_IRQ_INFO ioctl, we used the wrong size. Let's
> > > fix it by using the right size.
> > > 
> > > Reviewed-by: Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com>
> > > Signed-off-by: Jing Zhang <bjzhjing@linux.vnet.ibm.com>
> > > Signed-off-by: Dong Jia Shi <bjsdjshi@linux.vnet.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 12d0262336..8d97b53e77 100644
> > > --- a/hw/vfio/ccw.c
> > > +++ b/hw/vfio/ccw.c
> > > @@ -168,7 +168,7 @@ static void vfio_ccw_register_io_notifier(VFIOCCWDevice *vcdev, Error **errp)
> > >          return;
> > >      }
> > >  
> > > -    argsz = sizeof(*irq_set);
> > > +    argsz = sizeof(*irq_info);
> > >      irq_info = g_malloc0(argsz);
> > >      irq_info->index = VFIO_CCW_IO_IRQ_INDEX;
> > >      irq_info->argsz = argsz;  
> > 
> > irq_set is larger than irq_info, but yes, let's do this correctly.
> > 
> > Out of curiosity, how did you spot this?
> >   
> 
> I'm trying to reuse the code here, while introducing some new MMIO
> regions, which you will see them some days later. ;>
> 

Looking forward to that :)

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

* Re: [PATCH 0/2] vfio-ccw bugfixs
  2017-07-18  1:49 [PATCH 0/2] vfio-ccw bugfixs Dong Jia Shi
  2017-07-18  1:49 ` [PATCH 1/2] vfio/ccw: allocate irq info with the right size Dong Jia Shi
  2017-07-18  1:49 ` [PATCH 2/2] vfio/ccw: fix initialization of the Object DeviceState pointer in the common base-device Dong Jia Shi
@ 2017-07-18  9:26 ` Cornelia Huck
  2 siblings, 0 replies; 8+ messages in thread
From: Cornelia Huck @ 2017-07-18  9:26 UTC (permalink / raw)
  To: Dong Jia Shi; +Cc: linux-s390, kvm, qemu-devel, borntraeger

On Tue, 18 Jul 2017 03:49:24 +0200
Dong Jia Shi <bjsdjshi@linux.vnet.ibm.com> wrote:

> Dear Conny,
> 
> Here we got two bugfix patches for vfio-ccw:
> - fix commit 7da624e2 which missed to initialize a new introduced
>   pointer for the vfio-ccw case
> - fix a memory allocation that used a wrong size for an irq info
>   variable
> 
> Dong Jia Shi (1):
>   vfio/ccw: fix initialization of the Object DeviceState pointer in the
>     common base-device
> 
> Jing Zhang (1):
>   vfio/ccw: allocate irq info with the right size
> 
>  hw/vfio/ccw.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 

Thanks, queued to my s390-next branch.

As these are bugfixes, I'll send a pullreq next week.

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

end of thread, other threads:[~2017-07-18  9:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-18  1:49 [PATCH 0/2] vfio-ccw bugfixs Dong Jia Shi
2017-07-18  1:49 ` [PATCH 1/2] vfio/ccw: allocate irq info with the right size Dong Jia Shi
2017-07-18  8:32   ` Cornelia Huck
     [not found]     ` <20170718084943.GC15985@bjsdjshi@linux.vnet.ibm.com>
2017-07-18  9:07       ` Cornelia Huck
2017-07-18  1:49 ` [PATCH 2/2] vfio/ccw: fix initialization of the Object DeviceState pointer in the common base-device Dong Jia Shi
2017-07-18  2:26   ` Alex Williamson
2017-07-18  8:37   ` Cornelia Huck
2017-07-18  9:26 ` [PATCH 0/2] vfio-ccw bugfixs Cornelia Huck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox