Bugfixes.

-----BEGIN PGP SIGNATURE-----
 
 iQFIBAABCAAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmI4knUUHHBib256aW5p
 QHJlZGhhdC5jb20ACgkQv/vSX3jHroO8iQf8CmpzT4ISDRrPa21g/UtI9ADMg6I7
 oK4tUmgYm4VWsiP0QiDDj8ky89opEAMeHYUn7zIf5fXoXZHizd/pAFblo7LBk/Zh
 2ZanHBrRCw81LkxK6ZRGenBh35F/4IkG8I4GJNmpG0SRMxrqkwUKUyCoHPL7ne4g
 hsIw+NRxGEVzvpart3OATSFWky2ZwKIIn/nHjgpvl/hXMTp5gjcB5O6tT/FNWKkc
 Oqf8t1S/USs/6EgrXXeiUhn77HN7a2gvJx+RRYhih7VuAZtuOjF+lzObfOCI1Xdq
 jRNk8AwpP3//ZepgiChwxHdBsOMJ6aQ+9uJ7cx5u58/L9Mf68I3kHTm6fA==
 =4C5J
 -----END PGP SIGNATURE-----

Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging

Bugfixes.

# gpg: Signature made Mon 21 Mar 2022 14:57:57 GMT
# gpg:                using RSA key F13338574B662389866C7682BFFBD25F78C7AE83
# gpg:                issuer "pbonzini@redhat.com"
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full]
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>" [full]
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
#      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83

* tag 'for-upstream' of https://gitlab.com/bonzini/qemu:
  hw/i386/amd_iommu: Fix maybe-uninitialized error with GCC 12
  target/i386: kvm: do not access uninitialized variable on older kernels

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2022-03-21 21:27:14 +00:00
commit 48fb0a826e
2 changed files with 15 additions and 9 deletions

View File

@ -913,7 +913,7 @@ static void amdvi_page_walk(AMDVIAddressSpace *as, uint64_t *dte,
}
/* we are at the leaf page table or page table encodes a huge page */
while (level > 0) {
do {
pte_perms = amdvi_get_perms(pte);
present = pte & 1;
if (!present || perms != (perms & pte_perms)) {
@ -932,10 +932,7 @@ static void amdvi_page_walk(AMDVIAddressSpace *as, uint64_t *dte,
}
oldlevel = level;
level = get_pte_translation_mode(pte);
if (level == 0x7) {
break;
}
}
} while (level > 0 && level < 7);
if (level == 0x7) {
page_mask = pte_override_page_mask(pte);

View File

@ -411,6 +411,12 @@ uint32_t kvm_arch_get_supported_cpuid(KVMState *s, uint32_t function,
}
} else if (function == 0xd && index == 0 &&
(reg == R_EAX || reg == R_EDX)) {
/*
* The value returned by KVM_GET_SUPPORTED_CPUID does not include
* features that still have to be enabled with the arch_prctl
* system call. QEMU needs the full value, which is retrieved
* with KVM_GET_DEVICE_ATTR.
*/
struct kvm_device_attr attr = {
.group = 0,
.attr = KVM_X86_XCOMP_GUEST_SUPP,
@ -419,13 +425,16 @@ 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);
return ret;
}
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);
if (rc < 0) {
if (rc != -ENXIO) {
warn_report("KVM_GET_DEVICE_ATTR(0, KVM_X86_XCOMP_GUEST_SUPP) "
"error: %d", rc);
}
return ret;
}
ret = (reg == R_EAX) ? bitmask : bitmask >> 32;
} else if (function == 0x80000001 && reg == R_ECX) {