From: Jan Kiszka <jan.kiszka@siemens.com>
To: Sheng Yang <sheng@linux.intel.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
Avi Kivity <avi@redhat.com>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: [Qemu-devel] Re: [PATCH] qemu-kvm: Replace kvm_set/get_fpu() with upstream version.
Date: Thu, 17 Jun 2010 15:27:02 +0200 [thread overview]
Message-ID: <4C1A22A6.7010209@siemens.com> (raw)
In-Reply-To: <1276768851-31415-1-git-send-email-sheng@linux.intel.com>
Sheng Yang wrote:
> Signed-off-by: Sheng Yang <sheng@linux.intel.com>
> ---
>
> Would send out XSAVE patch after the upstream ones have been merged, since the
> patch would be affected by the merge.
>
> qemu-kvm-x86.c | 23 ++---------------------
> qemu-kvm.c | 10 ----------
> qemu-kvm.h | 30 ------------------------------
> target-i386/kvm.c | 5 ++++-
> 4 files changed, 6 insertions(+), 62 deletions(-)
>
> diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c
> index 3c33e64..49218ae 100644
> --- a/qemu-kvm-x86.c
> +++ b/qemu-kvm-x86.c
> @@ -775,7 +775,6 @@ static void get_seg(SegmentCache *lhs, const struct kvm_segment *rhs)
> void kvm_arch_load_regs(CPUState *env, int level)
> {
> struct kvm_regs regs;
> - struct kvm_fpu fpu;
> struct kvm_sregs sregs;
> struct kvm_msr_entry msrs[100];
> int rc, n, i;
> @@ -806,16 +805,7 @@ void kvm_arch_load_regs(CPUState *env, int level)
>
> kvm_set_regs(env, ®s);
>
> - memset(&fpu, 0, sizeof fpu);
> - fpu.fsw = env->fpus & ~(7 << 11);
> - fpu.fsw |= (env->fpstt & 7) << 11;
> - fpu.fcw = env->fpuc;
> - for (i = 0; i < 8; ++i)
> - fpu.ftwx |= (!env->fptags[i]) << i;
> - memcpy(fpu.fpr, env->fpregs, sizeof env->fpregs);
> - memcpy(fpu.xmm, env->xmm_regs, sizeof env->xmm_regs);
> - fpu.mxcsr = env->mxcsr;
> - kvm_set_fpu(env, &fpu);
> + kvm_put_fpu(env);
>
> memset(sregs.interrupt_bitmap, 0, sizeof(sregs.interrupt_bitmap));
> if (env->interrupt_injected >= 0) {
> @@ -933,7 +923,6 @@ void kvm_arch_load_regs(CPUState *env, int level)
> void kvm_arch_save_regs(CPUState *env)
> {
> struct kvm_regs regs;
> - struct kvm_fpu fpu;
> struct kvm_sregs sregs;
> struct kvm_msr_entry msrs[100];
> uint32_t hflags;
> @@ -965,15 +954,7 @@ void kvm_arch_save_regs(CPUState *env)
> env->eflags = regs.rflags;
> env->eip = regs.rip;
>
> - kvm_get_fpu(env, &fpu);
> - env->fpstt = (fpu.fsw >> 11) & 7;
> - env->fpus = fpu.fsw;
> - env->fpuc = fpu.fcw;
> - for (i = 0; i < 8; ++i)
> - env->fptags[i] = !((fpu.ftwx >> i) & 1);
> - memcpy(env->fpregs, fpu.fpr, sizeof env->fpregs);
> - memcpy(env->xmm_regs, fpu.xmm, sizeof env->xmm_regs);
> - env->mxcsr = fpu.mxcsr;
> + kvm_get_fpu(env);
>
> kvm_get_sregs(env, &sregs);
>
> diff --git a/qemu-kvm.c b/qemu-kvm.c
> index 96d458c..114cb5e 100644
> --- a/qemu-kvm.c
> +++ b/qemu-kvm.c
> @@ -461,16 +461,6 @@ int kvm_set_regs(CPUState *env, struct kvm_regs *regs)
> return kvm_vcpu_ioctl(env, KVM_SET_REGS, regs);
> }
>
> -int kvm_get_fpu(CPUState *env, struct kvm_fpu *fpu)
> -{
> - return kvm_vcpu_ioctl(env, KVM_GET_FPU, fpu);
> -}
> -
> -int kvm_set_fpu(CPUState *env, struct kvm_fpu *fpu)
> -{
> - return kvm_vcpu_ioctl(env, KVM_SET_FPU, fpu);
> -}
> -
> int kvm_get_sregs(CPUState *env, struct kvm_sregs *sregs)
> {
> return kvm_vcpu_ioctl(env, KVM_GET_SREGS, sregs);
> diff --git a/qemu-kvm.h b/qemu-kvm.h
> index 6f6c6d8..ebe7893 100644
> --- a/qemu-kvm.h
> +++ b/qemu-kvm.h
> @@ -222,36 +222,6 @@ int kvm_get_regs(CPUState *env, struct kvm_regs *regs);
> * \return 0 on success
> */
> int kvm_set_regs(CPUState *env, struct kvm_regs *regs);
> -/*!
> - * \brief Read VCPU fpu registers
> - *
> - * This gets the FPU registers from the VCPU and outputs them
> - * into a kvm_fpu structure
> - *
> - * \note This function returns a \b copy of the VCPUs registers.\n
> - * If you wish to modify the VCPU FPU registers, you should call kvm_set_fpu()
> - *
> - * \param kvm Pointer to the current kvm_context
> - * \param vcpu Which virtual CPU should get dumped
> - * \param fpu Pointer to a kvm_fpu which will be populated with the VCPUs
> - * fpu registers values
> - * \return 0 on success
> - */
> -int kvm_get_fpu(CPUState *env, struct kvm_fpu *fpu);
> -
> -/*!
> - * \brief Write VCPU fpu registers
> - *
> - * This sets the FPU registers on the VCPU from a kvm_fpu structure
> - *
> - * \note When this function returns, the fpu pointer and the data it points to
> - * can be discarded
> - * \param kvm Pointer to the current kvm_context
> - * \param vcpu Which virtual CPU should get dumped
> - * \param fpu Pointer to a kvm_fpu which holds the new vcpu fpu state
> - * \return 0 on success
> - */
> -int kvm_set_fpu(CPUState *env, struct kvm_fpu *fpu);
>
> /*!
> * \brief Read VCPU system registers
> diff --git a/target-i386/kvm.c b/target-i386/kvm.c
> index 9cb9cf4..9c13f62 100644
> --- a/target-i386/kvm.c
> +++ b/target-i386/kvm.c
> @@ -488,6 +488,7 @@ static int kvm_getput_regs(CPUState *env, int set)
>
> return ret;
> }
> +#endif /* KVM_UPSTREAM */
>
> static int kvm_put_fpu(CPUState *env)
> {
> @@ -507,6 +508,7 @@ static int kvm_put_fpu(CPUState *env)
> return kvm_vcpu_ioctl(env, KVM_SET_FPU, &fpu);
> }
>
> +#ifdef KVM_UPSTREAM
> static int kvm_put_sregs(CPUState *env)
> {
> struct kvm_sregs sregs;
> @@ -605,7 +607,7 @@ static int kvm_put_msrs(CPUState *env, int level)
> return kvm_vcpu_ioctl(env, KVM_SET_MSRS, &msr_data);
>
> }
> -
> +#endif /* KVM_UPSTREAM */
>
> static int kvm_get_fpu(CPUState *env)
> {
> @@ -628,6 +630,7 @@ static int kvm_get_fpu(CPUState *env)
> return 0;
> }
>
> +#ifdef KVM_UPSTREAM
> static int kvm_get_sregs(CPUState *env)
> {
> struct kvm_sregs sregs;
Perfect, another step forward towards upstream!
Thanks,
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
next prev parent reply other threads:[~2010-06-17 13:27 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-17 7:18 [Qemu-devel] [PATCH v4 0/4] XSAVE enabling in QEmu Sheng Yang
2010-06-17 7:18 ` [Qemu-devel] [PATCH 1/4] qemu: kvm: Extend kvm_arch_get_supported_cpuid() to support index Sheng Yang
2010-06-17 7:18 ` [Qemu-devel] [PATCH 2/4] qemu: Enable XSAVE related CPUID Sheng Yang
2010-06-17 7:18 ` [Qemu-devel] [PATCH 3/4] qemu: kvm: Enable XSAVE live migration support Sheng Yang
2010-06-17 7:40 ` [Qemu-devel] " Jan Kiszka
2010-06-17 8:26 ` [Qemu-devel] " Sheng Yang
2010-06-17 8:57 ` [Qemu-devel] " Jan Kiszka
2010-06-17 9:53 ` [Qemu-devel] " Sheng Yang
2010-06-17 13:25 ` [Qemu-devel] " Jan Kiszka
2010-06-17 7:18 ` [Qemu-devel] [PATCH 4/4] qemu-kvm: " Sheng Yang
2010-06-17 7:41 ` [Qemu-devel] " Jan Kiszka
2010-06-17 8:32 ` Sheng Yang
2010-06-17 8:44 ` Jan Kiszka
2010-06-17 10:00 ` [Qemu-devel] [PATCH] qemu-kvm: Replace kvm_set/get_fpu() with upstream version Sheng Yang
2010-06-17 13:27 ` Jan Kiszka [this message]
2010-06-18 19:26 ` [Qemu-devel] Re: [PATCH v4 0/4] XSAVE enabling in QEmu Marcelo Tosatti
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=4C1A22A6.7010209@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sheng@linux.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).