From: Liran Alon <liran.alon@oracle.com>
To: qemu-devel@nongnu.org
Cc: maran.wilson@oracle.com, dgilbert@redhat.com,
Liran Alon <liran.alon@oracle.com>,
pbonzini@redhat.com, Karl Heubaum <karl.heubaum@oracle.com>
Subject: [Qemu-devel] [PATCH 2/2] target/i386: kvm: Init nested-state in case of vCPU exposed with SVM
Date: Sat, 22 Jun 2019 00:37:12 +0300 [thread overview]
Message-ID: <20190621213712.16222-3-liran.alon@oracle.com> (raw)
In-Reply-To: <20190621213712.16222-1-liran.alon@oracle.com>
Even though current most upstream kernel does not support save/restore
of nested-state in case of AMD SVM, prepare QEMU code to init
relevant nested-state struct fields.
Reviewed-by: Mark Kanda <mark.kanda@oracle.com>
Reviewed-by: Karl Heubaum <karl.heubaum@oracle.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
---
target/i386/kvm.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index c2bae6a3023a..be192e54a80b 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -1714,13 +1714,14 @@ int kvm_arch_init_vcpu(CPUState *cs)
env->nested_state->size = max_nested_state_len;
- if (IS_INTEL_CPU(env)) {
+ if (cpu_has_vmx(env)) {
struct kvm_vmx_nested_state_hdr *vmx_hdr =
&env->nested_state->hdr.vmx;
-
env->nested_state->format = KVM_STATE_NESTED_FORMAT_VMX;
vmx_hdr->vmxon_pa = -1ull;
vmx_hdr->vmcs12_pa = -1ull;
+ } else if (cpu_has_svm(env)) {
+ env->nested_state->format = KVM_STATE_NESTED_FORMAT_SVM;
}
}
--
2.20.1
next prev parent reply other threads:[~2019-06-21 21:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-21 21:37 [Qemu-devel] [PATCH 0/2] target/i386: kvm: Fix treatment of AMD SVM in nested migration Liran Alon
2019-06-21 21:37 ` [Qemu-devel] [PATCH 1/2] target/i386: kvm: Block migration on vCPU exposed with SVM when kernel lacks caps to save/restore nested state Liran Alon
2019-06-21 21:37 ` Liran Alon [this message]
2019-06-21 23:59 ` [Qemu-devel] [PATCH 0/2] target/i386: kvm: Fix treatment of AMD SVM in nested migration Paolo Bonzini
2019-06-22 0:44 ` Liran Alon
2019-06-22 2:39 ` no-reply
2019-06-22 11:16 ` Liran Alon
2019-06-23 8:35 ` no-reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190621213712.16222-3-liran.alon@oracle.com \
--to=liran.alon@oracle.com \
--cc=dgilbert@redhat.com \
--cc=karl.heubaum@oracle.com \
--cc=maran.wilson@oracle.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).