]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
iommu/mediatek: Add sub_comm id in translation fault
authorChao Hao <chao.hao@mediatek.com>
Fri, 3 Jul 2020 04:41:23 +0000 (12:41 +0800)
committerJoerg Roedel <jroedel@suse.de>
Fri, 10 Jul 2020 14:13:11 +0000 (16:13 +0200)
commit37276e00da7d3a0d643d325aef81b7283fe23010
tree4c3247f8a29d37a961b9bb289e6180ad8e369f71
parentb053bc7183c86dc52e68e9891d269992e79a5251
iommu/mediatek: Add sub_comm id in translation fault

The max larb number that a iommu HW support is 8(larb0~larb7 in the below
diagram).
If the larb's number is over 8, we use a sub_common for merging
several larbs into one larb. At this case, we will extend larb_id:
bit[11:9] means common-id;
bit[8:7] means subcommon-id;
>From these two variables, we could get the real larb number when
translation fault happen.
The diagram is as below:
 EMI
  |
IOMMU
  |
           -----------------
   |               |
common1    common0
   |    |
   -----------------
  |
             smi common
  |
  ------------------------------------
  |       |       |       |     |    |
 3'd0    3'd1    3'd2    3'd3  ...  3'd7   <-common_id(max is 8)
  |       |       |       |     |    |
Larb0   Larb1     |     Larb3  ... Larb7
  |
    smi sub common
  |
     --------------------------
     |        |       |       |
    2'd0     2'd1    2'd2    2'd3   <-sub_common_id(max is 4)
     |        |       |       |
   Larb8    Larb9   Larb10  Larb11

In this patch we extend larb_remap[] to larb_remap[8][4] for this.
larb_remap[x][y]: x means common-id above, y means subcommon_id above.

We can also distinguish if the M4U HW has sub_common by HAS_SUB_COMM
macro.

Signed-off-by: Chao Hao <chao.hao@mediatek.com>
Reviewed-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Link: https://lore.kernel.org/r/20200703044127.27438-7-chao.hao@mediatek.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/mtk_iommu.c
drivers/iommu/mtk_iommu.h