linux-stable/arch
Douglas Anderson a54b7fa6b9 arm64: dts: qcom: sc7180: Mark SCM as dma-coherent for trogdor
Trogdor devices use firmware backed by TF-A instead of Qualcomm's
normal TZ. On TF-A we end up mapping memory as cacheable.
Specifically, you can see in Trogdor's TF-A code [1] in
qti_sip_mem_assign() that we call qti_mmap_add_dynamic_region() with
MT_RO_DATA. This translates down to MT_MEMORY instead of
MT_NON_CACHEABLE or MT_DEVICE. Apparently Qualcomm's normal TZ
implementation maps the memory as non-cacheable.

Let's add the "dma-coherent" attribute to the SCM for trogdor.

Adding "dma-coherent" like this fixes WiFi on sc7180-trogdor
devices. WiFi was broken as of commit 7bd6680b47 ("Revert "Revert
"arm64: dma: Drop cache invalidation from
arch_dma_prep_coherent()"""). Specifically at bootup we'd get:

 qcom_scm firmware:scm: Assign memory protection call failed -22
 qcom_rmtfs_mem 94600000.memory: assign memory failed
 qcom_rmtfs_mem: probe of 94600000.memory failed with error -22

From discussion on the mailing lists [2] and over IRC [3], it was
determined that we should always have been tagging the SCM as
dma-coherent on trogdor but that the old "invalidate" happened to make
things work most of the time. Tagging it properly like this is a much
more robust solution.

[1] https://chromium.googlesource.com/chromiumos/third_party/arm-trusted-firmware/+/refs/heads/firmware-trogdor-13577.B/plat/qti/common/src/qti_syscall.c
[2] https://lore.kernel.org/r/20230614165904.1.I279773c37e2c1ed8fbb622ca6d1397aea0023526@changeid
[3] https://oftc.irclog.whitequark.org/linux-msm/2023-06-15

Fixes: 7bd6680b47 ("Revert "Revert "arm64: dma: Drop cache invalidation from arch_dma_prep_coherent()""")
Fixes: 7ec3e67307 ("arm64: dts: qcom: sc7180-trogdor: add initial trogdor and lazor dt")
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Link: https://lore.kernel.org/r/20230616081440.v2.3.Ic62daa649b47b656b313551d646c4de9a7da4bd4@changeid
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
2023-06-22 12:20:12 -07:00
..
alpha Locking changes in v6.4: 2023-05-05 12:56:55 -07:00
arc Locking changes in v6.4: 2023-05-05 12:56:55 -07:00
arm ARM: dts: qcom: msm8974: remove superfluous "input-enable" 2023-05-17 19:20:17 -07:00
arm64 arm64: dts: qcom: sc7180: Mark SCM as dma-coherent for trogdor 2023-06-22 12:20:12 -07:00
csky arch/csky patches for 6.4 2023-05-04 12:25:05 -07:00
hexagon Locking changes in v6.4: 2023-05-05 12:56:55 -07:00
ia64 Locking changes in v6.4: 2023-05-05 12:56:55 -07:00
loongarch Locking changes in v6.4: 2023-05-05 12:56:55 -07:00
m68k Locking changes in v6.4: 2023-05-05 12:56:55 -07:00
microblaze Kconfig: introduce HAS_IOPORT option and select it as necessary 2023-04-05 22:15:19 +02:00
mips Locking changes in v6.4: 2023-05-05 12:56:55 -07:00
nios2 - Nick Piggin's "shoot lazy tlbs" series, to improve the peformance of 2023-04-27 19:42:02 -07:00
openrisc Locking changes in v6.4: 2023-05-05 12:56:55 -07:00
parisc Locking changes in v6.4: 2023-05-05 12:56:55 -07:00
powerpc Locking changes in v6.4: 2023-05-05 12:56:55 -07:00
riscv Locking changes in v6.4: 2023-05-05 12:56:55 -07:00
s390 s390: remove the unneeded select GCC12_NO_ARRAY_BOUNDS 2023-05-05 18:56:23 -07:00
sh Locking changes in v6.4: 2023-05-05 12:56:55 -07:00
sparc Locking changes in v6.4: 2023-05-05 12:56:55 -07:00
um This pull request contains the following changes for UML: 2023-05-03 19:02:03 -07:00
x86 Locking changes in v6.4: 2023-05-05 12:56:55 -07:00
xtensa Locking changes in v6.4: 2023-05-05 12:56:55 -07:00
.gitignore
Kconfig lazy tlb: shoot lazies, non-refcounting lazy tlb mm reference handling scheme 2023-03-28 16:20:08 -07:00