[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Xen-devel] [PATCH]ACPI: re-enable mwait for xen cpuidle



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.

Signed-off-by: Wei Gang <gang.wei@xxxxxxxxx>

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;

Attachment: re-enable-mwait_pv-ops-dom0-v2.1.patch
Description: re-enable-mwait_pv-ops-dom0-v2.1.patch

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.