Skip to content

Commit

Permalink
KVM: Use u64 for frame data types
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Stephen Rothwell <[email protected]>
Signed-off-by: Marcelo Tosatti <[email protected]>
  • Loading branch information
Joerg Roedel authored and avikivity committed Aug 2, 2010
1 parent 8285541 commit 5689cc5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion arch/powerpc/kvm/44x_tlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions include/linux/kvm_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion virt/kvm/iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 5689cc5

Please sign in to comment.