From 221d059d15f1c8bd070a63fd45cd8d2598af5f99 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Sun, 23 May 2010 18:37:00 +0300 Subject: KVM: Update Red Hat copyrights Signed-off-by: Avi Kivity --- virt/kvm/iommu.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'virt/kvm/iommu.c') diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c index 96048ee9e39e..673c88a8efe9 100644 --- a/virt/kvm/iommu.c +++ b/virt/kvm/iommu.c @@ -16,6 +16,8 @@ * * Copyright (C) 2006-2008 Intel Corporation * Copyright IBM Corporation, 2008 + * Copyright 2010 Red Hat, Inc. and/or its affiliates. + * * Author: Allen M. Kay * Author: Weidong Han * Author: Ben-Ami Yassour -- cgit v1.2.2 From 95c87e2b4460a488ec7ce42f273893e410ab385a Mon Sep 17 00:00:00 2001 From: Sheng Yang Date: Thu, 1 Jul 2010 15:00:50 +0800 Subject: KVM: Fix IOMMU memslot reference warning This patch fixes the following warning. =================================================== [ INFO: suspicious rcu_dereference_check() usage. ] --------------------------------------------------- include/linux/kvm_host.h:259 invoked rcu_dereference_check() without protection! other info that might help us debug this: rcu_scheduler_active = 1, debug_locks = 0 no locks held by qemu-system-x86/29679. stack backtrace: Pid: 29679, comm: qemu-system-x86 Not tainted 2.6.35-rc3+ #200 Call Trace: [] lockdep_rcu_dereference+0xa8/0xb1 [] kvm_iommu_unmap_memslots+0xc9/0xde [kvm] [] kvm_iommu_unmap_guest+0x40/0x4e [kvm] [] kvm_arch_destroy_vm+0x1a/0x186 [kvm] [] kvm_put_kvm+0x110/0x167 [kvm] [] kvm_vcpu_release+0x18/0x1c [kvm] [] fput+0x22a/0x3a0 [] filp_close+0xb4/0xcd [] put_files_struct+0x1b7/0x36b [] ? put_files_struct+0x48/0x36b [] ? do_raw_spin_unlock+0x118/0x160 [] exit_files+0x6d/0x75 [] do_exit+0x47d/0xc60 [] ? _raw_spin_unlock_irq+0x30/0x36 [] do_group_exit+0xcf/0x134 [] get_signal_to_deliver+0x732/0x81d [] ? cpu_clock+0x4e/0x60 [] do_notify_resume+0x117/0xc43 [] ? trace_hardirqs_on+0xd/0xf [] ? sys_rt_sigtimedwait+0x2b5/0x3bf [] ? trace_hardirqs_off_thunk+0x3a/0x3c [] ? sysret_signal+0x5/0x3d [] int_signal+0x12/0x17 Signed-off-by: Sheng Yang Signed-off-by: Marcelo Tosatti --- virt/kvm/iommu.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'virt/kvm/iommu.c') diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c index 673c88a8efe9..779559552ce7 100644 --- a/virt/kvm/iommu.c +++ b/virt/kvm/iommu.c @@ -126,9 +126,10 @@ unmap_pages: static int kvm_iommu_map_memslots(struct kvm *kvm) { - int i, r = 0; + int i, idx, r = 0; struct kvm_memslots *slots; + idx = srcu_read_lock(&kvm->srcu); slots = kvm_memslots(kvm); for (i = 0; i < slots->nmemslots; i++) { @@ -136,6 +137,7 @@ static int kvm_iommu_map_memslots(struct kvm *kvm) if (r) break; } + srcu_read_unlock(&kvm->srcu, idx); return r; } @@ -285,15 +287,17 @@ static void kvm_iommu_put_pages(struct kvm *kvm, static int kvm_iommu_unmap_memslots(struct kvm *kvm) { - int i; + int i, idx; struct kvm_memslots *slots; + idx = srcu_read_lock(&kvm->srcu); slots = kvm_memslots(kvm); for (i = 0; i < slots->nmemslots; i++) { kvm_iommu_put_pages(kvm, slots->memslots[i].base_gfn, slots->memslots[i].npages); } + srcu_read_unlock(&kvm->srcu, idx); return 0; } -- cgit v1.2.2 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 --- virt/kvm/iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'virt/kvm/iommu.c') diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c index 779559552ce7..62a9caf0563c 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.2.2