qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 9d38d9: i386/sev: Don't allow automatic fallb


From: Richard Henderson
Subject: [Qemu-commits] [qemu/qemu] 9d38d9: i386/sev: Don't allow automatic fallback to legacy...
Date: Tue, 16 Jul 2024 22:46:13 -0700

  Branch: refs/heads/staging
  Home:   https://github.com/qemu/qemu
  Commit: 9d38d9dca2a81aaf5752d45d221021ef96d496cd
      
https://github.com/qemu/qemu/commit/9d38d9dca2a81aaf5752d45d221021ef96d496cd
  Author: Michael Roth <michael.roth@amd.com>
  Date:   2024-07-16 (Tue, 16 Jul 2024)

  Changed paths:
    M hw/i386/pc.c
    M qapi/qom.json
    M target/i386/sev.c

  Log Message:
  -----------
  i386/sev: Don't allow automatic fallback to legacy KVM_SEV*_INIT

Currently if the 'legacy-vm-type' property of the sev-guest object is
'on', QEMU will attempt to use the newer KVM_SEV_INIT2 kernel
interface in conjunction with the newer KVM_X86_SEV_VM and
KVM_X86_SEV_ES_VM KVM VM types.

This can lead to measurement changes if, for instance, an SEV guest was
created on a host that originally had an older kernel that didn't
support KVM_SEV_INIT2, but is booted on the same host later on after the
host kernel was upgraded.

Instead, if legacy-vm-type is 'off', QEMU should fail if the
KVM_SEV_INIT2 interface is not provided by the current host kernel.
Modify the fallback handling accordingly.

In the future, VMSA features and other flags might be added to QEMU
which will require legacy-vm-type to be 'off' because they will rely
on the newer KVM_SEV_INIT2 interface. It may be difficult to convey to
users what values of legacy-vm-type are compatible with which
features/options, so as part of this rework, switch legacy-vm-type to a
tri-state OnOffAuto option. 'auto' in this case will automatically
switch to using the newer KVM_SEV_INIT2, but only if it is required to
make use of new VMSA features or other options only available via
KVM_SEV_INIT2.

Defining 'auto' in this way would avoid inadvertantly breaking
compatibility with older kernels since it would only be used in cases
where users opt into newer features that are only available via
KVM_SEV_INIT2 and newer kernels, and provide better default behavior
than the legacy-vm-type=off behavior that was previously in place, so
make it the default for 9.1+ machine types.

Cc: Daniel P. Berrangé <berrange@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
cc: kvm@vger.kernel.org
Signed-off-by: Michael Roth <michael.roth@amd.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Link: https://lore.kernel.org/r/20240710041005.83720-1-michael.roth@amd.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: e0bf95443ee9326d44031373420cf9f3513ee255
      
https://github.com/qemu/qemu/commit/e0bf95443ee9326d44031373420cf9f3513ee255
  Author: Sergey Dyasli <sergey.dyasli@nutanix.com>
  Date:   2024-07-16 (Tue, 16 Jul 2024)

  Changed paths:
    M chardev/char-io.c

  Log Message:
  -----------
  Revert "qemu-char: do not operate on sources from finalize callbacks"

This reverts commit 2b316774f60291f57ca9ecb6a9f0712c532cae34.

After 038b4217884c ("Revert "chardev: use a child source for qio input
source"") we've been observing the "iwp->src == NULL" assertion
triggering periodically during the initial capabilities querying by
libvirtd. One of possible backtraces:

