qemu/target-ppc
David Gibson b5aec39672 pseries: Don't try to munmap() a malloc()ed TCE table
For the pseries machine, TCE (IOMMU) tables can either be directly
malloc()ed in qemu or, when running on a KVM which supports it, mmap()ed
from a KVM ioctl.  The latter option is used when available, because it
allows the (frequent bottlenext) H_PUT_TCE hypercall to be KVM accelerated.
However, even when KVM is persent, TCE acceleration is not always possible.
Only KVM HV supports this ioctl(), not KVM PR, or the kernel could run out
of contiguous memory to allocate the new table.  In this case we need to
fall back on the malloc()ed table.

When a device is removed, and we need to remove the TCE table, we need to
either munmap() or free() the table as appropriate for how it was
allocated.  The code is supposed to do that, but we buggily fail to
initialize the tcet->fd variable in the malloc() case, which is used as a
flag to determine which is the right choice.

This patch fixes the bug, and cleans up error messages relating to this
path while we're at it.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-03-15 13:12:11 +01:00
..
cpu.h Rename CPUState -> CPUArchState 2012-03-14 22:20:27 +01:00
helper_regs.h Replace always_inline with inline 2009-08-16 09:06:54 +00:00
helper.c target-ppc: Don't overuse CPUState 2012-03-14 22:20:25 +01:00
helper.h PPC: E500: Implement msgsnd 2012-02-02 02:47:47 +01:00
kvm_ppc.c PPC: KVM: Remove kvmppc_read_host_property 2011-10-06 09:43:35 +02:00
kvm_ppc.h target-ppc: Don't overuse CPUState 2012-03-14 22:20:25 +01:00
kvm.c pseries: Don't try to munmap() a malloc()ed TCE table 2012-03-15 13:12:11 +01:00
machine.c target-ppc: Don't overuse CPUState 2012-03-14 22:20:25 +01:00
mfrom_table_gen.c fix spelling in target sub directory 2011-12-02 10:50:57 +00:00
mfrom_table.c find -type f | xargs sed -i 's/[\t ]$//g' # on most files 2007-09-16 21:08:06 +00:00
op_helper.c target-ppc: Don't overuse CPUState 2012-03-14 22:20:25 +01:00
STATUS Fix typos in comments (chek -> check) 2011-05-22 22:31:45 +01:00
translate_init.c target-ppc: Don't overuse CPUState 2012-03-14 22:20:25 +01:00
translate.c target-ppc: Don't overuse CPUState 2012-03-14 22:20:25 +01:00