Skip to content

Commit bf44fe4

Browse files
davejiangjonmason
authored andcommitted
NTB: Add split BAR output for debugfs stats
When split BAR is enabled, the driver needs to dump out the split BAR registers rather than the original 64bit BAR registers. Signed-off-by: Dave Jiang <[email protected]> Signed-off-by: Jon Mason <[email protected]>
1 parent fd839bf commit bf44fe4

File tree

1 file changed

+68
-15
lines changed

1 file changed

+68
-15
lines changed

drivers/ntb/hw/intel/ntb_hw_intel.c

Lines changed: 68 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -632,17 +632,36 @@ static ssize_t ndev_debugfs_read(struct file *filp, char __user *ubuf,
632632
off += scnprintf(buf + off, buf_size - off,
633633
"XLAT23 -\t\t%#018llx\n", u.v64);
634634

635-
u.v64 = ioread64(mmio + bar2_off(ndev->xlat_reg->bar2_xlat, 4));
636-
off += scnprintf(buf + off, buf_size - off,
637-
"XLAT45 -\t\t%#018llx\n", u.v64);
635+
if (ndev->bar4_split) {
636+
u.v32 = ioread32(mmio + bar2_off(ndev->xlat_reg->bar2_xlat, 4));
637+
off += scnprintf(buf + off, buf_size - off,
638+
"XLAT4 -\t\t\t%#06x\n", u.v32);
639+
640+
u.v32 = ioread32(mmio + bar2_off(ndev->xlat_reg->bar2_xlat, 5));
641+
off += scnprintf(buf + off, buf_size - off,
642+
"XLAT5 -\t\t\t%#06x\n", u.v32);
643+
} else {
644+
u.v64 = ioread64(mmio + bar2_off(ndev->xlat_reg->bar2_xlat, 4));
645+
off += scnprintf(buf + off, buf_size - off,
646+
"XLAT45 -\t\t%#018llx\n", u.v64);
647+
}
638648

639649
u.v64 = ioread64(mmio + bar2_off(ndev->xlat_reg->bar2_limit, 2));
640650
off += scnprintf(buf + off, buf_size - off,
641651
"LMT23 -\t\t\t%#018llx\n", u.v64);
642652

643-
u.v64 = ioread64(mmio + bar2_off(ndev->xlat_reg->bar2_limit, 4));
644-
off += scnprintf(buf + off, buf_size - off,
645-
"LMT45 -\t\t\t%#018llx\n", u.v64);
653+
if (ndev->bar4_split) {
654+
u.v32 = ioread32(mmio + bar2_off(ndev->xlat_reg->bar2_limit, 4));
655+
off += scnprintf(buf + off, buf_size - off,
656+
"LMT4 -\t\t\t%#06x\n", u.v32);
657+
u.v32 = ioread32(mmio + bar2_off(ndev->xlat_reg->bar2_limit, 5));
658+
off += scnprintf(buf + off, buf_size - off,
659+
"LMT5 -\t\t\t%#06x\n", u.v32);
660+
} else {
661+
u.v64 = ioread64(mmio + bar2_off(ndev->xlat_reg->bar2_limit, 4));
662+
off += scnprintf(buf + off, buf_size - off,
663+
"LMT45 -\t\t\t%#018llx\n", u.v64);
664+
}
646665

647666
if (pdev_is_xeon(ndev->ntb.pdev)) {
648667
if (ntb_topo_is_b2b(ndev->ntb.topo)) {
@@ -653,17 +672,41 @@ static ssize_t ndev_debugfs_read(struct file *filp, char __user *ubuf,
653672
off += scnprintf(buf + off, buf_size - off,
654673
"B2B XLAT23 -\t\t%#018llx\n", u.v64);
655674

656-
u.v64 = ioread64(mmio + XEON_PBAR45XLAT_OFFSET);
657-
off += scnprintf(buf + off, buf_size - off,
658-
"B2B XLAT45 -\t\t%#018llx\n", u.v64);
675+
if (ndev->bar4_split) {
676+
u.v32 = ioread32(mmio + XEON_PBAR4XLAT_OFFSET);
677+
off += scnprintf(buf + off, buf_size - off,
678+
"B2B XLAT4 -\t\t%#06x\n",
679+
u.v32);
680+
u.v32 = ioread32(mmio + XEON_PBAR5XLAT_OFFSET);
681+
off += scnprintf(buf + off, buf_size - off,
682+
"B2B XLAT5 -\t\t%#06x\n",
683+
u.v32);
684+
} else {
685+
u.v64 = ioread64(mmio + XEON_PBAR45XLAT_OFFSET);
686+
off += scnprintf(buf + off, buf_size - off,
687+
"B2B XLAT45 -\t\t%#018llx\n",
688+
u.v64);
689+
}
659690

660691
u.v64 = ioread64(mmio + XEON_PBAR23LMT_OFFSET);
661692
off += scnprintf(buf + off, buf_size - off,
662693
"B2B LMT23 -\t\t%#018llx\n", u.v64);
663694

664-
u.v64 = ioread64(mmio + XEON_PBAR45LMT_OFFSET);
665-
off += scnprintf(buf + off, buf_size - off,
666-
"B2B LMT45 -\t\t%#018llx\n", u.v64);
695+
if (ndev->bar4_split) {
696+
u.v32 = ioread32(mmio + XEON_PBAR4LMT_OFFSET);
697+
off += scnprintf(buf + off, buf_size - off,
698+
"B2B LMT4 -\t\t%#06x\n",
699+
u.v32);
700+
u.v32 = ioread32(mmio + XEON_PBAR5LMT_OFFSET);
701+
off += scnprintf(buf + off, buf_size - off,
702+
"B2B LMT5 -\t\t%#06x\n",
703+
u.v32);
704+
} else {
705+
u.v64 = ioread64(mmio + XEON_PBAR45LMT_OFFSET);
706+
off += scnprintf(buf + off, buf_size - off,
707+
"B2B LMT45 -\t\t%#018llx\n",
708+
u.v64);
709+
}
667710

668711
off += scnprintf(buf + off, buf_size - off,
669712
"\nNTB Secondary BAR:\n");
@@ -676,9 +719,19 @@ static ssize_t ndev_debugfs_read(struct file *filp, char __user *ubuf,
676719
off += scnprintf(buf + off, buf_size - off,
677720
"SBAR23 -\t\t%#018llx\n", u.v64);
678721

679-
u.v64 = ioread64(mmio + XEON_SBAR45BASE_OFFSET);
680-
off += scnprintf(buf + off, buf_size - off,
681-
"SBAR45 -\t\t%#018llx\n", u.v64);
722+
if (ndev->bar4_split) {
723+
u.v32 = ioread32(mmio + XEON_SBAR4BASE_OFFSET);
724+
off += scnprintf(buf + off, buf_size - off,
725+
"SBAR4 -\t\t\t%#06x\n", u.v32);
726+
u.v32 = ioread32(mmio + XEON_SBAR5BASE_OFFSET);
727+
off += scnprintf(buf + off, buf_size - off,
728+
"SBAR5 -\t\t\t%#06x\n", u.v32);
729+
} else {
730+
u.v64 = ioread64(mmio + XEON_SBAR45BASE_OFFSET);
731+
off += scnprintf(buf + off, buf_size - off,
732+
"SBAR45 -\t\t%#018llx\n",
733+
u.v64);
734+
}
682735
}
683736

684737
off += scnprintf(buf + off, buf_size - off,

0 commit comments

Comments
 (0)