KVM: do not treat noslot pfn as a error pfn
This patch filters noslot pfn out from error pfns based on Marcelo comment: noslot pfn is not a error pfn After this patch, - is_noslot_pfn indicates that the gfn is not in slot - is_error_pfn indicates that the gfn is in slot but the error is occurred when translate the gfn to pfn - is_error_noslot_pfn indicates that the pfn either it is error pfns or it is noslot pfn And is_invalid_pfn can be removed, it makes the code more clean Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
This commit is contained in:

committed by
Marcelo Tosatti

parent
19bf7f8ac3
commit
81c52c56e2
@@ -58,28 +58,40 @@
|
||||
|
||||
/*
|
||||
* For the normal pfn, the highest 12 bits should be zero,
|
||||
* so we can mask these bits to indicate the error.
|
||||
* so we can mask bit 62 ~ bit 52 to indicate the error pfn,
|
||||
* mask bit 63 to indicate the noslot pfn.
|
||||
*/
|
||||
#define KVM_PFN_ERR_MASK (0xfffULL << 52)
|
||||
#define KVM_PFN_ERR_MASK (0x7ffULL << 52)
|
||||
#define KVM_PFN_ERR_NOSLOT_MASK (0xfffULL << 52)
|
||||
#define KVM_PFN_NOSLOT (0x1ULL << 63)
|
||||
|
||||
#define KVM_PFN_ERR_FAULT (KVM_PFN_ERR_MASK)
|
||||
#define KVM_PFN_ERR_HWPOISON (KVM_PFN_ERR_MASK + 1)
|
||||
#define KVM_PFN_ERR_BAD (KVM_PFN_ERR_MASK + 2)
|
||||
#define KVM_PFN_ERR_RO_FAULT (KVM_PFN_ERR_MASK + 3)
|
||||
#define KVM_PFN_ERR_RO_FAULT (KVM_PFN_ERR_MASK + 2)
|
||||
|
||||
/*
|
||||
* error pfns indicate that the gfn is in slot but faild to
|
||||
* translate it to pfn on host.
|
||||
*/
|
||||
static inline bool is_error_pfn(pfn_t pfn)
|
||||
{
|
||||
return !!(pfn & KVM_PFN_ERR_MASK);
|
||||
}
|
||||
|
||||
static inline bool is_noslot_pfn(pfn_t pfn)
|
||||
/*
|
||||
* error_noslot pfns indicate that the gfn can not be
|
||||
* translated to pfn - it is not in slot or failed to
|
||||
* translate it to pfn.
|
||||
*/
|
||||
static inline bool is_error_noslot_pfn(pfn_t pfn)
|
||||
{
|
||||
return pfn == KVM_PFN_ERR_BAD;
|
||||
return !!(pfn & KVM_PFN_ERR_NOSLOT_MASK);
|
||||
}
|
||||
|
||||
static inline bool is_invalid_pfn(pfn_t pfn)
|
||||
/* noslot pfn indicates that the gfn is not in slot. */
|
||||
static inline bool is_noslot_pfn(pfn_t pfn)
|
||||
{
|
||||
return !is_noslot_pfn(pfn) && is_error_pfn(pfn);
|
||||
return pfn == KVM_PFN_NOSLOT;
|
||||
}
|
||||
|
||||
#define KVM_HVA_ERR_BAD (PAGE_OFFSET)
|
||||
|
Reference in New Issue
Block a user