qemu-aarch64: '-cpu max,sve=offstill leaves SVE2 advertised bygetauxval`

Host environment

  • Operating system: Ubuntu 24.04
  • OS/kernel version: Linux 6.14.0
  • Architecture: x86_64
  • QEMU flavor: qemu-aarch64
  • QEMU version: qemu-aarch64 version 10.1.50

Description of problem

Similar to #2304 (closed), using sve=off does not turn off sve2 when petitioning getauxval.

#include <sys/auxv.h>
#include <stdio.h>

int main() {
  unsigned long hwcap = getauxval(AT_HWCAP);
  unsigned long hwcap2 = getauxval(AT_HWCAP2);

  if (hwcap & HWCAP_SVE) {
    printf("have sve!\n");
  } else {
    printf("don't have sve!\n");
  }
  if (hwcap2 & HWCAP2_SVE2) {
    printf("have sve2!\n");
  } else {
    printf("don't have sve2!\n");
  }
  if (hwcap2 & HWCAP2_SVEAES) {
    printf("have sve-aes!\n");
  } else {
    printf("don't have sve-aes!\n");
  }
}

This program results in the following:

~/qemu/build/qemu-aarch64 a.out -cpu max,sve=off ./a.out
don't have sve!
have sve2!
don't have sve-aes!

git bisects to fcac98d0

Assignee Loading
Time tracking Loading