All of lore.kernel.org
 help / color / mirror / Atom feed
* [PULL v2 00/22] QEMU changes for 7.0 soft freeze
@ 2022-03-08 11:34 Paolo Bonzini
  2022-03-08 11:34 ` [PULL 01/22] whpx: Fixed reporting of the CPU context to GDB for 64-bit Paolo Bonzini
                   ` (22 more replies)
  0 siblings, 23 replies; 34+ messages in thread
From: Paolo Bonzini @ 2022-03-08 11:34 UTC (permalink / raw)
  To: qemu-devel

The following changes since commit 99c53410bc9d50e556f565b0960673cccb566452:

  Merge remote-tracking branch 'remotes/thuth-gitlab/tags/pull-request-2022-02-28' into staging (2022-03-01 13:25:54 +0000)

are available in the Git repository at:

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

for you to fetch changes up to d722beb6ac1d457bfa3d7dd5bce7bcea5ea45540:

  gitlab-ci: do not run tests with address sanitizer (2022-03-08 12:34:12 +0100)

----------------------------------------------------------------
* whpx fixes in preparation for GDB support (Ivan)
* VSS header fixes (Marc-André)
* 5-level EPT support (Vitaly)
* AMX support (Jing Liu & Yang Zhong)
* Bundle changes to MSI routes (Longpeng)
* More precise emulation of #SS (Gareth)
* Disable ASAN testing

----------------------------------------------------------------
Gareth Webb (1):
      target/i386: Throw a #SS when loading a non-canonical IST

Ivan Shcherbakov (2):
      whpx: Fixed reporting of the CPU context to GDB for 64-bit
      whpx: Fixed incorrect CR8/TPR synchronization

Jing Liu (5):
      x86: Fix the 64-byte boundary enumeration for extended state
      x86: Add AMX XTILECFG and XTILEDATA components
      x86: Add XFD faulting bit for state components
      x86: Add AMX CPUIDs enumeration
      x86: add support for KVM_CAP_XSAVE2 and AMX state migration

Longpeng (Mike) (2):
      kvm-irqchip: introduce new API to support route change
      kvm/msi: do explicit commit when adding msi routes

Marc-André Lureau (3):
      meson: fix generic location of vss headers
      qga/vss-win32: check old VSS SDK headers
      qga/vss: update informative message about MinGW

Maxim Levitsky (1):
      KVM: SVM: always set MSR_AMD64_TSC_RATIO to default value

Paolo Bonzini (4):
      update meson-buildoptions.sh
      target/i386: only include bits in pg_mode if they are not ignored
      linux-headers: include missing changes from 5.17
      gitlab-ci: do not run tests with address sanitizer

Vitaly Kuznetsov (2):
      vmxcap: Add 5-level EPT bit
      i386: Add Icelake-Server-v6 CPU model with 5-level EPT support

Yang Zhong (1):
      x86: Grant AMX permission for guest

Zeng Guang (1):
      x86: Support XFD and AMX xsave data migration

 .gitlab-ci.d/buildtest.yml           |   2 -
 accel/kvm/kvm-all.c                  |   7 +-
 accel/stubs/kvm-stub.c               |   2 +-
 hw/misc/ivshmem.c                    |   5 +-
 hw/vfio/pci.c                        |   5 +-
 hw/virtio/virtio-pci.c               |   4 +-
 include/sysemu/kvm.h                 |  23 ++++++-
 linux-headers/asm-x86/kvm.h          |   3 +
 linux-headers/linux/kvm.h            |   4 ++
 meson.build                          |   5 +-
 qga/meson.build                      |   2 +-
 qga/vss-win32/install.cpp            |   4 ++
 qga/vss-win32/provider.cpp           |   4 ++
 qga/vss-win32/vss-common.h           |   3 +-
 scripts/kvm/vmxcap                   |   1 +
 scripts/meson-buildoptions.sh        |   2 +-
 target/i386/cpu.c                    |  84 +++++++++++++++++++++--
 target/i386/cpu.h                    |  43 +++++++++++-
 target/i386/kvm/kvm-cpu.c            |  11 +--
 target/i386/kvm/kvm.c                | 125 ++++++++++++++++++++++++++++++-----
 target/i386/kvm/kvm_i386.h           |   1 +
 target/i386/machine.c                |  46 +++++++++++++
 target/i386/tcg/seg_helper.c         |  49 +++++++++++++-
 target/i386/tcg/sysemu/excp_helper.c |  40 +----------
 target/i386/whpx/whpx-all.c          |  30 ++++++++-
 target/i386/xsave_helper.c           |  28 ++++++++
 26 files changed, 449 insertions(+), 84 deletions(-)
-- 
2.35.1



^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PULL 01/22] whpx: Fixed reporting of the CPU context to GDB for 64-bit
  2022-03-08 11:34 [PULL v2 00/22] QEMU changes for 7.0 soft freeze Paolo Bonzini
@ 2022-03-08 11:34 ` Paolo Bonzini
  2022-03-08 11:34 ` [PULL 02/22] whpx: Fixed incorrect CR8/TPR synchronization Paolo Bonzini
                   ` (21 subsequent siblings)
  22 siblings, 0 replies; 34+ messages in thread
From: Paolo Bonzini @ 2022-03-08 11:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: Ivan Shcherbakov

From: Ivan Shcherbakov <ivan@sysprogs.com>

Make sure that pausing the VM while in 64-bit mode will set the
HF_CS64_MASK flag in env->hflags (see x86_update_hflags() in
target/i386/cpu.c).

Without it, the code in gdbstub.c would only use the 32-bit register values
when debugging 64-bit targets, making debugging effectively impossible.

Signed-off-by: Ivan Shcherbakov <ivan@sysprogs.com>
Message-Id: <00f701d82874$68b02000$3a106000$@sysprogs.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/i386/whpx/whpx-all.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c
index ef896da0a2..edd4fafbdf 100644
--- a/target/i386/whpx/whpx-all.c
+++ b/target/i386/whpx/whpx-all.c
@@ -604,6 +604,8 @@ static void whpx_get_registers(CPUState *cpu)
         whpx_apic_get(x86_cpu->apic_state);
     }
 
+    x86_update_hflags(env);
+
     return;
 }
 
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PULL 02/22] whpx: Fixed incorrect CR8/TPR synchronization
  2022-03-08 11:34 [PULL v2 00/22] QEMU changes for 7.0 soft freeze Paolo Bonzini
  2022-03-08 11:34 ` [PULL 01/22] whpx: Fixed reporting of the CPU context to GDB for 64-bit Paolo Bonzini
@ 2022-03-08 11:34 ` Paolo Bonzini
  2022-03-08 11:34 ` [PULL 03/22] vmxcap: Add 5-level EPT bit Paolo Bonzini
                   ` (20 subsequent siblings)
  22 siblings, 0 replies; 34+ messages in thread
From: Paolo Bonzini @ 2022-03-08 11:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: Ivan Shcherbakov

From: Ivan Shcherbakov <ivan@sysprogs.com>

This fixes the following error triggered when stopping and resuming a 64-bit
Linux kernel via gdb:

qemu-system-x86_64.exe: WHPX: Failed to set virtual processor context, hr=c0350005

The previous logic for synchronizing the values did not take into account
that the lower 4 bits of the CR8 register, containing the priority level,
mapped to bits 7:4 of the APIC.TPR register (see section 10.8.6.1 of
Volume 3 of Intel 64 and IA-32 Architectures Software Developer's Manual).
The caused WHvSetVirtualProcessorRegisters() to fail with an error,
effectively preventing GDB from changing the guest context.

Signed-off-by: Ivan Shcherbakov <ivan@sysprogs.com>
Message-Id: <010b01d82874$bb4ef160$31ecd420$@sysprogs.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/i386/whpx/whpx-all.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c
index edd4fafbdf..63203730bc 100644
--- a/target/i386/whpx/whpx-all.c
+++ b/target/i386/whpx/whpx-all.c
@@ -256,6 +256,21 @@ static int whpx_set_tsc(CPUState *cpu)
     return 0;
 }
 
+/*
+ * The CR8 register in the CPU is mapped to the TPR register of the APIC,
+ * however, they use a slightly different encoding. Specifically:
+ *
+ *     APIC.TPR[bits 7:4] = CR8[bits 3:0]
+ *
+ * This mechanism is described in section 10.8.6.1 of Volume 3 of Intel 64
+ * and IA-32 Architectures Software Developer's Manual.
+ */
+
+static uint64_t whpx_apic_tpr_to_cr8(uint64_t tpr)
+{
+    return tpr >> 4;
+}
+
 static void whpx_set_registers(CPUState *cpu, int level)
 {
     struct whpx_state *whpx = &whpx_global;
@@ -284,7 +299,7 @@ static void whpx_set_registers(CPUState *cpu, int level)
     v86 = (env->eflags & VM_MASK);
     r86 = !(env->cr[0] & CR0_PE_MASK);
 
-    vcpu->tpr = cpu_get_apic_tpr(x86_cpu->apic_state);
+    vcpu->tpr = whpx_apic_tpr_to_cr8(cpu_get_apic_tpr(x86_cpu->apic_state));
     vcpu->apic_base = cpu_get_apic_base(x86_cpu->apic_state);
 
     idx = 0;
@@ -475,6 +490,17 @@ static void whpx_get_registers(CPUState *cpu)
                      hr);
     }
 
+    if (whpx_apic_in_platform()) {
+        /*
+         * Fetch the TPR value from the emulated APIC. It may get overwritten
+         * below with the value from CR8 returned by
+         * WHvGetVirtualProcessorRegisters().
+         */
+        whpx_apic_get(x86_cpu->apic_state);
+        vcpu->tpr = whpx_apic_tpr_to_cr8(
+            cpu_get_apic_tpr(x86_cpu->apic_state));
+    }
+
     idx = 0;
 
     /* Indexes for first 16 registers match between HV and QEMU definitions */
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PULL 03/22] vmxcap: Add 5-level EPT bit
  2022-03-08 11:34 [PULL v2 00/22] QEMU changes for 7.0 soft freeze Paolo Bonzini
  2022-03-08 11:34 ` [PULL 01/22] whpx: Fixed reporting of the CPU context to GDB for 64-bit Paolo Bonzini
  2022-03-08 11:34 ` [PULL 02/22] whpx: Fixed incorrect CR8/TPR synchronization Paolo Bonzini
@ 2022-03-08 11:34 ` Paolo Bonzini
  2022-03-08 11:34 ` [PULL 04/22] meson: fix generic location of vss headers Paolo Bonzini
                   ` (19 subsequent siblings)
  22 siblings, 0 replies; 34+ messages in thread
From: Paolo Bonzini @ 2022-03-08 11:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: Vitaly Kuznetsov

From: Vitaly Kuznetsov <vkuznets@redhat.com>

5-level EPT is present in Icelake Server CPUs and is supported by QEMU
('vmx-page-walk-5').

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Message-Id: <20220221145316.576138-2-vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 scripts/kvm/vmxcap | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/kvm/vmxcap b/scripts/kvm/vmxcap
index 6fe66d5f57..f140040104 100755
--- a/scripts/kvm/vmxcap
+++ b/scripts/kvm/vmxcap
@@ -249,6 +249,7 @@ controls = [
         bits = {
             0: 'Execute-only EPT translations',
             6: 'Page-walk length 4',
+            7: 'Page-walk length 5',
             8: 'Paging-structure memory type UC',
             14: 'Paging-structure memory type WB',
             16: '2MB EPT pages',
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PULL 04/22] meson: fix generic location of vss headers
  2022-03-08 11:34 [PULL v2 00/22] QEMU changes for 7.0 soft freeze Paolo Bonzini
                   ` (2 preceding siblings ...)
  2022-03-08 11:34 ` [PULL 03/22] vmxcap: Add 5-level EPT bit Paolo Bonzini
@ 2022-03-08 11:34 ` Paolo Bonzini
  2022-03-08 11:34 ` [PULL 05/22] qga/vss-win32: check old VSS SDK headers Paolo Bonzini
                   ` (18 subsequent siblings)
  22 siblings, 0 replies; 34+ messages in thread
From: Paolo Bonzini @ 2022-03-08 11:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

This is a left-over, despite requesting the change before the merge.

Fixes: commit 8821a389 ("configure, meson: replace VSS SDK checks and options with --enable-vss-sdk")
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220222194008.610377-2-marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 8df40bfac4..b871098dbb 100644
--- a/meson.build
+++ b/meson.build
@@ -1936,7 +1936,7 @@ have_vss = false
 if targetos == 'windows' and link_language == 'cpp'
   have_vss = cxx.compiles('''
     #define __MIDL_user_allocate_free_DEFINED__
-    #include <inc/win2003/vss.h>
+    #include <vss.h>
     int main(void) { return VSS_CTX_BACKUP; }''')
 endif
 
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PULL 05/22] qga/vss-win32: check old VSS SDK headers
  2022-03-08 11:34 [PULL v2 00/22] QEMU changes for 7.0 soft freeze Paolo Bonzini
                   ` (3 preceding siblings ...)
  2022-03-08 11:34 ` [PULL 04/22] meson: fix generic location of vss headers Paolo Bonzini
@ 2022-03-08 11:34 ` Paolo Bonzini
  2022-03-08 11:34 ` [PULL 06/22] qga/vss: update informative message about MinGW Paolo Bonzini
                   ` (17 subsequent siblings)
  22 siblings, 0 replies; 34+ messages in thread
From: Paolo Bonzini @ 2022-03-08 11:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

The VssCoordinator & VssAdmin interfaces have been moved to vsadmin.h in
the Windows SDK.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220222194008.610377-3-marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 meson.build                | 3 +++
 qga/vss-win32/install.cpp  | 4 ++++
 qga/vss-win32/provider.cpp | 4 ++++
 qga/vss-win32/vss-common.h | 3 ++-
 4 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index b871098dbb..101a3f2d31 100644
--- a/meson.build
+++ b/meson.build
@@ -1933,12 +1933,15 @@ config_host_data.set('CONFIG_AF_VSOCK', cc.compiles(gnu_source_prefix + '''
   }'''))
 
 have_vss = false
+have_vss_sdk = false # old xp/2003 SDK
 if targetos == 'windows' and link_language == 'cpp'
   have_vss = cxx.compiles('''
     #define __MIDL_user_allocate_free_DEFINED__
     #include <vss.h>
     int main(void) { return VSS_CTX_BACKUP; }''')
+  have_vss_sdk = cxx.has_header('vscoordint.h')
 endif
+config_host_data.set('HAVE_VSS_SDK', have_vss_sdk)
 
 have_ntddscsi = false
 if targetos == 'windows'
diff --git a/qga/vss-win32/install.cpp b/qga/vss-win32/install.cpp
index efc5bb9909..8076efe3cb 100644
--- a/qga/vss-win32/install.cpp
+++ b/qga/vss-win32/install.cpp
@@ -13,7 +13,11 @@
 #include "qemu/osdep.h"
 
 #include "vss-common.h"
+#ifdef HAVE_VSS_SDK
 #include <vscoordint.h>
+#else
+#include <vsadmin.h>
+#endif
 #include "install.h"
 #include <wbemidl.h>
 #include <comdef.h>
diff --git a/qga/vss-win32/provider.cpp b/qga/vss-win32/provider.cpp
index fd187fb66f..1b885e24ee 100644
--- a/qga/vss-win32/provider.cpp
+++ b/qga/vss-win32/provider.cpp
@@ -12,7 +12,11 @@
 
 #include "qemu/osdep.h"
 #include "vss-common.h"
+#ifdef HAVE_VSS_SDK
 #include <vscoordint.h>
+#else
+#include <vsadmin.h>
+#endif
 #include <vsprov.h>
 
 #define VSS_TIMEOUT_MSEC (60*1000)
diff --git a/qga/vss-win32/vss-common.h b/qga/vss-win32/vss-common.h
index 54f8de8c88..0e67e7822c 100644
--- a/qga/vss-win32/vss-common.h
+++ b/qga/vss-win32/vss-common.h
@@ -64,12 +64,13 @@ const CLSID CLSID_QGAVSSProvider = { 0x6e6a3492, 0x8d4d, 0x440c,
 const TCHAR g_szClsid[] = TEXT("{6E6A3492-8D4D-440C-9619-5E5D0CC31CA8}");
 const TCHAR g_szProgid[] = TEXT("QGAVSSProvider");
 
+#ifdef HAVE_VSS_SDK
 /* Enums undefined in VSS SDK 7.2 but defined in newer Windows SDK */
 enum __VSS_VOLUME_SNAPSHOT_ATTRIBUTES {
     VSS_VOLSNAP_ATTR_NO_AUTORECOVERY       = 0x00000002,
     VSS_VOLSNAP_ATTR_TXF_RECOVERY          = 0x02000000
 };
-
+#endif
 
 /* COM pointer utility; call ->Release() when it goes out of scope */
 template <class T>
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PULL 06/22] qga/vss: update informative message about MinGW
  2022-03-08 11:34 [PULL v2 00/22] QEMU changes for 7.0 soft freeze Paolo Bonzini
                   ` (4 preceding siblings ...)
  2022-03-08 11:34 ` [PULL 05/22] qga/vss-win32: check old VSS SDK headers Paolo Bonzini
@ 2022-03-08 11:34 ` Paolo Bonzini
  2022-03-08 11:34 ` [PULL 07/22] update meson-buildoptions.sh Paolo Bonzini
                   ` (16 subsequent siblings)
  22 siblings, 0 replies; 34+ messages in thread
From: Paolo Bonzini @ 2022-03-08 11:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

The headers are now all available in MinGW master branch.
(commit 13390dbbf885f and earlier) aiming for 10.0.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220222194008.610377-4-marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 qga/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qga/meson.build b/qga/meson.build
index 54f2da5b07..62472747f1 100644
--- a/qga/meson.build
+++ b/qga/meson.build
@@ -15,7 +15,7 @@ have_qga_vss = get_option('qga_vss') \
     If your Visual Studio installation doesn't have the VSS headers,
     Please download and install Microsoft VSS SDK:
     http://www.microsoft.com/en-us/download/details.aspx?id=23490
-    On POSIX-systems, MinGW doesn't yet provide working headers.
+    On POSIX-systems, MinGW should provide headers in >=10.0 releases.
     you can extract the SDK headers by:
     $ scripts/extract-vsssdk-headers setup.exe
     The headers are extracted in the directory 'inc/win2003'.
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PULL 07/22] update meson-buildoptions.sh
  2022-03-08 11:34 [PULL v2 00/22] QEMU changes for 7.0 soft freeze Paolo Bonzini
                   ` (5 preceding siblings ...)
  2022-03-08 11:34 ` [PULL 06/22] qga/vss: update informative message about MinGW Paolo Bonzini
@ 2022-03-08 11:34 ` Paolo Bonzini
  2022-03-08 11:34 ` [PULL 08/22] kvm-irqchip: introduce new API to support route change Paolo Bonzini
                   ` (15 subsequent siblings)
  22 siblings, 0 replies; 34+ messages in thread
From: Paolo Bonzini @ 2022-03-08 11:34 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 scripts/meson-buildoptions.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
index 9ee684ef03..1e26f4571e 100644
--- a/scripts/meson-buildoptions.sh
+++ b/scripts/meson-buildoptions.sh
@@ -20,7 +20,6 @@ meson_options_help() {
   printf "%s\n" '  --enable-malloc=CHOICE   choose memory allocator to use [system] (choices:'
   printf "%s\n" '                           jemalloc/system/tcmalloc)'
   printf "%s\n" '  --enable-profiler        profiler support'
-  printf "%s\n" '  --enable-qga-vss         build QGA VSS support'
   printf "%s\n" '  --enable-qom-cast-debug  cast debugging support'
   printf "%s\n" '  --enable-rng-none        dummy RNG, avoid using /dev/(u)random and'
   printf "%s\n" '                           getrandom()'
@@ -97,6 +96,7 @@ meson_options_help() {
   printf "%s\n" '  parallels       parallels image format support'
   printf "%s\n" '  qcow1           qcow1 image format support'
   printf "%s\n" '  qed             qed image format support'
+  printf "%s\n" '  qga-vss         build QGA VSS support (broken with MinGW)'
   printf "%s\n" '  rbd             Ceph block device driver'
   printf "%s\n" '  replication     replication support'
   printf "%s\n" '  sdl             SDL user interface'
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PULL 08/22] kvm-irqchip: introduce new API to support route change
  2022-03-08 11:34 [PULL v2 00/22] QEMU changes for 7.0 soft freeze Paolo Bonzini
                   ` (6 preceding siblings ...)
  2022-03-08 11:34 ` [PULL 07/22] update meson-buildoptions.sh Paolo Bonzini
@ 2022-03-08 11:34 ` Paolo Bonzini
  2022-03-08 11:34 ` [PULL 09/22] kvm/msi: do explicit commit when adding msi routes Paolo Bonzini
                   ` (14 subsequent siblings)
  22 siblings, 0 replies; 34+ messages in thread
From: Paolo Bonzini @ 2022-03-08 11:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: Longpeng(Mike)

From: "Longpeng(Mike)" <longpeng2@huawei.com>

Paolo suggested adding the new API to support route changes [1]. We should invoke
kvm_irqchip_begin_route_changes() before changing the routes, increasing the
KVMRouteChange.changes if the routes are changed, and commit the changes at last.

[1] https://lists.gnu.org/archive/html/qemu-devel/2021-11/msg02898.html

Signed-off-by: Longpeng <longpeng2@huawei.com>
Message-Id: <20220222141116.2091-2-longpeng2@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/sysemu/kvm.h | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index 6eb39a088b..36e6d40191 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -224,6 +224,11 @@ DECLARE_INSTANCE_CHECKER(KVMState, KVM_STATE,
 extern KVMState *kvm_state;
 typedef struct Notifier Notifier;
 
+typedef struct KVMRouteChange {
+     KVMState *s;
+     int changes;
+} KVMRouteChange;
+
 /* external API */
 
 bool kvm_has_free_slot(MachineState *ms);
@@ -494,6 +499,20 @@ int kvm_irqchip_add_msi_route(KVMState *s, int vector, PCIDevice *dev);
 int kvm_irqchip_update_msi_route(KVMState *s, int virq, MSIMessage msg,
                                  PCIDevice *dev);
 void kvm_irqchip_commit_routes(KVMState *s);
+
+static inline KVMRouteChange kvm_irqchip_begin_route_changes(KVMState *s)
+{
+    return (KVMRouteChange) { .s = s, .changes = 0 };
+}
+
+static inline void kvm_irqchip_commit_route_changes(KVMRouteChange *c)
+{
+    if (c->changes) {
+        kvm_irqchip_commit_routes(c->s);
+        c->changes = 0;
+    }
+}
+
 void kvm_irqchip_release_virq(KVMState *s, int virq);
 
 int kvm_irqchip_add_adapter_route(KVMState *s, AdapterInfo *adapter);
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PULL 09/22] kvm/msi: do explicit commit when adding msi routes
  2022-03-08 11:34 [PULL v2 00/22] QEMU changes for 7.0 soft freeze Paolo Bonzini
                   ` (7 preceding siblings ...)
  2022-03-08 11:34 ` [PULL 08/22] kvm-irqchip: introduce new API to support route change Paolo Bonzini
@ 2022-03-08 11:34 ` Paolo Bonzini
  2022-03-08 11:34 ` [PULL 10/22] target/i386: only include bits in pg_mode if they are not ignored Paolo Bonzini
                   ` (13 subsequent siblings)
  22 siblings, 0 replies; 34+ messages in thread
From: Paolo Bonzini @ 2022-03-08 11:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: Longpeng(Mike)

From: "Longpeng(Mike)" <longpeng2@huawei.com>

We invoke the kvm_irqchip_commit_routes() for each addition to MSI route
table, which is not efficient if we are adding lots of routes in some cases.

This patch lets callers invoke the kvm_irqchip_commit_routes(), so the
callers can decide how to optimize.

[1] https://lists.gnu.org/archive/html/qemu-devel/2021-11/msg00967.html

Signed-off-by: Longpeng <longpeng2@huawei.com>
Message-Id: <20220222141116.2091-3-longpeng2@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 accel/kvm/kvm-all.c    | 7 ++++---
 accel/stubs/kvm-stub.c | 2 +-
 hw/misc/ivshmem.c      | 5 ++++-
 hw/vfio/pci.c          | 5 ++++-
 hw/virtio/virtio-pci.c | 4 +++-
 include/sysemu/kvm.h   | 4 ++--
 target/i386/kvm/kvm.c  | 4 +++-
 7 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 0e66ebb497..27864dfaea 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -1961,10 +1961,11 @@ int kvm_irqchip_send_msi(KVMState *s, MSIMessage msg)
     return kvm_set_irq(s, route->kroute.gsi, 1);
 }
 
-int kvm_irqchip_add_msi_route(KVMState *s, int vector, PCIDevice *dev)
+int kvm_irqchip_add_msi_route(KVMRouteChange *c, int vector, PCIDevice *dev)
 {
     struct kvm_irq_routing_entry kroute = {};
     int virq;
+    KVMState *s = c->s;
     MSIMessage msg = {0, 0};
 
     if (pci_available && dev) {
@@ -2004,7 +2005,7 @@ int kvm_irqchip_add_msi_route(KVMState *s, int vector, PCIDevice *dev)
 
     kvm_add_routing_entry(s, &kroute);
     kvm_arch_add_msi_route_post(&kroute, vector, dev);
-    kvm_irqchip_commit_routes(s);
+    c->changes++;
 
     return virq;
 }
@@ -2162,7 +2163,7 @@ int kvm_irqchip_send_msi(KVMState *s, MSIMessage msg)
     abort();
 }
 
-int kvm_irqchip_add_msi_route(KVMState *s, int vector, PCIDevice *dev)
+int kvm_irqchip_add_msi_route(KVMRouteChange *c, int vector, PCIDevice *dev)
 {
     return -ENOSYS;
 }
diff --git a/accel/stubs/kvm-stub.c b/accel/stubs/kvm-stub.c
index 5319573e00..ae6e8e9aa7 100644
--- a/accel/stubs/kvm-stub.c
+++ b/accel/stubs/kvm-stub.c
@@ -81,7 +81,7 @@ int kvm_on_sigbus(int code, void *addr)
 }
 
 #ifndef CONFIG_USER_ONLY
-int kvm_irqchip_add_msi_route(KVMState *s, int vector, PCIDevice *dev)
+int kvm_irqchip_add_msi_route(KVMRouteChange *c, int vector, PCIDevice *dev)
 {
     return -ENOSYS;
 }
diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
index 299837e5c1..2307f4a513 100644
--- a/hw/misc/ivshmem.c
+++ b/hw/misc/ivshmem.c
@@ -424,16 +424,19 @@ static void ivshmem_add_kvm_msi_virq(IVShmemState *s, int vector,
                                      Error **errp)
 {
     PCIDevice *pdev = PCI_DEVICE(s);
+    KVMRouteChange c;
     int ret;
 
     IVSHMEM_DPRINTF("ivshmem_add_kvm_msi_virq vector:%d\n", vector);
     assert(!s->msi_vectors[vector].pdev);
 
-    ret = kvm_irqchip_add_msi_route(kvm_state, vector, pdev);
+    c = kvm_irqchip_begin_route_changes(kvm_state);
+    ret = kvm_irqchip_add_msi_route(&c, vector, pdev);
     if (ret < 0) {
         error_setg(errp, "kvm_irqchip_add_msi_route failed");
         return;
     }
+    kvm_irqchip_commit_route_changes(&c);
 
     s->msi_vectors[vector].virq = ret;
     s->msi_vectors[vector].pdev = pdev;
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index 7b45353ce2..d07a4e99b1 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -412,6 +412,7 @@ static int vfio_enable_vectors(VFIOPCIDevice *vdev, bool msix)
 static void vfio_add_kvm_msi_virq(VFIOPCIDevice *vdev, VFIOMSIVector *vector,
                                   int vector_n, bool msix)
 {
+    KVMRouteChange c;
     int virq;
 
     if ((msix && vdev->no_kvm_msix) || (!msix && vdev->no_kvm_msi)) {
@@ -422,11 +423,13 @@ static void vfio_add_kvm_msi_virq(VFIOPCIDevice *vdev, VFIOMSIVector *vector,
         return;
     }
 
-    virq = kvm_irqchip_add_msi_route(kvm_state, vector_n, &vdev->pdev);
+    c = kvm_irqchip_begin_route_changes(kvm_state);
+    virq = kvm_irqchip_add_msi_route(&c, vector_n, &vdev->pdev);
     if (virq < 0) {
         event_notifier_cleanup(&vector->kvm_interrupt);
         return;
     }
+    kvm_irqchip_commit_route_changes(&c);
 
     if (kvm_irqchip_add_irqfd_notifier_gsi(kvm_state, &vector->kvm_interrupt,
                                        NULL, virq) < 0) {
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index f9cf9592fd..7cf1231c1c 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -683,10 +683,12 @@ static int kvm_virtio_pci_vq_vector_use(VirtIOPCIProxy *proxy,
     int ret;
 
     if (irqfd->users == 0) {
-        ret = kvm_irqchip_add_msi_route(kvm_state, vector, &proxy->pci_dev);
+        KVMRouteChange c = kvm_irqchip_begin_route_changes(kvm_state);
+        ret = kvm_irqchip_add_msi_route(&c, vector, &proxy->pci_dev);
         if (ret < 0) {
             return ret;
         }
+        kvm_irqchip_commit_route_changes(&c);
         irqfd->virq = ret;
     }
     irqfd->users++;
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index 36e6d40191..e83280521a 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -486,7 +486,7 @@ void kvm_init_cpu_signals(CPUState *cpu);
 
 /**
  * kvm_irqchip_add_msi_route - Add MSI route for specific vector
- * @s:      KVM state
+ * @c:      KVMRouteChange instance.
  * @vector: which vector to add. This can be either MSI/MSIX
  *          vector. The function will automatically detect whether
  *          MSI/MSIX is enabled, and fetch corresponding MSI
@@ -495,7 +495,7 @@ void kvm_init_cpu_signals(CPUState *cpu);
  *          as @NULL, an empty MSI message will be inited.
  * @return: virq (>=0) when success, errno (<0) when failed.
  */
-int kvm_irqchip_add_msi_route(KVMState *s, int vector, PCIDevice *dev);
+int kvm_irqchip_add_msi_route(KVMRouteChange *c, int vector, PCIDevice *dev);
 int kvm_irqchip_update_msi_route(KVMState *s, int virq, MSIMessage msg,
                                  PCIDevice *dev);
 void kvm_irqchip_commit_routes(KVMState *s);
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index 2c8feb4a6f..cfef36a14e 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -4939,16 +4939,18 @@ void kvm_arch_init_irq_routing(KVMState *s)
     kvm_gsi_routing_allowed = true;
 
     if (kvm_irqchip_is_split()) {
+        KVMRouteChange c = kvm_irqchip_begin_route_changes(s);
         int i;
 
         /* If the ioapic is in QEMU and the lapics are in KVM, reserve
            MSI routes for signaling interrupts to the local apics. */
         for (i = 0; i < IOAPIC_NUM_PINS; i++) {
-            if (kvm_irqchip_add_msi_route(s, 0, NULL) < 0) {
+            if (kvm_irqchip_add_msi_route(&c, 0, NULL) < 0) {
                 error_report("Could not enable split IRQ mode.");
                 exit(1);
             }
         }
+        kvm_irqchip_commit_route_changes(&c);
     }
 }
 
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PULL 10/22] target/i386: only include bits in pg_mode if they are not ignored
  2022-03-08 11:34 [PULL v2 00/22] QEMU changes for 7.0 soft freeze Paolo Bonzini
                   ` (8 preceding siblings ...)
  2022-03-08 11:34 ` [PULL 09/22] kvm/msi: do explicit commit when adding msi routes Paolo Bonzini
@ 2022-03-08 11:34 ` Paolo Bonzini
  2022-03-08 11:34 ` [PULL 11/22] target/i386: Throw a #SS when loading a non-canonical IST Paolo Bonzini
                   ` (12 subsequent siblings)
  22 siblings, 0 replies; 34+ messages in thread
From: Paolo Bonzini @ 2022-03-08 11:34 UTC (permalink / raw)
  To: qemu-devel

LA57/PKE/PKS is only relevant in 64-bit mode, and NXE is only relevant if
PAE is in use.  Since there is code that checks PG_MODE_LA57 to determine
the canonicality of addresses, make sure that the bit is not set by
mistake in 32-bit mode.  While it would not be a problem because 32-bit
addresses by definition fit in both 48-bit and 57-bit address spaces,
it is nicer if get_pg_mode() actually returns whether a feature is enabled,
and it allows a few simplifications in the page table walker.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/i386/tcg/sysemu/excp_helper.c | 34 ++++++++++++++--------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/target/i386/tcg/sysemu/excp_helper.c b/target/i386/tcg/sysemu/excp_helper.c
index 5ba739fbed..0410170d64 100644
--- a/target/i386/tcg/sysemu/excp_helper.c
+++ b/target/i386/tcg/sysemu/excp_helper.c
@@ -24,32 +24,35 @@
 int get_pg_mode(CPUX86State *env)
 {
     int pg_mode = 0;
+    if (!(env->cr[0] & CR0_PG_MASK)) {
+        return 0;
+    }
     if (env->cr[0] & CR0_WP_MASK) {
         pg_mode |= PG_MODE_WP;
     }
     if (env->cr[4] & CR4_PAE_MASK) {
         pg_mode |= PG_MODE_PAE;
+        if (env->efer & MSR_EFER_NXE) {
+            pg_mode |= PG_MODE_NXE;
+        }
     }
     if (env->cr[4] & CR4_PSE_MASK) {
         pg_mode |= PG_MODE_PSE;
     }
-    if (env->cr[4] & CR4_PKE_MASK) {
-        pg_mode |= PG_MODE_PKE;
-    }
-    if (env->cr[4] & CR4_PKS_MASK) {
-        pg_mode |= PG_MODE_PKS;
-    }
     if (env->cr[4] & CR4_SMEP_MASK) {
         pg_mode |= PG_MODE_SMEP;
     }
-    if (env->cr[4] & CR4_LA57_MASK) {
-        pg_mode |= PG_MODE_LA57;
-    }
     if (env->hflags & HF_LMA_MASK) {
         pg_mode |= PG_MODE_LMA;
-    }
-    if (env->efer & MSR_EFER_NXE) {
-        pg_mode |= PG_MODE_NXE;
+        if (env->cr[4] & CR4_PKE_MASK) {
+            pg_mode |= PG_MODE_PKE;
+        }
+        if (env->cr[4] & CR4_PKS_MASK) {
+            pg_mode |= PG_MODE_PKS;
+        }
+        if (env->cr[4] & CR4_LA57_MASK) {
+            pg_mode |= PG_MODE_LA57;
+        }
     }
     return pg_mode;
 }
@@ -278,9 +281,7 @@ do_check_protect_pse36:
         *prot |= PAGE_EXEC;
     }
 
-    if (!(pg_mode & PG_MODE_LMA)) {
-        pkr = 0;
-    } else if (ptep & PG_USER_MASK) {
+    if (ptep & PG_USER_MASK) {
         pkr = pg_mode & PG_MODE_PKE ? env->pkru : 0;
     } else {
         pkr = pg_mode & PG_MODE_PKS ? env->pkrs : 0;
@@ -343,8 +344,7 @@ do_check_protect_pse36:
     if (is_user)
         error_code |= PG_ERROR_U_MASK;
     if (is_write1 == 2 &&
-        (((pg_mode & PG_MODE_NXE) && (pg_mode & PG_MODE_PAE)) ||
-         (pg_mode & PG_MODE_SMEP)))
+        ((pg_mode & PG_MODE_NXE) || (pg_mode & PG_MODE_SMEP)))
         error_code |= PG_ERROR_I_D_MASK;
     return error_code;
 }
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PULL 11/22] target/i386: Throw a #SS when loading a non-canonical IST
  2022-03-08 11:34 [PULL v2 00/22] QEMU changes for 7.0 soft freeze Paolo Bonzini
                   ` (9 preceding siblings ...)
  2022-03-08 11:34 ` [PULL 10/22] target/i386: only include bits in pg_mode if they are not ignored Paolo Bonzini
@ 2022-03-08 11:34 ` Paolo Bonzini
  2022-03-08 11:34 ` [PULL 12/22] linux-headers: include missing changes from 5.17 Paolo Bonzini
                   ` (11 subsequent siblings)
  22 siblings, 0 replies; 34+ messages in thread
From: Paolo Bonzini @ 2022-03-08 11:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gareth Webb

From: Gareth Webb <gareth.webb@umbralsoftware.co.uk>

Loading a non-canonical address into rsp when handling an interrupt or
performing a far call should raise a #SS not a #GP.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/870
Signed-off-by: Gareth Webb <gareth.webb@umbralsoftware.co.uk>
Message-Id: <164529651121.25406.15337137068584246397-0@git.sr.ht>
[Move get_pg_mode to seg_helper.c for user-mode emulators. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/i386/tcg/seg_helper.c         | 49 +++++++++++++++++++++++++++-
 target/i386/tcg/sysemu/excp_helper.c | 36 --------------------
 2 files changed, 48 insertions(+), 37 deletions(-)

diff --git a/target/i386/tcg/seg_helper.c b/target/i386/tcg/seg_helper.c
index baa905a0cd..4cf1f973cf 100644
--- a/target/i386/tcg/seg_helper.c
+++ b/target/i386/tcg/seg_helper.c
@@ -28,6 +28,42 @@
 #include "helper-tcg.h"
 #include "seg_helper.h"
 
+int get_pg_mode(CPUX86State *env)
+{
+    int pg_mode = 0;
+    if (!(env->cr[0] & CR0_PG_MASK)) {
+        return 0;
+    }
+    if (env->cr[0] & CR0_WP_MASK) {
+        pg_mode |= PG_MODE_WP;
+    }
+    if (env->cr[4] & CR4_PAE_MASK) {
+        pg_mode |= PG_MODE_PAE;
+        if (env->efer & MSR_EFER_NXE) {
+            pg_mode |= PG_MODE_NXE;
+        }
+    }
+    if (env->cr[4] & CR4_PSE_MASK) {
+        pg_mode |= PG_MODE_PSE;
+    }
+    if (env->cr[4] & CR4_SMEP_MASK) {
+        pg_mode |= PG_MODE_SMEP;
+    }
+    if (env->hflags & HF_LMA_MASK) {
+        pg_mode |= PG_MODE_LMA;
+        if (env->cr[4] & CR4_PKE_MASK) {
+            pg_mode |= PG_MODE_PKE;
+        }
+        if (env->cr[4] & CR4_PKS_MASK) {
+            pg_mode |= PG_MODE_PKS;
+        }
+        if (env->cr[4] & CR4_LA57_MASK) {
+            pg_mode |= PG_MODE_LA57;
+        }
+    }
+    return pg_mode;
+}
+
 /* return non zero if error */
 static inline int load_segment_ra(CPUX86State *env, uint32_t *e1_ptr,
                                uint32_t *e2_ptr, int selector,
@@ -795,6 +831,8 @@ static inline target_ulong get_rsp_from_tss(CPUX86State *env, int level)
 {
     X86CPU *cpu = env_archcpu(env);
     int index;
+    target_ulong rsp;
+    int32_t sext;
 
 #if 0
     printf("TR: base=" TARGET_FMT_lx " limit=%x\n",
@@ -808,7 +846,16 @@ static inline target_ulong get_rsp_from_tss(CPUX86State *env, int level)
     if ((index + 7) > env->tr.limit) {
         raise_exception_err(env, EXCP0A_TSS, env->tr.selector & 0xfffc);
     }
-    return cpu_ldq_kernel(env, env->tr.base + index);
+
+    rsp = cpu_ldq_kernel(env, env->tr.base + index);
+
+    /* test virtual address sign extension */
+    sext = rsp >> (get_pg_mode(env) & PG_MODE_LA57 ? 56 : 47);
+    if (sext != 0 && sext != -1) {
+        raise_exception_err(env, EXCP0C_STACK, 0);
+    }
+
+    return rsp;
 }
 
 /* 64 bit interrupt */
diff --git a/target/i386/tcg/sysemu/excp_helper.c b/target/i386/tcg/sysemu/excp_helper.c
index 0410170d64..db4c266c86 100644
--- a/target/i386/tcg/sysemu/excp_helper.c
+++ b/target/i386/tcg/sysemu/excp_helper.c
@@ -21,42 +21,6 @@
 #include "cpu.h"
 #include "tcg/helper-tcg.h"
 
-int get_pg_mode(CPUX86State *env)
-{
-    int pg_mode = 0;
-    if (!(env->cr[0] & CR0_PG_MASK)) {
-        return 0;
-    }
-    if (env->cr[0] & CR0_WP_MASK) {
-        pg_mode |= PG_MODE_WP;
-    }
-    if (env->cr[4] & CR4_PAE_MASK) {
-        pg_mode |= PG_MODE_PAE;
-        if (env->efer & MSR_EFER_NXE) {
-            pg_mode |= PG_MODE_NXE;
-        }
-    }
-    if (env->cr[4] & CR4_PSE_MASK) {
-        pg_mode |= PG_MODE_PSE;
-    }
-    if (env->cr[4] & CR4_SMEP_MASK) {
-        pg_mode |= PG_MODE_SMEP;
-    }
-    if (env->hflags & HF_LMA_MASK) {
-        pg_mode |= PG_MODE_LMA;
-        if (env->cr[4] & CR4_PKE_MASK) {
-            pg_mode |= PG_MODE_PKE;
-        }
-        if (env->cr[4] & CR4_PKS_MASK) {
-            pg_mode |= PG_MODE_PKS;
-        }
-        if (env->cr[4] & CR4_LA57_MASK) {
-            pg_mode |= PG_MODE_LA57;
-        }
-    }
-    return pg_mode;
-}
-
 #define PG_ERROR_OK (-1)
 
 typedef hwaddr (*MMUTranslateFunc)(CPUState *cs, hwaddr gphys, MMUAccessType access_type,
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PULL 12/22] linux-headers: include missing changes from 5.17
  2022-03-08 11:34 [PULL v2 00/22] QEMU changes for 7.0 soft freeze Paolo Bonzini
                   ` (10 preceding siblings ...)
  2022-03-08 11:34 ` [PULL 11/22] target/i386: Throw a #SS when loading a non-canonical IST Paolo Bonzini
@ 2022-03-08 11:34 ` Paolo Bonzini
  2022-03-08 11:34 ` [PULL 13/22] x86: Fix the 64-byte boundary enumeration for extended state Paolo Bonzini
                   ` (10 subsequent siblings)
  22 siblings, 0 replies; 34+ messages in thread
From: Paolo Bonzini @ 2022-03-08 11:34 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 linux-headers/asm-x86/kvm.h | 3 +++
 linux-headers/linux/kvm.h   | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/linux-headers/asm-x86/kvm.h b/linux-headers/asm-x86/kvm.h
index 2da3316bb5..bf6e96011d 100644
--- a/linux-headers/asm-x86/kvm.h
+++ b/linux-headers/asm-x86/kvm.h
@@ -452,6 +452,9 @@ struct kvm_sync_regs {
 
 #define KVM_STATE_VMX_PREEMPTION_TIMER_DEADLINE	0x00000001
 
+/* attributes for system fd (group 0) */
+#define KVM_X86_XCOMP_GUEST_SUPP	0
+
 struct kvm_vmx_nested_state_data {
 	__u8 vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE];
 	__u8 shadow_vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE];
diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h
index 00af3bc333..d232feaae9 100644
--- a/linux-headers/linux/kvm.h
+++ b/linux-headers/linux/kvm.h
@@ -1133,6 +1133,7 @@ struct kvm_ppc_resize_hpt {
 #define KVM_CAP_VM_MOVE_ENC_CONTEXT_FROM 206
 #define KVM_CAP_VM_GPA_BITS 207
 #define KVM_CAP_XSAVE2 208
+#define KVM_CAP_SYS_ATTRIBUTES 209
 
 #ifdef KVM_CAP_IRQ_ROUTING
 
@@ -2047,4 +2048,7 @@ struct kvm_stats_desc {
 
 #define KVM_GET_STATS_FD  _IO(KVMIO,  0xce)
 
+/* Available with KVM_CAP_XSAVE2 */
+#define KVM_GET_XSAVE2		  _IOR(KVMIO,  0xcf, struct kvm_xsave)
+
 #endif /* __LINUX_KVM_H */
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PULL 13/22] x86: Fix the 64-byte boundary enumeration for extended state
  2022-03-08 11:34 [PULL v2 00/22] QEMU changes for 7.0 soft freeze Paolo Bonzini
                   ` (11 preceding siblings ...)
  2022-03-08 11:34 ` [PULL 12/22] linux-headers: include missing changes from 5.17 Paolo Bonzini
@ 2022-03-08 11:34 ` Paolo Bonzini
  2022-03-08 11:34 ` [PULL 14/22] x86: Add AMX XTILECFG and XTILEDATA components Paolo Bonzini
                   ` (9 subsequent siblings)
  22 siblings, 0 replies; 34+ messages in thread
From: Paolo Bonzini @ 2022-03-08 11:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: Yang Zhong, Jing Liu

From: Jing Liu <jing2.liu@intel.com>

The extended state subleaves (EAX=0Dh, ECX=n, n>1).ECX[1]
indicate whether the extended state component locates
on the next 64-byte boundary following the preceding state
component when the compacted format of an XSAVE area is
used.

Right now, they are all zero because no supported component
needed the bit to be set, but the upcoming AMX feature will
use it.  Fix the subleaves value according to KVM's supported
cpuid.

Signed-off-by: Jing Liu <jing2.liu@intel.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20220217060434.52460-2-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/i386/cpu.c         | 1 +
 target/i386/cpu.h         | 6 ++++++
 target/i386/kvm/kvm-cpu.c | 1 +
 3 files changed, 8 insertions(+)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 6c7ef1099b..0f3c477dfc 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -5488,6 +5488,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
                 const ExtSaveArea *esa = &x86_ext_save_areas[count];
                 *eax = esa->size;
                 *ebx = esa->offset;
+                *ecx = esa->ecx & ESA_FEATURE_ALIGN64_MASK;
             }
         }
         break;
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index e69ab5dd78..7bd9d58505 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -550,6 +550,11 @@ typedef enum X86Seg {
 #define XSTATE_Hi16_ZMM_MASK            (1ULL << XSTATE_Hi16_ZMM_BIT)
 #define XSTATE_PKRU_MASK                (1ULL << XSTATE_PKRU_BIT)
 
+#define ESA_FEATURE_ALIGN64_BIT         1
+
+#define ESA_FEATURE_ALIGN64_MASK        (1U << ESA_FEATURE_ALIGN64_BIT)
+
+
 /* CPUID feature words */
 typedef enum FeatureWord {
     FEAT_1_EDX,         /* CPUID[1].EDX */
@@ -1356,6 +1361,7 @@ QEMU_BUILD_BUG_ON(sizeof(XSavePKRU) != 0x8);
 typedef struct ExtSaveArea {
     uint32_t feature, bits;
     uint32_t offset, size;
+    uint32_t ecx;
 } ExtSaveArea;
 
 #define XSAVE_STATE_AREA_COUNT (XSTATE_PKRU_BIT + 1)
diff --git a/target/i386/kvm/kvm-cpu.c b/target/i386/kvm/kvm-cpu.c
index d95028018e..ce27d3b1df 100644
--- a/target/i386/kvm/kvm-cpu.c
+++ b/target/i386/kvm/kvm-cpu.c
@@ -104,6 +104,7 @@ static void kvm_cpu_xsave_init(void)
             if (sz != 0) {
                 assert(esa->size == sz);
                 esa->offset = kvm_arch_get_supported_cpuid(s, 0xd, i, R_EBX);
+                esa->ecx = kvm_arch_get_supported_cpuid(s, 0xd, i, R_ECX);
             }
         }
     }
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PULL 14/22] x86: Add AMX XTILECFG and XTILEDATA components
  2022-03-08 11:34 [PULL v2 00/22] QEMU changes for 7.0 soft freeze Paolo Bonzini
                   ` (12 preceding siblings ...)
  2022-03-08 11:34 ` [PULL 13/22] x86: Fix the 64-byte boundary enumeration for extended state Paolo Bonzini
@ 2022-03-08 11:34 ` Paolo Bonzini
  2022-03-08 11:34 ` [PULL 15/22] x86: Grant AMX permission for guest Paolo Bonzini
                   ` (8 subsequent siblings)
  22 siblings, 0 replies; 34+ messages in thread
From: Paolo Bonzini @ 2022-03-08 11:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: Yang Zhong, Jing Liu

From: Jing Liu <jing2.liu@intel.com>

The AMX TILECFG register and the TMMx tile data registers are
saved/restored via XSAVE, respectively in state component 17
(64 bytes) and state component 18 (8192 bytes).

Add AMX feature bits to x86_ext_save_areas array to set
up AMX components. Add structs that define the layout of
AMX XSAVE areas and use QEMU_BUILD_BUG_ON to validate the
structs sizes.

Signed-off-by: Jing Liu <jing2.liu@intel.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20220217060434.52460-3-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/i386/cpu.c |  8 ++++++++
 target/i386/cpu.h | 18 +++++++++++++++++-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 0f3c477dfc..ec35dd1717 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -1402,6 +1402,14 @@ ExtSaveArea x86_ext_save_areas[XSAVE_STATE_AREA_COUNT] = {
     [XSTATE_PKRU_BIT] =
           { .feature = FEAT_7_0_ECX, .bits = CPUID_7_0_ECX_PKU,
             .size = sizeof(XSavePKRU) },
+    [XSTATE_XTILE_CFG_BIT] = {
+        .feature = FEAT_7_0_EDX, .bits = CPUID_7_0_EDX_AMX_TILE,
+        .size = sizeof(XSaveXTILECFG),
+    },
+    [XSTATE_XTILE_DATA_BIT] = {
+        .feature = FEAT_7_0_EDX, .bits = CPUID_7_0_EDX_AMX_TILE,
+        .size = sizeof(XSaveXTILEDATA)
+    },
 };
 
 static uint32_t xsave_area_size(uint64_t mask)
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 7bd9d58505..3ff1b49d29 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -539,6 +539,8 @@ typedef enum X86Seg {
 #define XSTATE_ZMM_Hi256_BIT            6
 #define XSTATE_Hi16_ZMM_BIT             7
 #define XSTATE_PKRU_BIT                 9
+#define XSTATE_XTILE_CFG_BIT            17
+#define XSTATE_XTILE_DATA_BIT           18
 
 #define XSTATE_FP_MASK                  (1ULL << XSTATE_FP_BIT)
 #define XSTATE_SSE_MASK                 (1ULL << XSTATE_SSE_BIT)
@@ -847,6 +849,8 @@ typedef uint64_t FeatureWordArray[FEATURE_WORDS];
 #define CPUID_7_0_EDX_TSX_LDTRK         (1U << 16)
 /* AVX512_FP16 instruction */
 #define CPUID_7_0_EDX_AVX512_FP16       (1U << 23)
+/* AMX tile (two-dimensional register) */
+#define CPUID_7_0_EDX_AMX_TILE          (1U << 24)
 /* Speculation Control */
 #define CPUID_7_0_EDX_SPEC_CTRL         (1U << 26)
 /* Single Thread Indirect Branch Predictors */
@@ -1350,6 +1354,16 @@ typedef struct XSavePKRU {
     uint32_t padding;
 } XSavePKRU;
 
+/* Ext. save area 17: AMX XTILECFG state */
+typedef struct XSaveXTILECFG {
+    uint8_t xtilecfg[64];
+} XSaveXTILECFG;
+
+/* Ext. save area 18: AMX XTILEDATA state */
+typedef struct XSaveXTILEDATA {
+    uint8_t xtiledata[8][1024];
+} XSaveXTILEDATA;
+
 QEMU_BUILD_BUG_ON(sizeof(XSaveAVX) != 0x100);
 QEMU_BUILD_BUG_ON(sizeof(XSaveBNDREG) != 0x40);
 QEMU_BUILD_BUG_ON(sizeof(XSaveBNDCSR) != 0x40);
@@ -1357,6 +1371,8 @@ QEMU_BUILD_BUG_ON(sizeof(XSaveOpmask) != 0x40);
 QEMU_BUILD_BUG_ON(sizeof(XSaveZMM_Hi256) != 0x200);
 QEMU_BUILD_BUG_ON(sizeof(XSaveHi16_ZMM) != 0x400);
 QEMU_BUILD_BUG_ON(sizeof(XSavePKRU) != 0x8);
+QEMU_BUILD_BUG_ON(sizeof(XSaveXTILECFG) != 0x40);
+QEMU_BUILD_BUG_ON(sizeof(XSaveXTILEDATA) != 0x2000);
 
 typedef struct ExtSaveArea {
     uint32_t feature, bits;
@@ -1364,7 +1380,7 @@ typedef struct ExtSaveArea {
     uint32_t ecx;
 } ExtSaveArea;
 
-#define XSAVE_STATE_AREA_COUNT (XSTATE_PKRU_BIT + 1)
+#define XSAVE_STATE_AREA_COUNT (XSTATE_XTILE_DATA_BIT + 1)
 
 extern ExtSaveArea x86_ext_save_areas[XSAVE_STATE_AREA_COUNT];
 
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PULL 15/22] x86: Grant AMX permission for guest
  2022-03-08 11:34 [PULL v2 00/22] QEMU changes for 7.0 soft freeze Paolo Bonzini
                   ` (13 preceding siblings ...)
  2022-03-08 11:34 ` [PULL 14/22] x86: Add AMX XTILECFG and XTILEDATA components Paolo Bonzini
@ 2022-03-08 11:34 ` Paolo Bonzini
  2022-03-16 15:57   ` Peter Krempa
  2022-03-08 11:34 ` [PULL 16/22] x86: Add XFD faulting bit for state components Paolo Bonzini
                   ` (7 subsequent siblings)
  22 siblings, 1 reply; 34+ messages in thread
From: Paolo Bonzini @ 2022-03-08 11:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: Yang Zhong, Jing Liu

From: Yang Zhong <yang.zhong@intel.com>

Kernel allocates 4K xstate buffer by default. For XSAVE features
which require large state component (e.g. AMX), Linux kernel
dynamically expands the xstate buffer only after the process has
acquired the necessary permissions. Those are called dynamically-
enabled XSAVE features (or dynamic xfeatures).

There are separate permissions for native tasks and guests.

Qemu should request the guest permissions for dynamic xfeatures
which will be exposed to the guest. This only needs to be done
once before the first vcpu is created.

KVM implemented one new ARCH_GET_XCOMP_SUPP system attribute API to
get host side supported_xcr0 and Qemu can decide if it can request
dynamically enabled XSAVE features permission.
https://lore.kernel.org/all/20220126152210.3044876-1-pbonzini@redhat.com/

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Signed-off-by: Jing Liu <jing2.liu@intel.com>
Message-Id: <20220217060434.52460-4-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/i386/cpu.c          |  7 +++++
 target/i386/cpu.h          |  4 +++
 target/i386/kvm/kvm-cpu.c  | 12 ++++----
 target/i386/kvm/kvm.c      | 57 ++++++++++++++++++++++++++++++++++++++
 target/i386/kvm/kvm_i386.h |  1 +
 5 files changed, 75 insertions(+), 6 deletions(-)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index ec35dd1717..505ee289bc 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -6007,6 +6007,7 @@ static void x86_cpu_enable_xsave_components(X86CPU *cpu)
     CPUX86State *env = &cpu->env;
     int i;
     uint64_t mask;
+    static bool request_perm;
 
     if (!(env->features[FEAT_1_ECX] & CPUID_EXT_XSAVE)) {
         env->features[FEAT_XSAVE_COMP_LO] = 0;
@@ -6022,6 +6023,12 @@ static void x86_cpu_enable_xsave_components(X86CPU *cpu)
         }
     }
 
+    /* Only request permission for first vcpu */
+    if (kvm_enabled() && !request_perm) {
+        kvm_request_xsave_components(cpu, mask);
+        request_perm = true;
+    }
+
     env->features[FEAT_XSAVE_COMP_LO] = mask;
     env->features[FEAT_XSAVE_COMP_HI] = mask >> 32;
 }
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 3ff1b49d29..9630f4712a 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -551,6 +551,10 @@ typedef enum X86Seg {
 #define XSTATE_ZMM_Hi256_MASK           (1ULL << XSTATE_ZMM_Hi256_BIT)
 #define XSTATE_Hi16_ZMM_MASK            (1ULL << XSTATE_Hi16_ZMM_BIT)
 #define XSTATE_PKRU_MASK                (1ULL << XSTATE_PKRU_BIT)
+#define XSTATE_XTILE_CFG_MASK           (1ULL << XSTATE_XTILE_CFG_BIT)
+#define XSTATE_XTILE_DATA_MASK          (1ULL << XSTATE_XTILE_DATA_BIT)
+
+#define XSTATE_DYNAMIC_MASK             (XSTATE_XTILE_DATA_MASK)
 
 #define ESA_FEATURE_ALIGN64_BIT         1
 
diff --git a/target/i386/kvm/kvm-cpu.c b/target/i386/kvm/kvm-cpu.c
index ce27d3b1df..a35a1bf9fe 100644
--- a/target/i386/kvm/kvm-cpu.c
+++ b/target/i386/kvm/kvm-cpu.c
@@ -84,7 +84,7 @@ static void kvm_cpu_max_instance_init(X86CPU *cpu)
 static void kvm_cpu_xsave_init(void)
 {
     static bool first = true;
-    KVMState *s = kvm_state;
+    uint32_t eax, ebx, ecx, edx;
     int i;
 
     if (!first) {
@@ -100,11 +100,11 @@ static void kvm_cpu_xsave_init(void)
         ExtSaveArea *esa = &x86_ext_save_areas[i];
 
         if (esa->size) {
-            int sz = kvm_arch_get_supported_cpuid(s, 0xd, i, R_EAX);
-            if (sz != 0) {
-                assert(esa->size == sz);
-                esa->offset = kvm_arch_get_supported_cpuid(s, 0xd, i, R_EBX);
-                esa->ecx = kvm_arch_get_supported_cpuid(s, 0xd, i, R_ECX);
+            host_cpuid(0xd, i, &eax, &ebx, &ecx, &edx);
+            if (eax != 0) {
+                assert(esa->size == eax);
+                esa->offset = ebx;
+                esa->ecx = ecx;
             }
         }
     }
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index cfef36a14e..1e4436ee74 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -17,6 +17,7 @@
 #include "qapi/error.h"
 #include <sys/ioctl.h>
 #include <sys/utsname.h>
+#include <sys/syscall.h>
 
 #include <linux/kvm.h>
 #include "standard-headers/asm-x86/kvm_para.h"
@@ -348,6 +349,7 @@ uint32_t kvm_arch_get_supported_cpuid(KVMState *s, uint32_t function,
     struct kvm_cpuid2 *cpuid;
     uint32_t ret = 0;
     uint32_t cpuid_1_edx;
+    uint64_t bitmask;
 
     cpuid = get_supported_cpuid(s);
 
@@ -405,6 +407,25 @@ uint32_t kvm_arch_get_supported_cpuid(KVMState *s, uint32_t function,
         if (!has_msr_arch_capabs) {
             ret &= ~CPUID_7_0_EDX_ARCH_CAPABILITIES;
         }
+    } else if (function == 0xd && index == 0 &&
+               (reg == R_EAX || reg == R_EDX)) {
+        struct kvm_device_attr attr = {
+            .group = 0,
+            .attr = KVM_X86_XCOMP_GUEST_SUPP,
+            .addr = (unsigned long) &bitmask
+        };
+
+        bool sys_attr = kvm_check_extension(s, KVM_CAP_SYS_ATTRIBUTES);
+        if (!sys_attr) {
+            warn_report("cannot get sys attribute capabilities %d", sys_attr);
+        }
+
+        int rc = kvm_ioctl(s, KVM_GET_DEVICE_ATTR, &attr);
+        if (rc == -1 && (errno == ENXIO || errno == EINVAL)) {
+            warn_report("KVM_GET_DEVICE_ATTR(0, KVM_X86_XCOMP_GUEST_SUPP) "
+                        "error: %d", rc);
+        }
+        ret = (reg == R_EAX) ? bitmask : bitmask >> 32;
     } else if (function == 0x80000001 && reg == R_ECX) {
         /*
          * It's safe to enable TOPOEXT even if it's not returned by
@@ -5150,3 +5171,39 @@ bool kvm_arch_cpu_check_are_resettable(void)
 {
     return !sev_es_enabled();
 }
+
+#define ARCH_REQ_XCOMP_GUEST_PERM       0x1025
+
+void kvm_request_xsave_components(X86CPU *cpu, uint64_t mask)
+{
+    KVMState *s = kvm_state;
+    uint64_t supported;
+
+    mask &= XSTATE_DYNAMIC_MASK;
+    if (!mask) {
+        return;
+    }
+    /*
+     * Just ignore bits that are not in CPUID[EAX=0xD,ECX=0].
+     * ARCH_REQ_XCOMP_GUEST_PERM would fail, and QEMU has warned
+     * about them already because they are not supported features.
+     */
+    supported = kvm_arch_get_supported_cpuid(s, 0xd, 0, R_EAX);
+    supported |= (uint64_t)kvm_arch_get_supported_cpuid(s, 0xd, 0, R_EDX) << 32;
+    mask &= supported;
+
+    while (mask) {
+        int bit = ctz64(mask);
+        int rc = syscall(SYS_arch_prctl, ARCH_REQ_XCOMP_GUEST_PERM, bit);
+        if (rc) {
+            /*
+             * Older kernel version (<5.17) do not support
+             * ARCH_REQ_XCOMP_GUEST_PERM, but also do not return
+             * any dynamic feature from kvm_arch_get_supported_cpuid.
+             */
+            warn_report("prctl(ARCH_REQ_XCOMP_GUEST_PERM) failure "
+                        "for feature bit %d", bit);
+        }
+        mask &= ~BIT_ULL(bit);
+    }
+}
diff --git a/target/i386/kvm/kvm_i386.h b/target/i386/kvm/kvm_i386.h
index a978509d50..4124912c20 100644
--- a/target/i386/kvm/kvm_i386.h
+++ b/target/i386/kvm/kvm_i386.h
@@ -52,5 +52,6 @@ bool kvm_hyperv_expand_features(X86CPU *cpu, Error **errp);
 uint64_t kvm_swizzle_msi_ext_dest_id(uint64_t address);
 
 bool kvm_enable_sgx_provisioning(KVMState *s);
+void kvm_request_xsave_components(X86CPU *cpu, uint64_t mask);
 
 #endif
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PULL 16/22] x86: Add XFD faulting bit for state components
  2022-03-08 11:34 [PULL v2 00/22] QEMU changes for 7.0 soft freeze Paolo Bonzini
                   ` (14 preceding siblings ...)
  2022-03-08 11:34 ` [PULL 15/22] x86: Grant AMX permission for guest Paolo Bonzini
@ 2022-03-08 11:34 ` Paolo Bonzini
  2022-03-08 11:34 ` [PULL 17/22] x86: Add AMX CPUIDs enumeration Paolo Bonzini
                   ` (6 subsequent siblings)
  22 siblings, 0 replies; 34+ messages in thread
From: Paolo Bonzini @ 2022-03-08 11:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: Yang Zhong, Jing Liu

From: Jing Liu <jing2.liu@intel.com>

Intel introduces XFD faulting mechanism for extended
XSAVE features to dynamically enable the features in
runtime. If CPUID (EAX=0Dh, ECX=n, n>1).ECX[2] is set
as 1, it indicates support for XFD faulting of this
state component.

Signed-off-by: Jing Liu <jing2.liu@intel.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20220217060434.52460-5-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/i386/cpu.c | 3 ++-
 target/i386/cpu.h | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 505ee289bc..79e24bb23f 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -5496,7 +5496,8 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
                 const ExtSaveArea *esa = &x86_ext_save_areas[count];
                 *eax = esa->size;
                 *ebx = esa->offset;
-                *ecx = esa->ecx & ESA_FEATURE_ALIGN64_MASK;
+                *ecx = esa->ecx &
+                       (ESA_FEATURE_ALIGN64_MASK | ESA_FEATURE_XFD_MASK);
             }
         }
         break;
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 9630f4712a..925d0129e2 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -557,8 +557,10 @@ typedef enum X86Seg {
 #define XSTATE_DYNAMIC_MASK             (XSTATE_XTILE_DATA_MASK)
 
 #define ESA_FEATURE_ALIGN64_BIT         1
+#define ESA_FEATURE_XFD_BIT             2
 
 #define ESA_FEATURE_ALIGN64_MASK        (1U << ESA_FEATURE_ALIGN64_BIT)
+#define ESA_FEATURE_XFD_MASK            (1U << ESA_FEATURE_XFD_BIT)
 
 
 /* CPUID feature words */
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PULL 17/22] x86: Add AMX CPUIDs enumeration
  2022-03-08 11:34 [PULL v2 00/22] QEMU changes for 7.0 soft freeze Paolo Bonzini
                   ` (15 preceding siblings ...)
  2022-03-08 11:34 ` [PULL 16/22] x86: Add XFD faulting bit for state components Paolo Bonzini
@ 2022-03-08 11:34 ` Paolo Bonzini
  2022-03-08 11:34 ` [PULL 18/22] x86: add support for KVM_CAP_XSAVE2 and AMX state migration Paolo Bonzini
                   ` (5 subsequent siblings)
  22 siblings, 0 replies; 34+ messages in thread
From: Paolo Bonzini @ 2022-03-08 11:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: Yang Zhong, Jing Liu

From: Jing Liu <jing2.liu@intel.com>

Add AMX primary feature bits XFD and AMX_TILE to
enumerate the CPU's AMX capability. Meanwhile, add
AMX TILE and TMUL CPUID leaf and subleaves which
exist when AMX TILE is present to provide the maximum
capability of TILE and TMUL.

Signed-off-by: Jing Liu <jing2.liu@intel.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20220217060434.52460-6-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/i386/cpu.c     | 55 ++++++++++++++++++++++++++++++++++++++++---
 target/i386/kvm/kvm.c |  4 +++-
 2 files changed, 55 insertions(+), 4 deletions(-)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 79e24bb23f..351a1e4f2a 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -575,6 +575,18 @@ static CPUCacheInfo legacy_l3_cache = {
 #define INTEL_PT_CYCLE_BITMAP    0x1fff         /* Support 0,2^(0~11) */
 #define INTEL_PT_PSB_BITMAP      (0x003f << 16) /* Support 2K,4K,8K,16K,32K,64K */
 
+/* CPUID Leaf 0x1D constants: */
+#define INTEL_AMX_TILE_MAX_SUBLEAF     0x1
+#define INTEL_AMX_TOTAL_TILE_BYTES     0x2000
+#define INTEL_AMX_BYTES_PER_TILE       0x400
+#define INTEL_AMX_BYTES_PER_ROW        0x40
+#define INTEL_AMX_TILE_MAX_NAMES       0x8
+#define INTEL_AMX_TILE_MAX_ROWS        0x10
+
+/* CPUID Leaf 0x1E constants: */
+#define INTEL_AMX_TMUL_MAX_K           0x10
+#define INTEL_AMX_TMUL_MAX_N           0x40
+
 void x86_cpu_vendor_words2str(char *dst, uint32_t vendor1,
                               uint32_t vendor2, uint32_t vendor3)
 {
@@ -844,8 +856,8 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
             "avx512-vp2intersect", NULL, "md-clear", NULL,
             NULL, NULL, "serialize", NULL,
             "tsx-ldtrk", NULL, NULL /* pconfig */, NULL,
-            NULL, NULL, NULL, "avx512-fp16",
-            NULL, NULL, "spec-ctrl", "stibp",
+            NULL, NULL, "amx-bf16", "avx512-fp16",
+            "amx-tile", "amx-int8", "spec-ctrl", "stibp",
             NULL, "arch-capabilities", "core-capability", "ssbd",
         },
         .cpuid = {
@@ -910,7 +922,7 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
         .type = CPUID_FEATURE_WORD,
         .feat_names = {
             "xsaveopt", "xsavec", "xgetbv1", "xsaves",
-            NULL, NULL, NULL, NULL,
+            "xfd", NULL, NULL, NULL,
             NULL, NULL, NULL, NULL,
             NULL, NULL, NULL, NULL,
             NULL, NULL, NULL, NULL,
@@ -5586,6 +5598,43 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
         }
         break;
     }
+    case 0x1D: {
+        /* AMX TILE */
+        *eax = 0;
+        *ebx = 0;
+        *ecx = 0;
+        *edx = 0;
+        if (!(env->features[FEAT_7_0_EDX] & CPUID_7_0_EDX_AMX_TILE)) {
+            break;
+        }
+
+        if (count == 0) {
+            /* Highest numbered palette subleaf */
+            *eax = INTEL_AMX_TILE_MAX_SUBLEAF;
+        } else if (count == 1) {
+            *eax = INTEL_AMX_TOTAL_TILE_BYTES |
+                   (INTEL_AMX_BYTES_PER_TILE << 16);
+            *ebx = INTEL_AMX_BYTES_PER_ROW | (INTEL_AMX_TILE_MAX_NAMES << 16);
+            *ecx = INTEL_AMX_TILE_MAX_ROWS;
+        }
+        break;
+    }
+    case 0x1E: {
+        /* AMX TMUL */
+        *eax = 0;
+        *ebx = 0;
+        *ecx = 0;
+        *edx = 0;
+        if (!(env->features[FEAT_7_0_EDX] & CPUID_7_0_EDX_AMX_TILE)) {
+            break;
+        }
+
+        if (count == 0) {
+            /* Highest numbered palette subleaf */
+            *ebx = INTEL_AMX_TMUL_MAX_K | (INTEL_AMX_TMUL_MAX_N << 8);
+        }
+        break;
+    }
     case 0x40000000:
         /*
          * CPUID code in kvm_arch_init_vcpu() ignores stuff
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index 1e4436ee74..385c5f8ed3 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -1780,7 +1780,9 @@ int kvm_arch_init_vcpu(CPUState *cs)
                 c = &cpuid_data.entries[cpuid_i++];
             }
             break;
-        case 0x14: {
+        case 0x14:
+        case 0x1d:
+        case 0x1e: {
             uint32_t times;
 
             c->function = i;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PULL 18/22] x86: add support for KVM_CAP_XSAVE2 and AMX state migration
  2022-03-08 11:34 [PULL v2 00/22] QEMU changes for 7.0 soft freeze Paolo Bonzini
                   ` (16 preceding siblings ...)
  2022-03-08 11:34 ` [PULL 17/22] x86: Add AMX CPUIDs enumeration Paolo Bonzini
@ 2022-03-08 11:34 ` Paolo Bonzini
  2022-03-08 11:34 ` [PULL 19/22] x86: Support XFD and AMX xsave data migration Paolo Bonzini
                   ` (4 subsequent siblings)
  22 siblings, 0 replies; 34+ messages in thread
From: Paolo Bonzini @ 2022-03-08 11:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: Yang Zhong, Zeng Guang, Wei Wang, Jing Liu

From: Jing Liu <jing2.liu@intel.com>

When dynamic xfeatures (e.g. AMX) are used by the guest, the xsave
area would be larger than 4KB. KVM_GET_XSAVE2 and KVM_SET_XSAVE
under KVM_CAP_XSAVE2 works with a xsave buffer larger than 4KB.
Always use the new ioctls under KVM_CAP_XSAVE2 when KVM supports it.

Signed-off-by: Jing Liu <jing2.liu@intel.com>
Signed-off-by: Zeng Guang <guang.zeng@intel.com>
Signed-off-by: Wei Wang <wei.w.wang@intel.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20220217060434.52460-7-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/i386/cpu.h          |  4 ++++
 target/i386/kvm/kvm.c      | 42 ++++++++++++++++++++++++--------------
 target/i386/xsave_helper.c | 28 +++++++++++++++++++++++++
 3 files changed, 59 insertions(+), 15 deletions(-)

diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 925d0129e2..8c850e74b8 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -1527,6 +1527,10 @@ typedef struct CPUX86State {
     uint64_t opmask_regs[NB_OPMASK_REGS];
     YMMReg zmmh_regs[CPU_NB_REGS];
     ZMMReg hi16_zmm_regs[CPU_NB_REGS];
+#ifdef TARGET_X86_64
+    uint8_t xtilecfg[64];
+    uint8_t xtiledata[8192];
+#endif
 
     /* sysenter registers */
     uint32_t sysenter_cs;
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index 385c5f8ed3..0fbdeacbb7 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -123,6 +123,7 @@ static uint32_t num_architectural_pmu_gp_counters;
 static uint32_t num_architectural_pmu_fixed_counters;
 
 static int has_xsave;
+static int has_xsave2;
 static int has_xcrs;
 static int has_pit_state2;
 static int has_sregs2;
@@ -1586,6 +1587,26 @@ static Error *invtsc_mig_blocker;
 
 #define KVM_MAX_CPUID_ENTRIES  100
 
+static void kvm_init_xsave(CPUX86State *env)
+{
+    if (has_xsave2) {
+        env->xsave_buf_len = QEMU_ALIGN_UP(has_xsave2, 4096);
+    } else if (has_xsave) {
+        env->xsave_buf_len = sizeof(struct kvm_xsave);
+    } else {
+        return;
+    }
+
+    env->xsave_buf = qemu_memalign(4096, env->xsave_buf_len);
+    memset(env->xsave_buf, 0, env->xsave_buf_len);
+    /*
+     * The allocated storage must be large enough for all of the
+     * possible XSAVE state components.
+     */
+    assert(kvm_arch_get_supported_cpuid(kvm_state, 0xd, 0, R_ECX) <=
+           env->xsave_buf_len);
+}
+
 int kvm_arch_init_vcpu(CPUState *cs)
 {
     struct {
@@ -1615,6 +1636,8 @@ int kvm_arch_init_vcpu(CPUState *cs)
 
     cpuid_i = 0;
 
+    has_xsave2 = kvm_check_extension(cs->kvm_state, KVM_CAP_XSAVE2);
+
     r = kvm_arch_set_tsc_khz(cs);
     if (r < 0) {
         return r;
@@ -2004,19 +2027,7 @@ int kvm_arch_init_vcpu(CPUState *cs)
     if (r) {
         goto fail;
     }
-
-    if (has_xsave) {
-        env->xsave_buf_len = sizeof(struct kvm_xsave);
-        env->xsave_buf = qemu_memalign(4096, env->xsave_buf_len);
-        memset(env->xsave_buf, 0, env->xsave_buf_len);
-
-        /*
-         * The allocated storage must be large enough for all of the
-         * possible XSAVE state components.
-         */
-        assert(kvm_arch_get_supported_cpuid(kvm_state, 0xd, 0, R_ECX)
-               <= env->xsave_buf_len);
-    }
+    kvm_init_xsave(env);
 
     max_nested_state_len = kvm_max_nested_state_length();
     if (max_nested_state_len > 0) {
@@ -3320,13 +3331,14 @@ static int kvm_get_xsave(X86CPU *cpu)
 {
     CPUX86State *env = &cpu->env;
     void *xsave = env->xsave_buf;
-    int ret;
+    int type, ret;
 
     if (!has_xsave) {
         return kvm_get_fpu(cpu);
     }
 
-    ret = kvm_vcpu_ioctl(CPU(cpu), KVM_GET_XSAVE, xsave);
+    type = has_xsave2 ? KVM_GET_XSAVE2 : KVM_GET_XSAVE;
+    ret = kvm_vcpu_ioctl(CPU(cpu), type, xsave);
     if (ret < 0) {
         return ret;
     }
diff --git a/target/i386/xsave_helper.c b/target/i386/xsave_helper.c
index ac61a96344..996e9f3bfe 100644
--- a/target/i386/xsave_helper.c
+++ b/target/i386/xsave_helper.c
@@ -126,6 +126,20 @@ void x86_cpu_xsave_all_areas(X86CPU *cpu, void *buf, uint32_t buflen)
 
         memcpy(pkru, &env->pkru, sizeof(env->pkru));
     }
+
+    e = &x86_ext_save_areas[XSTATE_XTILE_CFG_BIT];
+    if (e->size && e->offset) {
+        XSaveXTILECFG *tilecfg = buf + e->offset;
+
+        memcpy(tilecfg, &env->xtilecfg, sizeof(env->xtilecfg));
+    }
+
+    e = &x86_ext_save_areas[XSTATE_XTILE_DATA_BIT];
+    if (e->size && e->offset && buflen >= e->size + e->offset) {
+        XSaveXTILEDATA *tiledata = buf + e->offset;
+
+        memcpy(tiledata, &env->xtiledata, sizeof(env->xtiledata));
+    }
 #endif
 }
 
@@ -247,5 +261,19 @@ void x86_cpu_xrstor_all_areas(X86CPU *cpu, const void *buf, uint32_t buflen)
         pkru = buf + e->offset;
         memcpy(&env->pkru, pkru, sizeof(env->pkru));
     }
+
+    e = &x86_ext_save_areas[XSTATE_XTILE_CFG_BIT];
+    if (e->size && e->offset) {
+        const XSaveXTILECFG *tilecfg = buf + e->offset;
+
+        memcpy(&env->xtilecfg, tilecfg, sizeof(env->xtilecfg));
+    }
+
+    e = &x86_ext_save_areas[XSTATE_XTILE_DATA_BIT];
+    if (e->size && e->offset && buflen >= e->size + e->offset) {
+        const XSaveXTILEDATA *tiledata = buf + e->offset;
+
+        memcpy(&env->xtiledata, tiledata, sizeof(env->xtiledata));
+    }
 #endif
 }
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PULL 19/22] x86: Support XFD and AMX xsave data migration
  2022-03-08 11:34 [PULL v2 00/22] QEMU changes for 7.0 soft freeze Paolo Bonzini
                   ` (17 preceding siblings ...)
  2022-03-08 11:34 ` [PULL 18/22] x86: add support for KVM_CAP_XSAVE2 and AMX state migration Paolo Bonzini
@ 2022-03-08 11:34 ` Paolo Bonzini
  2022-03-08 11:34 ` [PULL 20/22] i386: Add Icelake-Server-v6 CPU model with 5-level EPT support Paolo Bonzini
                   ` (3 subsequent siblings)
  22 siblings, 0 replies; 34+ messages in thread
From: Paolo Bonzini @ 2022-03-08 11:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: Yang Zhong, Zeng Guang, Wei Wang

From: Zeng Guang <guang.zeng@intel.com>

XFD(eXtended Feature Disable) allows to enable a
feature on xsave state while preventing specific
user threads from using the feature.

Support save and restore XFD MSRs if CPUID.D.1.EAX[4]
enumerate to be valid. Likewise migrate the MSRs and
related xsave state necessarily.

Signed-off-by: Zeng Guang <guang.zeng@intel.com>
Signed-off-by: Wei Wang <wei.w.wang@intel.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20220217060434.52460-8-yang.zhong@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/i386/cpu.h     |  9 +++++++++
 target/i386/kvm/kvm.c | 18 +++++++++++++++++
 target/i386/machine.c | 46 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 73 insertions(+)

diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 8c850e74b8..efea2c78ec 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -507,6 +507,9 @@ typedef enum X86Seg {
 
 #define MSR_VM_HSAVE_PA                 0xc0010117
 
+#define MSR_IA32_XFD                    0x000001c4
+#define MSR_IA32_XFD_ERR                0x000001c5
+
 #define MSR_IA32_BNDCFGS                0x00000d90
 #define MSR_IA32_XSS                    0x00000da0
 #define MSR_IA32_UMWAIT_CONTROL         0xe1
@@ -872,6 +875,8 @@ typedef uint64_t FeatureWordArray[FEATURE_WORDS];
 #define CPUID_7_1_EAX_AVX_VNNI          (1U << 4)
 /* AVX512 BFloat16 Instruction */
 #define CPUID_7_1_EAX_AVX512_BF16       (1U << 5)
+/* XFD Extend Feature Disabled */
+#define CPUID_D_1_EAX_XFD               (1U << 4)
 
 /* Packets which contain IP payload have LIP values */
 #define CPUID_14_0_ECX_LIP              (1U << 31)
@@ -1616,6 +1621,10 @@ typedef struct CPUX86State {
     uint64_t msr_rtit_cr3_match;
     uint64_t msr_rtit_addrs[MAX_RTIT_ADDRS];
 
+    /* Per-VCPU XFD MSRs */
+    uint64_t msr_xfd;
+    uint64_t msr_xfd_err;
+
     /* exception/interrupt handling */
     int error_code;
     int exception_is_int;
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index 0fbdeacbb7..debac04e91 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -3276,6 +3276,13 @@ static int kvm_put_msrs(X86CPU *cpu, int level)
                               env->msr_ia32_sgxlepubkeyhash[3]);
         }
 
+        if (env->features[FEAT_XSAVE] & CPUID_D_1_EAX_XFD) {
+            kvm_msr_entry_add(cpu, MSR_IA32_XFD,
+                              env->msr_xfd);
+            kvm_msr_entry_add(cpu, MSR_IA32_XFD_ERR,
+                              env->msr_xfd_err);
+        }
+
         /* Note: MSR_IA32_FEATURE_CONTROL is written separately, see
          *       kvm_put_msr_feature_control. */
     }
@@ -3668,6 +3675,11 @@ static int kvm_get_msrs(X86CPU *cpu)
         kvm_msr_entry_add(cpu, MSR_IA32_SGXLEPUBKEYHASH3, 0);
     }
 
+    if (env->features[FEAT_XSAVE] & CPUID_D_1_EAX_XFD) {
+        kvm_msr_entry_add(cpu, MSR_IA32_XFD, 0);
+        kvm_msr_entry_add(cpu, MSR_IA32_XFD_ERR, 0);
+    }
+
     ret = kvm_vcpu_ioctl(CPU(cpu), KVM_GET_MSRS, cpu->kvm_msr_buf);
     if (ret < 0) {
         return ret;
@@ -3964,6 +3976,12 @@ static int kvm_get_msrs(X86CPU *cpu)
             env->msr_ia32_sgxlepubkeyhash[index - MSR_IA32_SGXLEPUBKEYHASH0] =
                            msrs[i].data;
             break;
+        case MSR_IA32_XFD:
+            env->msr_xfd = msrs[i].data;
+            break;
+        case MSR_IA32_XFD_ERR:
+            env->msr_xfd_err = msrs[i].data;
+            break;
         }
     }
 
diff --git a/target/i386/machine.c b/target/i386/machine.c
index 6202f47793..7c54bada81 100644
--- a/target/i386/machine.c
+++ b/target/i386/machine.c
@@ -1483,6 +1483,48 @@ static const VMStateDescription vmstate_pdptrs = {
     }
 };
 
+static bool xfd_msrs_needed(void *opaque)
+{
+    X86CPU *cpu = opaque;
+    CPUX86State *env = &cpu->env;
+
+    return !!(env->features[FEAT_XSAVE] & CPUID_D_1_EAX_XFD);
+}
+
+static const VMStateDescription vmstate_msr_xfd = {
+    .name = "cpu/msr_xfd",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .needed = xfd_msrs_needed,
+    .fields = (VMStateField[]) {
+        VMSTATE_UINT64(env.msr_xfd, X86CPU),
+        VMSTATE_UINT64(env.msr_xfd_err, X86CPU),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
+#ifdef TARGET_X86_64
+static bool amx_xtile_needed(void *opaque)
+{
+    X86CPU *cpu = opaque;
+    CPUX86State *env = &cpu->env;
+
+    return !!(env->features[FEAT_7_0_EDX] & CPUID_7_0_EDX_AMX_TILE);
+}
+
+static const VMStateDescription vmstate_amx_xtile = {
+    .name = "cpu/intel_amx_xtile",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .needed = amx_xtile_needed,
+    .fields = (VMStateField[]) {
+        VMSTATE_UINT8_ARRAY(env.xtilecfg, X86CPU, 64),
+        VMSTATE_UINT8_ARRAY(env.xtiledata, X86CPU, 8192),
+        VMSTATE_END_OF_LIST()
+    }
+};
+#endif
+
 const VMStateDescription vmstate_x86_cpu = {
     .name = "cpu",
     .version_id = 12,
@@ -1622,6 +1664,10 @@ const VMStateDescription vmstate_x86_cpu = {
         &vmstate_msr_tsx_ctrl,
         &vmstate_msr_intel_sgx,
         &vmstate_pdptrs,
+        &vmstate_msr_xfd,
+#ifdef TARGET_X86_64
+        &vmstate_amx_xtile,
+#endif
         NULL
     }
 };
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PULL 20/22] i386: Add Icelake-Server-v6 CPU model with 5-level EPT support
  2022-03-08 11:34 [PULL v2 00/22] QEMU changes for 7.0 soft freeze Paolo Bonzini
                   ` (18 preceding siblings ...)
  2022-03-08 11:34 ` [PULL 19/22] x86: Support XFD and AMX xsave data migration Paolo Bonzini
@ 2022-03-08 11:34 ` Paolo Bonzini
  2022-03-08 11:34 ` [PULL 21/22] KVM: SVM: always set MSR_AMD64_TSC_RATIO to default value Paolo Bonzini
                   ` (2 subsequent siblings)
  22 siblings, 0 replies; 34+ messages in thread
From: Paolo Bonzini @ 2022-03-08 11:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: Vitaly Kuznetsov

From: Vitaly Kuznetsov <vkuznets@redhat.com>

Windows 11 with WSL2 enabled (Hyper-V) fails to boot with Icelake-Server
{-v5} CPU model but boots well with '-cpu host'. Apparently, it expects
5-level paging and 5-level EPT support to come in pair but QEMU's
Icelake-Server CPU model lacks the later. Introduce 'Icelake-Server-v6'
CPU model with 'vmx-page-walk-5' enabled by default.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Message-Id: <20220221145316.576138-1-vkuznets@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/i386/cpu.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 351a1e4f2a..916d3354fe 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -3526,6 +3526,14 @@ static const X86CPUDefinition builtin_x86_defs[] = {
                     { /* end of list */ }
                 },
             },
+            {
+                .version = 6,
+                .note = "5-level EPT",
+                .props = (PropValue[]) {
+                    { "vmx-page-walk-5", "on" },
+                    { /* end of list */ }
+                },
+            },
             { /* end of list */ }
         }
     },
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PULL 21/22] KVM: SVM: always set MSR_AMD64_TSC_RATIO to default value
  2022-03-08 11:34 [PULL v2 00/22] QEMU changes for 7.0 soft freeze Paolo Bonzini
                   ` (19 preceding siblings ...)
  2022-03-08 11:34 ` [PULL 20/22] i386: Add Icelake-Server-v6 CPU model with 5-level EPT support Paolo Bonzini
@ 2022-03-08 11:34 ` Paolo Bonzini
  2022-03-08 11:34 ` [PULL 22/22] gitlab-ci: do not run tests with address sanitizer Paolo Bonzini
  2022-03-10 12:09 ` [PULL v2 00/22] QEMU changes for 7.0 soft freeze Peter Maydell
  22 siblings, 0 replies; 34+ messages in thread
From: Paolo Bonzini @ 2022-03-08 11:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: Maxim Levitsky

From: Maxim Levitsky <mlevitsk@redhat.com>

Even when the feature is not supported in guest CPUID,
still set the msr to the default value which will
be the only value KVM will accept in this case

Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Message-Id: <20220223115824.319821-1-mlevitsk@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/i386/cpu.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 916d3354fe..a88d6554c8 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -5997,9 +5997,7 @@ static void x86_cpu_reset(DeviceState *dev)
 
     x86_cpu_set_sgxlepubkeyhash(env);
 
-    if (env->features[FEAT_SVM] & CPUID_SVM_TSCSCALE) {
-        env->amd_tsc_scale_msr =  MSR_AMD64_TSC_RATIO_DEFAULT;
-    }
+    env->amd_tsc_scale_msr =  MSR_AMD64_TSC_RATIO_DEFAULT;
 
 #endif
 }
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PULL 22/22] gitlab-ci: do not run tests with address sanitizer
  2022-03-08 11:34 [PULL v2 00/22] QEMU changes for 7.0 soft freeze Paolo Bonzini
                   ` (20 preceding siblings ...)
  2022-03-08 11:34 ` [PULL 21/22] KVM: SVM: always set MSR_AMD64_TSC_RATIO to default value Paolo Bonzini
@ 2022-03-08 11:34 ` Paolo Bonzini
  2022-03-10 12:09 ` [PULL v2 00/22] QEMU changes for 7.0 soft freeze Peter Maydell
  22 siblings, 0 replies; 34+ messages in thread
From: Paolo Bonzini @ 2022-03-08 11:34 UTC (permalink / raw)
  To: qemu-devel

This is flaky and sometimes fails or hangs unexplicably.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 .gitlab-ci.d/buildtest.yml | 2 --
 1 file changed, 2 deletions(-)

diff --git a/.gitlab-ci.d/buildtest.yml b/.gitlab-ci.d/buildtest.yml
index 0aa70213fb..0aea7ab84c 100644
--- a/.gitlab-ci.d/buildtest.yml
+++ b/.gitlab-ci.d/buildtest.yml
@@ -515,8 +515,6 @@ build-oss-fuzz:
         echo Testing ${fuzzer} ... ;
         "${fuzzer}" -runs=1 -seed=1 || exit 1 ;
       done
-    # Unrelated to fuzzer: run some tests with -fsanitize=address
-    - cd build-oss-fuzz && make check-qtest-i386 check-unit
 
 build-tci:
   extends: .native_build_job_template
-- 
2.35.1



^ permalink raw reply related	[flat|nested] 34+ messages in thread

* Re: [PULL v2 00/22] QEMU changes for 7.0 soft freeze
  2022-03-08 11:34 [PULL v2 00/22] QEMU changes for 7.0 soft freeze Paolo Bonzini
                   ` (21 preceding siblings ...)
  2022-03-08 11:34 ` [PULL 22/22] gitlab-ci: do not run tests with address sanitizer Paolo Bonzini
@ 2022-03-10 12:09 ` Peter Maydell
  22 siblings, 0 replies; 34+ messages in thread
From: Peter Maydell @ 2022-03-10 12:09 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel

On Tue, 8 Mar 2022 at 11:38, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> The following changes since commit 99c53410bc9d50e556f565b0960673cccb566452:
>
>   Merge remote-tracking branch 'remotes/thuth-gitlab/tags/pull-request-2022-02-28' into staging (2022-03-01 13:25:54 +0000)
>
> are available in the Git repository at:
>
>   https://gitlab.com/bonzini/qemu.git tags/for-upstream
>
> for you to fetch changes up to d722beb6ac1d457bfa3d7dd5bce7bcea5ea45540:
>
>   gitlab-ci: do not run tests with address sanitizer (2022-03-08 12:34:12 +0100)
>
> ----------------------------------------------------------------
> * whpx fixes in preparation for GDB support (Ivan)
> * VSS header fixes (Marc-André)
> * 5-level EPT support (Vitaly)
> * AMX support (Jing Liu & Yang Zhong)
> * Bundle changes to MSI routes (Longpeng)
> * More precise emulation of #SS (Gareth)
> * Disable ASAN testing
>

This seems to fail on the jobs that run check-acceptance:
https://gitlab.com/qemu-project/qemu/-/jobs/2186949883
https://gitlab.com/qemu-project/qemu/-/jobs/2186949881
https://gitlab.com/qemu-project/qemu/-/jobs/2186949890

because the TCG boot tests for i440fx and q35 hang:

(001/183) tests/avocado/boot_linux.py:BootLinuxX8664.test_pc_i440fx_tcg:
INTERRUPTED: Test interrupted by SIGTERM\nRunner error occurred:
Timeout reached\nOriginal status: ERROR\n{'name':
'001-tests/avocado/boot_linux.py:BootLinuxX8664.test_pc_i440fx_tcg',
'logdir': '/builds/qemu-project/qemu/build/tests/results/job-2022-03-10T11.02-cc7d226/t...
(900.76 s)

(003/183) tests/avocado/boot_linux.py:BootLinuxX8664.test_pc_q35_tcg:
INTERRUPTED: Test interrupted by SIGTERM\nRunner error occurred:
Timeout reached\nOriginal status: ERROR\n{'name':
'003-tests/avocado/boot_linux.py:BootLinuxX8664.test_pc_q35_tcg',
'logdir': '/builds/qemu-project/qemu/build/tests/results/job-2022-03-10T11.02-cc7d226/test...
(901.26 s)


-- PMM


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PULL 15/22] x86: Grant AMX permission for guest
  2022-03-08 11:34 ` [PULL 15/22] x86: Grant AMX permission for guest Paolo Bonzini
@ 2022-03-16 15:57   ` Peter Krempa
  2022-03-16 16:05     ` Daniel P. Berrangé
                       ` (3 more replies)
  0 siblings, 4 replies; 34+ messages in thread
From: Peter Krempa @ 2022-03-16 15:57 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Yang Zhong, qemu-devel, Jing Liu

On Tue, Mar 08, 2022 at 12:34:38 +0100, Paolo Bonzini wrote:
> From: Yang Zhong <yang.zhong@intel.com>
> 
> Kernel allocates 4K xstate buffer by default. For XSAVE features
> which require large state component (e.g. AMX), Linux kernel
> dynamically expands the xstate buffer only after the process has
> acquired the necessary permissions. Those are called dynamically-
> enabled XSAVE features (or dynamic xfeatures).
> 
> There are separate permissions for native tasks and guests.
> 
> Qemu should request the guest permissions for dynamic xfeatures
> which will be exposed to the guest. This only needs to be done
> once before the first vcpu is created.
> 
> KVM implemented one new ARCH_GET_XCOMP_SUPP system attribute API to
> get host side supported_xcr0 and Qemu can decide if it can request
> dynamically enabled XSAVE features permission.
> https://lore.kernel.org/all/20220126152210.3044876-1-pbonzini@redhat.com/
> 
> Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Yang Zhong <yang.zhong@intel.com>
> Signed-off-by: Jing Liu <jing2.liu@intel.com>
> Message-Id: <20220217060434.52460-4-yang.zhong@intel.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  target/i386/cpu.c          |  7 +++++
>  target/i386/cpu.h          |  4 +++
>  target/i386/kvm/kvm-cpu.c  | 12 ++++----
>  target/i386/kvm/kvm.c      | 57 ++++++++++++++++++++++++++++++++++++++
>  target/i386/kvm/kvm_i386.h |  1 +
>  5 files changed, 75 insertions(+), 6 deletions(-)

With this commit qemu crashes for me when invoking the following
QMP command:

$ ~pipo/git/qemu.git/build/qemu-system-x86_64 -S -no-user-config -nodefaults -nographic -machine none,accel=kvm -qmp stdio
{"QMP": {"version": {"qemu": {"micro": 90, "minor": 2, "major": 6}, "package": "v7.0.0-rc0-8-g1d60bb4b14"}, "capabilities": ["oob"]}}
{'execute':'qmp_capabilities'}
{"return": {}}
{"execute":"qom-list-properties","arguments":{"typename":"max-x86_64-cpu"},"id":"libvirt-41"}
qemu-system-x86_64: ../target/i386/kvm/kvm-cpu.c:105: kvm_cpu_xsave_init: Assertion `esa->size == eax' failed.
Aborted (core dumped)

Note that the above is on a box with an 'AMD Ryzen 9 3900X'.

Curiously on a laptop with an Intel chip (Intel(R) Core(TM) i7-10610U)
it seems to work.



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PULL 15/22] x86: Grant AMX permission for guest
  2022-03-16 15:57   ` Peter Krempa
@ 2022-03-16 16:05     ` Daniel P. Berrangé
  2022-03-16 17:20       ` Paolo Bonzini
  2022-03-16 17:48       ` David Edmondson
  2022-03-17  5:56     ` Yang Zhong
                       ` (2 subsequent siblings)
  3 siblings, 2 replies; 34+ messages in thread
From: Daniel P. Berrangé @ 2022-03-16 16:05 UTC (permalink / raw)
  To: Peter Krempa; +Cc: Yang Zhong, Paolo Bonzini, qemu-devel, Jing Liu

On Wed, Mar 16, 2022 at 04:57:39PM +0100, Peter Krempa wrote:
> On Tue, Mar 08, 2022 at 12:34:38 +0100, Paolo Bonzini wrote:
> > From: Yang Zhong <yang.zhong@intel.com>
> > 
> > Kernel allocates 4K xstate buffer by default. For XSAVE features
> > which require large state component (e.g. AMX), Linux kernel
> > dynamically expands the xstate buffer only after the process has
> > acquired the necessary permissions. Those are called dynamically-
> > enabled XSAVE features (or dynamic xfeatures).
> > 
> > There are separate permissions for native tasks and guests.
> > 
> > Qemu should request the guest permissions for dynamic xfeatures
> > which will be exposed to the guest. This only needs to be done
> > once before the first vcpu is created.
> > 
> > KVM implemented one new ARCH_GET_XCOMP_SUPP system attribute API to
> > get host side supported_xcr0 and Qemu can decide if it can request
> > dynamically enabled XSAVE features permission.
> > https://lore.kernel.org/all/20220126152210.3044876-1-pbonzini@redhat.com/
> > 
> > Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
> > Signed-off-by: Yang Zhong <yang.zhong@intel.com>
> > Signed-off-by: Jing Liu <jing2.liu@intel.com>
> > Message-Id: <20220217060434.52460-4-yang.zhong@intel.com>
> > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> > ---
> >  target/i386/cpu.c          |  7 +++++
> >  target/i386/cpu.h          |  4 +++
> >  target/i386/kvm/kvm-cpu.c  | 12 ++++----
> >  target/i386/kvm/kvm.c      | 57 ++++++++++++++++++++++++++++++++++++++
> >  target/i386/kvm/kvm_i386.h |  1 +
> >  5 files changed, 75 insertions(+), 6 deletions(-)
> 
> With this commit qemu crashes for me when invoking the following
> QMP command:

It is way worse than that even. If you remove '-S' you get an
immediate kaboom on startup on AMD hosts

$ ./build/qemu-system-x86_64 -accel kvm
Unable to init server: Could not connect: Connection refused
qemu-system-x86_64: ../target/i386/kvm/kvm-cpu.c:105: kvm_cpu_xsave_init: Assertion `esa->size == eax' failed.
Aborted (core dumped)


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PULL 15/22] x86: Grant AMX permission for guest
  2022-03-16 16:05     ` Daniel P. Berrangé
@ 2022-03-16 17:20       ` Paolo Bonzini
  2022-03-16 17:48       ` David Edmondson
  1 sibling, 0 replies; 34+ messages in thread
From: Paolo Bonzini @ 2022-03-16 17:20 UTC (permalink / raw)
  To: Daniel P. Berrangé, Peter Krempa; +Cc: Yang Zhong, qemu-devel, Jing Liu

On 3/16/22 17:05, Daniel P. Berrangé wrote:
> On Wed, Mar 16, 2022 at 04:57:39PM +0100, Peter Krempa wrote:
>> On Tue, Mar 08, 2022 at 12:34:38 +0100, Paolo Bonzini wrote:
>>> From: Yang Zhong <yang.zhong@intel.com>
>>>
>>> Kernel allocates 4K xstate buffer by default. For XSAVE features
>>> which require large state component (e.g. AMX), Linux kernel
>>> dynamically expands the xstate buffer only after the process has
>>> acquired the necessary permissions. Those are called dynamically-
>>> enabled XSAVE features (or dynamic xfeatures).
>>>
>>> There are separate permissions for native tasks and guests.
>>>
>>> Qemu should request the guest permissions for dynamic xfeatures
>>> which will be exposed to the guest. This only needs to be done
>>> once before the first vcpu is created.
>>>
>>> KVM implemented one new ARCH_GET_XCOMP_SUPP system attribute API to
>>> get host side supported_xcr0 and Qemu can decide if it can request
>>> dynamically enabled XSAVE features permission.
>>> https://lore.kernel.org/all/20220126152210.3044876-1-pbonzini@redhat.com/
>>>
>>> Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
>>> Signed-off-by: Yang Zhong <yang.zhong@intel.com>
>>> Signed-off-by: Jing Liu <jing2.liu@intel.com>
>>> Message-Id: <20220217060434.52460-4-yang.zhong@intel.com>
>>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>>> ---
>>>   target/i386/cpu.c          |  7 +++++
>>>   target/i386/cpu.h          |  4 +++
>>>   target/i386/kvm/kvm-cpu.c  | 12 ++++----
>>>   target/i386/kvm/kvm.c      | 57 ++++++++++++++++++++++++++++++++++++++
>>>   target/i386/kvm/kvm_i386.h |  1 +
>>>   5 files changed, 75 insertions(+), 6 deletions(-)
>>
>> With this commit qemu crashes for me when invoking the following
>> QMP command:
> 
> It is way worse than that even. If you remove '-S' you get an
> immediate kaboom on startup on AMD hosts
> 
> $ ./build/qemu-system-x86_64 -accel kvm
> Unable to init server: Could not connect: Connection refused
> qemu-system-x86_64: ../target/i386/kvm/kvm-cpu.c:105: kvm_cpu_xsave_init: Assertion `esa->size == eax' failed.
> Aborted (core dumped)

I'll check it tomorrow, thanks.

Paolo



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PULL 15/22] x86: Grant AMX permission for guest
  2022-03-16 16:05     ` Daniel P. Berrangé
  2022-03-16 17:20       ` Paolo Bonzini
@ 2022-03-16 17:48       ` David Edmondson
  2022-03-16 17:50         ` Daniel P. Berrangé
  1 sibling, 1 reply; 34+ messages in thread
From: David Edmondson @ 2022-03-16 17:48 UTC (permalink / raw)
  To: Daniel P. Berrangé
  Cc: Yang Zhong, Paolo Bonzini, Peter Krempa, qemu-devel, Jing Liu

On Wednesday, 2022-03-16 at 16:05:01 GMT, Daniel P. Berrangé wrote:

> On Wed, Mar 16, 2022 at 04:57:39PM +0100, Peter Krempa wrote:
>> On Tue, Mar 08, 2022 at 12:34:38 +0100, Paolo Bonzini wrote:
>> > From: Yang Zhong <yang.zhong@intel.com>
>> > 
>> > Kernel allocates 4K xstate buffer by default. For XSAVE features
>> > which require large state component (e.g. AMX), Linux kernel
>> > dynamically expands the xstate buffer only after the process has
>> > acquired the necessary permissions. Those are called dynamically-
>> > enabled XSAVE features (or dynamic xfeatures).
>> > 
>> > There are separate permissions for native tasks and guests.
>> > 
>> > Qemu should request the guest permissions for dynamic xfeatures
>> > which will be exposed to the guest. This only needs to be done
>> > once before the first vcpu is created.
>> > 
>> > KVM implemented one new ARCH_GET_XCOMP_SUPP system attribute API to
>> > get host side supported_xcr0 and Qemu can decide if it can request
>> > dynamically enabled XSAVE features permission.
>> > https://lore.kernel.org/all/20220126152210.3044876-1-pbonzini@redhat.com/
>> > 
>> > Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
>> > Signed-off-by: Yang Zhong <yang.zhong@intel.com>
>> > Signed-off-by: Jing Liu <jing2.liu@intel.com>
>> > Message-Id: <20220217060434.52460-4-yang.zhong@intel.com>
>> > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> > ---
>> >  target/i386/cpu.c          |  7 +++++
>> >  target/i386/cpu.h          |  4 +++
>> >  target/i386/kvm/kvm-cpu.c  | 12 ++++----
>> >  target/i386/kvm/kvm.c      | 57 ++++++++++++++++++++++++++++++++++++++
>> >  target/i386/kvm/kvm_i386.h |  1 +
>> >  5 files changed, 75 insertions(+), 6 deletions(-)
>> 
>> With this commit qemu crashes for me when invoking the following
>> QMP command:
>
> It is way worse than that even. If you remove '-S' you get an
> immediate kaboom on startup on AMD hosts

Which AMD CPU is in this host?

> $ ./build/qemu-system-x86_64 -accel kvm
> Unable to init server: Could not connect: Connection refused
> qemu-system-x86_64: ../target/i386/kvm/kvm-cpu.c:105: kvm_cpu_xsave_init: Assertion `esa->size == eax' failed.
> Aborted (core dumped)
>
> With regards,
> Daniel

dme.
-- 
My girl Friday, she no square.


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PULL 15/22] x86: Grant AMX permission for guest
  2022-03-16 17:48       ` David Edmondson
@ 2022-03-16 17:50         ` Daniel P. Berrangé
  2022-03-17 12:12           ` Maxim Levitsky
  0 siblings, 1 reply; 34+ messages in thread
From: Daniel P. Berrangé @ 2022-03-16 17:50 UTC (permalink / raw)
  To: David Edmondson
  Cc: Yang Zhong, Paolo Bonzini, Peter Krempa, qemu-devel, Jing Liu

On Wed, Mar 16, 2022 at 05:48:04PM +0000, David Edmondson wrote:
> On Wednesday, 2022-03-16 at 16:05:01 GMT, Daniel P. Berrangé wrote:
> 
> > On Wed, Mar 16, 2022 at 04:57:39PM +0100, Peter Krempa wrote:
> >> On Tue, Mar 08, 2022 at 12:34:38 +0100, Paolo Bonzini wrote:
> >> > From: Yang Zhong <yang.zhong@intel.com>
> >> > 
> >> > Kernel allocates 4K xstate buffer by default. For XSAVE features
> >> > which require large state component (e.g. AMX), Linux kernel
> >> > dynamically expands the xstate buffer only after the process has
> >> > acquired the necessary permissions. Those are called dynamically-
> >> > enabled XSAVE features (or dynamic xfeatures).
> >> > 
> >> > There are separate permissions for native tasks and guests.
> >> > 
> >> > Qemu should request the guest permissions for dynamic xfeatures
> >> > which will be exposed to the guest. This only needs to be done
> >> > once before the first vcpu is created.
> >> > 
> >> > KVM implemented one new ARCH_GET_XCOMP_SUPP system attribute API to
> >> > get host side supported_xcr0 and Qemu can decide if it can request
> >> > dynamically enabled XSAVE features permission.
> >> > https://lore.kernel.org/all/20220126152210.3044876-1-pbonzini@redhat.com/
> >> > 
> >> > Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
> >> > Signed-off-by: Yang Zhong <yang.zhong@intel.com>
> >> > Signed-off-by: Jing Liu <jing2.liu@intel.com>
> >> > Message-Id: <20220217060434.52460-4-yang.zhong@intel.com>
> >> > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> >> > ---
> >> >  target/i386/cpu.c          |  7 +++++
> >> >  target/i386/cpu.h          |  4 +++
> >> >  target/i386/kvm/kvm-cpu.c  | 12 ++++----
> >> >  target/i386/kvm/kvm.c      | 57 ++++++++++++++++++++++++++++++++++++++
> >> >  target/i386/kvm/kvm_i386.h |  1 +
> >> >  5 files changed, 75 insertions(+), 6 deletions(-)
> >> 
> >> With this commit qemu crashes for me when invoking the following
> >> QMP command:
> >
> > It is way worse than that even. If you remove '-S' you get an
> > immediate kaboom on startup on AMD hosts
> 
> Which AMD CPU is in this host?

AMD EPYC 7302P


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PULL 15/22] x86: Grant AMX permission for guest
  2022-03-16 15:57   ` Peter Krempa
  2022-03-16 16:05     ` Daniel P. Berrangé
@ 2022-03-17  5:56     ` Yang Zhong
  2022-03-18 10:13     ` Michal Prívozník
  2022-03-22  8:26     ` Yang Zhong
  3 siblings, 0 replies; 34+ messages in thread
From: Yang Zhong @ 2022-03-17  5:56 UTC (permalink / raw)
  To: Peter Krempa, pbonzini; +Cc: Paolo Bonzini, qemu-devel, Jing Liu

On Wed, Mar 16, 2022 at 04:57:39PM +0100, Peter Krempa wrote:
> On Tue, Mar 08, 2022 at 12:34:38 +0100, Paolo Bonzini wrote:
> > From: Yang Zhong <yang.zhong@intel.com>
> > 
> > Kernel allocates 4K xstate buffer by default. For XSAVE features
> > which require large state component (e.g. AMX), Linux kernel
> > dynamically expands the xstate buffer only after the process has
> > acquired the necessary permissions. Those are called dynamically-
> > enabled XSAVE features (or dynamic xfeatures).
> > 
> > There are separate permissions for native tasks and guests.
> > 
> > Qemu should request the guest permissions for dynamic xfeatures
> > which will be exposed to the guest. This only needs to be done
> > once before the first vcpu is created.
> > 
> > KVM implemented one new ARCH_GET_XCOMP_SUPP system attribute API to
> > get host side supported_xcr0 and Qemu can decide if it can request
> > dynamically enabled XSAVE features permission.
> > https://lore.kernel.org/all/20220126152210.3044876-1-pbonzini@redhat.com/
> > 
> > Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
> > Signed-off-by: Yang Zhong <yang.zhong@intel.com>
> > Signed-off-by: Jing Liu <jing2.liu@intel.com>
> > Message-Id: <20220217060434.52460-4-yang.zhong@intel.com>
> > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> > ---
> >  target/i386/cpu.c          |  7 +++++
> >  target/i386/cpu.h          |  4 +++
> >  target/i386/kvm/kvm-cpu.c  | 12 ++++----
> >  target/i386/kvm/kvm.c      | 57 ++++++++++++++++++++++++++++++++++++++
> >  target/i386/kvm/kvm_i386.h |  1 +
> >  5 files changed, 75 insertions(+), 6 deletions(-)
> 
> With this commit qemu crashes for me when invoking the following
> QMP command:
> 
> $ ~pipo/git/qemu.git/build/qemu-system-x86_64 -S -no-user-config -nodefaults -nographic -machine none,accel=kvm -qmp stdio
> {"QMP": {"version": {"qemu": {"micro": 90, "minor": 2, "major": 6}, "package": "v7.0.0-rc0-8-g1d60bb4b14"}, "capabilities": ["oob"]}}
> {'execute':'qmp_capabilities'}
> {"return": {}}
> {"execute":"qom-list-properties","arguments":{"typename":"max-x86_64-cpu"},"id":"libvirt-41"}
> qemu-system-x86_64: ../target/i386/kvm/kvm-cpu.c:105: kvm_cpu_xsave_init: Assertion `esa->size == eax' failed.
> Aborted (core dumped)
> 
> Note that the above is on a box with an 'AMD Ryzen 9 3900X'.
> 
> Curiously on a laptop with an Intel chip (Intel(R) Core(TM) i7-10610U)
> it seems to work.

  Thanks for pointing this out!
  
  In my side, no AMD machine can be used to try this issue, I listed the
  FPU info from host kernel dmesg for reference.
  
  root@984fee00bf64:~# dmesg | grep fpu
  [    0.000000] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
  [    0.000000] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
  [    0.000000] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'
  [    0.000000] x86/fpu: Supporting XSAVE feature 0x020: 'AVX-512 opmask'
  [    0.000000] x86/fpu: Supporting XSAVE feature 0x040: 'AVX-512 Hi256'
  [    0.000000] x86/fpu: Supporting XSAVE feature 0x080: 'AVX-512 ZMM_Hi256'
  [    0.000000] x86/fpu: Supporting XSAVE feature 0x200: 'Protection Keys User registers'
  [    0.000000] x86/fpu: Supporting XSAVE feature 0x400: 'PASID state'
  [    0.000000] x86/fpu: Supporting XSAVE feature 0x20000: 'AMX Tile config'
  [    0.000000] x86/fpu: Supporting XSAVE feature 0x40000: 'AMX Tile data'
  [    0.000000] x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]:  256
  [    0.000000] x86/fpu: xstate_offset[5]:  832, xstate_sizes[5]:   64
  [    0.000000] x86/fpu: xstate_offset[6]:  896, xstate_sizes[6]:  512
  [    0.000000] x86/fpu: xstate_offset[7]: 1408, xstate_sizes[7]: 1024
  [    0.000000] x86/fpu: xstate_offset[9]: 2432, xstate_sizes[9]:    8
  [    0.000000] x86/fpu: xstate_offset[10]: 2440, xstate_sizes[10]:    8
  [    0.000000] x86/fpu: xstate_offset[17]: 2496, xstate_sizes[17]:   64
  [    0.000000] x86/fpu: xstate_offset[18]: 2560, xstate_sizes[18]: 8192
  [    0.000000] x86/fpu: Enabled xstate features 0x606e7, context size is 10752 bytes, using 'compacted' format.

  Paolo, if you have fix patch, I can double check this from Intel SPR server. thanks!

  Yang



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PULL 15/22] x86: Grant AMX permission for guest
  2022-03-16 17:50         ` Daniel P. Berrangé
@ 2022-03-17 12:12           ` Maxim Levitsky
  0 siblings, 0 replies; 34+ messages in thread
From: Maxim Levitsky @ 2022-03-17 12:12 UTC (permalink / raw)
  To: Daniel P. Berrangé, David Edmondson
  Cc: Yang Zhong, Paolo Bonzini, Peter Krempa, qemu-devel, Jing Liu

On Wed, 2022-03-16 at 17:50 +0000, Daniel P. Berrangé wrote:
> On Wed, Mar 16, 2022 at 05:48:04PM +0000, David Edmondson wrote:
> > On Wednesday, 2022-03-16 at 16:05:01 GMT, Daniel P. Berrangé wrote:
> > 
> > > On Wed, Mar 16, 2022 at 04:57:39PM +0100, Peter Krempa wrote:
> > > > On Tue, Mar 08, 2022 at 12:34:38 +0100, Paolo Bonzini wrote:
> > > > > From: Yang Zhong <yang.zhong@intel.com>
> > > > > 
> > > > > Kernel allocates 4K xstate buffer by default. For XSAVE features
> > > > > which require large state component (e.g. AMX), Linux kernel
> > > > > dynamically expands the xstate buffer only after the process has
> > > > > acquired the necessary permissions. Those are called dynamically-
> > > > > enabled XSAVE features (or dynamic xfeatures).
> > > > > 
> > > > > There are separate permissions for native tasks and guests.
> > > > > 
> > > > > Qemu should request the guest permissions for dynamic xfeatures
> > > > > which will be exposed to the guest. This only needs to be done
> > > > > once before the first vcpu is created.
> > > > > 
> > > > > KVM implemented one new ARCH_GET_XCOMP_SUPP system attribute API to
> > > > > get host side supported_xcr0 and Qemu can decide if it can request
> > > > > dynamically enabled XSAVE features permission.
> > > > > https://lore.kernel.org/all/20220126152210.3044876-1-pbonzini@redhat.com/
> > > > > 
> > > > > Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
> > > > > Signed-off-by: Yang Zhong <yang.zhong@intel.com>
> > > > > Signed-off-by: Jing Liu <jing2.liu@intel.com>
> > > > > Message-Id: <20220217060434.52460-4-yang.zhong@intel.com>
> > > > > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> > > > > ---
> > > > >  target/i386/cpu.c          |  7 +++++
> > > > >  target/i386/cpu.h          |  4 +++
> > > > >  target/i386/kvm/kvm-cpu.c  | 12 ++++----
> > > > >  target/i386/kvm/kvm.c      | 57 ++++++++++++++++++++++++++++++++++++++
> > > > >  target/i386/kvm/kvm_i386.h |  1 +
> > > > >  5 files changed, 75 insertions(+), 6 deletions(-)
> > > > 
> > > > With this commit qemu crashes for me when invoking the following
> > > > QMP command:
> > > 
> > > It is way worse than that even. If you remove '-S' you get an
> > > immediate kaboom on startup on AMD hosts
> > 
> > Which AMD CPU is in this host?
> 
> AMD EPYC 7302P
> 
> 
> With regards,
> Daniel

my 3970X - same issue.

Best regards,
	Maxim Levitsky



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PULL 15/22] x86: Grant AMX permission for guest
  2022-03-16 15:57   ` Peter Krempa
  2022-03-16 16:05     ` Daniel P. Berrangé
  2022-03-17  5:56     ` Yang Zhong
@ 2022-03-18 10:13     ` Michal Prívozník
  2022-03-18 11:53       ` Yang Zhong
  2022-03-22  8:26     ` Yang Zhong
  3 siblings, 1 reply; 34+ messages in thread
From: Michal Prívozník @ 2022-03-18 10:13 UTC (permalink / raw)
  To: Peter Krempa, Paolo Bonzini; +Cc: Yang Zhong, qemu-devel, Jing Liu

