From: Avi Kivity <avi@redhat.com>
To: Orit Wasserman <owasserm@redhat.com>
Cc: kvm@vger.kernel.org, gleb@redhat.com,
Orit Wasserman <owasserm@rehdat.com>
Subject: Re: [PATCH] Fix migration of real mode guests from host with unrestricted guest to a host without it.
Date: Thu, 31 May 2012 14:23:32 +0300 [thread overview]
Message-ID: <4FC754B4.9010904@redhat.com> (raw)
In-Reply-To: <1338462810-6300-1-git-send-email-owasserm@redhat.com>
On 05/31/2012 02:13 PM, Orit Wasserman wrote:
> For example migration between Westmere and Nehelem hosts.
> The patch fixes the guest segments similar to enter_rmode function.
>
> Signed-off-by: Orit Wasserman <owasserm@rehdat.com>
> ---
> arch/x86/kvm/vmx.c | 38 ++++++++++++++++++++++++++++++++++++++
> 1 files changed, 38 insertions(+), 0 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 32eb588..2eca18f 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -3229,6 +3229,44 @@ static void vmx_set_segment(struct kvm_vcpu *vcpu,
>
> vmcs_write32(sf->ar_bytes, ar);
> __clear_bit(VCPU_EXREG_CPL, (ulong *)&vcpu->arch.regs_avail);
> +
> + /*
> + * Fix segments for real mode guest in hosts that don't have
> + * "unrestricted_mode" or it was disabled.
> + * This is done to allow migration of the guests from hosts with
> + * unrestricted guest like Westmere to older host that don't have
> + * unrestricted guest like Nehelem.
> + */
> + if (!enable_unrestricted_guest && vmx->rmode.vm86_active) {
> + switch (seg) {
> + case VCPU_SREG_CS:
> + vmcs_write32(GUEST_CS_AR_BYTES, 0xf3);
> + vmcs_write32(GUEST_CS_LIMIT, 0xffff);
> + if (vmcs_readl(GUEST_CS_BASE) == 0xffff0000)
> + vmcs_writel(GUEST_CS_BASE, 0xf0000);
> + vmcs_write16(GUEST_CS_SELECTOR,
> + vmcs_readl(GUEST_CS_BASE) >> 4);
> + break;
> + case VCPU_SREG_ES:
> + fix_rmode_seg(VCPU_SREG_ES, &vmx->rmode.es);
> + break;
> + case VCPU_SREG_DS:
> + fix_rmode_seg(VCPU_SREG_DS, &vmx->rmode.ds);
> + break;
> + case VCPU_SREG_GS:
> + fix_rmode_seg(VCPU_SREG_GS, &vmx->rmode.gs);
> + break;
> + case VCPU_SREG_FS:
> + fix_rmode_seg(VCPU_SREG_FS, &vmx->rmode.fs);
> + break;
> + case VCPU_SREG_SS:
> + vmcs_write16(GUEST_SS_SELECTOR,
> + vmcs_readl(GUEST_SS_BASE) >> 4);
> + vmcs_write32(GUEST_SS_LIMIT, 0xffff);
> + vmcs_write32(GUEST_SS_AR_BYTES, 0xf3);
> + break;
> + }
> + }
> }
>
This duplicates the code in enter_rmode(). Please change enter_rmode()
to vmx_set_segment(vmx_get_segment()) to avoid duplication.
--
error compiling committee.c: too many arguments to function
prev parent reply other threads:[~2012-05-31 12:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-31 11:13 [PATCH] Fix migration of real mode guests from host with unrestricted guest to a host without it Orit Wasserman
2012-05-31 11:23 ` Avi Kivity [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=4FC754B4.9010904@redhat.com \
--to=avi@redhat.com \
--cc=gleb@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=owasserm@redhat.com \
--cc=owasserm@rehdat.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