Skip to contentSkip to conversation

i386, Rust for 2026-11-17

GIT PULL Applied Paolo Bonzini 3 participants 7 messages Nov 18 – Nov 19

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

The following changes since commit 6883fb508cb7a93e2e7b44c0582bfd9fc2196d4d:

Merge tag 'for-upstream' of https://repo.or.cz/qemu/kevin into staging (2026-11-17 13:09:47 -0800)

are available in the Git repository at:

https://gitlab.com/bonzini/qemu.git tags/for-upstream

for you to fetch changes up to 2b5920edfaff693acad867fe4a80149ea71d037b:

build: Add "-d keeprsp" to Ninja flags (2026-11-18 09:04:46 +0100)

v1->v2: fix author of "treat ENTER's size operand as unsigned",
add final patch

----------------------------------------------------------------
* target/i386/kvm: fix latched INIT lost in kvm_put_vcpu_events()
* target/i386/kvm: set VM ioctl KVM_SET_TSC_KHZ to maintain TSC synchronization
* target/i386/tcg: fix CPUID checks for TZCNT and LZCNT
* target/i386/tcg: reject VEX encodings of PBLENDVB, BLENDVPS and BLENDVPD
* target/i386/tcg: fix SETCC(zu) optimization
* target/i386/tcg: fix lea address calculation for CS register
* target/i386/tcg: Fix 64-bit RSP truncation on far transfers
* target/i386/tcg: all scalar instructions should be LIG
* target/i386/tcg: treat ENTER's size operand as unsigned
* target/i386/tcg: remove unused argument of decode_ops
* target/i386/tcg: remove unused operand sizes
* tests/tcg: fix load/restore for test-avx and test-mmx
* rust: fix failure with nightly libstd

----------------------------------------------------------------
Denis V. Lunev (1):
target/i386/kvm: fix latched INIT lost in kvm_put_vcpu_events()

Dongli Zhang (1):
target/i386/kvm: set VM ioctl KVM_SET_TSC_KHZ to maintain TSC synchronization

John Snow (1):
build: Add "-d keeprsp" to Ninja flags

Mark Cave-Ayland (1):
target/i386/tcg: fix lea address calculation for CS register

NickSampanis (3):
target/i386/tcg: Fix 64-bit RSP truncation on retf in 64-bit mode target/i386/tcg: Fix 64-bit RSP truncation on far call in 64-bit mode target/i386/tcg: Fix 64-bit RSP truncation on far call through a call gate

Paolo Bonzini (7):
target/i386/tcg: fix CPUID checks for TZCNT and LZCNT target/i386/tcg: reject VEX encodings of PBLENDVB, BLENDVPS and BLENDVPD target/i386/tcg: fix SETCC(zu) optimization
tests/tcg: fix load/restore for test-avx and test-mmx target/i386/tcg: all scalar instructions should be LIG target/i386/tcg: remove unused argument of decode_ops target/i386/tcg: remove unused operand sizes

Samuel Tardieu (1):
rust/common: rename IntegerExt::bit() to single_bit()

Zixin Wang (1):
target/i386/tcg: treat ENTER's size operand as unsigned

 Makefile                          |  2 +-
 target/i386/tcg/decode-new.h      |  7 ++--
 target/i386/kvm/kvm.c             | 19 ++++++++-
 target/i386/tcg/seg_helper.c      | 15 +++++--
 target/i386/tcg/translate.c       | 22 +++++++++-
 tests/tcg/i386/test-avx.c         | 22 +++++-----
 tests/tcg/i386/test-i386-blendv.c | 51 +++++++++++++++++++++++
 tests/tcg/i386/test-i386-enter.c  | 42 +++++++++++++++++++
 tests/tcg/i386/test-mmx.c         | 22 +++++-----
 target/i386/tcg/decode-new.c.inc  | 88 +++++++++++++++++++--------------------
 target/i386/tcg/emit.c.inc        |  8 ++++
 rust/common/src/bitops.rs         |  8 ++--
 tests/tcg/i386/meson.build        |  2 +
 tests/tcg/x86_64/meson.build      |  2 +
 14 files changed, 230 insertions(+), 80 deletions(-)
 create mode 100644 tests/tcg/i386/test-i386-blendv.c
 create mode 100644 tests/tcg/i386/test-i386-enter.c
