All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] virtio-scsi: scsi events must be converted to target endianness
@ 2014-06-30 15:17 Greg Kurz
  2014-06-30 18:08 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Greg Kurz @ 2014-06-30 15:17 UTC (permalink / raw)
  To: Paolo Bonzini, Michael S. Tsirkin; +Cc: qemu-devel

From: Cédric Le Goater <clg@fr.ibm.com>

Virtio SCSI Events need to be byteswapped before being pushed
when host and guest have a different endianness. Not doing so
breaks hotplug of virtio scsi disks, with the following error
message being printed in the guest console:

virtio_scsi: Unsupport virtio scsi event 1000000

This issue got uncovered while testing disk hotplug with a PowerKVM
ppc64le guest. I have checked that this issue also affects a x86_64
guest run on a ppc64 host.

Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
[ Ported from PowerKVM,
  Greg Kurz <gkurz@linux.vnet.ibm.com> ]
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
---
 hw/scsi/virtio-scsi.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
index 0b0a331..5568479 100644
--- a/hw/scsi/virtio-scsi.c
+++ b/hw/scsi/virtio-scsi.c
@@ -591,8 +591,8 @@ static void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev,
 
     evt = &req->resp.event;
     memset(evt, 0, sizeof(VirtIOSCSIEvent));
-    evt->event = event;
-    evt->reason = reason;
+    evt->event = virtio_tswap32(vdev, event);
+    evt->reason = virtio_tswap32(vdev, reason);
     if (!dev) {
         assert(event == VIRTIO_SCSI_T_EVENTS_MISSED);
     } else {

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

* Re: [Qemu-devel] [PATCH] virtio-scsi: scsi events must be converted to target endianness
  2014-06-30 15:17 [Qemu-devel] [PATCH] virtio-scsi: scsi events must be converted to target endianness Greg Kurz
@ 2014-06-30 18:08 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2014-06-30 18:08 UTC (permalink / raw)
  To: Greg Kurz, Michael S. Tsirkin; +Cc: qemu-devel

Il 30/06/2014 17:17, Greg Kurz ha scritto:
> From: Cédric Le Goater <clg@fr.ibm.com>
>
> Virtio SCSI Events need to be byteswapped before being pushed
> when host and guest have a different endianness. Not doing so
> breaks hotplug of virtio scsi disks, with the following error
> message being printed in the guest console:
>
> virtio_scsi: Unsupport virtio scsi event 1000000
>
> This issue got uncovered while testing disk hotplug with a PowerKVM
> ppc64le guest. I have checked that this issue also affects a x86_64
> guest run on a ppc64 host.
>
> Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
> [ Ported from PowerKVM,
>   Greg Kurz <gkurz@linux.vnet.ibm.com> ]
> Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
> ---
>  hw/scsi/virtio-scsi.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
> index 0b0a331..5568479 100644
> --- a/hw/scsi/virtio-scsi.c
> +++ b/hw/scsi/virtio-scsi.c
> @@ -591,8 +591,8 @@ static void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev,
>
>      evt = &req->resp.event;
>      memset(evt, 0, sizeof(VirtIOSCSIEvent));
> -    evt->event = event;
> -    evt->reason = reason;
> +    evt->event = virtio_tswap32(vdev, event);
> +    evt->reason = virtio_tswap32(vdev, reason);
>      if (!dev) {
>          assert(event == VIRTIO_SCSI_T_EVENTS_MISSED);
>      } else {
>
>
>

Applying to scsi-next branch, thanks.

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

end of thread, other threads:[~2014-06-30 18:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-30 15:17 [Qemu-devel] [PATCH] virtio-scsi: scsi events must be converted to target endianness Greg Kurz
2014-06-30 18:08 ` Paolo Bonzini

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.