KVM: Use u64 for frame data types
authorJoerg Roedel <joerg.roedel@amd.com>
Thu, 1 Jul 2010 14:00:12 +0000 (16:00 +0200)
committerAvi Kivity <avi@redhat.com>
Mon, 2 Aug 2010 03:39:44 +0000 (06:39 +0300)
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 <joerg.roedel@amd.com>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
arch/powerpc/kvm/44x_tlb.c
include/linux/kvm_types.h
virt/kvm/iommu.c

index 812312542e50cd9b42d73df0b02168d5a678ac7e..9b9b5cdea840bcdfb87128687dab6f0d41726446 100644 (file)
@@ -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;
        }
index fb46efbeabec6978365e33389d29c7f4b3d27e4a..7ac0d4eee4306fd2ca211dbf9fec9de454b1d3fe 100644 (file)
 
 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;
 
index 779559552ce78e6f8441d1c8de0eeaeb72652a28..62a9caf0563c2205327245b2a1103f1bbff94e70 100644 (file)
@@ -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;
                }