xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libxc: expand cpuid features exposed to PVH guests
@ 2014-07-23 14:12 Roger Pau Monne
  2014-07-23 14:22 ` Andrew Cooper
  2014-07-28 14:19 ` David Vrabel
  0 siblings, 2 replies; 5+ messages in thread
From: Roger Pau Monne @ 2014-07-23 14:12 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper, Ian Jackson, Ian Campbell, Roger Pau Monne

Expand the cpuid features exposed to PVH guests, this includes
exposing PSE, PGE and 1GB pages (which will be masked by the
hypervisor if not supported by the hardware).

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/libxc/xc_cpuid_x86.c |   13 ++++++++-----
 tools/libxc/xc_domain.c    |    1 +
 tools/libxc/xenctrl.h      |    2 +-
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c
index 8acb9fb..c7208fc 100644
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -437,7 +437,7 @@ static void xc_cpuid_hvm_policy(
 
 static void xc_cpuid_pv_policy(
     xc_interface *xch, domid_t domid,
-    const unsigned int *input, unsigned int *regs)
+    const unsigned int *input, unsigned int *regs, unsigned int autotranslated)
 {
     DECLARE_DOMCTL;
     unsigned int guest_width;
@@ -460,8 +460,10 @@ static void xc_cpuid_pv_policy(
     if ( (input[0] & 0x7fffffff) == 0x00000001 )
     {
         clear_bit(X86_FEATURE_VME, regs[3]);
-        clear_bit(X86_FEATURE_PSE, regs[3]);
-        clear_bit(X86_FEATURE_PGE, regs[3]);
+        if ( !autotranslated ) {
+            clear_bit(X86_FEATURE_PSE, regs[3]);
+            clear_bit(X86_FEATURE_PGE, regs[3]);
+        }
         clear_bit(X86_FEATURE_MCE, regs[3]);
         clear_bit(X86_FEATURE_MCA, regs[3]);
         clear_bit(X86_FEATURE_MTRR, regs[3]);
@@ -530,7 +532,8 @@ static void xc_cpuid_pv_policy(
         {
             set_bit(X86_FEATURE_SYSCALL, regs[3]);
         }
-        clear_bit(X86_FEATURE_PAGE1GB, regs[3]);
+        if ( !autotranslated )
+            clear_bit(X86_FEATURE_PAGE1GB, regs[3]);
         clear_bit(X86_FEATURE_RDTSCP, regs[3]);
 
         clear_bit(X86_FEATURE_SVM, regs[2]);
@@ -578,7 +581,7 @@ static int xc_cpuid_policy(
     if ( info.hvm )
         xc_cpuid_hvm_policy(xch, domid, input, regs);
     else
-        xc_cpuid_pv_policy(xch, domid, input, regs);
+        xc_cpuid_pv_policy(xch, domid, input, regs, info.pvh);
 
     return 0;
 }
diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c
index 0230c6c..c67ac9a 100644
--- a/tools/libxc/xc_domain.c
+++ b/tools/libxc/xc_domain.c
@@ -348,6 +348,7 @@ int xc_domain_getinfo(xc_interface *xch,
         info->running  = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_running);
         info->hvm      = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_hvm_guest);
         info->debugged = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_debugged);
+        info->pvh      = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_pvh_guest);
 
         info->shutdown_reason =
             (domctl.u.getdomaininfo.flags>>XEN_DOMINF_shutdownshift) &
diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h
index 3578b09..8b55fba 100644
--- a/tools/libxc/xenctrl.h
+++ b/tools/libxc/xenctrl.h
@@ -422,7 +422,7 @@ typedef struct xc_dominfo {
     uint32_t      ssidref;
     unsigned int  dying:1, crashed:1, shutdown:1,
                   paused:1, blocked:1, running:1,
-                  hvm:1, debugged:1;
+                  hvm:1, debugged:1, pvh:1;
     unsigned int  shutdown_reason; /* only meaningful if shutdown==1 */
     unsigned long nr_pages; /* current number, not maximum */
     unsigned long nr_outstanding_pages;
-- 
1.7.7.5 (Apple Git-26)


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] libxc: expand cpuid features exposed to PVH guests
  2014-07-23 14:12 [PATCH] libxc: expand cpuid features exposed to PVH guests Roger Pau Monne
@ 2014-07-23 14:22 ` Andrew Cooper
  2014-07-28 14:19 ` David Vrabel
  1 sibling, 0 replies; 5+ messages in thread
From: Andrew Cooper @ 2014-07-23 14:22 UTC (permalink / raw)
  To: Roger Pau Monne, xen-devel; +Cc: Ian Jackson, Ian Campbell

On 23/07/14 15:12, Roger Pau Monne wrote:
> Expand the cpuid features exposed to PVH guests, this includes
> exposing PSE, PGE and 1GB pages (which will be masked by the
> hypervisor if not supported by the hardware).
>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
> Cc: Ian Campbell <ian.campbell@citrix.com>
> Cc: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
>  tools/libxc/xc_cpuid_x86.c |   13 ++++++++-----
>  tools/libxc/xc_domain.c    |    1 +
>  tools/libxc/xenctrl.h      |    2 +-
>  3 files changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c
> index 8acb9fb..c7208fc 100644
> --- a/tools/libxc/xc_cpuid_x86.c
> +++ b/tools/libxc/xc_cpuid_x86.c
> @@ -437,7 +437,7 @@ static void xc_cpuid_hvm_policy(
>  
>  static void xc_cpuid_pv_policy(
>      xc_interface *xch, domid_t domid,
> -    const unsigned int *input, unsigned int *regs)
> +    const unsigned int *input, unsigned int *regs, unsigned int autotranslated)

bool autotranslated, but I would suggest 'pvh' as a name as PV
autotranslated is an already existing thing.

Other than that, Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

>  {
>      DECLARE_DOMCTL;
>      unsigned int guest_width;
> @@ -460,8 +460,10 @@ static void xc_cpuid_pv_policy(
>      if ( (input[0] & 0x7fffffff) == 0x00000001 )
>      {
>          clear_bit(X86_FEATURE_VME, regs[3]);
> -        clear_bit(X86_FEATURE_PSE, regs[3]);
> -        clear_bit(X86_FEATURE_PGE, regs[3]);
> +        if ( !autotranslated ) {
> +            clear_bit(X86_FEATURE_PSE, regs[3]);
> +            clear_bit(X86_FEATURE_PGE, regs[3]);
> +        }
>          clear_bit(X86_FEATURE_MCE, regs[3]);
>          clear_bit(X86_FEATURE_MCA, regs[3]);
>          clear_bit(X86_FEATURE_MTRR, regs[3]);
> @@ -530,7 +532,8 @@ static void xc_cpuid_pv_policy(
>          {
>              set_bit(X86_FEATURE_SYSCALL, regs[3]);
>          }
> -        clear_bit(X86_FEATURE_PAGE1GB, regs[3]);
> +        if ( !autotranslated )
> +            clear_bit(X86_FEATURE_PAGE1GB, regs[3]);
>          clear_bit(X86_FEATURE_RDTSCP, regs[3]);
>  
>          clear_bit(X86_FEATURE_SVM, regs[2]);
> @@ -578,7 +581,7 @@ static int xc_cpuid_policy(
>      if ( info.hvm )
>          xc_cpuid_hvm_policy(xch, domid, input, regs);
>      else
> -        xc_cpuid_pv_policy(xch, domid, input, regs);
> +        xc_cpuid_pv_policy(xch, domid, input, regs, info.pvh);
>  
>      return 0;
>  }
> diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c
> index 0230c6c..c67ac9a 100644
> --- a/tools/libxc/xc_domain.c
> +++ b/tools/libxc/xc_domain.c
> @@ -348,6 +348,7 @@ int xc_domain_getinfo(xc_interface *xch,
>          info->running  = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_running);
>          info->hvm      = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_hvm_guest);
>          info->debugged = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_debugged);
> +        info->pvh      = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_pvh_guest);
>  
>          info->shutdown_reason =
>              (domctl.u.getdomaininfo.flags>>XEN_DOMINF_shutdownshift) &
> diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h
> index 3578b09..8b55fba 100644
> --- a/tools/libxc/xenctrl.h
> +++ b/tools/libxc/xenctrl.h
> @@ -422,7 +422,7 @@ typedef struct xc_dominfo {
>      uint32_t      ssidref;
>      unsigned int  dying:1, crashed:1, shutdown:1,
>                    paused:1, blocked:1, running:1,
> -                  hvm:1, debugged:1;
> +                  hvm:1, debugged:1, pvh:1;
>      unsigned int  shutdown_reason; /* only meaningful if shutdown==1 */
>      unsigned long nr_pages; /* current number, not maximum */
>      unsigned long nr_outstanding_pages;


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] libxc: expand cpuid features exposed to PVH guests
  2014-07-23 14:12 [PATCH] libxc: expand cpuid features exposed to PVH guests Roger Pau Monne
  2014-07-23 14:22 ` Andrew Cooper
@ 2014-07-28 14:19 ` David Vrabel
  2014-07-28 17:39   ` Roger Pau Monné
  1 sibling, 1 reply; 5+ messages in thread
From: David Vrabel @ 2014-07-28 14:19 UTC (permalink / raw)
  To: Roger Pau Monne, xen-devel; +Cc: Andrew Cooper, Ian Jackson, Ian Campbell

On 23/07/14 15:12, Roger Pau Monne wrote:
> Expand the cpuid features exposed to PVH guests, this includes
> exposing PSE, PGE and 1GB pages (which will be masked by the
> hypervisor if not supported by the hardware).

I'm confused.  Why is PVH using the PV CPUID policy instead of the HVM one?

David

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] libxc: expand cpuid features exposed to PVH guests
  2014-07-28 14:19 ` David Vrabel
@ 2014-07-28 17:39   ` Roger Pau Monné
  2014-07-29 14:15     ` George Dunlap
  0 siblings, 1 reply; 5+ messages in thread
From: Roger Pau Monné @ 2014-07-28 17:39 UTC (permalink / raw)
  To: David Vrabel, xen-devel; +Cc: Andrew Cooper, Ian Jackson, Ian Campbell

On 28/07/14 16:19, David Vrabel wrote:
> On 23/07/14 15:12, Roger Pau Monne wrote:
>> Expand the cpuid features exposed to PVH guests, this includes
>> exposing PSE, PGE and 1GB pages (which will be masked by the
>> hypervisor if not supported by the hardware).
> 
> I'm confused.  Why is PVH using the PV CPUID policy instead of the HVM one?

On PVH guests info.hvm == false, so it falls into the PV cpuid policy.
I'm not sure however if this is intentional or not.

Roger.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] libxc: expand cpuid features exposed to PVH guests
  2014-07-28 17:39   ` Roger Pau Monné
@ 2014-07-29 14:15     ` George Dunlap
  0 siblings, 0 replies; 5+ messages in thread
From: George Dunlap @ 2014-07-29 14:15 UTC (permalink / raw)
  To: Roger Pau Monné
  Cc: xen-devel, Ian Campbell, Ian Jackson, David Vrabel, Andrew Cooper

On Mon, Jul 28, 2014 at 1:39 PM, Roger Pau Monné <roger.pau@citrix.com> wrote:
> On 28/07/14 16:19, David Vrabel wrote:
>> On 23/07/14 15:12, Roger Pau Monne wrote:
>>> Expand the cpuid features exposed to PVH guests, this includes
>>> exposing PSE, PGE and 1GB pages (which will be masked by the
>>> hypervisor if not supported by the hardware).
>>
>> I'm confused.  Why is PVH using the PV CPUID policy instead of the HVM one?
>
> On PVH guests info.hvm == false, so it falls into the PV cpuid policy.
> I'm not sure however if this is intentional or not.

The original idea was that PVH should be as close to PV as possible;
this was back when we were still hoping to have a "lightweight
container" rather than the full HVM stack.  Since "lightweight" isn't
actually that lightweight, we're sort of moving towards "PVH is HVM
without a device model".

 -George

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-07-29 14:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-23 14:12 [PATCH] libxc: expand cpuid features exposed to PVH guests Roger Pau Monne
2014-07-23 14:22 ` Andrew Cooper
2014-07-28 14:19 ` David Vrabel
2014-07-28 17:39   ` Roger Pau Monné
2014-07-29 14:15     ` George Dunlap

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).