]> rtime.felk.cvut.cz Git - lisovros/qemu_apohw.git/commit
virtio: add endian-ambivalent support to VirtIODevice
authorGreg Kurz <gkurz@linux.vnet.ibm.com>
Tue, 24 Jun 2014 17:38:54 +0000 (19:38 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Sun, 29 Jun 2014 16:39:42 +0000 (19:39 +0300)
commit616a655219a92ae7cf5d6a7862e6489c6282009e
tree034610ea9da38e5895f4083c16c12dc1b45a63d7
parentbf7663c4bd8f8f619d6dbb5780025d92ace250a8
virtio: add endian-ambivalent support to VirtIODevice

Some CPU families can dynamically change their endianness. This means we
can have little endian ppc or big endian arm guests for example. This has
an impact on legacy virtio data structures since they are target endian.
We hence introduce a new property to track the endianness of each virtio
device. It is reasonnably assumed that endianness won't change while the
device is in use : we hence capture the device endianness when it gets
reset.

We migrate this property in a subsection, after the device descriptor. This
means the load code must not rely on it until it is restored. As a consequence,
the vring sanity checks had to be moved after the call to vmstate_load_state().
We enforce paranoia by poisoning the property at the begining of virtio_load().

Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/virtio/virtio-pci.c
hw/virtio/virtio.c
include/hw/virtio/virtio.h