🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
1 messages
1 total messages Started by Yicheng Zhong Wed, 11 Nov 2026 09:34
[RFC net-next 2/2] octeontx2-af: cn20k: do not phys_to_virt() the mailbox base
#14462
Author: Yicheng Zhong
Date: Wed, 11 Nov 2026 09:34
45 lines
10337 bytes
qmem_alloc() stores the kernel virtual address returned by
otx2_dma_alloc_coherent() in ->base and the DMA address in ->iova, so ->base
is already addressable.  cn20k_rvu_get_mbox_regions() passes it through
phys_to_virt() before handing it to otx2_mbox_regions_init(), which then
dereferences the result as a pointer, and on arm64 phys_to_virt() subtracts
PHYS_OFFSET and adds PAGE_OFFSET, so a virtual address goes in and something
outside the linear map comes out.

Use ->base directly, since the memory the AF wants is the RAM it allocated.
If ->base is meant to hold a physical address on this path then the
assignment in qmem_alloc() is what should change instead, and we would like
to know which of the two is intended.

Fixes: f8909d3dd554 ("octeontx2-af: CN20K mbox implementation for AF's VF")
Signed-off-by: Yicheng Zhong <zhongyicheng2025@iscas.ac.cn>
Signed-off-by: Yicheng Zhong <zhongyicheng241@mails.ucas.ac.cn>
---
 drivers/net/ethernet/marvell/octeontx2/af/cn20k/mbox_init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cn20k/mbox_init.c b/drivers/net/ethernet/marvell/octeontx2/af/cn20k/mbox_init.c
index 01f32adac59..6908d7ff7fb 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/cn20k/mbox_init.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/cn20k/mbox_init.c
@@ -240,7 +240,7 @@ int cn20k_rvu_get_mbox_regions(struct rvu *rvu, void **mbox_addr,
 			if (!test_bit(region, pf_bmap))
 				continue;
 
-			bar = (u64)phys_to_virt((u64)rvu->ng_rvu->vf_mbox_addr->base);
+			bar = (u64)rvu->ng_rvu->vf_mbox_addr->base;
 			bar += region * MBOX_SIZE;
 			mbox_addr[region] = (void *)bar;
 
@@ -254,7 +254,7 @@ int cn20k_rvu_get_mbox_regions(struct rvu *rvu, void **mbox_addr,
 		if (!test_bit(region, pf_bmap))
 			continue;
 
-		bar = (u64)phys_to_virt((u64)rvu->ng_rvu->pf_mbox_addr->base);
+		bar = (u64)rvu->ng_rvu->pf_mbox_addr->base;
 		bar += region * MBOX_SIZE;
 
 		mbox_addr[region] = (void *)bar;
-- 
2.43.0
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads