summaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm/kvm_host.h
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2010-07-01 16:00:11 +0200
committerAvi Kivity <avi@redhat.com>2010-08-01 10:47:30 +0300
commit828554136bbacae6e39fc31b9cd7e7c660ad7530 (patch)
tree4e2ec85ff33c9c1e7245e83ed8e4fa3791007ef7 /arch/x86/include/asm/kvm_host.h
parent95c87e2b4460a488ec7ce42f273893e410ab385a (diff)
downloadop-kernel-dev-828554136bbacae6e39fc31b9cd7e7c660ad7530.zip
op-kernel-dev-828554136bbacae6e39fc31b9cd7e7c660ad7530.tar.gz
KVM: Remove unnecessary divide operations
This patch converts unnecessary divide and modulo operations in the KVM large page related code into logical operations. This allows to convert gfn_t to u64 while not breaking 32 bit builds. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/include/asm/kvm_host.h')
-rw-r--r--arch/x86/include/asm/kvm_host.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 2bda624..50c79b9 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -44,7 +44,8 @@
/* KVM Hugepage definitions for x86 */
#define KVM_NR_PAGE_SIZES 3
-#define KVM_HPAGE_SHIFT(x) (PAGE_SHIFT + (((x) - 1) * 9))
+#define KVM_HPAGE_GFN_SHIFT(x) (((x) - 1) * 9)
+#define KVM_HPAGE_SHIFT(x) (PAGE_SHIFT + KVM_HPAGE_GFN_SHIFT(x))
#define KVM_HPAGE_SIZE(x) (1UL << KVM_HPAGE_SHIFT(x))
#define KVM_HPAGE_MASK(x) (~(KVM_HPAGE_SIZE(x) - 1))
#define KVM_PAGES_PER_HPAGE(x) (KVM_HPAGE_SIZE(x) / PAGE_SIZE)
OpenPOWER on IntegriCloud