Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pseries/iommu: Ensure TCEs are cleared with non-huge DDW

There are now two kinds of DMA windows that might be presented by
PowerVM DDW support -- huge windows (that can map all of system memory
regardless of the LPAR configuration) and non-huge windows (which
can't). They are implemented slightly differently in PowerVM, and thus
have different characteristics. The most obvious is that slot isolate
doesn't clear the TCEs/window for us with non-huge windows. Thus, when a
DLPAR operation occurs on a slot using a non-huge window, TCEs are still
present (the notifier chain doesn't currently remove them explicitly)
and the DLPAR fails. Fix this by calling remove_ddw() first, which will
unmap the DDW TCEs.

Note: a corresponding change to drmgr is needed to actually successfully
DLPAR, such that the device-tree update (which causes the notifier chain
to fire) occurs before slot isolate.

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

authored by

Nishanth Aravamudan and committed by
Benjamin Herrenschmidt
71cf1def 22b38298

+1 -10
+1 -10
arch/powerpc/platforms/pseries/iommu.c
··· 1296 1296 1297 1297 switch (action) { 1298 1298 case OF_RECONFIG_DETACH_NODE: 1299 + remove_ddw(np); 1299 1300 if (pci && pci->iommu_table) 1300 1301 iommu_free_table(pci->iommu_table, np->full_name); 1301 1302 ··· 1309 1308 } 1310 1309 } 1311 1310 spin_unlock(&direct_window_list_lock); 1312 - 1313 - /* 1314 - * Because the notifier runs after isolation of the 1315 - * slot, we are guaranteed any DMA window has already 1316 - * been revoked and the TCEs have been marked invalid, 1317 - * so we don't need a call to remove_ddw(np). However, 1318 - * if an additional notifier action is added before the 1319 - * isolate call, we should update this code for 1320 - * completeness with such a call. 1321 - */ 1322 1311 break; 1323 1312 default: 1324 1313 err = NOTIFY_DONE;