Skip to contentSkip to conversation

kvm tools: Ninja out support for VIRTIO_F_FEATURES_HIGH

PATCH Applied Sasha Levin 3 participants 4 messages Dec 6, 2011 – Dec 7, 2011 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kvm tools: Ninja out support for VIRTIO_F_FEATURES_HIGH

Rusty has just removed it out of the spec. Since we probably the only ones who implemented support for it, we should remove it out of our code as well.

There is no issue with breaking anything since nothing else worked with it, so it's fully backwards compatible.

---
 tools/kvm/include/kvm/virtio.h |    3 +--
 tools/kvm/virtio/core.c        |    9 +--------
 tools/kvm/virtio/pci.c         |    4 ++--
 3 files changed, 4 insertions(+), 12 deletions(-)
tools/kvm/include/kvm/virtio.h +1 -2
index a7aa020..610f4d0 100644
@@ -14,7 +14,6 @@
 
 #define VIRTIO_PCI_O_CONFIG	0
 #define VIRTIO_PCI_O_MSIX	1
-#define VIRTIO_PCI_O_FEATURES	2
 
 struct virt_queue {
 	struct vring	vring;
@@ -63,6 +62,6 @@ u16 virt_queue__get_head_iov(struct virt_queue *vq, struct iovec iov[], u16 *out
 u16 virt_queue__get_inout_iov(struct kvm *kvm, struct virt_queue *queue,
 			      struct iovec in_iov[], struct iovec out_iov[],
 			      u16 *in, u16 *out);
-int virtio__get_dev_specific_field(int offset, bool msix, bool features_hi, u32 *config_off);
+int virtio__get_dev_specific_field(int offset, bool msix, u32 *config_off);
 
 #endif /* KVM__VIRTIO_H */
tools/kvm/virtio/core.c +1 -8
index fe9d588..5dc767a 100644
@@ -128,7 +128,7 @@ u16 virt_queue__get_inout_iov(struct kvm *kvm, struct virt_queue *queue,
 	return head;
 }
 
-int virtio__get_dev_specific_field(int offset, bool msix, bool features_hi, u32 *config_off)
+int virtio__get_dev_specific_field(int offset, bool msix, u32 *config_off)
 {
 	if (msix) {
 		if (offset < 4)
@@ -137,13 +137,6 @@ int virtio__get_dev_specific_field(int offset, bool msix, bool features_hi, u32
 			offset -= 4;
 	}
 
-	if (features_hi) {
-		if (offset < 4)
-			return VIRTIO_PCI_O_FEATURES;
-		else
-			offset -= 4;
-	}
-
 	*config_off = offset;
 
 	return VIRTIO_PCI_O_CONFIG;
tools/kvm/virtio/pci.c +2 -2
index 0737ae7..3d9a7f8 100644
@@ -69,7 +69,7 @@ static bool virtio_pci__specific_io_in(struct kvm *kvm, struct virtio_trans *vtr
 	struct virtio_pci *vpci = vtrans->virtio;
 	int type = virtio__get_dev_specific_field(offset - 20,
 							virtio_pci__msix_enabled(vpci),
-							0, &config_offset);
+							&config_offset);
 	if (type == VIRTIO_PCI_O_MSIX) {
 		switch (offset) {
 		case VIRTIO_MSI_CONFIG_VECTOR:
@@ -140,7 +140,7 @@ static bool virtio_pci__specific_io_out(struct kvm *kvm, struct virtio_trans *vt
 	struct virtio_pci *vpci = vtrans->virtio;
 	u32 config_offset, gsi, vec;
 	int type = virtio__get_dev_specific_field(offset - 20, virtio_pci__msix_enabled(vpci),
-							0, &config_offset);
+							&config_offset);
 	if (type == VIRTIO_PCI_O_MSIX) {
 		switch (offset) {
 		case VIRTIO_MSI_CONFIG_VECTOR:
Signature · 1 line
1.7.8
Applied
#1 lore raw
Quoted 8 lines · Sasha Levin

Rusty has just removed it out of the spec. Since we probably the only ones who implemented support for it, we should remove it out of our code as well.

There is no issue with breaking anything since nothing else worked with it, so it's fully backwards compatible.

Applied, thanks!

How is this going to work going forward? Should I ask Rusty for an ACK before merging code that implements some (new) part of the virtio spec? I like the fact that we're bleeding edge but it's pointless for everyone involved if we implement something that's known to be half-baked in the spec.

Pekka

#2 lore raw
Quoted 10 lines · Pekka Enberg
Quoted 8 lines · Sasha Levin

Rusty has just removed it out of the spec. Since we probably the only ones who implemented support for it, we should remove it out of our code as well.

There is no issue with breaking anything since nothing else worked with it, so it's fully backwards compatible.

Quoted 7 lines

Applied, thanks!

How is this going to work going forward? Should I ask Rusty for an ACK before merging code that implements some (new) part of the virtio spec? I like the fact that we're bleeding edge but it's pointless for everyone involved if we implement something that's known to be half-baked in the spec.

There was a little cheating involved here since the spec basically broke backwards compatibility by removing 64 bit features, so it's a special case and probably won't happen (too many times) again.

Half baked features usually don't go into the spec as well, Rusty usually insists on having a working code besides just spec updates, so again - this was one of those rare special cases.

If Rusty or Michael could ACK our virtio patches it would be awesome.

Signature · 1 line
Sasha.
Acked-by
#3 lore raw
Quoted 23 lines · Sasha Levin
Quoted 10 lines · Pekka Enberg
Quoted 8 lines · Sasha Levin

Rusty has just removed it out of the spec. Since we probably the only ones who implemented support for it, we should remove it out of our code as well.

There is no issue with breaking anything since nothing else worked with it, so it's fully backwards compatible.

Quoted 7 lines

Applied, thanks!

How is this going to work going forward? Should I ask Rusty for an ACK before merging code that implements some (new) part of the virtio spec? I like the fact that we're bleeding edge but it's pointless for everyone involved if we implement something that's known to be half-baked in the spec.

There was a little cheating involved here since the spec basically broke backwards compatibility by removing 64 bit features, so it's a special case and probably won't happen (too many times) again.

Quoted 5 lines

Half baked features usually don't go into the spec as well, Rusty usually insists on having a working code besides just spec updates, so again - this was one of those rare special cases.

If Rusty or Michael could ACK our virtio patches it would be awesome.

TLDR version: I shouldn't have put it in the spec until we needed it. The spec revert broke no guests, because no guest ever implemented high feature bits (both because it wasn't in the draft spec long, and no device defined > 32 features yet, so no guest needed to).

It also broke no hosts, since it was up to the host to offer the high feature bits. No host did, since no device needed those high bits. kvmtool guys are just enthusiasts, so they put in the infrastructure, but didn't use it.

If I'm wrong, then when we use bit 31 for something else, a new guest may break. It may happen, but we're going to 64 bits in a different manner, so we can avoid using bit 31 for a long time.

It's very unusual for me to un-spec things, but in this very limited case it fairly safe.

Cheers,
Rusty.