mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 09:43:56 -06:00
pseries: Support SMT systems for KVM Book3S-HV
Alex Graf has already made qemu support KVM for the pseries machine when using the Book3S-PR KVM variant (which runs the guest in usermode, emulating supervisor operations). This code allows gets us very close to also working with KVM Book3S-HV (using the hypervisor capabilities of recent POWER CPUs). This patch moves us another step towards Book3S-HV support by correctly handling SMT (multithreaded) POWER CPUs. There are two parts to this: * Querying KVM to check SMT capability, and if present, adjusting the cpu numbers that qemu assigns to cause KVM to assign guest threads to cores in the right way (this isn't automatic, because the POWER HV support has a limitation that different threads on a single core cannot be in different guests at the same time). * Correctly informing the guest OS of the SMT thread to core mappings via the device tree. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
parent
eeae2e7b52
commit
e97c363638
4 changed files with 46 additions and 3 deletions
|
@ -26,6 +26,8 @@
|
|||
#include "helper_regs.h"
|
||||
#include "qemu-common.h"
|
||||
#include "kvm.h"
|
||||
#include "kvm_ppc.h"
|
||||
#include "cpus.h"
|
||||
|
||||
//#define DEBUG_MMU
|
||||
//#define DEBUG_BATS
|
||||
|
@ -3189,6 +3191,15 @@ CPUPPCState *cpu_ppc_init (const char *cpu_model)
|
|||
if (tcg_enabled()) {
|
||||
ppc_translate_init();
|
||||
}
|
||||
/* Adjust cpu index for SMT */
|
||||
#if !defined(CONFIG_USER_ONLY)
|
||||
if (kvm_enabled()) {
|
||||
int smt = kvmppc_smt_threads();
|
||||
|
||||
env->cpu_index = (env->cpu_index / smp_threads)*smt
|
||||
+ (env->cpu_index % smp_threads);
|
||||
}
|
||||
#endif /* !CONFIG_USER_ONLY */
|
||||
env->cpu_model_str = cpu_model;
|
||||
cpu_ppc_register_internal(env, def);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue