iommu/mediatek: Add mutex for m4u_group and m4u_dom in data
authorYong Wu <yong.wu@mediatek.com>
Tue, 3 May 2022 07:13:58 +0000 (15:13 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jun 2022 08:23:14 +0000 (10:23 +0200)
commit596f59d3369175142f967ae8bf76ed768b202888
treeb04cf20456ca2b128617430e5a3c74072417db8f
parent053465ab20dcd324a43a1811ee98e5721e6a3e65
iommu/mediatek: Add mutex for m4u_group and m4u_dom in data

[ Upstream commit 0e5a3f2e630b28e88e018655548212ef8eb4dfcb ]

Add a mutex to protect the data in the structure mtk_iommu_data,
like ->"m4u_group" ->"m4u_dom". For the internal data, we should
protect it in ourselves driver. Add a mutex for this.
This could be a fix for the multi-groups support.

Fixes: c3045f39244e ("iommu/mediatek: Support for multi domains")
Signed-off-by: Yunfei Wang <yf.wang@mediatek.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Link: https://lore.kernel.org/r/20220503071427.2285-8-yong.wu@mediatek.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iommu/mtk_iommu.c
drivers/iommu/mtk_iommu.h