Skip to content
Snippets Groups Projects
  1. Sep 16, 2023
  2. Sep 15, 2023
  3. Sep 13, 2023
    • Philippe Mathieu-Daudé's avatar
      target/i386: Call accel-agnostic x86_cpu_get_supported_cpuid() · d0474024
      Philippe Mathieu-Daudé authored
      
      x86_cpu_get_supported_cpuid() is generic and handles the different
      accelerators. Use it instead of kvm_arch_get_supported_cpuid().
      
      That fixes a link failure introduced by commit 3adce820
      ("target/i386: Remove unused KVM stubs") when QEMU is configured
      as:
      
        $ ./configure --cc=clang \
          --target-list=x86_64-linux-user,x86_64-softmmu \
          --enable-debug
      
      We were getting:
      
        [71/71] Linking target qemu-x86_64
        FAILED: qemu-x86_64
        /usr/bin/ld: libqemu-x86_64-linux-user.fa.p/target_i386_cpu.c.o: in function `cpu_x86_cpuid':
        cpu.c:(.text+0x1374): undefined reference to `kvm_arch_get_supported_cpuid'
        /usr/bin/ld: libqemu-x86_64-linux-user.fa.p/target_i386_cpu.c.o: in function `x86_cpu_filter_features':
        cpu.c:(.text+0x81c2): undefined reference to `kvm_arch_get_supported_cpuid'
        /usr/bin/ld: cpu.c:(.text+0x81da): undefined reference to `kvm_arch_get_supported_cpuid'
        /usr/bin/ld: cpu.c:(.text+0x81f2): undefined reference to `kvm_arch_get_supported_cpuid'
        /usr/bin/ld: cpu.c:(.text+0x820a): undefined reference to `kvm_arch_get_supported_cpuid'
        /usr/bin/ld: libqemu-x86_64-linux-user.fa.p/target_i386_cpu.c.o:cpu.c:(.text+0x8225): more undefined references to `kvm_arch_get_supported_cpuid' follow
        clang: error: linker command failed with exit code 1 (use -v to see invocation)
        ninja: build stopped: subcommand failed.
      
      For the record, this is because '--enable-debug' disables
      optimizations (CFLAGS=-O0).
      
      While at this (un)optimization level GCC eliminate the
      following dead code (CPP output of mentioned build):
      
       static void x86_cpu_get_supported_cpuid(uint32_t func, uint32_t index,
                                               uint32_t *eax, uint32_t *ebx,
                                               uint32_t *ecx, uint32_t *edx)
       {
           if ((0)) {
               *eax = kvm_arch_get_supported_cpuid(kvm_state, func, index, R_EAX);
               *ebx = kvm_arch_get_supported_cpuid(kvm_state, func, index, R_EBX);
               *ecx = kvm_arch_get_supported_cpuid(kvm_state, func, index, R_ECX);
               *edx = kvm_arch_get_supported_cpuid(kvm_state, func, index, R_EDX);
           } else if (0) {
               *eax = 0;
               *ebx = 0;
               *ecx = 0;
               *edx = 0;
           } else {
               *eax = 0;
               *ebx = 0;
               *ecx = 0;
               *edx = 0;
           }
      
      Clang does not (see commit 2140cfa5 "i386: Fix build by
      providing stub kvm_arch_get_supported_cpuid()").
      
      Cc: qemu-stable@nongnu.org
      Fixes: 3adce820 ("target/i386: Remove unused KVM stubs")
      Reported-by: default avatarKevin Wolf <kwolf@redhat.com>
      Suggested-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarPhilippe Mathieu-Daudé <philmd@linaro.org>
      Message-ID: <20230913093009.83520-4-philmd@linaro.org>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      d0474024
    • Philippe Mathieu-Daudé's avatar
      target/i386: Drop accel_uses_host_cpuid before x86_cpu_get_supported_cpuid · da472f94
      Philippe Mathieu-Daudé authored
      
      x86_cpu_get_supported_cpuid() already checks for KVM/HVF
      accelerators, so it is not needed to manually check it via
      a call to accel_uses_host_cpuid() before calling it.
      
      Suggested-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarPhilippe Mathieu-Daudé <philmd@linaro.org>
      Message-ID: <20230913093009.83520-3-philmd@linaro.org>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      da472f94
    • Philippe Mathieu-Daudé's avatar
      target/i386: Check kvm_hyperv_expand_features() return value · 652a5f22
      Philippe Mathieu-Daudé authored
      
      In case more code is added after the kvm_hyperv_expand_features()
      call, check its return value (since it can fail).
      
      Fixes: 071ce4b0 ("i386: expand Hyper-V features during CPU feature expansion time")
      Signed-off-by: default avatarPhilippe Mathieu-Daudé <philmd@linaro.org>
      Message-ID: <20230913093009.83520-2-philmd@linaro.org>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      652a5f22
  4. Sep 12, 2023
  5. Sep 11, 2023
Loading