]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
iommu/mediatek: Fix protect memory setting
authorYong Wu <yong.wu@mediatek.com>
Sun, 18 Mar 2018 01:52:54 +0000 (09:52 +0800)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Mon, 27 Aug 2018 14:40:05 +0000 (16:40 +0200)
commite6a0d1297ea1387a09f163f3c426ae0807da0deb
treecf4cd23d78113e054e4683375379894a680eb70b
parent4e1742d6b04839f62b4a4ea7ef870f276e238538
iommu/mediatek: Fix protect memory setting

BugLink: http://bugs.launchpad.net/bugs/1786352
[ Upstream commit 70ca608b2ec6dafa6bb1c2b0691852fc78f8f717 ]

In MediaTek's IOMMU design, When a iommu translation fault occurs
(HW can NOT translate the destination address to a valid physical
address), the IOMMU HW output the dirty data into a special memory
to avoid corrupting the main memory, this is called "protect memory".
the register(0x114) for protect memory is a little different between
mt8173 and mt2712.

In the mt8173, bit[30:6] in the register represents [31:7] of the
physical address. In the 4GB mode, the register bit[31] should be 1.
While in the mt2712, the bits don't shift. bit[31:7] in the register
represents [31:7] in the physical address, and bit[1:0] in the
register represents bit[33:32] of the physical address if it has.

Fixes: e6dec9230862 ("iommu/mediatek: Add mt2712 IOMMU support")
Reported-by: Honghui Zhang <honghui.zhang@mediatek.com>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/iommu/mtk_iommu.c
drivers/iommu/mtk_iommu.h