From patchwork Fri Oct 9 03:59:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1378974 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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4C6vVc2zL8z9sTc for ; Fri, 9 Oct 2020 15:00:24 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=wMLrdDuf; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4C6vVb6988zDqW7 for ; Fri, 9 Oct 2020 15:00:23 +1100 (AEDT) X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4C6vVJ4fTGzDqYV for ; Fri, 9 Oct 2020 15:00:08 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=wMLrdDuf; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4C6vVJ1kBtz9sTR; Fri, 9 Oct 2020 15:00:08 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1602216008; bh=8ylLPbrojeucV+rewl3vS/OFWU7C/7idqm5/EmVT6JM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wMLrdDuf5+dDk2eHaN9RzBCQuf/a4fsOWRgqDOCqxN/M4koqYp7m2HBsSDU2GFksy Wm3D1Y2Q2GNBz5J/GqMAHJFAFqYhFkL2FC2ubpmMmQt1onir/drW5xEiYgFD8W36Gs bvGYdHz6wbTs3sPSkqKGzHTmG8PGPE6F+ZUs6301mynxmbP269awvzqZ3rvYM15RDS QGEFuCLP8kgpnensMwPFNpsuYxR/xBSy5Y9K6yUzKxO6xMX9wjpS+CuJDGAIVmkEkT QuaoxZsqw6ThV37+phHhzfqrJBa6/vwh056Sa7VYfpN1kv9jgu1LF3mFy8is4hpp7e hyFi7lTXY60Hw== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Fri, 9 Oct 2020 14:59:54 +1100 Message-Id: <20201009040001.310868-2-amitay@ozlabs.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201009040001.310868-1-amitay@ozlabs.org> References: <20201009040001.310868-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 1/8] libpdbg: Rename get_thread_status to p8_thread_state X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.29 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: Amitay Isaacs Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Signed-off-by: Amitay Isaacs Reviewed-by: Joel Stanley --- libpdbg/p8chip.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libpdbg/p8chip.c b/libpdbg/p8chip.c index 4179557..d7664b8 100644 --- a/libpdbg/p8chip.c +++ b/libpdbg/p8chip.c @@ -172,7 +172,7 @@ static void deassert_special_wakeup(struct core *chip) pib_write(&chip->target, PMSPCWKUPFSP_REG, 0); } -static struct thread_state get_thread_status(struct thread *thread) +static struct thread_state p8_thread_state(struct thread *thread) { uint64_t val, mode_reg; struct thread_state thread_status; @@ -302,7 +302,7 @@ static int p8_thread_stop(struct thread *thread) } while (!(val & RAS_STATUS_INST_COMPLETE) && !(val & RAS_STATUS_TS_QUIESCE)); - thread->status = get_thread_status(thread); + thread->status = p8_thread_state(thread); return 0; } @@ -312,7 +312,7 @@ static int p8_thread_start(struct thread *thread) /* Activate thread */ CHECK_ERR(pib_write(&thread->target, DIRECT_CONTROLS_REG, DIRECT_CONTROL_SP_START)); - thread->status = get_thread_status(thread); + thread->status = p8_thread_state(thread); return 0; } @@ -462,7 +462,7 @@ static int p8_ram_destroy(struct thread *thread) pdbg_target_require_parent("core", &thread->target)); uint64_t val, ram_mode; - if (!(get_thread_status(thread).active)) { + if (!(p8_thread_state(thread).active)) { /* Mark the RAM thread active so GPRs stick */ CHECK_ERR(pib_read(&chip->target, THREAD_ACTIVE_REG, &val)); val |= PPC_BIT(8) >> thread->id; @@ -559,7 +559,7 @@ static int p8_thread_sreset(struct thread *thread) if (!(thread->status.active)) { CHECK_ERR(pib_write(&thread->target, DIRECT_CONTROLS_REG, DIRECT_CONTROL_SP_SRESET)); - thread->status = get_thread_status(thread); + thread->status = p8_thread_state(thread); return 0; } @@ -590,7 +590,7 @@ static int p8_thread_probe(struct pdbg_target *target) struct thread *thread = target_to_thread(target); thread->id = (pdbg_target_address(target, NULL) >> 4) & 0xf; - thread->status = get_thread_status(thread); + thread->status = p8_thread_state(thread); return 0; } From patchwork Fri Oct 9 03:59:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1378975 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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4C6vVk7162z9sTc for ; Fri, 9 Oct 2020 15:00:30 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=Qsc6NIZZ; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4C6vVj4HdtzDqT1 for ; Fri, 9 Oct 2020 15:00:29 +1100 (AEDT) X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4C6vVK3qhCzDqVB for ; Fri, 9 Oct 2020 15:00:09 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=Qsc6NIZZ; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4C6vVJ4K7Zz9sTc; Fri, 9 Oct 2020 15:00:08 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1602216008; bh=nrxgPXzeJJfvj6aFMKKU80pGXlq81/HoFqVCuOnq0K4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qsc6NIZZ67M+jYVwuNm45LEn2YZQ0xYrN8Zn6UhU+uV1zXIWZPdu85c3HoxsUmcnr NNzllNlld4hhS+56+PeXmdounZ7N0dAxtEez6+TPxNPuafx3kiQ5GoWN7I6X7ciWb0 J/+Zp7Y6cOjpQ2N9lD1rKExexT7AaXaTEhdYxGGjO7EY6fljy18emHAeOwFmzBdoUi JRwWWyN75KqAYvruF6T0o7+oaOiJFl+2RE6qiuGQaQ2GohXkJok9VZaAGLwr2i1qaB APdOPmufPtFrY+bg9M4Ta9fMNjGNjnjQkBLW3DbJ6smYDdq6MOkd7ik/bfgABvBkBY Qrq80/cwPyPQg== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Fri, 9 Oct 2020 14:59:55 +1100 Message-Id: <20201009040001.310868-3-amitay@ozlabs.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201009040001.310868-1-amitay@ozlabs.org> References: <20201009040001.310868-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 2/8] libpdbg: Rename p9_get_thread_status to p9_thread_state X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.29 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: Amitay Isaacs Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Signed-off-by: Amitay Isaacs Reviewed-by: Joel Stanley --- libpdbg/p9chip.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libpdbg/p9chip.c b/libpdbg/p9chip.c index f33696e..db6efd5 100644 --- a/libpdbg/p9chip.c +++ b/libpdbg/p9chip.c @@ -90,7 +90,7 @@ static uint64_t thread_write(struct thread *thread, uint64_t addr, uint64_t data return pib_write(chip, addr, data); } -static struct thread_state p9_get_thread_status(struct thread *thread) +static struct thread_state p9_thread_state(struct thread *thread) { uint64_t value; struct thread_state thread_state; @@ -118,7 +118,7 @@ static int p9_thread_probe(struct pdbg_target *target) struct thread *thread = target_to_thread(target); thread->id = pdbg_target_index(target); - thread->status = p9_get_thread_status(thread); + thread->status = p9_thread_state(thread); return 0; } @@ -147,7 +147,7 @@ static int p9_thread_start(struct thread *thread) thread_write(thread, P9_DIRECT_CONTROL, PPC_BIT(6 + 8*thread->id)); } - thread->status = p9_get_thread_status(thread); + thread->status = p9_thread_state(thread); return 0; } @@ -157,14 +157,14 @@ static int p9_thread_stop(struct thread *thread) int i = 0; thread_write(thread, P9_DIRECT_CONTROL, PPC_BIT(7 + 8*thread->id)); - while (!(p9_get_thread_status(thread).quiesced)) { + while (!(p9_thread_state(thread).quiesced)) { usleep(1000); if (i++ > RAS_STATUS_TIMEOUT) { PR_ERROR("Unable to quiesce thread\n"); break; } } - thread->status = p9_get_thread_status(thread); + thread->status = p9_thread_state(thread); return 0; } @@ -214,7 +214,7 @@ static int p9_thread_sreset(struct thread *thread) thread_write(thread, P9_DIRECT_CONTROL, PPC_BIT(4 + 8*thread->id)); - thread->status = p9_get_thread_status(thread); + thread->status = p9_thread_state(thread); return 0; } @@ -268,7 +268,7 @@ static int p9_ram_setup(struct thread *thread) CHECK_ERR_GOTO(out_fail, thread_write(thread, P9_SCOMC, 0x0)); - thread->status = p9_get_thread_status(thread); + thread->status = p9_thread_state(thread); thread->ram_is_setup = true; @@ -398,7 +398,7 @@ static int p9_ram_destroy(struct thread *thread) /* Deactivate thread for ramming */ CHECK_ERR(thread_write(thread, P9_THREAD_INFO, 0)); - thread->status = p9_get_thread_status(thread); + thread->status = p9_thread_state(thread); thread->ram_is_setup = false; From patchwork Fri Oct 9 03:59:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1378976 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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4C6vVs3rVfz9sTR for ; Fri, 9 Oct 2020 15:00:37 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=mwzjJLje; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4C6vVr5VKJzDqW8 for ; Fri, 9 Oct 2020 15:00:36 +1100 (AEDT) X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4C6vVL0MqSzDqWq for ; Fri, 9 Oct 2020 15:00:10 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=mwzjJLje; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4C6vVK0S6bz9sS8; Fri, 9 Oct 2020 15:00:09 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1602216009; bh=e3H/iuD+Qx4x9t33slpsjt3i+7PB+XU8tjBhccOM/28=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mwzjJLjeF3OUJ2zFIc/T6RknZMwZQJ6I7HMyQMTbdQ8bO8HAv9QUVuBHzhx0xYJRW 0M7CEqaFCqDD8nzEcuif2545eRfDYsmtlQZrAOwa5MkHtryYhN8woE+lahwsflaqEx /PxbhUMMyCy7DiDP5kXHCFvK0cMkR/bIOepV2k+zpuFk+t77eyZbPAieEvNe/0utvk nsCpzZF5enyzj5ra81hF+9eozZFz4X8iJRqCN6EhqOr5hcbUISjFEUSgUz0IbyxuFw rg2BEze4+CrauxvkPg55GJhE6dDrxsymGOyNnoOrXPZ+cybDo7z5rSSecdEtgt1T0j 4hBV/PBV0pkDg== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Fri, 9 Oct 2020 14:59:56 +1100 Message-Id: <20201009040001.310868-4-amitay@ozlabs.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201009040001.310868-1-amitay@ozlabs.org> References: <20201009040001.310868-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 3/8] libpdbg: Add state() method to thread X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.29 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: Amitay Isaacs Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Signed-off-by: Amitay Isaacs Reviewed-by: Joel Stanley --- libpdbg/hwunit.h | 1 + libpdbg/p8chip.c | 1 + libpdbg/p9chip.c | 1 + 3 files changed, 3 insertions(+) diff --git a/libpdbg/hwunit.h b/libpdbg/hwunit.h index ee825bb..c7d8edf 100644 --- a/libpdbg/hwunit.h +++ b/libpdbg/hwunit.h @@ -126,6 +126,7 @@ struct thread { struct pdbg_target target; struct thread_state status; int id; + struct thread_state (*state)(struct thread *); int (*step)(struct thread *, int); int (*start)(struct thread *); int (*stop)(struct thread *); diff --git a/libpdbg/p8chip.c b/libpdbg/p8chip.c index d7664b8..6349a38 100644 --- a/libpdbg/p8chip.c +++ b/libpdbg/p8chip.c @@ -649,6 +649,7 @@ static struct thread p8_thread = { .probe = p8_thread_probe, .release = p8_thread_release, }, + .state = p8_thread_state, .step = p8_thread_step, .start = p8_thread_start, .stop = p8_thread_stop, diff --git a/libpdbg/p9chip.c b/libpdbg/p9chip.c index db6efd5..e72a16a 100644 --- a/libpdbg/p9chip.c +++ b/libpdbg/p9chip.c @@ -428,6 +428,7 @@ static struct thread p9_thread = { .probe = p9_thread_probe, .release = p9_thread_release, }, + .state = p9_thread_state, .start = p9_thread_start, .stop = p9_thread_stop, .step = p9_thread_step, From patchwork Fri Oct 9 03:59:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1378977 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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4C6vW00FDLz9sS8 for ; Fri, 9 Oct 2020 15:00:44 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=KOZYbJEe; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4C6vVz3mSbzDqLg for ; Fri, 9 Oct 2020 15:00:43 +1100 (AEDT) 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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4C6vVL5KwkzDqWH for ; Fri, 9 Oct 2020 15:00:10 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=KOZYbJEe; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4C6vVK5HR3z9sTR; Fri, 9 Oct 2020 15:00:09 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1602216009; bh=Kc6DyL4eXSnt2oYc6HBZn4Jx9wiq7YSOKPArc+LA8Uk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KOZYbJEe5AyG+TAyyDoaywTvdD8o+Ly391MfIXJZWavEmq8/Ju+0mEiVcbIIvh7y4 w9o+eUgq4EzAyO+9gNdNI93smn7flLaTlrrK5Ka2ZrGuP3DaBH//UmFvaAUy6/+juo hI/sJ1c1xdb6lz2gWt7tYv3CHFRWn54XkXhBRpAZDfEM5Z9wS4Ds6sj+IA1BUQwPx+ jKHNc3sGIgcnQXXCV0AoCAFWQOZuoBs+jIlY4mazuarmw9YplE6+8sZCUd+aQfCBUf ghtUx7atL+KnBLgjzdVveGInZwcbUUvnQ4o+784fBayqNr6WfFXx8cU1RW/r4pAw6z nwtF7V1/079Dg== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Fri, 9 Oct 2020 14:59:57 +1100 Message-Id: <20201009040001.310868-5-amitay@ozlabs.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201009040001.310868-1-amitay@ozlabs.org> References: <20201009040001.310868-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 4/8] libpdbg: Use thread method to get state X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.29 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: Amitay Isaacs Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Signed-off-by: Amitay Isaacs Reviewed-by: Joel Stanley --- libpdbg/p8chip.c | 10 +++++----- libpdbg/p9chip.c | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/libpdbg/p8chip.c b/libpdbg/p8chip.c index 6349a38..3764bd6 100644 --- a/libpdbg/p8chip.c +++ b/libpdbg/p8chip.c @@ -302,7 +302,7 @@ static int p8_thread_stop(struct thread *thread) } while (!(val & RAS_STATUS_INST_COMPLETE) && !(val & RAS_STATUS_TS_QUIESCE)); - thread->status = p8_thread_state(thread); + thread->status = thread->state(thread); return 0; } @@ -312,7 +312,7 @@ static int p8_thread_start(struct thread *thread) /* Activate thread */ CHECK_ERR(pib_write(&thread->target, DIRECT_CONTROLS_REG, DIRECT_CONTROL_SP_START)); - thread->status = p8_thread_state(thread); + thread->status = thread->state(thread); return 0; } @@ -462,7 +462,7 @@ static int p8_ram_destroy(struct thread *thread) pdbg_target_require_parent("core", &thread->target)); uint64_t val, ram_mode; - if (!(p8_thread_state(thread).active)) { + if (!(thread->state(thread).active)) { /* Mark the RAM thread active so GPRs stick */ CHECK_ERR(pib_read(&chip->target, THREAD_ACTIVE_REG, &val)); val |= PPC_BIT(8) >> thread->id; @@ -559,7 +559,7 @@ static int p8_thread_sreset(struct thread *thread) if (!(thread->status.active)) { CHECK_ERR(pib_write(&thread->target, DIRECT_CONTROLS_REG, DIRECT_CONTROL_SP_SRESET)); - thread->status = p8_thread_state(thread); + thread->status = thread->state(thread); return 0; } @@ -590,7 +590,7 @@ static int p8_thread_probe(struct pdbg_target *target) struct thread *thread = target_to_thread(target); thread->id = (pdbg_target_address(target, NULL) >> 4) & 0xf; - thread->status = p8_thread_state(thread); + thread->status = thread->state(thread); return 0; } diff --git a/libpdbg/p9chip.c b/libpdbg/p9chip.c index e72a16a..05cce7f 100644 --- a/libpdbg/p9chip.c +++ b/libpdbg/p9chip.c @@ -118,7 +118,7 @@ static int p9_thread_probe(struct pdbg_target *target) struct thread *thread = target_to_thread(target); thread->id = pdbg_target_index(target); - thread->status = p9_thread_state(thread); + thread->status = thread->state(thread); return 0; } @@ -147,7 +147,7 @@ static int p9_thread_start(struct thread *thread) thread_write(thread, P9_DIRECT_CONTROL, PPC_BIT(6 + 8*thread->id)); } - thread->status = p9_thread_state(thread); + thread->status = thread->state(thread); return 0; } @@ -157,14 +157,14 @@ static int p9_thread_stop(struct thread *thread) int i = 0; thread_write(thread, P9_DIRECT_CONTROL, PPC_BIT(7 + 8*thread->id)); - while (!(p9_thread_state(thread).quiesced)) { + while (!(thread->state(thread).quiesced)) { usleep(1000); if (i++ > RAS_STATUS_TIMEOUT) { PR_ERROR("Unable to quiesce thread\n"); break; } } - thread->status = p9_thread_state(thread); + thread->status = thread->state(thread); return 0; } @@ -214,7 +214,7 @@ static int p9_thread_sreset(struct thread *thread) thread_write(thread, P9_DIRECT_CONTROL, PPC_BIT(4 + 8*thread->id)); - thread->status = p9_thread_state(thread); + thread->status = thread->state(thread); return 0; } @@ -268,7 +268,7 @@ static int p9_ram_setup(struct thread *thread) CHECK_ERR_GOTO(out_fail, thread_write(thread, P9_SCOMC, 0x0)); - thread->status = p9_thread_state(thread); + thread->status = thread->state(thread); thread->ram_is_setup = true; @@ -398,7 +398,7 @@ static int p9_ram_destroy(struct thread *thread) /* Deactivate thread for ramming */ CHECK_ERR(thread_write(thread, P9_THREAD_INFO, 0)); - thread->status = p9_thread_state(thread); + thread->status = thread->state(thread); thread->ram_is_setup = false; From patchwork Fri Oct 9 03:59:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1378978 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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4C6vW52JGJz9sTc for ; Fri, 9 Oct 2020 15:00:49 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=X/CVM2Tq; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4C6vW46rhgzDqLg for ; Fri, 9 Oct 2020 15:00:48 +1100 (AEDT) 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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4C6vVM6zFNzDqWG for ; Fri, 9 Oct 2020 15:00:11 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=X/CVM2Tq; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4C6vVL2jgwz9sTc; Fri, 9 Oct 2020 15:00:10 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1602216010; bh=f+BZW9yxN0kejl4lQkjAvkcXpYbXMsndHYa7abIb3VQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X/CVM2TqdS+g0Pfdscb8Dbbnh3rUDFYfk7BM5RbpotJ378unXEw99YW6hB/c1StXy rXVQVlMkyt9SzgyEwr5SDFnTjKn8Hs+1Go9tu0BTBoPbPZ/a4bIAdB2gkG0ZYApmh4 AHNM6Ey2z+4NtiZ/0MP5/c9j+rbBQsVFhlRtgqoERRylDz0IHEhyKosHE6muFJjG10 fZdfNxm2anApz0udaK+9a2g0wrdAc5+DhSg08jO3ZYr0LpLKg9yhafwYs6S8AEnYkr tfJo6z5ThOCBc4VuWKyCM/2hfzXZUUpjtMAfoaeICP5v96wl7U/a7DaLcYz3izelLL k6P34kH86WDsQ== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Fri, 9 Oct 2020 14:59:58 +1100 Message-Id: <20201009040001.310868-6-amitay@ozlabs.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201009040001.310868-1-amitay@ozlabs.org> References: <20201009040001.310868-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 5/8] libpdbg: Expose p9_thread_state method X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.29 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: Amitay Isaacs Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" This will be used by sbefifo thread to update thread status. Signed-off-by: Amitay Isaacs Reviewed-by: Joel Stanley --- libpdbg/chip.h | 2 ++ libpdbg/p9chip.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libpdbg/chip.h b/libpdbg/chip.h index 6856c64..11e8e8b 100644 --- a/libpdbg/chip.h +++ b/libpdbg/chip.h @@ -43,4 +43,6 @@ int ram_putmsr(struct thread *thread, uint64_t value); int ram_getcr(struct thread *thread, uint32_t *value); int ram_putcr(struct thread *thread, uint32_t value); +struct thread_state p9_thread_state(struct thread *thread); + #endif diff --git a/libpdbg/p9chip.c b/libpdbg/p9chip.c index 05cce7f..d8187ce 100644 --- a/libpdbg/p9chip.c +++ b/libpdbg/p9chip.c @@ -90,7 +90,7 @@ static uint64_t thread_write(struct thread *thread, uint64_t addr, uint64_t data return pib_write(chip, addr, data); } -static struct thread_state p9_thread_state(struct thread *thread) +struct thread_state p9_thread_state(struct thread *thread) { uint64_t value; struct thread_state thread_state; From patchwork Fri Oct 9 03:59:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1378980 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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4C6vWK3DXkz9sS8 for ; Fri, 9 Oct 2020 15:01:01 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=mszrE+G7; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4C6vWK0SZCzDqJc for ; Fri, 9 Oct 2020 15:01:01 +1100 (AEDT) X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4C6vVN598wzDqTm for ; Fri, 9 Oct 2020 15:00:12 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=mszrE+G7; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4C6vVL6BNYz9sS8; Fri, 9 Oct 2020 15:00:10 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1602216011; bh=W5rP8fa1lDcfpqFMC+ZOBdBcLnYAVeSjsyLYvMt9XRg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mszrE+G7+Jc1mQAZE1pmd9fHqmDegi0S5YJ/bpHYsc8Q4QTTA2enZbC1UoTBCsW0E B9podIQBftnhepz13YEmGQx2jL3xdEDxg+Sno8TSmQPyXRUPKHNNnhih63+Ou6I/1Q 4xznI/90oA0rVvto8+DYGIW+Ox8qpyTJ0DI8op86tB5ubzqO0CSHQ9E9hv72HtMcI6 4MPY1neQRoIzPQHSZ1HgFFJJNmkYP8Dfq6JDyunva/7pqeiL2ZH5R/oD5wFYEyKV1o CnBxaVh0ToAkta92X86BB7RXXw+VVu2G65oEt+SF0XvbetNvz2ZW071hzXk7zPsnwp ybuJ0/EeY0cOg== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Fri, 9 Oct 2020 14:59:59 +1100 Message-Id: <20201009040001.310868-7-amitay@ozlabs.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201009040001.310868-1-amitay@ozlabs.org> References: <20201009040001.310868-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 6/8] libpdbg: Implement state method for sbefifo thread X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.29 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: Amitay Isaacs Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Currently only p9 is supported for sbefifo thread. Signed-off-by: Amitay Isaacs Reviewed-by: Joel Stanley --- libpdbg/sbefifo.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libpdbg/sbefifo.c b/libpdbg/sbefifo.c index 9d68853..8c9f467 100644 --- a/libpdbg/sbefifo.c +++ b/libpdbg/sbefifo.c @@ -25,6 +25,7 @@ #include "hwunit.h" #include "debug.h" #include "sprs.h" +#include "chip.h" static int sbefifo_op_getmem(struct mem *sbefifo_mem, uint64_t addr, uint8_t *data, uint64_t size, @@ -320,6 +321,11 @@ static int sbefifo_thread_op(struct thread *thread, uint32_t oper) mode); } +static struct thread_state sbefifo_thread_state(struct thread *thread) +{ + return p9_thread_state(thread); +} + static int sbefifo_thread_start(struct thread *thread) { return sbefifo_thread_op(thread, SBEFIFO_INSN_OP_START); @@ -714,6 +720,7 @@ static struct thread sbefifo_thread = { .probe = sbefifo_thread_probe, .release = sbefifo_thread_release, }, + .state = sbefifo_thread_state, .start = sbefifo_thread_start, .stop = sbefifo_thread_stop, .step = sbefifo_thread_step, From patchwork Fri Oct 9 04:00:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1378981 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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4C6vWP1X7bz9sTc for ; Fri, 9 Oct 2020 15:01:05 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=KLKrnXQF; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4C6vWP0FZJzDqW6 for ; Fri, 9 Oct 2020 15:01:05 +1100 (AEDT) X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4C6vVN5CW6zDqW8 for ; Fri, 9 Oct 2020 15:00:12 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=KLKrnXQF; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4C6vVM4jc0z9sTR; Fri, 9 Oct 2020 15:00:11 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1602216011; bh=SwEJuvwDLrDFsjDOQ9ktm4GLo5RaeKUnkPl10qpN72c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KLKrnXQF8marpZqjjcKiePrIhLPEDYrdwRe2Jc60O3ZjqBAdng2rw32w4oyRY35Z9 DSKwhiEESOL1ZZWYzUEh8idR3TXeWB9ei83N0YRSOiVV4ohVYXG/Af/WxsenNu4HgO +X60xoDfhKWvaeKuHgUK3gPyvuPqvSl3WOtw4690dUOiP7Q8OPbemph/r0FrGy8Uyi eUKC2TrRmk2IcIf1J9TBzo9GFSvQ3XQ9hpCdVnMK0oTa3/O2vGS/JwgUqF19ahSVYE cDMRXleuCLIafttp5P3PfilqKCTLwGscSTw6DaTb2Hqik/aquM823vVTm+FlmimicS JJX4ppAx72lVQ== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Fri, 9 Oct 2020 15:00:00 +1100 Message-Id: <20201009040001.310868-8-amitay@ozlabs.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201009040001.310868-1-amitay@ozlabs.org> References: <20201009040001.310868-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 7/8] libpdbg: Update thread status when starting/stopping a thread X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.29 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: Amitay Isaacs Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Signed-off-by: Amitay Isaacs Reviewed-by: Joel Stanley --- libpdbg/sbefifo.c | 41 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/libpdbg/sbefifo.c b/libpdbg/sbefifo.c index 8c9f467..fae2ab7 100644 --- a/libpdbg/sbefifo.c +++ b/libpdbg/sbefifo.c @@ -291,6 +291,7 @@ static int sbefifo_thread_probe(struct pdbg_target *target) struct thread *thread = target_to_thread(target); thread->id = pdbg_target_index(target); + thread->status = thread->state(thread); return 0; } @@ -328,18 +329,42 @@ static struct thread_state sbefifo_thread_state(struct thread *thread) static int sbefifo_thread_start(struct thread *thread) { - return sbefifo_thread_op(thread, SBEFIFO_INSN_OP_START); + int rc; + + /* Can only start if a thread is quiesced */ + if (!(thread->status.quiesced)) + return 1; + + rc = sbefifo_thread_op(thread, SBEFIFO_INSN_OP_START); + + thread->status = thread->state(thread); + + return rc; } static int sbefifo_thread_stop(struct thread *thread) { - return sbefifo_thread_op(thread, SBEFIFO_INSN_OP_STOP); + int rc; + + rc = sbefifo_thread_op(thread, SBEFIFO_INSN_OP_STOP); + + thread->status = thread->state(thread); + + return rc; } static int sbefifo_thread_step(struct thread *thread, int count) { int i, rc = 0; + /* Can only step if a thread is quiesced */ + if (!(thread->status.quiesced)) + return 1; + + /* Core must be active to step */ + if (!(thread->status.active)) + return 1; + for (i = 0; i < count; i++) rc |= sbefifo_thread_op(thread, SBEFIFO_INSN_OP_STEP); @@ -348,7 +373,17 @@ static int sbefifo_thread_step(struct thread *thread, int count) static int sbefifo_thread_sreset(struct thread *thread) { - return sbefifo_thread_op(thread, SBEFIFO_INSN_OP_SRESET); + int rc; + + /* Can only sreset if a thread is quiesced */ + if (!(thread->status.quiesced)) + return 1; + + rc = sbefifo_thread_op(thread, SBEFIFO_INSN_OP_SRESET); + + thread->status = thread->state(thread); + + return rc; } static int sbefifo_thread_getregs(struct thread *thread, struct thread_regs *regs) From patchwork Fri Oct 9 04:00:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1378979 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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4C6vWD3lN0z9sTR for ; Fri, 9 Oct 2020 15:00:56 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=MGxXQd7s; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4C6vWD2wSwzDqSv for ; Fri, 9 Oct 2020 15:00:56 +1100 (AEDT) X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4C6vVN5FMBzDqWG for ; Fri, 9 Oct 2020 15:00:12 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=MGxXQd7s; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4C6vVN1N7Dz9sVK; Fri, 9 Oct 2020 15:00:12 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1602216012; bh=SWg6p97T/rkQqzzR+ASTsob6FOyH7A+VHcz5C7YJ87c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MGxXQd7srGrDh3Yn03rG6WPv8jmllHToq2RZ5U5ipDJCbZ2ebtSROMk3rB/R197OI GVTmVaHwCVv8HKXjL0T0O5wm5OhNzNS08h3LS3G3udSjKXiVyDUfWO8DzoUB5i1taK IprxoBLyr9EaGb9dxYb+tSa+Gn9HODPBHJqwvW1io8dhbdAbz3XH/4JALU0GNWT6G2 +v0VluVw1QXZcsDFZx0QwHv+JSl8pJz7iaPHCtYTv9xwZCgkZ7nWcxRtbQXHhvQLhO 801bBzMA+f0h+6HblqVN/7JIjC6h3oe01i1BJ2voxmVMAL/+trHN8H9CINFu+oxBBu uEA5kg2+1ccgA== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Fri, 9 Oct 2020 15:00:01 +1100 Message-Id: <20201009040001.310868-9-amitay@ozlabs.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201009040001.310868-1-amitay@ozlabs.org> References: <20201009040001.310868-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 8/8] libpdbg: Update thread state when starting/stopping all threads X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.29 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: Amitay Isaacs Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Signed-off-by: Amitay Isaacs Reviewed-by: Joel Stanley --- libpdbg/sbefifo.c | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/libpdbg/sbefifo.c b/libpdbg/sbefifo.c index fae2ab7..a8e4522 100644 --- a/libpdbg/sbefifo.c +++ b/libpdbg/sbefifo.c @@ -263,12 +263,32 @@ static int sbefifo_pib_thread_op(struct pib *pib, uint32_t oper) static int sbefifo_pib_thread_start(struct pib *pib) { - return sbefifo_pib_thread_op(pib, SBEFIFO_INSN_OP_START); + struct pdbg_target *target; + int rc; + + rc = sbefifo_pib_thread_op(pib, SBEFIFO_INSN_OP_START); + + pdbg_for_each_target("thread", &pib->target, target) { + struct thread *thread = target_to_thread(target); + thread->status = thread->state(thread); + } + + return rc; } static int sbefifo_pib_thread_stop(struct pib *pib) { - return sbefifo_pib_thread_op(pib, SBEFIFO_INSN_OP_STOP); + struct pdbg_target *target; + int rc; + + rc = sbefifo_pib_thread_op(pib, SBEFIFO_INSN_OP_STOP); + + pdbg_for_each_target("thread", &pib->target, target) { + struct thread *thread = target_to_thread(target); + thread->status = thread->state(thread); + } + + return rc; } static int sbefifo_pib_thread_step(struct pib *pib, int count) @@ -283,7 +303,17 @@ static int sbefifo_pib_thread_step(struct pib *pib, int count) static int sbefifo_pib_thread_sreset(struct pib *pib) { - return sbefifo_pib_thread_op(pib, SBEFIFO_INSN_OP_SRESET); + struct pdbg_target *target; + int rc; + + rc = sbefifo_pib_thread_op(pib, SBEFIFO_INSN_OP_SRESET); + + pdbg_for_each_target("thread", &pib->target, target) { + struct thread *thread = target_to_thread(target); + thread->status = thread->state(thread); + } + + return rc; } static int sbefifo_thread_probe(struct pdbg_target *target)