Commit 42ea16f8 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'for-linus-4.11b-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip

Pull xen fixes from Juergen Gross:
 "Fixes for PM under Xen"

* tag 'for-linus-4.11b-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
  xen/acpi: upload PM state from init-domain to Xen
  xen/acpi: Replace hard coded "ACPI0007"
parents 69917da7 1914f0cd
...@@ -27,10 +27,10 @@ ...@@ -27,10 +27,10 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/syscore_ops.h>
#include <linux/acpi.h> #include <linux/acpi.h>
#include <acpi/processor.h> #include <acpi/processor.h>
#include <xen/xen.h> #include <xen/xen.h>
#include <xen/xen-ops.h>
#include <xen/interface/platform.h> #include <xen/interface/platform.h>
#include <asm/xen/hypercall.h> #include <asm/xen/hypercall.h>
...@@ -408,7 +408,7 @@ static int check_acpi_ids(struct acpi_processor *pr_backup) ...@@ -408,7 +408,7 @@ static int check_acpi_ids(struct acpi_processor *pr_backup)
acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT, acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX, ACPI_UINT32_MAX,
read_acpi_id, NULL, NULL, NULL); read_acpi_id, NULL, NULL, NULL);
acpi_get_devices("ACPI0007", read_acpi_id, NULL, NULL); acpi_get_devices(ACPI_PROCESSOR_DEVICE_HID, read_acpi_id, NULL, NULL);
upload: upload:
if (!bitmap_equal(acpi_id_present, acpi_ids_done, nr_acpi_bits)) { if (!bitmap_equal(acpi_id_present, acpi_ids_done, nr_acpi_bits)) {
...@@ -466,15 +466,33 @@ static int xen_upload_processor_pm_data(void) ...@@ -466,15 +466,33 @@ static int xen_upload_processor_pm_data(void)
return rc; return rc;
} }
static int xen_acpi_processor_resume(struct notifier_block *nb, static void xen_acpi_processor_resume_worker(struct work_struct *dummy)
unsigned long action, void *data)
{ {
int rc;
bitmap_zero(acpi_ids_done, nr_acpi_bits); bitmap_zero(acpi_ids_done, nr_acpi_bits);
return xen_upload_processor_pm_data();
rc = xen_upload_processor_pm_data();
if (rc != 0)
pr_info("ACPI data upload failed, error = %d\n", rc);
}
static void xen_acpi_processor_resume(void)
{
static DECLARE_WORK(wq, xen_acpi_processor_resume_worker);
/*
* xen_upload_processor_pm_data() calls non-atomic code.
* However, the context for xen_acpi_processor_resume is syscore
* with only the boot CPU online and in an atomic context.
*
* So defer the upload for some point safer.
*/
schedule_work(&wq);
} }
struct notifier_block xen_acpi_processor_resume_nb = { static struct syscore_ops xap_syscore_ops = {
.notifier_call = xen_acpi_processor_resume, .resume = xen_acpi_processor_resume,
}; };
static int __init xen_acpi_processor_init(void) static int __init xen_acpi_processor_init(void)
...@@ -527,7 +545,7 @@ static int __init xen_acpi_processor_init(void) ...@@ -527,7 +545,7 @@ static int __init xen_acpi_processor_init(void)
if (rc) if (rc)
goto err_unregister; goto err_unregister;
xen_resume_notifier_register(&xen_acpi_processor_resume_nb); register_syscore_ops(&xap_syscore_ops);
return 0; return 0;
err_unregister: err_unregister:
...@@ -544,7 +562,7 @@ static void __exit xen_acpi_processor_exit(void) ...@@ -544,7 +562,7 @@ static void __exit xen_acpi_processor_exit(void)
{ {
int i; int i;
xen_resume_notifier_unregister(&xen_acpi_processor_resume_nb); unregister_syscore_ops(&xap_syscore_ops);
kfree(acpi_ids_done); kfree(acpi_ids_done);
kfree(acpi_id_present); kfree(acpi_id_present);
kfree(acpi_id_cst_present); kfree(acpi_id_cst_present);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment