All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mukesh Rathor <mukesh.rathor@oracle.com>
To: "Xen-devel@lists.xensource.com" <Xen-devel@lists.xensource.com>
Cc: boris.ostrovsky@oracle.com, Aravind.Gopalakrishnan@amd.com,
	suravee.suthikulpanit@amd.com, Jan Beulich <JBeulich@suse.com>
Subject: [RFH]: AMD CR intercept for lmsw/clts
Date: Mon, 4 Aug 2014 18:33:37 -0700	[thread overview]
Message-ID: <20140804183337.2bb1b680@mantra.us.oracle.com> (raw)

Hi,

On AMD, clts/lmsw will cause "mov cr" vmexit, but unlike intel, they
can't be handled via svm_vmexit_do_cr_access and are emulated thru
handle_mmio() which is a problem for pvh because of:

handle_mmio():
..
    ASSERT(!is_pvh_vcpu(curr));

AMD CR intercepts in svm.c:
    case VMEXIT_CR0_READ ... VMEXIT_CR15_READ:
    case VMEXIT_CR0_WRITE ... VMEXIT_CR15_WRITE:
        if ( cpu_has_svm_decode && (vmcb->exitinfo1 & (1ULL << 63)) )
            svm_vmexit_do_cr_access(vmcb, regs);
        else if ( !handle_mmio() )     <==========
            hvm_inject_hw_exception(TRAP_gp_fault, 0);
    break;

Soooo, this leaves no choice but to make the ASSERT conditional
for intel only, and let handle_mmio go thru x86_emulate and let
x86_emulate fail for anything other than lmsw/clts? I was thinking
something like:

x86_emulate()
  int fail_pvh_emul = 1;
  ...
  case lmsw/clts:
     .....
     fail_pvh_emul = 0;

then
 done:
     if (fail_pvh_emul)
         rc = X86EMUL_UNHANDLEABLE;
     return rc;

Or, should I just create a new function for clts/lmsw and call it
directly from vmexit switch itself?

Can't think of any other clever way to do this... thoughts/suggestions?

thanks,
Mukesh

             reply	other threads:[~2014-08-05  1:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-05  1:33 Mukesh Rathor [this message]
2014-08-05  7:46 ` [RFH]: AMD CR intercept for lmsw/clts Jan Beulich
2014-08-05 11:16   ` Andrew Cooper
2014-08-05 12:11     ` Jan Beulich
2014-08-05 13:00       ` Andrew Cooper
2014-08-05 13:15         ` Jan Beulich
2014-08-05 22:30         ` Mukesh Rathor
2014-08-06  9:34           ` Andrew Cooper
2014-08-15 21:04             ` Konrad Rzeszutek Wilk
2014-08-15 21:48               ` Andrew Cooper
2014-08-05 22:22   ` Mukesh Rathor

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=20140804183337.2bb1b680@mantra.us.oracle.com \
    --to=mukesh.rathor@oracle.com \
    --cc=Aravind.Gopalakrishnan@amd.com \
    --cc=JBeulich@suse.com \
    --cc=Xen-devel@lists.xensource.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=suravee.suthikulpanit@amd.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.