|
|
6e672b |
From 608f71fea5a9cc79483d0b66aa59cd652ee5bf9c Mon Sep 17 00:00:00 2001
|
|
|
6e672b |
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
|
|
|
6e672b |
Date: Thu, 28 Jun 2018 17:57:06 +0200
|
|
|
6e672b |
Subject: [PATCH 1/5] target-i386: introduce kvm_put_one_msr
|
|
|
6e672b |
|
|
|
6e672b |
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
6e672b |
Message-id: <20180628175710.56848-2-dgilbert@redhat.com>
|
|
|
6e672b |
Patchwork-id: 81144
|
|
|
6e672b |
O-Subject: [RHEL-7.5.z/RHEL-7.4.z/RHEL-7.3.z qemu-kvm PATCH 1/5] target-i386: introduce kvm_put_one_msr
|
|
|
6e672b |
Bugzilla: 1596302
|
|
|
6e672b |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
6e672b |
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
|
|
|
6e672b |
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
6e672b |
|
|
|
6e672b |
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
|
|
|
6e672b |
|
|
|
6e672b |
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
6e672b |
Message-id: <20180515115634.24469-2-dgilbert@redhat.com>
|
|
|
6e672b |
Patchwork-id: 80272
|
|
|
6e672b |
O-Subject: [RHEL-7.6 qemu-kvm PATCH v2 1/5] target-i386: introduce kvm_put_one_msr
|
|
|
6e672b |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
6e672b |
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
6e672b |
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
6e672b |
|
|
|
6e672b |
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
|
|
|
6e672b |
|
|
|
6e672b |
Avoid further code duplication in the next patch.
|
|
|
6e672b |
|
|
|
6e672b |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
6e672b |
(cherry picked from commit 73e1b8f2f9b8a90361f9c1af306ee17bfcfd592d)
|
|
|
6e672b |
(cherry picked from commit e9e26236af6a858961280cd4997c437eab27c1e9)
|
|
|
6e672b |
Merge conflict:
|
|
|
6e672b |
We don't yet have Eduardo's patch where kvm_msr_entry_add
|
|
|
6e672b |
was added, so rework to the older kvm_msr_entry_set.
|
|
|
6e672b |
|
|
|
6e672b |
No msr_feature_control in this world
|
|
|
6e672b |
|
|
|
6e672b |
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
6e672b |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
6e672b |
(cherry picked from commit 596e3e7f77a1570aff586199e7bb34de0b4e0ba6)
|
|
|
6e672b |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
6e672b |
---
|
|
|
6e672b |
target-i386/kvm.c | 28 +++++++++++++++++++++-------
|
|
|
6e672b |
1 file changed, 21 insertions(+), 7 deletions(-)
|
|
|
6e672b |
|
|
|
6e672b |
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
|
|
|
6e672b |
index 656e24b..8544e52 100644
|
|
|
6e672b |
--- a/target-i386/kvm.c
|
|
|
6e672b |
+++ b/target-i386/kvm.c
|
|
|
6e672b |
@@ -1141,24 +1141,38 @@ static void kvm_msr_entry_set(struct kvm_msr_entry *entry,
|
|
|
6e672b |
entry->data = value;
|
|
|
6e672b |
}
|
|
|
6e672b |
|
|
|
6e672b |
-static int kvm_put_tscdeadline_msr(X86CPU *cpu)
|
|
|
6e672b |
+static int kvm_put_one_msr(X86CPU *cpu, int index, uint64_t value)
|
|
|
6e672b |
{
|
|
|
6e672b |
- CPUX86State *env = &cpu->env;
|
|
|
6e672b |
struct {
|
|
|
6e672b |
struct kvm_msrs info;
|
|
|
6e672b |
struct kvm_msr_entry entries[1];
|
|
|
6e672b |
} msr_data;
|
|
|
6e672b |
- struct kvm_msr_entry *msrs = msr_data.entries;
|
|
|
6e672b |
+
|
|
|
6e672b |
+ kvm_msr_entry_set(&msr_data.entries[0], index, value);
|
|
|
6e672b |
+
|
|
|
6e672b |
+ msr_data.info = (struct kvm_msrs) {
|
|
|
6e672b |
+ .nmsrs = 1,
|
|
|
6e672b |
+ };
|
|
|
6e672b |
+
|
|
|
6e672b |
+ return kvm_vcpu_ioctl(CPU(cpu), KVM_SET_MSRS, &msr_data);
|
|
|
6e672b |
+}
|
|
|
6e672b |
+
|
|
|
6e672b |
+static int kvm_put_tscdeadline_msr(X86CPU *cpu)
|
|
|
6e672b |
+{
|
|
|
6e672b |
+ CPUX86State *env = &cpu->env;
|
|
|
6e672b |
+ int ret;
|
|
|
6e672b |
|
|
|
6e672b |
if (!has_msr_tsc_deadline) {
|
|
|
6e672b |
return 0;
|
|
|
6e672b |
}
|
|
|
6e672b |
|
|
|
6e672b |
- kvm_msr_entry_set(&msrs[0], MSR_IA32_TSCDEADLINE, env->tsc_deadline);
|
|
|
6e672b |
-
|
|
|
6e672b |
- msr_data.info.nmsrs = 1;
|
|
|
6e672b |
+ ret = kvm_put_one_msr(cpu, MSR_IA32_TSCDEADLINE, env->tsc_deadline);
|
|
|
6e672b |
+ if (ret < 0) {
|
|
|
6e672b |
+ return ret;
|
|
|
6e672b |
+ }
|
|
|
6e672b |
|
|
|
6e672b |
- return kvm_vcpu_ioctl(CPU(cpu), KVM_SET_MSRS, &msr_data);
|
|
|
6e672b |
+ assert(ret == 1);
|
|
|
6e672b |
+ return 0;
|
|
|
6e672b |
}
|
|
|
6e672b |
|
|
|
6e672b |
static int kvm_put_msrs(X86CPU *cpu, int level)
|
|
|
6e672b |
--
|
|
|
6e672b |
1.8.3.1
|
|
|
6e672b |
|