From patchwork Tue Jun 19 05:25:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Neuling X-Patchwork-Id: 931382 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 418xJm2fcNz9s3C for ; Tue, 19 Jun 2018 15:26:16 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=neuling.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 418xJl4dQZzF0fX for ; Tue, 19 Jun 2018 15:26:15 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=neuling.org X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [203.11.71.1]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 418xJ56MBzzF0mQ for ; Tue, 19 Jun 2018 15:25:41 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=neuling.org Received: from localhost.localdomain (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 418xJ4639cz9s78; Tue, 19 Jun 2018 15:25:40 +1000 (AEST) Received: by localhost.localdomain (Postfix, from userid 1000) id 8ADF9EE78C6; Tue, 19 Jun 2018 15:25:40 +1000 (AEST) From: Michael Neuling To: alistair@popple.id.au Date: Tue, 19 Jun 2018 15:25:28 +1000 Message-Id: <20180619052535.24043-11-mikey@neuling.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180619052535.24043-1-mikey@neuling.org> References: <20180619052535.24043-1-mikey@neuling.org> Subject: [Pdbg] [PATCH 11/18] htm: Add deconfigure_*htm() and add it to stop() X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "mailing list for https://github.com/open-power/pdbg development" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: grimm@linux.vnet.ibm.com, pdbg@lists.ozlabs.org MIME-Version: 1.0 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Cleanup the core from running in single issue mode when we stop the trace. Signed-off-by: Michael Neuling --- libpdbg/htm.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/libpdbg/htm.c b/libpdbg/htm.c index 7cf93f8fae..dedf0e1938 100644 --- a/libpdbg/htm.c +++ b/libpdbg/htm.c @@ -452,6 +452,34 @@ static int configure_chtm(struct htm *htm) return 0; } +static int deconfigure_chtm(struct htm *htm) +{ + uint64_t hid0, ncu; + + if (!pdbg_target_is_class(&htm->target, "chtm")) + return 0; + + if (HTM_ERR(pib_read(htm->target.parent, NCU_MODE_REGISTER, &ncu))) + return -1; + ncu &= ~NCU_MODE_HTM_ENABLE; + if (HTM_ERR(pib_write(htm->target.parent, NCU_MODE_REGISTER, ncu))) + return -1; + + if (HTM_ERR(pib_read(htm->target.parent, HID0_REGISTER, &hid0))) + return -1; + hid0 &= ~(HID0_TRACE_BITS); + if (HTM_ERR(pib_write(htm->target.parent, HID0_REGISTER, hid0))) + return -1; + + if (HTM_ERR(pib_write(&htm->target, HTM_COLLECTION_MODE,0))) + return -1; + +// FIXME this needs kernel work to happen +// if (HTM_ERR(deconfigure_debugfs_memtrace(htm))) +// return -1; + return 0; +} + static int configure_nhtm(struct htm *htm) { uint64_t val; @@ -500,6 +528,14 @@ static int configure_nhtm(struct htm *htm) return 0; } +static int deconfigure_nhtm(struct htm *htm) +{ + if (!pdbg_target_is_class(&htm->target, "nhtm")) + return 0; + // FIXME: write and test this + return 0; +} + static int is_startable(struct htm_status *status) { return (status->state == READY || status->state == PAUSED); @@ -739,6 +775,12 @@ static int do_htm_stop(struct htm *htm) } else { PR_INFO("* Skipping STOP trigger, HTM is not running\n"); } + + if (deconfigure_chtm(htm) < 0) + return -1; + if (deconfigure_nhtm(htm) < 0) + return -1; + return 1; }