Re: [Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host features

2013-03-07 Thread Anthony Liguori
Andreas Färber writes: > Am 07.03.2013 17:44, schrieb Anthony Liguori: >> Andreas Färber writes: >> >>> Am 07.03.2013 17:27, schrieb Christian Borntraeger: > It's a bug in both virtio-ccw that features=0 when get_features is > called. You can also tell this with: > > [10:02 AM]

Re: [Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host features

2013-03-07 Thread Anthony Liguori
"Michael S. Tsirkin" writes: > On Thu, Mar 07, 2013 at 10:44:18AM -0600, Anthony Liguori wrote: >> Andreas Färber writes: >> >> > Am 07.03.2013 17:27, schrieb Christian Borntraeger: >> >>> It's a bug in both virtio-ccw that features=0 when get_features is >> >>> called. You can also tell this

Re: [Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host features

2013-03-07 Thread Andreas Färber
Am 07.03.2013 17:44, schrieb Anthony Liguori: > Andreas Färber writes: > >> Am 07.03.2013 17:27, schrieb Christian Borntraeger: It's a bug in both virtio-ccw that features=0 when get_features is called. You can also tell this with: [10:02 AM] anthony@titi:~/git/qemu/hw/s390x$

Re: [Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host features

2013-03-07 Thread Michael S. Tsirkin
On Thu, Mar 07, 2013 at 10:44:18AM -0600, Anthony Liguori wrote: > Andreas Färber writes: > > > Am 07.03.2013 17:27, schrieb Christian Borntraeger: > >>> It's a bug in both virtio-ccw that features=0 when get_features is > >>> called. You can also tell this with: > >>> > >>> [10:02 AM] anthony@t

Re: [Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host features

2013-03-07 Thread Anthony Liguori
Andreas Färber writes: > Am 07.03.2013 17:27, schrieb Christian Borntraeger: >>> It's a bug in both virtio-ccw that features=0 when get_features is >>> called. You can also tell this with: >>> >>> [10:02 AM] anthony@titi:~/git/qemu/hw/s390x$ grep >>> DEFINE_VIRTIO_NET_FEATURES * >>> virtio-ccw.

Re: [Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host features

2013-03-07 Thread Anthony Liguori
Christian Borntraeger writes: >> You're misreading how this works. >> >> Host features are set based on command line arguments. This is >> advertised to the guest. The vdev->get_config() call then sanitizes >> features. For instance, look at: >> >> static uint32_t virtio_net_get_features(Vir

Re: [Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host features

2013-03-07 Thread Alexander Graf
On 07.03.2013, at 17:27, Christian Borntraeger wrote: >> You're misreading how this works. >> >> Host features are set based on command line arguments. This is >> advertised to the guest. The vdev->get_config() call then sanitizes >> features. For instance, look at: >> >> static uint32_t vir

Re: [Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host features

2013-03-07 Thread Andreas Färber
Am 07.03.2013 17:27, schrieb Christian Borntraeger: >> It's a bug in both virtio-ccw that features=0 when get_features is >> called. You can also tell this with: >> >> [10:02 AM] anthony@titi:~/git/qemu/hw/s390x$ grep DEFINE_VIRTIO_NET_FEATURES >> * >> virtio-ccw.c:DEFINE_VIRTIO_NET_FEATURES(

Re: [Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host features

2013-03-07 Thread Christian Borntraeger
> You're misreading how this works. > > Host features are set based on command line arguments. This is > advertised to the guest. The vdev->get_config() call then sanitizes > features. For instance, look at: > > static uint32_t virtio_net_get_features(VirtIODevice *vdev, uint32_t features) > {

Re: [Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host features

2013-03-07 Thread Anthony Liguori
Christian Borntraeger writes: > On 05/03/13 17:48, Alexander Graf wrote: >> On 02/06/2013 12:47 AM, Jesse Larrew wrote: >>> Currently, the config size for virtio devices is hard coded. When a new >>> feature is added that changes the config size, drivers that assume a static >>> config size will

Re: [Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host features

2013-03-07 Thread Christian Borntraeger
Ping. Anthony, Jesse, how is this supposed to work? Christian On 05/03/13 18:03, Christian Borntraeger wrote: > On 05/03/13 17:48, Alexander Graf wrote: >> On 02/06/2013 12:47 AM, Jesse Larrew wrote: >>> Currently, the config size for virtio devices is hard coded. When a new >>> feature is added

Re: [Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host features

2013-03-05 Thread Alexander Graf
On 02/06/2013 12:47 AM, Jesse Larrew wrote: Currently, the config size for virtio devices is hard coded. When a new feature is added that changes the config size, drivers that assume a static config size will break. For purposes of backward compatibility, there needs to be a way to inform drivers

Re: [Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host features

2013-03-05 Thread Christian Borntraeger
On 05/03/13 17:48, Alexander Graf wrote: > On 02/06/2013 12:47 AM, Jesse Larrew wrote: >> Currently, the config size for virtio devices is hard coded. When a new >> feature is added that changes the config size, drivers that assume a static >> config size will break. For purposes of backward compat

Re: [Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host features

2013-03-05 Thread Alexander Graf
On 02/06/2013 12:47 AM, Jesse Larrew wrote: Currently, the config size for virtio devices is hard coded. When a new feature is added that changes the config size, drivers that assume a static config size will break. For purposes of backward compatibility, there needs to be a way to inform drivers

Re: [Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host features

2013-02-07 Thread Anthony Liguori
"Michael S. Tsirkin" writes: > On Tue, Feb 05, 2013 at 05:47:16PM -0600, Jesse Larrew wrote: >> Currently, the config size for virtio devices is hard coded. When a new >> feature is added that changes the config size, drivers that assume a static >> config size will break. For purposes of backwar

Re: [Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host features

2013-02-07 Thread Stefan Hajnoczi
On Thu, Feb 7, 2013 at 4:55 PM, Anthony Liguori wrote: > Stefan Hajnoczi writes: > >> On Thu, Feb 7, 2013 at 3:43 PM, Laszlo Ersek wrote: >>> Instead, what about >>> >>> #define endof(container, field) \ >>> (offsetof(container, field) + sizeof ((container *)0)->field) >> >> As mentioned in

Re: [Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host features

2013-02-07 Thread Michael S. Tsirkin
On Thu, Feb 07, 2013 at 03:15:42PM -0600, Anthony Liguori wrote: > "Michael S. Tsirkin" writes: > > > On Thu, Feb 07, 2013 at 11:46:55AM -0600, Anthony Liguori wrote: > > > > So why do we add extra code who's sole effect is breaking old > > windows drivers? > > A little dramatic, no? > > > I li

Re: [Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host features

2013-02-07 Thread Anthony Liguori
"Michael S. Tsirkin" writes: > On Thu, Feb 07, 2013 at 11:46:55AM -0600, Anthony Liguori wrote: > > So why do we add extra code who's sole effect is breaking old > windows drivers? A little dramatic, no? > I like the idea but why add code for status and mac features? Because it's correct and t

Re: [Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host features

2013-02-07 Thread Michael S. Tsirkin
On Thu, Feb 07, 2013 at 11:46:55AM -0600, Anthony Liguori wrote: > "Michael S. Tsirkin" writes: > > > On Thu, Feb 07, 2013 at 09:45:54AM -0600, Anthony Liguori wrote: > >> "Michael S. Tsirkin" writes: > >> > >> This is about bug-for-bug compatibility with older QEMU. > > > > Sorry, with which v

Re: [Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host features

2013-02-07 Thread Anthony Liguori
Stefan Hajnoczi writes: > On Thu, Feb 7, 2013 at 3:43 PM, Laszlo Ersek wrote: >> Instead, what about >> >> #define endof(container, field) \ >> (offsetof(container, field) + sizeof ((container *)0)->field) > > As mentioned in my reply, I think endof() isn't necessary. > > Just use offsetof()

Re: [Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host features

2013-02-07 Thread Anthony Liguori
Laszlo Ersek writes: > On 02/07/13 09:55, Michael S. Tsirkin wrote: >> On Tue, Feb 05, 2013 at 05:47:16PM -0600, Jesse Larrew wrote: >>> Currently, the config size for virtio devices is hard coded. When a new >>> feature is added that changes the config size, drivers that assume a static >>> conf

Re: [Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host features

2013-02-07 Thread Anthony Liguori
"Michael S. Tsirkin" writes: > On Thu, Feb 07, 2013 at 09:45:54AM -0600, Anthony Liguori wrote: >> "Michael S. Tsirkin" writes: >> >> This is about bug-for-bug compatibility with older QEMU. > > Sorry, with which version? > > It looks like if I run qemu 1.3 with .status=off > windows drivers wo

Re: [Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host features

2013-02-07 Thread Michael S. Tsirkin
On Thu, Feb 07, 2013 at 04:22:45PM +0100, Stefan Hajnoczi wrote: > On Thu, Feb 7, 2013 at 3:43 PM, Laszlo Ersek wrote: > > Instead, what about > > > > #define endof(container, field) \ > > (offsetof(container, field) + sizeof ((container *)0)->field) > > As mentioned in my reply, I think endo

Re: [Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host features

2013-02-07 Thread Michael S. Tsirkin
On Thu, Feb 07, 2013 at 05:56:16PM +0200, Michael S. Tsirkin wrote: > On Thu, Feb 07, 2013 at 09:45:54AM -0600, Anthony Liguori wrote: > > "Michael S. Tsirkin" writes: > > > > > On Tue, Feb 05, 2013 at 05:47:16PM -0600, Jesse Larrew wrote: > > >> Currently, the config size for virtio devices is h

Re: [Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host features

2013-02-07 Thread Michael S. Tsirkin
On Thu, Feb 07, 2013 at 09:45:54AM -0600, Anthony Liguori wrote: > "Michael S. Tsirkin" writes: > > > On Tue, Feb 05, 2013 at 05:47:16PM -0600, Jesse Larrew wrote: > >> Currently, the config size for virtio devices is hard coded. When a new > >> feature is added that changes the config size, driv

Re: [Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host features

2013-02-07 Thread Laszlo Ersek
On 02/07/13 16:22, Stefan Hajnoczi wrote: > On Thu, Feb 7, 2013 at 3:43 PM, Laszlo Ersek wrote: >> Instead, what about >> >> #define endof(container, field) \ >> (offsetof(container, field) + sizeof ((container *)0)->field) > > As mentioned in my reply, I think endof() isn't necessary. > > J

Re: [Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host features

2013-02-07 Thread Laszlo Ersek
On 02/07/13 15:43, Laszlo Ersek wrote: > On 02/07/13 09:55, Michael S. Tsirkin wrote: >> On Tue, Feb 05, 2013 at 05:47:16PM -0600, Jesse Larrew wrote: >>> +#define endof(container, field) \ >>> +((intptr_t)(&(((container *)0)->field)+1)) >> > Furthermore, taking the pointer to "one past" &fie

Re: [Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host features

2013-02-07 Thread Michael S. Tsirkin
On Thu, Feb 07, 2013 at 03:43:51PM +0100, Laszlo Ersek wrote: > #define endof(container, field) \ > (offsetof(container, field) + sizeof ((container *)0)->field) Indeed, this looks cleaner.

Re: [Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host features

2013-02-07 Thread Stefan Hajnoczi
On Thu, Feb 7, 2013 at 3:43 PM, Laszlo Ersek wrote: > Instead, what about > > #define endof(container, field) \ > (offsetof(container, field) + sizeof ((container *)0)->field) As mentioned in my reply, I think endof() isn't necessary. Just use offsetof() the *next* field or sizeof() the enti

Re: [Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host features

2013-02-07 Thread Laszlo Ersek
On 02/07/13 09:55, Michael S. Tsirkin wrote: > On Tue, Feb 05, 2013 at 05:47:16PM -0600, Jesse Larrew wrote: >> Currently, the config size for virtio devices is hard coded. When a new >> feature is added that changes the config size, drivers that assume a static >> config size will break. For purpo

Re: [Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host features

2013-02-07 Thread Stefan Hajnoczi
On Tue, Feb 05, 2013 at 05:47:16PM -0600, Jesse Larrew wrote: > diff --git a/hw/virtio-net.c b/hw/virtio-net.c > index f1c2884..8f521b3 100644 > --- a/hw/virtio-net.c > +++ b/hw/virtio-net.c > @@ -73,8 +73,31 @@ typedef struct VirtIONet > int multiqueue; > uint16_t max_queues; > uint

Re: [Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host features

2013-02-07 Thread Michael S. Tsirkin
On Tue, Feb 05, 2013 at 05:47:16PM -0600, Jesse Larrew wrote: > Currently, the config size for virtio devices is hard coded. When a new > feature is added that changes the config size, drivers that assume a static > config size will break. For purposes of backward compatibility, there needs > to be

[Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host features

2013-02-05 Thread Jesse Larrew
Currently, the config size for virtio devices is hard coded. When a new feature is added that changes the config size, drivers that assume a static config size will break. For purposes of backward compatibility, there needs to be a way to inform drivers of the config size needed to accommodate the

Re: [Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host features

2013-02-05 Thread Eric Blake
On 02/05/2013 03:48 PM, Jesse Larrew wrote: > Currently, the config size for virtio devices is hard coded. When a new > feature is added that changes the config size, drivers that assume a static > config size will break. For purposes of backward compatability, there needs s/compatability/compatib

[Qemu-devel] [PATCH 2/3] hw/virtio-net.c: set config size using host features

2013-02-05 Thread Jesse Larrew
Currently, the config size for virtio devices is hard coded. When a new feature is added that changes the config size, drivers that assume a static config size will break. For purposes of backward compatability, there needs to be a way to inform drivers of the config size needed to accomodate the s