On Sat, Sep 27, 2008 at 10:12:37AM +0800, Yu, Ke wrote:
> IA64: implement ia64 cpufreq notify hypercall
>
> This patch implement the ia64 cpufreq hypercall to get dom0 cpufreq ACPI info.
>
> Signed-off-by: Yu Ke <ke.yu@xxxxxxxxx>
> Liu Jinsong <jinsong.liu@xxxxxxxxx>
Hi, some comments below.
> IA64: implement ia64 cpufreq notify hypercall
>
> This patch implement the ia64 cpufreq hypercall to get dom0 cpufreq ACPI info.
>
> Signed-off-by: Yu Ke <ke.yu@xxxxxxxxx>
> Liu Jinsong <jinsong.liu@xxxxxxxxx>
>
> diff -r ac0516cfe654 xen/arch/ia64/linux-xen/acpi.c
> --- a/xen/arch/ia64/linux-xen/acpi.c Fri Sep 26 19:44:23 2008 +0800
> +++ b/xen/arch/ia64/linux-xen/acpi.c Fri Sep 26 19:44:53 2008 +0800
> @@ -219,6 +219,10 @@
> return 0;
> }
>
> +#ifdef XEN
> +extern u16 ia64_acpiid_to_sapicid[];
> +#endif
> +
Please don't insert delcartions into .c file.
Please declare it in header file.
> static int __init
> acpi_parse_lsapic(struct acpi_subtable_header * header, const unsigned long
> end)
> {
> @@ -232,6 +236,10 @@
> #ifdef CONFIG_SMP
> smp_boot_data.cpu_phys_id[available_cpus] =
> (lsapic->id << 8) | lsapic->eid;
> +#endif
> +#ifdef XEN
> + ia64_acpiid_to_sapicid[lsapic->processor_id] =
> + (lsapic->id << 8) | lsapic->eid;
> #endif
> ++available_cpus;
> }
> diff -r ac0516cfe654 xen/arch/ia64/xen/cpufreq/cpufreq.c
> --- a/xen/arch/ia64/xen/cpufreq/cpufreq.c Fri Sep 26 19:44:23 2008 +0800
> +++ b/xen/arch/ia64/xen/cpufreq/cpufreq.c Fri Sep 26 19:44:53 2008 +0800
> @@ -300,4 +300,34 @@
>
> return ret;
> }
> +
> +#define MAX_LOCAL_SAPIC 255
> +u16 ia64_acpiid_to_sapicid[ MAX_LOCAL_SAPIC ] =
> + {[0 ... MAX_LOCAL_SAPIC - 1] = 0xffff };
> +
> +/* acpiid to cpuid */
> +int get_cpu_id(u8 acpi_id)
> +{
> + int i;
> + u16 apic_id;
> +
> + apic_id = ia64_acpiid_to_sapicid[acpi_id];
> + if ( apic_id == 0xffff )
> + return -EINVAL;
> +
> + for ( i = 0; i < NR_CPUS; i++ )
> + {
> + if ( apic_id == ia64_cpu_to_sapicid[i]
> + )
> + return i;
> + }
> +
> + return -1;
> +}
> +
> __initcall(cpufreq_driver_init);
> +
> +int cpufreq_cpu_init(unsigned int cpuid)
> +{
> + return cpufreq_add_cpu(cpuid);
> +}
Please Linux style, not 4 tab.
> diff -r ac0516cfe654 xen/arch/ia64/xen/dom0_ops.c
> --- a/xen/arch/ia64/xen/dom0_ops.c Fri Sep 26 19:44:23 2008 +0800
> +++ b/xen/arch/ia64/xen/dom0_ops.c Fri Sep 26 19:44:53 2008 +0800
> @@ -14,6 +14,7 @@
> #include <public/sysctl.h>
> #include <xen/sched.h>
> #include <xen/event.h>
> +#include <xen/domain.h>
> #include <asm/pdb.h>
> #include <xen/trace.h>
> #include <xen/console.h>
> @@ -28,10 +29,21 @@
> #include <asm/hvm/support.h>
> #include <xsm/xsm.h>
> #include <public/hvm/save.h>
> +#include <public/platform.h>
> +#include <acpi/cpufreq/cpufreq.h>
>
> #define get_xen_guest_handle(val, hnd) do { val = (hnd).p; } while (0)
>
> extern unsigned long total_pages;
> +
> +int xenpf_copy_px_states(struct processor_performance *pxpt,
> + struct xen_processor_performance *dom0_px_info)
> +{
> + if (!pxpt || !dom0_px_info)
> + return -EINVAL;
> + return copy_from_guest(pxpt->states, dom0_px_info->states,
> + dom0_px_info->state_count);
> +}
>
> long arch_do_domctl(xen_domctl_t *op, XEN_GUEST_HANDLE(xen_domctl_t)
> u_domctl)
> {
> @@ -597,6 +609,40 @@
> case IA64_DOM0VP_unexpose_foreign_p2m:
> ret = dom0vp_unexpose_foreign_p2m(d, arg0, arg1);
> break;
> +
> + case IA64_DOM0VP_set_pm_info: {
> + XEN_GUEST_HANDLE(xenpf_set_processor_pminfo_t) hnd;
> + struct xenpf_set_processor_pminfo pminfo;
> + extern int set_px_pminfo(uint32_t cpuid, struct
> + xen_processor_performance *perf);
> +
> + set_xen_guest_handle(hnd, (xenpf_set_processor_pminfo_t*)arg0);
> + if (copy_from_guest(&pminfo, hnd, 1)){
> + return -EFAULT;
> + }
> +
> + switch (pminfo.type)
> + {
> + case XEN_PM_PX:
> + if ( !(xen_processor_pmbits & XEN_PROCESSOR_PM_PX) )
> + {
> + ret = -ENOSYS;
> + break;
> + }
> + ret = set_px_pminfo(pminfo.id, &pminfo.perf);
> + break;
> + case XEN_PM_CX:
> + /* Place holder for Cx */
> + ret = -ENOSYS;
> + break;
> + default:
> + ret = -EINVAL;
> + break;
> + }
> +
> + break;
> + }
> +
> default:
> ret = -1;
> printk("unknown dom0_vp_op 0x%lx\n", cmd);
Hmm, why not use XENPF_set_processor_pminfo.
Ah, I guess you did this because Xen/IA64 doesn't define do_platform_op().
So please define do_platform_op() in xen/arch/ia64/xen/platform_hypercall.c
following the x86 way.
And update ia64_hypercall_table in xen/arch/ia64/linux-xen/entry.S.
You also have to update the next patch for Linux.
> diff -r ac0516cfe654 xen/arch/ia64/xen/domain.c
> --- a/xen/arch/ia64/xen/domain.c Fri Sep 26 19:44:23 2008 +0800
> +++ b/xen/arch/ia64/xen/domain.c Fri Sep 26 19:44:53 2008 +0800
> @@ -2160,6 +2160,7 @@
> snprintf(si->magic, sizeof(si->magic), "xen-3.0-ia64");
> si->nr_pages = max_pages;
> si->flags = SIF_INITDOMAIN|SIF_PRIVILEGED;
> + si->flags |= (xen_processor_pmbits << 8) & SIF_PM_MASK;
>
> printk("Dom0: 0x%lx\n", (u64)dom0);
>
not space, but tab.
> diff -r ac0516cfe654 xen/include/public/arch-ia64.h
> --- a/xen/include/public/arch-ia64.h Fri Sep 26 19:44:23 2008 +0800
> +++ b/xen/include/public/arch-ia64.h Fri Sep 26 19:44:53 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-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|