From: liguang <lig.fnst@cn.fujitsu.com>
To: Len Brown <lenb@kernel.org>, "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: "Matthew Garrett" <matthew.garrett@nebula.com>,
linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org,
platform-driver-x86@vger.kernel.org,
"Andreas Färber" <afaerber@suse.de>,
"Igor Mammedov" <imammedo@redhat.com>,
liguang <lig.fnst@cn.fujitsu.com>
Subject: [PATCH RFC v2 3/3] cpu_physic_hotplug: register handler for ec space notifier
Date: Thu, 6 Jun 2013 09:40:35 +0800 [thread overview]
Message-ID: <1370482835-764-4-git-send-email-lig.fnst@cn.fujitsu.com> (raw)
In-Reply-To: <1370482835-764-1-git-send-email-lig.fnst@cn.fujitsu.com>
Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
---
drivers/platform/x86/cpu_physic_hotplug.c | 30 ++++++++++++++++++++++++++--
1 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/drivers/platform/x86/cpu_physic_hotplug.c b/drivers/platform/x86/cpu_physic_hotplug.c
index a52c042..1cdac1b 100644
--- a/drivers/platform/x86/cpu_physic_hotplug.c
+++ b/drivers/platform/x86/cpu_physic_hotplug.c
@@ -9,6 +9,11 @@ MODULE_AUTHOR("Li Guang");
MODULE_DESCRIPTION("CPU physically hot-plug/unplug Driver");
MODULE_LICENSE("GPL");
+#define EC_SPACE_CPU_IDX 3
+#define EC_SPACE_CPU_OFFSET 4
+#define EC_SPACE_CPU_CMD 2
+#define EC_CPU_EJECT 0xE7
+
static int cpu_logic_hotplug_notify(struct notifier_block *nfb,
unsigned long action, void *hcpu)
{
@@ -20,6 +25,7 @@ static int cpu_logic_hotplug_notify(struct notifier_block *nfb,
case CPU_ONLINE:
break;
case CPU_DEAD:
+ ec_write(EC_SPACE_CPU_CMD, EC_CPU_EJECT);
break;
default:
break;
@@ -34,8 +40,26 @@ static struct notifier_block cpu_logic_hotplug_notifier =
};
static int cpu_physic_hotplug_notify(struct notifier_block *nfb,
- unsigned char *s)
+ unsigned long action, void *s)
{
+ u8 index = 0, val = 0;
+ bool cpu_state = false;
+ struct acpi_processor *pr;
+
+ ec_read(EC_SPACE_CPU_IDX, &index);
+ if (index == 0)
+ goto out;
+ pr = per_cpu(processors, index);
+
+ ec_read(EC_SPACE_CPU_OFFSET + index/8, &val);
+ if (val & 1 << index/8)
+ cpu_state = true;
+
+ if (pr->flags.need_hotplug_init & cpu_state)
+ cpu_up(pr->id);
+
+out:
+ return NOTIFY_OK;
}
static struct notifier_block cpu_physic_hotplug_notifier =
@@ -46,14 +70,14 @@ static struct notifier_block cpu_physic_hotplug_notifier =
static int __init cpu_qemu_hotplug_init(void)
{
register_hotcpu_notifier(&cpu_logic_hotplug_notifier);
- register_ec_gpe_notifier(&cpu_physic_hotplug_notifier);
+ register_ec_space_notifier(&cpu_physic_hotplug_notifier);
return 0;
}
static void __exit cpu_qemu_hotplug_exit(void)
{
unregister_hotcpu_notifier(&cpu_logic_hotplug_notifier);
- unregister_ec_gpe_notifier(&cpu_physic_hotplug_notifier);
+ unregister_ec_space_notifier(&cpu_physic_hotplug_notifier);
}
module_init(cpu_qemu_hotplug_init);
--
1.7.2.5
next prev parent reply other threads:[~2013-06-06 1:50 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-06 1:40 [PATCH RFC v2 0/3] add cpu physically hotplug driver liguang
2013-06-06 1:40 ` [PATCH RFC v2 1/3] drivers/platform/x86: " liguang
2013-06-06 2:24 ` Gu Zheng
2013-06-06 3:03 ` li guang
2013-06-06 9:34 ` Borislav Petkov
2013-06-06 1:40 ` [PATCH RFC v2 2/3] ec: add ec space notifier liguang
2013-06-06 10:59 ` Rafael J. Wysocki
2013-06-10 0:46 ` li guang
2013-06-10 11:43 ` Rafael J. Wysocki
2013-06-06 1:40 ` liguang [this message]
2013-06-06 11:00 ` [PATCH RFC v2 0/3] add cpu physically hotplug driver Rafael J. Wysocki
2013-06-10 0:36 ` li guang
2013-06-10 3:51 ` Yasuaki Ishimatsu
2013-06-10 4:04 ` li guang
2013-06-10 11:47 ` Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1370482835-764-4-git-send-email-lig.fnst@cn.fujitsu.com \
--to=lig.fnst@cn.fujitsu.com \
--cc=afaerber@suse.de \
--cc=imammedo@redhat.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew.garrett@nebula.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=rjw@sisk.pl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®