On 3/16/22 16:57, Peter Krempa wrote:
> On Tue, Mar 08, 2022 at 12:34:38 +0100, Paolo Bonzini wrote:
>> From: Yang Zhong <yang.zhong@intel.com>
>>
>> Kernel allocates 4K xstate buffer by default. For XSAVE features
>> which require large state component (e.g. AMX), Linux kernel
>> dynamically expands the xstate buffer only after the process has
>> acquired the necessary permissions. Those are called dynamically-
>> enabled XSAVE features (or dynamic xfeatures).
>>
>> There are separate permissions for native tasks and guests.
>>
>> Qemu should request the guest permissions for dynamic xfeatures
>> which will be exposed to the guest. This only needs to be done
>> once before the first vcpu is created.
>>
>> KVM implemented one new ARCH_GET_XCOMP_SUPP system attribute API to
>> get host side supported_xcr0 and Qemu can decide if it can request
>> dynamically enabled XSAVE features permission.
>> https://lore.kernel.org/all/20220126152210.3044876-1-pbonzini@redhat.com/
>>
>> Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
>> Signed-off-by: Yang Zhong <yang.zhong@intel.com>
>> Signed-off-by: Jing Liu <jing2.liu@intel.com>
>> Message-Id: <20220217060434.52460-4-yang.zhong@intel.com>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> ---
>>  target/i386/cpu.c          |  7 +++++
>>  target/i386/cpu.h          |  4 +++
>>  target/i386/kvm/kvm-cpu.c  | 12 ++++----
>>  target/i386/kvm/kvm.c      | 57 ++++++++++++++++++++++++++++++++++++++
>>  target/i386/kvm/kvm_i386.h |  1 +
>>  5 files changed, 75 insertions(+), 6 deletions(-)
> 
> With this commit qemu crashes for me when invoking the following
> QMP command:
> 
> $ ~pipo/git/qemu.git/build/qemu-system-x86_64 -S -no-user-config -nodefaults -nographic -machine none,accel=kvm -qmp stdio
> {"QMP": {"version": {"qemu": {"micro": 90, "minor": 2, "major": 6}, "package": "v7.0.0-rc0-8-g1d60bb4b14"}, "capabilities": ["oob"]}}
> {'execute':'qmp_capabilities'}
> {"return": {}}
> {"execute":"qom-list-properties","arguments":{"typename":"max-x86_64-cpu"},"id":"libvirt-41"}
> qemu-system-x86_64: ../target/i386/kvm/kvm-cpu.c:105: kvm_cpu_xsave_init: Assertion `esa->size == eax' failed.
> Aborted (core dumped)
> 
> Note that the above is on a box with an 'AMD Ryzen 9 3900X'.
> 
> Curiously on a laptop with an Intel chip (Intel(R) Core(TM) i7-10610U)
> it seems to work.
> 
> 

Not trying to beat a dead horse here, but I've just found another
problem with this patch. On my laptop (Linux maggie
5.15.26-gentoo-x86_64 #1 SMP Thu Mar 10 08:55:28 CET 2022 x86_64
Intel(R) Core(TM) i7-10610U CPU @ 1.80GHz GenuineIntel GNU/Linux), when
I start a guest it no longer sees AVX instructions:

  qemu.git $ ./build/qemu-system-x86_64 -accel kvm -cpu host ...

Michal



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PULL 15/22] x86: Grant AMX permission for guest
  2022-03-18 10:13     ` Michal Prívozník
@ 2022-03-18 11:53       ` Yang Zhong
  0 siblings, 0 replies; 34+ messages in thread
From: Yang Zhong @ 2022-03-18 11:53 UTC (permalink / raw)
  To: Michal Prívozník, pbonzini
  Cc: yang.zhong, Paolo Bonzini, Peter Krempa, qemu-devel, Jing Liu

On Fri, Mar 18, 2022 at 11:13:56AM +0100, Michal Prívozník wrote:
> On 3/16/22 16:57, Peter Krempa wrote:
> > On Tue, Mar 08, 2022 at 12:34:38 +0100, Paolo Bonzini wrote:
> >> From: Yang Zhong <yang.zhong@intel.com>
> >>
> >> Kernel allocates 4K xstate buffer by default. For XSAVE features
> >> which require large state component (e.g. AMX), Linux kernel
> >> dynamically expands the xstate buffer only after the process has
> >> acquired the necessary permissions. Those are called dynamically-
> >> enabled XSAVE features (or dynamic xfeatures).
> >>
> >> There are separate permissions for native tasks and guests.
> >>
> >> Qemu should request the guest permissions for dynamic xfeatures
> >> which will be exposed to the guest. This only needs to be done
> >> once before the first vcpu is created.
> >>
> >> KVM implemented one new ARCH_GET_XCOMP_SUPP system attribute API to
> >> get host side supported_xcr0 and Qemu can decide if it can request
> >> dynamically enabled XSAVE features permission.
> >> https://lore.kernel.org/all/20220126152210.3044876-1-pbonzini@redhat.com/
> >>
> >> Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
> >> Signed-off-by: Yang Zhong <yang.zhong@intel.com>
> >> Signed-off-by: Jing Liu <jing2.liu@intel.com>
> >> Message-Id: <20220217060434.52460-4-yang.zhong@intel.com>
> >> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> >> ---
> >>  target/i386/cpu.c          |  7 +++++
> >>  target/i386/cpu.h          |  4 +++
> >>  target/i386/kvm/kvm-cpu.c  | 12 ++++----
> >>  target/i386/kvm/kvm.c      | 57 ++++++++++++++++++++++++++++++++++++++
> >>  target/i386/kvm/kvm_i386.h |  1 +
> >>  5 files changed, 75 insertions(+), 6 deletions(-)
> > 
> > With this commit qemu crashes for me when invoking the following
> > QMP command:
> > 
> > $ ~pipo/git/qemu.git/build/qemu-system-x86_64 -S -no-user-config -nodefaults -nographic -machine none,accel=kvm -qmp stdio
> > {"QMP": {"version": {"qemu": {"micro": 90, "minor": 2, "major": 6}, "package": "v7.0.0-rc0-8-g1d60bb4b14"}, "capabilities": ["oob"]}}
> > {'execute':'qmp_capabilities'}
> > {"return": {}}
> > {"execute":"qom-list-properties","arguments":{"typename":"max-x86_64-cpu"},"id":"libvirt-41"}
> > qemu-system-x86_64: ../target/i386/kvm/kvm-cpu.c:105: kvm_cpu_xsave_init: Assertion `esa->size == eax' failed.
> > Aborted (core dumped)
> > 
> > Note that the above is on a box with an 'AMD Ryzen 9 3900X'.
> > 
> > Curiously on a laptop with an Intel chip (Intel(R) Core(TM) i7-10610U)
> > it seems to work.
> > 
> > 
> 
> Not trying to beat a dead horse here, but I've just found another
> problem with this patch. On my laptop (Linux maggie
> 5.15.26-gentoo-x86_64 #1 SMP Thu Mar 10 08:55:28 CET 2022 x86_64
> Intel(R) Core(TM) i7-10610U CPU @ 1.80GHz GenuineIntel GNU/Linux), when
> I start a guest it no longer sees AVX instructions:
> 
>   qemu.git $ ./build/qemu-system-x86_64 -accel kvm -cpu host ...
>

  Thanks Michal, this issue is caused by compatibility with older kernel version.

  The Qemu will report below logs:
  emu-system-x86_64: warning: cannot get sys attribute capabilities 0
  qemu-system-x86_64: warning: cannot get sys attribute capabilities 0
  qemu-system-x86_64: warning: cannot get sys attribute capabilities 0
  qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.0DH:EAX [bit 5]
  qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.0DH:EAX [bit 6]
  qemu-system-x86_64: warning: host doesn't support requested feature: CPUID.0DH:EAX [bit 9]
  ......

  Since the AMX changes in Qemu need read ARCH_GET_XCOMP_SUPP attribute to get host supported_xcr0
  value, and new kernel release add this new API. So the older kernel can't report right xcr0 value.

  I made one new patch to fix this issue, please try this patch. thanks!
  https://lists.nongnu.org/archive/html/qemu-devel/2022-03/msg04732.html

  Paolo, this patch only fix this compatibility issue, but the issue caused by AMD cpu is still not
  fixed from my side because no AMD platform can be used in my side. If you have no time to check
  this issue, maybe I need lookfor this platform from our internal. thanks!

  Yang 

 
> Michal


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PULL 15/22] x86: Grant AMX permission for guest
  2022-03-16 15:57   ` Peter Krempa
                       ` (2 preceding siblings ...)
  2022-03-18 10:13     ` Michal Prívozník
@ 2022-03-22  8:26     ` Yang Zhong
  3 siblings, 0 replies; 34+ messages in thread
From: Yang Zhong @ 2022-03-22  8:26 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: yang.zhong, Paolo Bonzini, Peter Krempa, qemu-devel, Jing Liu

On Wed, Mar 16, 2022 at 04:57:39PM +0100, Peter Krempa wrote:
> On Tue, Mar 08, 2022 at 12:34:38 +0100, Paolo Bonzini wrote:
> > From: Yang Zhong <yang.zhong@intel.com>
> > 
> > Kernel allocates 4K xstate buffer by default. For XSAVE features
> > which require large state component (e.g. AMX), Linux kernel
> > dynamically expands the xstate buffer only after the process has
> > acquired the necessary permissions. Those are called dynamically-
> > enabled XSAVE features (or dynamic xfeatures).
> > 
> > There are separate permissions for native tasks and guests.
> > 
> > Qemu should request the guest permissions for dynamic xfeatures
> > which will be exposed to the guest. This only needs to be done
> > once before the first vcpu is created.
> > 
> > KVM implemented one new ARCH_GET_XCOMP_SUPP system attribute API to
> > get host side supported_xcr0 and Qemu can decide if it can request
> > dynamically enabled XSAVE features permission.
> > https://lore.kernel.org/all/20220126152210.3044876-1-pbonzini@redhat.com/
> > 
> > Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
> > Signed-off-by: Yang Zhong <yang.zhong@intel.com>
> > Signed-off-by: Jing Liu <jing2.liu@intel.com>
> > Message-Id: <20220217060434.52460-4-yang.zhong@intel.com>
> > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> > ---
> >  target/i386/cpu.c          |  7 +++++
> >  target/i386/cpu.h          |  4 +++
> >  target/i386/kvm/kvm-cpu.c  | 12 ++++----
> >  target/i386/kvm/kvm.c      | 57 ++++++++++++++++++++++++++++++++++++++
> >  target/i386/kvm/kvm_i386.h |  1 +
> >  5 files changed, 75 insertions(+), 6 deletions(-)
> 
> With this commit qemu crashes for me when invoking the following
> QMP command:
> 
> $ ~pipo/git/qemu.git/build/qemu-system-x86_64 -S -no-user-config -nodefaults -nographic -machine none,accel=kvm -qmp stdio
> {"QMP": {"version": {"qemu": {"micro": 90, "minor": 2, "major": 6}, "package": "v7.0.0-rc0-8-g1d60bb4b14"}, "capabilities": ["oob"]}}
> {'execute':'qmp_capabilities'}
> {"return": {}}
> {"execute":"qom-list-properties","arguments":{"typename":"max-x86_64-cpu"},"id":"libvirt-41"}
> qemu-system-x86_64: ../target/i386/kvm/kvm-cpu.c:105: kvm_cpu_xsave_init: Assertion `esa->size == eax' failed.
> Aborted (core dumped)
> 
> Note that the above is on a box with an 'AMD Ryzen 9 3900X'.
> 
> Curiously on a laptop with an Intel chip (Intel(R) Core(TM) i7-10610U)
> it seems to work.

  
  Paolo, I debugged this issue and found this issue is caused by xstate feature bit9
  (MPK, which like pku in intel) in the some AMD platforms.

  #AMD Spec, p409
  https://www.amd.com/system/files/TechDocs/24593.pdf

  I checked the cpuid info from AMD EPYC 7402P server and ECX=0x9, the eax is 0x40,
  which is different with eax=0x00000008 in Intel platform. So, the ASSERT is generated
  by AMX changes.

  ##AMD host
  0x0000000d 0x00: eax=0x00000207 ebx=0x00000340 ecx=0x00000380 edx=0x00000000
  0x0000000d 0x01: eax=0x0000000f ebx=0x00000340 ecx=0x00000000 edx=0x00000000
  0x0000000d 0x02: eax=0x00000100 ebx=0x00000240 ecx=0x00000000 edx=0x00000000
  0x0000000d 0x09: eax=0x00000040 ebx=0x00000340 ecx=0x00000000 edx=0x00000000

  ##Intel host
  0x0000000d 0x00: eax=0x000602e7 ebx=0x00002b00 ecx=0x00002b00 edx=0x00000000
  0x0000000d 0x01: eax=0x0000001f ebx=0x00002d00 ecx=0x0000dd00 edx=0x00000000
  0x0000000d 0x02: eax=0x00000100 ebx=0x00000240 ecx=0x00000000 edx=0x00000000
  0x0000000d 0x05: eax=0x00000040 ebx=0x00000440 ecx=0x00000000 edx=0x00000000
  0x0000000d 0x06: eax=0x00000200 ebx=0x00000480 ecx=0x00000000 edx=0x00000000
  0x0000000d 0x07: eax=0x00000400 ebx=0x00000680 ecx=0x00000000 edx=0x00000000
  0x0000000d 0x08: eax=0x00000080 ebx=0x00000000 ecx=0x00000001 edx=0x00000000
  0x0000000d 0x09: eax=0x00000008 ebx=0x00000a80 ecx=0x00000000 edx=0x00000000
  0x0000000d 0x0a: eax=0x00000008 ebx=0x00000000 ecx=0x00000001 edx=0x00000000
  0x0000000d 0x0b: eax=0x00000010 ebx=0x00000000 ecx=0x00000001 edx=0x00000000
  0x0000000d 0x0c: eax=0x00000018 ebx=0x00000000 ecx=0x00000001 edx=0x00000000
  0x0000000d 0x0e: eax=0x00000030 ebx=0x00000000 ecx=0x00000001 edx=0x00000000
  0x0000000d 0x0f: eax=0x00000328 ebx=0x00000000 ecx=0x00000001 edx=0x00000000
  0x0000000d 0x11: eax=0x00000040 ebx=0x00000ac0 ecx=0x00000002 edx=0x00000000
  0x0000000d 0x12: eax=0x00002000 ebx=0x00000b00 ecx=0x00000006 edx=0x00000000

  But I also checked same cpuid info from AMD MILAN server, the eax=0x00000008 in ECX=0x9.
  So, for this ECX=0x9, the eax values in different AMD server are different.

  How can we handle those different value since we have used host_cpuid() to read host's
  registers? thanks!

  Yang



^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2022-03-22  8:45 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-08 11:34 [PULL v2 00/22] QEMU changes for 7.0 soft freeze Paolo Bonzini
2022-03-08 11:34 ` [PULL 01/22] whpx: Fixed reporting of the CPU context to GDB for 64-bit Paolo Bonzini
2022-03-08 11:34 ` [PULL 02/22] whpx: Fixed incorrect CR8/TPR synchronization Paolo Bonzini
2022-03-08 11:34 ` [PULL 03/22] vmxcap: Add 5-level EPT bit Paolo Bonzini
2022-03-08 11:34 ` [PULL 04/22] meson: fix generic location of vss headers Paolo Bonzini
2022-03-08 11:34 ` [PULL 05/22] qga/vss-win32: check old VSS SDK headers Paolo Bonzini
2022-03-08 11:34 ` [PULL 06/22] qga/vss: update informative message about MinGW Paolo Bonzini
2022-03-08 11:34 ` [PULL 07/22] update meson-buildoptions.sh Paolo Bonzini
2022-03-08 11:34 ` [PULL 08/22] kvm-irqchip: introduce new API to support route change Paolo Bonzini
2022-03-08 11:34 ` [PULL 09/22] kvm/msi: do explicit commit when adding msi routes Paolo Bonzini
2022-03-08 11:34 ` [PULL 10/22] target/i386: only include bits in pg_mode if they are not ignored Paolo Bonzini
2022-03-08 11:34 ` [PULL 11/22] target/i386: Throw a #SS when loading a non-canonical IST Paolo Bonzini
2022-03-08 11:34 ` [PULL 12/22] linux-headers: include missing changes from 5.17 Paolo Bonzini
2022-03-08 11:34 ` [PULL 13/22] x86: Fix the 64-byte boundary enumeration for extended state Paolo Bonzini
2022-03-08 11:34 ` [PULL 14/22] x86: Add AMX XTILECFG and XTILEDATA components Paolo Bonzini
2022-03-08 11:34 ` [PULL 15/22] x86: Grant AMX permission for guest Paolo Bonzini
2022-03-16 15:57   ` Peter Krempa
2022-03-16 16:05     ` Daniel P. Berrangé
2022-03-16 17:20       ` Paolo Bonzini
2022-03-16 17:48       ` David Edmondson
2022-03-16 17:50         ` Daniel P. Berrangé
2022-03-17 12:12           ` Maxim Levitsky
2022-03-17  5:56     ` Yang Zhong
2022-03-18 10:13     ` Michal Prívozník
2022-03-18 11:53       ` Yang Zhong
2022-03-22  8:26     ` Yang Zhong
2022-03-08 11:34 ` [PULL 16/22] x86: Add XFD faulting bit for state components Paolo Bonzini
2022-03-08 11:34 ` [PULL 17/22] x86: Add AMX CPUIDs enumeration Paolo Bonzini
2022-03-08 11:34 ` [PULL 18/22] x86: add support for KVM_CAP_XSAVE2 and AMX state migration Paolo Bonzini
2022-03-08 11:34 ` [PULL 19/22] x86: Support XFD and AMX xsave data migration Paolo Bonzini
2022-03-08 11:34 ` [PULL 20/22] i386: Add Icelake-Server-v6 CPU model with 5-level EPT support Paolo Bonzini
2022-03-08 11:34 ` [PULL 21/22] KVM: SVM: always set MSR_AMD64_TSC_RATIO to default value Paolo Bonzini
2022-03-08 11:34 ` [PULL 22/22] gitlab-ci: do not run tests with address sanitizer Paolo Bonzini
2022-03-10 12:09 ` [PULL v2 00/22] QEMU changes for 7.0 soft freeze Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.