From: Jason Wang Date: Wed, 5 Jul 2017 07:49:51 +0000 (+0800) Subject: virtio: IOMMU support X-Git-Tag: rel-1.11.0~24 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=dd9bba5b9c1d5175a2757f3fdc9d554b4c8eea3a;p=seabios.git virtio: IOMMU support 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 Signed-off-by: Jason Wang --- diff --git a/src/hw/virtio-blk.c b/src/hw/virtio-blk.c index dca7855..901b8f5 100644 --- a/src/hw/virtio-blk.c +++ b/src/hw/virtio-blk.c @@ -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); diff --git a/src/hw/virtio-ring.h b/src/hw/virtio-ring.h index 7665fd5..8604a01 100644 --- a/src/hw/virtio-ring.h +++ b/src/hw/virtio-ring.h @@ -18,6 +18,7 @@ /* v1.0 compliant. */ #define VIRTIO_F_VERSION_1 32 +#define VIRTIO_F_IOMMU_PLATFORM 33 #define MAX_QUEUE_NUM (128) diff --git a/src/hw/virtio-scsi.c b/src/hw/virtio-scsi.c index 7490ec0..4eea5c3 100644 --- a/src/hw/virtio-scsi.c +++ b/src/hw/virtio-scsi.c @@ -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)) {