summaryrefslogtreecommitdiffstats
path: root/hw/spapr_iommu.c
diff options
context:
space:
mode:
authorDavid Gibson2012-09-12 18:57:14 +0200
committerAlexander Graf2012-10-04 15:54:17 +0200
commiteddeed26ac83392053aef823a341f643ea8e3d2f (patch)
tree9432d42a4d3b48c022aa4cc29c3808b7853e87b9 /hw/spapr_iommu.c
parentpseries: Clear TCE and signal state when resetting PAPR VIO devices (diff)
downloadqemu-eddeed26ac83392053aef823a341f643ea8e3d2f.tar.gz
qemu-eddeed26ac83392053aef823a341f643ea8e3d2f.tar.xz
qemu-eddeed26ac83392053aef823a341f643ea8e3d2f.zip
pseries: Reset emulated PCI TCE tables on system reset
The emulated PCI host bridge on the pseries machine incorporates an IOMMU (PAPR TCE table). Currently the mappings in this IOMMU are not cleared when we reset the system. This patch fixes this bug. To do this it adds a new reset function to the IOMMU emulation code. The VIO devices already reset their TCE tables, but they do so by destroying and re-creating their DMA context. This doesn't work for the PCI host bridge, because the infrastructure for PCI IOMMUs has already copied/cached the DMA pointer context into the subordinate PCI device structures. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'hw/spapr_iommu.c')
-rw-r--r--hw/spapr_iommu.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/hw/spapr_iommu.c b/hw/spapr_iommu.c
index 53b731773a..216aa06809 100644
--- a/hw/spapr_iommu.c
+++ b/hw/spapr_iommu.c
@@ -162,6 +162,17 @@ void spapr_tce_free(DMAContext *dma)
}
}
+void spapr_tce_reset(DMAContext *dma)
+{
+ if (dma) {
+ sPAPRTCETable *tcet = DO_UPCAST(sPAPRTCETable, dma, dma);
+ size_t table_size = (tcet->window_size >> SPAPR_TCE_PAGE_SHIFT)
+ * sizeof(sPAPRTCE);
+
+ memset(tcet->table, 0, table_size);
+ }
+}
+
static target_ulong put_tce_emu(sPAPRTCETable *tcet, target_ulong ioba,
target_ulong tce)
{