hw/virtio: Have virtio_bus_get_vdev_bad_features() return 64-bit value
PATCH 1/1 hw/virtio: Have virtio_bus_get_vdev_bad_features() return 64-bit value
In commit 019a3edbb25 ("virtio: make features 64bit wide") we increased the 'features' field to 64-bit, but forgot to update the virtio_bus_get_vdev_bad_features() helper. The 'bad features' are truncated to 32-bit. The virtio_net_bad_features() handler from the virtio-net devices is potentially affected.
Have the virtio_bus_get_vdev_bad_features() helper return the full 64-bit value.
--- include/hw/virtio/virtio-bus.h | 2 +- hw/virtio/virtio-bus.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
include/hw/virtio/virtio-bus.h +1 -1
@@ -122,7 +122,7 @@ uint16_t virtio_bus_get_vdev_id(VirtioBusState *bus);/* Get the config_len field of the plugged device. */ size_t virtio_bus_get_vdev_config_len (VirtioBusState *bus);/* Get bad features of the plugged device. */ -uint32_t virtio_bus_get_vdev_bad_features (VirtioBusState *bus); +uint64_t virtio_bus_get_vdev_bad_features (VirtioBusState *bus);/* Get config of the plugged device. */ void virtio_bus_get_vdev_config (VirtioBusState *bus,uint8_t *config);/* Set config of the plugged device. */
hw/virtio/virtio-bus.c +1 -1
@@ -134,7 +134,7 @@ size_t virtio_bus_get_vdev_config_len(VirtioBusState *bus) }/* Get bad features of the plugged device. */ -uint32_t virtio_bus_get_vdev_bad_features (VirtioBusState *bus) +uint64_t virtio_bus_get_vdev_bad_features (VirtioBusState *bus) {VirtIODevice *vdev =virtio_bus_get_device (bus);VirtioDeviceClass *k;
Signature · 1 line
2.26.3
Quoted 9 lines · On Thu, 20 May 2021 12:28:22 +0200 Philippe Mathieu-Daudé <[email protected]>…
In commit
019a3edbb25("virtio: make features 64bit wide") we increased the 'features' field to 64-bit, but forgot to update thevirtio_bus_get_vdev_bad_features()helper. The 'bad features' are truncated to 32-bit. Thevirtio_net_bad_features()handler from the virtio-net devices is potentially affected.Have the
virtio_bus_get_vdev_bad_features()helper return the full 64-bit value.
Quoted 7 lines
Fixes 019a3edbb25 ("virtio: make features 64bit wide")Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/hw/virtio/virtio-bus.h | 2 +- hw/virtio/virtio-bus.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Quoted 5 lines · Philippe Mathieu-Daudé
In commit
019a3edbb25("virtio: make features 64bit wide") we increased the 'features' field to 64-bit, but forgot to update thevirtio_bus_get_vdev_bad_features()helper. The 'bad features' are truncated to 32-bit. Thevirtio_net_bad_features()handler from the virtio-net devices is potentially affected.
I'm fine with increasing it for consistency, but bad features are all legacy things aren't they? So there isn't a functional issue ... or did I miss anything?
Quoted 40 lines
Have the
virtio_bus_get_vdev_bad_features()helper return the full 64-bit value.Fixes 019a3edbb25 ("virtio: make features 64bit wide")Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/hw/virtio/virtio-bus.h | 2 +- hw/virtio/virtio-bus.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)include/hw/virtio/virtio-bus.h +1
-1@@ -122,7 +122,7 @@ uint16_t virtio_bus_get_vdev_id(VirtioBusState *bus);/* Get the config_len field of the plugged device. */ size_t virtio_bus_get_vdev_config_len (VirtioBusState *bus);/* Get bad features of the plugged device. */ -uint32_t virtio_bus_get_vdev_bad_features (VirtioBusState *bus); +uint64_t virtio_bus_get_vdev_bad_features (VirtioBusState *bus);/* Get config of the plugged device. */ void virtio_bus_get_vdev_config (VirtioBusState *bus,uint8_t *config);/* Set config of the plugged device. */ hw/virtio/virtio-bus.c +1
-1@@ -134,7 +134,7 @@ size_t virtio_bus_get_vdev_config_len(VirtioBusState *bus) }/* Get bad features of the plugged device. */ -uint32_t virtio_bus_get_vdev_bad_features (VirtioBusState *bus) +uint64_t virtio_bus_get_vdev_bad_features (VirtioBusState *bus) {VirtIODevice *vdev =virtio_bus_get_device (bus);VirtioDeviceClass *k;Signature · 1 line
2.26.3
Quoted 10 lines · Michael S. Tsirkin
Quoted 5 lines · Philippe Mathieu-Daudé
In commit
019a3edbb25("virtio: make features 64bit wide") we increased the 'features' field to 64-bit, but forgot to update thevirtio_bus_get_vdev_bad_features()helper. The 'bad features' are truncated to 32-bit. Thevirtio_net_bad_features()handler from the virtio-net devices is potentially affected.I'm fine with increasing it for consistency, but bad features are all legacy things aren't they? So there isn't a functional issue ... or did I miss anything?
Are you saying all bad legacy features are < 32-bit and there is no potential problem?
Quoted 42 lines
Quoted 41 lines
Have the
virtio_bus_get_vdev_bad_features()helper return the full 64-bit value.Fixes 019a3edbb25 ("virtio: make features 64bit wide")Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/hw/virtio/virtio-bus.h | 2 +- hw/virtio/virtio-bus.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)include/hw/virtio/virtio-bus.h +1
-1@@ -122,7 +122,7 @@ uint16_t virtio_bus_get_vdev_id(VirtioBusState *bus);/* Get the config_len field of the plugged device. */ size_t virtio_bus_get_vdev_config_len (VirtioBusState *bus);/* Get bad features of the plugged device. */ -uint32_t virtio_bus_get_vdev_bad_features (VirtioBusState *bus); +uint64_t virtio_bus_get_vdev_bad_features (VirtioBusState *bus);/* Get config of the plugged device. */ void virtio_bus_get_vdev_config (VirtioBusState *bus,uint8_t *config);/* Set config of the plugged device. */ hw/virtio/virtio-bus.c +1
-1@@ -134,7 +134,7 @@ size_t virtio_bus_get_vdev_config_len(VirtioBusState *bus) }/* Get bad features of the plugged device. */ -uint32_t virtio_bus_get_vdev_bad_features (VirtioBusState *bus) +uint64_t virtio_bus_get_vdev_bad_features (VirtioBusState *bus) {VirtIODevice *vdev =virtio_bus_get_device (bus);VirtioDeviceClass *k;Signature · 1 line
2.26.3
Quoted 8 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Michael S. Tsirkin
Quoted 5 lines · Philippe Mathieu-Daudé
In commit
019a3edbb25("virtio: make features 64bit wide") we increased the 'features' field to 64-bit, but forgot to update thevirtio_bus_get_vdev_bad_features()helper. The 'bad features' are truncated to 32-bit. Thevirtio_net_bad_features()handler from the virtio-net devices is potentially affected.
Quoted 6 lines
Quoted 3 lines
I'm fine with increasing it for consistency, but bad features are all legacy things aren't they? So there isn't a functional issue ... or did I miss anything?
Are you saying all bad legacy features are < 32-bit and there is no potential problem?
I think so yes. I agree with the change, I jus think it's cosmetic and the commit log should say so.
Quoted 42 lines
Quoted 42 lines
Quoted 41 lines
Have the
virtio_bus_get_vdev_bad_features()helper return the full 64-bit value.Fixes 019a3edbb25 ("virtio: make features 64bit wide")Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/hw/virtio/virtio-bus.h | 2 +- hw/virtio/virtio-bus.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)include/hw/virtio/virtio-bus.h +1
-1@@ -122,7 +122,7 @@ uint16_t virtio_bus_get_vdev_id(VirtioBusState *bus);/* Get the config_len field of the plugged device. */ size_t virtio_bus_get_vdev_config_len (VirtioBusState *bus);/* Get bad features of the plugged device. */ -uint32_t virtio_bus_get_vdev_bad_features (VirtioBusState *bus); +uint64_t virtio_bus_get_vdev_bad_features (VirtioBusState *bus);/* Get config of the plugged device. */ void virtio_bus_get_vdev_config (VirtioBusState *bus,uint8_t *config);/* Set config of the plugged device. */ hw/virtio/virtio-bus.c +1
-1@@ -134,7 +134,7 @@ size_t virtio_bus_get_vdev_config_len(VirtioBusState *bus) }/* Get bad features of the plugged device. */ -uint32_t virtio_bus_get_vdev_bad_features (VirtioBusState *bus) +uint64_t virtio_bus_get_vdev_bad_features (VirtioBusState *bus) {VirtIODevice *vdev =virtio_bus_get_device (bus);VirtioDeviceClass *k;Signature · 1 line
2.26.3