Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: mvpp2: clear BM pool before initialization

Register value persist after booting the kernel using
kexec which results in kernel panic. Thus clear the
BM pool registers before initialisation to fix the issue.

Fixes: 3f518509dedc ("ethernet: Add new driver for Marvell Armada 375 network unit")
Signed-off-by: Jenishkumar Maheshbhai Patel <jpatel2@marvell.com>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Link: https://lore.kernel.org/r/20240119035914.2595665-1-jpatel2@marvell.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Jenishkumar Maheshbhai Patel and committed by
Jakub Kicinski
9f538b41 a5f5eee2

+26 -1
+26 -1
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
··· 614 614 mvpp2_write(priv, MVPP22_BM_POOL_BASE_ADDR_HIGH_REG, val); 615 615 } 616 616 617 + /* Cleanup pool before actual initialization in the OS */ 618 + static void mvpp2_bm_pool_cleanup(struct mvpp2 *priv, int pool_id) 619 + { 620 + unsigned int thread = mvpp2_cpu_to_thread(priv, get_cpu()); 621 + u32 val; 622 + int i; 623 + 624 + /* Drain the BM from all possible residues left by firmware */ 625 + for (i = 0; i < MVPP2_BM_POOL_SIZE_MAX; i++) 626 + mvpp2_thread_read(priv, thread, MVPP2_BM_PHY_ALLOC_REG(pool_id)); 627 + 628 + put_cpu(); 629 + 630 + /* Stop the BM pool */ 631 + val = mvpp2_read(priv, MVPP2_BM_POOL_CTRL_REG(pool_id)); 632 + val |= MVPP2_BM_STOP_MASK; 633 + mvpp2_write(priv, MVPP2_BM_POOL_CTRL_REG(pool_id), val); 634 + } 635 + 617 636 static int mvpp2_bm_init(struct device *dev, struct mvpp2 *priv) 618 637 { 619 638 enum dma_data_direction dma_dir = DMA_FROM_DEVICE; 620 639 int i, err, poolnum = MVPP2_BM_POOLS_NUM; 621 640 struct mvpp2_port *port; 641 + 642 + if (priv->percpu_pools) 643 + poolnum = mvpp2_get_nrxqs(priv) * 2; 644 + 645 + /* Clean up the pool state in case it contains stale state */ 646 + for (i = 0; i < poolnum; i++) 647 + mvpp2_bm_pool_cleanup(priv, i); 622 648 623 649 if (priv->percpu_pools) { 624 650 for (i = 0; i < priv->port_count; i++) { ··· 655 629 } 656 630 } 657 631 658 - poolnum = mvpp2_get_nrxqs(priv) * 2; 659 632 for (i = 0; i < poolnum; i++) { 660 633 /* the pool in use */ 661 634 int pn = i / (poolnum / 2);