Skip to content

Commit 83f0922

Browse files
Xiao Guangrongavikivity
Xiao Guangrong
authored andcommitted
KVM: inline is_*_pfn functions
These functions are exported and can not inline, move them to kvm_host.h to eliminate the overload of function call Signed-off-by: Xiao Guangrong <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
1 parent 950e950 commit 83f0922

File tree

2 files changed

+16
-21
lines changed

2 files changed

+16
-21
lines changed

include/linux/kvm_host.h

+16-3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <linux/slab.h>
2222
#include <linux/rcupdate.h>
2323
#include <linux/ratelimit.h>
24+
#include <linux/err.h>
2425
#include <asm/signal.h>
2526

2627
#include <linux/kvm.h>
@@ -52,6 +53,21 @@
5253
#define KVM_PFN_ERR_HWPOISON (-EHWPOISON)
5354
#define KVM_PFN_ERR_BAD (-ENOENT)
5455

56+
static inline int is_error_pfn(pfn_t pfn)
57+
{
58+
return IS_ERR_VALUE(pfn);
59+
}
60+
61+
static inline int is_noslot_pfn(pfn_t pfn)
62+
{
63+
return pfn == -ENOENT;
64+
}
65+
66+
static inline int is_invalid_pfn(pfn_t pfn)
67+
{
68+
return !is_noslot_pfn(pfn) && is_error_pfn(pfn);
69+
}
70+
5571
/*
5672
* vcpu->requests bit members
5773
*/
@@ -396,9 +412,6 @@ id_to_memslot(struct kvm_memslots *slots, int id)
396412
extern struct page *bad_page;
397413

398414
int is_error_page(struct page *page);
399-
int is_error_pfn(pfn_t pfn);
400-
int is_noslot_pfn(pfn_t pfn);
401-
int is_invalid_pfn(pfn_t pfn);
402415
int kvm_is_error_hva(unsigned long addr);
403416
int kvm_set_memory_region(struct kvm *kvm,
404417
struct kvm_userspace_memory_region *mem,

virt/kvm/kvm_main.c

-18
Original file line numberDiff line numberDiff line change
@@ -928,24 +928,6 @@ int is_error_page(struct page *page)
928928
}
929929
EXPORT_SYMBOL_GPL(is_error_page);
930930

931-
int is_error_pfn(pfn_t pfn)
932-
{
933-
return IS_ERR_VALUE(pfn);
934-
}
935-
EXPORT_SYMBOL_GPL(is_error_pfn);
936-
937-
int is_noslot_pfn(pfn_t pfn)
938-
{
939-
return pfn == -ENOENT;
940-
}
941-
EXPORT_SYMBOL_GPL(is_noslot_pfn);
942-
943-
int is_invalid_pfn(pfn_t pfn)
944-
{
945-
return !is_noslot_pfn(pfn) && is_error_pfn(pfn);
946-
}
947-
EXPORT_SYMBOL_GPL(is_invalid_pfn);
948-
949931
struct page *get_bad_page(void)
950932
{
951933
return ERR_PTR(-ENOENT);

0 commit comments

Comments
 (0)