Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
c3c91fee
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
c3c91fee
编写于
11月 25, 2007
作者:
A
Avi Kivity
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
KVM: Replace page fault injection by the generalized exception queue
Signed-off-by:
N
Avi Kivity
<
avi@qumranet.com
>
上级
298101da
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
19 addition
and
71 deletion
+19
-71
drivers/kvm/mmu.c
drivers/kvm/mmu.c
+1
-1
drivers/kvm/svm.c
drivers/kvm/svm.c
+0
-35
drivers/kvm/vmx.c
drivers/kvm/vmx.c
+0
-32
drivers/kvm/x86.c
drivers/kvm/x86.c
+16
-1
drivers/kvm/x86.h
drivers/kvm/x86.h
+2
-2
未找到文件。
drivers/kvm/mmu.c
浏览文件 @
c3c91fee
...
...
@@ -1081,7 +1081,7 @@ static void inject_page_fault(struct kvm_vcpu *vcpu,
u64
addr
,
u32
err_code
)
{
kvm_
x86_ops
->
inject_page_fault
(
vcpu
,
addr
,
err_code
);
kvm_inject_page_fault
(
vcpu
,
addr
,
err_code
);
}
static
void
paging_free
(
struct
kvm_vcpu
*
vcpu
)
...
...
drivers/kvm/svm.c
浏览文件 @
c3c91fee
...
...
@@ -225,12 +225,6 @@ static void inject_ud(struct kvm_vcpu *vcpu)
UD_VECTOR
;
}
static
int
is_page_fault
(
uint32_t
info
)
{
info
&=
SVM_EVTINJ_VEC_MASK
|
SVM_EVTINJ_TYPE_MASK
|
SVM_EVTINJ_VALID
;
return
info
==
(
PF_VECTOR
|
SVM_EVTINJ_VALID
|
SVM_EVTINJ_TYPE_EXEPT
);
}
static
int
is_external_interrupt
(
u32
info
)
{
info
&=
SVM_EVTINJ_TYPE_MASK
|
SVM_EVTINJ_VALID
;
...
...
@@ -1624,34 +1618,6 @@ static void svm_set_cr3(struct kvm_vcpu *vcpu, unsigned long root)
}
}
static
void
svm_inject_page_fault
(
struct
kvm_vcpu
*
vcpu
,
unsigned
long
addr
,
uint32_t
err_code
)
{
struct
vcpu_svm
*
svm
=
to_svm
(
vcpu
);
uint32_t
exit_int_info
=
svm
->
vmcb
->
control
.
exit_int_info
;
++
vcpu
->
stat
.
pf_guest
;
if
(
is_page_fault
(
exit_int_info
))
{
svm
->
vmcb
->
control
.
event_inj_err
=
0
;
svm
->
vmcb
->
control
.
event_inj
=
SVM_EVTINJ_VALID
|
SVM_EVTINJ_VALID_ERR
|
SVM_EVTINJ_TYPE_EXEPT
|
DF_VECTOR
;
return
;
}
vcpu
->
cr2
=
addr
;
svm
->
vmcb
->
save
.
cr2
=
addr
;
svm
->
vmcb
->
control
.
event_inj
=
SVM_EVTINJ_VALID
|
SVM_EVTINJ_VALID_ERR
|
SVM_EVTINJ_TYPE_EXEPT
|
PF_VECTOR
;
svm
->
vmcb
->
control
.
event_inj_err
=
err_code
;
}
static
int
is_disabled
(
void
)
{
u64
vm_cr
;
...
...
@@ -1721,7 +1687,6 @@ static struct kvm_x86_ops svm_x86_ops = {
.
set_rflags
=
svm_set_rflags
,
.
tlb_flush
=
svm_flush_tlb
,
.
inject_page_fault
=
svm_inject_page_fault
,
.
inject_gp
=
svm_inject_gp
,
...
...
drivers/kvm/vmx.c
浏览文件 @
c3c91fee
...
...
@@ -2487,37 +2487,6 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
asm
(
"int $2"
);
}
static
void
vmx_inject_page_fault
(
struct
kvm_vcpu
*
vcpu
,
unsigned
long
addr
,
u32
err_code
)
{
struct
vcpu_vmx
*
vmx
=
to_vmx
(
vcpu
);
u32
vect_info
=
vmx
->
idt_vectoring_info
;
++
vcpu
->
stat
.
pf_guest
;
if
(
is_page_fault
(
vect_info
))
{
printk
(
KERN_DEBUG
"inject_page_fault: "
"double fault 0x%lx @ 0x%lx
\n
"
,
addr
,
vmcs_readl
(
GUEST_RIP
));
vmcs_write32
(
VM_ENTRY_EXCEPTION_ERROR_CODE
,
0
);
vmcs_write32
(
VM_ENTRY_INTR_INFO_FIELD
,
DF_VECTOR
|
INTR_TYPE_EXCEPTION
|
INTR_INFO_DELIEVER_CODE_MASK
|
INTR_INFO_VALID_MASK
);
return
;
}
vcpu
->
cr2
=
addr
;
vmcs_write32
(
VM_ENTRY_EXCEPTION_ERROR_CODE
,
err_code
);
vmcs_write32
(
VM_ENTRY_INTR_INFO_FIELD
,
PF_VECTOR
|
INTR_TYPE_EXCEPTION
|
INTR_INFO_DELIEVER_CODE_MASK
|
INTR_INFO_VALID_MASK
);
}
static
void
vmx_free_vmcs
(
struct
kvm_vcpu
*
vcpu
)
{
struct
vcpu_vmx
*
vmx
=
to_vmx
(
vcpu
);
...
...
@@ -2649,7 +2618,6 @@ static struct kvm_x86_ops vmx_x86_ops = {
.
set_rflags
=
vmx_set_rflags
,
.
tlb_flush
=
vmx_flush_tlb
,
.
inject_page_fault
=
vmx_inject_page_fault
,
.
inject_gp
=
vmx_inject_gp
,
...
...
drivers/kvm/x86.c
浏览文件 @
c3c91fee
...
...
@@ -142,6 +142,21 @@ void kvm_queue_exception(struct kvm_vcpu *vcpu, unsigned nr)
}
EXPORT_SYMBOL_GPL
(
kvm_queue_exception
);
void
kvm_inject_page_fault
(
struct
kvm_vcpu
*
vcpu
,
unsigned
long
addr
,
u32
error_code
)
{
++
vcpu
->
stat
.
pf_guest
;
if
(
vcpu
->
exception
.
pending
&&
vcpu
->
exception
.
nr
==
PF_VECTOR
)
{
printk
(
KERN_DEBUG
"kvm: inject_page_fault:"
" double fault 0x%lx
\n
"
,
addr
);
vcpu
->
exception
.
nr
=
DF_VECTOR
;
vcpu
->
exception
.
error_code
=
0
;
return
;
}
vcpu
->
cr2
=
addr
;
kvm_queue_exception_e
(
vcpu
,
PF_VECTOR
,
error_code
);
}
void
kvm_queue_exception_e
(
struct
kvm_vcpu
*
vcpu
,
unsigned
nr
,
u32
error_code
)
{
WARN_ON
(
vcpu
->
exception
.
pending
);
...
...
@@ -1601,7 +1616,7 @@ static int emulator_write_emulated_onepage(unsigned long addr,
gpa_t
gpa
=
vcpu
->
mmu
.
gva_to_gpa
(
vcpu
,
addr
);
if
(
gpa
==
UNMAPPED_GVA
)
{
kvm_
x86_ops
->
inject_page_fault
(
vcpu
,
addr
,
2
);
kvm_inject_page_fault
(
vcpu
,
addr
,
2
);
return
X86EMUL_PROPAGATE_FAULT
;
}
...
...
drivers/kvm/x86.h
浏览文件 @
c3c91fee
...
...
@@ -219,8 +219,6 @@ struct kvm_x86_ops {
void
(
*
set_rflags
)(
struct
kvm_vcpu
*
vcpu
,
unsigned
long
rflags
);
void
(
*
tlb_flush
)(
struct
kvm_vcpu
*
vcpu
);
void
(
*
inject_page_fault
)(
struct
kvm_vcpu
*
vcpu
,
unsigned
long
addr
,
u32
err_code
);
void
(
*
inject_gp
)(
struct
kvm_vcpu
*
vcpu
,
unsigned
err_code
);
...
...
@@ -306,6 +304,8 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data);
void
kvm_queue_exception
(
struct
kvm_vcpu
*
vcpu
,
unsigned
nr
);
void
kvm_queue_exception_e
(
struct
kvm_vcpu
*
vcpu
,
unsigned
nr
,
u32
error_code
);
void
kvm_inject_page_fault
(
struct
kvm_vcpu
*
vcpu
,
unsigned
long
cr2
,
u32
error_code
);
void
fx_init
(
struct
kvm_vcpu
*
vcpu
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录