diff mbox series

[2/3] htm: Allow nest htm in htm_toggle_debug_bit()

Message ID 20180904061231.6409-2-mikey@neuling.org
State Accepted
Headers show
Series [1/3] htm: Always run configure functions | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success master/apply_patch Successfully applied
snowpatch_ozlabs/build-multiarch success Test build-multiarch on branch master

Commit Message

Michael Neuling Sept. 4, 2018, 6:12 a.m. UTC
Currently htm_toggle_debug_bit() assumes the target's parent is a core
but this is only the case for core htm. For nest htm, the target's
parent is a chip.

Also for nest, we don't need to toggle this bit.

This detects the nest htm case and just returns.

Signed-off-by: Michael Neuling <mikey@neuling.org>
---
 libpdbg/htm.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libpdbg/htm.c b/libpdbg/htm.c
index 6bc6b734e4..f9013e5aba 100644
--- a/libpdbg/htm.c
+++ b/libpdbg/htm.c
@@ -730,9 +730,15 @@  static int do_htm_reset(struct htm *htm, bool wrap)
 static int htm_toggle_debug_bit(struct htm *htm)
 {
 	struct pdbg_target *target;
-	struct pdbg_target *core = pdbg_target_require_parent("core", &htm->target);
+	struct pdbg_target *core;
 	uint64_t reg;
 
+	/* NHTM doesn't have a core as a parent but donesn't need this
+	 * bit toggled */
+	core = pdbg_target_parent("core", &htm->target);
+	if (!core)
+		return 0; /* nhtm case */
+
 	/* FIXME: this is a hack for P8 */
 	if (!dt_node_is_compatible(core, "ibm,power8-core")) {
 		PR_ERROR("HTM is POWER8 only currently\n");