From patchwork Thu Jun 7 06:54: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: 926169 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 411brW0HFsz9s71 for ; Thu, 7 Jun 2018 16:54:51 +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 411brV4nHYzF32n for ; Thu, 7 Jun 2018 16:54:50 +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 (ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 411brL0d4pzF32c for ; Thu, 7 Jun 2018 16:54:42 +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 411brK3mJxz9s1R; Thu, 7 Jun 2018 16:54:41 +1000 (AEST) Received: by localhost.localdomain (Postfix, from userid 1000) id 74993EE791B; Thu, 7 Jun 2018 16:54:41 +1000 (AEST) From: Michael Neuling To: alistair@popple.id.au Date: Thu, 7 Jun 2018 16:54:28 +1000 Message-Id: <20180607065438.18257-1-mikey@neuling.org> X-Mailer: git-send-email 2.17.0 Subject: [Pdbg] [PATCH 01/11] Cleanup exit code 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: pdbg@lists.ozlabs.org MIME-Version: 1.0 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Signed-off-by: Michael Neuling --- src/main.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/main.c b/src/main.c index 85770ef78c..26e141076e 100644 --- a/src/main.c +++ b/src/main.c @@ -622,16 +622,11 @@ int main(int argc, char *argv[]) return 1; found_action: - if (rc <= 0) { - printf("No valid targets found or specified. Try adding -p/-c/-t options to specify a target.\n"); - printf("Alternatively run '%s -a probe' to get a list of all valid targets\n", - basename(argv[0])); - rc = 1; - } else - rc = 0; + if (rc > 0) + return 0; - //if (backend == FSI) - //fsi_destroy(NULL); - - return rc; + printf("No valid targets found or specified. Try adding -p/-c/-t options to specify a target.\n"); + printf("Alternatively run '%s -a probe' to get a list of all valid targets\n", + basename(argv[0])); + return 1; } From patchwork Thu Jun 7 06:54:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Neuling X-Patchwork-Id: 926171 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 411brZ5qlSz9s31 for ; Thu, 7 Jun 2018 16:54:54 +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 411brZ43SSzF32p for ; Thu, 7 Jun 2018 16:54:54 +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 411brK6kSHzF32G for ; Thu, 7 Jun 2018 16:54: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 411brK3pW0z9s1b; Thu, 7 Jun 2018 16:54:41 +1000 (AEST) Received: by localhost.localdomain (Postfix, from userid 1000) id 7A143EE791C; Thu, 7 Jun 2018 16:54:41 +1000 (AEST) From: Michael Neuling To: alistair@popple.id.au Date: Thu, 7 Jun 2018 16:54:29 +1000 Message-Id: <20180607065438.18257-2-mikey@neuling.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180607065438.18257-1-mikey@neuling.org> References: <20180607065438.18257-1-mikey@neuling.org> Subject: [Pdbg] [PATCH 02/11] Increase max processors for sparse chip id configs 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: pdbg@lists.ozlabs.org MIME-Version: 1.0 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" This bumps up the MAX_PROCESSORS to 64 so we support more machines. On a Tuletta with 2 DCMS, we end up with chip ids 0, 1, 16 and 17. We can't use the last two chips with the current setting. Signed-off-by: Michael Neuling --- src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index 26e141076e..1422c3f7bb 100644 --- a/src/main.c +++ b/src/main.c @@ -69,7 +69,7 @@ static enum backend backend = KERNEL; static char const *device_node; static int i2c_addr = 0x50; -#define MAX_PROCESSORS 16 +#define MAX_PROCESSORS 64 #define MAX_CHIPS 24 #define MAX_THREADS THREADS_PER_CORE From patchwork Thu Jun 7 06:54:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Neuling X-Patchwork-Id: 926168 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 411brQ1KWMz9s4w for ; Thu, 7 Jun 2018 16:54:46 +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 411brP68DKzF32k for ; Thu, 7 Jun 2018 16:54:45 +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 411brL00STzF32Q for ; Thu, 7 Jun 2018 16:54:42 +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 411brK4Cgzz9s2t; Thu, 7 Jun 2018 16:54:41 +1000 (AEST) Received: by localhost.localdomain (Postfix, from userid 1000) id 7CB1FEE791D; Thu, 7 Jun 2018 16:54:41 +1000 (AEST) From: Michael Neuling To: alistair@popple.id.au Date: Thu, 7 Jun 2018 16:54:30 +1000 Message-Id: <20180607065438.18257-3-mikey@neuling.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180607065438.18257-1-mikey@neuling.org> References: <20180607065438.18257-1-mikey@neuling.org> Subject: [Pdbg] [PATCH 03/11] host: Make debugfs scom file hex digit not decimal 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: pdbg@lists.ozlabs.org MIME-Version: 1.0 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" The kernel uses hex numbers not decimal hence this was broken on a 2 DCM Tuletta which uses chip ids above 9. Signed-off-by: Michael Neuling --- libpdbg/host.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpdbg/host.c b/libpdbg/host.c index 5e0e08fc33..483e04881c 100644 --- a/libpdbg/host.c +++ b/libpdbg/host.c @@ -95,7 +95,7 @@ static int host_pib_probe(struct pdbg_target *target) if (chip_id == -1) goto out; - if (asprintf(&access_fn, "%s/%08d/access", XSCOM_BASE_PATH, chip_id) < 0) + if (asprintf(&access_fn, "%s/%08x/access", XSCOM_BASE_PATH, chip_id) < 0) goto out; *fd = open(access_fn, O_RDWR); From patchwork Thu Jun 7 06:54:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Neuling X-Patchwork-Id: 926170 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 411brX5lNpz9s2t for ; Thu, 7 Jun 2018 16:54:52 +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 411brX4Hn0zF32g for ; Thu, 7 Jun 2018 16:54:52 +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 411brL0xcyzF32d for ; Thu, 7 Jun 2018 16:54:42 +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 411brK4XsJz9s31; Thu, 7 Jun 2018 16:54:41 +1000 (AEST) Received: by localhost.localdomain (Postfix, from userid 1000) id 85AEAEE791E; Thu, 7 Jun 2018 16:54:41 +1000 (AEST) From: Michael Neuling To: alistair@popple.id.au Date: Thu, 7 Jun 2018 16:54:31 +1000 Message-Id: <20180607065438.18257-4-mikey@neuling.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180607065438.18257-1-mikey@neuling.org> References: <20180607065438.18257-1-mikey@neuling.org> Subject: [Pdbg] [PATCH 04/11] host: Handle more chips 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: pdbg@lists.ozlabs.org MIME-Version: 1.0 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Tuletta can have 2 x DCMs where chip ids end up as 0,1,16,17 Signed-off-by: Michael Neuling --- p8-host.dts.m4 | 62 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 42 insertions(+), 20 deletions(-) diff --git a/p8-host.dts.m4 b/p8-host.dts.m4 index ed88a55576..aef7e93ed7 100644 --- a/p8-host.dts.m4 +++ b/p8-host.dts.m4 @@ -1,27 +1,49 @@ +define(`CHIP',`pib@$1 { + #address-cells = <0x2>; + #size-cells = <0x1>; + compatible = "ibm,host-pib"; + reg = <$1>; + chip-id = <$1>; + index = <$1>; + include(p8-pib.dts.m4)dnl + }')dnl + /dts-v1/; / { #address-cells = <0x1>; #size-cells = <0x0>; - /* Host based debugfs access */ - pib@0 { - #address-cells = <0x2>; - #size-cells = <0x1>; - compatible = "ibm,host-pib"; - reg = <0x0>; - chip-id = <0x0>; - index = <0x0>; - include(p8-pib.dts.m4)dnl - }; - - pib@8 { - #address-cells = <0x2>; - #size-cells = <0x1>; - compatible = "ibm,host-pib"; - reg = <0x8>; - chip-id = <0x8>; - index = <0x1>; - include(p8-pib.dts.m4)dnl - }; + CHIP(0); + CHIP(1); + CHIP(2); + CHIP(3); + CHIP(4); + CHIP(5); + CHIP(6); + CHIP(7); + CHIP(8); + CHIP(9); + CHIP(10); + CHIP(11); + CHIP(12); + CHIP(13); + CHIP(14); + CHIP(15); + CHIP(16); + CHIP(17); + CHIP(18); + CHIP(19); + CHIP(20); + CHIP(21); + CHIP(22); + CHIP(23); + CHIP(24); + CHIP(25); + CHIP(26); + CHIP(27); + CHIP(28); + CHIP(29); + CHIP(30); + CHIP(31); }; From patchwork Thu Jun 7 06:54:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Neuling X-Patchwork-Id: 926172 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 411brd0P4Sz9s2t for ; Thu, 7 Jun 2018 16:54:57 +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 411brc6JgkzF32n for ; Thu, 7 Jun 2018 16:54:56 +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 (ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 411brL13bgzF32g for ; Thu, 7 Jun 2018 16:54:42 +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 411brK4hw9z9s4w; Thu, 7 Jun 2018 16:54:41 +1000 (AEST) Received: by localhost.localdomain (Postfix, from userid 1000) id 880A8EE791F; Thu, 7 Jun 2018 16:54:41 +1000 (AEST) From: Michael Neuling To: alistair@popple.id.au Date: Thu, 7 Jun 2018 16:54:32 +1000 Message-Id: <20180607065438.18257-5-mikey@neuling.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180607065438.18257-1-mikey@neuling.org> References: <20180607065438.18257-1-mikey@neuling.org> Subject: [Pdbg] [PATCH 05/11] target: Cleanup pib_read/write() to make easier to read 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: pdbg@lists.ozlabs.org MIME-Version: 1.0 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Currently we change input parameter addr to have a different meaning making the code hard to read. This adds a new local variable target_addr to make it easier to read. This also adds a pr_debug() to each so we can see whats happening. Signed-off-by: Michael Neuling --- libpdbg/target.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/libpdbg/target.c b/libpdbg/target.c index bcf4bb9b69..be3b8458ec 100644 --- a/libpdbg/target.c +++ b/libpdbg/target.c @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -112,28 +113,34 @@ static int pib_indirect_write(struct pib *pib, uint64_t addr, uint64_t data) int pib_read(struct pdbg_target *pib_dt, uint64_t addr, uint64_t *data) { struct pib *pib; + uint64_t target_addr = addr; int rc; - pib_dt = get_class_target_addr(pib_dt, "pib", &addr); + pib_dt = get_class_target_addr(pib_dt, "pib", &target_addr); pib = target_to_pib(pib_dt); - if (addr & PPC_BIT(0)) - rc = pib_indirect_read(pib, addr, data); + if (target_addr & PPC_BIT(0)) + rc = pib_indirect_read(pib, target_addr, data); else - rc = pib->read(pib, addr, data); + rc = pib->read(pib, target_addr, data); + PR_DEBUG("addr:0x%08" PRIx64 " data:0x%016" PRIx64 "\n", + target_addr, *data); return rc; } int pib_write(struct pdbg_target *pib_dt, uint64_t addr, uint64_t data) { struct pib *pib; + uint64_t target_addr = addr; int rc; - pib_dt = get_class_target_addr(pib_dt, "pib", &addr); + pib_dt = get_class_target_addr(pib_dt, "pib", &target_addr); pib = target_to_pib(pib_dt); - if (addr & PPC_BIT(0)) - rc = pib_indirect_write(pib, addr, data); + PR_DEBUG("addr:0x%08" PRIx64 " data:0x%016" PRIx64 "\n", + target_addr, data); + if (target_addr & PPC_BIT(0)) + rc = pib_indirect_write(pib, target_addr, data); else - rc = pib->write(pib, addr, data); + rc = pib->write(pib, target_addr, data); return rc; } From patchwork Thu Jun 7 06:54:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Neuling X-Patchwork-Id: 926177 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 411brm4YbTz9s1b for ; Thu, 7 Jun 2018 16:55:04 +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 411brm3MyVzF32m for ; Thu, 7 Jun 2018 16:55:04 +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 411brL3Wr7zF32h for ; Thu, 7 Jun 2018 16:54:42 +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 411brK5NRQz9s71; Thu, 7 Jun 2018 16:54:41 +1000 (AEST) Received: by localhost.localdomain (Postfix, from userid 1000) id 8C7D6EE7920; Thu, 7 Jun 2018 16:54:41 +1000 (AEST) From: Michael Neuling To: alistair@popple.id.au Date: Thu, 7 Jun 2018 16:54:33 +1000 Message-Id: <20180607065438.18257-6-mikey@neuling.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180607065438.18257-1-mikey@neuling.org> References: <20180607065438.18257-1-mikey@neuling.org> Subject: [Pdbg] [PATCH 06/11] Remove htm_* options 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: pdbg@lists.ozlabs.org MIME-Version: 1.0 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" These have been marked deprecated for a while and are just taking up room in the help, so let's remove them. The are replaced with "htm core|nest [options]" Signed-off-by: Michael Neuling --- src/htm.c | 95 ------------------------------------------------------ src/htm.h | 8 ----- src/main.c | 7 ---- 3 files changed, 110 deletions(-) diff --git a/src/htm.c b/src/htm.c index f0073548a3..e5e29f5e0b 100644 --- a/src/htm.c +++ b/src/htm.c @@ -380,98 +380,3 @@ int run_htm(int optind, int argc, char *argv[]) return rc; } - -/* - * Handle the deprecated commands by telling the user what the new - * command is. - */ -int run_htm_start(int optind, int argc, char *argv[]) -{ - int i; - - fprintf(stderr, "You're running a deprecated command!\n"); - fprintf(stderr, "Please use:\n"); - for (i = 0; i < optind; i++) - fprintf(stderr, "%s ", argv[i]); - fprintf(stderr, "htm nest start\n"); - - return 0; -} - -int run_htm_stop(int optind, int argc, char *argv[]) -{ - int i; - - fprintf(stderr, "You're running a deprecated command!\n"); - fprintf(stderr, "Please use:\n"); - for (i = 0; i < optind; i++) - fprintf(stderr, "%s ", argv[i]); - fprintf(stderr, "htm nest stop\n"); - - return 0; -} - -int run_htm_status(int optind, int argc, char *argv[]) -{ - int i; - - fprintf(stderr, "You're running a deprecated command!\n"); - fprintf(stderr, "Please use:\n"); - for (i = 0; i < optind; i++) - fprintf(stderr, "%s ", argv[i]); - fprintf(stderr, "htm nest status\n"); - - return 0; -} - -int run_htm_reset(int optind, int argc, char *argv[]) -{ - int i; - - fprintf(stderr, "You're running a deprecated command!\n"); - fprintf(stderr, "Please use:\n"); - for (i = 0; i < optind; i++) - fprintf(stderr, "%s ", argv[i]); - fprintf(stderr, "htm nest reset\n"); - - return 0; -} - -int run_htm_dump(int optind, int argc, char *argv[]) -{ - int i; - - fprintf(stderr, "You're running a deprecated command!\n"); - fprintf(stderr, "Please use:\n"); - for (i = 0; i < optind; i++) - fprintf(stderr, "%s ", argv[i]); - fprintf(stderr, "htm nest dump\n"); - - return 0; -} - -int run_htm_trace(int optind, int argc, char *argv[]) -{ - int i; - - fprintf(stderr, "You're running a deprecated command!\n"); - fprintf(stderr, "Please use:\n"); - for (i = 0; i < optind; i++) - fprintf(stderr, "%s ", argv[i]); - fprintf(stderr, "htm nest trace\n"); - - return 0; -} - -int run_htm_analyse(int optind, int argc, char *argv[]) -{ - int i; - - fprintf(stderr, "You're running a deprecated command!\n"); - fprintf(stderr, "Please use:\n"); - for (i = 0; i < optind; i++) - fprintf(stderr, "%s ", argv[i]); - fprintf(stderr, "htm nest analyse\n"); - - return 0; -} diff --git a/src/htm.h b/src/htm.h index f5ffa7689f..21e7b77744 100644 --- a/src/htm.h +++ b/src/htm.h @@ -16,12 +16,4 @@ #include #include -int run_htm_start(int optind, int argc, char *argv[]); -int run_htm_stop(int optind, int argc, char *argv[]); -int run_htm_status(int optind, int argc, char *argv[]); -int run_htm_reset(int optind, int argc, char *argv[]); -int run_htm_dump(int optind, int argc, char *argv[]); -int run_htm_trace(int optind, int argc, char *argv[]); -int run_htm_analyse(int optind, int argc, char *argv[]); - int run_htm(int optind, int argc, char *argv[]); diff --git a/src/main.c b/src/main.c index 1422c3f7bb..ad725ec1d2 100644 --- a/src/main.c +++ b/src/main.c @@ -100,13 +100,6 @@ static struct action actions[] = { { "start", "", "Start thread", &thread_start }, { "step", "", "Set a thread instructions", &thread_step }, { "stop", "", "Stop thread", &thread_stop }, - { "htm_start", "", "[deprecated use 'htm nest start'] Start Nest HTM", &run_htm_start }, - { "htm_stop", "", "[deprecated use 'htm nest stop'] Stop Nest HTM", &run_htm_stop }, - { "htm_status", "", "[deprecated use 'htm nest status'] Print the status of HTM", &run_htm_status }, - { "htm_reset", "", "[deprecated use 'htm nest reset'] Reset the HTM facility", &run_htm_reset }, - { "htm_dump", "", "[deprecated use 'htm nest dump'] Dump HTM buffer to file", &run_htm_dump }, - { "htm_trace", "" , "[deprecated use 'htm nest trace'] Configure and start tracing with HTM", &run_htm_trace }, - { "htm_analyse", "", "[derepcated use 'htm nest analyse'] Stop and dump buffer to file", &run_htm_analyse }, { "htm", "core|nest start|stop|status|reset|dump|trace|analyse", "Hardware Trace Macro", &run_htm }, { "release", "", "Should be called after pdbg work is finished, to release special wakeups and other resources.", &handle_release}, { "probe", "", "", &handle_probe }, From patchwork Thu Jun 7 06:54:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Neuling X-Patchwork-Id: 926175 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 411brj6pcDz9s1b for ; Thu, 7 Jun 2018 16:55:01 +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 411brj5VFfzF32p for ; Thu, 7 Jun 2018 16:55:01 +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 (ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 411brL3XbHzF32k for ; Thu, 7 Jun 2018 16:54:42 +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 411brK5Lntz9s5N; Thu, 7 Jun 2018 16:54:41 +1000 (AEST) Received: by localhost.localdomain (Postfix, from userid 1000) id 91068EE7921; Thu, 7 Jun 2018 16:54:41 +1000 (AEST) From: Michael Neuling To: alistair@popple.id.au Date: Thu, 7 Jun 2018 16:54:34 +1000 Message-Id: <20180607065438.18257-7-mikey@neuling.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180607065438.18257-1-mikey@neuling.org> References: <20180607065438.18257-1-mikey@neuling.org> Subject: [Pdbg] [PATCH 07/11] htm: Only check that the primary thread is running 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: pdbg@lists.ozlabs.org MIME-Version: 1.0 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" htm only works in SMT1 mode, check for that. Signed-off-by: Michael Neuling --- src/htm.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/src/htm.c b/src/htm.c index e5e29f5e0b..4c1f7446ad 100644 --- a/src/htm.c +++ b/src/htm.c @@ -276,6 +276,27 @@ static void print_usage(enum htm_type type) } } +static bool is_smt1(struct pdbg_target *target) +{ + /* primary thread */ + if (pdbg_target_index(target) == 0) { + if (((thread_status(target).active)) && + (thread_status(target).sleep_state == PDBG_THREAD_STATE_RUN)) + return true; + goto fail; + } + + /* secondary thread */ + if (thread_status(target).quiesced) + return true; + +fail: + fprintf(stderr, "Error: core HTM needs to run in SMT1 with no powersave. Try\n"); + fprintf(stderr, " ppc64_cpu --smt=1\n"); + fprintf(stderr, " for i in /sys/devices/system/cpu/cpu*/cpuidle/state*/disable;do echo 1 > $i;done\n"); + return false; +} + int run_htm(int optind, int argc, char *argv[]) { struct pdbg_target *target; @@ -342,14 +363,9 @@ int run_htm(int optind, int argc, char *argv[]) if (pdbg_target_status(target) == PDBG_TARGET_NONEXISTENT) continue; - if ((!(thread_status(target).active)) || - (thread_status(target).sleep_state != PDBG_THREAD_STATE_RUN)) { - fprintf(stderr, "It appears powersave is on on %s@%d\n", - pdbg_target_name(target), pdbg_target_index(target)); - fprintf(stderr, "core HTM needs to run with powersave off\n"); - fprintf(stderr, "Hint: put powersave=off on the kernel commandline\n"); + if (!is_smt1(target)) return 0; - } + } /* Select the correct chtm target */ From patchwork Thu Jun 7 06:54:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Neuling X-Patchwork-Id: 926176 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 411brl2XV6z9s1b for ; Thu, 7 Jun 2018 16:55:03 +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 411brl1Kg2zF330 for ; Thu, 7 Jun 2018 16:55:03 +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 411brL3gBNzF32m for ; Thu, 7 Jun 2018 16:54:42 +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 411brK5NNQz9s5R; Thu, 7 Jun 2018 16:54:41 +1000 (AEST) Received: by localhost.localdomain (Postfix, from userid 1000) id 97B65EE7922; Thu, 7 Jun 2018 16:54:41 +1000 (AEST) From: Michael Neuling To: alistair@popple.id.au Date: Thu, 7 Jun 2018 16:54:35 +1000 Message-Id: <20180607065438.18257-8-mikey@neuling.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180607065438.18257-1-mikey@neuling.org> References: <20180607065438.18257-1-mikey@neuling.org> Subject: [Pdbg] [PATCH 08/11] htm: Print chip being targeted properly 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: pdbg@lists.ozlabs.org MIME-Version: 1.0 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Signed-off-by: Michael Neuling --- src/htm.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/htm.c b/src/htm.c index 4c1f7446ad..80cdec27b1 100644 --- a/src/htm.c +++ b/src/htm.c @@ -34,6 +34,7 @@ #include #include +#include #include #include "main.h" @@ -53,9 +54,11 @@ enum htm_type { static inline void print_htm_address(enum htm_type type, struct pdbg_target *target) { - if (type == HTM_CORE) - printf("%d#", pdbg_parent_index(target, "core")); - printf("%d\n", pdbg_target_index(target)); + if (type == HTM_CORE) { + printf("p%d:", pdbg_parent_index(target, "pib")); + printf("c%d:", pdbg_parent_index(target, "core")); + } + printf("t%d\n", pdbg_target_index(target)); } static char *get_htm_dump_filename(void) From patchwork Thu Jun 7 06:54:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Neuling X-Patchwork-Id: 926178 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 411brp1kYPz9s1b for ; Thu, 7 Jun 2018 16:55:06 +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 411brp0SJ5zF32h for ; Thu, 7 Jun 2018 16:55:06 +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 411brL3Y9lzF32l for ; Thu, 7 Jun 2018 16:54:42 +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 411brK6K9zz9s7G; Thu, 7 Jun 2018 16:54:41 +1000 (AEST) Received: by localhost.localdomain (Postfix, from userid 1000) id 9A5A7EE7923; Thu, 7 Jun 2018 16:54:41 +1000 (AEST) From: Michael Neuling To: alistair@popple.id.au Date: Thu, 7 Jun 2018 16:54:36 +1000 Message-Id: <20180607065438.18257-9-mikey@neuling.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180607065438.18257-1-mikey@neuling.org> References: <20180607065438.18257-1-mikey@neuling.org> Subject: [Pdbg] [PATCH 09/11] htm: Cleanup status output 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: pdbg@lists.ozlabs.org MIME-Version: 1.0 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Actually print something in status output. Drop some of the more esoteric details to PR_INFO() Signed-off-by: Michael Neuling --- libpdbg/htm.c | 41 ++++++++++++++++++++--------------------- src/htm.c | 3 +-- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/libpdbg/htm.c b/libpdbg/htm.c index 3a6187e0b2..7009c40081 100644 --- a/libpdbg/htm.c +++ b/libpdbg/htm.c @@ -789,18 +789,16 @@ static int do_htm_status(struct htm *htm) if (dt_node_is_compatible(&htm->target, "ibm,power9-nhtm")) regs++; - PR_DEBUG("HTM register dump:\n"); + PR_INFO("HTM register dump:\n"); 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); + PR_INFO(" %d: 0x%016" PRIx64 "\n", i, val); } - putchar('\n'); - PR_INFO("* Checking HTM status...\n"); if (HTM_ERR(get_status(htm, &status))) return -1; @@ -815,47 +813,48 @@ static int do_htm_status(struct htm *htm) } PR_DEBUG("HTM status : 0x%016" PRIx64 "\n", status.raw); - PR_INFO("State: "); + printf("State: "); switch (status.state) { case INIT: - PR_INFO("INIT"); + printf("INIT"); break; case PREREQ: - PR_INFO("PREREQ"); + printf("PREREQ"); break; case READY: - PR_INFO("READY"); + printf("READY"); break; case TRACING: - PR_INFO("TRACING"); + printf("TRACING"); break; case PAUSED: - PR_INFO("PAUSED"); + printf("PAUSED"); break; case FLUSH: - PR_INFO("FLUSH"); + printf("FLUSH"); break; case COMPLETE: - PR_INFO("COMPLETE"); + printf("COMPLETE"); break; case ENABLE: - PR_INFO("ENABLE"); + printf("ENABLE"); break; case STAMP: - PR_INFO("STAMP"); + printf("STAMP"); break; default: - PR_INFO("UNINITIALIZED"); + printf("UNINITIALIZED"); } - PR_INFO("\n"); + printf("\n"); - PR_INFO("HTM base addr : 0x%016" PRIx64 ", size: 0x%016" PRIx64 " ", - status.mem_base, total << 20); + printf("addr:0x%016" PRIx64 "\n", status.mem_base); + printf("size:0x%016" PRIx64 " ", total << 20); if (total > 512) - PR_INFO("[ %" PRIu64 "GB ]", total >> 10); + printf("[ %" PRIu64 "GB ]", total >> 10); else - PR_INFO("[ %" PRIu64 "MB ]", total); - PR_INFO("\n"); + printf("[ %" PRIu64 "MB ]", total); + printf("\n"); + printf("curr:0x%016" PRIx64 "\n", status.mem_last); return 1; } diff --git a/src/htm.c b/src/htm.c index 80cdec27b1..62b8569259 100644 --- a/src/htm.c +++ b/src/htm.c @@ -141,14 +141,13 @@ static int run_status(enum htm_type type, int optind, int argc, char *argv[]) if (target_is_disabled(target)) continue; - printf("HTM@"); + printf("Status HTM@"); print_htm_address(type, target); if (htm_status(target) != 1) { printf("Couldn't get HTM@"); print_htm_address(type, target); } rc++; - printf("\n\n"); } return rc; From patchwork Thu Jun 7 06:54:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Neuling X-Patchwork-Id: 926174 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 411brh3Sr7z9s1b for ; Thu, 7 Jun 2018 16:55:00 +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 411brh2MvlzF32g for ; Thu, 7 Jun 2018 16:55:00 +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 411brL3k9VzF32n for ; Thu, 7 Jun 2018 16:54:42 +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 411brK6K9Pz9s78; Thu, 7 Jun 2018 16:54:41 +1000 (AEST) Received: by localhost.localdomain (Postfix, from userid 1000) id 9F13AEE7924; Thu, 7 Jun 2018 16:54:41 +1000 (AEST) From: Michael Neuling To: alistair@popple.id.au Date: Thu, 7 Jun 2018 16:54:37 +1000 Message-Id: <20180607065438.18257-10-mikey@neuling.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180607065438.18257-1-mikey@neuling.org> References: <20180607065438.18257-1-mikey@neuling.org> Subject: [Pdbg] [PATCH 10/11] htm: Few code cleanups 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: pdbg@lists.ozlabs.org MIME-Version: 1.0 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Remove unused arguments. Remove unused pause command. Make < 80 cols Signed-off-by: Michael Neuling --- libpdbg/htm.c | 32 +++----------------------------- libpdbg/target.h | 1 - src/htm.c | 26 +++++++++++++------------- 3 files changed, 16 insertions(+), 43 deletions(-) diff --git a/libpdbg/htm.c b/libpdbg/htm.c index 7009c40081..da381f5811 100644 --- a/libpdbg/htm.c +++ b/libpdbg/htm.c @@ -214,13 +214,6 @@ int htm_reset(struct pdbg_target *target, uint64_t *base, uint64_t *size) return htm ? htm->reset(htm, base, size) : -1; } -int htm_pause(struct pdbg_target *target) -{ - struct htm *htm = check_and_convert(target); - - return htm ? htm->pause(htm) : -1; -} - int htm_status(struct pdbg_target *target) { struct htm *htm = check_and_convert(target); @@ -645,7 +638,9 @@ static int get_trace_base(struct htm *htm, uint64_t *base) static bool is_resetable(struct htm_status *status) { - return status->state == COMPLETE || status->state == REPAIR || status->state == INIT; + return status->state == COMPLETE || + status->state == REPAIR || + status->state == INIT; } static bool is_configured(struct htm *htm) @@ -761,25 +756,6 @@ static int do_htm_reset(struct htm *htm, uint64_t *r_base, uint64_t *r_size) return 1; } -static int do_htm_pause(struct htm *htm) -{ - struct htm_status status; - - if (HTM_ERR(get_status(htm, &status))) - return -1; - - if (status.state == UNINITIALIZED) { - PR_INFO("* Skipping PAUSE trigger, HTM appears uninitialized\n"); - return 0; - } - - PR_INFO("* Sending PAUSE trigger to HTM\n"); - if (HTM_ERR(pib_write(&htm->target, HTM_SCOM_TRIGGER, HTM_TRIG_PAUSE))) - return -1; - - return 0; -} - static int do_htm_status(struct htm *htm) { struct htm_status status; @@ -985,7 +961,6 @@ static struct htm nhtm = { .start = do_htm_start, .stop = do_htm_stop, .reset = do_htm_reset, - .pause = do_htm_pause, .status = do_htm_status, .dump = do_htm_dump, }; @@ -1001,7 +976,6 @@ static struct htm chtm = { .start = do_htm_start, .stop = do_htm_stop, .reset = do_htm_reset, - .pause = do_htm_pause, .status = do_htm_status, .dump = do_htm_dump, }; diff --git a/libpdbg/target.h b/libpdbg/target.h index abdc0beb20..716ba42bef 100644 --- a/libpdbg/target.h +++ b/libpdbg/target.h @@ -94,7 +94,6 @@ struct htm { int (*start)(struct htm *); int (*stop)(struct htm *); int (*reset)(struct htm *, uint64_t *, uint64_t *); - int (*pause)(struct htm *); int (*status)(struct htm *); int (*dump)(struct htm *, uint64_t, const char *); }; diff --git a/src/htm.c b/src/htm.c index 62b8569259..f2fc8cfb52 100644 --- a/src/htm.c +++ b/src/htm.c @@ -81,7 +81,7 @@ static char *get_htm_dump_filename(void) return filename; } -static int run_start(enum htm_type type, int optind, int argc, char *argv[]) +static int run_start(enum htm_type type) { struct pdbg_target *target; int rc = 0; @@ -105,7 +105,7 @@ static int run_start(enum htm_type type, int optind, int argc, char *argv[]) return rc; } -static int run_stop(enum htm_type type, int optind, int argc, char *argv[]) +static int run_stop(enum htm_type type) { struct pdbg_target *target; int rc = 0; @@ -129,7 +129,7 @@ static int run_stop(enum htm_type type, int optind, int argc, char *argv[]) return rc; } -static int run_status(enum htm_type type, int optind, int argc, char *argv[]) +static int run_status(enum htm_type type) { struct pdbg_target *target; int rc = 0; @@ -153,7 +153,7 @@ static int run_status(enum htm_type type, int optind, int argc, char *argv[]) return rc; } -static int run_reset(enum htm_type type, int optind, int argc, char *argv[]) +static int run_reset(enum htm_type type) { uint64_t old_base = 0, base, size; struct pdbg_target *target; @@ -186,7 +186,7 @@ static int run_reset(enum htm_type type, int optind, int argc, char *argv[]) return rc; } -static int run_dump(enum htm_type type, int optind, int argc, char *argv[]) +static int run_dump(enum htm_type type) { struct pdbg_target *target; char *filename; @@ -218,34 +218,34 @@ static int run_dump(enum htm_type type, int optind, int argc, char *argv[]) return rc; } -static int run_trace(enum htm_type type, int optind, int argc, char *argv[]) +static int run_trace(enum htm_type type) { int rc; - rc = run_reset(type, optind, argc, argv); + rc = run_reset(type); if (rc == 0) { printf("No HTM units were reset.\n"); printf("It is unlikely anything will start... trying anyway\n"); } - rc = run_start(type, optind, argc, argv); + rc = run_start(type); if (rc == 0) printf("No HTM units were started\n"); return rc; } -static int run_analyse(enum htm_type type, int optind, int argc, char *argv[]) +static int run_analyse(enum htm_type type) { int rc; - rc = run_stop(type, optind, argc, argv); + rc = run_stop(type); if (rc == 0) { printf("No HTM units were stopped.\n"); printf("It is unlikely anything will dump... trying anyway\n"); } - rc = run_dump(type, optind, argc, argv); + rc = run_dump(type); if (rc == 0) printf("No HTM buffers were dumped to file\n"); @@ -256,7 +256,7 @@ static struct { const char *name; const char *args; const char *desc; - int (*fn)(enum htm_type, int, int, char **); + int (*fn)(enum htm_type); } actions[] = { { "start", "", "Start %s HTM", &run_start }, { "stop", "", "Stop %s HTM", &run_stop }, @@ -382,7 +382,7 @@ int run_htm(int optind, int argc, char *argv[]) optind++; for (i = 0; i < ARRAY_SIZE(actions); i++) { if (strcmp(argv[optind], actions[i].name) == 0) { - rc = actions[i].fn(type, optind, argc, argv); + rc = actions[i].fn(type); break; } } From patchwork Thu Jun 7 06:54:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Neuling X-Patchwork-Id: 926173 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 411brg0gmWz9s1b for ; Thu, 7 Jun 2018 16:54:59 +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 411brf6ZFGzF32k for ; Thu, 7 Jun 2018 16:54:58 +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 411brL4M7wzF32p for ; Thu, 7 Jun 2018 16:54:42 +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 411brK6rjYz9s7L; Thu, 7 Jun 2018 16:54:41 +1000 (AEST) Received: by localhost.localdomain (Postfix, from userid 1000) id A6856EE7925; Thu, 7 Jun 2018 16:54:41 +1000 (AEST) From: Michael Neuling To: alistair@popple.id.au Date: Thu, 7 Jun 2018 16:54:38 +1000 Message-Id: <20180607065438.18257-11-mikey@neuling.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180607065438.18257-1-mikey@neuling.org> References: <20180607065438.18257-1-mikey@neuling.org> Subject: [Pdbg] [PATCH 11/11] htm: Fix dump filename 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: pdbg@lists.ozlabs.org MIME-Version: 1.0 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Currently we always generate 0.0-htm.dump irrespective of the chip, core and thread it's generated from. This changes it to htm-p??-c??-t??.dump using the correct CPU being run on. Signed-off-by: Michael Neuling --- libpdbg/htm.c | 23 +++++++++-------------- libpdbg/libpdbg.h | 2 +- libpdbg/target.h | 2 +- src/htm.c | 35 ++++++++++++++--------------------- 4 files changed, 25 insertions(+), 37 deletions(-) diff --git a/libpdbg/htm.c b/libpdbg/htm.c index da381f5811..a1975448c2 100644 --- a/libpdbg/htm.c +++ b/libpdbg/htm.c @@ -221,7 +221,7 @@ int htm_status(struct pdbg_target *target) return htm ? htm->status(htm) : -1; } -int htm_dump(struct pdbg_target *target, uint64_t size, const char *filename) +int htm_dump(struct pdbg_target *target, uint64_t size, char *filename) { struct htm *htm = check_and_convert(target); @@ -834,16 +834,16 @@ static int do_htm_status(struct htm *htm) return 1; } -static int do_htm_dump(struct htm *htm, uint64_t size, const char *basename) +static int do_htm_dump(struct htm *htm, uint64_t size, char *filename) { - char *trace_file, *dump_file; + char *trace_file; struct htm_status status; uint64_t trace[0x1000]; int trace_fd, dump_fd; uint32_t chip_id; size_t r; - if (!basename) + if (!filename) return -1; if (HTM_ERR(get_status(htm, &status))) @@ -880,15 +880,10 @@ static int do_htm_dump(struct htm *htm, uint64_t size, const char *basename) return -1; } - if (asprintf(&dump_file, "%d.%d-%s", chip_id, htm->target.index, basename) == -1) { - free(trace_file); - close(trace_fd); - return -1; - } - dump_fd = open(dump_file, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); + dump_fd = open(filename, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); if (dump_fd == -1) { - PR_ERROR("Failed to open %s: %m\n", dump_file); - free(dump_file); + PR_ERROR("Failed to open %s: %m\n", filename); + free(filename); free(trace_file); close(trace_fd); return -1; @@ -899,7 +894,7 @@ static int do_htm_dump(struct htm *htm, uint64_t size, const char *basename) if (r == -1) { PR_ERROR("Failed to read from %s: %m\n", trace_file); free(trace_file); - free(dump_file); + free(filename); close(trace_fd); close(dump_fd); return -1; @@ -912,7 +907,7 @@ static int do_htm_dump(struct htm *htm, uint64_t size, const char *basename) } free(trace_file); - free(dump_file); + free(filename); close(trace_fd); close(dump_fd); return 1; diff --git a/libpdbg/libpdbg.h b/libpdbg/libpdbg.h index c73cf21fed..c0990d928c 100644 --- a/libpdbg/libpdbg.h +++ b/libpdbg/libpdbg.h @@ -166,7 +166,7 @@ int htm_start(struct pdbg_target *target); int htm_stop(struct pdbg_target *target); int htm_status(struct pdbg_target *target); int htm_reset(struct pdbg_target *target, uint64_t *base, uint64_t *size); -int htm_dump(struct pdbg_target *target, uint64_t size, const char *filename); +int htm_dump(struct pdbg_target *target, uint64_t size, char *filename); int adu_getmem(struct pdbg_target *target, uint64_t addr, uint8_t *ouput, uint64_t size); int adu_putmem(struct pdbg_target *target, uint64_t addr, uint8_t *input, uint64_t size); diff --git a/libpdbg/target.h b/libpdbg/target.h index 716ba42bef..e4a3ed41f0 100644 --- a/libpdbg/target.h +++ b/libpdbg/target.h @@ -95,7 +95,7 @@ struct htm { int (*stop)(struct htm *); int (*reset)(struct htm *, uint64_t *, uint64_t *); int (*status)(struct htm *); - int (*dump)(struct htm *, uint64_t, const char *); + int (*dump)(struct htm *, uint64_t, char *); }; #define target_to_htm(x) container_of(x, struct htm, target) diff --git a/src/htm.c b/src/htm.c index f2fc8cfb52..e28c75ece3 100644 --- a/src/htm.c +++ b/src/htm.c @@ -39,8 +39,6 @@ #include "main.h" -#define HTM_DUMP_BASENAME "htm.dump" - #define HTM_ENUM_TO_STRING(e) ((e == HTM_NEST) ? "nhtm" : "chtm") #define PR_ERROR(x, args...) \ @@ -61,23 +59,18 @@ static inline void print_htm_address(enum htm_type type, printf("t%d\n", pdbg_target_index(target)); } -static char *get_htm_dump_filename(void) +static char *get_htm_dump_filename(struct pdbg_target *target) { char *filename; - int i; + int rc; - filename = strdup(HTM_DUMP_BASENAME); - if (!filename) + rc = asprintf(&filename, "htm-p%d-c%d-t%d.dump", + pdbg_parent_index(target, "pib"), + pdbg_parent_index(target, "core"), + pdbg_target_index(target)); + if (rc == -1) return NULL; - i = 0; - while (access(filename, F_OK) == 0) { - free(filename); - if (asprintf(&filename, "%s.%d", HTM_DUMP_BASENAME, i) == -1) - return NULL; - i++; - } - return filename; } @@ -192,12 +185,6 @@ static int run_dump(enum htm_type type) char *filename; int rc = 0; - filename = get_htm_dump_filename(); - if (!filename) - return 0; - - /* size = 0 will dump everything */ - printf("Dumping HTM trace to file [chip].[#]%s\n", filename); pdbg_for_each_class_target(HTM_ENUM_TO_STRING(type), target) { if (!target_selected(target)) continue; @@ -205,15 +192,21 @@ static int run_dump(enum htm_type type) if (target_is_disabled(target)) continue; + filename = get_htm_dump_filename(target); + if (!filename) + return 0; + + /* size = 0 will dump everything */ printf("Dumping HTM@"); print_htm_address(type, target); + printf("File: %s\n", filename); if (htm_dump(target, 0, filename) != 1) { printf("Couldn't dump HTM@"); print_htm_address(type, target); } rc++; + free(filename); } - free(filename); return rc; }