[PATCH 0/2] target/i386: allow using named CPU modeles with user mode emulation

Paolo Bonzini posted 2 patches 10 months, 3 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20230618222109.110843-1-pbonzini@redhat.com
There is a newer version of this series
target/i386/cpu.c | 95 ++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 86 insertions(+), 9 deletions(-)
[PATCH 0/2] target/i386: allow using named CPU modeles with user mode emulation
Posted by Paolo Bonzini 10 months, 3 weeks ago
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 the i386 target is not about running
  programs on a 32-bit processor, but rather running programs using the
  32-bit kernel ABI on any processor; the behavior of the processor in
  compatibility (32-bit) mode is independent of the LM feature.  Therefore,
  LM can also be treated as a feature that is only relevant in kernel
  mode.

Other CPU models have warnings for the ARCH_CAPABILITIES MSR; hide
them as well in a similar manner.

Based-on: <20230618215114.107337-1-pbonzini@redhat.com>

Paolo Bonzini (2):
  target/i386: ignore ARCH_CAPABILITIES features in user mode emulation
  target/i386: ignore CPL0-specific features in user mode emulation

 target/i386/cpu.c | 95 ++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 86 insertions(+), 9 deletions(-)

-- 
2.40.1