virtio: fix wrong features returned for legacy virtio
PATCH 1/1 virtio: fix wrong features returned for legacy virtio
Declare dst as type uint32_t instead of uint64_t, otherwise, we will get a random upper 32 bit feature bits, as the following io port read reads lower 32 bit only. It could lead a feature bits that include VIRTIO_F_VERSION_1 (the 32th bit) for legacy virtio, which is obviously wrong.
--- drivers/net/virtio/virtio_pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/virtio/virtio_pci.c +1 -1
@@ -74,7 +74,7 @@ legacy_write_dev_config(struct virtio_hw *hw, size_t offset,static uint64_t legacy_get_features (struct virtio_hw *hw) { -uint64_t dst; +uint32_t dst;rte_eal_pci_ioport_read (&hw->io, &dst,4 ,VIRTIO_PCI_HOST_FEATURES );return dst;
Signature · 1 line
1.9.0
Quoted 18 lines · Yuanhan Liu
Declare dst as type
uint32_tinstead ofuint64_t, otherwise, we will get a random upper 32 bit feature bits, as the following io port read reads lower 32 bit only. It could lead a feature bits that includeVIRTIO_F_VERSION_1(the 32th bit) for legacy virtio, which is obviously wrong.Fixes b8f04520ad71 ("virtio: use PCI ioport API")Cc David Marchand <[email protected]>Signed-off-by Yuanhan Liu <[email protected]>--- drivers/net/virtio/virtio_pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/virtio/virtio_pci.c +0
-0
drivers/net/virtio/virtio_pci.c legacy_write_dev_config(struct virtio_hw *hw, size_t offset, · line 80
Quoted 8 lines
drivers/net/virtio/virtio_pci.c +1
-1@@ -74,7 +74,7 @@ legacy_write_dev_config(struct virtio_hw *hw, size_t offset,static uint64_t legacy_get_features (struct virtio_hw *hw) { -uint64_t dst; +uint32_t dst;rte_eal_pci_ioport_read (&hw->io, &dst,4 ,VIRTIO_PCI_HOST_FEATURES );return dst;
Quoted 9 lines · Yuanhan Liu
Declare dst as type
uint32_tinstead ofuint64_t, otherwise, we will get a random upper 32 bit feature bits, as the following io port read reads lower 32 bit only. It could lead a feature bits that includeVIRTIO_F_VERSION_1(the 32th bit) for legacy virtio, which is obviously wrong.Fixes b8f04520ad71 ("virtio: use PCI ioport API")Cc David Marchand <[email protected]>Signed-off-by Yuanhan Liu <[email protected]>
Argh, good catch.
Relooked at my patch, this should be the only bug (of this kind ;-)).
Signature · 1 line
David Marchand
Quoted 7 lines · David Marchand
Quoted 5 lines · Yuanhan Liu
Declare dst as type
uint32_tinstead ofuint64_t, otherwise, we will get a random upper 32 bit feature bits, as the following io port read reads lower 32 bit only. It could lead a feature bits that includeVIRTIO_F_VERSION_1(the 32th bit) for legacy virtio, which is obviously wrong.
Quoted 7 lines
Quoted 4 lines
Fixes b8f04520ad71 ("virtio: use PCI ioport API")Cc David Marchand <[email protected]>Signed-off-by Yuanhan Liu <[email protected]>Argh, good catch.
Relooked at my patch, this should be the only bug (of this kind ;-)).
Yes, I also have a check while making this patch.
--yliu
Quoted 6 lines
Reviewed-by David Marchand <[email protected]>Signature · 1 line
David Marchand
Quoted 13 lines · Yuanhan Liu
Quoted 12 lines · David Marchand
Quoted 9 lines · Yuanhan Liu
Declare dst as type
uint32_tinstead ofuint64_t, otherwise, we will get a random upper 32 bit feature bits, as the following io port read reads lower 32 bit only. It could lead a feature bits that includeVIRTIO_F_VERSION_1(the 32th bit) for legacy virtio, which is obviously wrong.Fixes b8f04520ad71 ("virtio: use PCI ioport API")Cc David Marchand <[email protected]>Signed-off-by Yuanhan Liu <[email protected]>
Quoted 12 lines
Quoted 2 lines
Argh, good catch.
Relooked at my patch, this should be the only bug (of this kind ;-)).Yes, I also have a check while making this patch.
--yliuQuoted 6 lines
Reviewed-by David Marchand <[email protected]>Signature · 1 line
David Marchand
Hi,
this patch no longer applies to dpdk-next-net/rel_16_04 branch due to changes in legacy_get_features function. Is it still needed? If so, please do a V2.
Regards,
/Bruce
Quoted 24 lines · Bruce Richardson
Quoted 23 lines · Yuanhan Liu
Quoted 7 lines · David Marchand
Quoted 5 lines · Yuanhan Liu
Declare dst as type
uint32_tinstead ofuint64_t, otherwise, we will get a random upper 32 bit feature bits, as the following io port read reads lower 32 bit only. It could lead a feature bits that includeVIRTIO_F_VERSION_1(the 32th bit) for legacy virtio, which is obviously wrong.Quoted 7 lines
Quoted 4 lines
Fixes b8f04520ad71 ("virtio: use PCI ioport API")Cc David Marchand <[email protected]>Signed-off-by Yuanhan Liu <[email protected]>Argh, good catch.
Relooked at my patch, this should be the only bug (of this kind ;-)).Yes, I also have a check while making this patch.
--yliuQuoted 4 lines
Reviewed-by David Marchand <[email protected]>
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
Signature · 1 line
David MarchandHi,
this patch no longer applies to dpdk-next-net/rel_16_04 branch due to changes in
legacy_get_featuresfunction.
Hi Bruce,
It's a patch based on Thomas' tree. And this patch fixes an regression at there, too.
--yliu
Quoted 4 lines
Is it still needed? If so, please do a V2.
Regards,
/Bruce
Quoted 32 lines · Yuanhan Liu
Quoted 24 lines · Bruce Richardson
Quoted 23 lines · Yuanhan Liu
Quoted 7 lines · David Marchand
Quoted 5 lines · Yuanhan Liu
Declare dst as type
uint32_tinstead ofuint64_t, otherwise, we will get a random upper 32 bit feature bits, as the following io port read reads lower 32 bit only. It could lead a feature bits that includeVIRTIO_F_VERSION_1(the 32th bit) for legacy virtio, which is obviously wrong.Quoted 7 lines
Quoted 4 lines
Fixes b8f04520ad71 ("virtio: use PCI ioport API")Cc David Marchand <[email protected]>Signed-off-by Yuanhan Liu <[email protected]>Argh, good catch.
Relooked at my patch, this should be the only bug (of this kind ;-)).Yes, I also have a check while making this patch.
--yliuQuoted 4 lines
Reviewed-by David Marchand <[email protected]>Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
Signature · 1 line
David MarchandHi,
this patch no longer applies to dpdk-next-net/rel_16_04 branch due to changes in
legacy_get_featuresfunction.
Quoted 7 lines
Hi Bruce,
It's a patch based on Thomas' tree. And this patch fixes an regression at there, too.
--yliu
Ok, thanks for the info.
Thomas, I'm delegating this patch to you in patchwork to apply to your tree.
/Bruce
Thomas Monjalon
Applied2016-03-10 08:43, David Marchand:
Quoted 9 lines
Quoted 7 lines · Yuanhan Liu
Declare dst as type
uint32_tinstead ofuint64_t, otherwise, we will get a random upper 32 bit feature bits, as the following io port read reads lower 32 bit only. It could lead a feature bits that includeVIRTIO_F_VERSION_1(the 32th bit) for legacy virtio, which is obviously wrong.Fixes b8f04520ad71 ("virtio: use PCI ioport API")
Quoted 7 lines
Quoted 2 lines
Cc David Marchand <[email protected]>Signed-off-by Yuanhan Liu <[email protected]>Argh, good catch.
Relooked at my patch, this should be the only bug (of this kind ;-)).Reviewed-by David Marchand <[email protected]>
Applied, thanks