diff options
author | Gaurav Batra <gbatra@linux.vnet.ibm.com> | 2023-06-13 12:16:41 -0500 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2023-06-26 14:57:31 +1000 |
commit | d61cd13e732c0eaa7d66b45edb2d0de8eab65a1e (patch) | |
tree | d963c5d50e6222c8d3d5d57cef0670d6cfbd144a /scripts | |
parent | bfd8d989210cb6bb1c8e87b7c525831dceb91418 (diff) | |
download | linux-stable-d61cd13e732c0eaa7d66b45edb2d0de8eab65a1e.tar.gz linux-stable-d61cd13e732c0eaa7d66b45edb2d0de8eab65a1e.tar.bz2 linux-stable-d61cd13e732c0eaa7d66b45edb2d0de8eab65a1e.zip |
powerpc/iommu: TCEs are incorrectly manipulated with DLPAR add/remove of memory
When memory is dynamically added/removed, iommu_mem_notifier() is invoked. This
routine traverses through all the DMA windows (DDW only, not default windows)
to add/remove "direct" TCE mappings. The routines for this purpose are
tce_clearrange_multi_pSeriesLP() and tce_clearrange_multi_pSeriesLP().
Both these routines are designed for Direct mapped DMA windows only.
The issue is that there could be some DMA windows in the list which are not
"direct" mapped. Calling these routines will either,
1) remove some dynamically mapped TCEs, Or
2) try to add TCEs which are out of bounds and HCALL returns H_PARAMETER
Here are the side affects when these routines are incorrectly invoked for
"dynamically" mapped DMA windows.
tce_setrange_multi_pSeriesLP()
This adds direct mapped TCEs. Now, this could invoke HCALL to add TCEs with
out-of-bound range. In this scenario, HCALL will return H_PARAMETER and DLAR
ADD of memory will fail.
tce_clearrange_multi_pSeriesLP()
This will remove range of TCEs. The TCE range that is calculated, depending on
the memory range being added, could infact be mapping some other memory
address (for dynamic DMA window scenario). This will wipe out those TCEs.
The solution is for iommu_mem_notifier() to only invoke these routines for
"direct" mapped DMA windows.
Signed-off-by: Gaurav Batra <gbatra@linux.vnet.ibm.com>
Reviewed-by: Brian King <brking@linux.vnet.ibm.com>
[mpe: Initialise direct at allocation time in ddw_list_new_entry()]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230613171641.15641-1-gbatra@linux.vnet.ibm.com
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions