From nobody Tue Feb 10 03:38:35 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=1672739653; cv=none; d=zohomail.com; s=zohoarc; b=E+uGRvJo5LfPyySd/P6MUK/m6wReGuuYS3fXx/WTuaFne/KCDzVrUxG76XoCalqSHdnVomfDk7cEd65wxI61tzAhrxuE1AXpt4m4Bg1HWoLNsiVDPp5pGvWdGjroz7NWb8eo5Xo1BX5yvrxdPOE19yOGX67+zzyud5w3vMWNQew= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1672739653; 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=GZEvsh8Np1/FoP2/QnEUMrmGGnjC8ZIME0GRZCYo0Z0=; b=TnqaDg628yA32p7gwcuPf9/nPa6kCJLDAS1I484QaYDqEq33aVepr0aKRFVTnbnvKtY2rlfxWdxMiUASO/jCAFONJycfnm9+SdMmqvCrS563aGT8cd40O+NRN9ZcfENTXix0oLppQV6XODlf5tLBgE5VCWq/Ma4qoa7GTb7dia0= 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 1672739653190163.13706365309542; Tue, 3 Jan 2023 01:54:13 -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-161-ghVG9DhgPQm2yOFD8sfAtg-1; Tue, 03 Jan 2023 04:53:22 -0500 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 9077E8F6EA3; Tue, 3 Jan 2023 09:53:19 +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 77CD32166B26; Tue, 3 Jan 2023 09:53:19 +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 415A31946594; Tue, 3 Jan 2023 09:53:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id C357E1946587 for ; Tue, 3 Jan 2023 09:53:16 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id AA111492C18; Tue, 3 Jan 2023 09:53:16 +0000 (UTC) Received: from speedmetal.redhat.com (ovpn-208-20.brq.redhat.com [10.40.208.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1A39A492C14 for ; Tue, 3 Jan 2023 09:53:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1672739652; 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=GZEvsh8Np1/FoP2/QnEUMrmGGnjC8ZIME0GRZCYo0Z0=; b=MsZwGakC/hKQyAsbvA8WEoBJEPIfeC8/0raTQB54qe5sHFKpJfdwkoeYpZ3Crks9Yd/vt8 hjY7iDOwuBV8JQwb33mCmgZepA9COIYHv+SYXJtKpFPh+JAFpz3NDrp+hs05ofTP8WLq0V bPUdg7Uq9eW3Cty4aM8z/C0HUR09cMo= X-MC-Unique: ghVG9DhgPQm2yOFD8sfAtg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 3/3] qemu: Use '-machine hpet=off' instead of '-no-hpet' Date: Tue, 3 Jan 2023 10:53:01 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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.6 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: 1672739655117100001 Content-Type: text/plain; charset="utf-8" qemu is about to deprecate the '-no-hpet' option in favor of configuring the timer via '-machine'. Use the QEMU_CAPS_MACHINE_HPET capability to switch to the new syntax and mask out the old QEMU_CAPS_NO_HPET capability at the same time to prevent using the old syntax. Signed-off-by: Peter Krempa Reviewed-by: Thomas Huth --- src/qemu/qemu_capabilities.c | 5 ++++ src/qemu/qemu_command.c | 29 ++++++++++++++++++- .../caps_8.0.0.x86_64.xml | 1 - .../q35-virt-manager-basic.x86_64-latest.args | 3 +- .../x86_64-pc-graphics.x86_64-latest.args | 3 +- .../x86_64-pc-headless.x86_64-latest.args | 3 +- .../x86_64-q35-graphics.x86_64-latest.args | 3 +- .../x86_64-q35-headless.x86_64-latest.args | 3 +- 8 files changed, 38 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 7df68f85a1..3591e73e5b 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -5410,6 +5410,11 @@ virQEMUCapsInitProcessCapsInterlock(virQEMUCaps *qem= uCaps) * on a not entirely related witness. */ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_JSON)) virQEMUCapsSet(qemuCaps, QEMU_CAPS_COMPAT_DEPRECATED); + + /* Modern-style config of the HPET timer overrides support for the '-n= o-hpet' + * option */ + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_HPET)) + virQEMUCapsClear(qemuCaps, QEMU_CAPS_NO_HPET); } diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index ee2e873b95..06e29ff8ae 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -5860,7 +5860,10 @@ qemuBuildClockCommandLine(virCommand *cmd, break; case VIR_DOMAIN_TIMER_NAME_HPET: - /* the only meaningful attribute for hpet is "present". If pre= sent + /* Modern qemu versions configure the HPET timer via -machine.= See + * qemuBuildMachineCommandLine. + * + * the only meaningful attribute for hpet is "present". If pre= sent * is VIR_TRISTATE_BOOL_ABSENT, that means it wasn't specified= , and * should be left at the default for the hypervisor. "default"= when * -no-hpet exists is VIR_TRISTATE_BOOL_YES, and when -no-hpet @@ -6744,6 +6747,7 @@ qemuBuildMachineCommandLine(virCommand *cmd, { virCPUDef *cpu =3D def->cpu; g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; + size_t i; virCommandAddArg(cmd, "-machine"); virBufferAdd(&buf, def->os.machine, -1); @@ -6829,6 +6833,29 @@ qemuBuildMachineCommandLine(virCommand *cmd, virBufferAddLit(&buf, ",graphics=3Doff"); } + for (i =3D 0; i < def->clock.ntimers; i++) { + switch ((virDomainTimerNameType)def->clock.timers[i]->name) { + case VIR_DOMAIN_TIMER_NAME_HPET: + /* qemuBuildClockCommandLine handles the old-style config via = '-no-hpet' */ + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_HPET) && + def->clock.timers[i]->present !=3D VIR_TRISTATE_BOOL_ABSEN= T) { + virBufferAsprintf(&buf, ",hpet=3D%s", + virTristateSwitchTypeToString(def->clock= .timers[i]->present)); + } + break; + + case VIR_DOMAIN_TIMER_NAME_PLATFORM: + case VIR_DOMAIN_TIMER_NAME_TSC: + case VIR_DOMAIN_TIMER_NAME_KVMCLOCK: + case VIR_DOMAIN_TIMER_NAME_HYPERVCLOCK: + case VIR_DOMAIN_TIMER_NAME_ARMVTIMER: + case VIR_DOMAIN_TIMER_NAME_RTC: + case VIR_DOMAIN_TIMER_NAME_PIT: + case VIR_DOMAIN_TIMER_NAME_LAST: + break; + } + } + virCommandAddArgBuffer(cmd, &buf); return 0; diff --git a/tests/qemucapabilitiesdata/caps_8.0.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_8.0.0.x86_64.xml index 31dc03a780..860ad2860a 100644 --- a/tests/qemucapabilitiesdata/caps_8.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_8.0.0.x86_64.xml @@ -5,7 +5,6 @@ 0 - diff --git a/tests/qemuxml2argvdata/q35-virt-manager-basic.x86_64-latest.ar= gs b/tests/qemuxml2argvdata/q35-virt-manager-basic.x86_64-latest.args index 2f75d79739..8446abdb6e 100644 --- a/tests/qemuxml2argvdata/q35-virt-manager-basic.x86_64-latest.args +++ b/tests/qemuxml2argvdata/q35-virt-manager-basic.x86_64-latest.args @@ -10,7 +10,7 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-virt-manager-basic/.= config \ -name guest=3Dvirt-manager-basic,debug-threads=3Don \ -S \ -object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tm= p/lib/domain--1-virt-manager-basic/master-key.aes"}' \ --machine q35,usb=3Doff,vmport=3Doff,dump-guest-core=3Doff,memory-backend= =3Dpc.ram \ +-machine q35,usb=3Doff,vmport=3Doff,dump-guest-core=3Doff,memory-backend= =3Dpc.ram,hpet=3Doff \ -accel kvm \ -cpu qemu64 \ -m 4096 \ @@ -24,7 +24,6 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-virt-manager-basic/.= config \ -mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ -rtc base=3Dutc,driftfix=3Dslew \ -global kvm-pit.lost_tick_policy=3Ddelay \ --no-hpet \ -no-shutdown \ -global ICH9-LPC.disable_s3=3D1 \ -global ICH9-LPC.disable_s4=3D1 \ diff --git a/tests/qemuxml2argvdata/x86_64-pc-graphics.x86_64-latest.args b= /tests/qemuxml2argvdata/x86_64-pc-graphics.x86_64-latest.args index ef0b9c620c..4c3c896f02 100644 --- a/tests/qemuxml2argvdata/x86_64-pc-graphics.x86_64-latest.args +++ b/tests/qemuxml2argvdata/x86_64-pc-graphics.x86_64-latest.args @@ -10,7 +10,7 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-guest/.config \ -name guest=3Dguest,debug-threads=3Don \ -S \ -object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tm= p/lib/domain--1-guest/master-key.aes"}' \ --machine pc,usb=3Doff,dump-guest-core=3Doff,memory-backend=3Dpc.ram \ +-machine pc,usb=3Doff,dump-guest-core=3Doff,memory-backend=3Dpc.ram,hpet= =3Doff \ -accel tcg \ -cpu qemu64 \ -m 4096 \ @@ -24,7 +24,6 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-guest/.config \ -mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ -rtc base=3Dutc,driftfix=3Dslew \ -global kvm-pit.lost_tick_policy=3Ddelay \ --no-hpet \ -no-shutdown \ -global PIIX4_PM.disable_s3=3D1 \ -global PIIX4_PM.disable_s4=3D1 \ diff --git a/tests/qemuxml2argvdata/x86_64-pc-headless.x86_64-latest.args b= /tests/qemuxml2argvdata/x86_64-pc-headless.x86_64-latest.args index aee3161a75..281d611f8b 100644 --- a/tests/qemuxml2argvdata/x86_64-pc-headless.x86_64-latest.args +++ b/tests/qemuxml2argvdata/x86_64-pc-headless.x86_64-latest.args @@ -10,7 +10,7 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-guest/.config \ -name guest=3Dguest,debug-threads=3Don \ -S \ -object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tm= p/lib/domain--1-guest/master-key.aes"}' \ --machine pc,usb=3Doff,dump-guest-core=3Doff,memory-backend=3Dpc.ram \ +-machine pc,usb=3Doff,dump-guest-core=3Doff,memory-backend=3Dpc.ram,hpet= =3Doff \ -accel tcg \ -cpu qemu64 \ -m 4096 \ @@ -25,7 +25,6 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-guest/.config \ -mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ -rtc base=3Dutc,driftfix=3Dslew \ -global kvm-pit.lost_tick_policy=3Ddelay \ --no-hpet \ -no-shutdown \ -global PIIX4_PM.disable_s3=3D1 \ -global PIIX4_PM.disable_s4=3D1 \ diff --git a/tests/qemuxml2argvdata/x86_64-q35-graphics.x86_64-latest.args = b/tests/qemuxml2argvdata/x86_64-q35-graphics.x86_64-latest.args index 337103d722..db56a83763 100644 --- a/tests/qemuxml2argvdata/x86_64-q35-graphics.x86_64-latest.args +++ b/tests/qemuxml2argvdata/x86_64-q35-graphics.x86_64-latest.args @@ -10,7 +10,7 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-guest/.config \ -name guest=3Dguest,debug-threads=3Don \ -S \ -object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tm= p/lib/domain--1-guest/master-key.aes"}' \ --machine q35,usb=3Doff,dump-guest-core=3Doff,memory-backend=3Dpc.ram \ +-machine q35,usb=3Doff,dump-guest-core=3Doff,memory-backend=3Dpc.ram,hpet= =3Doff \ -accel tcg \ -cpu qemu64 \ -m 4096 \ @@ -24,7 +24,6 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-guest/.config \ -mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ -rtc base=3Dutc,driftfix=3Dslew \ -global kvm-pit.lost_tick_policy=3Ddelay \ --no-hpet \ -no-shutdown \ -global ICH9-LPC.disable_s3=3D1 \ -global ICH9-LPC.disable_s4=3D1 \ diff --git a/tests/qemuxml2argvdata/x86_64-q35-headless.x86_64-latest.args = b/tests/qemuxml2argvdata/x86_64-q35-headless.x86_64-latest.args index bf8a2f3af9..dde31179d3 100644 --- a/tests/qemuxml2argvdata/x86_64-q35-headless.x86_64-latest.args +++ b/tests/qemuxml2argvdata/x86_64-q35-headless.x86_64-latest.args @@ -10,7 +10,7 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-guest/.config \ -name guest=3Dguest,debug-threads=3Don \ -S \ -object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tm= p/lib/domain--1-guest/master-key.aes"}' \ --machine q35,usb=3Doff,dump-guest-core=3Doff,memory-backend=3Dpc.ram \ +-machine q35,usb=3Doff,dump-guest-core=3Doff,memory-backend=3Dpc.ram,hpet= =3Doff \ -accel tcg \ -cpu qemu64 \ -m 4096 \ @@ -25,7 +25,6 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-guest/.config \ -mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ -rtc base=3Dutc,driftfix=3Dslew \ -global kvm-pit.lost_tick_policy=3Ddelay \ --no-hpet \ -no-shutdown \ -global ICH9-LPC.disable_s3=3D1 \ -global ICH9-LPC.disable_s4=3D1 \ --=20 2.38.1