[Pdbg] [PATCH v2 1/7] libpdbg/htm: Convert current HTM function names to Nest HTM

Cyril Bur cyrilbur at gmail.com
Wed Feb 14 15:27:37 AEDT 2018


Signed-off-by: Cyril Bur <cyrilbur at gmail.com>
---
 libpdbg/htm.c | 31 ++++++++++++++++++-------------
 p9-pib.dts.m4 |  4 ++--
 src/htm.c     | 18 +++++++++---------
 3 files changed, 29 insertions(+), 24 deletions(-)

diff --git a/libpdbg/htm.c b/libpdbg/htm.c
index ee6cf1e..eb6fc2c 100644
--- a/libpdbg/htm.c
+++ b/libpdbg/htm.c
@@ -168,7 +168,7 @@ struct htm_status {
 
 static struct htm *check_and_convert(struct pdbg_target *target)
 {
-	if (strcmp(target->class,"htm"))
+	if (strcmp(target->class, "nhtm"))
 		return NULL;
 
 	return target_to_htm(target);
@@ -580,7 +580,7 @@ static bool is_configured(struct htm *htm)
 	return true;
 }
 
-static int do_htm_reset(struct htm *htm, uint64_t *r_base, uint64_t *r_size)
+static int do_nhtm_reset(struct htm *htm, uint64_t *r_base, uint64_t *r_size)
 {
 	struct htm_status status;
 	uint64_t i, size, base, val;
@@ -673,12 +673,17 @@ static int do_htm_status(struct htm *htm)
 {
 	struct htm_status status;
 	uint64_t val, total;
-	int i;
+	int i, regs = 9;
+
+	if (dt_node_is_compatible(htm->target.dn, "ibm,power9-nhtm"))
+		regs++;
 
 	PR_DEBUG("HTM register dump:\n");
-	for (i = 0; i < 10; i++) {
-		if (HTM_ERR(pib_read(&htm->target, i, &val)))
+	for (i = 0; i < regs; i++) {
+		if (HTM_ERR(pib_read(&htm->target, i, &val))) {
 			PR_ERROR("Couldn't read HTM reg: %d\n", i);
+			continue;
+		}
 
 		PR_DEBUG(" %d: 0x%016" PRIx64 "\n", i, val);
 	}
@@ -827,7 +832,7 @@ static int do_htm_dump(struct htm *htm, uint64_t size, const char *basename)
 	return 1;
 }
 
-static int htm_probe(struct pdbg_target *target)
+static int nhtm_probe(struct pdbg_target *target)
 {
 	uint64_t val;
 
@@ -845,18 +850,18 @@ static int htm_probe(struct pdbg_target *target)
 	return 0;
 }
 
-struct htm htm = {
+struct htm nhtm = {
 	.target = {
-		.name =	"HTM",
-		.compatible = "ibm,htm",
-		.class = "htm",
-		.probe = htm_probe,
+		.name =	"Nest HTM",
+		.compatible = "ibm,power9-nhtm",
+		.class = "nhtm",
+		.probe = nhtm_probe,
 	},
 	.start = do_htm_start,
 	.stop = do_htm_stop,
-	.reset = do_htm_reset,
+	.reset = do_nhtm_reset,
 	.pause = do_htm_pause,
 	.status = do_htm_status,
 	.dump = do_htm_dump,
 };
-DECLARE_HW_UNIT(htm);
+DECLARE_HW_UNIT(nhtm);
diff --git a/p9-pib.dts.m4 b/p9-pib.dts.m4
index b972907..341241a 100644
--- a/p9-pib.dts.m4
+++ b/p9-pib.dts.m4
@@ -30,13 +30,13 @@ adu at 90000 {
 };
 
 htm at 5012880 {
-	compatible = "ibm,htm";
+	compatible = "ibm,power9-nhtm";
 	reg = <0x0 0x5012880 0x40>;
 	index = <0x0>;
 };
 
 htm at 50128C0 {
-	compatible = "ibm,htm";
+	compatible = "ibm,power9-nhtm";
 	reg = <0x0 0x50128C0 0x40>;
 	index = <0x1>;
 };
diff --git a/src/htm.c b/src/htm.c
index b03aca0..93158f1 100644
--- a/src/htm.c
+++ b/src/htm.c
@@ -50,7 +50,7 @@ int run_htm_start(int optind, int argc, char *argv[])
 	struct pdbg_target *target;
 	int rc = 0;
 
-	pdbg_for_each_class_target("htm", target) {
+	pdbg_for_each_class_target("nhtm", target) {
 		uint32_t index = pdbg_target_index(target);
 		uint64_t chip_id;
 
@@ -69,7 +69,7 @@ int run_htm_stop(int optind, int argc, char *argv[])
 	struct pdbg_target *target;
 	int rc = 0;
 
-	pdbg_for_each_class_target("htm", target) {
+	pdbg_for_each_class_target("nhtm", target) {
 		uint32_t index = pdbg_target_index(target);
 		uint64_t chip_id;
 
@@ -88,7 +88,7 @@ int run_htm_status(int optind, int argc, char *argv[])
 	struct pdbg_target *target;
 	int rc = 0;
 
-	pdbg_for_each_class_target("htm", target) {
+	pdbg_for_each_class_target("nhtm", target) {
 		uint32_t index = pdbg_target_index(target);
 		uint64_t chip_id;
 
@@ -109,7 +109,7 @@ int run_htm_reset(int optind, int argc, char *argv[])
 	struct pdbg_target *target;
 	int rc = 0;
 
-	pdbg_for_each_class_target("htm", target) {
+	pdbg_for_each_class_target("nhtm", target) {
 		uint32_t index = pdbg_target_index(target);
 		uint64_t chip_id;
 
@@ -143,7 +143,7 @@ int run_htm_dump(int optind, int argc, char *argv[])
 
 	/* size = 0 will dump everything */
 	printf("Dumping HTM trace to file [chip].[#]%s\n", filename);
-	pdbg_for_each_class_target("htm", target) {
+	pdbg_for_each_class_target("nhtm", target) {
 		uint32_t index = pdbg_target_index(target);
 		uint64_t chip_id;
 
@@ -164,7 +164,7 @@ int run_htm_trace(int optind, int argc, char *argv[])
 	struct pdbg_target *target;
 	int rc = 0;
 
-	pdbg_for_each_class_target("htm", target) {
+	pdbg_for_each_class_target("nhtm", target) {
 		uint32_t index = pdbg_target_index(target);
 		uint64_t chip_id;
 
@@ -187,7 +187,7 @@ int run_htm_trace(int optind, int argc, char *argv[])
 		old_base = base;
 	}
 
-	pdbg_for_each_class_target("htm", target) {
+	pdbg_for_each_class_target("nhtm", target) {
 		uint32_t index = pdbg_target_index(target);
 		uint64_t chip_id;
 
@@ -207,7 +207,7 @@ int run_htm_analyse(int optind, int argc, char *argv[])
 	char *filename;
 	int rc = 0;
 
-	pdbg_for_each_class_target("htm", target)
+	pdbg_for_each_class_target("nhtm", target)
 		htm_stop(target);
 
 	filename = get_htm_dump_filename();
@@ -215,7 +215,7 @@ int run_htm_analyse(int optind, int argc, char *argv[])
 		return 0;
 
 	printf("Dumping HTM trace to file [chip].[#]%s\n", filename);
-	pdbg_for_each_class_target("htm", target) {
+	pdbg_for_each_class_target("nhtm", target) {
 		uint32_t index = pdbg_target_index(target);
 		uint64_t chip_id;
 
-- 
2.16.1



More information about the Pdbg mailing list