mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
target-arm: Provide '-cpu host' when running KVM
Implement '-cpu host' for ARM when we're using KVM, broadly in line with other KVM-supporting architectures. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org> Message-id: 1385140638-10444-11-git-send-email-peter.maydell@linaro.org
This commit is contained in:
parent
3541addc88
commit
a96c0514ab
3 changed files with 285 additions and 0 deletions
|
@ -62,4 +62,59 @@ bool write_list_to_kvmstate(ARMCPU *cpu);
|
|||
*/
|
||||
bool write_kvmstate_to_list(ARMCPU *cpu);
|
||||
|
||||
#ifdef CONFIG_KVM
|
||||
/**
|
||||
* kvm_arm_create_scratch_host_vcpu:
|
||||
* @cpus_to_try: array of QEMU_KVM_ARM_TARGET_* values (terminated with
|
||||
* QEMU_KVM_ARM_TARGET_NONE) to try as fallback if the kernel does not
|
||||
* know the PREFERRED_TARGET ioctl
|
||||
* @fdarray: filled in with kvmfd, vmfd, cpufd file descriptors in that order
|
||||
* @init: filled in with the necessary values for creating a host vcpu
|
||||
*
|
||||
* Create a scratch vcpu in its own VM of the type preferred by the host
|
||||
* kernel (as would be used for '-cpu host'), for purposes of probing it
|
||||
* for capabilities.
|
||||
*
|
||||
* Returns: true on success (and fdarray and init are filled in),
|
||||
* false on failure (and fdarray and init are not valid).
|
||||
*/
|
||||
bool kvm_arm_create_scratch_host_vcpu(const uint32_t *cpus_to_try,
|
||||
int *fdarray,
|
||||
struct kvm_vcpu_init *init);
|
||||
|
||||
/**
|
||||
* kvm_arm_destroy_scratch_host_vcpu:
|
||||
* @fdarray: array of fds as set up by kvm_arm_create_scratch_host_vcpu
|
||||
*
|
||||
* Tear down the scratch vcpu created by kvm_arm_create_scratch_host_vcpu.
|
||||
*/
|
||||
void kvm_arm_destroy_scratch_host_vcpu(int *fdarray);
|
||||
|
||||
#define TYPE_ARM_HOST_CPU "host-" TYPE_ARM_CPU
|
||||
#define ARM_HOST_CPU_CLASS(klass) \
|
||||
OBJECT_CLASS_CHECK(ARMHostCPUClass, (klass), TYPE_ARM_HOST_CPU)
|
||||
#define ARM_HOST_CPU_GET_CLASS(obj) \
|
||||
OBJECT_GET_CLASS(ARMHostCPUClass, (obj), TYPE_ARM_HOST_CPU)
|
||||
|
||||
typedef struct ARMHostCPUClass {
|
||||
/*< private >*/
|
||||
ARMCPUClass parent_class;
|
||||
/*< public >*/
|
||||
|
||||
uint64_t features;
|
||||
uint32_t target;
|
||||
const char *dtb_compatible;
|
||||
} ARMHostCPUClass;
|
||||
|
||||
/**
|
||||
* kvm_arm_get_host_cpu_features:
|
||||
* @ahcc: ARMHostCPUClass to fill in
|
||||
*
|
||||
* Probe the capabilities of the host kernel's preferred CPU and fill
|
||||
* in the ARMHostCPUClass struct accordingly.
|
||||
*/
|
||||
bool kvm_arm_get_host_cpu_features(ARMHostCPUClass *ahcc);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue