From nobody Sat Apr 27 11:40:59 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) client-ip=80.81.252.135; envelope-from=seabios-bounces@seabios.org; helo=mail.coreboot.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org Return-Path: Received: from mail.coreboot.org (mail.coreboot.org [80.81.252.135]) by mx.zohomail.com with SMTPS id 1499265772938868.723698416216; Wed, 5 Jul 2017 07:42:52 -0700 (PDT) Received: from [127.0.0.1] (helo=ra.coresystems.de) by mail.coreboot.org with esmtp (Exim 4.86_2) (envelope-from ) id 1dSlUD-0007It-9q; Wed, 05 Jul 2017 16:41:01 +0200 Received: from mx1.redhat.com ([209.132.183.28]) by mail.coreboot.org with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_2) (envelope-from ) id 1dSf30-0002DJ-4S for seabios@seabios.org; Wed, 05 Jul 2017 09:48:41 +0200 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B9B1361D07 for ; Wed, 5 Jul 2017 07:49:58 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (ovpn-12-111.pek2.redhat.com [10.72.12.111]) by smtp.corp.redhat.com (Postfix) with ESMTP id C59555DC1B; Wed, 5 Jul 2017 07:49:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B9B1361D07 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jasowang@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com B9B1361D07 From: Jason Wang To: seabios@seabios.org Date: Wed, 5 Jul 2017 15:49:51 +0800 Message-Id: <1499240991-5013-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 05 Jul 2017 07:49:58 +0000 (UTC) X-Spam-Score: -6.5 (------) X-Mailman-Approved-At: Wed, 05 Jul 2017 16:40:59 +0200 Subject: [SeaBIOS] [PATCH] virtio: IOMMU support X-BeenThere: seabios@seabios.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SeaBIOS mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, Jason Wang , mst@redhat.com MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: seabios-bounces@seabios.org Sender: "SeaBIOS" X-Duff: Orig. Duff, Duff Lite, Duff Dry, Duff Dark, Raspberry Duff, Lady Duff, Red Duff, Tartar Control Duff X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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. Signed-off-by: Jason Wang Acked-by: Michael S. Tsirkin --- src/hw/virtio-blk.c | 3 ++- src/hw/virtio-ring.h | 1 + src/hw/virtio-scsi.c | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) 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 =3D &vdrive->vp; u64 features =3D vp_get_features(vp); u64 version1 =3D 1ull << VIRTIO_F_VERSION_1; + u64 iommu_platform =3D 1ull << VIRTIO_F_IOMMU_PLATFORM; u64 blk_size =3D 1ull << VIRTIO_BLK_F_BLK_SIZE; if (!(features & version1)) { dprintf(1, "modern device without virtio_1 feature bit: %pP\n"= , pci); goto fail; } =20 - features =3D features & (version1 | blk_size); + features =3D features & (version1 | iommu_platform | blk_size); vp_set_features(vp, features); status |=3D 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 @@ =20 /* v1.0 compliant. */ #define VIRTIO_F_VERSION_1 32 +#define VIRTIO_F_IOMMU_PLATFORM 33 =20 #define MAX_QUEUE_NUM (128) =20 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 =3D vp_get_features(vp); u64 version1 =3D 1ull << VIRTIO_F_VERSION_1; + u64 iommu_platform =3D 1ull << VIRTIO_F_IOMMU_PLATFORM; if (!(features & version1)) { dprintf(1, "modern device without virtio_1 feature bit: %pP\n"= , pci); goto fail; } =20 - vp_set_features(vp, version1); + vp_set_features(vp, features & (version1 | iommu_platform)); status |=3D VIRTIO_CONFIG_S_FEATURES_OK; vp_set_status(vp, status); if (!(vp_get_status(vp) & VIRTIO_CONFIG_S_FEATURES_OK)) { --=20 2.7.4 _______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios