Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
7faa4ee1
Commit
7faa4ee1
authored
May 10, 2009
by
Avi Kivity
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
KVM: Add AMD cpuid bit: cr8_legacy, abm, misaligned sse, sse4, 3dnow prefetch
Signed-off-by:
Avi Kivity
<
avi@redhat.com
>
parent
8d753f36
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
33 deletions
+38
-33
arch/x86/kvm/x86.c
arch/x86/kvm/x86.c
+38
-33
No files found.
arch/x86/kvm/x86.c
View file @
7faa4ee1
...
@@ -1247,44 +1247,47 @@ static void do_cpuid_1_ent(struct kvm_cpuid_entry2 *entry, u32 function,
...
@@ -1247,44 +1247,47 @@ static void do_cpuid_1_ent(struct kvm_cpuid_entry2 *entry, u32 function,
entry
->
flags
=
0
;
entry
->
flags
=
0
;
}
}
#define F(x) bit(X86_FEATURE_##x)
static
void
do_cpuid_ent
(
struct
kvm_cpuid_entry2
*
entry
,
u32
function
,
static
void
do_cpuid_ent
(
struct
kvm_cpuid_entry2
*
entry
,
u32
function
,
u32
index
,
int
*
nent
,
int
maxnent
)
u32
index
,
int
*
nent
,
int
maxnent
)
{
{
const
u32
kvm_supported_word0_x86_features
=
bit
(
X86_FEATURE_FPU
)
|
unsigned
f_nx
=
is_efer_nx
()
?
F
(
NX
)
:
0
;
bit
(
X86_FEATURE_VME
)
|
bit
(
X86_FEATURE_DE
)
|
bit
(
X86_FEATURE_PSE
)
|
bit
(
X86_FEATURE_TSC
)
|
bit
(
X86_FEATURE_MSR
)
|
bit
(
X86_FEATURE_PAE
)
|
bit
(
X86_FEATURE_MCE
)
|
bit
(
X86_FEATURE_CX8
)
|
bit
(
X86_FEATURE_APIC
)
|
bit
(
X86_FEATURE_SEP
)
|
bit
(
X86_FEATURE_MTRR
)
|
bit
(
X86_FEATURE_PGE
)
|
bit
(
X86_FEATURE_MCA
)
|
bit
(
X86_FEATURE_CMOV
)
|
bit
(
X86_FEATURE_PAT
)
|
bit
(
X86_FEATURE_PSE36
)
|
bit
(
X86_FEATURE_CLFLSH
)
|
bit
(
X86_FEATURE_MMX
)
|
bit
(
X86_FEATURE_FXSR
)
|
bit
(
X86_FEATURE_XMM
)
|
bit
(
X86_FEATURE_XMM2
)
|
bit
(
X86_FEATURE_SELFSNOOP
);
const
u32
kvm_supported_word1_x86_features
=
bit
(
X86_FEATURE_FPU
)
|
bit
(
X86_FEATURE_VME
)
|
bit
(
X86_FEATURE_DE
)
|
bit
(
X86_FEATURE_PSE
)
|
bit
(
X86_FEATURE_TSC
)
|
bit
(
X86_FEATURE_MSR
)
|
bit
(
X86_FEATURE_PAE
)
|
bit
(
X86_FEATURE_CX8
)
|
bit
(
X86_FEATURE_APIC
)
|
bit
(
X86_FEATURE_PGE
)
|
bit
(
X86_FEATURE_CMOV
)
|
bit
(
X86_FEATURE_PSE36
)
|
bit
(
X86_FEATURE_MMX
)
|
bit
(
X86_FEATURE_FXSR
)
|
bit
(
X86_FEATURE_SYSCALL
)
|
(
is_efer_nx
()
?
bit
(
X86_FEATURE_NX
)
:
0
)
|
#ifdef CONFIG_X86_64
#ifdef CONFIG_X86_64
bit
(
X86_FEATURE_LM
)
|
unsigned
f_lm
=
F
(
LM
);
#else
unsigned
f_lm
=
0
;
#endif
#endif
bit
(
X86_FEATURE_FXSR_OPT
)
|
bit
(
X86_FEATURE_MMXEXT
)
|
/* cpuid 1.edx */
bit
(
X86_FEATURE_3DNOWEXT
)
|
const
u32
kvm_supported_word0_x86_features
=
bit
(
X86_FEATURE_3DNOW
);
F
(
FPU
)
|
F
(
VME
)
|
F
(
DE
)
|
F
(
PSE
)
|
const
u32
kvm_supported_word3_x86_features
=
F
(
TSC
)
|
F
(
MSR
)
|
F
(
PAE
)
|
F
(
MCE
)
|
bit
(
X86_FEATURE_XMM3
)
|
bit
(
X86_FEATURE_CX16
);
F
(
CX8
)
|
F
(
APIC
)
|
0
/* Reserved */
|
F
(
SEP
)
|
F
(
MTRR
)
|
F
(
PGE
)
|
F
(
MCA
)
|
F
(
CMOV
)
|
F
(
PAT
)
|
F
(
PSE36
)
|
0
/* PSN */
|
F
(
CLFLSH
)
|
0
/* Reserved, DS, ACPI */
|
F
(
MMX
)
|
F
(
FXSR
)
|
F
(
XMM
)
|
F
(
XMM2
)
|
F
(
SELFSNOOP
)
|
0
/* HTT, TM, Reserved, PBE */
;
/* cpuid 0x80000001.edx */
const
u32
kvm_supported_word1_x86_features
=
F
(
FPU
)
|
F
(
VME
)
|
F
(
DE
)
|
F
(
PSE
)
|
F
(
TSC
)
|
F
(
MSR
)
|
F
(
PAE
)
|
F
(
MCE
)
|
F
(
CX8
)
|
F
(
APIC
)
|
0
/* Reserved */
|
F
(
SYSCALL
)
|
F
(
MTRR
)
|
F
(
PGE
)
|
F
(
MCA
)
|
F
(
CMOV
)
|
F
(
PAT
)
|
F
(
PSE36
)
|
0
/* Reserved */
|
f_nx
|
0
/* Reserved */
|
F
(
MMXEXT
)
|
F
(
MMX
)
|
F
(
FXSR
)
|
F
(
FXSR_OPT
)
|
0
/* GBPAGES */
|
0
/* RDTSCP */
|
0
/* Reserved */
|
f_lm
|
F
(
3
DNOWEXT
)
|
F
(
3
DNOW
);
/* cpuid 1.ecx */
const
u32
kvm_supported_word4_x86_features
=
F
(
XMM3
)
|
F
(
CX16
);
/* cpuid 0x80000001.ecx */
const
u32
kvm_supported_word6_x86_features
=
const
u32
kvm_supported_word6_x86_features
=
bit
(
X86_FEATURE_LAHF_LM
)
|
bit
(
X86_FEATURE_CMP_LEGACY
)
|
F
(
LAHF_LM
)
|
F
(
CMP_LEGACY
)
|
F
(
SVM
)
|
0
/* ExtApicSpace */
|
bit
(
X86_FEATURE_SVM
);
F
(
CR8_LEGACY
)
|
F
(
ABM
)
|
F
(
SSE4A
)
|
F
(
MISALIGNSSE
)
|
F
(
3
DNOWPREFETCH
)
|
0
/* OSVW */
|
0
/* IBS */
|
F
(
SSE5
)
|
0
/* SKINIT */
|
0
/* WDT */
;
/* all calls to cpuid_count() should be made on the same cpu */
/* all calls to cpuid_count() should be made on the same cpu */
get_cpu
();
get_cpu
();
...
@@ -1297,7 +1300,7 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
...
@@ -1297,7 +1300,7 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
break
;
break
;
case
1
:
case
1
:
entry
->
edx
&=
kvm_supported_word0_x86_features
;
entry
->
edx
&=
kvm_supported_word0_x86_features
;
entry
->
ecx
&=
kvm_supported_word
3
_x86_features
;
entry
->
ecx
&=
kvm_supported_word
4
_x86_features
;
break
;
break
;
/* function 2 entries are STATEFUL. That is, repeated cpuid commands
/* function 2 entries are STATEFUL. That is, repeated cpuid commands
* may return different values. This forces us to get_cpu() before
* may return different values. This forces us to get_cpu() before
...
@@ -1359,6 +1362,8 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
...
@@ -1359,6 +1362,8 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
put_cpu
();
put_cpu
();
}
}
#undef F
static
int
kvm_dev_ioctl_get_supported_cpuid
(
struct
kvm_cpuid2
*
cpuid
,
static
int
kvm_dev_ioctl_get_supported_cpuid
(
struct
kvm_cpuid2
*
cpuid
,
struct
kvm_cpuid_entry2
__user
*
entries
)
struct
kvm_cpuid_entry2
__user
*
entries
)
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment