On Thu, 9 Nov 2017, Oleksandr Tyshchenko wrote:
> From: Oleksandr Dmytryshyn <oleksandr.dmytrys...@globallogic.com>
> 
> ACPI-specific parts are moved under appropriate ifdefs.
> Now pmstat functions can be used in ARM platform.
> 
> This is a rebased version of the original patch:
> https://lists.xen.org/archives/html/xen-devel/2014-11/msg00941.html

My first maybe naive question is: why do we want to disable the C-states
and not the P-states? After all, they are both defined in ACPI?

The second question is: instead of #ifdef'ing everything C-states,
couldn't we just rely on XEN_PROCESSOR_PM_CX not being available?


> Signed-off-by: Oleksandr Dmytryshyn <oleksandr.dmytrys...@globallogic.com>
> Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshche...@epam.com>
> CC: Jan Beulich <jbeul...@suse.com>
> CC: Andrew Cooper <andrew.coop...@citrix.com>
> CC: Stefano Stabellini <sstabell...@kernel.org>
> CC: Julien Grall <julien.gr...@linaro.org>
> ---
>  xen/drivers/pm/stat.c    | 8 +++++++-
>  xen/include/xen/pmstat.h | 2 ++
>  2 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/xen/drivers/pm/stat.c b/xen/drivers/pm/stat.c
> index 133e64d..986ba41 100644
> --- a/xen/drivers/pm/stat.c
> +++ b/xen/drivers/pm/stat.c
> @@ -35,7 +35,6 @@
>  #include <asm/processor.h>
>  #include <xen/percpu.h>
>  #include <xen/domain.h>
> -#include <xen/acpi.h>
>  
>  #include <public/sysctl.h>
>  #include <xen/cpufreq.h>
> @@ -132,6 +131,8 @@ int do_get_pm_info(struct xen_sysctl_get_pmstat *op)
>          break;
>      }
>  
> +/* For now those operations can be used only when ACPI is enabled */
> +#ifdef CONFIG_ACPI
>      case PMSTAT_get_max_cx:
>      {
>          op->u.getcx.nr = pmstat_get_cx_nr(op->cpuid);
> @@ -150,6 +151,7 @@ int do_get_pm_info(struct xen_sysctl_get_pmstat *op)
>          ret = pmstat_reset_cx_stat(op->cpuid);
>          break;
>      }
> +#endif /* CONFIG_ACPI */
>  
>      default:
>          printk("not defined sub-hypercall @ do_get_pm_info\n");
> @@ -465,6 +467,7 @@ int do_pm_op(struct xen_sysctl_pm_op *op)
>          break;
>      }
>  
> +#ifdef CONFIG_ACPI
>      case XEN_SYSCTL_pm_op_get_max_cstate:
>      {
>          op->u.get_max_cstate = acpi_get_cstate_limit();
> @@ -476,6 +479,7 @@ int do_pm_op(struct xen_sysctl_pm_op *op)
>          acpi_set_cstate_limit(op->u.set_max_cstate);
>          break;
>      }
> +#endif /* CONFIG_ACPI */
>  
>  #ifdef CONFIG_HAS_CPU_TURBO
>      case XEN_SYSCTL_pm_op_enable_turbo:
> @@ -500,6 +504,7 @@ int do_pm_op(struct xen_sysctl_pm_op *op)
>      return ret;
>  }
>  
> +#ifdef CONFIG_ACPI
>  int acpi_set_pdc_bits(u32 acpi_id, XEN_GUEST_HANDLE_PARAM(uint32) pdc)
>  {
>      u32 bits[3];
> @@ -530,3 +535,4 @@ int acpi_set_pdc_bits(u32 acpi_id, 
> XEN_GUEST_HANDLE_PARAM(uint32) pdc)
>  
>      return ret;
>  }
> +#endif /* CONFIG_ACPI */
> diff --git a/xen/include/xen/pmstat.h b/xen/include/xen/pmstat.h
> index 266bc16..a870c8a 100644
> --- a/xen/include/xen/pmstat.h
> +++ b/xen/include/xen/pmstat.h
> @@ -6,10 +6,12 @@
>  #include <public/sysctl.h>   /* for struct pm_cx_stat */
>  
>  int set_px_pminfo(uint32_t cpu, struct xen_processor_performance *perf);
> +#ifdef CONFIG_ACPI
>  long set_cx_pminfo(uint32_t cpu, struct xen_processor_power *power);
>  uint32_t pmstat_get_cx_nr(uint32_t cpuid);
>  int pmstat_get_cx_stat(uint32_t cpuid, struct pm_cx_stat *stat);
>  int pmstat_reset_cx_stat(uint32_t cpuid);
> +#endif
>  
>  int do_get_pm_info(struct xen_sysctl_get_pmstat *op);
>  int do_pm_op(struct xen_sysctl_pm_op *op);
> -- 
> 2.7.4
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to