Skip to content

Commit 0daa55d

Browse files
harman-mrvldavem330
authored andcommitted
octeontx2-af: cn10k: debugfs for dumping LMTST map table
CN10k SoCs use atomic stores of up to 128 bytes to submit packets/instructions into co-processor cores. The enqueueing is performed using Large Memory Transaction Store (LMTST) operations. They allow for lockless enqueue operations - i.e., two different CPU cores can submit instructions to the same queue without needing to lock the queue or synchronize their accesses. This patch implements a new debugfs entry for dumping LMTST map table present on CN10K, as this might be very useful to debug any issue in case of shared LMTST region among multiple pci functions. Signed-off-by: Harman Kalra <hkalra@marvell.com> Signed-off-by: Bhaskara Budiredla <bbudiredla@marvell.com> Signed-off-by: Rakesh Babu <rsaladi2@marvell.com> Signed-off-by: Sunil Kovvuri Goutham <sgoutham@marvell.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 1910ccf commit 0daa55d

1 file changed

Lines changed: 94 additions & 0 deletions

File tree

‎drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c‎

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,96 @@ static const struct file_operations rvu_dbg_##name##_fops = { \
226226

227227
static void print_nix_qsize(struct seq_file *filp, struct rvu_pfvf *pfvf);
228228

229+
#define LMT_MAPTBL_ENTRY_SIZE 16
230+
/* Dump LMTST map table */
231+
static ssize_t rvu_dbg_lmtst_map_table_display(struct file *filp,
232+
char __user *buffer,
233+
size_t count, loff_t *ppos)
234+
{
235+
struct rvu *rvu = filp->private_data;
236+
u64 lmt_addr, val, tbl_base;
237+
int pf, vf, num_vfs, hw_vfs;
238+
void __iomem *lmt_map_base;
239+
int index = 0, off = 0;
240+
int bytes_not_copied;
241+
int buf_size = 10240;
242+
char *buf;
243+
244+
/* don't allow partial reads */
245+
if (*ppos != 0)
246+
return 0;
247+
248+
buf = kzalloc(buf_size, GFP_KERNEL);
249+
if (!buf)
250+
return -ENOSPC;
251+
252+
tbl_base = rvu_read64(rvu, BLKADDR_APR, APR_AF_LMT_MAP_BASE);
253+
254+
lmt_map_base = ioremap_wc(tbl_base, 128 * 1024);
255+
if (!lmt_map_base) {
256+
dev_err(rvu->dev, "Failed to setup lmt map table mapping!!\n");
257+
kfree(buf);
258+
return false;
259+
}
260+
261+
off += scnprintf(&buf[off], buf_size - 1 - off,
262+
"\n\t\t\t\t\tLmtst Map Table Entries");
263+
off += scnprintf(&buf[off], buf_size - 1 - off,
264+
"\n\t\t\t\t\t=======================");
265+
off += scnprintf(&buf[off], buf_size - 1 - off, "\nPcifunc\t\t\t");
266+
off += scnprintf(&buf[off], buf_size - 1 - off, "Table Index\t\t");
267+
off += scnprintf(&buf[off], buf_size - 1 - off,
268+
"Lmtline Base (word 0)\t\t");
269+
off += scnprintf(&buf[off], buf_size - 1 - off,
270+
"Lmt Map Entry (word 1)");
271+
off += scnprintf(&buf[off], buf_size - 1 - off, "\n");
272+
for (pf = 0; pf < rvu->hw->total_pfs; pf++) {
273+
off += scnprintf(&buf[off], buf_size - 1 - off, "PF%d \t\t\t",
274+
pf);
275+
276+
index = pf * rvu->hw->total_vfs * LMT_MAPTBL_ENTRY_SIZE;
277+
off += scnprintf(&buf[off], buf_size - 1 - off, " 0x%llx\t\t",
278+
(tbl_base + index));
279+
lmt_addr = readq(lmt_map_base + index);
280+
off += scnprintf(&buf[off], buf_size - 1 - off,
281+
" 0x%016llx\t\t", lmt_addr);
282+
index += 8;
283+
val = readq(lmt_map_base + index);
284+
off += scnprintf(&buf[off], buf_size - 1 - off, " 0x%016llx\n",
285+
val);
286+
/* Reading num of VFs per PF */
287+
rvu_get_pf_numvfs(rvu, pf, &num_vfs, &hw_vfs);
288+
for (vf = 0; vf < num_vfs; vf++) {
289+
index = (pf * rvu->hw->total_vfs * 16) +
290+
((vf + 1) * LMT_MAPTBL_ENTRY_SIZE);
291+
off += scnprintf(&buf[off], buf_size - 1 - off,
292+
"PF%d:VF%d \t\t", pf, vf);
293+
off += scnprintf(&buf[off], buf_size - 1 - off,
294+
" 0x%llx\t\t", (tbl_base + index));
295+
lmt_addr = readq(lmt_map_base + index);
296+
off += scnprintf(&buf[off], buf_size - 1 - off,
297+
" 0x%016llx\t\t", lmt_addr);
298+
index += 8;
299+
val = readq(lmt_map_base + index);
300+
off += scnprintf(&buf[off], buf_size - 1 - off,
301+
" 0x%016llx\n", val);
302+
}
303+
}
304+
off += scnprintf(&buf[off], buf_size - 1 - off, "\n");
305+
306+
bytes_not_copied = copy_to_user(buffer, buf, off);
307+
kfree(buf);
308+
309+
iounmap(lmt_map_base);
310+
if (bytes_not_copied)
311+
return -EFAULT;
312+
313+
*ppos = off;
314+
return off;
315+
}
316+
317+
RVU_DEBUG_FOPS(lmtst_map_table, lmtst_map_table_display, NULL);
318+
229319
/* Dumps current provisioning status of all RVU block LFs */
230320
static ssize_t rvu_dbg_rsrc_attach_status(struct file *filp,
231321
char __user *buffer,
@@ -2672,6 +2762,10 @@ void rvu_dbg_init(struct rvu *rvu)
26722762
debugfs_create_file("rsrc_alloc", 0444, rvu->rvu_dbg.root, rvu,
26732763
&rvu_dbg_rsrc_status_fops);
26742764

2765+
if (!is_rvu_otx2(rvu))
2766+
debugfs_create_file("lmtst_map_table", 0444, rvu->rvu_dbg.root,
2767+
rvu, &rvu_dbg_lmtst_map_table_fops);
2768+
26752769
if (!cgx_get_cgxcnt_max())
26762770
goto create;
26772771

0 commit comments

Comments
 (0)