Thread 1 (Thread 0x7f16cd4f0700 (LWP 43858)):
0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
1  0x00007f16c6c21e65 in __GI_abort () at abort.c:79
2  0x00007f16c6c21d39 in __assert_fail_base  at assert.c:92
3  0x00007f16c6c46e86 in __GI___assert_fail 
(assertion=assertion@entry=0x562e9bcdaadd "iwp->src == NULL", 
file=file@entry=0x562e9bcdaac8 "../chardev/char-io.c", line=line@entry=99, 
function=function@entry=0x562e9bcdab10 <__PRETTY_FUNCTION__.20549> 
"io_watch_poll_finalize") at assert.c:101
4  0x0000562e9ba20c2c in io_watch_poll_finalize (source=<optimized out>) at 
../chardev/char-io.c:99
5  io_watch_poll_finalize (source=<optimized out>) at ../chardev/char-io.c:88
6  0x00007f16c904aae0 in g_source_unref_internal () from /lib64/libglib-2.0.so.0
7  0x00007f16c904baf9 in g_source_destroy_internal () from 
/lib64/libglib-2.0.so.0
8  0x0000562e9ba20db0 in io_remove_watch_poll (source=0x562e9d6720b0) at 
../chardev/char-io.c:147
9  remove_fd_in_watch (chr=chr@entry=0x562e9d5f3800) at ../chardev/char-io.c:153
10 0x0000562e9ba23ffb in update_ioc_handlers (s=0x562e9d5f3800) at 
../chardev/char-socket.c:592
11 0x0000562e9ba2072f in qemu_chr_fe_set_handlers_full at 
../chardev/char-fe.c:279
12 0x0000562e9ba207a9 in qemu_chr_fe_set_handlers at ../chardev/char-fe.c:304
13 0x0000562e9ba2ca75 in monitor_qmp_setup_handlers_bh (opaque=0x562e9d4c2c60) 
at ../monitor/qmp.c:509
14 0x0000562e9bb6222e in aio_bh_poll (ctx=ctx@entry=0x562e9d4c2f20) at 
../util/async.c:216
15 0x0000562e9bb4de0a in aio_poll (ctx=0x562e9d4c2f20, 
blocking=blocking@entry=true) at ../util/aio-posix.c:722
16 0x0000562e9b99dfaa in iothread_run (opaque=0x562e9d4c26f0) at 
../iothread.c:63
17 0x0000562e9bb505a4 in qemu_thread_start (args=0x562e9d4c7ea0) at 
../util/qemu-thread-posix.c:543
18 0x00007f16c70081ca in start_thread (arg=<optimized out>) at 
pthread_create.c:479
19 0x00007f16c6c398d3 in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:95

io_remove_watch_poll(), which makes sure that iwp->src is NULL, calls
g_source_destroy() which finds that iwp->src is not NULL in the finalize
callback. This can only happen if another thread has managed to trigger
io_watch_poll_prepare() callback in the meantime.

