Message ID | 20230630062845.26606-4-hkelam@marvell.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 79ebb53772c95d3a6ae51b3c65f9985fdd430df6 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | octeontx2-af: MAC block fixes for CN10KB | expand |
Context | Check | Description |
---|---|---|
netdev/series_format | success | Posting correctly formatted |
netdev/tree_selection | success | Clearly marked for net |
netdev/fixes_present | success | Fixes tag present in non-next series |
netdev/header_inline | success | No static functions without inline keyword in header files |
netdev/build_32bit | success | Errors and warnings before: 8 this patch: 8 |
netdev/cc_maintainers | success | CCed 11 of 11 maintainers |
netdev/build_clang | fail | Errors and warnings before: 18 this patch: 18 |
netdev/verify_signedoff | success | Signed-off-by tag matches author and committer |
netdev/deprecated_api | success | None detected |
netdev/check_selftest | success | No net selftest shell script |
netdev/verify_fixes | success | Fixes tag looks correct |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 8 this patch: 8 |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 19 lines checked |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/source_inline | success | Was 0 now: 0 |
On Fri, Jun 30, 2023 at 11:58:44AM +0530, Hariprasad Kelam wrote: > with the addition of new MAC blocks like CN10K RPM and CN10KB > RPM_USX, LMACs are noncontiguous and CGX blocks are also > noncontiguous. But during RVU driver initialization, the driver > is assuming they are contiguous and trying to access > cgx or lmac with their id which is resulting in kernel panic. > > This patch fixes the issue by adding proper checks. > > [ 23.219150] pc : cgx_lmac_read+0x38/0x70 > [ 23.219154] lr : rvu_program_channels+0x3f0/0x498 > [ 23.223852] sp : ffff000100d6fc80 > [ 23.227158] x29: ffff000100d6fc80 x28: ffff00010009f880 x27: > 000000000000005a > [ 23.234288] x26: ffff000102586768 x25: 0000000000002500 x24: > fffffffffff0f000 > > Fixes: 91c6945ea1f9 ("octeontx2-af: cn10k: Add RPM MAC support") > Signed-off-by: Hariprasad Kelam <hkelam@marvell.com> > Signed-off-by: Sunil Goutham <sgoutham@marvell.com> Reviewed-by: Simon Horman <simon.horman@corigine.com>
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c index bd77152bb8d7..f4bdca662d61 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c @@ -169,6 +169,9 @@ void cgx_lmac_write(int cgx_id, int lmac_id, u64 offset, u64 val) { struct cgx *cgx_dev = cgx_get_pdata(cgx_id); + /* Software must not access disabled LMAC registers */ + if (!is_lmac_valid(cgx_dev, lmac_id)) + return; cgx_write(cgx_dev, lmac_id, offset, val); } @@ -176,6 +179,10 @@ u64 cgx_lmac_read(int cgx_id, int lmac_id, u64 offset) { struct cgx *cgx_dev = cgx_get_pdata(cgx_id); + /* Software must not access disabled LMAC registers */ + if (!is_lmac_valid(cgx_dev, lmac_id)) + return 0; + return cgx_read(cgx_dev, lmac_id, offset); }