Commit a4740b14 authored by Timo Alho's avatar Timo Alho Committed by Thierry Reding
Browse files

firmware: tegra: bpmp: Do only aligned access to IPC memory area



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 64 kB memory area above the IPC memory when 64 kB
memory pages are used.

Signed-off-by: default avatarTimo Alho <talho@nvidia.com>
Signed-off-by: default avatarMikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
parent f2906aa8
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -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))