[PATCH] initialize TCE tables

John Rose johnrose at austin.ibm.com
Sat Jun 11 06:06:56 EST 2005


It turns out that the previous patch is incorrect.  When running with
this patch, dynamic slot adds result in intermittent kernel warnings
about failed TCE hcalls.  

The patch fails to account for the firmware-defined offset of each iommu
table when initializing the table's TCEs.  Each iommu table has an
offset communicated by the ibm,dma-window property, and this needs to be
passed into tce_free().  With the patch as-is, dynamic adds result in
redundant clearing of the TCEs for offset 0, regardless of the offset of
the table in question.

Here's the correct patch, which I tested across multiple platforms and
multiple DLPAR operations.

Thanks-
John

Signed-off-by: John Rose <johnrose at austin.ibm.com>

diff -puN arch/ppc64/kernel/iommu.c~initialize_tces arch/ppc64/kernel/iommu.c
--- 2_6_linus_2/arch/ppc64/kernel/iommu.c~initialize_tces	2005-06-01 12:17:53.000000000 -0500
+++ 2_6_linus_2-johnrose/arch/ppc64/kernel/iommu.c	2005-06-10 14:46:27.000000000 -0500
@@ -423,6 +423,9 @@ struct iommu_table *iommu_init_table(str
 	tbl->it_largehint = tbl->it_halfpoint;
 	spin_lock_init(&tbl->it_lock);
 
+	/* Clear the hardware table in case firmware left allocations in it */
+	ppc_md.tce_free(tbl, tbl->it_offset, tbl->it_size);
+
 	if (!welcomed) {
 		printk(KERN_INFO "IOMMU table initialized, virtual merging %s\n",
 		       novmerge ? "disabled" : "enabled");

_




More information about the Linuxppc64-dev mailing list