[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 11/33] vhost: 64 bit features
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 11/33] vhost: 64 bit features |
Date: |
Thu, 4 Jun 2015 12:34:20 +0200 |
From: Cornelia Huck <address@hidden>
Make sure that all vhost interfaces use 64 bit features, as the virtio
core does, and make sure to use ULL everywhere possible to be on the
safe side.
Signed-off-by: Cornelia Huck <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
hw/net/vhost_net.c | 12 ++++++------
hw/virtio/vhost.c | 14 +++++++-------
include/hw/virtio/vhost.h | 6 +++---
include/net/vhost_net.h | 4 ++--
4 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index dc48ece..1c55517 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -109,13 +109,13 @@ static const int *vhost_net_get_feature_bits(struct
vhost_net *net)
return feature_bits;
}
-unsigned vhost_net_get_features(struct vhost_net *net, unsigned features)
+uint64_t vhost_net_get_features(struct vhost_net *net, uint64_t features)
{
return vhost_get_features(&net->dev, vhost_net_get_feature_bits(net),
features);
}
-void vhost_net_ack_features(struct vhost_net *net, unsigned features)
+void vhost_net_ack_features(struct vhost_net *net, uint64_t features)
{
net->dev.acked_features = net->dev.backend_features;
vhost_ack_features(&net->dev, vhost_net_get_feature_bits(net), features);
@@ -149,7 +149,7 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options)
goto fail;
}
net->dev.backend_features = qemu_has_vnet_hdr(options->net_backend)
- ? 0 : (1 << VHOST_NET_F_VIRTIO_NET_HDR);
+ ? 0 : (1ULL << VHOST_NET_F_VIRTIO_NET_HDR);
net->backend = r;
} else {
net->dev.backend_features = 0;
@@ -169,7 +169,7 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options)
if (backend_kernel) {
if (!qemu_has_vnet_hdr_len(options->net_backend,
sizeof(struct virtio_net_hdr_mrg_rxbuf))) {
- net->dev.features &= ~(1 << VIRTIO_NET_F_MRG_RXBUF);
+ net->dev.features &= ~(1ULL << VIRTIO_NET_F_MRG_RXBUF);
}
if (~net->dev.features & net->dev.backend_features) {
fprintf(stderr, "vhost lacks feature mask %" PRIu64
@@ -433,11 +433,11 @@ void vhost_net_cleanup(struct vhost_net *net)
{
}
-unsigned vhost_net_get_features(struct vhost_net *net, unsigned features)
+uint64_t vhost_net_get_features(struct vhost_net *net, uint64_t features)
{
return features;
}
-void vhost_net_ack_features(struct vhost_net *net, unsigned features)
+void vhost_net_ack_features(struct vhost_net *net, uint64_t features)
{
}
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 54851b7..def440f 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -551,7 +551,7 @@ static int vhost_dev_set_features(struct vhost_dev *dev,
bool enable_log)
uint64_t features = dev->acked_features;
int r;
if (enable_log) {
- features |= 0x1 << VHOST_F_LOG_ALL;
+ features |= 0x1ULL << VHOST_F_LOG_ALL;
}
r = dev->vhost_ops->vhost_call(dev, VHOST_SET_FEATURES, &features);
return r < 0 ? -errno : 0;
@@ -860,7 +860,7 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
.priority = 10
};
hdev->migration_blocker = NULL;
- if (!(hdev->features & (0x1 << VHOST_F_LOG_ALL))) {
+ if (!(hdev->features & (0x1ULL << VHOST_F_LOG_ALL))) {
error_setg(&hdev->migration_blocker,
"Migration disabled: vhost lacks VHOST_F_LOG_ALL feature.");
migrate_add_blocker(hdev->migration_blocker);
@@ -1003,12 +1003,12 @@ void vhost_virtqueue_mask(struct vhost_dev *hdev,
VirtIODevice *vdev, int n,
assert(r >= 0);
}
-unsigned vhost_get_features(struct vhost_dev *hdev, const int *feature_bits,
- unsigned features)
+uint64_t vhost_get_features(struct vhost_dev *hdev, const int *feature_bits,
+ uint64_t features)
{
const int *bit = feature_bits;
while (*bit != VHOST_INVALID_FEATURE_BIT) {
- unsigned bit_mask = (1 << *bit);
+ uint64_t bit_mask = (1ULL << *bit);
if (!(hdev->features & bit_mask)) {
features &= ~bit_mask;
}
@@ -1018,11 +1018,11 @@ unsigned vhost_get_features(struct vhost_dev *hdev,
const int *feature_bits,
}
void vhost_ack_features(struct vhost_dev *hdev, const int *feature_bits,
- unsigned features)
+ uint64_t features)
{
const int *bit = feature_bits;
while (*bit != VHOST_INVALID_FEATURE_BIT) {
- unsigned bit_mask = (1 << *bit);
+ uint64_t bit_mask = (1ULL << *bit);
if (features & bit_mask) {
hdev->acked_features |= bit_mask;
}
diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h
index 8f04888..88e1e56 100644
--- a/include/hw/virtio/vhost.h
+++ b/include/hw/virtio/vhost.h
@@ -72,8 +72,8 @@ bool vhost_virtqueue_pending(struct vhost_dev *hdev, int n);
*/
void vhost_virtqueue_mask(struct vhost_dev *hdev, VirtIODevice *vdev, int n,
bool mask);
-unsigned vhost_get_features(struct vhost_dev *hdev, const int *feature_bits,
- unsigned features);
+uint64_t vhost_get_features(struct vhost_dev *hdev, const int *feature_bits,
+ uint64_t features);
void vhost_ack_features(struct vhost_dev *hdev, const int *feature_bits,
- unsigned features);
+ uint64_t features);
#endif
diff --git a/include/net/vhost_net.h b/include/net/vhost_net.h
index b1c18a3..9eb493e 100644
--- a/include/net/vhost_net.h
+++ b/include/net/vhost_net.h
@@ -22,8 +22,8 @@ void vhost_net_stop(VirtIODevice *dev, NetClientState *ncs,
int total_queues);
void vhost_net_cleanup(VHostNetState *net);
-unsigned vhost_net_get_features(VHostNetState *net, unsigned features);
-void vhost_net_ack_features(VHostNetState *net, unsigned features);
+uint64_t vhost_net_get_features(VHostNetState *net, uint64_t features);
+void vhost_net_ack_features(VHostNetState *net, uint64_t features);
bool vhost_net_virtqueue_pending(VHostNetState *net, int n);
void vhost_net_virtqueue_mask(VHostNetState *net, VirtIODevice *dev,
--
1.8.3.1
- [Qemu-devel] [PATCH 10/33] vhost_net: add version_1 feature, (continued)
- [Qemu-devel] [PATCH 10/33] vhost_net: add version_1 feature, Gerd Hoffmann, 2015/06/04
- [Qemu-devel] [PATCH 03/33] virtio: allow virtio-1 queue layout, Gerd Hoffmann, 2015/06/04
- [Qemu-devel] [PATCH 02/33] virtio: endianness checks for virtio 1.0 devices, Gerd Hoffmann, 2015/06/04
- [Qemu-devel] [PATCH 17/33] virtio-pci: add flags to enable/disable legacy/modern, Gerd Hoffmann, 2015/06/04
- [Qemu-devel] [PATCH 08/33] virtio-net: support longer header, Gerd Hoffmann, 2015/06/04
- [Qemu-devel] [PATCH 15/33] virtio: add modern config accessors, Gerd Hoffmann, 2015/06/04
- [Qemu-devel] [PATCH 14/33] virtio: generation counter support, Gerd Hoffmann, 2015/06/04
- [Qemu-devel] [PATCH 21/33] virtio-pci: correctly set host notifiers for modern bar, Gerd Hoffmann, 2015/06/04
- [Qemu-devel] [PATCH 16/33] virtio-pci: switch to modern accessors for 1.0, Gerd Hoffmann, 2015/06/04
- [Qemu-devel] [PATCH 11/33] vhost: 64 bit features,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 22/33] virtio_balloon: header update, Gerd Hoffmann, 2015/06/04
- [Qemu-devel] [PATCH 19/33] virtio-pci: change & document virtio pci bar layout., Gerd Hoffmann, 2015/06/04
- [Qemu-devel] [PATCH 29/33] virtio-pci: drop identical virtio_pci_cap, Gerd Hoffmann, 2015/06/04
- [Qemu-devel] [PATCH 26/33] virtio-pci: add virtio_pci_modern_region_map(), Gerd Hoffmann, 2015/06/04
- [Qemu-devel] [PATCH 06/33] virtio: allow to fail setting status, Gerd Hoffmann, 2015/06/04
- [Qemu-devel] [PATCH 23/33] virtio-balloon: switch to virtio_add_feature, Gerd Hoffmann, 2015/06/04
- [Qemu-devel] [PATCH 20/33] virtio-pci: make modern bar 64bit + prefetchable, Gerd Hoffmann, 2015/06/04
- [Qemu-devel] [PATCH 27/33] virtio-pci: move virtio_pci_add_mem_cap call to virtio_pci_modern_region_map, Gerd Hoffmann, 2015/06/04
- [Qemu-devel] [PATCH 12/33] linux-headers: add virtio_pci, Gerd Hoffmann, 2015/06/04
- [Qemu-devel] [PATCH 13/33] virtio-pci: initial virtio 1.0 support, Gerd Hoffmann, 2015/06/04