linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] firmware: tegra: bpmp: do only aligned access to IPC memory area
@ 2022-06-22 13:22 Mikko Perttunen
  2022-06-22 13:23 ` [PATCH 2/2] arm64: tegra: Mark BPMP channels as no-memory-wc Mikko Perttunen
  0 siblings, 1 reply; 4+ messages in thread
From: Mikko Perttunen @ 2022-06-22 13:22 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter
  Cc: Timo Alho, Mikko Perttunen, Greg Kroah-Hartman,
	Mian Yousaf Kaukab, linux-tegra, linux-kernel

From: Timo Alho <talho@nvidia.com>

Use memcpy_toio and memcpy_fromio variants of memcpy to guarantee
no unaligned access to IPC memory area. This is to allow the IPC
memory to be mapped as Device memory to further suppress speculative
reads from happening within the 64kB memory area above the IPC memory
when 64kB memory pages are used.

Signed-off-by: Timo Alho <talho@nvidia.com>
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
---
 drivers/firmware/tegra/bpmp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/firmware/tegra/bpmp.c b/drivers/firmware/tegra/bpmp.c
index 5654c5e9862b..037db21de510 100644
--- a/drivers/firmware/tegra/bpmp.c
+++ b/drivers/firmware/tegra/bpmp.c
@@ -201,7 +201,7 @@ static ssize_t __tegra_bpmp_channel_read(struct tegra_bpmp_channel *channel,
 	int err;
 
 	if (data && size > 0)
-		memcpy(data, channel->ib->data, size);
+		memcpy_fromio(data, channel->ib->data, size);
 
 	err = tegra_bpmp_ack_response(channel);
 	if (err < 0)
@@ -245,7 +245,7 @@ static ssize_t __tegra_bpmp_channel_write(struct tegra_bpmp_channel *channel,
 	channel->ob->flags = flags;
 
 	if (data && size > 0)
-		memcpy(channel->ob->data, data, size);
+		memcpy_toio(channel->ob->data, data, size);
 
 	return tegra_bpmp_post_request(channel);
 }
@@ -420,7 +420,7 @@ void tegra_bpmp_mrq_return(struct tegra_bpmp_channel *channel, int code,
 	channel->ob->code = code;
 
 	if (data && size > 0)
-		memcpy(channel->ob->data, data, size);
+		memcpy_toio(channel->ob->data, data, size);
 
 	err = tegra_bpmp_post_response(channel);
 	if (WARN_ON(err < 0))
-- 
2.36.1


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

end of thread, other threads:[~2022-06-23  9:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-22 13:22 [PATCH 1/2] firmware: tegra: bpmp: do only aligned access to IPC memory area Mikko Perttunen
2022-06-22 13:23 ` [PATCH 2/2] arm64: tegra: Mark BPMP channels as no-memory-wc Mikko Perttunen
2022-06-22 13:29   ` Mikko Perttunen
2022-06-23  9:36     ` Yousaf Kaukab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).