All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: "Wei, Gang" <gang.wei@intel.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	Keir Fraser <keir.fraser@eu.citrix.com>,
	"Yu, Ke" <ke.yu@intel.com>
Subject: Re: [PATCH]ACPI: re-enable mwait for xen cpuidle
Date: Fri, 02 Apr 2010 11:33:01 -0700	[thread overview]
Message-ID: <4BB6385D.4090404@goop.org> (raw)
In-Reply-To: <E6467867A6B05E4FA831B7DF29925F5C40E67A90@shzsmsx502.ccr.corp.intel.com>

On 04/02/2010 09:27 AM, Wei, Gang wrote:
> Updated the 2nd patch, only set MWAIT feature for dom0.
>
> Jimmy
>
> ACPI: re-enable mwait for xen cpuidle
>
> Xen hypervisor doesn't export mwait feature to dom0, but latest Linux kernel start to check this feature while initializing _PDC object. Modify xen_cpuid to re-enable mwait for xen cpuidle.
>    

What if the CPU really doesn't have MWAIT?

But I agree with your original assessment that setting MWAIT just to get 
a couple of paths in ACPI parsing enabled is probably overkill, but I 
don't like the idea of putting xen-specific tests into the acpi code.

Would it be possible to change the parser code to parse unconditionally 
and then ignore the MWAIT-specific stuff later on?  (I haven't looked at 
the structure of the code, so I'm not sure if this suggestion even makes 
sense.)

     J

> Signed-off-by: Wei Gang<gang.wei@intel.com>
>
> diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
> index c3e8bff..82f3826 100644
> --- a/arch/x86/xen/enlighten.c
> +++ b/arch/x86/xen/enlighten.c
> @@ -182,6 +182,9 @@ static void __init xen_banner(void)
>   static __read_mostly unsigned int cpuid_leaf1_edx_mask = ~0;
>   static __read_mostly unsigned int cpuid_leaf1_ecx_mask = ~0;
>   static __read_mostly unsigned int cpuid_leaf81_edx_mask = ~0;
> +static __read_mostly unsigned int cpuid_leaf1_ecx_set;
> +static __read_mostly unsigned int cpuid_leaf5_ecx_set;
> +static __read_mostly unsigned int cpuid_leaf5_edx_set;
>
>   static void xen_cpuid(unsigned int *ax, unsigned int *bx,
>   		      unsigned int *cx, unsigned int *dx)
> @@ -189,6 +192,8 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx,
>   	unsigned maskebx = ~0;
>   	unsigned maskecx = ~0;
>   	unsigned maskedx = ~0;
> +	unsigned setecx  =  0;
> +	unsigned setedx  =  0;
>
>   	/*
>   	 * Mask out inconvenient features, to try and disable as many
> @@ -198,6 +203,12 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx,
>   	case 0x1:
>   		maskecx = cpuid_leaf1_ecx_mask;
>   		maskedx = cpuid_leaf1_edx_mask;
> +		setecx  = cpuid_leaf1_ecx_set;
> +		break;
> +
> +	case 0x5: /* MWAIT INFO */
> +		setecx = cpuid_leaf5_ecx_set;
> +		setedx = cpuid_leaf5_edx_set;
>   		break;
>
>   	case 0xb:
> @@ -220,6 +231,8 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx,
>   	*bx&= maskebx;
>   	*cx&= maskecx;
>   	*dx&= maskedx;
> +	*cx |= setecx;
> +	*dx |= setedx;
>   }
>
>   static __init void xen_init_cpuid_mask(void)
> @@ -238,6 +251,11 @@ static __init void xen_init_cpuid_mask(void)
>   			  (1<<  X86_FEATURE_MCA)  |  /* disable MCA */
>   			  (1<<  X86_FEATURE_APIC) |  /* disable local APIC */
>   			  (1<<  X86_FEATURE_ACPI));  /* disable ACPI */
> +	else {
> +		cpuid_leaf1_ecx_set = 1<<  (X86_FEATURE_MWAIT % 32);
> +		cpuid_leaf5_ecx_set = 0x3; /* EXTENSIONS_SUPPORTED | INTERRUPT_BREAK */
> +		cpuid_leaf5_edx_set = ~0;
> +	}
>
>   	ax = 1;
>   	cx = 0;

  reply	other threads:[~2010-04-02 18:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-02  2:38 [PATCH]ACPI: re-enable mwait for xen cpuidle Wei, Gang
2010-04-02  5:40 ` Jeremy Fitzhardinge
2010-04-02  6:32   ` Wei, Gang
2010-04-02  9:34     ` Wei, Gang
2010-04-02 13:41       ` Wei, Gang
2010-04-02 14:27         ` Keir Fraser
2010-04-02 14:46           ` Keir Fraser
2010-04-02 15:18             ` Wei, Gang
2010-04-02 16:27       ` Wei, Gang
2010-04-02 18:33         ` Jeremy Fitzhardinge [this message]
2010-04-03 14:07           ` Wei, Gang
2010-04-05 18:30             ` Jeremy Fitzhardinge
2010-04-06  1:46               ` Wei, Gang

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=4BB6385D.4090404@goop.org \
    --to=jeremy@goop.org \
    --cc=gang.wei@intel.com \
    --cc=ke.yu@intel.com \
    --cc=keir.fraser@eu.citrix.com \
    --cc=xen-devel@lists.xensource.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.