x86/amx: compatible with older kernel release
PATCH 1/1 x86/amx: compatible with older kernel release
The AMX KVM introduced one new ARCH_GET_XCOMP_SUPP system attribute API to get host side supported_xcr0 and latest Qemu can decide if it can request dynamically enabled XSAVE features permission. But this implementation(19db68ca68) did not consider older kernel release. This patch can avoid to read this new KVM_GET_DEVICE_ATTR ioctl.
Signed-off-by Yang Zhong <[email protected]>
--- target/i386/kvm/kvm.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
target/i386/kvm/kvm.c +8 -8
@@ -420,14 +420,14 @@ uint32_t kvm_arch_get_supported_cpuid(KVMState *s, uint32_t function,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 { +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
Signature · 1 line
2.25.1
Quoted 10 lines · Yang Zhong
The AMX KVM introduced one new
ARCH_GET_XCOMP_SUPPsystem attribute API to get host sidesupported_xcr0and latest Qemu can decide if it can request dynamically enabled XSAVE features permission. But this implementation(19db68ca68) did not consider older kernel release. This patch can avoid to read this newKVM_GET_DEVICE_ATTRioctl.Signed-off-by Yang Zhong <[email protected]>--- target/i386/kvm/kvm.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
Tested-by Michal Privoznik <[email protected]>
Thank you.
Michal