[PATCH] iommu/qcom: add optional clock for TLB invalidate

2020-05-09 Thread Shawn Guo
On some SoCs like MSM8939 with A405 adreno, there is a gfx_tbu clock needs to be on while doing TLB invalidate. Otherwise, TLBSYNC status will not be correctly reflected, causing the system to go into a bad state. Add it as an optional clock, so that platforms that have this clock can pass it

[PATCH] iommu/amd: Fix get_acpihid_device_id

2020-05-09 Thread Raul E Rangel
acpi_dev_hid_uid_match expects a null pointer for UID if it doesn't exist. The acpihid_map_entry contains a char buffer for holding the UID. If no UID was provided in the IVRS table, this buffer will be zeroed. If we pass in a null string, acpi_dev_hid_uid_match will return false because it will

Re: [PATCH 1/4] dma-mapping: move the remaining DMA API calls out of line

2020-05-09 Thread Alexey Kardashevskiy
On 09/05/2020 18:19, Christoph Hellwig wrote: > On Tue, May 05, 2020 at 02:18:37PM +1000, Alexey Kardashevskiy wrote: >> >> >> On 17/04/2020 17:58, Christoph Hellwig wrote: >>> On Wed, Apr 15, 2020 at 09:21:37PM +1000, Alexey Kardashevskiy wrote: And the fact they were exported leaves

Re: [PATCH] iommu/qcom: add optional clock for TLB invalidate

2020-05-09 Thread Stanimir Varbanov
Hi Shawn, On 5/9/20 4:08 PM, Shawn Guo wrote: > On some SoCs like MSM8939 with A405 adreno, there is a gfx_tbu clock > needs to be on while doing TLB invalidate. Otherwise, TLBSYNC status > will not be correctly reflected, causing the system to go into a bad > state. Add it as an optional clock,

Re: [PATCH] iommu/amd: Fix get_acpihid_device_id

2020-05-09 Thread Andy Shevchenko
On Sat, May 9, 2020 at 1:50 AM Raul E Rangel wrote: > > acpi_dev_hid_uid_match expects a null pointer for UID if it doesn't acpi_dev_hid_uid_match() > exist. The acpihid_map_entry contains a char buffer for holding the > UID. If no UID was provided in the IVRS table, this buffer will be >

[PATCH v3 3/7] iommu/mediatek: Disable STANDARD_AXI_MODE in MISC_CTRL

2020-05-09 Thread Chao Hao
In order to improve performance, we always disable STANDARD_AXI_MODE in MISC_CTRL. Signed-off-by: Chao Hao --- drivers/iommu/mtk_iommu.c | 8 +++- drivers/iommu/mtk_iommu.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/mtk_iommu.c

[PATCH v3 7/7] iommu/mediatek: Add mt6779 basic support

2020-05-09 Thread Chao Hao
1. Start from mt6779, INVLDT_SEL move to offset=0x2c, so we add REG_MMU_INV_SEL_GEN2 definition and mt6779 uses it. 2. Change PROTECT_PA_ALIGN from 128 byte to 256 byte. 3. For REG_MMU_CTRL_REG register, we only need to change bit[2:0], others bits keep default value, ex: enable victim tlb.

[PATCH v3 2/7] iommu/mediatek: Rename the register STANDARD_AXI_MODE(0x48) to MISC_CTRL

2020-05-09 Thread Chao Hao
For iommu offset=0x48 register, only the previous mt8173/mt8183 use the name STANDARD_AXI_MODE, all the latest SoC extend the register more feature by different bits, for example: axi_mode, in_order_en, coherent_en and so on. So rename REG_MMU_MISC_CTRL may be more proper. This patch only rename

[PATCH v3 00/07] MT6779 IOMMU SUPPORT

2020-05-09 Thread Chao Hao
This patchset adds mt6779 iommu support. mt6779 has two iommus, they are MM_IOMMU(M4U) and APU_IOMMU which used ARM Short-Descriptor translation format. The mt6779's MM_IOMMU-SMI and APU_IOMMU HW diagram is as below, it is only a brief diagram: EMI

[PATCH v3 6/7] iommu/mediatek: Add REG_MMU_WR_LEN definition preparing for mt6779

2020-05-09 Thread Chao Hao
Some platforms(ex: mt6779) have a new register called by REG_MMU_WR_LEN to improve performance. This patch add this register definition. Signed-off-by: Chao Hao --- drivers/iommu/mtk_iommu.c | 10 ++ drivers/iommu/mtk_iommu.h | 2 ++ 2 files changed, 12 insertions(+) diff --git

[PATCH v3 5/7] iommu/mediatek: Add sub_comm id in translation fault

2020-05-09 Thread Chao Hao
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 variable,

[PATCH v3 1/7] dt-bindings: mediatek: Add bindings for MT6779

2020-05-09 Thread Chao Hao
This patch adds description for MT6779 IOMMU. MT6779 has two iommus, they are mm_iommu and apu_iommu which both use ARM Short-Descriptor translation format. In addition, mm_iommu and apu_iommu are two independent HW instance , we need to set them separately. The MT6779 IOMMU hardware diagram is

[PATCH v3 4/7] iommu/mediatek: Move inv_sel_reg into the plat_data

2020-05-09 Thread Chao Hao
For mt6779, MMU_INVLDT_SEL register's offset is changed from 0x38 to 0x2c, so we can put inv_sel_reg in the plat_data to use it. In addition, we renamed it to REG_MMU_INV_SEL_GEN1 and use it before mt6779. Signed-off-by: Chao Hao --- drivers/iommu/mtk_iommu.c | 9 ++---

Re: [PATCH 1/4] dma-mapping: move the remaining DMA API calls out of line

2020-05-09 Thread Christoph Hellwig
On Tue, May 05, 2020 at 02:18:37PM +1000, Alexey Kardashevskiy wrote: > > > On 17/04/2020 17:58, Christoph Hellwig wrote: > > On Wed, Apr 15, 2020 at 09:21:37PM +1000, Alexey Kardashevskiy wrote: > >> And the fact they were exported leaves possibility that there is a > >> driver somewhere