diff mbox

[v4,2/3] KVM: add converters between pfn_t and kvm_pfn_t

Message ID 20171103055327.21684-3-haozhong.zhang@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Haozhong Zhang Nov. 3, 2017, 5:53 a.m. UTC
Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
---
 include/linux/kvm_host.h | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Dan Williams Nov. 3, 2017, 1:21 p.m. UTC | #1
On Thu, Nov 2, 2017 at 10:53 PM, Haozhong Zhang
<haozhong.zhang@intel.com> wrote:
> Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>

Can you also add some text to the changelog saying why we need these converters?

> ---
>  include/linux/kvm_host.h | 4 ++++
>  1 file changed, 4 insertions(+)
Haozhong Zhang Nov. 8, 2017, 2:47 a.m. UTC | #2
On 11/03/17 06:21 -0700, Dan Williams wrote:
> On Thu, Nov 2, 2017 at 10:53 PM, Haozhong Zhang
> <haozhong.zhang@intel.com> wrote:
> > Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
> 
> Can you also add some text to the changelog saying why we need these converters?

I'm going to drop these converters in the next version. The function
introduced in patch 1 does not need flags in pfn_t, so unsigned long
is enough. I'll change pfn_t to unsigned long in patch 1 as well.

Haozhong
diff mbox

Patch

diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 6882538eda32..caf6f7a6bdb2 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -27,6 +27,7 @@ 
 #include <linux/irqbypass.h>
 #include <linux/swait.h>
 #include <linux/refcount.h>
+#include <linux/pfn_t.h>
 #include <asm/signal.h>
 
 #include <linux/kvm.h>
@@ -67,6 +68,9 @@ 
 #define KVM_PFN_ERR_HWPOISON	(KVM_PFN_ERR_MASK + 1)
 #define KVM_PFN_ERR_RO_FAULT	(KVM_PFN_ERR_MASK + 2)
 
+#define pfn_t_to_kvm_pfn_t(x)	pfn_t_to_pfn(x)
+#define kvm_pfn_t_to_pfn_t(x)	pfn_to_pfn_t((x) & ~KVM_PFN_ERR_NOSLOT_MASK)
+
 /*
  * error pfns indicate that the gfn is in slot but faild to
  * translate it to pfn on host.