virtio: memory accessors for endian-ambivalent targets
commit0f5d1d2a49778863db54b4b1ac2dc008a8f21f11
authorGreg Kurz <gkurz@linux.vnet.ibm.com>
Tue, 24 Jun 2014 17:39:55 +0000 (24 19:39 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Sun, 29 Jun 2014 16:39:42 +0000 (29 19:39 +0300)
tree40d098de5380831ffd85e0ebeef3c3cafe90f905
parent616a655219a92ae7cf5d6a7862e6489c6282009e
virtio: memory accessors for endian-ambivalent targets

This is the virtio-access.h header file taken from Rusty's "endian-ambivalent
targets using legacy virtio" patch. It introduces helpers that should be used
when accessing vring data or by drivers for data that contains headers.
The virtio config space is also target endian, but the current code already
handles that with the virtio_is_big_endian() helper. There is no obvious
benefit at using the virtio accessors in this case.

Now we have two distinct paths: a fast inline one for fixed endian targets,
and a slow out-of-line one for targets that define the new TARGET_IS_BIENDIAN
macro.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
[ relicensed virtio-access.h to GPLv2+ on Rusty's request,
  pass &address_space_memory to physical memory accessors,
  per-device endianness,
  virtio tswap16 and tswap64 helpers,
  faspath for fixed endian targets,
  Greg Kurz <gkurz@linux.vnet.ibm.com> ]
Cc: Cédric Le Goater <clg@fr.ibm.com>
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
include/hw/virtio/virtio-access.h [new file with mode: 0644]