Change Px control protection corresponding to changeset 18125 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 diff -r 377fa374db34 xen/arch/x86/acpi/cpufreq/utility.c --- a/xen/arch/x86/acpi/cpufreq/utility.c Tue Jul 29 08:34:58 2008 +0800 +++ b/xen/arch/x86/acpi/cpufreq/utility.c Tue Jul 29 10:09:39 2008 +0800 @@ -312,12 +312,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; } @@ -332,14 +331,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; diff -r 377fa374db34 xen/arch/x86/acpi/pmstat.c --- a/xen/arch/x86/acpi/pmstat.c Tue Jul 29 08:34:58 2008 +0800 +++ b/xen/arch/x86/acpi/pmstat.c Tue Jul 29 10:10:03 2008 +0800 @@ -52,9 +52,9 @@ int do_get_pm_info(struct xen_sysctl_get 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) ) diff -r 377fa374db34 xen/arch/x86/platform_hypercall.c --- a/xen/arch/x86/platform_hypercall.c Tue Jul 29 08:34:58 2008 +0800 +++ b/xen/arch/x86/platform_hypercall.c Tue Jul 29 10:07:51 2008 +0800 @@ -420,7 +420,7 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe 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() ) diff -r 377fa374db34 xen/include/acpi/cpufreq/processor_perf.h --- a/xen/include/acpi/cpufreq/processor_perf.h Tue Jul 29 08:34:58 2008 +0800 +++ b/xen/include/acpi/cpufreq/processor_perf.h Tue Jul 29 10:07:07 2008 +0800 @@ -3,6 +3,8 @@ #include #include + +#define XEN_PX_INIT 0x80000000 int get_cpu_id(u8); int acpi_cpufreq_init(void);