Change Px control protection corresponding to changeset 18125
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 29 Jul 2008 12:27:29 +0000 (13:27 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 29 Jul 2008 12:27:29 +0000 (13:27 +0100)
xen changeset 18125(ab1d7db3facb) changed some px init logic, which
has some effect to Px statistic and S3 suspend/resume logic.
This patch change Px control protection corresponding to changeset
18125.

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
xen/arch/x86/acpi/cpufreq/utility.c
xen/arch/x86/acpi/pmstat.c
xen/arch/x86/platform_hypercall.c
xen/include/acpi/cpufreq/processor_perf.h

index e34586e3b51a919f1a7ff4f9ba9b4ef9076706f0..787e91ceefcae4e498cdbf27dc763c8eb9e738bd 100644 (file)
@@ -296,12 +296,11 @@ void cpufreq_suspend(void)
 {
     int cpu;
 
-    /* to protect the case when Px was controlled by dom0-kernel */
-    /* or when CPU_FREQ not set in which case ACPI Px objects not parsed */
+    /* to protect the case when Px was not controlled by xen */
     for_each_online_cpu(cpu) {
         struct processor_performance *perf = &processor_pminfo[cpu].perf;
 
-        if (!perf->init)
+        if (!(perf->init & XEN_PX_INIT))
             return;
     }
 
@@ -316,14 +315,13 @@ int cpufreq_resume(void)
 {
     int cpu, ret = 0;
 
-    /* 1. to protect the case when Px was controlled by dom0-kernel */
-    /* or when CPU_FREQ not set in which case ACPI Px objects not parsed */
+    /* 1. to protect the case when Px was not controlled by xen */
     /* 2. set state and resume flag to sync cpu to right state and freq */
     for_each_online_cpu(cpu) {
         struct processor_performance *perf = &processor_pminfo[cpu].perf;
         struct cpufreq_policy *policy = &xen_px_policy[cpu];
 
-        if (!perf->init)
+        if (!(perf->init & XEN_PX_INIT))
             goto err;
         perf->state = 0;
         policy->resume = 1;
index cf14fc9d647f38717a3dca1ea12200b2e9fb3158..ec408a2333cc71db6a569b33f4f8ea4b784ebbfb 100644 (file)
@@ -52,9 +52,9 @@ int do_get_pm_info(struct xen_sysctl_get_pmstat *op)
     struct pm_px *pxpt = &px_statistic_data[op->cpuid];
     struct processor_pminfo *pmpt = &processor_pminfo[op->cpuid];
 
-    /* to protect the case when Px was controlled by dom0-kernel */
-    /* or when CPU_FREQ not set in which case ACPI Px objects not parsed */
-    if ( !pmpt->perf.init && (op->type & PMSTAT_CATEGORY_MASK) == PMSTAT_PX )
+    /* to protect the case when Px was not controlled by xen */
+    if ( (!(pmpt->perf.init & XEN_PX_INIT)) && 
+        (op->type & PMSTAT_CATEGORY_MASK) == PMSTAT_PX )
         return -EINVAL;
 
     if ( !cpu_online(op->cpuid) )
index 5a882c7057200376ea19dcf3015760ca5d87d4c3..b93dc71a239346a4d4520ff67f008df1b851be2d 100644 (file)
@@ -415,7 +415,7 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xen_platform_op_t) u_xenpf_op)
             if ( pxpt->init == ( XEN_PX_PCT | XEN_PX_PSS |
                                  XEN_PX_PSD | XEN_PX_PPC ) )
             {
-                pxpt->init |= 0x80000000;
+                pxpt->init |= XEN_PX_INIT;
                 cpu_count++;
             }
             if ( cpu_count == num_online_cpus() )
index 944aaf63b0f3fa96c9163ba5f7ac77994f58a5f8..f5251a553cd91a1c56f4918631db4d48397131a0 100644 (file)
@@ -4,6 +4,8 @@
 #include <public/platform.h>
 #include <public/sysctl.h>
 
+#define XEN_PX_INIT 0x80000000
+
 int get_cpu_id(u8);
 int acpi_cpufreq_init(void);
 int powernow_cpufreq_init(void);