All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] soc: qcom: cmd-db: map shared memory as WT, not WB
@ 2024-03-27 20:09 Volodymyr Babchuk
  2024-03-27 20:45 ` Konrad Dybcio
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Volodymyr Babchuk @ 2024-03-27 20:09 UTC (permalink / raw)
  Cc: Caleb Connolly, Volodymyr Babchuk, Bjorn Andersson,
	Konrad Dybcio, linux-arm-msm, linux-kernel

It appears that hardware does not like cacheable accesses to this
region. Trying to access this shared memory region as Normal Memory
leads to secure interrupt which causes an endless loop somewhere in
Trust Zone.

The only reason it is working right now is because Qualcomm Hypervisor
maps the same region as Non-Cacheable memory in Stage 2 translation
tables. The issue manifests if we want to use another hypervisor (like
Xen or KVM), which does not know anything about those specific
mappings. This patch fixes the issue by mapping the shared memory as
Write-Through. This removes dependency on correct mappings in Stage 2
tables.

I tested this on SA8155P with Xen.

Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
---
 drivers/soc/qcom/cmd-db.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/qcom/cmd-db.c b/drivers/soc/qcom/cmd-db.c
index a5fd68411bed5..dd5ababdb476c 100644
--- a/drivers/soc/qcom/cmd-db.c
+++ b/drivers/soc/qcom/cmd-db.c
@@ -324,7 +324,7 @@ static int cmd_db_dev_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	cmd_db_header = memremap(rmem->base, rmem->size, MEMREMAP_WB);
+	cmd_db_header = memremap(rmem->base, rmem->size, MEMREMAP_WT);
 	if (!cmd_db_header) {
 		ret = -ENOMEM;
 		cmd_db_header = NULL;
-- 
2.43.0

^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2024-04-11  8:41 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-27 20:09 [PATCH] soc: qcom: cmd-db: map shared memory as WT, not WB Volodymyr Babchuk
2024-03-27 20:45 ` Konrad Dybcio
2024-03-27 21:04   ` Volodymyr Babchuk
2024-03-27 21:06     ` Konrad Dybcio
2024-03-27 23:29       ` Caleb Connolly
2024-03-28  9:58         ` Stephan Gerhold
2024-03-29  0:40           ` Stephen Boyd
2024-04-11  3:54             ` Elliot Berman
2024-04-11  4:43               ` Stephen Boyd
2024-04-10 22:12           ` Volodymyr Babchuk
2024-04-11  8:02             ` Stephan Gerhold
2024-04-11  8:41               ` Stephen Boyd
2024-03-28 21:29         ` Volodymyr Babchuk
2024-03-28 11:12 ` Nikita Travkin
2024-03-28 14:06   ` Nikita Travkin
2024-03-28 12:01 ` Maulik Shah (mkshah)
2024-03-28 22:19   ` Volodymyr Babchuk
2024-03-29  4:52     ` Maulik Shah (mkshah)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.