WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-ia64-devel] [PATCH 3/3] IA64: add cpufreq support

Hi.

Two comments.
- It seems that tabs and spaces are mixed. Please follow Linux style.
  You also want to modify to use XENPF hypercall.

- Since drivers/acpi/Kconfig is common file, the hunk should 
  go to xen-devel after the ia64 part is merged to xen-unstable.hg

thanks,

On Sat, Sep 27, 2008 at 10:13:14AM +0800, Yu, Ke wrote:
> IA64: add ia64 cpufreq notify hypercall
> 
> This patch adds ia64 notify hypercall to pass cpufreq ACPI information to 
> hypervisor,
> and get cpufreq statistic data from hypervisor.
> 
> Signed-off-by: Yu Ke <ke.yu@xxxxxxxxx>
>                Liu Jinsong <jinsong.liu@xxxxxxxxx>

> IA64: add ia64 cpufreq notify hypercall
> 
> This patch adds ia64 notify hypercall to pass cpufreq ACPI information to 
> hypervisor, 
> and get cpufreq statistic data from hypervisor.
> 
> Signed-off-by: Yu Ke <ke.yu@xxxxxxxxx>
>                Liu Jinsong <jinsong.liu@xxxxxxxxx>
> 
> diff -r 2f32c16d5370 arch/ia64/kernel/Makefile
> --- a/arch/ia64/kernel/Makefile       Fri Sep 26 19:36:24 2008 +0800
> +++ b/arch/ia64/kernel/Makefile       Fri Sep 26 19:38:21 2008 +0800
> @@ -16,6 +16,9 @@
>  
>  ifneq ($(CONFIG_ACPI_PROCESSOR),)
>  obj-y                                += acpi-processor.o
> +ifneq ($(CONFIG_PROCESSOR_EXTERNAL_CONTROL),)
> +obj-$(CONFIG_XEN)            += processor_extcntl_xen.o
> +endif
>  endif
>  
>  obj-$(CONFIG_IA64_PALINFO)   += palinfo.o
> diff -r 2f32c16d5370 arch/ia64/kernel/processor_extcntl_xen.c
> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
> +++ b/arch/ia64/kernel/processor_extcntl_xen.c        Fri Sep 26 19:38:21 
> 2008 +0800
> @@ -0,0 +1,154 @@
> +/*
> + * processor_extcntl_xen.c - interface to notify Xen
> + *
> + *  Copyright (C) 2008, Intel corporation
> + *
> + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> + *
> + *  This program is free software; you can redistribute it and/or modify
> + *  it under the terms of the GNU General Public License as published by
> + *  the Free Software Foundation; either version 2 of the License, or (at
> + *  your option) any later version.
> + *
> + *  This program is distributed in the hope that it will be useful, but
> + *  WITHOUT ANY WARRANTY; without even the implied warranty of
> + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + *  General Public License for more details.
> + *
> + *  You should have received a copy of the GNU General Public License along
> + *  with this program; if not, write to the Free Software Foundation, Inc.,
> + *  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
> + *
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/init.h>
> +#include <linux/types.h>
> +#include <linux/acpi.h>
> +#include <linux/pm.h>
> +#include <linux/cpu.h>
> +#include <linux/cpufreq.h>
> +#include <acpi/processor.h>
> +#include <asm/hypercall.h>
> +#include <asm/xen/xencomm.h>
> +
> +static int xen_cx_notifier(struct acpi_processor *pr, int action)
> +{
> +     printk(KERN_WARNING "Cx is not supported yet\n");
> +
> +    return -EINVAL;
> +}
> +
> +static int xen_px_notifier(struct acpi_processor *pr, int action)
> +{
> +     int ret = -EINVAL;
> +    struct xenpf_set_processor_pminfo pminfo = {
> +        .id   = pr->acpi_id,
> +        .type = XEN_PM_PX,
> +    };
> +    struct xen_processor_performance *perf;
> +    struct xen_processor_px *states = NULL;
> +    struct acpi_processor_performance *px;
> +    struct acpi_psd_package *pdomain;
> +    struct xencomm_handle *desc,*states_desc;
> +
> +    if (!pr || !pr->performance)
> +        return -EINVAL;
> +
> +    perf = &pminfo.perf;
> +    px = pr->performance;
> +    desc = xencomm_map_no_alloc(&pminfo, sizeof(pminfo));
> +
> +    switch(action) {
> +
> +        case PROCESSOR_PM_CHANGE:
> +            /* ppc dynamic handle */
> +            pminfo.perf.flags = XEN_PX_PPC;
> +            pminfo.perf.platform_limit = pr->performance_platform_limit;
> +            ret =  HYPERVISOR_set_pm_info(desc);
> +            break;
> +
> +        case PROCESSOR_PM_INIT:
> +
> +            /* px normal init */
> +            perf->flags = XEN_PX_PPC | 
> +                XEN_PX_PCT | 
> +                XEN_PX_PSS | 
> +                XEN_PX_PSD;
> +
> +            /* ppc */
> +            perf->platform_limit = pr->performance_platform_limit;
> +
> +            /* pct */
> +            xen_convert_pct_reg(&perf->control_register, 
> &px->control_register);
> +            xen_convert_pct_reg(&perf->status_register, 
> &px->status_register);
> +
> +            /* pss */
> +            perf->state_count = px->state_count;
> +            states = 
> kzalloc(px->state_count*sizeof(xen_processor_px_t),GFP_KERNEL);
> +            if (!states){
> +                ret = -ENOMEM;
> +                break;
> +            }
> +            xen_convert_pss_states(states, px->states, px->state_count);
> +            set_xen_guest_handle(perf->states, states);
> +            states_desc = 
> xencomm_map_no_alloc(xen_guest_handle(perf->states),
> +                    sizeof(*xen_guest_handle(perf->states)));
> +            set_xen_guest_handle(perf->states, 
> (xen_processor_px_t*)states_desc);
> +
> +            /* psd */
> +            pdomain = &px->domain_info;
> +            xen_convert_psd_pack(&perf->domain_info, pdomain);
> +            if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ALL)
> +                perf->shared_type = CPUFREQ_SHARED_TYPE_ALL;
> +            else if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ANY)
> +                perf->shared_type = CPUFREQ_SHARED_TYPE_ANY;
> +            else if (pdomain->coord_type == DOMAIN_COORD_TYPE_HW_ALL)
> +                perf->shared_type = CPUFREQ_SHARED_TYPE_HW;
> +            else {
> +                ret = -ENODEV;
> +                kfree(states);
> +                break;
> +            }
> +
> +            ret =  HYPERVISOR_set_pm_info(desc);
> +            kfree(states);
> +            break;
> +
> +        default:
> +            ret = -EINVAL;
> +    }
> +
> +     return ret;
> +}
> +
> +static int xen_tx_notifier(struct acpi_processor *pr, int action)
> +{
> +     return -EINVAL;
> +}
> +static int xen_hotplug_notifier(struct acpi_processor *pr, int event)
> +{
> +     return -EINVAL;
> +}
> +
> +static struct processor_extcntl_ops xen_extcntl_ops = {
> +     .hotplug                = xen_hotplug_notifier,
> +};
> +
> +void arch_acpi_processor_init_extcntl(const struct processor_extcntl_ops 
> **ops)
> +{
> +     unsigned int pmbits = (xen_start_info->flags & SIF_PM_MASK) >> 8;
> +
> +    if (!pmbits)
> +        return;
> +
> +     if (pmbits & XEN_PROCESSOR_PM_CX)
> +             xen_extcntl_ops.pm_ops[PM_TYPE_IDLE] = xen_cx_notifier;
> +     if (pmbits & XEN_PROCESSOR_PM_PX)
> +             xen_extcntl_ops.pm_ops[PM_TYPE_PERF] = xen_px_notifier;
> +     if (pmbits & XEN_PROCESSOR_PM_TX)
> +             xen_extcntl_ops.pm_ops[PM_TYPE_THR] = xen_tx_notifier;
> +
> +     *ops = &xen_extcntl_ops;
> +}
> +EXPORT_SYMBOL(arch_acpi_processor_init_extcntl);
> diff -r 2f32c16d5370 arch/ia64/xen/xcom_privcmd.c
> --- a/arch/ia64/xen/xcom_privcmd.c    Fri Sep 26 19:36:24 2008 +0800
> +++ b/arch/ia64/xen/xcom_privcmd.c    Fri Sep 26 19:38:21 2008 +0800
> @@ -193,6 +193,33 @@
>               set_xen_guest_handle(kern_op.u.physinfo.cpu_to_node,
>                                    (void *)desc);
>               break;
> +
> +     case XEN_SYSCTL_get_pmstat:
> +             if (kern_op.u.get_pmstat.type == PMSTAT_get_pxstat) {
> +                     desc = xencomm_map(
> +                             
> xen_guest_handle(kern_op.u.get_pmstat.u.getpx.trans_pt),
> +                             kern_op.u.get_pmstat.u.getpx.total * 
> +                             kern_op.u.get_pmstat.u.getpx.total *
> +                             sizeof(uint64_t));
> +                     if 
> (xen_guest_handle(kern_op.u.get_pmstat.u.getpx.trans_pt) != NULL
> +                && kern_op.u.get_pmstat.u.getpx.total > 0 && desc == NULL)
> +                             return -ENOMEM;
> +
> +                     
> set_xen_guest_handle(kern_op.u.get_pmstat.u.getpx.trans_pt,
> +                                          (void *)desc);
> +
> +                     desc1 = xencomm_map(
> +                             
> xen_guest_handle(kern_op.u.get_pmstat.u.getpx.pt),
> +                             kern_op.u.get_pmstat.u.getpx.total * 
> sizeof(pm_px_val_t));
> +                     if (xen_guest_handle(kern_op.u.get_pmstat.u.getpx.pt) 
> != NULL &&
> +                         kern_op.u.get_pmstat.u.getpx.total > 0 && desc1 == 
> NULL)
> +                             return -ENOMEM;
> +
> +                     set_xen_guest_handle(kern_op.u.get_pmstat.u.getpx.pt,
> +                                          (void *)desc1);
> +             }
> +             break;
> +
>       default:
>               printk("%s: unknown sysctl cmd %d\n", __func__, kern_op.cmd);
>               return -ENOSYS;
> diff -r 2f32c16d5370 drivers/acpi/Kconfig
> --- a/drivers/acpi/Kconfig    Fri Sep 26 19:36:24 2008 +0800
> +++ b/drivers/acpi/Kconfig    Fri Sep 26 19:38:21 2008 +0800
> @@ -370,7 +370,7 @@
>  
>  config PROCESSOR_EXTERNAL_CONTROL
>       bool
> -     depends on X86 && XEN
> +     depends on (X86 || IA64) && XEN
>       default y
>  endif        # ACPI
>  
> diff -r 2f32c16d5370 include/asm-ia64/hypercall.h
> --- a/include/asm-ia64/hypercall.h    Fri Sep 26 19:36:24 2008 +0800
> +++ b/include/asm-ia64/hypercall.h    Fri Sep 26 19:38:21 2008 +0800
> @@ -427,6 +427,13 @@
>  }
>  
>  static inline int
> +HYPERVISOR_set_pm_info(struct xencomm_handle *pminfo)
> +{
> +    return _hypercall2(int, ia64_dom0vp_op, IA64_DOM0VP_set_pm_info,
> +                    pminfo);
> +}
> +
> +static inline int
>  xencomm_arch_hypercall_kexec_op(int cmd, struct xencomm_handle *arg)
>  {
>       return _hypercall2(int, kexec_op, cmd, arg);
> diff -r 2f32c16d5370 include/xen/interface/arch-ia64.h
> --- a/include/xen/interface/arch-ia64.h       Fri Sep 26 19:36:24 2008 +0800
> +++ b/include/xen/interface/arch-ia64.h       Fri Sep 26 19:38:21 2008 +0800
> @@ -453,6 +453,9 @@
>  /* unexpose the foreign domain's p2m table into privileged domain */
>  #define IA64_DOM0VP_unexpose_foreign_p2m        13
>  
> +/* pass power management info to hypervisor */
> +#define IA64_DOM0VP_set_pm_info         14
> +
>  // flags for page assignement to pseudo physical address space
>  #define _ASSIGN_readonly                0
>  #define ASSIGN_readonly                 (1UL << _ASSIGN_readonly)
> 


-- 
yamahata

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

<Prev in Thread] Current Thread [Next in Thread>