qemu-irix/target-ppc
David Gibson d928541b51 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-01-12 18:30:51 +01:00
..
STATUS Fix typos in comments (chek -> check) 2011-05-22 22:31:45 +01:00
cpu.h ppc: Alter CPU state to mask out TCG unimplemented instructions as appropriate 2011-10-31 02:57:56 +01:00
helper.c pseries: Support SMT systems for KVM Book3S-HV 2011-10-30 17:11:53 +01:00
helper.h target-ppc: remove old CONFIG_SOFTFLOAT #ifdef 2011-06-03 16:07:48 +02:00
helper_regs.h
kvm.c pseries: Don't try to munmap() a malloc()ed TCE table 2012-01-12 18:30:51 +01:00
kvm_ppc.c PPC: KVM: Remove kvmppc_read_host_property 2011-10-06 09:43:35 +02:00
kvm_ppc.h ppc: Fix up usermode only builds 2011-10-30 20:03:27 +01:00
machine.c PPC: move TLBs to their own arrays 2011-06-17 02:58:37 +02:00
mfrom_table.c
mfrom_table_gen.c
op_helper.c softmmu_header: pass CPUState to tlb_fill 2011-10-01 09:31:26 +00:00
translate.c PPC: Fix for the gdb single step problem on an rfi instruction 2011-11-11 17:33:58 +01:00
translate_init.c ppc: Alter CPU state to mask out TCG unimplemented instructions as appropriate 2011-10-31 02:57:56 +01:00