qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Greg Kurz <gkurz@linux.vnet.ibm.com>,
	Peter Maydell <peter.maydell@linaro.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Alexander Graf <agraf@suse.de>,
	David Gibson <david@gibson.dropbear.id.au>
Cc: qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] virtio: move bi-endian target support to a single location
Date: Tue, 31 May 2016 13:54:11 +0200	[thread overview]
Message-ID: <81bca811-db78-ffd2-dbfc-67e14ae88ce2@redhat.com> (raw)
In-Reply-To: <146468219419.25446.8053365248306938869.stgit@bahia.huguette.org>



On 31/05/2016 10:09, Greg Kurz wrote:
> diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
> index 440071815408..81cc5b0ae35c 100644
> --- a/hw/virtio/vhost.c
> +++ b/hw/virtio/vhost.c
> @@ -767,15 +767,11 @@ static inline bool vhost_needs_vring_endian(VirtIODevice *vdev)
>      if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {
>          return false;
>      }
> -#ifdef TARGET_IS_BIENDIAN
>  #ifdef HOST_WORDS_BIGENDIAN
>      return vdev->device_endian == VIRTIO_DEVICE_ENDIAN_LITTLE;
>  #else
>      return vdev->device_endian == VIRTIO_DEVICE_ENDIAN_BIG;
>  #endif
> -#else
> -    return false;
> -#endif

This should be okay.

>  }
>  
>  static int vhost_virtqueue_set_vring_endian_legacy(struct vhost_dev *dev,
> diff --git a/include/hw/virtio/virtio-access.h b/include/hw/virtio/virtio-access.h
> index 8dc84f520316..4b2803814642 100644
> --- a/include/hw/virtio/virtio-access.h
> +++ b/include/hw/virtio/virtio-access.h
> @@ -17,9 +17,13 @@
>  #include "hw/virtio/virtio.h"
>  #include "exec/address-spaces.h"
>  
> +#if defined(TARGET_PPC64) || defined(TARGET_ARM)
> +#define LEGACY_VIRTIO_IS_BIENDIAN 1
> +#endif

These will only be correct if something else includes cpu.h.  Instead of
defining this, you should add

#include "cpu.h"

at the top of include/hw/virtio-access.h and leave the definitions in
target-*/cpu.h.

Thanks,

Paolo

>  static inline bool virtio_access_is_big_endian(VirtIODevice *vdev)
>  {
> -#if defined(TARGET_IS_BIENDIAN)
> +#if defined(LEGACY_VIRTIO_IS_BIENDIAN)
>      return virtio_is_big_endian(vdev);
>  #elif defined(TARGET_WORDS_BIGENDIAN)
>      if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {
> diff --git a/target-arm/cpu.h b/target-arm/cpu.h
> index c741b53ad45f..60971e16f7a4 100644
> --- a/target-arm/cpu.h
> +++ b/target-arm/cpu.h
> @@ -29,8 +29,6 @@
>  #  define TARGET_LONG_BITS 32
>  #endif
>  
> -#define TARGET_IS_BIENDIAN 1
> -
>  #define CPUArchState struct CPUARMState
>  
>  #include "qemu-common.h"
> diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h
> index cd33539d1ce9..556d66c39d11 100644
> --- a/target-ppc/cpu.h
> +++ b/target-ppc/cpu.h
> @@ -28,8 +28,6 @@
>  #define TARGET_LONG_BITS 64
>  #define TARGET_PAGE_BITS 12
>  
> -#define TARGET_IS_BIENDIAN 1
> -
>  /* Note that the official physical address space bits is 62-M where M
>     is implementation dependent.  I've not looked up M for the set of
>     cpus we emulate at the system level.  */
> 

  parent reply	other threads:[~2016-05-31 11:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-31  8:09 [Qemu-devel] [PATCH] virtio: move bi-endian target support to a single location Greg Kurz
2016-05-31  9:19 ` Cédric Le Goater
2016-05-31 11:54 ` Paolo Bonzini [this message]
2016-05-31 13:10   ` Greg Kurz
2016-05-31 13:14     ` Peter Maydell
2016-05-31 14:10       ` Greg Kurz
2016-05-31 13:15     ` Paolo Bonzini
2016-05-31 14:10       ` Greg Kurz
2016-06-01  2:33       ` David Gibson
2016-06-01  8:30         ` Paolo Bonzini
2016-06-02 16:04         ` Greg Kurz
2016-06-03  1:16           ` David Gibson
2016-06-03  6:05             ` Greg Kurz
2016-06-06 13:41             ` Paolo Bonzini

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=81bca811-db78-ffd2-dbfc-67e14ae88ce2@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=agraf@suse.de \
    --cc=david@gibson.dropbear.id.au \
    --cc=gkurz@linux.vnet.ibm.com \
    --cc=mst@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /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).