Signature · 1 line
2.56.0
#1 lore raw

[PULL 14/16] target/i386/tcg: treat ENTER's size operand as unsigned

From: Zixin Wang <[email protected]>

The first immediate operand of ENTER is the size of the dynamic storage area and is unsigned. Decoding it as a signed immediate sign-extends values with bit 15 set, moving the stack pointer in the wrong direction.

Decode it with I_unsigned and add a regression test covering 32-bit and 64-bit guests.

Tested with a minimal x86_64-linux-user build; the new test fails before the change and passes after it.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/4643

---
 target/i386/tcg/translate.c      |  2 +-
 tests/tcg/i386/test-i386-enter.c | 42 ++++++++++++++++++++++++++++++++
 target/i386/tcg/decode-new.c.inc |  2 +-
 tests/tcg/i386/meson.build       |  1 +
 tests/tcg/x86_64/meson.build     |  1 +
 5 files changed, 46 insertions(+), 2 deletions(-)
 create mode 100644 tests/tcg/i386/test-i386-enter.c
target/i386/tcg/translate.c +1 -1
index d4ccddc33fd..719771032ff 100644
@@ -1989,7 +1989,7 @@ static void gen_popa(DisasContext *s)
     gen_stack_update(s, 8 * size);
 }
 
-static void gen_enter(DisasContext *s, int esp_addend, int level)
+static void gen_enter(DisasContext *s, uint16_t esp_addend, int level)
 {
     MemOp d_ot = mo_pushpop(s, s->dflag);
     MemOp a_ot = mo_stacksize(s);
tests/tcg/i386/test-i386-enter.c new file +42 -0

42 lines not on this page · raw message

target/i386/tcg/decode-new.c.inc +1 -1
index 19c76a12009..bd9a94b3162 100644
@@ -1972,7 +1972,7 @@ static const X86OpEntry opcodes_root[256] = {
     [0xBE] = X86_OP_ENTRYwr(MOV, LoBits,v, I,v),
     [0xBF] = X86_OP_ENTRYwr(MOV, LoBits,v, I,v),
 
-    [0xC8] = X86_OP_ENTRYrr(ENTER, I,w, I,b),
+    [0xC8] = X86_OP_ENTRYrr(ENTER, I_unsigned, w, I, b),
     [0xC9] = X86_OP_ENTRY0(LEAVE),
     [0xCA] = X86_OP_ENTRYr(RETF,  I,w),
     [0xCB] = X86_OP_ENTRY0(RETF),
tests/tcg/i386/meson.build +1 -0
index c912f37fab7..d2ba8410413 100644
@@ -37,6 +37,7 @@ tests += {
                '-lm', '-fno-pie', '-Wl,--no-warn-rwx-segments'],
   },
   'test-idiv-overflow.c': {},
+  'test-i386-enter.c': {'cflags': ['-O2', '-fomit-frame-pointer']},
   '../multiarch/sha512.c': {
      'exe_name': 'sha512-sse',
      'cflags': ['-msse4.1', '-O3'],
tests/tcg/x86_64/meson.build +1 -0
index 9738d04220b..1efb35cf2eb 100644
@@ -50,6 +50,7 @@ tests += {
   '../i386/test-i386-blendv.c': {},
   '../i386/test-i386-bmi2.c': {'cflags': ['-O2', '-fwrapv']},
   '../i386/test-idiv-overflow.c': {},
+  '../i386/test-i386-enter.c': {'cflags': ['-O2', '-fomit-frame-pointer']},
 }
 
 tests += {
Signature · 1 line
2.56.0
#2 lore raw

[PULL 16/16] build: Add "-d keeprsp" to Ninja flags

In reply to Paolo Bonzini

From: John Snow <[email protected]>

When auditing compilation, it is helpful to be able to see all of the object files passed during the linking step, which ninja can obscure behind temporary .rsp "response files". Normally, these are deleted immediately afterwards - but for debugging purposes, it is helpful to leave them behind to understand what went wrong.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index 54547a37b1a..9dda1b3c89a 100644
@@ -151,7 +151,7 @@ NINJAFLAGS = \
         $(filter-out -j, \
           $(or $(filter -l% -j%, $(MAKEFLAGS)), \
                $(if $(filter --jobserver-auth=%, $(MAKEFLAGS)),, -j1))) \
-        -d keepdepfile
+        -d keepdepfile $(if $(DEBUG),-d keeprsp)
 ninja-cmd-goals += $(or $(MAKECMDGOALS), all)
 ninja-cmd-goals += $(foreach g, $(MAKECMDGOALS), $(.ninja-goals.$g))
 
Signature · 1 line
2.56.0
#3 lore raw
In reply to Paolo Bonzini
Quoted 15 lines · Paolo Bonzini

The following changes since commit 6883fb508cb7a93e2e7b44c0582bfd9fc2196d4d:

   Merge tag 'for-upstream' ofhttps://repo.or.cz/qemu/kevin into staging (2026-11-17 13:09:47 -0800)

are available in the Git repository at:

https://gitlab.com/bonzini/qemu.git tags/for-upstream

for you to fetch changes up to 2b5920edfaff693acad867fe4a80149ea71d037b:

build: Add "-d keeprsp" to Ninja flags (2026-11-18 09:04:46 +0100)

v1->v2: fix author of "treat ENTER's size operand as unsigned",
add final patch

Quoted 14 lines

----------------------------------------------------------------
* target/i386/kvm: fix latched INIT lost in kvm_put_vcpu_events()
* target/i386/kvm: set VM ioctl KVM_SET_TSC_KHZ to maintain TSC synchronization
* target/i386/tcg: fix CPUID checks for TZCNT and LZCNT
* target/i386/tcg: reject VEX encodings of PBLENDVB, BLENDVPS and BLENDVPD
* target/i386/tcg: fix SETCC(zu) optimization
* target/i386/tcg: fix lea address calculation for CS register
* target/i386/tcg: Fix 64-bit RSP truncation on far transfers
* target/i386/tcg: all scalar instructions should be LIG
* target/i386/tcg: treat ENTER's size operand as unsigned
* target/i386/tcg: remove unused argument of decode_ops
* target/i386/tcg: remove unused operand sizes
* tests/tcg: fix load/restore for test-avx and test-mmx
* rust: fix failure with nightly libstd

Applied, thanks.

r~

#4 lore raw
In reply to Paolo Bonzini
Quoted 5 lines · Paolo Bonzini

* target/i386/kvm: fix latched INIT lost in kvm_put_vcpu_events()
* target/i386/kvm: set VM ioctl KVM_SET_TSC_KHZ to maintain TSC synchronization
* target/i386/tcg: fix CPUID checks for TZCNT and LZCNT
* target/i386/tcg: reject VEX encodings of PBLENDVB, BLENDVPS and BLENDVPD
* target/i386/tcg: fix SETCC(zu) optimization

Quoted 8 lines

* target/i386/tcg: fix lea address calculation for CS register
* target/i386/tcg: Fix 64-bit RSP truncation on far transfers
* target/i386/tcg: all scalar instructions should be LIG
* target/i386/tcg: treat ENTER's size operand as unsigned
* target/i386/tcg: remove unused argument of decode_ops
* target/i386/tcg: remove unused operand sizes
* tests/tcg: fix load/restore for test-avx and test-mmx
* rust: fix failure with nightly libstd

Hi!

From this PullRequest I'm picking up 2 changes for the stable series --

target/i386/kvm: fix latched INIT lost in kvm_put_vcpu_events() target/i386/tcg: treat ENTER's size operand as unsigned

But it feels like some other fixes should be picked up too.

For example, should I pick the 64-bit RP truncation fixes?

The "target/i386/tcg: fix lea address calculation for CS register" change feels like a good candidate for 11.1.x.

Maybe some fixes by Paolo.

What do you think?

Thanks,

/mjt

Quoted 32 lines

----------------------------------------------------------------
Denis V. Lunev (1):
target/i386/kvm: fix latched INIT lost in kvm_put_vcpu_events()

Dongli Zhang (1):
target/i386/kvm: set VM ioctl KVM_SET_TSC_KHZ to maintain TSC synchronization

John Snow (1):
build: Add "-d keeprsp" to Ninja flags

Mark Cave-Ayland (1):
target/i386/tcg: fix lea address calculation for CS register

NickSampanis (3):
target/i386/tcg: Fix 64-bit RSP truncation on retf in 64-bit mode target/i386/tcg: Fix 64-bit RSP truncation on far call in 64-bit mode target/i386/tcg: Fix 64-bit RSP truncation on far call through a call gate

Paolo Bonzini (7):
target/i386/tcg: fix CPUID checks for TZCNT and LZCNT target/i386/tcg: reject VEX encodings of PBLENDVB, BLENDVPS and BLENDVPD target/i386/tcg: fix SETCC(zu) optimization
tests/tcg: fix load/restore for test-avx and test-mmx target/i386/tcg: all scalar instructions should be LIG target/i386/tcg: remove unused argument of decode_ops target/i386/tcg: remove unused operand sizes

Samuel Tardieu (1):
rust/common: rename IntegerExt::bit() to single_bit()

Zixin Wang (1):
target/i386/tcg: treat ENTER's size operand as unsigned

#5 lore raw
Quoted 11 lines · Michael Tokarev

From this PullRequest I'm picking up 2 changes for the stable series --

  target/i386/kvm: fix latched INIT lost in kvm_put_vcpu_events() target/i386/tcg: treat ENTER's size operand as unsigned

But it feels like some other fixes should be picked up too.

For example, should I pick the 64-bit RP truncation fixes?

The "target/i386/tcg: fix lea address calculation for CS register" change feels like a good candidate for 11.1.x.

I would pick, in order of importance

- fix lea address calculation (this one is the only regression and I should have Cc'd qemu-stable indeed)
- fix load/restore for test-avx and test-mmx (otherwise the test is broken)
- set VM ioctl KVM_SET_TSC_KHZ
- fix latched INIT lost

If you really want, the 64-bit RSP fixes can go in too, but the other TCG fixes are corner cases that we don't really care about.

Paolo

#6 lore raw
Quoted 5 lines · Paolo Bonzini

I would pick, in order of importance

- fix lea address calculation (this one is the only regression and I should have Cc'd qemu-stable indeed)
- fix load/restore for test-avx and test-mmx (otherwise the test is broken)
- set VM ioctl KVM_SET_TSC_KHZ

I looked at this one. Unfortunately it does not apply to 10.0.x due to lack of other infrastructure there: kvm_arch_pre_create_vcpu() and subsequent KVM_PMU_CAP_DISABLE changes. It would be good to have it in an LTS series though.

Quoted 3 lines

- fix latched INIT lost

If you really want, the 64-bit RSP fixes can go in too, but the other TCG fixes are corner cases that we don't really care about.

Heh. I already picked up "treat ENTER's size operand as unsigned", it shouldn't be that bad even if don't care about these corner case. Also 4e61c4bb175d9 "target/i386: raise #DE for INT_MIN / -1 in IDIV helpers".

Thank you for the hints!

/mjt