@@ -200,6 +200,7 @@ typedef struct CPUWatchpoint {
int numa_node; /* NUMA node this cpu is belonging to */ \
int nr_cores; /* number of cores within this CPU package */ \
int nr_threads;/* number of threads within this CPU */ \
+ int cpu_entitlement; /* the % of the pcpu that the vcpu receives */ \
int running; /* Nonzero if cpu is currently running(usermode). */ \
int thread_id; \
/* user data */ \
@@ -1042,6 +1042,7 @@ void qemu_init_vcpu(void *_env)
env->nr_cores = smp_cores;
env->nr_threads = smp_threads;
+ env->cpu_entitlement = cpu_entitlement;
env->stopped = 1;
if (kvm_enabled()) {
qemu_kvm_start_vcpu(env);
@@ -16,6 +16,7 @@ void qtest_clock_warp(int64_t dest);
/* vl.c */
extern int smp_cores;
extern int smp_threads;
+extern int cpu_entitlement;
void set_numa_modes(void);
void set_cpu_log(const char *optarg);
void set_cpu_log_filename(const char *optarg);
@@ -246,6 +246,7 @@ int kvm_init_vcpu(CPUArchState *env)
s->coalesced_mmio_ring =
(void *)env->kvm_run + s->coalesced_mmio * PAGE_SIZE;
}
+ kvm_vm_ioctl(s, KVM_SET_ENTITLEMENT, env->cpu_entitlement);
ret = kvm_arch_init_vcpu(env);
if (ret == 0) {
@@ -901,6 +901,8 @@ struct kvm_s390_ucas_mapping {
#define KVM_SET_ONE_REG _IOW(KVMIO, 0xac, struct kvm_one_reg)
/* VM is being stopped by host */
#define KVM_KVMCLOCK_CTRL _IO(KVMIO, 0xad)
+/* Set the cpu entitlement this will be used to adjust stealtime reporting */
+#define KVM_SET_ENTITLEMENT _IOW(KVMIO, 0xae, unsigned long)
#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0)
#define KVM_DEV_ASSIGN_PCI_2_3 (1 << 1)
Add KVM_SET_ENTITLEMENT ioctl to pass the entitlement to the hypervisor. Signed-off-by: Michael Wolf <mjw@linux.vnet.ibm.com> --- cpu-defs.h | 1 + cpus.c | 1 + cpus.h | 1 + kvm-all.c | 1 + linux-headers/linux/kvm.h | 2 ++ 5 files changed, 6 insertions(+)