Commit 5689cc53fa9d09b5bf41b1b1a7c90bd6c112ab40

Authored by Joerg Roedel
Committed by Avi Kivity
1 parent 828554136b

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 <joerg.roedel@amd.com>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

Showing 3 changed files with 5 additions and 4 deletions Side-by-side Diff

arch/powerpc/kvm/44x_tlb.c
... ... @@ -316,7 +316,8 @@
316 316 gfn = gpaddr >> PAGE_SHIFT;
317 317 new_page = gfn_to_page(vcpu->kvm, gfn);
318 318 if (is_error_page(new_page)) {
319   - printk(KERN_ERR "Couldn't get guest page for gfn %lx!\n", gfn);
  319 + printk(KERN_ERR "Couldn't get guest page for gfn %llx!\n",
  320 + (unsigned long long)gfn);
320 321 kvm_release_page_clean(new_page);
321 322 return;
322 323 }
include/linux/kvm_types.h
... ... @@ -32,11 +32,11 @@
32 32  
33 33 typedef unsigned long gva_t;
34 34 typedef u64 gpa_t;
35   -typedef unsigned long gfn_t;
  35 +typedef u64 gfn_t;
36 36  
37 37 typedef unsigned long hva_t;
38 38 typedef u64 hpa_t;
39   -typedef unsigned long hfn_t;
  39 +typedef u64 hfn_t;
40 40  
41 41 typedef hfn_t pfn_t;
42 42  
... ... @@ -108,7 +108,7 @@
108 108 get_order(page_size), flags);
109 109 if (r) {
110 110 printk(KERN_ERR "kvm_iommu_map_address:"
111   - "iommu failed to map pfn=%lx\n", pfn);
  111 + "iommu failed to map pfn=%llx\n", pfn);
112 112 goto unmap_pages;
113 113 }
114 114