QEMU changes for 7.0 soft freeze
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 d170dbb84f8ed8f8c9daa359d6d95cd02fd959b7:
gitlab-ci: do not run tests with address sanitizer (2022-03-07 17:41:51 +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 TAP output for check-block
* 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 (5):
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
check-block: revert TAP output and reintroduce -makecheck
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 ++++++++ tests/check-block.sh | 6 +- tests/qemu-iotests/check | 6 +- tests/qemu-iotests/meson.build | 1 - tests/qemu-iotests/testenv.py | 30 ++++----- tests/qemu-iotests/testrunner.py | 54 +++++++-------- 31 files changed, 494 insertions(+), 136 deletions(-)
Signature · 1 line
2.34.1
[PULL 15/23] x86: Grant AMX permission for guest
From: Yang Zhong <[email protected]>
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/[email protected]/
Message-Id: <[email protected]>
--- 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(-)
target/i386/cpu.c +7 -0
@@ -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 ; }
target/i386/cpu.h +4 -0
@@ -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
target/i386/kvm/kvm-cpu.c +6 -6
@@ -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; } } }
target/i386/kvm/kvm.c +57 -0
78 lines not on this page · raw message
target/i386/kvm/kvm_i386.h +1 -0
@@ -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
Signature · 1 line
2.34.1
[PULL 16/23] x86: Add XFD faulting bit for state components
In reply to Paolo BonziniFrom: Jing Liu <[email protected]>
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.
Message-Id: <[email protected]>
--- target/i386/cpu.c | 3 ++- target/i386/cpu.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-)
target/i386/cpu.c +2 -1
@@ -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 ;
target/i386/cpu.h +2 -0
@@ -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 */
Signature · 1 line
2.34.1
[PULL 05/23] qga/vss-win32: check old VSS SDK headers
In reply to Paolo BonziniFrom: Marc-André Lureau <[email protected]>
The VssCoordinator & VssAdmin interfaces have been moved to vsadmin.h in the Windows SDK.
Message-Id: <[email protected]>
--- 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(-)
meson.build +3 -0
@@ -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'
qga/vss-win32/install.cpp +4 -0
@@ -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>
qga/vss-win32/provider.cpp +4 -0
@@ -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)
qga/vss-win32/vss-common.h +2 -1
@@ -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>
Signature · 1 line
2.34.1
[PULL 03/23] vmxcap: Add 5-level EPT bit
In reply to Paolo BonziniFrom: Vitaly Kuznetsov <[email protected]>
5-level EPT is present in Icelake Server CPUs and is supported by QEMU ('vmx-page-walk-5').
Message-Id: <[email protected]>
--- scripts/kvm/vmxcap | 1 + 1 file changed, 1 insertion(+)
scripts/kvm/vmxcap +1 -0
@@ -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',
Signature · 1 line
2.34.1
[PULL 04/23] meson: fix generic location of vss headers
In reply to Paolo BonziniFrom: Marc-André Lureau <[email protected]>
This is a left-over, despite requesting the change before the merge.
Message-Id: <[email protected]>
--- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meson.build +1 -1
@@ -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
Signature · 1 line
2.34.1
[PULL 06/23] qga/vss: update informative message about MinGW
In reply to Paolo BonziniFrom: Marc-André Lureau <[email protected]>
The headers are now all available in MinGW master branch. (commit 13390dbbf885f and earlier) aiming for 10.0.
Message-Id: <[email protected]>
--- qga/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
qga/meson.build +1 -1
@@ -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'.
Signature · 1 line
2.34.1
[PULL 12/23] linux-headers: include missing changes from 5.17
In reply to Paolo Bonzini--- linux-headers/asm-x86/kvm.h | 3 +++ linux-headers/linux/kvm.h | 4 ++++ 2 files changed, 7 insertions(+)
linux-headers/asm-x86/kvm.h +3 -0
@@ -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 ];
linux-headers/linux/kvm.h +4 -0
@@ -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 */
Signature · 1 line
2.34.1
[PULL 08/23] kvm-irqchip: introduce new API to support route change
In reply to Paolo BonziniFrom: "Longpeng(Mike)" <[email protected]>
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
Message-Id: <[email protected]>
--- include/sysemu/kvm.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
include/sysemu/kvm.h +19 -0
@@ -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);
Signature · 1 line
2.34.1
[PULL 17/23] x86: Add AMX CPUIDs enumeration
In reply to Paolo BonziniFrom: Jing Liu <[email protected]>
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.
Message-Id: <[email protected]>
--- target/i386/cpu.c | 55 ++++++++++++++++++++++++++++++++++++++++--- target/i386/kvm/kvm.c | 4 +++- 2 files changed, 55 insertions(+), 4 deletions(-)
target/i386/cpu.c +52 -3
@@ -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
target/i386/kvm/kvm.c +3 -1
@@ -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;
Signature · 1 line
2.34.1
[PULL 02/23] whpx: Fixed incorrect CR8/TPR synchronization
In reply to Paolo BonziniFrom: Ivan Shcherbakov <[email protected]>
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.
Message-Id: <[email protected]>
--- target/i386/whpx/whpx-all.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-)
target/i386/whpx/whpx-all.c +27 -1
@@ -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 */
Signature · 1 line
2.34.1
[PULL 13/23] x86: Fix the 64-byte boundary enumeration for extended state
In reply to Paolo BonziniFrom: Jing Liu <[email protected]>
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.
Message-Id: <[email protected]>
--- target/i386/cpu.c | 1 + target/i386/cpu.h | 6 ++++++ target/i386/kvm/kvm-cpu.c | 1 + 3 files changed, 8 insertions(+)
target/i386/cpu.c +1 -0
@@ -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 ;
target/i386/cpu.h +6 -0
@@ -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)
target/i386/kvm/kvm-cpu.c +1 -0
@@ -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 ); } } }
Signature · 1 line
2.34.1
[PULL 09/23] kvm/msi: do explicit commit when adding msi routes
In reply to Paolo BonziniFrom: "Longpeng(Mike)" <[email protected]>
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
Message-Id: <[email protected]>
--- 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(-)
accel/kvm/kvm-all.c +4 -3
@@ -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 ; }
accel/stubs/kvm-stub.c +1 -1
@@ -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 ; }
hw/misc/ivshmem.c +4 -1
@@ -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;
hw/vfio/pci.c +4 -1
@@ -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 ) {
hw/virtio/virtio-pci.c +3 -1
@@ -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++;
include/sysemu/kvm.h +2 -2
@@ -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);
target/i386/kvm/kvm.c +3 -1
@@ -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); } }
Signature · 1 line
2.34.1
[PULL 10/23] target/i386: only include bits in pg_mode if they are not ignored
In reply to Paolo BonziniLA57/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.
--- target/i386/tcg/sysemu/excp_helper.c | 34 ++++++++++++++-------------- 1 file changed, 17 insertions(+), 17 deletions(-)
target/i386/tcg/sysemu/excp_helper.c +17 -17
@@ -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; }
Signature · 1 line
2.34.1
[PULL 18/23] x86: add support for KVM_CAP_XSAVE2 and AMX state migration
In reply to Paolo BonziniFrom: Jing Liu <[email protected]>
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.
Message-Id: <[email protected]>
--- target/i386/cpu.h | 4 ++++ target/i386/kvm/kvm.c | 42 ++++++++++++++++++++++++-------------- target/i386/xsave_helper.c | 28 +++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 15 deletions(-)
target/i386/cpu.h +4 -0
@@ -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;
target/i386/kvm/kvm.c +27 -15
77 lines not on this page · raw message
target/i386/xsave_helper.c +28 -0
@@ -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 }
Signature · 1 line
2.34.1
[PULL 01/23] whpx: Fixed reporting of the CPU context to GDB for 64-bit
In reply to Paolo BonziniFrom: Ivan Shcherbakov <[email protected]>
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.
Message-Id: <[email protected]>
--- target/i386/whpx/whpx-all.c | 2 ++ 1 file changed, 2 insertions(+)
target/i386/whpx/whpx-all.c +2 -0
@@ -604,6 +604,8 @@ static void whpx_get_registers(CPUState *cpu)whpx_apic_get (x86_cpu->apic_state); } +x86_update_hflags (env); +return ; }
Signature · 1 line
2.34.1
[PULL 11/23] target/i386: Throw a #SS when loading a non-canonical IST
In reply to Paolo BonziniFrom: Gareth Webb <[email protected]>
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
Message-Id: <[email protected]>
--- target/i386/tcg/seg_helper.c | 49 +++++++++++++++++++++++++++- target/i386/tcg/sysemu/excp_helper.c | 36 -------------------- 2 files changed, 48 insertions(+), 37 deletions(-)
target/i386/tcg/seg_helper.c +48 -1
@@ -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 */
target/i386/tcg/sysemu/excp_helper.c +0 -36
@@ -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,
Signature · 1 line
2.34.1
[PULL 20/23] i386: Add Icelake-Server-v6 CPU model with 5-level EPT support
In reply to Paolo BonziniFrom: Vitaly Kuznetsov <[email protected]>
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.
Message-Id: <[email protected]>
--- target/i386/cpu.c | 8 ++++++++ 1 file changed, 8 insertions(+)
target/i386/cpu.c +8 -0
@@ -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 */ } } },
Signature · 1 line
2.34.1
[PULL 14/23] x86: Add AMX XTILECFG and XTILEDATA components
In reply to Paolo BonziniFrom: Jing Liu <[email protected]>
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.
Message-Id: <[email protected]>
--- target/i386/cpu.c | 8 ++++++++ target/i386/cpu.h | 18 +++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-)
target/i386/cpu.c +8 -0
@@ -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)
target/i386/cpu.h +17 -1
@@ -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 ];
Signature · 1 line
2.34.1
[PULL 07/23] update meson-buildoptions.sh
In reply to Paolo Bonzini--- scripts/meson-buildoptions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/meson-buildoptions.sh +1 -1
@@ -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'
Signature · 1 line
2.34.1
[PULL 23/23] gitlab-ci: do not run tests with address sanitizer
In reply to Paolo BonziniThis is flaky and sometimes fails or hangs unexplicably.
--- .gitlab-ci.d/buildtest.yml | 2 -- 1 file changed, 2 deletions(-)
.gitlab-ci.d/buildtest.yml +0 -2
@@ -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
Signature · 1 line
2.34.1
[PULL 19/23] x86: Support XFD and AMX xsave data migration
In reply to Paolo BonziniFrom: Zeng Guang <[email protected]>
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.
Message-Id: <[email protected]>
--- target/i386/cpu.h | 9 +++++++++ target/i386/kvm/kvm.c | 18 +++++++++++++++++ target/i386/machine.c | 46 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+)
target/i386/cpu.h +9 -0
@@ -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;
target/i386/kvm/kvm.c +18 -0
@@ -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 ; } }
target/i386/machine.c +46 -0
58 lines not on this page · raw message
Signature · 1 line
2.34.1
[PULL 21/23] KVM: SVM: always set MSR_AMD64_TSC_RATIO to default value
In reply to Paolo BonziniFrom: Maxim Levitsky <[email protected]>
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
Message-Id: <[email protected]>
--- target/i386/cpu.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
target/i386/cpu.c +1 -3
@@ -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 }
Signature · 1 line
2.34.1
[PULL 22/23] check-block: revert TAP output and reintroduce -makecheck
In reply to Paolo BonziniThis reverts commits d316859f4e28c74ab8b618895d2a5e0a865d3cf1 and 308c8475bc9d7e352125dea42950afbaf9daadfe.
The TAP output is inferior in that it does not include the diff for failed tests; there are also cases (for skipped tests) where the TAP output is incorrect.
Message-Id: <[email protected]>
--- tests/check-block.sh | 6 ++-- tests/qemu-iotests/check | 6 ++-- tests/qemu-iotests/meson.build | 1 - tests/qemu-iotests/testenv.py | 30 +++++++++--------- tests/qemu-iotests/testrunner.py | 54 ++++++++++++++------------------ 5 files changed, 45 insertions(+), 52 deletions(-)
tests/check-block.sh +3 -3
@@ -14,8 +14,8 @@ else fi skip() { - echo "1..0 #SKIP $*" - exit 0 + echo "$*" + exit 77 } # Disable tests with any sanitizer except for specific ones
@@ -75,7 +75,7 @@ JOBS=$(echo "$MAKEFLAGS" | sed -n 's/\(^\|.* \)-j\([0-9]\+\)\( .*\|$\)/-j \2/p') ret=0 for fmt in $format_list ; do - ${PYTHON} ./check $JOBS -tap -$fmt $group || ret=1 + ${PYTHON} ./check $JOBS -makecheck -$fmt $group || ret=1 done exit $ret
tests/qemu-iotests/check +3 -3
@@ -32,6 +32,8 @@ def make_argparser() -> argparse.ArgumentParser: p.add_argument('-n', '--dry-run', action='store_true', help='show me, do not run tests') + p.add_argument('-makecheck', action='store_true', + help='pretty print output for make check') p.add_argument('-j', dest='jobs', type=int, default=1, help='run tests in multiple parallel jobs')
@@ -51,8 +53,6 @@ def make_argparser() -> argparse.ArgumentParser: p.add_argument('--color', choices=['on', 'off', 'auto'], default='auto', help="use terminal colors. The default " "'auto' value means use colors if terminal stdout detected") - p.add_argument('-tap', action='store_true', - help='produce TAP output') g_env = p.add_argument_group('test environment options') mg = g_env.add_mutually_exclusive_group()
@@ -164,7 +164,7 @@ if __name__ == '__main__': if args.dry_run: print('\n'.join(tests)) else: - with TestRunner(env, tap=args.tap, + with TestRunner(env, makecheck=args.makecheck, color=args.color) as tr: paths = [os.path.join(env.source_iotests, t) for t in tests] ok = tr.run_tests(paths, args.jobs)
tests/qemu-iotests/meson.build +0 -1
@@ -22,7 +22,6 @@ if have_tools and targetos != 'windows' and not get_option('gprof') endif test('qemu-iotests ' + format, sh, args: [files('../check-block.sh'), format], depends: qemu_iotests_binaries, env: qemu_iotests_env, - protocol: 'tap', suite: suites, timeout: 0, is_parallel: false)
tests/qemu-iotests/testenv.py +15 -15
@@ -287,21 +287,21 @@ def __enter__(self) -> 'TestEnv': def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> None: self.close() - def print_env(self, prefix: str = '') -> None: + def print_env(self) -> None: template = """\ -{prefix}QEMU -- "{QEMU_PROG}" {QEMU_OPTIONS} -{prefix}QEMU_IMG -- "{QEMU_IMG_PROG}" {QEMU_IMG_OPTIONS} -{prefix}QEMU_IO -- "{QEMU_IO_PROG}" {QEMU_IO_OPTIONS} -{prefix}QEMU_NBD -- "{QEMU_NBD_PROG}" {QEMU_NBD_OPTIONS} -{prefix}IMGFMT -- {IMGFMT}{imgopts} -{prefix}IMGPROTO -- {IMGPROTO} -{prefix}PLATFORM -- {platform} -{prefix}TEST_DIR -- {TEST_DIR} -{prefix}SOCK_DIR -- {SOCK_DIR} -{prefix}GDB_OPTIONS -- {GDB_OPTIONS} -{prefix}VALGRIND_QEMU -- {VALGRIND_QEMU} -{prefix}PRINT_QEMU_OUTPUT -- {PRINT_QEMU} -{prefix}""" +QEMU -- "{QEMU_PROG}" {QEMU_OPTIONS} +QEMU_IMG -- "{QEMU_IMG_PROG}" {QEMU_IMG_OPTIONS} +QEMU_IO -- "{QEMU_IO_PROG}" {QEMU_IO_OPTIONS} +QEMU_NBD -- "{QEMU_NBD_PROG}" {QEMU_NBD_OPTIONS} +IMGFMT -- {IMGFMT}{imgopts} +IMGPROTO -- {IMGPROTO} +PLATFORM -- {platform} +TEST_DIR -- {TEST_DIR} +SOCK_DIR -- {SOCK_DIR} +GDB_OPTIONS -- {GDB_OPTIONS} +VALGRIND_QEMU -- {VALGRIND_QEMU} +PRINT_QEMU_OUTPUT -- {PRINT_QEMU} +""" args = collections.defaultdict(str, self.get_env())
@@ -310,5 +310,5 @@ def print_env(self, prefix: str = '') -> None: u = os.uname() args['platform'] = f'{u.sysname}/{u.machine} {u.nodename} {u.release}' - args['prefix'] = prefix + print(template.format_map(args))
tests/qemu-iotests/testrunner.py +24 -30
93 lines not on this page · raw message
Signature · 1 line
2.34.1
Quoted 22 lines · Paolo Bonzini
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
d170dbb84f8ed8f8c9daa359d6d95cd02fd959b7:gitlab-ci: do not run tests with address sanitizer (2022-03-07 17:41:51 +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 TAP output for check-block
* Disable ASAN testing
----------------------------------------------------------------
[...]
Quoted 5 lines
Paolo Bonzini (5):
updatemeson-buildoptions.sh
target/i386: only include bits inpg_modeif they are not ignored
linux-headers: include missing changes from 5.17
check-block: revert TAP output and reintroduce -makecheck
You now need to revert commit db4b2133b8d ('Quote "case not run" lines in TAP mode'), too, which has just been merged yesterday.
But instead of reverting, couldn't we simply go ahead with my series here instead to restore the output of failed iotests:
https://lists.gnu.org/archive/html/qemu-devel/2022-02/msg05031.html
?
Thomas
Quoted 5 lines · Thomas Huth
You now need to revert commit
db4b2133b8d('Quote "case not run" lines in TAP mode'), too, which has just been merged yesterday.But instead of reverting, couldn't we simply go ahead with my series here instead to restore the output of failed iotests:
https://lists.gnu.org/archive/html/qemu-devel/2022-02/msg05031.html
That one also drops the progress report of non-failed tests, so I'm not sure it's an improvement. Also the commit message for that one should mention that it's a meson bug, IMO we should ask distros to backport the trivial fix to --verbose (https://github.com/mesonbuild/meson/commit/c3f145ca2b9f5a4cfac3ffe1de7d901a4e8aba10.patch).
Paolo
Quoted 8 lines · Paolo Bonzini
Quoted 5 lines · Thomas Huth
You now need to revert commit
db4b2133b8d('Quote "case not run" lines in TAP mode'), too, which has just been merged yesterday.But instead of reverting, couldn't we simply go ahead with my series here instead to restore the output of failed iotests:
https://lists.gnu.org/archive/html/qemu-devel/2022-02/msg05031.html
That one also drops the progress report of non-failed tests, so I'm not sure it's an improvement.
That only works here anyway if I don't run "make check" with the "-jX" option ... which I hardly do, since it then takes forever to finish the testing. So at least for me that's not really a reason.
Quoted 1 line
Also the commit message for that one should mention that it's a meson bug, IMO we should ask distros to backport the trivial fix to --verbose (https://github.com/mesonbuild/meson/commit/c3f145ca2b9f5a4cfac3ffe1de7d901a4e8aba10.patch).
Ok ... could you maybe ask the meson folks to include the fix in the upcoming stable releases?
... the meson master branch has been switched to Python 3.7 already, but AFAIU we still target Python 3.6 in QEMU, so I'm not sure whether we will be able to jump on the next main release with QEMU... we might need to stick with a 0.61.x release for a while in the future?
Since the fix is not available in any meson release yet and we're in QEMU softfreeze now, I'm now also not quite sure anymore whether we really should go forward with the TAP approach right now... maybe it's indeed better to revert the patches for QEMU 7.0 and sort it out later?
Thomas
Quoted 4 lines · Thomas Huth
Quoted 2 lines
That one also drops the progress report of non-failed tests, so I'm not sure it's an improvement.
That only works here anyway if I don't run "make check" with the "-jX" option ... which I hardly do, since it then takes forever to finish the testing. So at least for me that's not really a reason.
The point of having a separate "make check-block" was to have the progress report ("--verbose --num-processes 1" gives the progress report, the same with --print-errorlogs doesn't).
Quoted 1 line
Ok ... could you maybe ask the meson folks to include the fix in the upcoming stable releases?
Did it, hopefully will be in 0.61.3.
Quoted 4 lines
... the meson master branch has been switched to Python 3.7 already, but AFAIU we still target Python 3.6 in QEMU, so I'm not sure whether we will be able to jump on the next main release with QEMU... we might need to stick with a 0.61.x release for a while in the future?
3.6 was EOL'd in December, so I expect that QEMU will bump the requirement sometime this year too.
Paolo
Quoted 7 lines · Paolo Bonzini
Quoted 4 lines · Thomas Huth
Quoted 2 lines
That one also drops the progress report of non-failed tests, so I'm not sure it's an improvement.
That only works here anyway if I don't run "make check" with the "-jX" option ... which I hardly do, since it then takes forever to finish the testing. So at least for me that's not really a reason.
The point of having a separate "make check-block" was to have the progress report ("--verbose --num-processes 1" gives the progress report, the same with --print-errorlogs doesn't).
Yes, understood, but again, that only works for me if I run:
make check-block
But if I run:
make check-block -j8
I only get one single line saying:
[1/1] 🌓 qemu:block / qemu-iotests qcow2 2s
And the progress report is only printed in one go at the end, after all tests have finished. Since I'm using -jX with X > 1 by default, the progress report that you get with -j1 is simply no advantage for me. Is your build behaving differently? ... then this maybe depends on the meson version? I think my build is using the one from the submodule, version 0.59.3.
Quoted 3 lines
Quoted 1 line
Ok ... could you maybe ask the meson folks to include the fix in the upcoming stable releases?
Did it, hopefully will be in 0.61.3.
Great!
... but I guess this will be too late for QEMU 7.0 ?
I just sent out
"[PATCH v4] tests: Do not treat the iotests as separate meson test target
anymore"
in case we want to continue with the TAP mode for 7.0 (only updated the patch description) ... but since we're in freeze mode already, I'm also fine if you say that this is not appropriate for QEMU 7.0 anymore and that we should revert the TAP patches instead.
Quoted 5 lines
Quoted 4 lines
... the meson master branch has been switched to Python 3.7 already, but AFAIU we still target Python 3.6 in QEMU, so I'm not sure whether we will be able to jump on the next main release with QEMU... we might need to stick with a 0.61.x release for a while in the future?
3.6 was EOL'd in December, so I expect that QEMU will bump the requirement sometime this year too.
Yes, that makes sense ... I was just thinking about RHEL 8 and its clones, which have Python 3.6 as default ... but I think they also ship Python 3.8 as alternative, so I guess it should be fine to increase the minimum Python version for QEMU 7.1 ?
Thomas
Quoted 7 lines · Thomas Huth
Yes, understood, but again, that only works for me if I run:
make check-block
But if I run:
Quoted 7 lines
make check-block -j8
I only get one single line saying:
[1/1] 🌓 qemu:block / qemu-iotests qcow2 2s
And the progress report is only printed in one go at the end, after all tests have finished. Since I'm using -jX with X > 1 by default, the progress report that you get with -j1 is simply no advantage for me. Is your build behaving differently? ... then this maybe depends on the meson version? I think my build is using the one from the submodule, version 0.59.3.
Ok, I'll check that out.
Paolo
Quoted 4 lines · Thomas Huth
Since the fix is not available in any meson release yet and we're in QEMU softfreeze now, I'm now also not quite sure anymore whether we really should go forward with the TAP approach right now... maybe it's indeed better to revert the patches for QEMU 7.0 and sort it out later?
I'm a bit lost about where this discussion thread ended up, so to be clear: are you OK with me applying this pullreq from Paolo, or do you want more time to talk through the issue? (I have another half dozen pullreqs still to merge so it's not like I'm waiting on just this one.)
thanks
-- PMM
Quoted 11 lines · Peter Maydell
Quoted 4 lines · Thomas Huth
Since the fix is not available in any meson release yet and we're in QEMU softfreeze now, I'm now also not quite sure anymore whether we really should go forward with the TAP approach right now... maybe it's indeed better to revert the patches for QEMU 7.0 and sort it out later?
I'm a bit lost about where this discussion thread ended up, so to be clear: are you OK with me applying this pullreq from Paolo, or do you want more time to talk through the issue? (I have another half dozen pullreqs still to merge so it's not like I'm waiting on just this one.)
This version of the pull request has a merge conflict and won't apply anyway, but Paolo already sent a v2 of the PR which does not have the TAP revert patch in it, so you can certainly go ahead and merge that v2. We should have a decision by next Tuesday hopefully whether we revert the TAP code or go ahead with it...
Thomas