From nobody Fri Apr 26 02:32:51 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1637853910; cv=none; d=zohomail.com; s=zohoarc; b=ZSWqOs+IUa8Eh0XK6uzsTq2IZyiqVOTBny/Bts3czDNLiWERDNKJcCbw+Yz6fvhpf24/HWUS8S3WiK2K911pQqae/rliXZcHIJkZN3M+BRpAAT9Keky2H2mgDx3Eva1pTBQOe/ersV0MttBFePxA7OeqJ0QNre/e5gWbn+Hlpu8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637853910; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=XH1XP82oDSaespXBkBNpFTkJ9XfGyXiaUjtcYt5XPXA=; b=NcVZO+jP7xN16REfgn96JZ1BD1/jBNssCqumjWfrGxZlqQfUN2hgZK+RaxsHP2F9x01z6c3wjLagh+LBcHbsQVWzQbYMQ8HZpOwny5fPB6zkNJOycD1njDzHWblDgUgxJqDnvq/xnAtnuW4TKeEgiFbaFWzxdNeARcFBTgsq+Mo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1637853910935263.21271474442324; Thu, 25 Nov 2021 07:25:10 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-290-GXWViJCmO0Civ8prz2Mjmg-1; Thu, 25 Nov 2021 10:25:08 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 184D11006AA2; Thu, 25 Nov 2021 15:25:03 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AC09050D3F; Thu, 25 Nov 2021 15:25:02 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id AB2B44BB7C; Thu, 25 Nov 2021 15:24:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1APFOwqb011950 for ; Thu, 25 Nov 2021 10:24:58 -0500 Received: by smtp.corp.redhat.com (Postfix) id 60B2C60C05; Thu, 25 Nov 2021 15:24:58 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id B2F3A60BF4 for ; Thu, 25 Nov 2021 15:24:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637853910; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=XH1XP82oDSaespXBkBNpFTkJ9XfGyXiaUjtcYt5XPXA=; b=JNjWxhQe0iTlBkHVBiHEfwsjh9vXoAwAP5VWKNCDuu47/72HjlMKuNB1aEYlbgYmS5acGS iInKHi0jiiLusToGE1HPIfRaP9EwyKUTDEuTy2K9D2LI0uWdIbdqBChzhuGNl4v2voWr/G DEoDNKz7U8RsDJ4Ofe9qN271wbuJdvk= X-MC-Unique: GXWViJCmO0Civ8prz2Mjmg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH for 7.10] qemu: Fix validation of PCI option rom settings on hotplug Date: Thu, 25 Nov 2021 16:24:51 +0100 Message-Id: <1b2e30fb1bfce39a926b07ac19613e80747f511e.1637853866.git.pkrempa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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: 1637853912237100001 Content-Type: text/plain; charset="utf-8" Commit 24be92b8e moved the option rom settings validation code to the validation callbacks, but that doesn't work properly with device hotplug as we assign addresses only after parsing the whole XML. The check is too strict for that and caused failures when hotplugging devices such as: This patch relaxes the check in the validation callback to accept also _NONE and _UNASSIGNED address types and returns the check to 'qemuBuildRomProps' so that we preserve the full validation as we've used to. Fixes: 24be92b8e38762e9ba13e Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D2021437 Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 6 ++++++ src/qemu/qemu_validate.c | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 7a185061d8..c47998aabd 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1147,6 +1147,12 @@ qemuBuildRomProps(virJSONValue *props, !info->romfile) return 0; + if (info->type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("ROM tuning is only supported for PCI devices")); + return -1; + } + if (info->romenabled =3D=3D VIR_TRISTATE_BOOL_NO) { romfile =3D ""; } else { diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 397eea5ede..1de6e05101 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -1485,7 +1485,9 @@ qemuValidateDomainDeviceInfo(const virDomainDeviceDef= *dev, } if (info->romenabled || info->rombar || info->romfile) { - if (info->type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { + if (info->type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI && + info->type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && + info->type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_UNASSIGNED) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("ROM tuning is only supported for PCI devices= ")); return -1; --=20 2.31.1