From: Chuck Ebbert <cebbert@redhat.com>
To: linux-kernel <linux-kernel@vger.kernel.org>
Cc: Andi Kleen <ak@suse.de>
Subject: [RFC PATCH 2/3] x86: new API for modifying CPU feature flags
Date: Fri, 20 Apr 2007 18:53:49 -0400 [thread overview]
Message-ID: <4629447D.5030900@redhat.com> (raw)
In-Reply-To: <4629438C.4070209@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 0 bytes --]
[-- Attachment #2: x86_cpufeature_api.patch --]
[-- Type: text/plain, Size: 1467 bytes --]
x86: new API for modifying CPU feature flags
Use an API for setting/clearing CPU features, so the
process can be debugged.
Adds:
set_cpu_feature()
clear_cpu_feature()
clear_all_cpu_features()
Todo:
mask_boot_cpu_features()
set_cpu_feature_word()
more?
(Hardcoded printk for now, should be dprintk.)
Signed-off-by: Chuck Ebbert <cebbert@redhat.com>
---
include/asm-i386/cpufeature.h | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
--- 2.6.21-rc7-d390.orig/include/asm-i386/cpufeature.h
+++ 2.6.21-rc7-d390/include/asm-i386/cpufeature.h
@@ -108,6 +108,23 @@
#define cpu_has(c, bit) test_bit(bit, (c)->x86_capability)
#define boot_cpu_has(bit) test_bit(bit, boot_cpu_data.x86_capability)
+#define alter_cpu_feature(fn, feat, c) \
+ do { typeof(c) __c = (c); \
+ printk("CPU: %s: %s feature %s for CPU %p", \
+ __func__, #fn, #feat, __c); \
+ fn ## _bit(X86_FEATURE_ ## feat, __c->x86_capability); \
+ } while (0)
+
+#define set_cpu_feature(f, c) alter_cpu_feature(set, f, c)
+#define clear_cpu_feature(f, c) alter_cpu_feature(clear, f, c)
+
+#define clear_all_cpu_features(c) \
+ do { typeof(c) __c = (c); \
+ printk("CPU: %s: clearing all capabilities for CPU %p", \
+ __func__, __c); \
+ memset(&__c->x86_capability, 0, sizeof __c->x86_capability); \
+ } while (0)
+
#define cpu_has_fpu boot_cpu_has(X86_FEATURE_FPU)
#define cpu_has_vme boot_cpu_has(X86_FEATURE_VME)
#define cpu_has_de boot_cpu_has(X86_FEATURE_DE)
next prev parent reply other threads:[~2007-04-20 22:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-20 22:49 [RFC PATCH 0/3] Clean up x86 CPU feature setup Chuck Ebbert
2007-04-20 22:52 ` [RFC PATCH 1/3] x86: use defined names for all CPU feature flags Chuck Ebbert
2007-04-21 6:48 ` Dave Jones
2007-04-21 9:47 ` Andi Kleen
2007-04-21 21:19 ` Alan Cox
2007-04-20 22:53 ` Chuck Ebbert [this message]
2007-04-20 22:54 ` [RFC PATCH 3/3] x86: use the x86 CPU feature API Chuck Ebbert
2007-04-21 9:41 ` [RFC PATCH 0/3] Clean up x86 CPU feature setup Andi Kleen
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=4629447D.5030900@redhat.com \
--to=cebbert@redhat.com \
--cc=ak@suse.de \
--cc=linux-kernel@vger.kernel.org \
/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