From 5689cc53fa9d09b5bf41b1b1a7c90bd6c112ab40 Mon Sep 17 00:00:00 2001 From: Joerg Roedel Date: Thu, 1 Jul 2010 16:00:12 +0200 Subject: KVM: Use u64 for frame data types For 32bit machines where the physical address width is larger than the virtual address width the frame number types in KVM may overflow. Fix this by changing them to u64. [sfr: fix build on 32-bit ppc] Signed-off-by: Joerg Roedel Signed-off-by: Stephen Rothwell Signed-off-by: Marcelo Tosatti --- arch/powerpc/kvm/44x_tlb.c | 3 ++- include/linux/kvm_types.h | 4 ++-- virt/kvm/iommu.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/kvm/44x_tlb.c b/arch/powerpc/kvm/44x_tlb.c index 8123125..9b9b5cd 100644 --- a/arch/powerpc/kvm/44x_tlb.c +++ b/arch/powerpc/kvm/44x_tlb.c @@ -316,7 +316,8 @@ void kvmppc_mmu_map(struct kvm_vcpu *vcpu, u64 gvaddr, gpa_t gpaddr, gfn = gpaddr >> PAGE_SHIFT; new_page = gfn_to_page(vcpu->kvm, gfn); if (is_error_page(new_page)) { - printk(KERN_ERR "Couldn't get guest page for gfn %lx!\n", gfn); + printk(KERN_ERR "Couldn't get guest page for gfn %llx!\n", + (unsigned long long)gfn); kvm_release_page_clean(new_page); return; } diff --git a/include/linux/kvm_types.h b/include/linux/kvm_types.h index fb46efb..7ac0d4ee 100644 --- a/include/linux/kvm_types.h +++ b/include/linux/kvm_types.h @@ -32,11 +32,11 @@ typedef unsigned long gva_t; typedef u64 gpa_t; -typedef unsigned long gfn_t; +typedef u64 gfn_t; typedef unsigned long hva_t; typedef u64 hpa_t; -typedef unsigned long hfn_t; +typedef u64 hfn_t; typedef hfn_t pfn_t; diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c index 7795595..62a9caf 100644 --- a/virt/kvm/iommu.c +++ b/virt/kvm/iommu.c @@ -108,7 +108,7 @@ int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot) get_order(page_size), flags); if (r) { printk(KERN_ERR "kvm_iommu_map_address:" - "iommu failed to map pfn=%lx\n", pfn); + "iommu failed to map pfn=%llx\n", pfn); goto unmap_pages; } -- cgit v1.1