]> xenbits.xensource.com Git - seabios.git/commitdiff
virtio: IOMMU support
authorJason Wang <jasowang@redhat.com>
Wed, 5 Jul 2017 07:49:51 +0000 (15:49 +0800)
committerKevin O'Connor <kevin@koconnor.net>
Fri, 7 Jul 2017 14:56:12 +0000 (10:56 -0400)
Since we don't enable IOMMU at all, we can then simply enable the
IOMMU support by claiming the support of VIRITO_F_IOMMU_PLATFORM. This
fixes booting failure when iommu_platform is set from qemu cli.

Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
src/hw/virtio-blk.c
src/hw/virtio-ring.h
src/hw/virtio-scsi.c

index dca78556f4092bfec495a561e5e15997a79019a9..901b8f502eff6ec1bd66e4240a5f710b69c47bcc 100644 (file)
@@ -118,13 +118,14 @@ init_virtio_blk(void *data)
         struct vp_device *vp = &vdrive->vp;
         u64 features = vp_get_features(vp);
         u64 version1 = 1ull << VIRTIO_F_VERSION_1;
+        u64 iommu_platform = 1ull << VIRTIO_F_IOMMU_PLATFORM;
         u64 blk_size = 1ull << VIRTIO_BLK_F_BLK_SIZE;
         if (!(features & version1)) {
             dprintf(1, "modern device without virtio_1 feature bit: %pP\n", pci);
             goto fail;
         }
 
-        features = features & (version1 | blk_size);
+        features = features & (version1 | iommu_platform | blk_size);
         vp_set_features(vp, features);
         status |= VIRTIO_CONFIG_S_FEATURES_OK;
         vp_set_status(vp, status);
index 7665fd54b4aee1451591c09c849d0d8d65804cf9..8604a01140d3285ad110ce8997c147182b855080 100644 (file)
@@ -18,6 +18,7 @@
 
 /* v1.0 compliant. */
 #define VIRTIO_F_VERSION_1              32
+#define VIRTIO_F_IOMMU_PLATFORM         33
 
 #define MAX_QUEUE_NUM      (128)
 
index 7490ec082995d25014a9a4224536008ec754cb3c..4eea5c3902b2f1a5d0cd635edf6ab423f92e25a4 100644 (file)
@@ -163,12 +163,13 @@ init_virtio_scsi(void *data)
     if (vp->use_modern) {
         u64 features = vp_get_features(vp);
         u64 version1 = 1ull << VIRTIO_F_VERSION_1;
+        u64 iommu_platform = 1ull << VIRTIO_F_IOMMU_PLATFORM;
         if (!(features & version1)) {
             dprintf(1, "modern device without virtio_1 feature bit: %pP\n", pci);
             goto fail;
         }
 
-        vp_set_features(vp, version1);
+        vp_set_features(vp, features & (version1 | iommu_platform));
         status |= VIRTIO_CONFIG_S_FEATURES_OK;
         vp_set_status(vp, status);
         if (!(vp_get_status(vp) & VIRTIO_CONFIG_S_FEATURES_OK)) {