From cd5ea6b4cd9891e99c54fbcfe1f491ad4e575d43 Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk Date: Thu, 23 Feb 2012 23:26:17 -0500 Subject: [PATCH] Revert "Merge branch 'stable/acpi-cpufreq.v3.rebased' into uek2-merge" This reverts commit 3acb13af318b052c429430359fec3871b5ad2800, reversing changes made to c1c344a8ba3c301fe799bfe82ac384e2a18b83e4. Instead we will use the one that is going upstream. --- drivers/acpi/Makefile | 1 - drivers/acpi/processor_driver.c | 61 +++---- drivers/acpi/processor_idle.c | 6 +- drivers/acpi/processor_perflib.c | 6 +- drivers/acpi/processor_xen.c | 245 ---------------------------- drivers/xen/Kconfig | 5 - drivers/xen/Makefile | 3 - drivers/xen/acpi_processor.c | 268 ------------------------------- include/acpi/processor.h | 17 +- include/xen/acpi.h | 104 ------------ 10 files changed, 28 insertions(+), 688 deletions(-) delete mode 100644 drivers/acpi/processor_xen.c delete mode 100644 drivers/xen/acpi_processor.c delete mode 100644 include/xen/acpi.h diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index 1f39861fb2fc..ecb26b4f29a0 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile @@ -66,7 +66,6 @@ obj-$(CONFIG_ACPI_CUSTOM_METHOD)+= custom_method.o # processor has its own "processor." module_param namespace processor-y := processor_driver.o processor_throttling.o processor-y += processor_idle.o processor_thermal.o -processor-y += processor_xen.o processor-$(CONFIG_CPU_FREQ) += processor_perflib.o obj-$(CONFIG_ACPI_PROCESSOR_AGGREGATOR) += acpi_pad.o diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c index 8a367d7d4b08..a4e0f1ba6040 100644 --- a/drivers/acpi/processor_driver.c +++ b/drivers/acpi/processor_driver.c @@ -79,6 +79,9 @@ MODULE_AUTHOR("Paul Diefenbaugh"); MODULE_DESCRIPTION("ACPI Processor Driver"); MODULE_LICENSE("GPL"); +static int acpi_processor_add(struct acpi_device *device); +static int acpi_processor_remove(struct acpi_device *device, int type); +static void acpi_processor_notify(struct acpi_device *device, u32 event); static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu); static int acpi_processor_handle_eject(struct acpi_processor *pr); @@ -90,11 +93,6 @@ static const struct acpi_device_id processor_device_ids[] = { }; MODULE_DEVICE_TABLE(acpi, processor_device_ids); -int (*__acpi_processor_register_driver)(void) = acpi_processor_register_driver; -void (*__acpi_processor_unregister_driver)(void) \ - = acpi_processor_unregister_driver; - - static struct acpi_driver acpi_processor_driver = { .name = "processor", .class = ACPI_PROCESSOR_CLASS, @@ -380,7 +378,7 @@ static int acpi_processor_get_info(struct acpi_device *device) static DEFINE_PER_CPU(void *, processor_device_array); -void acpi_processor_notify(struct acpi_device *device, u32 event) +static void acpi_processor_notify(struct acpi_device *device, u32 event) { struct acpi_processor *pr = acpi_driver_data(device); int saved; @@ -444,7 +442,7 @@ static struct notifier_block acpi_cpu_notifier = .notifier_call = acpi_cpu_soft_notify, }; -int __cpuinit acpi_processor_add(struct acpi_device *device) +static int __cpuinit acpi_processor_add(struct acpi_device *device) { struct acpi_processor *pr = NULL; int result = 0; @@ -548,7 +546,7 @@ err_free_cpumask: return result; } -int acpi_processor_remove(struct acpi_device *device, int type) +static int acpi_processor_remove(struct acpi_device *device, int type) { struct acpi_processor *pr = NULL; @@ -761,6 +759,7 @@ static int acpi_processor_handle_eject(struct acpi_processor *pr) } #endif +static void acpi_processor_install_hotplug_notify(void) { #ifdef CONFIG_ACPI_HOTPLUG_CPU @@ -773,6 +772,7 @@ void acpi_processor_install_hotplug_notify(void) register_hotcpu_notifier(&acpi_cpu_notifier); } +static void acpi_processor_uninstall_hotplug_notify(void) { #ifdef CONFIG_ACPI_HOTPLUG_CPU @@ -785,29 +785,6 @@ void acpi_processor_uninstall_hotplug_notify(void) unregister_hotcpu_notifier(&acpi_cpu_notifier); } -int acpi_processor_register_driver(void) -{ - int result = 0; - if (!cpuidle_register_driver(&acpi_idle_driver)) { - printk(KERN_DEBUG "ACPI: %s registered with cpuidle\n", - acpi_idle_driver.name); - } else { - printk(KERN_DEBUG "ACPI: acpi_idle yielding to %s\n", - cpuidle_get_driver()->name); - } - - result = acpi_bus_register_driver(&acpi_processor_driver); - return result; -} - -void acpi_processor_unregister_driver(void) -{ - acpi_bus_unregister_driver(&acpi_processor_driver); - - cpuidle_unregister_driver(&acpi_idle_driver); - - return; -} /* * We keep the driver loaded even when ACPI is not running. * This is needed for the powernow-k8 driver, that works even without @@ -823,14 +800,18 @@ static int __init acpi_processor_init(void) memset(&errata, 0, sizeof(errata)); - xen_processor_driver_register(); - - if (__acpi_processor_register_driver) { - result = __acpi_processor_register_driver(); - if (result < 0) - goto out_cpuidle; + if (!cpuidle_register_driver(&acpi_idle_driver)) { + printk(KERN_DEBUG "ACPI: %s registered with cpuidle\n", + acpi_idle_driver.name); + } else { + printk(KERN_DEBUG "ACPI: acpi_idle yielding to %s\n", + cpuidle_get_driver()->name); } + result = acpi_bus_register_driver(&acpi_processor_driver); + if (result < 0) + goto out_cpuidle; + acpi_processor_install_hotplug_notify(); acpi_thermal_cpufreq_init(); @@ -847,7 +828,6 @@ out_cpuidle: return result; } - static void __exit acpi_processor_exit(void) { if (acpi_disabled) @@ -859,8 +839,9 @@ static void __exit acpi_processor_exit(void) acpi_processor_uninstall_hotplug_notify(); - if (__acpi_processor_unregister_driver) - __acpi_processor_unregister_driver(); + acpi_bus_unregister_driver(&acpi_processor_driver); + + cpuidle_unregister_driver(&acpi_idle_driver); return; } diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index f5250b2092af..431ab11c8c1b 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -427,7 +427,7 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) if (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO && (reg->space_id != ACPI_ADR_SPACE_FIXED_HARDWARE)) continue; - memcpy(&(cx.reg), reg, sizeof(*reg)); + /* There should be an easy way to extract an integer... */ obj = &(element->package.elements[1]); if (obj->type != ACPI_TYPE_INTEGER) @@ -1077,7 +1077,7 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr) cpuidle_pause_and_lock(); cpuidle_disable_device(&pr->power.dev); acpi_processor_get_power_info(pr); - if (pr->flags.power && (cpuidle_get_driver() == &acpi_idle_driver)) { + if (pr->flags.power) { acpi_processor_setup_cpuidle(pr); ret = cpuidle_enable_device(&pr->power.dev); } @@ -1125,7 +1125,7 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr, * Note that we use previously set idle handler will be used on * platforms that only support C1. */ - if (pr->flags.power && (cpuidle_get_driver() == &acpi_idle_driver)) { + if (pr->flags.power) { acpi_processor_setup_cpuidle(pr); if (cpuidle_register_device(&pr->power.dev)) return -EIO; diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index e622a0d8f677..85b32376dad7 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c @@ -65,7 +65,7 @@ static DEFINE_MUTEX(performance_mutex); * 0 -> cpufreq low level drivers initialized -> consider _PPC values * 1 -> ignore _PPC totally -> forced by user through boot param */ -int ignore_ppc = -1; +static int ignore_ppc = -1; module_param(ignore_ppc, int, 0644); MODULE_PARM_DESC(ignore_ppc, "If the frequency of your machine gets wrongly" \ "limited by BIOS, this should help"); @@ -386,7 +386,7 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr) return result; } -int acpi_processor_get_performance_info(struct acpi_processor *pr) +static int acpi_processor_get_performance_info(struct acpi_processor *pr) { int result = 0; acpi_status status = AE_OK; @@ -492,7 +492,7 @@ int acpi_processor_notify_smm(struct module *calling_module) EXPORT_SYMBOL(acpi_processor_notify_smm); -int acpi_processor_get_psd(struct acpi_processor *pr) +static int acpi_processor_get_psd(struct acpi_processor *pr) { int result = 0; acpi_status status = AE_OK; diff --git a/drivers/acpi/processor_xen.c b/drivers/acpi/processor_xen.c deleted file mode 100644 index 029e10ca6990..000000000000 --- a/drivers/acpi/processor_xen.c +++ /dev/null @@ -1,245 +0,0 @@ -/* - * processor_xen.c - ACPI Processor Driver for xen - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * - * 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. - * - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - */ - -#include -#include -#include - -#define PREFIX "ACPI: " - -#define ACPI_PROCESSOR_CLASS "processor" -#define ACPI_PROCESSOR_NOTIFY_PERFORMANCE 0x80 -#define ACPI_PROCESSOR_NOTIFY_POWER 0x81 -#define ACPI_PROCESSOR_NOTIFY_THROTTLING 0x82 - -#define _COMPONENT ACPI_PROCESSOR_COMPONENT -ACPI_MODULE_NAME("processor_xen"); - -#if defined(CONFIG_ACPI_PROCESSOR_XEN) || \ -defined(CONFIG_ACPI_PROCESSOR_XEN_MODULE) -static const struct acpi_device_id processor_device_ids[] = { - {ACPI_PROCESSOR_OBJECT_HID, 0}, - {"ACPI0007", 0}, - {"", 0}, -}; - -static int xen_acpi_processor_add(struct acpi_device *device); -static void xen_acpi_processor_notify(struct acpi_device *device, u32 event); - -struct acpi_driver xen_acpi_processor_driver = { - .name = "processor", - .class = ACPI_PROCESSOR_CLASS, - .ids = processor_device_ids, - .ops = { - .add = xen_acpi_processor_add, - .remove = acpi_processor_remove, - .suspend = acpi_processor_suspend, - .resume = acpi_processor_resume, - .notify = xen_acpi_processor_notify, - }, -}; - -#ifdef CONFIG_CPU_FREQ -/* - * Existing ACPI module does parse performance states at some point, - * when acpi-cpufreq driver is loaded which however is something - * we'd like to disable to avoid confliction with xen PM - * logic. So we have to collect raw performance information here - * when ACPI processor object is found and started. - */ -static int xen_acpi_processor_get_performance(struct acpi_processor *pr) -{ - int ret; - struct acpi_processor_performance *perf; - struct acpi_psd_package *pdomain; - - if (pr->performance) - return -EBUSY; - - perf = kzalloc(sizeof(struct acpi_processor_performance), GFP_KERNEL); - if (!perf) - return -ENOMEM; - - pr->performance = perf; - /* Get basic performance state information */ - ret = acpi_processor_get_performance_info(pr); - if (ret < 0) - goto err_out; - - /* invoke raw psd parse interface directly, as it's useless to - * construct a shared map around dom0's vcpu ID. - */ - pdomain = &pr->performance->domain_info; - pdomain->num_processors = 0; - ret = acpi_processor_get_psd(pr); - if (ret < 0) { - /* - * _PSD is optional - assume no coordination if absent (or - * broken), matching native kernels' behavior. - */ - pdomain->num_entries = ACPI_PSD_REV0_ENTRIES; - pdomain->revision = ACPI_PSD_REV0_REVISION; - pdomain->domain = pr->acpi_id; - pdomain->coord_type = DOMAIN_COORD_TYPE_SW_ALL; - pdomain->num_processors = 1; - } - - processor_cntl_xen_notify(pr, PROCESSOR_PM_INIT, PM_TYPE_PERF); - - /* Last step is to notify BIOS that xen exists */ - acpi_processor_notify_smm(THIS_MODULE); - - return 0; -err_out: - pr->performance = NULL; - kfree(perf); - return ret; -} -#endif /* CONFIG_CPU_FREQ */ - -static int __cpuinit xen_acpi_processor_add(struct acpi_device *device) -{ - struct acpi_processor *pr = NULL; - int result = 0; - - result = acpi_processor_add(device); - if (result < 0) - return result; - - pr = acpi_driver_data(device); - if (!pr) - return -EINVAL; - - if (pr->id == -1) { - int device_declaration; - int apic_id = -1; - - if (!strcmp(acpi_device_hid(device), ACPI_PROCESSOR_OBJECT_HID)) - device_declaration = 0; - else - device_declaration = 1; - - apic_id = acpi_get_cpuid(pr->handle, - device_declaration, pr->acpi_id); - if (apic_id == -1) { - /* Processor is not present in MADT table */ - return 0; - } - - /* - * It's possible to have pr->id as '-1' even when it's actually - * present in MADT table, e.g. due to limiting dom0 max vcpus - * less than physical present number. In such case we still want - * to parse ACPI processor object information, so mimic the - * pr->id to CPU-0. This should be safe because we only care - * about raw ACPI information, which only relies on pr->acpi_id. - * For other information relying on pr->id and gathered through - * SMP function call, it's safe to let them run on CPU-0 since - * underlying Xen will collect them. Only a valid pr->id can - * make later invocations forward progress. - */ - pr->id = 0; - } - - if (likely(!pr->flags.power_setup_done)) { - /* reset idle boot option which we don't care */ - boot_option_idle_override = IDLE_NO_OVERRIDE; - acpi_processor_power_init(pr, device); - /* set to IDLE_HALT for trapping into Xen */ - boot_option_idle_override = IDLE_HALT; - - if (pr->flags.power) - processor_cntl_xen_notify(pr, - PROCESSOR_PM_INIT, PM_TYPE_IDLE); - } - -#ifdef CONFIG_CPU_FREQ - if (likely(!pr->performance)) - xen_acpi_processor_get_performance(pr); -#endif - - return 0; -} - -static void xen_acpi_processor_notify(struct acpi_device *device, u32 event) -{ - struct acpi_processor *pr = acpi_driver_data(device); - - if (!pr) - return; - - acpi_processor_notify(device, event); - - switch (event) { - case ACPI_PROCESSOR_NOTIFY_PERFORMANCE: -#ifdef CONFIG_CPU_FREQ - processor_cntl_xen_notify(pr, - PROCESSOR_PM_CHANGE, PM_TYPE_PERF); -#endif - break; - case ACPI_PROCESSOR_NOTIFY_POWER: - processor_cntl_xen_notify(pr, - PROCESSOR_PM_CHANGE, PM_TYPE_IDLE); - break; - default: - break; - } - - return; -} - -/* init and exit */ - -/* we don't install acpi cpuidle driver because dom0 itself is running - * as a guest which has no knowledge whether underlying is actually idle - */ -int xen_acpi_processor_init(void) -{ - int result = 0; - - result = acpi_bus_register_driver(&xen_acpi_processor_driver); - if (result < 0) - return result; - /* mark ready for handling ppc */ - ignore_ppc = 0; - - return 0; -} - -void xen_acpi_processor_exit(void) -{ - ignore_ppc = -1; - - acpi_bus_unregister_driver(&xen_acpi_processor_driver); -} -#endif - -#if defined(CONFIG_ACPI_PROCESSOR_XEN) || \ -defined(CONFIG_ACPI_PROCESSOR_XEN_MODULE) -void xen_processor_driver_register(void) -{ - if (xen_initial_domain()) { - __acpi_processor_register_driver = xen_acpi_processor_init; - __acpi_processor_unregister_driver = xen_acpi_processor_exit; - } -} -#else -void xen_processor_driver_register(void) -{ -} -#endif diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig index 21369b0e43c2..985041c7d359 100644 --- a/drivers/xen/Kconfig +++ b/drivers/xen/Kconfig @@ -118,11 +118,6 @@ config XEN_SYS_HYPERVISOR virtual environment, /sys/hypervisor will still be present, but will have no xen contents. -config ACPI_PROCESSOR_XEN - tristate - depends on XEN_DOM0 && ACPI_PROCESSOR && CPU_FREQ - default m - config XEN_XENBUS_FRONTEND tristate diff --git a/drivers/xen/Makefile b/drivers/xen/Makefile index 7ef71de53823..48beb1d49fa4 100644 --- a/drivers/xen/Makefile +++ b/drivers/xen/Makefile @@ -20,9 +20,6 @@ obj-$(CONFIG_SWIOTLB_XEN) += swiotlb-xen.o obj-$(CONFIG_XEN_DOM0) += pci.o obj-$(CONFIG_XEN_PRIVCMD) += xen-privcmd.o obj-$(CONFIG_XEN_PCIDEV_BACKEND) += xen-pciback/ -ifdef CONFIG_ACPI_PROCESSOR_XEN -obj-$(CONFIG_ACPI_PROCESSOR) += acpi_processor.o -endif xen-evtchn-y := evtchn.o xen-gntdev-y := gntdev.o diff --git a/drivers/xen/acpi_processor.c b/drivers/xen/acpi_processor.c deleted file mode 100644 index 327a56efb5e6..000000000000 --- a/drivers/xen/acpi_processor.c +++ /dev/null @@ -1,268 +0,0 @@ -/* - * acpi_processor.c - interface to notify Xen on acpi processor object - * info parsing - * - * 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. - * - */ - -#include -#include -#include -#include - -#include -#include -#include - -static struct processor_cntl_xen_ops xen_ops; -int processor_cntl_xen_notify(struct acpi_processor *pr, int event, int type) -{ - int ret = -EINVAL; - - switch (event) { - case PROCESSOR_PM_INIT: - case PROCESSOR_PM_CHANGE: - if ((type >= PM_TYPE_MAX) || - !xen_ops.pm_ops[type]) - break; - - ret = xen_ops.pm_ops[type](pr, event); - break; - default: - printk(KERN_ERR "Unsupport processor events %d.\n", event); - break; - } - - return ret; -} -EXPORT_SYMBOL(processor_cntl_xen_notify); - -static inline void xen_convert_pct_reg(struct xen_pct_register *xpct, - struct acpi_pct_register *apct) -{ - xpct->descriptor = apct->descriptor; - xpct->length = apct->length; - xpct->space_id = apct->space_id; - xpct->bit_width = apct->bit_width; - xpct->bit_offset = apct->bit_offset; - xpct->reserved = apct->reserved; - xpct->address = apct->address; -} - -static inline void xen_convert_pss_states(struct xen_processor_px *xpss, - struct acpi_processor_px *apss, int state_count) -{ - int i; - for (i = 0; i < state_count; i++) { - xpss->core_frequency = apss->core_frequency; - xpss->power = apss->power; - xpss->transition_latency = apss->transition_latency; - xpss->bus_master_latency = apss->bus_master_latency; - xpss->control = apss->control; - xpss->status = apss->status; - xpss++; - apss++; - } -} - -static inline void xen_convert_psd_pack(struct xen_psd_package *xpsd, - struct acpi_psd_package *apsd) -{ - xpsd->num_entries = apsd->num_entries; - xpsd->revision = apsd->revision; - xpsd->domain = apsd->domain; - xpsd->coord_type = apsd->coord_type; - xpsd->num_processors = apsd->num_processors; -} - -static int xen_cx_notifier(struct acpi_processor *pr, int action) -{ - int ret, count = 0, i; - struct xen_platform_op op = { - .cmd = XENPF_set_processor_pminfo, - .interface_version = XENPF_INTERFACE_VERSION, - .u.set_pminfo.id = pr->acpi_id, - .u.set_pminfo.type = XEN_PM_CX, - }; - struct xen_processor_cx *data, *buf; - struct acpi_processor_cx *cx; - struct acpi_power_register *reg; - - if (action == PROCESSOR_PM_CHANGE) - return -EINVAL; - - /* Convert to Xen defined structure and hypercall */ - buf = kzalloc(pr->power.count * sizeof(struct xen_processor_cx)\ - , GFP_KERNEL); - if (!buf) - return -ENOMEM; - - data = buf; - for (i = 1; i <= pr->power.count; i++) { - cx = &pr->power.states[i]; - reg = &cx->reg; - /* Skip invalid cstate entry */ - if (!cx->valid) - continue; - - data->type = cx->type; - data->latency = cx->latency; - data->power = cx->power; - data->reg.space_id = reg->space_id; - data->reg.bit_width = reg->bit_width; - data->reg.bit_offset = reg->bit_offset; - data->reg.access_size = reg->access_size; - data->reg.address = reg->address; - - /* Get dependency relationships, _CSD is not supported yet */ - data->dpcnt = 0; - set_xen_guest_handle(data->dp, NULL); - - data++; - count++; - } - - if (!count) { - printk(KERN_ERR "No available Cx info for cpu %d\n", - pr->acpi_id); - kfree(buf); - return -EINVAL; - } - - op.u.set_pminfo.power.count = count; - op.u.set_pminfo.power.flags.bm_control = pr->flags.bm_control; - op.u.set_pminfo.power.flags.bm_check = pr->flags.bm_check; - op.u.set_pminfo.power.flags.has_cst = pr->flags.has_cst; - op.u.set_pminfo.power.flags.power_setup_done = - pr->flags.power_setup_done; - - set_xen_guest_handle(op.u.set_pminfo.power.states, buf); - ret = HYPERVISOR_dom0_op(&op); - kfree(buf); - return ret; -} - -static int xen_px_notifier(struct acpi_processor *pr, int action) -{ - int ret = -EINVAL; - struct xen_platform_op op = { - .cmd = XENPF_set_processor_pminfo, - .interface_version = XENPF_INTERFACE_VERSION, - .u.set_pminfo.id = pr->acpi_id, - .u.set_pminfo.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; - - if (!pr) - return -EINVAL; - - perf = &op.u.set_pminfo.perf; - px = pr->performance; - - switch (action) { - case PROCESSOR_PM_CHANGE: - /* ppc dynamic handle */ - perf->flags = XEN_PX_PPC; - perf->platform_limit = pr->performance_platform_limit; - - ret = HYPERVISOR_dom0_op(&op); - 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(struct xen_processor_px), GFP_KERNEL); - if (!states) - return -ENOMEM; - xen_convert_pss_states(states, px->states, px->state_count); - set_xen_guest_handle(perf->states, states); - - /* psd */ - pdomain = &px->domain_info; - /* Some sanity check */ - if ((pdomain->revision != ACPI_PSD_REV0_REVISION) || - (pdomain->num_entries != ACPI_PSD_REV0_ENTRIES) || - ((pdomain->coord_type != DOMAIN_COORD_TYPE_SW_ALL) && - (pdomain->coord_type != DOMAIN_COORD_TYPE_SW_ANY) && - (pdomain->coord_type != DOMAIN_COORD_TYPE_HW_ALL))) { - ret = -EINVAL; - kfree(states); - break; - } - - 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 = -EINVAL; - kfree(states); - break; - } - - ret = HYPERVISOR_dom0_op(&op); - kfree(states); - break; - - default: - break; - } - - return ret; -} - -static int __init xen_acpi_processor_extcntl_init(void) -{ - unsigned int pmbits; - - /* Only xen dom0 is allowed to handle ACPI processor info */ - if (!xen_initial_domain()) - return 0; - - pmbits = (xen_start_info->flags & SIF_PM_MASK) >> 8; - - if (pmbits & XEN_PROCESSOR_PM_CX) - xen_ops.pm_ops[PM_TYPE_IDLE] = xen_cx_notifier; - if (pmbits & XEN_PROCESSOR_PM_PX) - xen_ops.pm_ops[PM_TYPE_PERF] = xen_px_notifier; - - return 0; -} - -subsys_initcall(xen_acpi_processor_extcntl_init); -MODULE_LICENSE("GPL"); diff --git a/include/acpi/processor.h b/include/acpi/processor.h index 2ec18f700de4..ba4928cae473 100644 --- a/include/acpi/processor.h +++ b/include/acpi/processor.h @@ -65,7 +65,6 @@ struct acpi_processor_cx { u64 time; u8 bm_sts_skip; char desc[ACPI_CX_DESC_LEN]; - struct acpi_power_register reg; }; struct acpi_processor_power { @@ -240,13 +239,6 @@ extern void acpi_processor_unregister_performance(struct if a _PPC object exists, rmmod is disallowed then */ int acpi_processor_notify_smm(struct module *calling_module); -void acpi_processor_install_hotplug_notify(void); -void acpi_processor_uninstall_hotplug_notify(void); -int acpi_processor_register_driver(void); -void acpi_processor_unregister_driver(void); -int acpi_processor_add(struct acpi_device *device); -int acpi_processor_remove(struct acpi_device *device, int type); -void acpi_processor_notify(struct acpi_device *device, u32 event); /* for communication between multiple parts of the processor kernel module */ DECLARE_PER_CPU(struct acpi_processor *, processors); extern struct acpi_processor_errata errata; @@ -280,20 +272,13 @@ static inline void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx } #endif -/* in processor_xen.c */ -extern void xen_processor_driver_register(void); - - /* in processor_perflib.c */ #ifdef CONFIG_CPU_FREQ -extern int ignore_ppc; void acpi_processor_ppc_init(void); void acpi_processor_ppc_exit(void); int acpi_processor_ppc_has_changed(struct acpi_processor *pr, int event_flag); -int acpi_processor_get_performance_info(struct acpi_processor *pr); -int acpi_processor_get_psd(struct acpi_processor *pr); -int acpi_processor_get_bios_limit(int cpu, unsigned int *limit); +extern int acpi_processor_get_bios_limit(int cpu, unsigned int *limit); #else static inline void acpi_processor_ppc_init(void) { diff --git a/include/xen/acpi.h b/include/xen/acpi.h deleted file mode 100644 index 99e127076c26..000000000000 --- a/include/xen/acpi.h +++ /dev/null @@ -1,104 +0,0 @@ -/****************************************************************************** - * acpi.h - * acpi file for domain 0 kernel - * - * Copyright (c) 2011 Konrad Rzeszutek Wilk - * Copyright (c) 2011 Yu Ke - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version 2 - * as published by the Free Software Foundation; or, when distributed - * separately from the Linux kernel or incorporated into other - * software packages, subject to the following license: - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this source file (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, modify, - * merge, publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#ifndef _XEN_ACPI_H -#define _XEN_ACPI_H - -#include -#include -#include - -/* - * Following are interfaces for xen acpi processor control - */ -#if defined(CONFIG_ACPI_PROCESSOR_XEN) || \ -defined(CONFIG_ACPI_PROCESSOR_XEN_MODULE) -/* Events notified to xen */ -#define PROCESSOR_PM_INIT 1 -#define PROCESSOR_PM_CHANGE 2 -#define PROCESSOR_HOTPLUG 3 - -/* Objects for the PM events */ -#define PM_TYPE_IDLE 0 -#define PM_TYPE_PERF 1 -#define PM_TYPE_THR 2 -#define PM_TYPE_MAX 3 - -#define XEN_MAX_ACPI_ID 255 - -/* Processor hotplug events */ -#define HOTPLUG_TYPE_ADD 0 -#define HOTPLUG_TYPE_REMOVE 1 - -extern int (*__acpi_processor_register_driver)(void); -extern void (*__acpi_processor_unregister_driver)(void); -#endif - -#ifndef CONFIG_CPU_FREQ -static inline int xen_acpi_processor_get_performance(struct acpi_processor *pr) -{ - printk(KERN_WARNING - "Warning: xen_acpi_processor_get_performance not supported\n" - "Consider compiling CPUfreq support into your kernel.\n"); - return 0; -} -#endif - -#if defined(CONFIG_ACPI_PROCESSOR_XEN) || \ -defined(CONFIG_ACPI_PROCESSOR_XEN_MODULE) - -struct processor_cntl_xen_ops { - /* Transfer processor PM events to xen */ -int (*pm_ops[PM_TYPE_MAX])(struct acpi_processor *pr, int event); - /* Notify physical processor status to xen */ - int (*hotplug)(struct acpi_processor *pr, int type); -}; - -extern int processor_cntl_xen_notify(struct acpi_processor *pr, - int event, int type); -extern int processor_cntl_xen_power_cache(int cpu, int cx, - struct acpi_power_register *reg); -#else - -static inline int processor_cntl_xen_notify(struct acpi_processor *pr, - int event, int type) -{ - return 0; -} -static inline int processor_cntl_xen_power_cache(int cpu, int cx, - struct acpi_power_register *reg) -{ - return 0; -} -#endif /* CONFIG_ACPI_PROCESSOR_XEN */ - -#endif /* _XEN_ACPI_H */ -- 2.50.1