Commit 1ecff515 authored by Kunkun Jiang's avatar Kunkun Jiang Committed by Zheng Zengkai
Browse files

iommu/io-pgtable-arm: Fix attach device failed when smmuv3 supports HTTU

virt inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I4V39D


CVE: NA

------------------------------

We will add IO_PGTABLE_QUIRK_ARM_HD to pgtbl_cfg->quirks when smmuv3
supports HTTU. However, this flag is not processed in the
arm_64_lpae_alloc_pgtable_s1. As a result, device can't be
attached. There are two similar flags: IO_PGTABLE_QUIRK_ARM_BBML1 and
IO_PGTABLE_QUIRK_ARM_BBML2. This patch solves this problem.

Fixes: 341497bb (iommu/io-pgtable-arm: Add quirk ARM_HD and ARM_BBMLx)
Reported-by: default avatarJunxin Chen <chenjunxin1@huawei.com>
Signed-off-by: default avatarKunkun Jiang <jiangkunkun@huawei.com>
Reviewed-by: default avatarKeqian Zhu <zhukeqian1@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent 5687af50
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -1172,7 +1172,10 @@ arm_64_lpae_alloc_pgtable_s1(struct io_pgtable_cfg *cfg, void *cookie)

	if (cfg->quirks & ~(IO_PGTABLE_QUIRK_ARM_NS |
			    IO_PGTABLE_QUIRK_NON_STRICT |
			    IO_PGTABLE_QUIRK_ARM_TTBR1))
			    IO_PGTABLE_QUIRK_ARM_TTBR1 |
			    IO_PGTABLE_QUIRK_ARM_HD |
			    IO_PGTABLE_QUIRK_ARM_BBML1 |
			    IO_PGTABLE_QUIRK_ARM_BBML2))
		return NULL;

	data = arm_lpae_alloc_pgtable(cfg);
@@ -1269,7 +1272,10 @@ arm_64_lpae_alloc_pgtable_s2(struct io_pgtable_cfg *cfg, void *cookie)
	typeof(&cfg->arm_lpae_s2_cfg.vtcr) vtcr = &cfg->arm_lpae_s2_cfg.vtcr;

	/* The NS quirk doesn't apply at stage 2 */
	if (cfg->quirks & ~(IO_PGTABLE_QUIRK_NON_STRICT))
	if (cfg->quirks & ~(IO_PGTABLE_QUIRK_NON_STRICT |
			    IO_PGTABLE_QUIRK_ARM_HD |
			    IO_PGTABLE_QUIRK_ARM_BBML1 |
			    IO_PGTABLE_QUIRK_ARM_BBML2))
		return NULL;

	data = arm_lpae_alloc_pgtable(cfg);