npu3: Expose remaining ATSD launch registers
diff mbox series

Message ID 1565194902-23196-1-git-send-email-arbab@linux.ibm.com
State Accepted
Headers show
Series
  • npu3: Expose remaining ATSD launch registers
Related show

Checks

Context Check Description
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot-dco success Signed-off-by present
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot success Test snowpatch/job/snowpatch-skiboot on branch master
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (0e1db80c70477d89a73c7f2a1a7e19c7d8292c5f)

Commit Message

Reza Arbab Aug. 7, 2019, 4:21 p.m. UTC
List all 16 ATSD registers in the device tree, not just the first 8.

Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
---
 hw/npu3-nvlink.c    | 21 ++++++++++++---------
 include/npu3-regs.h |  1 +
 2 files changed, 13 insertions(+), 9 deletions(-)

Patch
diff mbox series

diff --git a/hw/npu3-nvlink.c b/hw/npu3-nvlink.c
index c8e1a0abf31b..7dc54be59dc4 100644
--- a/hw/npu3-nvlink.c
+++ b/hw/npu3-nvlink.c
@@ -1387,6 +1387,17 @@  static void npu3_dev_create_pvd(struct npu3_dev *dev)
 	npu3_cfg_populate(dev);
 }
 
+static void npu3_dt_add_mmio_atsd(struct npu3 *npu)
+{
+	struct dt_node *dn = npu->nvlink.phb.dt_node;
+	uint64_t mmio_atsd[NPU3_XTS_ATSD_MAX];
+
+	for (uint32_t i = 0; i < NPU3_XTS_ATSD_MAX; i++)
+		mmio_atsd[i] = npu->regs[0] + NPU3_XTS_ATSD_LAUNCH(i);
+
+	dt_add_property(dn, "ibm,mmio-atsd", mmio_atsd, sizeof(mmio_atsd));
+}
+
 static void npu3_dt_add_mmio_window(struct npu3 *npu)
 {
 	struct dt_node *dn = npu->nvlink.phb.dt_node;
@@ -1482,16 +1493,8 @@  static void npu3_dt_add_props(struct npu3 *npu)
 	dt_add_property_cells(dn, "ibm,links", NPU3_LINKS_PER_NPU);
 
 	dt_add_property(dn, "reg", npu->regs, sizeof(npu->regs));
-	dt_add_property_u64s(dn, "ibm,mmio-atsd",
-			     npu->regs[0] + NPU3_XTS_ATSD_LAUNCH(0),
-			     npu->regs[0] + NPU3_XTS_ATSD_LAUNCH(1),
-			     npu->regs[0] + NPU3_XTS_ATSD_LAUNCH(2),
-			     npu->regs[0] + NPU3_XTS_ATSD_LAUNCH(3),
-			     npu->regs[0] + NPU3_XTS_ATSD_LAUNCH(4),
-			     npu->regs[0] + NPU3_XTS_ATSD_LAUNCH(5),
-			     npu->regs[0] + NPU3_XTS_ATSD_LAUNCH(6),
-			     npu->regs[0] + NPU3_XTS_ATSD_LAUNCH(7));
 
+	npu3_dt_add_mmio_atsd(npu);
 	npu3_dt_add_mmio_window(npu);
 	npu3_dt_add_interrupts(npu);
 }
diff --git a/include/npu3-regs.h b/include/npu3-regs.h
index 341d652899c3..380fb5491590 100644
--- a/include/npu3-regs.h
+++ b/include/npu3-regs.h
@@ -248,5 +248,6 @@ 
 
 /* NPU_XTS_ATSD block registers */
 #define NPU3_XTS_ATSD_LAUNCH(n)			(NPU3_BLOCK_NPU_XTS_ATSD(n) + 0x000)
+#define NPU3_XTS_ATSD_MAX			16
 
 #endif /* __NPU3_REGS_H */