Skip to content

Commit e6c1502

Browse files
Xiao Guangrongavikivity
authored andcommitted
KVM: introduce KVM_PFN_ERR_HWPOISON
Then, get_hwpoison_pfn and is_hwpoison_pfn can be removed Signed-off-by: Xiao Guangrong <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
1 parent 6c8ee57 commit e6c1502

File tree

3 files changed

+3
-14
lines changed

3 files changed

+3
-14
lines changed

arch/x86/kvm/mmu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2649,7 +2649,7 @@ static void kvm_send_hwpoison_signal(unsigned long address, struct task_struct *
26492649
static int kvm_handle_bad_page(struct kvm_vcpu *vcpu, gfn_t gfn, pfn_t pfn)
26502650
{
26512651
kvm_release_pfn_clean(pfn);
2652-
if (is_hwpoison_pfn(pfn)) {
2652+
if (pfn == KVM_PFN_ERR_HWPOISON) {
26532653
kvm_send_hwpoison_signal(gfn_to_hva(vcpu->kvm, gfn), current);
26542654
return 0;
26552655
}

include/linux/kvm_host.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
(KVM_MMIO_SIZE / KVM_USER_MMIO_SIZE + KVM_EXTRA_MMIO_FRAGMENTS)
5050

5151
#define KVM_PFN_ERR_FAULT (-EFAULT)
52+
#define KVM_PFN_ERR_HWPOISON (-EHWPOISON)
5253

5354
/*
5455
* vcpu->requests bit members
@@ -395,7 +396,6 @@ extern struct page *bad_page;
395396

396397
int is_error_page(struct page *page);
397398
int is_error_pfn(pfn_t pfn);
398-
int is_hwpoison_pfn(pfn_t pfn);
399399
int is_noslot_pfn(pfn_t pfn);
400400
int is_invalid_pfn(pfn_t pfn);
401401
int kvm_is_error_hva(unsigned long addr);

virt/kvm/kvm_main.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -939,17 +939,6 @@ static pfn_t get_bad_pfn(void)
939939
return -ENOENT;
940940
}
941941

942-
static pfn_t get_hwpoison_pfn(void)
943-
{
944-
return -EHWPOISON;
945-
}
946-
947-
int is_hwpoison_pfn(pfn_t pfn)
948-
{
949-
return pfn == -EHWPOISON;
950-
}
951-
EXPORT_SYMBOL_GPL(is_hwpoison_pfn);
952-
953942
int is_noslot_pfn(pfn_t pfn)
954943
{
955944
return pfn == -ENOENT;
@@ -1115,7 +1104,7 @@ static pfn_t hva_to_pfn(unsigned long addr, bool atomic, bool *async,
11151104
if (npages == -EHWPOISON ||
11161105
(!async && check_user_page_hwpoison(addr))) {
11171106
up_read(&current->mm->mmap_sem);
1118-
return get_hwpoison_pfn();
1107+
return KVM_PFN_ERR_HWPOISON;
11191108
}
11201109

11211110
vma = find_vma_intersection(current->mm, addr, addr+1);

0 commit comments

Comments
 (0)