[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [Qemu-devel] [PATCH 1/2] virtio-net: fix cross-endianness support
From: |
Liu Yu-B13201 |
Subject: |
RE: [Qemu-devel] [PATCH 1/2] virtio-net: fix cross-endianness support |
Date: |
Mon, 28 Feb 2011 08:43:41 +0000 |
> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden
> On Behalf Of Aurelien Jarno
> Sent: Sunday, January 16, 2011 3:28 AM
> To: address@hidden
> Cc: Anthony Liguori; Aurelien Jarno
> Subject: [Qemu-devel] [PATCH 1/2] virtio-net: fix
> cross-endianness support
>
> virtio-net used to work on cross-endianness configurations,
> but doesn't
> anymore with recent guest kernels, as the new features don't handle
> endianness correctly.
>
> This patch fixes wrong conversion, and add missing ones to make
> virtio-net working. Tested on the following configurations:
> - i386 guest on x86_64 host
> - ppc guest on x86_64 host
> - i386 guest on mips host
> - ppc guest on mips host
>
> Cc: Anthony Liguori <address@hidden>
> Signed-off-by: Aurelien Jarno <address@hidden>
> ---
> hw/virtio-net.c | 13 +++++++------
> 1 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/hw/virtio-net.c b/hw/virtio-net.c
> index ec1bf8d..515fb19 100644
> --- a/hw/virtio-net.c
> +++ b/hw/virtio-net.c
> @@ -81,7 +81,7 @@ static void
> virtio_net_get_config(VirtIODevice *vdev, uint8_t *config)
> VirtIONet *n = to_virtio_net(vdev);
> struct virtio_net_config netcfg;
>
> - netcfg.status = n->status;
> + netcfg.status = lduw_p(&n->status);
> memcpy(netcfg.mac, n->mac, ETH_ALEN);
> memcpy(config, &netcfg, sizeof(netcfg));
> }
> @@ -340,7 +340,7 @@ static int
> virtio_net_handle_mac(VirtIONet *n, uint8_t cmd,
> n->mac_table.multi_overflow = 0;
> memset(n->mac_table.macs, 0, MAC_TABLE_ENTRIES * ETH_ALEN);
>
> - mac_data.entries = ldl_le_p(elem->out_sg[1].iov_base);
> + mac_data.entries = ldl_p(elem->out_sg[1].iov_base);
>
> if (sizeof(mac_data.entries) +
> (mac_data.entries * ETH_ALEN) > elem->out_sg[1].iov_len)
> @@ -356,7 +356,7 @@ static int
> virtio_net_handle_mac(VirtIONet *n, uint8_t cmd,
>
> n->mac_table.first_multi = n->mac_table.in_use;
>
> - mac_data.entries = ldl_le_p(elem->out_sg[2].iov_base);
> + mac_data.entries = ldl_p(elem->out_sg[2].iov_base);
>
Hello Aurelien,
Not clear what is happen, but this commit break e500(PowerPC big endian) kvm.
Looks like e500 is happy to use ldl_le_p(), but this patch change it to use
ldl_be_p().
Any thoughts about that?
Thanks,
Yu
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- RE: [Qemu-devel] [PATCH 1/2] virtio-net: fix cross-endianness support,
Liu Yu-B13201 <=