virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Zachary Amsden <zach@vmware.com>
Cc: Chris Wright <chrisw@sous-sol.org>,
	Virtualization Mailing List <virtualization@lists.osdl.org>
Subject: Re: New CPUID/MSR driver; virtualization hooks
Date: Thu, 05 Apr 2007 14:17:55 -0700	[thread overview]
Message-ID: <46156783.9030501@zytor.com> (raw)
In-Reply-To: <46156591.8080802@vmware.com>

Zachary Amsden wrote:
> H. Peter Anvin wrote:
>>
>> This code is almost entirely identical to the setgpr_wrapper in the 
>> patch (except for the fact that setgpr_wrapper sets and captures *ALL* 
>> the GPRs), and it seems rather pointless to use another wrapper.  It 
>> takes a pointer to an entrypoint (default to "cpuid; ret" in the CPUID 
>> case), so it should do what you need.
> 
> void (*cpuid)(unsigned int *eax, unsigned int *ebx, ...)
> 
> Not quite.  The paravirt_ops CPUID function is a C function which takes 
> pointers to each GPR as arguments, and returns the values through those 
> pointers.  This doesn't allow for an entrypoint compatible with 
> setgpr_wrapper, which expects the same output in both the cpuid; ret 
> case and the paravirt-ops case.
> 
> One could argue that the paravirt-ops CPUID should in fact emulate the 
> native instruction semantics, which would make it a non-C function.  

There is also another option, which is to create an entrypoint with the 
semantics of the *_everything() functions, i.e. take a register image in 
and out.  The above definition of a cpuid() wrapper is insufficient to 
handle potential weird cases, so if we go down that route it's 
inherently a limited-functionality hack.

It seems to me that perhaps this is the way to do it:

- Add cpuid_everything, rdmsr_everything and wrmsr_everything
   entrypoints;

- Provide compatibility wrappers that simply invoke the cpuid, rdmsr,
   and wrmsr entrypoints with appropriate parameter marshalling;

- On hardware, point them to the functions which invoke setgpr_wrapper.

What do you think?

	-hpa

  parent reply	other threads:[~2007-04-05 21:17 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-05  0:50 New CPUID/MSR driver; virtualization hooks H. Peter Anvin
2007-04-05  1:16 ` Chris Wright
2007-04-05  1:23   ` H. Peter Anvin
2007-04-05  5:17     ` Zachary Amsden
2007-04-05 18:03       ` H. Peter Anvin
2007-04-05 21:09         ` Zachary Amsden
2007-04-05 21:09           ` H. Peter Anvin
2007-04-05 21:25             ` Zachary Amsden
2007-04-05 21:17           ` H. Peter Anvin [this message]
2007-04-05 21:27             ` Zachary Amsden
2007-04-05 21:40               ` H. Peter Anvin
2007-04-05 21:43                 ` Jeremy Fitzhardinge
2007-04-05 21:43                 ` Zachary Amsden
2007-04-05 21:49                   ` Jeremy Fitzhardinge
2007-04-05 21:59                     ` H. Peter Anvin
2007-04-05 22:19                       ` Jeremy Fitzhardinge
2007-04-05 22:31                         ` H. Peter Anvin
2007-04-05 21:54                   ` Chris Wright
2007-04-05  1:48 ` Tony Breeds
2007-04-05  5:00 ` Zachary Amsden

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=46156783.9030501@zytor.com \
    --to=hpa@zytor.com \
    --cc=chrisw@sous-sol.org \
    --cc=virtualization@lists.osdl.org \
    --cc=zach@vmware.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).