From nobody Mon Feb 9 21:21:38 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=1676457785; cv=none; d=zohomail.com; s=zohoarc; b=Qy/13eJkRSoDU3Tk1x/po+sr4hh8kSMRH6p7cSw7/cFS4k1Ckkft9EHAUpTpI0FqDc4fQG1+zjOrUDrHsWS5htHuM7LnZFmTgXXBbQ/8djpZy36UVgf/xPxY1teG9Wxyo3GivnIuKb4sDvhYqFCF69c6/ywQbkf9jyfuZt4tdGY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676457785; 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=FAD0WidyLbBZCBSP8utagT1VsE2HKvwnP7pVg0W8O3M=; b=AjcmHh1OmKiRPeUiVEbZjyRUXiRtC7L7Z3c2QaEGA3KAq0bAL5x4xGXVhnkhIv/kweYvULKFzJvIpV4o5Wgg3clHsgRtmR5Md/7289FIf7RvbgtShh+VwBAkBz78KVSxxy+Vc2CWr5ddfpue241lXHGgfYNz4zaj/MpCENgyzhA= 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 1676457785831858.6477792110646; Wed, 15 Feb 2023 02:43:05 -0800 (PST) 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-281-DUqZfrjoOBqX8ZmbKRyl2g-1; Wed, 15 Feb 2023 05:43:01 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 842BD88B7AD; Wed, 15 Feb 2023 10:42:57 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6B4CC492B16; Wed, 15 Feb 2023 10:42:57 +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 3BCE9194658C; Wed, 15 Feb 2023 10:42:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 6EB4119465B5 for ; Wed, 15 Feb 2023 10:42:46 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 6334F1415108; Wed, 15 Feb 2023 10:42:46 +0000 (UTC) Received: from harajuku.usersys.redhat.com (ovpn-194-29.brq.redhat.com [10.40.194.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E6DA9140EBF4 for ; Wed, 15 Feb 2023 10:42:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676457784; 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=FAD0WidyLbBZCBSP8utagT1VsE2HKvwnP7pVg0W8O3M=; b=FhLtLJ/HzhdVW/61rK8Fzycvp5DhIKp1MC3j+juQKAnBuLQFj5LlmtEkMUhuMzNT5Hlg0s XeuDTPkrx4wx8x65FPKd8gV5N6dnCICK5AYV52apv4gTthqMofO+It7hgOp9n+QdgIO/3P +szfpS24pCHNFH4r+cGlbsufUp3pbNs= X-MC-Unique: DUqZfrjoOBqX8ZmbKRyl2g-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH 17/33] qemu: Don't pick firmware with unsupported format Date: Wed, 15 Feb 2023 11:42:14 +0100 Message-Id: <20230215104230.980815-18-abologna@redhat.com> In-Reply-To: <20230215104230.980815-1-abologna@redhat.com> References: <20230215104230.980815-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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 3.1 on 10.11.54.10 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: 1676457787827100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Right now, if the descriptor with the highest priority happens to describe a firmware in a format other than raw, no domain that uses autoselection will be able to start. A better approach is to filter out descriptors that advertise unsupported formats during autoselection. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_firmware.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c index c24bca6183..72036bd82b 100644 --- a/src/qemu/qemu_firmware.c +++ b/src/qemu/qemu_firmware.c @@ -1130,6 +1130,19 @@ qemuFirmwareMatchDomain(const virDomainDef *def, return false; } } + + if (STRNEQ(flash->executable.format, "raw")) { + VIR_DEBUG("Discarding loader with unsupported flash format '%s= '", + flash->executable.format); + return false; + } + if (flash->mode =3D=3D QEMU_FIRMWARE_FLASH_MODE_SPLIT) { + if (STRNEQ(flash->nvram_template.format, "raw")) { + VIR_DEBUG("Discarding loader with unsupported nvram templa= te format '%s'", + flash->nvram_template.format); + return false; + } + } } =20 if (def->sec) { @@ -1183,24 +1196,10 @@ qemuFirmwareEnableFeatures(virQEMUDriver *driver, loader->type =3D VIR_DOMAIN_LOADER_TYPE_PFLASH; loader->readonly =3D VIR_TRISTATE_BOOL_YES; =20 - if (STRNEQ(flash->executable.format, "raw")) { - virReportError(VIR_ERR_OPERATION_UNSUPPORTED, - _("unsupported flash format '%s'"), - flash->executable.format); - return -1; - } - VIR_FREE(loader->path); loader->path =3D g_strdup(flash->executable.filename); =20 if (flash->mode =3D=3D QEMU_FIRMWARE_FLASH_MODE_SPLIT) { - if (STRNEQ(flash->nvram_template.format, "raw")) { - virReportError(VIR_ERR_OPERATION_UNSUPPORTED, - _("unsupported nvram template format '%s'"), - flash->nvram_template.format); - return -1; - } - if (!loader->nvram) { loader->nvram =3D virStorageSourceNew(); loader->nvram->type =3D VIR_STORAGE_TYPE_FILE; --=20 2.39.1