Commit 8544c8e1 authored by Zhang Zekun's avatar Zhang Zekun
Browse files

iommu/arm-smmu-v3: Add a SYNC command to avoid broken page table prefetch

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I8MVBZ


CVE: NA

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

On Hisilicon LINXICORE9100 cores, SMMU pagetable prefetch features may
prefetch and use a invalid PTE even the PTE is valid at that time. This
will cause the device trigger fake pagefaults. If the SMMU works in
terminate mode, transactions which occur fake pagefaults will be aborted,
and could result in unexpected errors.

To fix this problem, we need to add a SYNC command after smmu has map a
iova, then smmu will always try to get the newest PTE.

Signed-off-by: default avatarZhang Zekun <zhangzekun11@huawei.com>
parent a711cdaf
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -156,6 +156,8 @@ stable kernels.
+----------------+-----------------+-----------------+-----------------------------+
| Hisilicon      | LINXICORE9100   | #162100125      | HISILICON_ERRATUM_162100125 |
+----------------+-----------------+-----------------+-----------------------------+
| Hisilicon      | LINXICORE9100   | #162100602      | HISILICON_ERRATUM_162100602 |
+----------------+-----------------+-----------------+-----------------------------+
| Hisilicon      | HIP09           | #162102203      | HISILICON_ERRATUM_162102203 |
+----------------+-----------------+-----------------+-----------------------------+
| Qualcomm Tech. | Kryo/Falkor v1  | E1003           | QCOM_FALKOR_ERRATUM_1003    |
+13 −0
Original line number Diff line number Diff line
@@ -836,6 +836,19 @@ config HISILICON_ERRATUM_162102203

	  If unsure, say N.

config HISILICON_ERRATUM_162100602
	bool "Hisilicon erratum 162100602"
	depends on ARM_SMMU_V3
	default y
	help
	 On Hisilicon LINXICORE9100 cores, SMMU pagetable prefetch features may
	 prefetch and use a invalid PTE even the PTE is valid at that time. This
	 will cause the device trigger fake pagefaults. If the SMMU works in
	 terminate mode, transactions which occur fake pagefaults will be aborted,
	 and could result in unexpected errors.

	 If unsure, say Y.

config QCOM_FALKOR_ERRATUM_1003
	bool "Falkor E1003: Incorrect translation due to ASID change"
	default y
+1 −0
Original line number Diff line number Diff line
@@ -404,6 +404,7 @@ CONFIG_HISILICON_ERRATUM_1980005=y
CONFIG_HISILICON_ERRATUM_162100801=y
CONFIG_HISILICON_ERRATUM_162100125=y
CONFIG_HISILICON_ERRATUM_162102203=y
CONFIG_HISILICON_ERRATUM_162100602=y
CONFIG_QCOM_FALKOR_ERRATUM_1003=y
CONFIG_QCOM_FALKOR_ERRATUM_1009=y
CONFIG_QCOM_QDF2400_ERRATUM_0065=y
+1 −0
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@
#define ARM64_HAS_PBHA_STAGE2			73
#define ARM64_SME				74
#define ARM64_SME_FA64				75
#define ARM64_WORKAROUND_HISILICON_ERRATUM_162100602	76

#define ARM64_NCAPS				80

+14 −0
Original line number Diff line number Diff line
@@ -331,6 +331,13 @@ static const struct midr_range hisilicon_erratum_162100125_cpus[] = {
};
#endif

#ifdef CONFIG_HISILICON_ERRATUM_162100602
static const struct midr_range hisilicon_erratum_162100602_cpus[] = {
	MIDR_REV(MIDR_HISI_LINXICORE9100, 0, 0),
	{},
};
#endif

#ifdef CONFIG_QCOM_FALKOR_ERRATUM_1003
static const struct arm64_cpu_capabilities qcom_erratum_1003_list[] = {
	{
@@ -533,6 +540,13 @@ const struct arm64_cpu_capabilities arm64_errata[] = {
		ERRATA_MIDR_RANGE_LIST(hisilicon_erratum_162100125_cpus),
	},
#endif
#ifdef CONFIG_HISILICON_ERRATUM_162100602
	{
		.desc = "Hisilicon erratum 162100602",
		.capability = ARM64_WORKAROUND_HISILICON_ERRATUM_162100602,
		ERRATA_MIDR_RANGE_LIST(hisilicon_erratum_162100602_cpus),
	},
#endif
#ifdef CONFIG_QCOM_FALKOR_ERRATUM_1003
	{
		.desc = "Qualcomm Technologies Falkor/Kryo erratum 1003",
Loading