x86, KVM fixes for 2026-11-26
Subsystems (2)
The following changes since commit 08ed97c33c3818ef51a7c852347a28e9f66807b5:
tests/tcg/i386: compile test-i386-blendv.c with -msse4.1 (2026-11-19 13:54:13 -0800)
are available in the Git repository at:
https://gitlab.com/bonzini/qemu.git tags/for-upstream
for you to fetch changes up to fe0cbc34d4273b82bbe6df38a2f12d61ec45f573:
mc146818rtc: set PF even when PIE is clear (2026-11-20 18:51:43 +0100)
----------------------------------------------------------------
* mc146818rtc: set PF even when PIE is clear
* i386/cpu: Remove AMX-TF32 CPUID bit from Diamond Rapids
* hostmem: allow building without KVM support
* target/i386/tcg: apply zero extension to 8- and 16-bit NDD destinations
----------------------------------------------------------------
Chang S. Bae (1):
i386/cpu: Remove AMX-TF32 CPUID bit from Diamond Rapids
Michael Tokarev (1):
hostmem: allow building without KVM support
Paolo Bonzini (2):
target/i386/tcg: apply zero extension to 8- and 16-bit NDD destinations
mc146818rtc: set PF even when PIE is clear
meson.build | 3 +-- backends/hostmem-memfd.c | 10 ++++++++- hw/rtc/mc146818rtc.c | 32 ++++++++++++++++++++-------- target/i386/cpu.c | 3 +-- tests/qtest/libqtest.c | 2 ++ tests/qtest/rtc-test.c | 45 ++++++++++++++++++++++++++++++++++++++-- target/i386/tcg/decode-new.c.inc | 4 +++- 7 files changed, 82 insertions(+), 17 deletions(-)
Signature · 1 line
2.56.1
[PULL 1/4] target/i386/tcg: apply zero extension to 8- and 16-bit NDD destinations
Section 3.1.2.4 of the APX spec says: "For an Intel® 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’s 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 = 0xfffff;
asm("addw %w2, %w1, %w0" : "+r"(a) : "r"(1));should leave 0, not 0xf0000 in the destination register.
--- target/i386/tcg/decode-new.c.inc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
target/i386/tcg/decode-new.c.inc +3 -1
@@ -2083,7 +2083,7 @@ static void decode_EVEX4cc(DisasContext *s, CPUX86State *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=0! * * For NDD=0, NF represents the direction. For NDD=1, NF represents fault * suppression.
@@ -3016,6 +3016,8 @@ static bool validate_evex_apx(DisasContext *s, X86DecodedInsn *decode) s->vex_ndd = false; } else if (!s->vex_ndd) { goto illegal; + } else { + decode->e.ext0 = X86_EXT_Unsigned; } evex4_mask = 0x1C; break;
Signature · 1 line
2.56.1
[PULL 3/4] i386/cpu: Remove AMX-TF32 CPUID bit from Diamond Rapids
In reply to Paolo BonziniFrom: "Chang S. Bae" <[email protected]>
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
--- target/i386/cpu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
target/i386/cpu.c +1 -2
@@ -5729,8 +5729,7 @@ static const X86CPUDefinition builtin_x86_defs[] = {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] = CPUID_29_0_EBX_APX_NCI_NDD_NF,/* * Though this bit will be set by avx_version=2, it's better to
Signature · 1 line
2.56.1
[PULL 2/4] hostmem: allow building without KVM support
In reply to Paolo BonziniFrom: Michael Tokarev <[email protected]>
On architectures where KVM is not available and so including <linux/kvm.h> 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 directory
16 | #include <asm/kvm.h>
Do not include <linux/kvm.h> because "system/kvm.h" already includes it for us when KVM is enabled, and guard the actual code using memfd definitions with
--- meson.build | 3 +-- backends/hostmem-memfd.c | 10 +++++++++- tests/qtest/libqtest.c | 2 ++ 3 files changed, 12 insertions(+), 3 deletions(-)
meson.build +1 -2
@@ -2422,11 +2422,10 @@ endif config_host_data.set('HOST_' + host_arch.to_upper(), 1) -kvm_targets_c = '""' if get_option('kvm').allowed() and host_os == 'linux' kvm_targets_c = '"' + '" ,"'.join(kvm_targets) + '"' + config_host_data.set('CONFIG_KVM_TARGETS', kvm_targets_c) endif -config_host_data.set('CONFIG_KVM_TARGETS', kvm_targets_c) if get_option('module_upgrades') and not enable_modules error('Cannot enable module-upgrades as modules are not enabled')
backends/hostmem-memfd.c +9 -1
@@ -20,9 +20,12 @@#include "qom/object.h" #include "migration/cpr.h" #include "system/kvm.h" -#include <linux/kvm.h> #include "qapi/qapi-type-infos-common.h" +#ifdef CONFIG_KVM_TARGETS +#include "linux-headers/linux/kvm.h" +#endif +OBJECT_DECLARE_SIMPLE_TYPE (HostMemoryBackendMemfd,MEMORY_BACKEND_MEMFD )
@@ -71,10 +74,15 @@ memfd_backend_memory_alloc(HostMemoryBackend *backend, Error **errp)return false; } +#ifdef CONFIG_KVM_TARGETS fd =kvm_create_guest_memfd (backend->size,GUEST_MEMFD_FLAG_MMAP |GUEST_MEMFD_FLAG_INIT_SHARED , errp); +#else +error_setg (errp,"guest-memfd=on requires KVM which is not enabled" ); + fd = -ENOSYS ; +#endif }else { fd = qemu_memfd_create(TYPE_MEMORY_BACKEND_MEMFD, backend->size, m->hugetlb, m->hugetlbsize, m->seal ?
tests/qtest/libqtest.c +2 -0
@@ -1165,6 +1165,7 @@ bool qtest_has_accel(const char *accel_name) g_autofree char *accel_type = NULL;if (g_str_equal (accel_name,"kvm" )) { +#ifdef CONFIG_KVM_TARGETS int i;const char *arch =qtest_get_arch ();const char *targets[] = {CONFIG_KVM_TARGETS };
@@ -1176,6 +1177,7 @@ bool qtest_has_accel(const char *accel_name) } } } +#endif return false; }
Signature · 1 line
2.56.1
[PULL 4/4] mc146818rtc: set PF even when PIE is clear
In reply to Paolo BonziniThe 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=1 so that the RTC does not count ticks with the periodic interrupt disabled as lost.
--- hw/rtc/mc146818rtc.c | 32 +++++++++++++++++++++--------- tests/qtest/rtc-test.c | 45 ++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 66 insertions(+), 11 deletions(-)
hw/rtc/mc146818rtc.c +23 -9
@@ -132,13 +132,7 @@ static void rtc_coalesced_timer(void *opaque)static uint32_t rtc_periodic_clock_ticks (MC146818RtcState *s) { -int period_code; - -if (!(s->cmos_data[RTC_REG_B ] ®_B_PIE )) { -return 0 ; - } - - period_code = s->cmos_data[RTC_REG_A ] &0x0f ; +int period_code = s->cmos_data[RTC_REG_A ] &0x0f ;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 =0 ; +/* +* 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 ] ®_B_PIE ) && + (s->cmos_data[RTC_REG_C ] ®_C_PF )) { +timer_del (s->periodic_timer); +return ; + } + period =rtc_periodic_clock_ticks (s); s->period = period;
@@ -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 ==LOST_TICK_POLICY_SLEW ) { +if (s->lost_tick_policy ==LOST_TICK_POLICY_SLEW && + (s->cmos_data[RTC_REG_B ] ®_B_PIE )) {uint32_t old_irq_coalesced = s->irq_coalesced; lost_clock += old_irq_coalesced * old_period;
@@ -226,8 +233,8 @@ static void rtc_periodic_timer(void *opaque) {MC146818RtcState *s = opaque; -periodic_timer_update (s, s->next_periodic_time, s->period, false); s->cmos_data[RTC_REG_C ] |=REG_C_PF ; +periodic_timer_update (s, s->next_periodic_time, s->period, false);if (s->cmos_data[RTC_REG_B ] ®_B_PIE ) { s->cmos_data[RTC_REG_C ] |=REG_C_IRQF ;if (s->lost_tick_policy ==LOST_TICK_POLICY_SLEW ) {
@@ -699,10 +706,17 @@ static uint64_t cmos_ioport_read(void *opaque, hwaddr addr, ret = s->cmos_data[s->cmos_index];qemu_irq_lower (s->irq); s->cmos_data[RTC_REG_C ] =0x00 ; + +/* Rearm the timers for bits that have been cleared. */ if (ret & (REG_C_UF |REG_C_AF )) {check_update_timer (s); } +if ((ret ®_C_PF ) && !(s->cmos_data[RTC_REG_B ] ®_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 ] ®_B_PIE ) && s->irq_reinject_on_ack_count <RTC_REINJECT_ON_ACK_COUNT ) {
tests/qtest/rtc-test.c +43 -2
63 lines not on this page · raw message
Signature · 1 line
2.56.1
Richard Henderson
AppliedQuoted 10 lines · Paolo Bonzini
The following changes since commit
08ed97c33c3818ef51a7c852347a28e9f66807b5:tests/tcg/i386: compile test-i386-blendv.c with -msse4.1 (2026-11-19 13:54:13 -0800)are available in the Git repository at:
https://gitlab.com/bonzini/qemu.git tags/for-upstream
for you to fetch changes up to
fe0cbc34d4273b82bbe6df38a2f12d61ec45f573:
Quoted 7 lines
mc146818rtc: set PF even when PIE is clear (2026-11-20 18:51:43 +0100)
----------------------------------------------------------------
* mc146818rtc: set PF even when PIE is clear
* i386/cpu: Remove AMX-TF32 CPUID bit from Diamond Rapids
* hostmem: allow building without KVM support
* target/i386/tcg: apply zero extension to 8- and 16-bit NDD destinations
Applied, thanks.
r~