[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [Qemu-ppc] [PATCH] virtio-pci: fix host notifiers on bi
From: |
Benjamin Herrenschmidt |
Subject: |
Re: [Qemu-devel] [Qemu-ppc] [PATCH] virtio-pci: fix host notifiers on bi-endian architectures |
Date: |
Thu, 12 Mar 2015 09:18:38 +1100 |
On Wed, 2015-03-11 at 23:03 +0100, Greg Kurz wrote:
> /* The host notifier will be swapped in adjust_endianness() according to the
> * target default endianness. We need to negate this swap if the device uses
> * an endianness that is not the default (ppc64le for example).
> */
>
> > > +static uint16_t cpu_to_host_notifier16(VirtIODevice *vdev, uint16_t val)
> > > +{
> > > + return virtio_is_big_endian(vdev) ? val : bswap16(val);
> > > +}
But but but ... The above ... won't it do things like break x86 ? Ie,
shouldn't we swap only if TARGET_BIG_ENDIAN and !virtio_is_big_endian ?
Or better, "fixed target endian" ^ "virtio endian" to cover all cases ?
Cheers,
Ben.
> > > static int virtio_pci_set_host_notifier_internal(VirtIOPCIProxy *proxy,
> > > int n, bool assign,
> > > bool set_handler)
> > > {
> > > @@ -150,10 +155,12 @@ static int
> > > virtio_pci_set_host_notifier_internal(VirtIOPCIProxy *proxy,
> > > }
> > > virtio_queue_set_host_notifier_fd_handler(vq, true, set_handler);
> > > memory_region_add_eventfd(&proxy->bar, VIRTIO_PCI_QUEUE_NOTIFY,
> > > 2,
> > > - true, n, notifier);
> > > + true, cpu_to_host_notifier16(vdev, n),
> > > + notifier);
> > > } else {
> > > memory_region_del_eventfd(&proxy->bar, VIRTIO_PCI_QUEUE_NOTIFY,
> > > 2,
> > > - true, n, notifier);
> > > + true, cpu_to_host_notifier16(vdev, n),
> > > + notifier);
> > > virtio_queue_set_host_notifier_fd_handler(vq, false, false);
> > > event_notifier_cleanup(notifier);
> > > }
> >
>
- [Qemu-devel] [PATCH] virtio-pci: fix host notifiers on bi-endian architectures, Greg Kurz, 2015/03/11
- Re: [Qemu-devel] [PATCH] virtio-pci: fix host notifiers on bi-endian architectures, Michael S. Tsirkin, 2015/03/11
- Re: [Qemu-devel] [PATCH] virtio-pci: fix host notifiers on bi-endian architectures, Michael S. Tsirkin, 2015/03/12
- Re: [Qemu-devel] [PATCH] virtio-pci: fix host notifiers on bi-endian architectures, Paolo Bonzini, 2015/03/12
- Re: [Qemu-devel] [PATCH] virtio-pci: fix host notifiers on bi-endian architectures, Greg Kurz, 2015/03/13
- [Qemu-devel] [PATCH 1/2] memory: make adjust_endianness() generic, Greg Kurz, 2015/03/13
- [Qemu-devel] [PATCH 2/2] memory: fix the eventfd data endianness according to the host, Greg Kurz, 2015/03/13
- Re: [Qemu-devel] [PATCH 2/2] memory: fix the eventfd data endianness according to the host, Paolo Bonzini, 2015/03/13
- Re: [Qemu-devel] [PATCH 2/2] memory: fix the eventfd data endianness according to the host, Greg Kurz, 2015/03/13
- Re: [Qemu-devel] [PATCH 2/2] memory: fix the eventfd data endianness according to the host, Paolo Bonzini, 2015/03/13