From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [PATCH v2 0/3] target/i386: allow using named CPU modeles with user mode emulation
Date: Mon, 26 Jun 2023 10:33:14 +0200 [thread overview]
Message-ID: <20230626083317.144746-1-pbonzini@redhat.com> (raw)
When running qemu-i386 even with -cpu Nehalem (aka x86_64-v2), it raises the
warning
TCG doesn't support requested feature: CPUID.80000001H:EDX.lm [bit 29]
Likewise using qemu-x86_64 with -cpu Haswell, it raises warnings for
TCG doesn't support requested feature: CPUID.01H:ECX.pcid [bit 17]
TCG doesn't support requested feature: CPUID.01H:ECX.x2apic [bit 21]
TCG doesn't support requested feature: CPUID.01H:ECX.tsc-deadline [bit 24]
TCG doesn't support requested feature: CPUID.07H:EBX.invpcid [bit 10]
Even though x86_64-v3 is the level that qemu-user is supposed to provide.
These are two related problems:
- for Haswell, the 4 missing features are only relevant to code running
in kernel mode; we can ignore them and mark them as supported even
though they are not. The supported features are only used to print
the warnings
- for qemu-i386, the issue is that this emulator is restricted to running
programs on a 32-bit processor, even though it is actually emulating
programs that use the 32-bit kernel ABI on any processor. The behavior
the processor in compatibility (32-bit CS, EFER.LMA=1) mode is mostly
the same as when EFER.LMA=0 and the little code that is needed to handle
64-bit ring-0 is even present in the qemu-i386 binary, just hidden
behind checks for HF_LMA_MASK. So, LM can also be treated as a feature
that is only relevant in kernel mode; not entirely, so this cannot yet
be extended to bsd-user, but the required changes are minimal.
Other CPU models have warnings for the ARCH_CAPABILITIES MSR; hide
them as well in a similar manner.
Based-on: <20230623131711.96775-1-pbonzini@redhat.com>
Paolo Bonzini (3):
target/i386: ignore ARCH_CAPABILITIES features in user mode emulation
target/i386: ignore CPL0-specific features in user mode emulation
target/i386: emulate 64-bit ring 0 for linux-user if LM feature is set
linux-user/i386/cpu_loop.c | 57 ++++++++++----------
target/i386/cpu.c | 103 +++++++++++++++++++++++++++++++++---
target/i386/tcg/translate.c | 6 ++-
3 files changed, 126 insertions(+), 40 deletions(-)
--
2.41.0
next reply other threads:[~2023-06-26 8:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-26 8:33 Paolo Bonzini [this message]
2023-06-26 8:33 ` [PATCH v2 1/3] target/i386: ignore ARCH_CAPABILITIES features in user mode emulation Paolo Bonzini
2023-06-26 10:04 ` Richard Henderson
2023-06-26 8:33 ` [PATCH v2 2/3] target/i386: ignore CPL0-specific " Paolo Bonzini
2023-06-26 10:04 ` Richard Henderson
2023-06-26 8:33 ` [PATCH v2 3/3] target/i386: emulate 64-bit ring 0 for linux-user if LM feature is set Paolo Bonzini
2023-06-26 9:20 ` [PATCH v2 0/3] target/i386: allow using named CPU modeles with user mode emulation Daniel P. Berrangé
2023-06-26 9:27 ` Paolo Bonzini
2023-06-26 9:36 ` Daniel P. Berrangé
2023-06-26 9:37 ` Paolo Bonzini
2023-06-26 10:06 ` Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230626083317.144746-1-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).