* [PATCH 1/2] x86_64: add pseudo-features for 32-bit compat syscall
@ 2008-07-10 23:22 Jeremy Fitzhardinge
2008-07-11 1:13 ` [PATCH 1a/2] x86_64: vdso32 cleanup using feature flags Jeremy Fitzhardinge
0 siblings, 1 reply; 3+ messages in thread
From: Jeremy Fitzhardinge @ 2008-07-10 23:22 UTC (permalink / raw)
To: Ingo Molnar; +Cc: the arch/x86 maintainers, Linux Kernel Mailing List
Add pseudo-feature bits to describe whether the CPU supports sysenter
and/or syscall from ia32-compat userspace. This removes a hardcoded
test in vdso32-setup.
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
arch/x86/kernel/cpu/centaur_64.c | 2 ++
arch/x86/kernel/cpu/common_64.c | 3 +++
arch/x86/kernel/cpu/intel_64.c | 2 ++
include/asm-x86/cpufeature.h | 4 ++--
4 files changed, 9 insertions(+), 2 deletions(-)
===================================================================
--- a/arch/x86/kernel/cpu/centaur_64.c
+++ b/arch/x86/kernel/cpu/centaur_64.c
@@ -10,6 +10,8 @@ static void __cpuinit early_init_centaur
{
if (c->x86 == 0x6 && c->x86_model >= 0xf)
set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
+
+ set_cpu_cap(c, X86_FEATURE_SYSENTER32);
}
static void __cpuinit init_centaur(struct cpuinfo_x86 *c)
===================================================================
--- a/arch/x86/kernel/cpu/common_64.c
+++ b/arch/x86/kernel/cpu/common_64.c
@@ -315,6 +315,9 @@ static void __cpuinit early_identify_cpu
if (c->extended_cpuid_level >= 0x80000007)
c->x86_power = cpuid_edx(0x80000007);
+ /* Assume all 64-bit CPUs support 32-bit syscall */
+ set_cpu_cap(c, X86_FEATURE_SYSCALL32);
+
if (c->x86_vendor != X86_VENDOR_UNKNOWN &&
cpu_devs[c->x86_vendor]->c_early_init)
cpu_devs[c->x86_vendor]->c_early_init(c);
===================================================================
--- a/arch/x86/kernel/cpu/intel_64.c
+++ b/arch/x86/kernel/cpu/intel_64.c
@@ -12,6 +12,8 @@ static void __cpuinit early_init_intel(s
if ((c->x86 == 0xf && c->x86_model >= 0x03) ||
(c->x86 == 0x6 && c->x86_model >= 0x0e))
set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
+
+ set_cpu_cap(c, X86_FEATURE_SYSENTER32);
}
/*
===================================================================
--- a/include/asm-x86/cpufeature.h
+++ b/include/asm-x86/cpufeature.h
@@ -74,8 +74,8 @@
#define X86_FEATURE_ARCH_PERFMON (3*32+11) /* Intel Architectural PerfMon */
#define X86_FEATURE_PEBS (3*32+12) /* Precise-Event Based Sampling */
#define X86_FEATURE_BTS (3*32+13) /* Branch Trace Store */
-/* 14 free */
-/* 15 free */
+#define X86_FEATURE_SYSCALL32 (3*32+14) /* syscall in ia32 userspace */
+#define X86_FEATURE_SYSENTER32 (3*32+15) /* sysenter in ia32 userspace */
#define X86_FEATURE_REP_GOOD (3*32+16) /* rep microcode works well on this CPU */
#define X86_FEATURE_MFENCE_RDTSC (3*32+17) /* Mfence synchronizes RDTSC */
#define X86_FEATURE_LFENCE_RDTSC (3*32+18) /* Lfence synchronizes RDTSC */
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1a/2] x86_64: vdso32 cleanup using feature flags
2008-07-10 23:22 [PATCH 1/2] x86_64: add pseudo-features for 32-bit compat syscall Jeremy Fitzhardinge
@ 2008-07-11 1:13 ` Jeremy Fitzhardinge
2008-07-11 13:46 ` Ingo Molnar
0 siblings, 1 reply; 3+ messages in thread
From: Jeremy Fitzhardinge @ 2008-07-11 1:13 UTC (permalink / raw)
To: Ingo Molnar; +Cc: the arch/x86 maintainers, Linux Kernel Mailing List
Use the X86_FEATURE_SYSENTER32 to remove hard-coded CPU vendor check.
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
arch/x86/vdso/vdso32-setup.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
===================================================================
--- a/arch/x86/vdso/vdso32-setup.c
+++ b/arch/x86/vdso/vdso32-setup.c
@@ -203,20 +203,11 @@ static struct page *vdso32_pages[1];
#ifdef CONFIG_X86_64
-static int use_sysenter __read_mostly = -1;
-
-#define vdso32_sysenter() (use_sysenter > 0)
+#define vdso32_sysenter() (boot_cpu_has(X86_FEATURE_SYSENTER32))
/* May not be __init: called during resume */
void syscall32_cpu_init(void)
{
- if (use_sysenter < 0) {
- if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
- use_sysenter = 1;
- if (boot_cpu_data.x86_vendor == X86_VENDOR_CENTAUR)
- use_sysenter = 1;
- }
-
/* Load these always in case some future AMD CPU supports
SYSENTER from compat mode too. */
checking_wrmsrl(MSR_IA32_SYSENTER_CS, (u64)__KERNEL_CS);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1a/2] x86_64: vdso32 cleanup using feature flags
2008-07-11 1:13 ` [PATCH 1a/2] x86_64: vdso32 cleanup using feature flags Jeremy Fitzhardinge
@ 2008-07-11 13:46 ` Ingo Molnar
0 siblings, 0 replies; 3+ messages in thread
From: Ingo Molnar @ 2008-07-11 13:46 UTC (permalink / raw)
To: Jeremy Fitzhardinge; +Cc: the arch/x86 maintainers, Linux Kernel Mailing List
* Jeremy Fitzhardinge <jeremy@goop.org> wrote:
> Use the X86_FEATURE_SYSENTER32 to remove hard-coded CPU vendor check.
>
> Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
nice cleanup - applied these two to tip/x86/core.
Ingo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-07-11 13:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-10 23:22 [PATCH 1/2] x86_64: add pseudo-features for 32-bit compat syscall Jeremy Fitzhardinge
2008-07-11 1:13 ` [PATCH 1a/2] x86_64: vdso32 cleanup using feature flags Jeremy Fitzhardinge
2008-07-11 13:46 ` Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox