qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: Farhan Ali <alifm@linux.vnet.ibm.com>, qemu-devel@nongnu.org
Cc: borntraeger@de.ibm.com, thuth@redhat.com, cohuck@redhat.com
Subject: Re: [Qemu-devel] [PATCH v1 1/2] virtio_gpu: Handle endian conversion
Date: Wed, 13 Sep 2017 10:13:55 +0200	[thread overview]
Message-ID: <1505290435.22749.3.camel@redhat.com> (raw)
In-Reply-To: <0a156f413f67b1bf55c5516d8263a15db3ec42c3.1505225353.git.alifm@linux.vnet.ibm.com>

  Hi,

> @@ -287,6 +287,12 @@ static void
> virtio_gpu_resource_create_2d(VirtIOGPU *g,
>      struct virtio_gpu_resource_create_2d c2d;
>  
>      VIRTIO_GPU_FILL_CMD(c2d);
> +
> +    c2d.resource_id = le32_to_cpu(c2d.resource_id);
> +    c2d.format = le32_to_cpu(c2d.format);
> +    c2d.width = le32_to_cpu(c2d.width);
> +    c2d.height = le32_to_cpu(c2d.height);
> +

Please move this to a helper function, maybe by updating the
VIRTIO_GPU_FILL_CMD macro.

The header fields should be byteswapped too.  As most structs have
32bit fields only (with the exception of hdr.fence_id) you should be
able to create a generic byteswap function which only needs the struct
size as argument and handles all structs without addresses/offsets
(which are 64bit fields).

The conversion looks incomplete, at least virtio_gpu_ctrl_response will
need adaptions too.  It probably works by luck because the guest driver
uses fences only in virgl (3d) mode.

cheers,
  Gerd

  reply	other threads:[~2017-09-13  8:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-12 14:26 [Qemu-devel] [PATCH v1 0/2] Virtio GPU for S390 Farhan Ali
2017-09-12 14:26 ` [Qemu-devel] [PATCH v1 1/2] virtio_gpu: Handle endian conversion Farhan Ali
2017-09-13  8:13   ` Gerd Hoffmann [this message]
2017-09-13 15:53     ` Farhan Ali
2017-09-14  8:44       ` Gerd Hoffmann
2017-09-12 14:26 ` [Qemu-devel] [PATCH v1 2/2] virtio-gpu-ccw: Create a virtio gpu device for the ccw bus Farhan Ali
2017-09-13 12:09   ` David Hildenbrand
2017-09-13 14:53     ` Gerd Hoffmann
2017-09-13 18:22     ` Thomas Huth
2017-09-13 14:31   ` Halil Pasic
2017-09-13 19:00 ` [Qemu-devel] [PATCH v1 0/2] Virtio GPU for S390 Thomas Huth
2017-09-13 19:11   ` Farhan Ali
2017-09-14  8:46   ` Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1505290435.22749.3.camel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=alifm@linux.vnet.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).