From nobody Sat Nov 28 01:30:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1795697764; cv=none; d=zohomail.com; s=zohoarc; b=mfBbiY+edU74SWIeaLx1sAmqOUxDh0ogqiECqVcvoDFCZDE7unnctYYnzeWp1DGXROLo6w4BwlMo8+oORxgME/xiCLD01wA7IYL9rxXjdmEhSG5I8q18fAHjtsMfzKUmaaWNchX8dww7qobjOYgIJs2QqcPAZH6pZoQ20ChrrvI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795697764; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=uCBaVavLSBaEKDfw8YlN7n87s1g9xGYdARPCIFuncDA=; b=UrFXYliKoEY0enJXAVy2Tcez4HqNtqRF/o+uQEGHMG30JarokKnfJadGNszejG9qa/6vi3t94wjeyplyXd5S5PGvP+IMDsj9vPA4VMiPqERpOfYyD+SFMNOseoU1tsqK8fTgRJkW2rfOcCwGFVo7HJkUIbfi6xxoLvMmkh0+ks4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1795697764395819.1690740930214; Thu, 26 Nov 2026 04:56:04 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xWZ0q-0006cR-1H; Thu, 26 Nov 2026 07:55:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xWZ0h-0006YQ-4c for qemu-devel@nongnu.org; Thu, 26 Nov 2026 07:55:35 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xWZ0e-0007wJ-1i for qemu-devel@nongnu.org; Thu, 26 Nov 2026 07:55:34 -0500 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-502-S1QOTWMZPsW8GD979Hng3w-1; Thu, 26 Nov 2026 12:55:28 +0000 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E7EE7180075B for ; Thu, 26 Nov 2026 12:55:27 +0000 (UTC) Received: from pbonzini-thinkpadx1carbon6th.rmtit.csb (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 46BDE1956086 for ; Thu, 26 Nov 2026 12:55:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1795697731; h=from:from: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; bh=uCBaVavLSBaEKDfw8YlN7n87s1g9xGYdARPCIFuncDA=; b=He4nYoHwem9BSGrfRkZGNEOTkplZZfwy3jtHtcnJZqefCI8mI/xK/OF/hZsRsA8QDi9ATr nw5acmuz0yNYBZnIUrsIz1ejqhAWyWigP4tPHLhYsVIomcM4tDGmSHVLi+8OQCI6you41R xJ9otQ/L8tNcnp2utTk8MrIhZkoFais= X-MC-Unique: S1QOTWMZPsW8GD979Hng3w-1 X-Mimecast-MFC-AGG-ID: S1QOTWMZPsW8GD979Hng3w_1795697728 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 1/4] target/i386/tcg: apply zero extension to 8- and 16-bit NDD destinations Date: Thu, 26 Nov 2026 13:55:21 +0100 Message-ID: <20261126125524.2223648-2-pbonzini@redhat.com> In-Reply-To: <20261126125524.2223648-1-pbonzini@redhat.com> References: <20261126125524.2223648-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1795697765708158500 Section 3.1.2.4 of the APX spec says: "For an Intel=C2=AE APX instruction with an NDD (see items 2.(a) of Section 3.1.2.3.1), the destination GPR (namely, the NDD) will get the instruction=E2=80=99s result in bits [OSIZE-= 1:0] and, if OSIZE < 64b, have its upper bits [63:OSIZE] zeroed. In other words, there is no merging of the old and new values at the NDD regardless of the OSIZE or whether the NDD is one of the source operands." For example, int a =3D 0xfffff; asm("addw %w2, %w1, %w0" : "+r"(a) : "r"(1)); should leave 0, not 0xf0000 in the destination register. Signed-off-by: Paolo Bonzini --- target/i386/tcg/decode-new.c.inc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/target/i386/tcg/decode-new.c.inc b/target/i386/tcg/decode-new.= c.inc index bd9a94b3162..a10641995e0 100644 --- a/target/i386/tcg/decode-new.c.inc +++ b/target/i386/tcg/decode-new.c.inc @@ -2083,7 +2083,7 @@ static void decode_EVEX4cc(DisasContext *s, CPUX86Sta= te *env, X86OpEntry *entry, /* * All EVEX-promoted register-destination conditional moves (all CFCMOV * cases except "CFCMOV rm, r", and three-operand CMOV) have zero-upper - * Note that this is specific to CMOV/CFCMOV, and not ZU! + * This is specific to CMOV/CFCMOV in that it applies even for NDD=3D0! * * For NDD=3D0, NF represents the direction. For NDD=3D1, NF represen= ts fault * suppression. @@ -3016,6 +3016,8 @@ static bool validate_evex_apx(DisasContext *s, X86Dec= odedInsn *decode) s->vex_ndd =3D false; } else if (!s->vex_ndd) { goto illegal; + } else { + decode->e.ext0 =3D X86_EXT_Unsigned; } evex4_mask =3D 0x1C; break; --=20 2.56.1 From nobody Sat Nov 28 01:30:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1795697796; cv=none; d=zohomail.com; s=zohoarc; b=VIHpfZkv6sBry80b8WAO9oxlx445mbinKVtcwRpRvzIqIpC27meIXVwtokKYZvc8hp0WTFMB5W/ubzZZSLPppm5uFxBJer3SQeUm2GNL+Dqd30PBZYBIjfxbPsGMx+hsEndf/qNVfgFWHBKLBh1zlAfa8ASdepuFkzFZVPTo7TQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795697796; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=qC7LhwYFT0RIC5t7Qq18dOJrfylyMvlslE87OLT/g8Y=; b=IOL/JV0YL7oZ11eyjlwsbHHp/lYwzdVMD/PFZWt6ajWZANTmu31hyBC9ukb347fLa4db1WBoudo/MDoaY/EaOqVUsw2NWZ8m2T/WSgStsCweNR24uy6Snl/5ADAdHm4PUB8eX0HKITBEiF2ydakPC2Al5lWCFeBzOEhmTWe7FMc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1795697796815896.4022836349982; Thu, 26 Nov 2026 04:56:36 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xWZ0r-0006dd-PO; Thu, 26 Nov 2026 07:55:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xWZ0i-0006Yl-3K for qemu-devel@nongnu.org; Thu, 26 Nov 2026 07:55:40 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xWZ0g-0007wZ-C2 for qemu-devel@nongnu.org; Thu, 26 Nov 2026 07:55:35 -0500 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-386-fTlyg9KBPP6mMIHcJkCErA-1; Thu, 26 Nov 2026 12:55:31 +0000 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6F0BD18001EC; Thu, 26 Nov 2026 12:55:30 +0000 (UTC) Received: from pbonzini-thinkpadx1carbon6th.rmtit.csb (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 560951956087; Thu, 26 Nov 2026 12:55:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1795697733; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qC7LhwYFT0RIC5t7Qq18dOJrfylyMvlslE87OLT/g8Y=; b=QHTNmy6mRSIiw6JUQxMYJhXpDIYo2NyTw3VCyd6i9sKbCcSqZFheg2N0/dBZ2EOpVBrtOB gyajgrozTnk7KF91o0dCh42d1aWykDG4yf2d0JkxzpXIf/DbB1uOxwopObvnah/Wsty/Gy vHybSOoC9M/+nQl2oYYL1MeivbG32Oo= X-MC-Unique: fTlyg9KBPP6mMIHcJkCErA-1 X-Mimecast-MFC-AGG-ID: fTlyg9KBPP6mMIHcJkCErA_1795697730 From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Michael Tokarev Subject: [PULL 2/4] hostmem: allow building without KVM support Date: Thu, 26 Nov 2026 13:55:22 +0100 Message-ID: <20261126125524.2223648-3-pbonzini@redhat.com> In-Reply-To: <20261126125524.2223648-1-pbonzini@redhat.com> References: <20261126125524.2223648-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1795697798327158500 Content-Type: text/plain; charset="utf-8" From: Michael Tokarev On architectures where KVM is not available and so including does not work, buildnig backends/hostmem-memfd.c fails since 7ca43d7ad02f: In file included from backends/hostmem-memfd.c:23: linux-headers/linux/kvm.h:16:10: fatal error: asm/kvm.h: No such file or d= irectory 16 | #include Do not include because "system/kvm.h" already includes it for= us when KVM is enabled, and guard the actual code using memfd definitions with Fixes: 7ca43d7ad02f ("hostmem: Support fully shared guest memfd to back a V= M") Signed-off-by: Michael Tokarev Link: https://lore.kernel.org/r/20261119111050.1203459-1-mjt@tls.msk.ru Signed-off-by: Paolo Bonzini --- meson.build | 3 +-- backends/hostmem-memfd.c | 10 +++++++++- tests/qtest/libqtest.c | 2 ++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index 4d267e10b5f..303f57a7cb6 100644 --- a/meson.build +++ b/meson.build @@ -2422,11 +2422,10 @@ endif =20 config_host_data.set('HOST_' + host_arch.to_upper(), 1) =20 -kvm_targets_c =3D '""' if get_option('kvm').allowed() and host_os =3D=3D 'linux' kvm_targets_c =3D '"' + '" ,"'.join(kvm_targets) + '"' + config_host_data.set('CONFIG_KVM_TARGETS', kvm_targets_c) endif -config_host_data.set('CONFIG_KVM_TARGETS', kvm_targets_c) =20 if get_option('module_upgrades') and not enable_modules error('Cannot enable module-upgrades as modules are not enabled') diff --git a/backends/hostmem-memfd.c b/backends/hostmem-memfd.c index 46489212a23..80ea5b9674d 100644 --- a/backends/hostmem-memfd.c +++ b/backends/hostmem-memfd.c @@ -20,9 +20,12 @@ #include "qom/object.h" #include "migration/cpr.h" #include "system/kvm.h" -#include #include "qapi/qapi-type-infos-common.h" =20 +#ifdef CONFIG_KVM_TARGETS +#include "linux-headers/linux/kvm.h" +#endif + OBJECT_DECLARE_SIMPLE_TYPE(HostMemoryBackendMemfd, MEMORY_BACKEND_MEMFD) =20 =20 @@ -71,10 +74,15 @@ memfd_backend_memory_alloc(HostMemoryBackend *backend, = Error **errp) return false; } =20 +#ifdef CONFIG_KVM_TARGETS fd =3D kvm_create_guest_memfd(backend->size, GUEST_MEMFD_FLAG_MMAP | GUEST_MEMFD_FLAG_INIT_SHARED, errp); +#else + error_setg(errp, "guest-memfd=3Don requires KVM which is not enabl= ed"); + fd =3D -ENOSYS; +#endif } else { fd =3D qemu_memfd_create(TYPE_MEMORY_BACKEND_MEMFD, backend->size, m->hugetlb, m->hugetlbsize, m->seal ? diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index 7f66c1bbb3b..b859ff728bf 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -1165,6 +1165,7 @@ bool qtest_has_accel(const char *accel_name) g_autofree char *accel_type =3D NULL; =20 if (g_str_equal(accel_name, "kvm")) { +#ifdef CONFIG_KVM_TARGETS int i; const char *arch =3D qtest_get_arch(); const char *targets[] =3D { CONFIG_KVM_TARGETS }; @@ -1176,6 +1177,7 @@ bool qtest_has_accel(const char *accel_name) } } } +#endif return false; } =20 --=20 2.56.1 From nobody Sat Nov 28 01:30:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1795697771; cv=none; d=zohomail.com; s=zohoarc; b=mnywED9a8D6OhRqp2Xnl9kUjmyhOi2boZR/EWTqwXfJ6TdrCvDnAS4nCb3Rc9PWDTbxk5Cu+GPRBAUfuM9SDTQWDqOpASSsVLWSh9iOc2f+L/5Dyq87TCPTacUjnt7KGCCMXfBPe/USRIVo5TEJVLiJHvXr0CdgCJAS5ZeeQKCI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795697771; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Iz/++PGz2HjBoTtPnTFvamqnpFrP4piWqS/PAD30+Sg=; b=Vx+o6WZjSFQ/AhzWFxoKgZjqDzkQTbBMEoJLxRfqPSz/ThqkshJKVtJwIoGh7gC5mlDp1XJn2JwSwrU9x3mqmhDnUfvHnKK91+Ju1NkzWNnhx2XTQorcrFnem/0fewihttAB9XQIoJuveFRJjJ5WjLdEpBNDSAhDtYO4UbVfn4c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17956977716373.8474259602450047; Thu, 26 Nov 2026 04:56:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xWZ0q-0006cU-9I; Thu, 26 Nov 2026 07:55:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xWZ0o-0006bt-Sv for qemu-devel@nongnu.org; Thu, 26 Nov 2026 07:55:42 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xWZ0m-0007yh-LB for qemu-devel@nongnu.org; Thu, 26 Nov 2026 07:55:42 -0500 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-209-5lNb7OsCPQGC50pO1e9NXw-1; Thu, 26 Nov 2026 12:55:33 +0000 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 594A419560A1; Thu, 26 Nov 2026 12:55:32 +0000 (UTC) Received: from pbonzini-thinkpadx1carbon6th.rmtit.csb (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0C6B01956087; Thu, 26 Nov 2026 12:55:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1795697739; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Iz/++PGz2HjBoTtPnTFvamqnpFrP4piWqS/PAD30+Sg=; b=FNwicTCFYKG1DYHZd3xFinFoOGLLoTTXlTg6O+uQ/x6fwKgW/EIEI9dMLlrcOtspxGt/PD LFj0jj8KguP4JOPrRRZUxWKRKNiypG5MWq+BEzZGPahACn2IXpC48pmI9Q+a1vO1F7KalC gWurJcM/EllGTpyjmU7YKjm1HK/H7o4= X-MC-Unique: 5lNb7OsCPQGC50pO1e9NXw-1 X-Mimecast-MFC-AGG-ID: 5lNb7OsCPQGC50pO1e9NXw_1795697732 From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: "Chang S. Bae" , qemu-stable@nongnu.org, Zhao Liu Subject: [PULL 3/4] i386/cpu: Remove AMX-TF32 CPUID bit from Diamond Rapids Date: Thu, 26 Nov 2026 13:55:23 +0100 Message-ID: <20261126125524.2223648-4-pbonzini@redhat.com> In-Reply-To: <20261126125524.2223648-1-pbonzini@redhat.com> References: <20261126125524.2223648-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 5 X-Spam_score: 0.5 X-Spam_bar: / X-Spam_report: (0.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1795697773685158500 Content-Type: text/plain; charset="utf-8" From: "Chang S. Bae" A recent update (rev. 62) to the Intel document [1] clarifies that the feature will not be implemented on Diamond Rapids. Listing it would result in spurious warnings due to the mismatch. Remove the feature from the CPU model. Note [1] (rev. 63) now clarifies that the CPUID bit is reserved rather than removed. So, the existing CPUID bit enumeration does not conflict with it and can be retained. [1] Intel Architecture Instruction Set Extensions and Future Features Cc: qemu-stable@nongnu.org # v11.0+ Reviewed-by: Zhao Liu Signed-off-by: Chang S. Bae Link: https://lore.kernel.org/r/20261119183717.962303-1-chang.seok.bae@inte= l.com Signed-off-by: Paolo Bonzini --- target/i386/cpu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index eab0d5a4d4a..40974bee26c 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -5729,8 +5729,7 @@ static const X86CPUDefinition builtin_x86_defs[] =3D { CPUID_1E_1_EAX_AMX_INT8_ALIAS | CPUID_1E_1_EAX_AMX_BF16_ALIAS | CPUID_1E_1_EAX_AMX_COMPLEX_ALIAS | CPUID_1E_1_EAX_AMX_FP16_ALIAS | CPUID_1E_1_EAX_AMX_FP8 | - CPUID_1E_1_EAX_AMX_TF32 | CPUID_1E_1_EAX_AMX_AVX512 | - CPUID_1E_1_EAX_AMX_MOVRS, + CPUID_1E_1_EAX_AMX_AVX512 | CPUID_1E_1_EAX_AMX_MOVRS, .features[FEAT_29_0_EBX] =3D CPUID_29_0_EBX_APX_NCI_NDD_NF, /* * Though this bit will be set by avx_version=3D2, it's better to --=20 2.56.1 From nobody Sat Nov 28 01:30:18 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1795697838; cv=none; d=zohomail.com; s=zohoarc; b=lDjbNZQ53hf0F09OFEl55mJc+H2E1MJY5zhnJYxE044yybH0iHhi5qizi7mcri1L/rnjTB0eGqs/UFznF6j9wBs0wDuBX7X0oKlcLx4qDgEDAFHN8KURHc8hoLezSUgZw4ot5mko19nnSwhydv0qIlvNkFb3DChWRMeNbuQ3pyg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795697838; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=J17fJmb57O8Sn3L6cRz6p/tIJ/btqGS30QdrH20f7O0=; b=RbYbC21RtXdCK0XJK5bSlE21bpoJI+ifkT1rcq3gGi2+kY9GO/uFKewuWA1gCLfJXBpXnV7j3gf5ESR/Cz/mdEgeitDfORpmT0opPLu2TGXi7z794j2CuR0CgYSmOwA7KhxSuv1TdEXw/cPKkXQr3dKp7dHfzzcOUjrdhyjYfqo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1795697838762301.2482304012925; Thu, 26 Nov 2026 04:57:18 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xWZ0r-0006d4-H0; Thu, 26 Nov 2026 07:55:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xWZ0o-0006br-Si for qemu-devel@nongnu.org; Thu, 26 Nov 2026 07:55:42 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xWZ0m-0007yV-6t for qemu-devel@nongnu.org; Thu, 26 Nov 2026 07:55:42 -0500 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-88-TYHoFqbVNLaQrrNKbLxreQ-1; Thu, 26 Nov 2026 12:55:36 +0000 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 934B11944B36; Thu, 26 Nov 2026 12:55:34 +0000 (UTC) Received: from pbonzini-thinkpadx1carbon6th.rmtit.csb (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BA7031956086; Thu, 26 Nov 2026 12:55:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1795697739; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=J17fJmb57O8Sn3L6cRz6p/tIJ/btqGS30QdrH20f7O0=; b=ClrrKN2kQCxeGbmqCl+IhKSNOhB2o5cEmraKKQv8nhK/kUd1yDktVPR88bBupJu6T6hQi+ 5bd4Y30Xa+iyO2XfNrf3mQsqpYQA8I8u66wphXWOFakt/41JB+cAwxWXjw9Clt0qB3rd+C OmKDWuJeQaH/4oD5u6xgTNY3D+8EVdA= X-MC-Unique: TYHoFqbVNLaQrrNKbLxreQ-1 X-Mimecast-MFC-AGG-ID: TYHoFqbVNLaQrrNKbLxreQ_1795697735 From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Tai Yunfang , Xiao Guangrong , Jason Thorpe , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 4/4] mc146818rtc: set PF even when PIE is clear Date: Thu, 26 Nov 2026 13:55:24 +0100 Message-ID: <20261126125524.2223648-5-pbonzini@redhat.com> In-Reply-To: <20261126125524.2223648-1-pbonzini@redhat.com> References: <20261126125524.2223648-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 5 X-Spam_score: 0.5 X-Spam_bar: / X-Spam_report: (0.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1795697840859158500 The MC146818A datasheet says PF is latched independently of PIE; PIE only makes PF raise IRQF and the IRQ line. QEMU skipped the periodic timer when PIE was clear, so PF never latched. Compute the period from register A regardless of PIE, and latch PF without raising an interrupt when PIE is clear. Stop the timer while PF is set so idle guests are not woken every period, then re-arm it when register C is read. Lost tick compensation is limited to PIE=3D1 so that the RTC does not count ticks with the periodic interrupt disabled as lost. Cc: Tai Yunfang Cc: Xiao Guangrong Cc: Jason Thorpe Fixes: 369b41359af ("mc146818rtc: precisely count the clock for periodic ti= mer") Co-authored-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Paolo Bonzini --- hw/rtc/mc146818rtc.c | 32 +++++++++++++++++++++--------- tests/qtest/rtc-test.c | 45 ++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 66 insertions(+), 11 deletions(-) diff --git a/hw/rtc/mc146818rtc.c b/hw/rtc/mc146818rtc.c index 887a8b07582..ae12e3f875e 100644 --- a/hw/rtc/mc146818rtc.c +++ b/hw/rtc/mc146818rtc.c @@ -132,13 +132,7 @@ static void rtc_coalesced_timer(void *opaque) =20 static uint32_t rtc_periodic_clock_ticks(MC146818RtcState *s) { - int period_code; - - if (!(s->cmos_data[RTC_REG_B] & REG_B_PIE)) { - return 0; - } - - period_code =3D s->cmos_data[RTC_REG_A] & 0x0f; + int period_code =3D s->cmos_data[RTC_REG_A] & 0x0f; =20 return periodic_period_to_clock(period_code); } @@ -153,6 +147,18 @@ static void periodic_timer_update(MC146818RtcState *s,= int64_t current_time, uint32_t period; int64_t cur_clock, next_irq_clock, lost_clock =3D 0; =20 + /* + * When the periodic interrupt is disabled the periodic timer only + * serves to set the PF flag in register C. Once it has been set + * there is nothing to do until the flag is cleared by reading + * register C, so keep the timer stopped to avoid useless wakeups. + */ + if (!(s->cmos_data[RTC_REG_B] & REG_B_PIE) && + (s->cmos_data[RTC_REG_C] & REG_C_PF)) { + timer_del(s->periodic_timer); + return; + } + period =3D rtc_periodic_clock_ticks(s); s->period =3D period; =20 @@ -194,7 +200,8 @@ static void periodic_timer_update(MC146818RtcState *s, = int64_t current_time, * to a shorter period, scale up the missing ticks since the * OS handler will treat past delayed ticks as shorter. */ - if (s->lost_tick_policy =3D=3D LOST_TICK_POLICY_SLEW) { + if (s->lost_tick_policy =3D=3D LOST_TICK_POLICY_SLEW && + (s->cmos_data[RTC_REG_B] & REG_B_PIE)) { uint32_t old_irq_coalesced =3D s->irq_coalesced; =20 lost_clock +=3D old_irq_coalesced * old_period; @@ -226,8 +233,8 @@ static void rtc_periodic_timer(void *opaque) { MC146818RtcState *s =3D opaque; =20 - periodic_timer_update(s, s->next_periodic_time, s->period, false); s->cmos_data[RTC_REG_C] |=3D REG_C_PF; + periodic_timer_update(s, s->next_periodic_time, s->period, false); if (s->cmos_data[RTC_REG_B] & REG_B_PIE) { s->cmos_data[RTC_REG_C] |=3D REG_C_IRQF; if (s->lost_tick_policy =3D=3D LOST_TICK_POLICY_SLEW) { @@ -699,10 +706,17 @@ static uint64_t cmos_ioport_read(void *opaque, hwaddr= addr, ret =3D s->cmos_data[s->cmos_index]; qemu_irq_lower(s->irq); s->cmos_data[RTC_REG_C] =3D 0x00; + + /* Rearm the timers for bits that have been cleared. */ if (ret & (REG_C_UF | REG_C_AF)) { check_update_timer(s); } =20 + if ((ret & REG_C_PF) && !(s->cmos_data[RTC_REG_B] & REG_B_PIE)= ) { + periodic_timer_update(s, qemu_clock_get_ns(rtc_clock), + s->period, false); + } + if(s->irq_coalesced && (s->cmos_data[RTC_REG_B] & REG_B_PIE) && s->irq_reinject_on_ack_count < RTC_REINJECT_ON_ACK_COU= NT) { diff --git a/tests/qtest/rtc-test.c b/tests/qtest/rtc-test.c index 02ed4e12385..b320a91d950 100644 --- a/tests/qtest/rtc-test.c +++ b/tests/qtest/rtc-test.c @@ -643,6 +643,46 @@ static void uip_stuck(void) =20 #define RTC_PERIOD_TEST_NR 50 =20 +static uint64_t wait_periodic_timer(uint64_t real_time, int period_code) +{ + uint64_t periodic_time =3D real_time; + periodic_time +=3D NANOSECONDS_PER_SECOND >> (16 - period_code); + + cmos_write(RTC_REG_A, period_code); + while (!(cmos_read(RTC_REG_C) & REG_C_PF)) { + real_time =3D clock_step_next(); + g_assert_cmpint(real_time, <, periodic_time + 100); + } + + g_assert_cmpint(real_time, <, periodic_time + 100); + g_assert_cmpint(real_time, >, periodic_time - 100); + return real_time; +} + +static void periodic_timer(void) +{ + int i; + uint64_t real_time; + + /* disable all interrupts. */ + cmos_write(RTC_REG_A, 0); + cmos_write(RTC_REG_B, cmos_read(RTC_REG_B) & + ~(REG_B_PIE | REG_B_AIE | REG_B_UIE)); + + /* wait for the first timer without assertions, to synchronize and cle= ar PF */ + cmos_read(RTC_REG_C); + cmos_write(RTC_REG_A, 10); + real_time =3D clock_step_next(); + while (!(cmos_read(RTC_REG_C) & REG_C_PF)) { + real_time =3D clock_step_next(); + } + + for (i =3D 0; i < RTC_PERIOD_TEST_NR; i++) { + real_time =3D wait_periodic_timer(real_time, RTC_PERIOD_CODE1); + real_time =3D wait_periodic_timer(real_time, RTC_PERIOD_CODE2); + } +} + static uint64_t wait_periodic_interrupt(uint64_t real_time) { while (!get_irq(RTC_ISA_IRQ)) { @@ -653,7 +693,7 @@ static uint64_t wait_periodic_interrupt(uint64_t real_t= ime) return real_time; } =20 -static void periodic_timer(void) +static void periodic_interrupt(void) { int i; uint64_t period_clocks, period_time, start_time, real_time; @@ -708,7 +748,8 @@ int main(int argc, char **argv) qtest_add_func("/rtc/update/divider-reset", divider_reset); qtest_add_func("/rtc/update/uip-stuck", uip_stuck); qtest_add_func("/rtc/misc/fuzz-registers", fuzz_registers); - qtest_add_func("/rtc/periodic/interrupt", periodic_timer); + qtest_add_func("/rtc/periodic/timer", periodic_timer); + qtest_add_func("/rtc/periodic/interrupt", periodic_interrupt); =20 ret =3D g_test_run(); =20 --=20 2.56.1