* [PATCH net] net: ipa: don't assume SMEM is page-aligned
@ 2022-08-18 13:42 Alex Elder
2022-08-23 1:30 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Alex Elder @ 2022-08-18 13:42 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni
Cc: mka, evgreen, bjorn.andersson, quic_cpratapa, quic_avuyyuru,
quic_jponduru, quic_subashab, elder, netdev, linux-arm-msm,
linux-kernel
In ipa_smem_init(), a Qualcomm SMEM region is allocated (if needed)
and then its virtual address is fetched using qcom_smem_get(). The
physical address associated with that region is also fetched.
The physical address is adjusted so that it is page-aligned, and an
attempt is made to update the size of the region to compensate for
any non-zero adjustment.
But that adjustment isn't done properly. The physical address is
aligned twice, and as a result the size is never actually adjusted.
Fix this by *not* aligning the "addr" local variable, and instead
making the "phys" local variable be the adjusted "addr" value.
Fixes: a0036bb413d5b ("net: ipa: define SMEM memory region for IPA")
Signed-off-by: Alex Elder <elder@linaro.org>
---
drivers/net/ipa/ipa_mem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ipa/ipa_mem.c b/drivers/net/ipa/ipa_mem.c
index 1e9eae208e44f..53a1dbeaffa6d 100644
--- a/drivers/net/ipa/ipa_mem.c
+++ b/drivers/net/ipa/ipa_mem.c
@@ -568,7 +568,7 @@ static int ipa_smem_init(struct ipa *ipa, u32 item, size_t size)
}
/* Align the address down and the size up to a page boundary */
- addr = qcom_smem_virt_to_phys(virt) & PAGE_MASK;
+ addr = qcom_smem_virt_to_phys(virt);
phys = addr & PAGE_MASK;
size = PAGE_ALIGN(size + addr - phys);
iova = phys; /* We just want a direct mapping */
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] net: ipa: don't assume SMEM is page-aligned
2022-08-18 13:42 [PATCH net] net: ipa: don't assume SMEM is page-aligned Alex Elder
@ 2022-08-23 1:30 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-08-23 1:30 UTC (permalink / raw)
To: Alex Elder
Cc: davem, edumazet, kuba, pabeni, mka, evgreen, bjorn.andersson,
quic_cpratapa, quic_avuyyuru, quic_jponduru, quic_subashab,
elder, netdev, linux-arm-msm, linux-kernel
Hello:
This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:
On Thu, 18 Aug 2022 08:42:05 -0500 you wrote:
> In ipa_smem_init(), a Qualcomm SMEM region is allocated (if needed)
> and then its virtual address is fetched using qcom_smem_get(). The
> physical address associated with that region is also fetched.
>
> The physical address is adjusted so that it is page-aligned, and an
> attempt is made to update the size of the region to compensate for
> any non-zero adjustment.
>
> [...]
Here is the summary with links:
- [net] net: ipa: don't assume SMEM is page-aligned
https://git.kernel.org/netdev/net/c/b8d4380365c5
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-08-23 1:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-18 13:42 [PATCH net] net: ipa: don't assume SMEM is page-aligned Alex Elder
2022-08-23 1:30 ` patchwork-bot+netdevbpf
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).