From nobody Sun Feb 8 12:32:52 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1656932965; cv=none; d=zohomail.com; s=zohoarc; b=dIInFFtX421A3DcfAAtnvPHg7lKovkGoUo+OOnC9Dp5leDLaj20aoYIzQeSStVMf6ots+P6o8VyTP6AqwFGd/cHLVNlXnmaVGlbWOG60MgxyWRQfR+KggXnd5x5kxO/+PGVD8+OcOB3/vfU1ovBn3m1jw0D5XScXaw9qUgOJT4c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1656932965; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=iuOi8iJbqBzBzvSKNoWMosBG0Batta4odWAEDtzRFJU=; b=QQJT7UHU2NWqllgMWQer2ZYFMmI+l1RsijQ1zuS6twZp32zxme8ovxbhYcTdDMiXtZbM6SyCHlYqP0fl1DlNfwyDbfILwOFPo5C4yhfoHwU+YaE6NQ+BvY6dF9/SEq7awnbQWXmU5//4Mj9ooT9PoaIQBizB9HkOV6HGCZp/BAw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1656932965332778.5614196121327; Mon, 4 Jul 2022 04:09:25 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-663-JwU5a1DbNBaB5QAXcy0MNg-1; Mon, 04 Jul 2022 07:09:22 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 570A080C8D3; Mon, 4 Jul 2022 11:09:17 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 39C622166B2B; Mon, 4 Jul 2022 11:09:17 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id A7609194707A; Mon, 4 Jul 2022 11:09:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 5855519466DF for ; Mon, 4 Jul 2022 11:09:15 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 4CC812166B2A; Mon, 4 Jul 2022 11:09:15 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id EC76D2166B26 for ; Mon, 4 Jul 2022 11:09:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656932964; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=iuOi8iJbqBzBzvSKNoWMosBG0Batta4odWAEDtzRFJU=; b=ItKT2HxQwiI2hg7CRnB1IW0vsLqfKb3kk1n3O5Nan/xd55W5Igs/rLlUif2R5XU8kocJ7f 2VqvJ5f78ZyqbVVERSYNxeeAFOj0CPLUk5NAysPu/M4LbsM3v5XFUIqw6xNOF9tdwE0aph fnrkfhjJL91wnvPnyU8wWOFb9xDqQvM= X-MC-Unique: JwU5a1DbNBaB5QAXcy0MNg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 3/3] domain_validate: Disallow non-virtio IOMMU with an
Date: Mon, 4 Jul 2022 13:09:12 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1656932966200100003 Content-Type: text/plain; charset="utf-8"; x-default="true" Per v8.3.0-rc1~199 it's only a virtio IOMMU that can have
. The rest (Intel and SMMUv3) are system devices and thus have no address associated with them. However, this assumption is never checked for. Fixes: b0eb1e193f5db033d0fbbf91ff71a121066ad77c Signed-off-by: Michal Privoznik --- src/conf/domain_validate.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index c977c39144..d35451c26a 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -2582,6 +2582,27 @@ virDomainGraphicsDefValidate(const virDomainDef *def, return 0; } =20 +static int +virDomainIOMMUDefValidate(const virDomainIOMMUDef *iommu) +{ + switch (iommu->model) { + case VIR_DOMAIN_IOMMU_MODEL_INTEL: + case VIR_DOMAIN_IOMMU_MODEL_SMMUV3: + if (iommu->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { + virReportError(VIR_ERR_XML_ERROR, + _("iommu model '%s' can't have address"), + virDomainIOMMUModelTypeToString(iommu->model)); + return -1; + } + break; + + case VIR_DOMAIN_IOMMU_MODEL_VIRTIO: + case VIR_DOMAIN_IOMMU_MODEL_LAST: + } + + return 0; +} + static int virDomainDeviceInfoValidate(const virDomainDeviceDef *dev) { @@ -2683,6 +2704,9 @@ virDomainDeviceDefValidateInternal(const virDomainDev= iceDef *dev, case VIR_DOMAIN_DEVICE_GRAPHICS: return virDomainGraphicsDefValidate(def, dev->data.graphics); =20 + case VIR_DOMAIN_DEVICE_IOMMU: + return virDomainIOMMUDefValidate(dev->data.iommu); + case VIR_DOMAIN_DEVICE_LEASE: case VIR_DOMAIN_DEVICE_WATCHDOG: case VIR_DOMAIN_DEVICE_HUB: @@ -2690,7 +2714,6 @@ virDomainDeviceDefValidateInternal(const virDomainDev= iceDef *dev, case VIR_DOMAIN_DEVICE_NVRAM: case VIR_DOMAIN_DEVICE_TPM: case VIR_DOMAIN_DEVICE_PANIC: - case VIR_DOMAIN_DEVICE_IOMMU: case VIR_DOMAIN_DEVICE_NONE: case VIR_DOMAIN_DEVICE_LAST: break; --=20 2.35.1