qubes-linux-kernel/patches.xen/pvops-xen-Re-upload-processor-PM-data-to-hypervisor-after-.patch

76 lines
2.1 KiB
Diff
Raw Normal View History

2013-04-15 12:50:04 +00:00
From 5d66288fa0a177817ca6473a53e27b32fbf37aa9 Mon Sep 17 00:00:00 2001
From: Ben Guthro <benjamin.guthro@xxxxxxxxxx>
Date: Tue, 2 Apr 2013 02:51:50 +0200
Subject: [PATCH] xen: Re-upload processor PM data to hypervisor after S3
resume
Upon resume, it was found that ACPI C-states were missing from non-boot CPUs.
This change registers a syscore_ops handler for this case, and performs a
subset of the xen_acpi_processor_init() functionality to achieve this case.
Signed-Off-By: Ben Guthro <benjamin.guthro@xxxxxxxxxx>
---
drivers/xen/xen-acpi-processor.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/drivers/xen/xen-acpi-processor.c b/drivers/xen/xen-acpi-processor.c
index 316df65..92dabc8 100644
--- a/drivers/xen/xen-acpi-processor.c
+++ b/drivers/xen/xen-acpi-processor.c
@@ -25,6 +25,7 @@
#include <linux/init.h>
#include <linux/module.h>
#include <linux/types.h>
+#include <linux/syscore_ops.h>
#include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h>
#include <acpi/processor.h>
@@ -467,6 +468,26 @@ static void free_acpi_perf_data(void)
free_percpu(acpi_perf_data);
}
+static void xen_acpi_processor_resume(void)
+{
+ int i;
+ printk(KERN_INFO "Resuming Xen processor info\n");
+
+ for_each_possible_cpu(i) {
+ struct acpi_processor *_pr;
+ _pr = per_cpu(processors, i /* APIC ID */);
+ if (!_pr)
+ continue;
+
+ __clear_bit(_pr->acpi_id, acpi_ids_done);
+ (void)upload_pm_data(_pr);
+ }
+}
+
+static struct syscore_ops xap_syscore_ops = {
+ .resume = xen_acpi_processor_resume,
+};
+
static int __init xen_acpi_processor_init(void)
{
struct acpi_processor *pr_backup = NULL;
@@ -532,6 +553,8 @@ static int __init xen_acpi_processor_init(void)
if (rc)
goto err_unregister;
+ register_syscore_ops(&xap_syscore_ops);
+
return 0;
err_unregister:
for_each_possible_cpu(i) {
@@ -550,6 +573,7 @@ static void __exit xen_acpi_processor_exit(void)
int i;
kfree(acpi_ids_done);
+ unregister_syscore_ops(&xap_syscore_ops);
for_each_possible_cpu(i) {
struct acpi_processor_performance *perf;
perf = per_cpu_ptr(acpi_perf_data, i);
--
1.8.1.4