Move iwp->src destruction back to the finalize callback to prevent the
described race, and also remove the stale comment. The deadlock glib bug
was fixed back in 2010 by b35820285668 ("gmain: move finalization of
GSource outside of context lock").

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Sergey Dyasli <sergey.dyasli@nutanix.com>
Link: 
https://lore.kernel.org/r/20240712092659.216206-1-sergey.dyasli@nutanix.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: f8b64d35a625e49ee73f7d54ae80cb5503be975b
      
https://github.com/qemu/qemu/commit/f8b64d35a625e49ee73f7d54ae80cb5503be975b
  Author: Akihiko Odaki <akihiko.odaki@daynix.com>
  Date:   2024-07-16 (Tue, 16 Jul 2024)

  Changed paths:
    M cpu-common.c
    M hw/core/cpu-common.c
    M include/hw/core/cpu.h

  Log Message:
  -----------
  cpu: Free queued CPU work

Running qemu-system-aarch64 -M virt -nographic and terminating it will
result in a LeakSanitizer error due to remaining queued CPU work so
free it.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Link: https://lore.kernel.org/r/20240714-cpu-v1-1-19c2f8de2055@daynix.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: 9971cbac2f30a89ddb094dc9627d2d16dc6e5875
      
https://github.com/qemu/qemu/commit/9971cbac2f30a89ddb094dc9627d2d16dc6e5875
  Author: Gustavo Romero <gustavo.romero@linaro.org>
  Date:   2024-07-16 (Tue, 16 Jul 2024)

  Changed paths:
    M include/disas/capstone.h

  Log Message:
  -----------
  disas: Fix build against Capstone v6

Capstone v6 made major changes, such as renaming for AArch64, which
broke programs using the old headers, like QEMU. However, Capstone v6
provides the CAPSTONE_AARCH64_COMPAT_HEADER compatibility definition
allowing to build against v6 with the old definitions, so fix the QEMU
build using it.

We can lift that definition and switch to the new naming once our
supported distros have Capstone v6 in place.

Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Link: 
https://lore.kernel.org/r/20240715213943.1210355-1-gustavo.romero@linaro.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: a4975023fb13cf229bd59c9ceec1b8cbdc5b9a20
      
https://github.com/qemu/qemu/commit/a4975023fb13cf229bd59c9ceec1b8cbdc5b9a20
  Author: Fiona Ebner <f.ebner@proxmox.com>
  Date:   2024-07-16 (Tue, 16 Jul 2024)

  Changed paths:
    M hw/scsi/lsi53c895a.c

  Log Message:
  -----------
  hw/scsi/lsi53c895a: bump instruction limit in scripts processing to fix 
regression

Commit 9876359990 ("hw/scsi/lsi53c895a: add timer to scripts
processing") reduced the maximum allowed instruction count by
a factor of 100 all the way down to 100.

This causes the "Check Point R81.20 Gaia" appliance [0] to fail to
boot after fully finishing the installation via the appliance's web
interface (there is already one reboot before that).

With a limit of 150, the appliance still fails to boot, while with a
limit of 200, it works. Bump to 500 to fix the regression and be on
the safe side.

Originally reported in the Proxmox community forum[1].

[0]: https://support.checkpoint.com/results/download/124397
[1]: https://forum.proxmox.com/threads/149772/post-683459

Cc: qemu-stable@nongnu.org
Fixes: 9876359990 ("hw/scsi/lsi53c895a: add timer to scripts processing")
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Acked-by: Sven Schnelle <svens@stackframe.org>
Link: https://lore.kernel.org/r/20240715131403.223239-1-f.ebner@proxmox.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: 57a8a80d1a5b28797b21d30bfc60601945820e51
      
https://github.com/qemu/qemu/commit/57a8a80d1a5b28797b21d30bfc60601945820e51
  Author: Fiona Ebner <f.ebner@proxmox.com>
  Date:   2024-07-16 (Tue, 16 Jul 2024)

  Changed paths:
    M hw/scsi/scsi-bus.c

  Log Message:
  -----------
  scsi: fix regression and honor bootindex again for legacy drives

Commit 3089637461 ("scsi: Don't ignore most usb-storage properties")
removed the call to object_property_set_int() and thus the 'set'
method for the bootindex property was also not called anymore. Here
that method is device_set_bootindex() (as configured by
scsi_dev_instance_init() -> device_add_bootindex_property()) which as
a side effect registers the device via add_boot_device_path().

As reported by a downstream user [0], the bootindex property did not
have the desired effect anymore for legacy drives. Fix the regression
by explicitly calling the add_boot_device_path() function after
checking that the bootindex is not yet used (to avoid
add_boot_device_path() calling exit()).

[0]: https://forum.proxmox.com/threads/149772/post-679433

Cc: qemu-stable@nongnu.org
Fixes: 3089637461 ("scsi: Don't ignore most usb-storage properties")
Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Link: https://lore.kernel.org/r/20240710152529.1737407-1-f.ebner@proxmox.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: d16ccfea238e51a17650c6e32f7c4a1e43cfaa09
      
https://github.com/qemu/qemu/commit/d16ccfea238e51a17650c6e32f7c4a1e43cfaa09
  Author: Song Gao <gaosong@loongson.cn>
  Date:   2024-07-16 (Tue, 16 Jul 2024)

  Changed paths:
    M include/qemu/timer.h

  Log Message:
  -----------
  qemu/timer: Add host ticks function for LoongArch

Signed-off-by: Song Gao <gaosong@loongson.cn>
Link: https://lore.kernel.org/r/20240716031500.4193498-1-gaosong@loongson.cn
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: de12ebfdabe224597f624827ad57348b83e7d88a
      
https://github.com/qemu/qemu/commit/de12ebfdabe224597f624827ad57348b83e7d88a
  Author: Boqiao Fu <bfu@redhat.com>
  Date:   2024-07-16 (Tue, 16 Jul 2024)

  Changed paths:
    M qemu-options.hx

  Log Message:
  -----------
  docs: Update description of 'user=username' for '-run-with'

The description of '-runas' and '-run-with' didn't explain that QEMU
will use setuid/setgid to implement the option, so the user might get
confused if using 'elevateprivileges=deny' as well.

Since '-runas' is going to be deprecated and replaced by '-run-with'
in the coming qemu9.1, add the message there.

Signed-off-by: Boqiao Fu <bfu@redhat.com>
Link: 
https://lore.kernel.org/r/CAFRHJ6J9uMk+HMZL+W+KE1yoRCOLPgbPUVVDku55sdXYiGXXHg@mail.gmail.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: c9669d6d5741f7aa86e160c5e42979f90d25d168
      
https://github.com/qemu/qemu/commit/c9669d6d5741f7aa86e160c5e42979f90d25d168
  Author: Paolo Bonzini <pbonzini@redhat.com>
  Date:   2024-07-16 (Tue, 16 Jul 2024)

  Changed paths:
    M hw/timer/hpet.c

  Log Message:
  -----------
  hpet: fix clamping of period

When writing a new period, the clamping should use a maximum value
rather tyhan a bit mask.  Also, when writing the high bits new_val
is shifted right by 32, so the maximum allowed period should also
be shifted right.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: 340627ec14968d64cfa3dd12d0e998639f227c49
      
https://github.com/qemu/qemu/commit/340627ec14968d64cfa3dd12d0e998639f227c49
  Author: Paolo Bonzini <pbonzini@redhat.com>
  Date:   2024-07-16 (Tue, 16 Jul 2024)

  Changed paths:
    M hw/timer/hpet.c

  Log Message:
  -----------
  hpet: fix HPET_TN_SETVAL for high 32-bits of the comparator

Commit 3787324101b ("hpet: Fix emulation of HPET_TN_SETVAL (Jan Kiszka)",
2009-04-17) applied the fix only to the low 32-bits of the comparator, but
it should be done for the high bits as well.  Otherwise, the high 32-bits
of the comparator cannot be written and they remain fixed to 0xffffffff.

Co-developed-by: TaiseiIto <taisei1212@outlook.jp>
Signed-off-by: TaiseiIto <taisei1212@outlook.jp>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: 3afc6539a84d3d003025c9352a0596dbcb350ff4
      
https://github.com/qemu/qemu/commit/3afc6539a84d3d003025c9352a0596dbcb350ff4
  Author: Paolo Bonzini <pbonzini@redhat.com>
  Date:   2024-07-16 (Tue, 16 Jul 2024)

  Changed paths:
    M target/i386/tcg/decode-new.c.inc
    M target/i386/tcg/emit.c.inc

  Log Message:
  -----------
  target/i386/tcg: fix POP to memory in long mode

In long mode, POP to memory will write a full 64-bit value.  However,
the call to gen_writeback() in gen_POP will use MO_32 because the
decoding table is incorrect.

The bug was latent until commit aea49fbb01a ("target/i386: use gen_writeback()
within gen_POP()", 2024-06-08), and then became visible because gen_op_st_v
now receives op->ot instead of the "ot" returned by gen_pop_T0.

Analyzed-by: Clément Chigot <chigot@adacore.com>
Fixes: 5e9e21bcc4d ("target/i386: move 60-BF opcodes to new decoder", 
2024-05-07)
Tested-by: Clément Chigot <chigot@adacore.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: a7cf4949938743e9ecb73efcb51d27bd18d3c3fa
      
https://github.com/qemu/qemu/commit/a7cf4949938743e9ecb73efcb51d27bd18d3c3fa
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2024-07-16 (Tue, 16 Jul 2024)

  Changed paths:
    M target/i386/tcg/seg_helper.c

  Log Message:
  -----------
  target/i386/tcg: Remove SEG_ADDL

This truncation is now handled by MMU_*32_IDX.  The introduction of
MMU_*32_IDX in fact applied correct 32-bit wraparound to 16-bit accesses
with a high segment base (e.g.  big real mode or vm86 mode), which did
not use SEG_ADDL.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Link: 
https://lore.kernel.org/r/20240617161210.4639-3-richard.henderson@linaro.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: 0bd385e7e3c33e987d7a8879918be6df7b111ac4
      
https://github.com/qemu/qemu/commit/0bd385e7e3c33e987d7a8879918be6df7b111ac4
  Author: Paolo Bonzini <pbonzini@redhat.com>
  Date:   2024-07-16 (Tue, 16 Jul 2024)

  Changed paths:
    M target/i386/tcg/seg_helper.c

  Log Message:
  -----------
  target/i386/tcg: Allow IRET from user mode to user mode with SMAP

This fixes a bug wherein i386/tcg assumed an interrupt return using
the IRET instruction was always returning from kernel mode to either
kernel mode or user mode. This assumption is violated when IRET is used
as a clever way to restore thread state, as for example in the dotnet
runtime. There, IRET returns from user mode to user mode.

This bug is that stack accesses from IRET and RETF, as well as accesses
to the parameters in a call gate, are normal data accesses using the
current CPL.  This manifested itself as a page fault in the guest Linux
kernel due to SMAP preventing the access.

This bug appears to have been in QEMU since the beginning.

Analyzed-by: Robert R. Henry <rrh.henry@gmail.com>
Co-developed-by: Robert R. Henry <rrh.henry@gmail.com>
Signed-off-by: Robert R. Henry <rrh.henry@gmail.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: 312ef3243e3bae07e49314efb2854f6f17080ec5
      
https://github.com/qemu/qemu/commit/312ef3243e3bae07e49314efb2854f6f17080ec5
  Author: Paolo Bonzini <pbonzini@redhat.com>
  Date:   2024-07-16 (Tue, 16 Jul 2024)

  Changed paths:
    M target/i386/tcg/seg_helper.c

  Log Message:
  -----------
  target/i386/tcg: use PUSHL/PUSHW for error code

Do not pre-decrement esp, let the macros subtract the appropriate
operand size.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: 059368bcf589f4c6cba860516f57cec0b51c1fa1
      
https://github.com/qemu/qemu/commit/059368bcf589f4c6cba860516f57cec0b51c1fa1
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2024-07-16 (Tue, 16 Jul 2024)

  Changed paths:
    M target/i386/tcg/seg_helper.c

  Log Message:
  -----------
  target/i386/tcg: Reorg push/pop within seg_helper.c

Interrupts and call gates should use accesses with the DPL as
the privilege level.  While computing the applicable MMU index
is easy, the harder thing is how to plumb it in the code.

One possibility could be to add a single argument to the PUSH* macros
for the privilege level, but this is repetitive and risks confusion
between the involved privilege levels.

Another possibility is to pass both CPL and DPL, and adjusting both
PUSH* and POP* to use specific privilege levels (instead of using
cpu_{ld,st}*_data). This makes the code more symmetric.

However, a more complicated but much nicer approach is to use a structure
to contain the stack parameters, env, unwind return address, and rewrite
the macros into functions.  The struct provides an easy home for the MMU
index as well.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Link: 
https://lore.kernel.org/r/20240617161210.4639-4-richard.henderson@linaro.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: fffe424b38340428f50111713c20d54b46101c7d
      
https://github.com/qemu/qemu/commit/fffe424b38340428f50111713c20d54b46101c7d
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2024-07-16 (Tue, 16 Jul 2024)

  Changed paths:
    M target/i386/cpu.c
    M target/i386/cpu.h

  Log Message:
  -----------
  target/i386/tcg: Introduce x86_mmu_index_{kernel_,}pl

Disconnect mmu index computation from the current pl
as stored in env->hflags.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Link: 
https://lore.kernel.org/r/20240617161210.4639-2-richard.henderson@linaro.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: 8053862af969a934dca67da9b38992e48fa1a95d
      
https://github.com/qemu/qemu/commit/8053862af969a934dca67da9b38992e48fa1a95d
  Author: Paolo Bonzini <pbonzini@redhat.com>
  Date:   2024-07-16 (Tue, 16 Jul 2024)

  Changed paths:
    M target/i386/tcg/seg_helper.c

  Log Message:
  -----------
  target/i386/tcg: Compute MMU index once

Add the MMU index to the StackAccess struct, so that it can be cached
or (in the next patch) computed from information that is not in
CPUX86State.

Co-developed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: 05d41bbcb34ee30465517229a888da93666b4f3f
      
https://github.com/qemu/qemu/commit/05d41bbcb34ee30465517229a888da93666b4f3f
  Author: Paolo Bonzini <pbonzini@redhat.com>
  Date:   2024-07-16 (Tue, 16 Jul 2024)

  Changed paths:
    M target/i386/tcg/seg_helper.c

  Log Message:
  -----------
  target/i386/tcg: check for correct busy state before switching to a new task

This step is listed in the Intel manual: "Checks that the new task is available
(call, jump, exception, or interrupt) or busy (IRET return)".

The AMD manual lists the same operation under the "Preventing recursion"
paragraph of "12.3.4 Nesting Tasks", though it is not clear if the processor
checks the busy bit in the IRET case.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: 8b131065080af3cf2dda04e4e190c5a74fec2f31
      
https://github.com/qemu/qemu/commit/8b131065080af3cf2dda04e4e190c5a74fec2f31
  Author: Paolo Bonzini <pbonzini@redhat.com>
  Date:   2024-07-16 (Tue, 16 Jul 2024)

  Changed paths:
    M target/i386/tcg/seg_helper.c

  Log Message:
  -----------
  target/i386/tcg: use X86Access for TSS access

This takes care of probing the vaddr range in advance, and is also faster
because it avoids repeated TLB lookups.  It also matches the Intel manual
better, as it says "Checks that the current (old) TSS, new TSS, and all
segment descriptors used in the task switch are paged into system memory";
note however that it's not clear how the processor checks for segment
descriptors, and this check is not included in the AMD manual.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: 6a079f2e68e1832ebca0e7d64bc31ffebde9b2dd
      
https://github.com/qemu/qemu/commit/6a079f2e68e1832ebca0e7d64bc31ffebde9b2dd
  Author: Paolo Bonzini <pbonzini@redhat.com>
  Date:   2024-07-16 (Tue, 16 Jul 2024)

  Changed paths:
    M target/i386/tcg/seg_helper.c

  Log Message:
  -----------
  target/i386/tcg: save current task state before loading new one

This is how the steps are ordered in the manual.  EFLAGS.NT is
overwritten after the fact in the saved image.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>


  Commit: 58ee924b97d1c0898555647a31820c5a20d55a73
      
https://github.com/qemu/qemu/commit/58ee924b97d1c0898555647a31820c5a20d55a73
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2024-07-17 (Wed, 17 Jul 2024)

  Changed paths:
    M chardev/char-io.c
    M cpu-common.c
    M hw/core/cpu-common.c
    M hw/i386/pc.c
    M hw/scsi/lsi53c895a.c
    M hw/scsi/scsi-bus.c
    M hw/timer/hpet.c
    M include/disas/capstone.h
    M include/hw/core/cpu.h
    M include/qemu/timer.h
    M qapi/qom.json
    M qemu-options.hx
    M target/i386/cpu.c
    M target/i386/cpu.h
    M target/i386/sev.c
    M target/i386/tcg/decode-new.c.inc
    M target/i386/tcg/emit.c.inc
    M target/i386/tcg/seg_helper.c

  Log Message:
  -----------
  Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging

* target/i386/tcg: fixes for seg_helper.c
* SEV: Don't allow automatic fallback to legacy KVM_SEV_INIT,
  but also don't use it by default
* scsi: honor bootindex again for legacy drives
* hpet, utils, scsi, build, cpu: miscellaneous bugfixes

# -----BEGIN PGP SIGNATURE-----
#
# iQFIBAABCAAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmaWoP0UHHBib256aW5p
# QHJlZGhhdC5jb20ACgkQv/vSX3jHroOqfggAg3jxUp6B8dFTEid5aV6qvT4M6nwD
# TAYcAl5kRqTOklEmXiPCoA5PeS0rbr+5xzWLAKgkumjCVXbxMoYSr0xJHVuDwQWv
# XunUm4kpxJBLKK3uTGAIW9A21thOaA5eAoLIcqu2smBMU953TBevMqA7T67h22rp
# y8NnZWWdyQRH0RAaWsCBaHVkkf+DuHSG5LHMYhkdyxzno+UWkTADFppVhaDO78Ba
# Egk49oMO+G6of4+dY//p1OtAkAf4bEHePKgxnbZePInJrkgHzr0TJWf9gERWFzdK
# JiM0q6DeqopZm+vENxS+WOx7AyDzdN0qOrf6t9bziXMg0Rr2Z8bu01yBCQ==
# =cZhV
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 17 Jul 2024 02:34:05 AM AEST
# gpg:                using RSA key F13338574B662389866C7682BFFBD25F78C7AE83
# gpg:                issuer "pbonzini@redhat.com"
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full]
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>" [full]

* tag 'for-upstream' of https://gitlab.com/bonzini/qemu:
  target/i386/tcg: save current task state before loading new one
  target/i386/tcg: use X86Access for TSS access
  target/i386/tcg: check for correct busy state before switching to a new task
  target/i386/tcg: Compute MMU index once
  target/i386/tcg: Introduce x86_mmu_index_{kernel_,}pl
  target/i386/tcg: Reorg push/pop within seg_helper.c
  target/i386/tcg: use PUSHL/PUSHW for error code
  target/i386/tcg: Allow IRET from user mode to user mode with SMAP
  target/i386/tcg: Remove SEG_ADDL
  target/i386/tcg: fix POP to memory in long mode
  hpet: fix HPET_TN_SETVAL for high 32-bits of the comparator
  hpet: fix clamping of period
  docs: Update description of 'user=username' for '-run-with'
  qemu/timer: Add host ticks function for LoongArch
  scsi: fix regression and honor bootindex again for legacy drives
  hw/scsi/lsi53c895a: bump instruction limit in scripts processing to fix 
regression
  disas: Fix build against Capstone v6
  cpu: Free queued CPU work
  Revert "qemu-char: do not operate on sources from finalize callbacks"
  i386/sev: Don't allow automatic fallback to legacy KVM_SEV*_INIT

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


Compare: https://github.com/qemu/qemu/compare/e2f346aa9864...58ee924b97d1

To unsubscribe from these emails, change your notification settings at 
https://github.com/qemu/qemu/settings/notifications



reply via email to

[Prev in Thread] Current Thread [Next in Thread]