From: Yang Weijiang <weijiang.yang@intel.com>
To: qemu-devel@nongnu.org, pbonzini@redhat.com, rkrcmar@redhat.com,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
mst@redhat.com, yu-cheng.yu@intel.com, yi.z.zhang@intel.com,
hjl.tools@gmail.com
Cc: Yang Weijiang <weijiang.yang@intel.com>,
Zhang Yi <yi.z.zhang@linux.intel.com>
Subject: [Qemu-devel][PATCH 4/4] Report CPUID xsave area support for CET.
Date: Wed, 26 Dec 2018 16:25:20 +0800 [thread overview]
Message-ID: <b3b315a59c56582e2c4fd5f3e262f5d38b4b8985.1545806972.git.weijiang.yang@intel.com> (raw)
In-Reply-To: <cover.1545806972.git.weijiang.yang@intel.com>
In-Reply-To: <cover.1545806972.git.weijiang.yang@intel.com>
CPUID bit definition as below:
CPUID.(EAX=d, ECX=1):ECX.CET_U(bit 11): user mode state
CPUID.(EAX=d, ECX=1):ECX.CET_S(bit 12): kernel mode state
Signed-off-by: Zhang Yi <yi.z.zhang@linux.intel.com>
Signed-off-by: Yang Weijiang <weijiang.yang@intel.com>
---
target/i386/cpu.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index cf4f2798dc..78994bfa1d 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -4396,12 +4396,22 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
*ebx = xsave_area_size(env->xcr0);
} else if (count == 1) {
*eax = env->features[FEAT_XSAVE];
+ *ecx = env->features[FEAT_XSAVE_SV_LO];
+ *edx = env->features[FEAT_XSAVE_SV_HI];
+ *ebx = xsave_area_size_compat(x86_cpu_xsave_components(cpu) |
+ x86_cpu_xsave_sv_components(cpu));
} else if (count < ARRAY_SIZE(x86_ext_save_areas)) {
if ((x86_cpu_xsave_components(cpu) >> count) & 1) {
const ExtSaveArea *esa = &x86_ext_save_areas[count];
*eax = esa->size;
*ebx = esa->offset;
}
+ if ((x86_cpu_xsave_sv_components(cpu) >> count) & 1) {
+ const ExtSaveArea *esa_sv = &x86_ext_save_areas[count];
+ *eax = esa_sv->size;
+ *ebx = esa_sv->offset;
+ *ecx = 1;
+ }
}
break;
}
--
2.17.1
prev parent reply other threads:[~2018-12-26 8:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-26 8:25 [Qemu-devel][PATCH 0/4] This patch-set is to enable Guest CET support Yang Weijiang
2018-12-26 8:25 ` [Qemu-devel][PATCH 1/4] Add CET xsaves/xrstors related macros and structures Yang Weijiang
2018-12-26 8:25 ` [Qemu-devel][PATCH 2/4] Add CET SHSTK and IBT CPUID feature-word definitions Yang Weijiang
2018-12-28 14:25 ` Paolo Bonzini
2018-12-29 15:26 ` Yang Weijiang
2018-12-26 8:25 ` [Qemu-devel][PATCH 3/4] Add hepler functions for CPUID xsave area size calculation Yang Weijiang
2019-01-08 16:11 ` Christophe de Dinechin
2018-12-26 8:25 ` Yang Weijiang [this message]
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=b3b315a59c56582e2c4fd5f3e262f5d38b4b8985.1545806972.git.weijiang.yang@intel.com \
--to=weijiang.yang@intel.com \
--cc=hjl.tools@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rkrcmar@redhat.com \
--cc=yi.z.zhang@intel.com \
--cc=yi.z.zhang@linux.intel.com \
--cc=yu-cheng.yu@intel.com \
/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).