Thread (122 messages) 122 messages, 8 authors, 2016-02-03

Re: [PATCH v4 7/8] virtio: add 1.0 support

From: Xie, Huawei <hidden>
Date: 2016-01-18 16:50:20

On 1/15/2016 12:34 PM, Yuanhan Liu wrote:
quoted hunk ↗ jump to hunk
-static void
+static int
 virtio_negotiate_features(struct virtio_hw *hw)
 {
 	uint64_t host_features;
@@ -949,6 +949,22 @@ virtio_negotiate_features(struct virtio_hw *hw)
 	hw->guest_features = vtpci_negotiate_features(hw, host_features);
Here if we are not modern device, we should remove VIRTIO_F_VERSION_1 in
guest features.
 	PMD_INIT_LOG(DEBUG, "features after negotiate = %"PRIx64,
 		hw->guest_features);
+
+	if (hw->modern) {
+		if (!vtpci_with_feature(hw, VIRTIO_F_VERSION_1)) {
+			PMD_INIT_LOG(ERR,
+				"VIRTIO_F_VERSION_1 features is not enabled.");
+			return -1;
+		}
+		vtpci_set_status(hw, VIRTIO_CONFIG_STATUS_FEATURES_OK);
+		if (!(vtpci_get_status(hw) & VIRTIO_CONFIG_STATUS_FEATURES_OK)) {
+			PMD_INIT_LOG(ERR,
+				"failed to set FEATURES_OK status!");
+			return -1;
+		}
+	}
+
+	return 0;
 }
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help