Message ID | 1425296404-12903-2-git-send-email-mst@redhat.com |
---|---|
State | New |
Headers | show |
On Mon, 2 Mar 2015 12:40:28 +0100 "Michael S. Tsirkin" <mst@redhat.com> wrote: > virtio 1.0 config space is in LE format for all > devices, use modern wrappers when accessed through > the 1.0 BAR. > > Reported-by: Rusty Russell <rusty@rustcorp.com.au> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com> > --- > hw/virtio/virtio-pci.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) Not that I'm deeply familiar with pci :), but this looks good to me. (This is on top of your pci branch, btw?)
On Mon, Mar 02, 2015 at 12:56:55PM +0100, Cornelia Huck wrote: > On Mon, 2 Mar 2015 12:40:28 +0100 > "Michael S. Tsirkin" <mst@redhat.com> wrote: > > > virtio 1.0 config space is in LE format for all > > devices, use modern wrappers when accessed through > > the 1.0 BAR. > > > > Reported-by: Rusty Russell <rusty@rustcorp.com.au> > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com> > > --- > > hw/virtio/virtio-pci.c | 12 ++++++------ > > 1 file changed, 6 insertions(+), 6 deletions(-) > > Not that I'm deeply familiar with pci :), but this looks good to me. > > (This is on top of your pci branch, btw?) virtio 1.0 branch
"Michael S. Tsirkin" <mst@redhat.com> writes: > virtio 1.0 config space is in LE format for all > devices, use modern wrappers when accessed through > the 1.0 BAR. Hmm, I'm not so sure about these patches. It's easy to miss the existence of the _modern variants, and they're 90% the same as the legacy variants. But as long as it's fixed... Thanks, Rusty. PS. rng, block, net and 9p virtio 1.0 seem to work OK on BE guests (LE host).
On Wed, Mar 04, 2015 at 11:06:08AM +1030, Rusty Russell wrote: > "Michael S. Tsirkin" <mst@redhat.com> writes: > > virtio 1.0 config space is in LE format for all > > devices, use modern wrappers when accessed through > > the 1.0 BAR. > > Hmm, I'm not so sure about these patches. It's easy to miss the > existence of the _modern variants, and they're 90% the same as the > legacy variants. > > But as long as it's fixed... > > Thanks, > Rusty. > PS. rng, block, net and 9p virtio 1.0 seem to work OK on BE guests (LE host). Hmm good point. What if I'll rework this to get bool legacy parameter?
"Michael S. Tsirkin" <mst@redhat.com> writes: > On Wed, Mar 04, 2015 at 11:06:08AM +1030, Rusty Russell wrote: >> "Michael S. Tsirkin" <mst@redhat.com> writes: >> > virtio 1.0 config space is in LE format for all >> > devices, use modern wrappers when accessed through >> > the 1.0 BAR. >> >> Hmm, I'm not so sure about these patches. It's easy to miss the >> existence of the _modern variants, and they're 90% the same as the >> legacy variants. >> >> But as long as it's fixed... >> >> Thanks, >> Rusty. >> PS. rng, block, net and 9p virtio 1.0 seem to work OK on BE guests (LE host). > > Hmm good point. What if I'll rework this to get bool legacy parameter? The functions have access to vdev, so they can determine that already. Simply renaming the old version to _legacy would be enough. Thanks, Rusty.
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 4c9a0b8..49ea7fc 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1198,13 +1198,13 @@ static uint64_t virtio_pci_device_read(void *opaque, hwaddr addr, switch (size) { case 1: - val = virtio_config_readb(vdev, addr); + val = virtio_config_modern_readb(vdev, addr); break; case 2: - val = virtio_config_readw(vdev, addr); + val = virtio_config_modern_readw(vdev, addr); break; case 4: - val = virtio_config_readl(vdev, addr); + val = virtio_config_modern_readl(vdev, addr); break; } return val; @@ -1216,13 +1216,13 @@ static void virtio_pci_device_write(void *opaque, hwaddr addr, VirtIODevice *vdev = opaque; switch (size) { case 1: - virtio_config_writeb(vdev, addr, val); + virtio_config_modern_writeb(vdev, addr, val); break; case 2: - virtio_config_writew(vdev, addr, val); + virtio_config_modern_writew(vdev, addr, val); break; case 4: - virtio_config_writel(vdev, addr, val); + virtio_config_modern_writel(vdev, addr, val); break; } }
virtio 1.0 config space is in LE format for all devices, use modern wrappers when accessed through the 1.0 BAR. Reported-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> --- hw/virtio/virtio-pci.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)