Skip to content

Commit

Permalink
sysemu/kvm: Restrict hvf_get_supported_cpuid() to x86 targets
Browse files Browse the repository at this point in the history
hvf_get_supported_cpuid() is only defined for x86 targets
(in target/i386/hvf/x86_cpuid.c).
Its declaration is pointless on all other targets.

All the calls to it in target/i386/cpu.c are guarded by
a call on hvf_enabled(), so are elided when HVF is not
built in. Therefore we can remove the unnecessary function
stub.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20231004092510.39498-3-philmd@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
philmd authored and bonzini committed Oct 7, 2023
1 parent 6da9447 commit 044431c
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 3 deletions.
3 changes: 0 additions & 3 deletions include/sysemu/hvf.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,10 @@
#include "cpu.h"

#ifdef CONFIG_HVF
uint32_t hvf_get_supported_cpuid(uint32_t func, uint32_t idx,
int reg);
extern bool hvf_allowed;
#define hvf_enabled() (hvf_allowed)
#else /* !CONFIG_HVF */
#define hvf_enabled() 0
#define hvf_get_supported_cpuid(func, idx, reg) 0
#endif /* !CONFIG_HVF */

#endif /* NEED_CPU_H */
Expand Down
1 change: 1 addition & 0 deletions target/i386/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "tcg/helper-tcg.h"
#include "sysemu/reset.h"
#include "sysemu/hvf.h"
#include "hvf/hvf-i386.h"
#include "kvm/kvm_i386.h"
#include "sev.h"
#include "qapi/error.h"
Expand Down
1 change: 1 addition & 0 deletions target/i386/hvf/hvf-cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "hw/boards.h"
#include "sysemu/hvf.h"
#include "hw/core/accel-cpu.h"
#include "hvf-i386.h"

static void hvf_cpu_max_instance_init(X86CPU *cpu)
{
Expand Down
2 changes: 2 additions & 0 deletions target/i386/hvf/hvf-i386.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#ifndef HVF_I386_H
#define HVF_I386_H

uint32_t hvf_get_supported_cpuid(uint32_t func, uint32_t idx, int reg);

void hvf_handle_io(CPUArchState *, uint16_t, void *, int, int, int);

/* Host specific functions */
Expand Down
1 change: 1 addition & 0 deletions target/i386/hvf/x86_cpuid.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "x86.h"
#include "vmx.h"
#include "sysemu/hvf.h"
#include "hvf-i386.h"

static bool xgetbv(uint32_t cpuid_ecx, uint32_t idx, uint64_t *xcr)
{
Expand Down

0 comments on commit 044431c

Please sign in to comment.