From patchwork Tue May 31 09:14:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1637260 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=Jc2k955k; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4LC67T4qvJz9s1l for ; Tue, 31 May 2022 19:15:17 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4LC67S5t7wz3bkH for ; Tue, 31 May 2022 19:15:16 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=Jc2k955k; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::632; helo=mail-pl1-x632.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=Jc2k955k; dkim-atps=neutral Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4LC67L0nDsz3bbv for ; Tue, 31 May 2022 19:15:08 +1000 (AEST) Received: by mail-pl1-x632.google.com with SMTP id d22so12303384plr.9 for ; Tue, 31 May 2022 02:15:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jLdDMyZpOX5dVkW0mU7LWp1Jd1nk+M6or98t1uEcsnU=; b=Jc2k955kh+9kMwU3c00jWp1eqJnjyd/YoRapp2e8sNjIA1sNgj9BHIh5i0v7/S8BUU QcdxwHa9ZkqTaBDqYrElWURXr5iV/rLIbAbzC5jvGiraQqrDF0R8TGj174rGUAM4MLuE yVDuGSMaanMaE87G+rICMV42mgjVoHnmOlPDKIYOUFeUHxKZhXtJ1Sxf9Vqa+wp1vPBT cfMhSAjtpRVi5l0nhmiITMxTujdH88FSwOxV9ywRHXomIxDesAa1BuQRB8o+sbak2nz+ l1kROyDqzYYL+n9MDIw6vB0uLEywBcF3d3Ebnf3dvFlkpEOsqK4OwvdP7Flqdhgii4vE 9SOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jLdDMyZpOX5dVkW0mU7LWp1Jd1nk+M6or98t1uEcsnU=; b=pRRLcGCs8dmAh8lA9VE3F5iYrjFypIf69Uy6T5aQl/ugPLJ+wJ7D2S2T2aYFdhmywL u14lQ82cAuBbqDeUUpc6msrLY6HzixDP61cNcpxIyMP7p9qHGqJUON/R8g97oq0yy5Bj 3UEHoyVd8ANwdfmZ24hRTg7A4F9cZl35n2iVvhyTkrHSg8vViYEUQ+HcB/r8QGCyxSFa HzhkkPvajVeAT3/qimYHKQu4Z1Wd8bLNQmvZsJeNsPW65St6/1hlJbf1iJt/MCbw23gS 6NSjQcLRx33OUHOfjqmChrBntCTvlZvY0Ezp5U7bYUlWblnEzEOct0hhyvvMekIvpfwu erLg== X-Gm-Message-State: AOAM531i3ngfS14ih5bIzSy75dN61VO43NH0QPWZvmkk0FaqNstz1xkK thsIv290t/g5oWPMOuSgzWSYx1cNv1XYHg== X-Google-Smtp-Source: ABdhPJzGkhPLMzeyk7WkM/tel7lMF4yrUZ8LHn90OdxklK8JWX1I9OblkTwrcLJMt/xJoCaHOJS1OA== X-Received: by 2002:a17:902:cec8:b0:163:e4c1:b302 with SMTP id d8-20020a170902cec800b00163e4c1b302mr8214798plg.123.1653988506076; Tue, 31 May 2022 02:15:06 -0700 (PDT) Received: from bobo.ozlabs.ibm.com (220-245-15-130.tpgi.com.au. [220.245.15.130]) by smtp.gmail.com with ESMTPSA id t10-20020a17090a950a00b001e2ebcce5d5sm1282857pjo.37.2022.05.31.02.15.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 02:15:05 -0700 (PDT) From: Nicholas Piggin To: pdbg@lists.ozlabs.org Date: Tue, 31 May 2022 19:14:48 +1000 Message-Id: <20220531091457.2208488-2-npiggin@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220531091457.2208488-1-npiggin@gmail.com> References: <20220531091457.2208488-1-npiggin@gmail.com> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 01/10] sbefifo: correct typo in thread target name 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: Nicholas Piggin Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" FFIO -> FIFO Signed-off-by: Nicholas Piggin --- libpdbg/sbefifo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpdbg/sbefifo.c b/libpdbg/sbefifo.c index d34fcace..5cb9c913 100644 --- a/libpdbg/sbefifo.c +++ b/libpdbg/sbefifo.c @@ -866,7 +866,7 @@ DECLARE_HW_UNIT(sbefifo_pib); static struct thread sbefifo_thread = { .target = { - .name = "SBE FFIO Chip-op based Thread", + .name = "SBE FIFO Chip-op based Thread", .compatible = "ibm,power-thread", .class = "thread", .probe = sbefifo_thread_probe, From patchwork Tue May 31 09:14:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1637261 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=NGG4uB3F; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=112.213.38.117; helo=lists.ozlabs.org; envelope-from=pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4LC67W3LQrz9s1l for ; Tue, 31 May 2022 19:15:19 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4LC67W2sW0z3bkc for ; Tue, 31 May 2022 19:15:19 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=NGG4uB3F; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::52d; helo=mail-pg1-x52d.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=NGG4uB3F; dkim-atps=neutral Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4LC67L3zBnz3bbj for ; Tue, 31 May 2022 19:15:10 +1000 (AEST) Received: by mail-pg1-x52d.google.com with SMTP id j21so12250591pga.13 for ; Tue, 31 May 2022 02:15:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/sdlQBsxDAJqT0QYjMJVfEpywZK4I7uqoNj0l3vveoc=; b=NGG4uB3FrWz/hQC0g9b+BbopL2H7vSkhJwvFhXed5f71Ygv6zZ0AoPs3DGrBKXsfrw DXuZfZbkBWQ2u7YHZzzIIzzuDmJIpsIBon7OUWNY8HrQTHewyNl17DFowN8QF7kbtZIg JtplFqd7Bo6h8900uInEsjlt/0/87IQg9zpNliYd1HYc7TLcNK1cCGnjLwj47UgTAU2D 65DwXHrSWG962t56RY/cBuC1DD3jAIO7rXqm2fdWUGU5770WxxNXKC5EgsyQCTLE784z 3sqn8RLXfG2TLXVApUgLexbvYACOqvzXkZNNob/b0FVliVKGS1XTLShaX8f8DH/WwyIV SsSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/sdlQBsxDAJqT0QYjMJVfEpywZK4I7uqoNj0l3vveoc=; b=B7Mk4XABBcZ1yFe96xKMyp8gKBy7ZFpT6fPh/ZdX+z7V1nsS2KIHPigbIuoNlMtkdJ AihUU6CztFsdAtHHX8v3XKZMxsBv3T/wlKx3jQo3NJiPbMsd0BnHxDjtRwyngyDfvf8t CBarfbgSu+k8j0eFRGO6Wi8JPJ2/uDH4UmTIeUxnGiHZ4cfqOnD47W5Ld+nU70sVf3y+ dC9vXPbEmReSNTpQPQHAIqG0R6ugOLceiMJb8Z0MBLVuKFt4S7VWJAZrOiaXxtx5QE9G Y7TSWNMD26AO9Jy0LMv+wbCZkpktPcUr1Xj4/d5DSNyHd9EwWVltorFt6ujHSq637iou 5+kQ== X-Gm-Message-State: AOAM531r9mvIJZDDuBYijoz56IaomnOVuc3f7rtnT20ZkHjo1rITlDTD BMv5ZEIlkM1CttwFFid5ei4pAcAolxztTw== X-Google-Smtp-Source: ABdhPJxwG01OtrU/qNe8yXnhFSHr7zqFkGLoRidg/y8lmzSYsFeRpkwUgbJkfxJJbBZaREZin4gDgA== X-Received: by 2002:a05:6a00:1a91:b0:518:7bca:d095 with SMTP id e17-20020a056a001a9100b005187bcad095mr50568651pfv.13.1653988508073; Tue, 31 May 2022 02:15:08 -0700 (PDT) Received: from bobo.ozlabs.ibm.com (220-245-15-130.tpgi.com.au. [220.245.15.130]) by smtp.gmail.com with ESMTPSA id t10-20020a17090a950a00b001e2ebcce5d5sm1282857pjo.37.2022.05.31.02.15.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 02:15:07 -0700 (PDT) From: Nicholas Piggin To: pdbg@lists.ozlabs.org Date: Tue, 31 May 2022 19:14:49 +1000 Message-Id: <20220531091457.2208488-3-npiggin@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220531091457.2208488-1-npiggin@gmail.com> References: <20220531091457.2208488-1-npiggin@gmail.com> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 02/10] gdbserver: Fix attn enable HID change icache flushing sequence 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: Nicholas Piggin Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Changing the HID attn enable bit on POWER9 and POWER10 requires the icache to be flushed *after* ATTN is changed. It is not clear that it may be done at the same time, so move it to after the attn bit change. Flushing the icache with HID requires a 0->1 edge and the bit does not reset back to 0, so first write 1 then 0 ready for the next flush. Signed-off-by: Nicholas Piggin --- src/pdbgproxy.c | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/src/pdbgproxy.c b/src/pdbgproxy.c index 13b72408..2d579a4a 100644 --- a/src/pdbgproxy.c +++ b/src/pdbgproxy.c @@ -303,6 +303,9 @@ static int thread_set_attn(struct pdbg_target *target, bool enable) return 0; hid &= ~POWER8_HID_ENABLE_ATTN; } + if (thread_putspr(target, SPR_HID, hid)) + return -1; + } else if (pdbg_target_compatible(target, "ibm,power9-thread")) { if (enable) { if (hid & POWER9_HID_ENABLE_ATTN) @@ -314,7 +317,22 @@ static int thread_set_attn(struct pdbg_target *target, bool enable) return 0; hid &= ~POWER9_HID_ENABLE_ATTN; } - hid |= POWER9_HID_FLUSH_ICACHE; + + if (hid & POWER9_HID_FLUSH_ICACHE) { + PR_WARNING("set_attn found HID flush icache bit unexpectedly set\n"); + hid &= ~POWER9_HID_FLUSH_ICACHE; + } + + /* Change the ENABLE_ATTN bit in the register */ + if (thread_putspr(target, SPR_HID, hid)) + return -1; + /* FLUSH_ICACHE 0->1 to flush */ + if (thread_putspr(target, SPR_HID, hid | POWER9_HID_FLUSH_ICACHE)) + return -1; + /* Restore FLUSH_ICACHE back to 0 */ + if (thread_putspr(target, SPR_HID, hid)) + return -1; + } else if (pdbg_target_compatible(target, "ibm,power10-thread")) { if (enable) { if (hid & POWER10_HID_ENABLE_ATTN) @@ -326,14 +344,24 @@ static int thread_set_attn(struct pdbg_target *target, bool enable) return 0; hid &= ~POWER10_HID_ENABLE_ATTN; } - hid |= POWER10_HID_FLUSH_ICACHE; + if (hid & POWER10_HID_FLUSH_ICACHE) { + PR_WARNING("set_attn found HID flush icache bit unexpectedly set\n"); + hid &= ~POWER10_HID_FLUSH_ICACHE; + } + + /* Change the ENABLE_ATTN bit in the register */ + if (thread_putspr(target, SPR_HID, hid)) + return -1; + /* FLUSH_ICACHE 0->1 to flush */ + if (thread_putspr(target, SPR_HID, hid | POWER10_HID_FLUSH_ICACHE)) + return -1; + /* Restore FLUSH_ICACHE back to 0 */ + if (thread_putspr(target, SPR_HID, hid)) + return -1; } else { return -1; } - if (thread_putspr(target, SPR_HID, hid)) - return -1; - return 0; } From patchwork Tue May 31 09:14:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1637262 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=DZwLb5hb; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4LC67Y3J3kz9s1l for ; Tue, 31 May 2022 19:15:21 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4LC67Y2DYwz3bkQ for ; Tue, 31 May 2022 19:15:21 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=DZwLb5hb; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::42f; helo=mail-pf1-x42f.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=DZwLb5hb; dkim-atps=neutral Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4LC67N3d3tz3bbj for ; Tue, 31 May 2022 19:15:12 +1000 (AEST) Received: by mail-pf1-x42f.google.com with SMTP id p8so12649872pfh.8 for ; Tue, 31 May 2022 02:15:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5VnWbsmwNLTh3Rc/F6QlRxdGIpwBR0WDhPojTC/5+M8=; b=DZwLb5hbgrOMdgd23cy0qgxGHdON9bN1BMHDG3iJ4oL9Zgk3CxB5t9nAMxzee1ZVr7 QCMX756xHanzgvEnUQvutQ0vEVfdZT0EMwxJ9Ik9S5uQYQi2RKnt/U31UcZmDFgM41gA d1UMIydtv35ksrHhrpy0rEj3BKIM+PKYOc+SSAGsl66NAEDwHoeYJZtjnNg39z6w0IUl fI+GLvHA4vTDW6KnwffynV093NPefB06oZ9IenyMLNmJ6FwU+U9qlFpujUsjZC8dt432 x51Px4Cd/fBofJOT8dHhXnKUlVMD57tAweQJz1fUikKJ1IvsZk3WEXq/+DT5hoZL36TX k+fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5VnWbsmwNLTh3Rc/F6QlRxdGIpwBR0WDhPojTC/5+M8=; b=oMByU3QA1dEIuf5z21+v/nHDRl4kSAUYyp6nLJMaziuKao4qrEKjLXLIus9eJt3l5z wi1S4Am40TwUSv+Gv0oLwfBrkJsoPND8k0Ajwa9nOhfJq0ATNmttmNK9/G3sfZeMN/IG DfC1fE2dB5Jvjcek4gU07ax5fBJrn6HxfycQfXShDxj4H3yxZ10shjF2F7JduXLGsDPZ ZFcW+eRLWaoiIbxpRwXoiBR9cPOSg0vcqhNq+vQ3gwi2Fl56WljblfPhxOkmWL5aBg5i o1QXGjw/vfBio0Ia/U59IF+javjCw422KTyjEF4NUf75INJSi5dWe0YrQ4cMbWLpgZSk YLlA== X-Gm-Message-State: AOAM531/KaD6RR4T97DCH6gsAHGqxEIPziVFjaNe7AVZ5AEW1UYcbcud IkaL/+eHMqvVwwnwq3XNTd2o6rAWcSCRiQ== X-Google-Smtp-Source: ABdhPJwiqiAAB+PSBRUQenmdogTDMoBr46F3un2an5hMVbURY+PpwTboIuGmbbdfSC2rl3v+u0vTSw== X-Received: by 2002:a05:6a00:c85:b0:518:b4a7:cce1 with SMTP id a5-20020a056a000c8500b00518b4a7cce1mr38795449pfv.66.1653988510181; Tue, 31 May 2022 02:15:10 -0700 (PDT) Received: from bobo.ozlabs.ibm.com (220-245-15-130.tpgi.com.au. [220.245.15.130]) by smtp.gmail.com with ESMTPSA id t10-20020a17090a950a00b001e2ebcce5d5sm1282857pjo.37.2022.05.31.02.15.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 02:15:09 -0700 (PDT) From: Nicholas Piggin To: pdbg@lists.ozlabs.org Date: Tue, 31 May 2022 19:14:50 +1000 Message-Id: <20220531091457.2208488-4-npiggin@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220531091457.2208488-1-npiggin@gmail.com> References: <20220531091457.2208488-1-npiggin@gmail.com> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 03/10] gdbserver: use TRAP for step stop reason 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: Nicholas Piggin Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" gdb expects single step to provide the TRAP stop reason, otherwise it considers it an unknown / other stop. This makes it print odd thread stop messages when single stepping, and it also causes it to break unexpectedly when continuing threads that had hit a breakpoint because it steps those threads over the breakpoint address before continuing, and that step causes it to break again unless the stop reason is TRAP. Signed-off-by: Nicholas Piggin --- src/pdbgproxy.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pdbgproxy.c b/src/pdbgproxy.c index 2d579a4a..29845762 100644 --- a/src/pdbgproxy.c +++ b/src/pdbgproxy.c @@ -66,6 +66,7 @@ struct gdb_thread { bool attn_set; bool initial_stopped; bool stop_attn; + bool stop_sstep; bool stop_ctrlc; }; @@ -208,7 +209,7 @@ static void send_stop_for_thread(struct pdbg_target *target) int sig; int i; - if (gdb_thread->stop_attn) + if (gdb_thread->stop_attn || gdb_thread->stop_sstep) sig = 5; /* TRAP */ else if (gdb_thread->stop_ctrlc) sig = 2; /* INT */ @@ -853,8 +854,9 @@ static void v_conts(uint64_t *stack, void *priv) thread_step(thread_target, 1); - gdb_thread->stop_ctrlc = false; gdb_thread->stop_attn = false; + gdb_thread->stop_sstep = true; + gdb_thread->stop_ctrlc = false; send_stop_for_thread(thread_target); } @@ -901,6 +903,7 @@ static void start_all(void) gdb_thread = thread->gdbserver_priv; gdb_thread->stop_attn = false; + gdb_thread->stop_sstep = false; gdb_thread->stop_ctrlc = false; } From patchwork Tue May 31 09:14:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1637263 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=MlX59lVh; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4LC67Z0qtdz9s1l for ; Tue, 31 May 2022 19:15:22 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4LC67Y6lXdz3blJ for ; Tue, 31 May 2022 19:15:21 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=MlX59lVh; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::42b; helo=mail-pf1-x42b.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=MlX59lVh; dkim-atps=neutral Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4LC67Q3z5Qz3bbj for ; Tue, 31 May 2022 19:15:14 +1000 (AEST) Received: by mail-pf1-x42b.google.com with SMTP id c196so781887pfb.1 for ; Tue, 31 May 2022 02:15:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fOcynzU981y7B8TJNpIrLcjyBWDn9nrc/y09/1N6+dw=; b=MlX59lVhtigvICh/POuJBiRpxKicOxuRzPVkD4VktcWIS74GsYPTBo4Hr8TI/TM/N/ kbZ2Ey4nyK+15o0+bQRl272TOAH5ZKrj1boDLWdLLzeXwtCx/aVJd/PgqqWbALyM5LXw 0u6E2OnGRdlC8m+0Cyz3cr3VZKxAwPTg4rHzAJuI0bMpNDNLpQ/ETnGZnzJxfnrX1llp b+mJ9Sof06YQsJIQa972+L2OgJDi1R97YBZ1vHSiz0UXdohJiRis1NnDfpYDB8UDJqhv 6CHvGTHbvgHBNAEHlgrh2ewVgpEWoSOaWp7KKy0To/hTosm4GS9CE+hsmHp+6rVyCJ8G vwaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fOcynzU981y7B8TJNpIrLcjyBWDn9nrc/y09/1N6+dw=; b=0ptvSDnRvsrXjUZc/WSDQJvznzzMVIwPCqFSZR3E548P1I+d5CEl3rKpGCRhP1n9+i rQ/2EFwAlaWTv+bu67kYC6r4ciHuDsdFCGF7YubMxoipimLvUb4cN9w66sXsOVlhU++O bUBlMiplcqDzEUna1W6er32zK11u8yH1yjcH1LzJ4NJE08TUZMPccSSXEhKErgYh0jt+ YNn3FVdcJ9S9niGBPz4ACUr+eJvD7sj4mINMc9lubEskrKcmcjrWgHy2nTDC+s6xc2m8 mHQTX7xtV5ZITA37K4FceFO1R3nnOnXzpsQ8/E4CK/FOvdDI2xTdhykjpSrQwMGzXEJP Knkg== X-Gm-Message-State: AOAM532TFY51UdaB/TZh8Vxi1rbiyWMFFAcx+6SofWshbPamw5KIJ4JT owbv3w3C82wL0SbPCODAoxalEAmuk8AzjQ== X-Google-Smtp-Source: ABdhPJzrLMgQdacNP/YbzJVbjD3o5mrBIWcPB24qeugsI+OF/QrNc7pi7wMvGgPUo6rfbxhgyl0l2Q== X-Received: by 2002:a63:202:0:b0:3f2:75a7:cd28 with SMTP id 2-20020a630202000000b003f275a7cd28mr51801318pgc.537.1653988512166; Tue, 31 May 2022 02:15:12 -0700 (PDT) Received: from bobo.ozlabs.ibm.com (220-245-15-130.tpgi.com.au. [220.245.15.130]) by smtp.gmail.com with ESMTPSA id t10-20020a17090a950a00b001e2ebcce5d5sm1282857pjo.37.2022.05.31.02.15.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 02:15:11 -0700 (PDT) From: Nicholas Piggin To: pdbg@lists.ozlabs.org Date: Tue, 31 May 2022 19:14:51 +1000 Message-Id: <20220531091457.2208488-5-npiggin@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220531091457.2208488-1-npiggin@gmail.com> References: <20220531091457.2208488-1-npiggin@gmail.com> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 04/10] p9chip: implement SMT state 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: Nicholas Piggin Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" The PC registers involved are the same as P10. Signed-off-by: Nicholas Piggin --- libpdbg/p9chip.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/libpdbg/p9chip.c b/libpdbg/p9chip.c index 0ac53542..0040402c 100644 --- a/libpdbg/p9chip.c +++ b/libpdbg/p9chip.c @@ -94,6 +94,7 @@ struct thread_state p9_thread_state(struct thread *thread) { uint64_t value; struct thread_state thread_state; + uint8_t smt_mode; thread_read(thread, P9_RAS_STATUS, &value); @@ -102,14 +103,31 @@ struct thread_state p9_thread_state(struct thread *thread) thread_read(thread, P9_THREAD_INFO, &value); thread_state.active = !!(value & PPC_BIT(thread->id)); + smt_mode = GETFIELD(PPC_BITMASK(8,9), value); + switch (smt_mode) { + case 0: + thread_state.smt_state = PDBG_SMT_1; + break; + + case 2: + thread_state.smt_state = PDBG_SMT_2; + break; + + case 3: + thread_state.smt_state = PDBG_SMT_4; + break; + + default: + thread_state.smt_state = PDBG_SMT_UNKNOWN; + break; + } + thread_read(thread, P9_CORE_THREAD_STATE, &value); if (value & PPC_BIT(56 + thread->id)) thread_state.sleep_state = PDBG_THREAD_STATE_STOP; else thread_state.sleep_state = PDBG_THREAD_STATE_RUN; - thread_state.smt_state = PDBG_SMT_UNKNOWN; - return thread_state; } From patchwork Tue May 31 09:14:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1637264 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=TYeKeTTl; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=112.213.38.117; helo=lists.ozlabs.org; envelope-from=pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4LC67Z49CFz9sCq for ; Tue, 31 May 2022 19:15:22 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4LC67Z3lyhz3bk8 for ; Tue, 31 May 2022 19:15:22 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=TYeKeTTl; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::636; helo=mail-pl1-x636.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=TYeKeTTl; dkim-atps=neutral Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4LC67T02vMz3bkR for ; Tue, 31 May 2022 19:15:16 +1000 (AEST) Received: by mail-pl1-x636.google.com with SMTP id b5so12295753plx.10 for ; Tue, 31 May 2022 02:15:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2x6cdU7azE3qeh8ysZqw8BfUZB3Scy0wXm40h2xURDE=; b=TYeKeTTlUCIabr7o8LzRGV3/ZuEYLiagY+wqKtsd2tMRkHrobfFMA/0mmvAtYO/rTs bAMCOw9dxv8d5VDkAfWCTqpth9c4dF4cPJJ9T1/HdztmTiX63Aih7o9nuMYVk5v6gKkW 9ddYWwVXGvq1ZlfuU52MtvOo86BV5dwf1MIxrjhsoVx4WS37vs6pkZsNijiqTJmhq71c GG7/Wl5NnQGmpQPlxlYqRFizmsB4Xj0CV1BLjh9I6uIwMTfDFk8G0t4g5Uw443PTq7hm FszUQIFkJfsbXzLGpydYl74DPO0CoTZ4ahHahObQVw3yTCpWH53ak0UWc+sIC30EKm/o 3XgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2x6cdU7azE3qeh8ysZqw8BfUZB3Scy0wXm40h2xURDE=; b=SeBuXeRnney5yH+DP99WhA5HMmPAq2pyp5zQ6pwWVysg3NOD5D5S7NPe7eqYOOawLO 5Fng4NDT/hOTb1BDJF39OirsL11vfesxE0dG58FMBoWi8Qe87PAv4SbCI2jBlXfB6vc6 t6OLcVUo4ujX5UAcA1BVKh2myXzIFVcq4NkgEyy5jRHVqtHt/ZquHU33Pp6zJY+vR6az mezUE3PvIzTbLfScFDGliRZE+Pk7r6Ak+Ke0JNDLZ6WzsVRYdLprwDJzI38pE5a7pGs0 QbRwNpoWpdG5cGXtzaFzC3cM6nfVhRJkD1JvrZP2JhGkk3O+k1TH2nlkAt1eEzpNDr5z 2NXw== X-Gm-Message-State: AOAM533ohSBAXJw/XLhtCvO3Qilp/inDtQnAPvSZMha8qXxwnm1dQ9AE Pfc7jP1msn9h73RBgYX0dmYylJm0sEoZxA== X-Google-Smtp-Source: ABdhPJzTd+G9IP3J8O6j/jFNaL9DtGISizhPOJOP/2cfZWL/qlYrPvwEOwbu4e0y3ByKoqBuTEdeUg== X-Received: by 2002:a17:90a:9412:b0:1e0:c0cc:8630 with SMTP id r18-20020a17090a941200b001e0c0cc8630mr27226265pjo.77.1653988514208; Tue, 31 May 2022 02:15:14 -0700 (PDT) Received: from bobo.ozlabs.ibm.com (220-245-15-130.tpgi.com.au. [220.245.15.130]) by smtp.gmail.com with ESMTPSA id t10-20020a17090a950a00b001e2ebcce5d5sm1282857pjo.37.2022.05.31.02.15.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 02:15:13 -0700 (PDT) From: Nicholas Piggin To: pdbg@lists.ozlabs.org Date: Tue, 31 May 2022 19:14:52 +1000 Message-Id: <20220531091457.2208488-6-npiggin@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220531091457.2208488-1-npiggin@gmail.com> References: <20220531091457.2208488-1-npiggin@gmail.com> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 05/10] libpdbg: implement fused-core and lpar-per-thread thread status 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: Nicholas Piggin Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Like smt_state, these are really a per-core state but for now they are put in the thread_state. A future change will use fused-core, and the lpar mode may be generally useful to know in some situations. Signed-off-by: Nicholas Piggin --- libpdbg/libpdbg.h | 2 ++ libpdbg/p10chip.c | 3 +++ libpdbg/p8chip.c | 3 +++ libpdbg/p9chip.c | 3 +++ 4 files changed, 11 insertions(+) diff --git a/libpdbg/libpdbg.h b/libpdbg/libpdbg.h index 05e54f76..252b1b16 100644 --- a/libpdbg/libpdbg.h +++ b/libpdbg/libpdbg.h @@ -1043,6 +1043,8 @@ enum pdbg_smt_state { struct thread_state { bool active; bool quiesced; + bool lpar_per_thread; + bool fused_core_mode; enum pdbg_sleep_state sleep_state; enum pdbg_smt_state smt_state; }; diff --git a/libpdbg/p10chip.c b/libpdbg/p10chip.c index 70481f1f..632a1a9c 100644 --- a/libpdbg/p10chip.c +++ b/libpdbg/p10chip.c @@ -107,6 +107,9 @@ struct thread_state p10_thread_state(struct thread *thread) else thread_state.sleep_state = PDBG_THREAD_STATE_RUN; + thread_state.lpar_per_thread = !(value & PPC_BIT(62)); + thread_state.fused_core_mode = !!(value & PPC_BIT(63)); + return thread_state; } diff --git a/libpdbg/p8chip.c b/libpdbg/p8chip.c index 5b2a90a9..0592ca08 100644 --- a/libpdbg/p8chip.c +++ b/libpdbg/p8chip.c @@ -247,6 +247,9 @@ static struct thread_state p8_thread_state(struct thread *thread) /* Clear debug mode */ pib_write(&thread->target, RAS_MODE_REG, mode_reg); + thread_state.lppar_per_thread = false; + thread_state.fused_core_mode = false; + return thread_status; } diff --git a/libpdbg/p9chip.c b/libpdbg/p9chip.c index 0040402c..036be521 100644 --- a/libpdbg/p9chip.c +++ b/libpdbg/p9chip.c @@ -128,6 +128,9 @@ struct thread_state p9_thread_state(struct thread *thread) else thread_state.sleep_state = PDBG_THREAD_STATE_RUN; + thread_state.lpar_per_thread = !(value & PPC_BIT(62)); + thread_state.fused_core_mode = !!(value & PPC_BIT(63)); + return thread_state; } From patchwork Tue May 31 09:14:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1637265 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=hOnKuiMA; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=112.213.38.117; helo=lists.ozlabs.org; envelope-from=pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4LC67b3zSBz9s1l for ; Tue, 31 May 2022 19:15:23 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4LC67b3BHDz3blB for ; Tue, 31 May 2022 19:15:23 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=hOnKuiMA; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::1034; helo=mail-pj1-x1034.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=hOnKuiMA; dkim-atps=neutral Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4LC67W32DTz3bl4 for ; Tue, 31 May 2022 19:15:18 +1000 (AEST) Received: by mail-pj1-x1034.google.com with SMTP id cx11so4796988pjb.1 for ; Tue, 31 May 2022 02:15:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TSnr9ZQTc4jhmbdhnr/ALlKESw8iIIjTtSbqYQ85zgc=; b=hOnKuiMApd+wFqe04A5yULz4TdiAk5PaJDpbYSYKaubn6axRAWPpa7UOdqNx/PiAli 1fkL4m7xhHbQ7JmDXxx1c3rW9QlGn/MEznvbLpmA7WaTs1rZwpIyHXqfpSQ/cDFRrnGv MjhusaUxQvTaSLj8//6HXJQyXezLDtsNVAR7OxxDc7H0zgwT1+QQEuiZj9yovHUe5x+F b0YtbB/QfZH+OOZcVRrviG95uVr1AK87KBDN8BuAZ0ocsV6oK/YidJniYLANisvN5KDd BJtKo/K2xkQVicToOMB24DRNyHpg57bDm+17YZmbGr0zg5Ev6VGs7Owv0mYtYt30N0xe tToQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TSnr9ZQTc4jhmbdhnr/ALlKESw8iIIjTtSbqYQ85zgc=; b=tXl+aLrDn/ALm6XfL7TmoqroWPyY127NHW+jKYc3tY8EQdLBvINRcy+BJp6bjrvnN5 ieweCrCVd8qhgwGSoDrusMz8M+4Pi5x5Oir+kM69fI/PP5MEZYhKfRytVOMu2kS4rlaQ QrQxF+sTnU5hV1xhNnTOPkBNjHym4kSBiwBiQZSqVH3hJ5tOeVle5eZVl0qcSNbbng5d w8RrXUERfosYWpDDF87irEkxGtLx+x6+SMCJTnaVMx3zpmlYA7vdYcp5SLMrCO5agVyg /vTKcuyUJ3eQxXNnFWCS4ixq2LbRK9bDWOIv2+W5EmLup9FOL+fAZxfcMi75af6X+WEB MaoQ== X-Gm-Message-State: AOAM533i6+8xshYqghKd04NcdI4nzqALxr/leKjDymSZ74Yg4a7kdL/j 2LvMh6FdXHDJdBS1GtswSSvcfnbAD1peQg== X-Google-Smtp-Source: ABdhPJwxyoINrFKEQLwL303f/2m0O3xg4WZxhtf20yKUDUhDfmOqXZ1eQKE0n9HcuVPoFd81V5uFNA== X-Received: by 2002:a17:902:7005:b0:163:ffe7:32eb with SMTP id y5-20020a170902700500b00163ffe732ebmr3555659plk.18.1653988516789; Tue, 31 May 2022 02:15:16 -0700 (PDT) Received: from bobo.ozlabs.ibm.com (220-245-15-130.tpgi.com.au. [220.245.15.130]) by smtp.gmail.com with ESMTPSA id t10-20020a17090a950a00b001e2ebcce5d5sm1282857pjo.37.2022.05.31.02.15.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 02:15:16 -0700 (PDT) From: Nicholas Piggin To: pdbg@lists.ozlabs.org Date: Tue, 31 May 2022 19:14:53 +1000 Message-Id: <20220531091457.2208488-7-npiggin@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220531091457.2208488-1-npiggin@gmail.com> References: <20220531091457.2208488-1-npiggin@gmail.com> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 06/10] libpdbg: move core state into struct core 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: Nicholas Piggin Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Create a core state along the same lines as thread state, and move per-core state (SMT, LPAR-per-thread, fused-core) modes there. This adds core into the SBEFIFO backend's hierarchy. Signed-off-by: Nicholas Piggin --- libpdbg/chip.h | 3 +++ libpdbg/hwunit.h | 2 ++ libpdbg/libpdbg.h | 19 ++++++++++++++- libpdbg/p10chip.c | 61 +++++++++++++++++++++++++++++------------------ libpdbg/p8chip.c | 41 +++++++++++++++++++++++-------- libpdbg/p9chip.c | 61 +++++++++++++++++++++++++++++------------------ libpdbg/sbefifo.c | 39 ++++++++++++++++++++++++++++++ libpdbg/thread.c | 9 +++++++ 8 files changed, 178 insertions(+), 57 deletions(-) diff --git a/libpdbg/chip.h b/libpdbg/chip.h index 22310530..d5b74514 100644 --- a/libpdbg/chip.h +++ b/libpdbg/chip.h @@ -46,4 +46,7 @@ int ram_putcr(struct thread *thread, uint32_t value); struct thread_state p9_thread_state(struct thread *thread); struct thread_state p10_thread_state(struct thread *thread); +struct core_state p9_core_state(struct core *core); +struct core_state p10_core_state(struct core *core); + #endif diff --git a/libpdbg/hwunit.h b/libpdbg/hwunit.h index 563b5812..4f27e34c 100644 --- a/libpdbg/hwunit.h +++ b/libpdbg/hwunit.h @@ -132,7 +132,9 @@ struct i2cbus { struct core { struct pdbg_target target; + struct core_state status; bool release_spwkup; + struct core_state (*state)(struct core *); }; #define target_to_core(x) container_of(x, struct core, target) diff --git a/libpdbg/libpdbg.h b/libpdbg/libpdbg.h index 252b1b16..0e314b14 100644 --- a/libpdbg/libpdbg.h +++ b/libpdbg/libpdbg.h @@ -1043,12 +1043,20 @@ enum pdbg_smt_state { struct thread_state { bool active; bool quiesced; + enum pdbg_sleep_state sleep_state; +}; + +/** + * @struct core_state + * @brief Container of core states + */ +struct core_state { bool lpar_per_thread; bool fused_core_mode; - enum pdbg_sleep_state sleep_state; enum pdbg_smt_state smt_state; }; + /** * @brief Start execution of the given thread * @param[in] target the thread target to operate on @@ -1125,6 +1133,15 @@ int thread_stop_proc(struct pdbg_target *target); */ struct thread_state thread_status(struct pdbg_target *target); +/** + * @brief Return the core status information + * + * @param[in] target the core target to operate on + * + * @return core_state structure containing core information + */ +struct core_state core_status(struct pdbg_target *target); + /** * @brief Get SPR id from name * diff --git a/libpdbg/p10chip.c b/libpdbg/p10chip.c index 632a1a9c..fc661d34 100644 --- a/libpdbg/p10chip.c +++ b/libpdbg/p10chip.c @@ -61,7 +61,6 @@ struct thread_state p10_thread_state(struct thread *thread) struct thread_state thread_state; uint64_t value; bool maint_mode, thread_quiesced, ict_empty; - uint8_t smt_mode; thread_read(thread, P10_RAS_STATUS, &value); @@ -82,34 +81,12 @@ struct thread_state p10_thread_state(struct thread *thread) thread_read(thread, P10_THREAD_INFO, &value); thread_state.active = !!(value & PPC_BIT(thread->id)); - smt_mode = GETFIELD(PPC_BITMASK(8,9), value); - switch (smt_mode) { - case 0: - thread_state.smt_state = PDBG_SMT_1; - break; - - case 2: - thread_state.smt_state = PDBG_SMT_2; - break; - - case 3: - thread_state.smt_state = PDBG_SMT_4; - break; - - default: - thread_state.smt_state = PDBG_SMT_UNKNOWN; - break; - } - thread_read(thread, P10_CORE_THREAD_STATE, &value); if (value & PPC_BIT(56 + thread->id)) thread_state.sleep_state = PDBG_THREAD_STATE_STOP; else thread_state.sleep_state = PDBG_THREAD_STATE_RUN; - thread_state.lpar_per_thread = !(value & PPC_BIT(62)); - thread_state.fused_core_mode = !!(value & PPC_BIT(63)); - return thread_state; } @@ -197,6 +174,41 @@ static struct thread p10_thread = { }; DECLARE_HW_UNIT(p10_thread); +struct core_state p10_core_state(struct core *core) +{ + struct core_state core_state; + uint64_t value; + uint8_t smt_mode; + + pib_read(&core->target, P10_THREAD_INFO, &value); + + smt_mode = GETFIELD(PPC_BITMASK(8,9), value); + switch (smt_mode) { + case 0: + core_state.smt_state = PDBG_SMT_1; + break; + + case 2: + core_state.smt_state = PDBG_SMT_2; + break; + + case 3: + core_state.smt_state = PDBG_SMT_4; + break; + + default: + core_state.smt_state = PDBG_SMT_UNKNOWN; + break; + } + + pib_read(&core->target, P10_CORE_THREAD_STATE, &value); + + core_state.lpar_per_thread = !(value & PPC_BIT(62)); + core_state.fused_core_mode = !!(value & PPC_BIT(63)); + + return core_state; +} + static int p10_core_probe(struct pdbg_target *target) { struct core *core = target_to_core(target); @@ -227,6 +239,8 @@ static int p10_core_probe(struct pdbg_target *target) core->release_spwkup = true; + core->status = core->state(core); + return 0; } @@ -301,6 +315,7 @@ static struct core p10_core = { .release = p10_core_release, .translate = translate_cast(p10_core_translate), }, + .state = p10_core_state, }; DECLARE_HW_UNIT(p10_core); diff --git a/libpdbg/p8chip.c b/libpdbg/p8chip.c index 0592ca08..1863af74 100644 --- a/libpdbg/p8chip.c +++ b/libpdbg/p8chip.c @@ -213,44 +213,62 @@ static struct thread_state p8_thread_state(struct thread *thread) assert(0); } + /* Clear debug mode */ + pib_write(&thread->target, RAS_MODE_REG, mode_reg); + + return thread_status; +} + +static struct core_state p8_core_state(struct core *core) +{ + uint64_t val, mode_reg; + struct core_state core_status; + + /* Need to activete debug mode to get complete status */ + pib_read(&core->target, RAS_MODE_REG, &mode_reg); + pib_write(&core->target, RAS_MODE_REG, mode_reg | MR_THREAD_IN_DEBUG); + + /* Read POW status */ + pib_read(&core->target, POW_STATUS_REG, &val); + switch (GETFIELD(PMC_POW_SMT, val)) { case PMC_POW_SMT_0: - thread_status.smt_state = PDBG_SMT_UNKNOWN; + core_status.smt_state = PDBG_SMT_UNKNOWN; break; case PMC_POW_SMT_1: - thread_status.smt_state = PDBG_SMT_1; + core_status.smt_state = PDBG_SMT_1; break; case PMC_POW_SMT_2SH: case PMC_POW_SMT_2SP: - thread_status.smt_state = PDBG_SMT_2; + core_status.smt_state = PDBG_SMT_2; break; /* It's unclear from the documentation what the difference between these * two are. */ case PMC_POW_SMT_4_3: case PMC_POW_SMT_4_4: - thread_status.smt_state = PDBG_SMT_4; + core_status.smt_state = PDBG_SMT_4; break; /* Ditto */ case PMC_POW_SMT_8_5: case PMC_POW_SMT_8_8: - thread_status.smt_state = PDBG_SMT_8; + core_status.smt_state = PDBG_SMT_8; break; default: assert(0); } - /* Clear debug mode */ - pib_write(&thread->target, RAS_MODE_REG, mode_reg); + core_status.lpar_per_thread = false; + core_status.fused_core_mode = false; - thread_state.lppar_per_thread = false; - thread_state.fused_core_mode = false; + /* Clear debug mode */ + pib_write(&core->target, RAS_MODE_REG, mode_reg); - return thread_status; + return core_status; } static int p8_thread_step(struct thread *thread, int count) @@ -667,6 +685,8 @@ static int p8_core_probe(struct pdbg_target *target) /* Child threads will set this to false if they are released while quiesced */ core->release_spwkup = true; + core->status = core->state(core); + return 0; } @@ -711,6 +731,7 @@ static struct core p8_core = { .probe = p8_core_probe, .release = p8_core_release, }, + .state = p8_core_state, }; DECLARE_HW_UNIT(p8_core); diff --git a/libpdbg/p9chip.c b/libpdbg/p9chip.c index 036be521..1167dac8 100644 --- a/libpdbg/p9chip.c +++ b/libpdbg/p9chip.c @@ -94,7 +94,6 @@ struct thread_state p9_thread_state(struct thread *thread) { uint64_t value; struct thread_state thread_state; - uint8_t smt_mode; thread_read(thread, P9_RAS_STATUS, &value); @@ -103,34 +102,12 @@ struct thread_state p9_thread_state(struct thread *thread) thread_read(thread, P9_THREAD_INFO, &value); thread_state.active = !!(value & PPC_BIT(thread->id)); - smt_mode = GETFIELD(PPC_BITMASK(8,9), value); - switch (smt_mode) { - case 0: - thread_state.smt_state = PDBG_SMT_1; - break; - - case 2: - thread_state.smt_state = PDBG_SMT_2; - break; - - case 3: - thread_state.smt_state = PDBG_SMT_4; - break; - - default: - thread_state.smt_state = PDBG_SMT_UNKNOWN; - break; - } - thread_read(thread, P9_CORE_THREAD_STATE, &value); if (value & PPC_BIT(56 + thread->id)) thread_state.sleep_state = PDBG_THREAD_STATE_STOP; else thread_state.sleep_state = PDBG_THREAD_STATE_RUN; - thread_state.lpar_per_thread = !(value & PPC_BIT(62)); - thread_state.fused_core_mode = !!(value & PPC_BIT(63)); - return thread_state; } @@ -474,6 +451,41 @@ static struct thread p9_thread = { }; DECLARE_HW_UNIT(p9_thread); +struct core_state p9_core_state(struct core *core) +{ + uint64_t value; + struct core_state core_state; + uint8_t smt_mode; + + pib_read(&core->target, P9_THREAD_INFO, &value); + + smt_mode = GETFIELD(PPC_BITMASK(8,9), value); + switch (smt_mode) { + case 0: + core_state.smt_state = PDBG_SMT_1; + break; + + case 2: + core_state.smt_state = PDBG_SMT_2; + break; + + case 3: + core_state.smt_state = PDBG_SMT_4; + break; + + default: + core_state.smt_state = PDBG_SMT_UNKNOWN; + break; + } + + pib_read(&core->target, P9_CORE_THREAD_STATE, &value); + + core_state.lpar_per_thread = !(value & PPC_BIT(62)); + core_state.fused_core_mode = !!(value & PPC_BIT(63)); + + return core_state; +} + static int p9_core_probe(struct pdbg_target *target) { struct core *core = target_to_core(target); @@ -495,6 +507,8 @@ static int p9_core_probe(struct pdbg_target *target) /* Child threads will set this to false if they are released while quiesced */ core->release_spwkup = true; + core->status = core->state(core); + return 0; } @@ -539,6 +553,7 @@ static struct core p9_core = { .probe = p9_core_probe, .release = p9_core_release, }, + .state = p9_core_state, }; DECLARE_HW_UNIT(p9_core); diff --git a/libpdbg/sbefifo.c b/libpdbg/sbefifo.c index 5cb9c913..3be19b80 100644 --- a/libpdbg/sbefifo.c +++ b/libpdbg/sbefifo.c @@ -895,6 +895,45 @@ static struct thread sbefifo_thread = { }; DECLARE_HW_UNIT(sbefifo_thread); +static struct core_state sbefifo_core_state(struct core *core) +{ + struct pdbg_target *pib = pdbg_target_require_parent("pib", &core->target); + struct sbefifo *sbefifo = pib_to_sbefifo(pib); + struct sbefifo_context *sctx = sbefifo->get_sbefifo_context(sbefifo); + + if (sbefifo_proc(sctx) == SBEFIFO_PROC_P9) + return p9_core_state(core); + else if (sbefifo_proc(sctx) == SBEFIFO_PROC_P10) + return p10_core_state(core); + else + abort(); +} + +static int sbefifo_core_probe(struct pdbg_target *target) +{ + struct core *core = target_to_core(target); + + core->status = core->state(core); + + return 0; +} + +static void sbefifo_core_release(struct pdbg_target *target) +{ +} + +static struct core sbefifo_core = { + .target = { + .name = "SBE FIFO Core", + .compatible = "ibm,power-core", + .class = "core", + .probe = sbefifo_core_probe, + .release = sbefifo_core_release, + }, + .state = sbefifo_core_state, +}; +DECLARE_HW_UNIT(sbefifo_core); + static struct sbefifo kernel_sbefifo = { .target = { .name = "Kernel based FSI SBE FIFO", diff --git a/libpdbg/thread.c b/libpdbg/thread.c index 78a59b8b..f93250ab 100644 --- a/libpdbg/thread.c +++ b/libpdbg/thread.c @@ -30,6 +30,15 @@ struct thread_state thread_status(struct pdbg_target *target) return thread->status; } +struct core_state core_status(struct pdbg_target *target) +{ + struct core *core; + + assert(pdbg_target_is_class(target, "core")); + core = target_to_core(target); + return core->status; +} + /* * Single step the thread count instructions. */ From patchwork Tue May 31 09:14:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1637266 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=LkFuORN3; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4LC67c4mK0z9s1l for ; Tue, 31 May 2022 19:15:24 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4LC67c3Zvbz3bkR for ; Tue, 31 May 2022 19:15:24 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=LkFuORN3; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::62c; helo=mail-pl1-x62c.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=LkFuORN3; dkim-atps=neutral Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4LC67Y3CNZz3bkp for ; Tue, 31 May 2022 19:15:21 +1000 (AEST) Received: by mail-pl1-x62c.google.com with SMTP id s14so12304836plk.8 for ; Tue, 31 May 2022 02:15:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PLcyL9+zMxCSYKQhg7am/pqmacna74/eYFicx/sc10A=; b=LkFuORN3aUtbTyegdTphhGbStutw+x+8V0upCjhrC5i7GEKdVzdqX4Szhj+gjc/EXa oTMEdNKe9ckL2BuTNhxTZEM+e5Pb6TNdO/WdF1HiqU2KmuJdYtwDgBaZ3W3BbQ/vIkPc igIEwkIIDFxWkT3TZQv5zkHwVz7Zn1AJ1RFW+jTbKLM71J1MnKWHcWoIIdyVvnOdpSVt g3WRk8UpZFDZ4tM1VO4KHsUzFbp83xew+BaXW83So7Hz++v7i4CkFW1w3jqo8AFUe1Vl FVZrB21b4stowkRsid25YyARjU3IoBGNintytxeuLjrWGL0nU4+y5CotWXnWwgJ75LL7 cjEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PLcyL9+zMxCSYKQhg7am/pqmacna74/eYFicx/sc10A=; b=v27GYEYuQYX1P6u2cq0Y/WDJJdrPVqnDVqtcJbYuyFZAFfR2pGyVwHX82eXt0SEdMg TM/t7hWCk9U9pW+S+xlqC0lH2xZgIkPfTpHASBWYEipM1f+lY5jEx24A7j0hLXvro9qe mznqzrUiqdEMpYQ9OTHIKR9FHXwO4N8PmrSRMtSv9kzxtOHcsj+t1c9Z70l6g8Hzu2or biHPxADB78NtUaHAhduwwBlAGibVlzaC2eOA+PsvJ7lI1Pwoc/EY6TI/s8SUqCYsmmRp yYslQENIiRiRtcWA/D145MkZm1pINAPlfCwvTgjGtfIp4DmcA84zuI+sNB0xP97FvjYI j1qg== X-Gm-Message-State: AOAM531g/M3yocVxd75VCKe/kUCyasS4eut6fx840y4tZXy9+cdGJlXt PfFEYJ9kEkPYCUe4kv7Y0wxq7B0C/vUlnw== X-Google-Smtp-Source: ABdhPJwFKGoOiBf0rCuzmj/Cu6iCPC4j9pYZBg9No+FXgFAw+GesFM2KVzYl+3upblV06DlPAGcw+w== X-Received: by 2002:a17:903:2287:b0:164:95f:b4d6 with SMTP id b7-20020a170903228700b00164095fb4d6mr1762128plh.140.1653988518990; Tue, 31 May 2022 02:15:18 -0700 (PDT) Received: from bobo.ozlabs.ibm.com (220-245-15-130.tpgi.com.au. [220.245.15.130]) by smtp.gmail.com with ESMTPSA id t10-20020a17090a950a00b001e2ebcce5d5sm1282857pjo.37.2022.05.31.02.15.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 02:15:18 -0700 (PDT) From: Nicholas Piggin To: pdbg@lists.ozlabs.org Date: Tue, 31 May 2022 19:14:54 +1000 Message-Id: <20220531091457.2208488-8-npiggin@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220531091457.2208488-1-npiggin@gmail.com> References: <20220531091457.2208488-1-npiggin@gmail.com> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 07/10] thread: print core state with threadstatus 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: Nicholas Piggin Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" For each line of threads printed, print interesting core state as well. Signed-off-by: Nicholas Piggin --- src/thread.c | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/src/thread.c b/src/thread.c index 76909d67..4093f1a3 100644 --- a/src/thread.c +++ b/src/thread.c @@ -220,6 +220,48 @@ static int thr_stop(void) } OPTCMD_DEFINE_CMD(stop, thr_stop); +static int print_one_core(struct pdbg_target *core) +{ + struct core_state cstate; + char s; + + if (!path_target_selected(core)) { + printf("--- "); + return 0; + } + + cstate = core_status(core); + + switch (cstate.smt_state) { + case PDBG_SMT_1: + s = '1'; + break; + + case PDBG_SMT_2: + s = '2'; + break; + + case PDBG_SMT_4: + s = '4'; + break; + + case PDBG_SMT_8: + s = '8'; + break; + + default: + s = '.'; + break; + } + + printf("%c%c%c ", + s, + (cstate.fused_core_mode ? 'F': 'N'), + (cstate.lpar_per_thread ? 'T': 'C')); + + return 1; +} + static int print_one_thread(struct pdbg_target *thread) { @@ -233,7 +275,6 @@ static int print_one_thread(struct pdbg_target *thread) tstate = thread_status(thread); - switch (tstate.sleep_state) { case PDBG_THREAD_STATE_DOZE: c = 'D'; @@ -292,7 +333,7 @@ static int thread_status_print(void) if (pdbg_target_status(pib) != PDBG_TARGET_ENABLED) continue; - printf("\np%01dt:", pdbg_target_index(pib)); + printf("\np%01dt: ", pdbg_target_index(pib)); for (i = 0; i < threads_per_core; i++) printf(" %d", i); printf("\n"); @@ -304,6 +345,7 @@ static int thread_status_print(void) continue; printf("c%02d: ", pdbg_target_index(core)); + print_one_core(core); pdbg_for_each_target("thread", core, thread) count += print_one_thread(thread); From patchwork Tue May 31 09:14:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1637267 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=QCdAl1oo; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4LC67f4TFZz9s1l for ; Tue, 31 May 2022 19:15:26 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4LC67f3ltDz3bkh for ; Tue, 31 May 2022 19:15:26 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=QCdAl1oo; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::1033; helo=mail-pj1-x1033.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=QCdAl1oo; dkim-atps=neutral Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4LC67b43CMz3bkR for ; Tue, 31 May 2022 19:15:23 +1000 (AEST) Received: by mail-pj1-x1033.google.com with SMTP id gd1so5016109pjb.2 for ; Tue, 31 May 2022 02:15:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nrkKVwJnggucsiapdQvTK//hRDTW7nWLnJNWxEVw2m0=; b=QCdAl1oo7ECebll+B03Qi6h2nW5ziCJ7pL3vlkfrmvctIuHDdFqkxKZvogcZDuGx0c 43uOIUD2dyHegtuM7rnChoiDdKV+gAD8XH8oF8QBPgY4DiCySN9pzhg/QAzQbaw4vD7V gwKxKDpl0chsn/ZVun3/XybodLcBSzp/v0PCHAnexBaRBIXs9tJGUYNqfqHZc45yDj3G M0HCeT7F3f6Z+NNCzh1L29YV1DtnbTGSyHaJ6Dfr2fXqa5eWmLkYlzZts4T1PihxMeI5 EN3rrA0puGSusDpsvR3G1uEdi03bElcG/t/0CyOFbg4sV0ohdy7Sn0vt+9tpLhxGp9C6 knVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nrkKVwJnggucsiapdQvTK//hRDTW7nWLnJNWxEVw2m0=; b=kwPaZ8zqte9cWNdQxekgw0EAT4lVpoBenk/qDsYX/TCHVnt9C0Y61//U9OaWQNMFbV ArvtLVCG0T8jexI7Gr1sRvXtArBE2myO7kCs9HtMS5H+f5MnD+VDolxuMDbiNIDrvsXu XLFyEldjaBLteBgvn+h6fT7bhEtAk7+bdyxDBfcsFWLzEfEtb9G1rq1diZf568iC1Bwd cVRLbEY/vne5dOjss9nxWMmri2HtjZYuPaBVFGHrUwvMHxg3nWUX3yCFxwGAEKynnplJ zoEBu2sJUinfe2faggDlP81xNGH/QgLKaDnYrk2QbOYBFSEwgg/U6OSchQ1I3StTrmQm A64A== X-Gm-Message-State: AOAM530Twwh3GlGtTME0Wgge730Zjq60oPRaZ0y4NStcxZQEYrzbLGtc tRErpLcAKnFTxvYBQXOvo0DfXc1TKBhw8Q== X-Google-Smtp-Source: ABdhPJwqNbv+4b/lRot1XRkWIePCvCKcZclKxbeo0bUkTMw0VTGzuBe9NPu9nKrK0mmyOBq8DNjD4g== X-Received: by 2002:a17:902:d483:b0:163:e9cf:7cef with SMTP id c3-20020a170902d48300b00163e9cf7cefmr7132917plg.82.1653988521055; Tue, 31 May 2022 02:15:21 -0700 (PDT) Received: from bobo.ozlabs.ibm.com (220-245-15-130.tpgi.com.au. [220.245.15.130]) by smtp.gmail.com with ESMTPSA id t10-20020a17090a950a00b001e2ebcce5d5sm1282857pjo.37.2022.05.31.02.15.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 02:15:20 -0700 (PDT) From: Nicholas Piggin To: pdbg@lists.ozlabs.org Date: Tue, 31 May 2022 19:14:55 +1000 Message-Id: <20220531091457.2208488-9-npiggin@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220531091457.2208488-1-npiggin@gmail.com> References: <20220531091457.2208488-1-npiggin@gmail.com> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 08/10] libpdbg: add fused-core thread id 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: Nicholas Piggin Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" libpdbg thread id is in small-core units because pervasive tends to be addressed by small core. However some PC registers contain fused-core thread ID fields, which need fused core indexing. Add thread->fc_id. Signed-off-by: Nicholas Piggin --- libpdbg/hwunit.h | 1 + libpdbg/p10chip.c | 19 +++++++++++++++++++ libpdbg/p8chip.c | 1 + libpdbg/p9chip.c | 18 ++++++++++++++++++ libpdbg/sbefifo.c | 10 ++++++++++ 5 files changed, 49 insertions(+) diff --git a/libpdbg/hwunit.h b/libpdbg/hwunit.h index 4f27e34c..23053b31 100644 --- a/libpdbg/hwunit.h +++ b/libpdbg/hwunit.h @@ -143,6 +143,7 @@ struct thread { struct thread_state status; void *gdbserver_priv; int id; + int fc_id; struct thread_state (*state)(struct thread *); int (*step)(struct thread *, int); int (*start)(struct thread *); diff --git a/libpdbg/p10chip.c b/libpdbg/p10chip.c index fc661d34..c0358ebc 100644 --- a/libpdbg/p10chip.c +++ b/libpdbg/p10chip.c @@ -90,13 +90,32 @@ struct thread_state p10_thread_state(struct thread *thread) return thread_state; } +static uint8_t p10_core_id(struct pdbg_target *core) +{ + return pdbg_target_index(core) & 0xff; +} + static int p10_thread_probe(struct pdbg_target *target) { + struct core *core = target_to_core(pdbg_target_require_parent("core", target)); struct thread *thread = target_to_thread(target); thread->id = pdbg_target_index(target); thread->status = thread->state(thread); + if (core->status.fused_core_mode) { + struct pdbg_target *parent; + uint8_t core_id; + + /* P10 uses core id as core-id */ + parent = pdbg_target_require_parent("core", target); + core_id = p10_core_id(parent); + + thread->fc_id = thread->id * 2 + (core_id % 2); + } else { + thread->fc_id = thread->id; + } + return 0; } diff --git a/libpdbg/p8chip.c b/libpdbg/p8chip.c index 1863af74..798db6c6 100644 --- a/libpdbg/p8chip.c +++ b/libpdbg/p8chip.c @@ -611,6 +611,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->fc_id = thread->id; thread->status = thread->state(thread); return 0; diff --git a/libpdbg/p9chip.c b/libpdbg/p9chip.c index 1167dac8..28e98762 100644 --- a/libpdbg/p9chip.c +++ b/libpdbg/p9chip.c @@ -111,13 +111,31 @@ struct thread_state p9_thread_state(struct thread *thread) return thread_state; } +static uint8_t p9_core_id(struct pdbg_target *core) +{ + return pdbg_target_index(core) & 0xff; +} + static int p9_thread_probe(struct pdbg_target *target) { + struct core *core = target_to_core(pdbg_target_require_parent("core", target)); struct thread *thread = target_to_thread(target); thread->id = pdbg_target_index(target); thread->status = thread->state(thread); + if (core->status.fused_core_mode) { + struct pdbg_target *parent; + uint8_t core_id; + + parent = pdbg_target_require_parent("core", target); + core_id = p9_core_id(parent); + + thread->fc_id = thread->id * 2 + (core_id % 2); + } else { + thread->fc_id = thread->id; + } + return 0; } diff --git a/libpdbg/sbefifo.c b/libpdbg/sbefifo.c index 3be19b80..7a9f614a 100644 --- a/libpdbg/sbefifo.c +++ b/libpdbg/sbefifo.c @@ -375,11 +375,21 @@ static uint8_t sbefifo_core_id(struct sbefifo_context *sctx, struct thread *thre static int sbefifo_thread_probe(struct pdbg_target *target) { + struct pdbg_target *parent = pdbg_target_require_parent("core", target); + struct core *core = target_to_core(parent); struct thread *thread = target_to_thread(target); thread->id = pdbg_target_index(target); thread->status = thread->state(thread); + if (core->status.fused_core_mode) { + uint8_t core_id = pdbg_target_index(parent) & 0xff; + + thread->fc_id = thread->id * 2 + (core_id % 2); + } else { + thread->fc_id = thread->id; + } + return 0; } From patchwork Tue May 31 09:14:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1637268 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=W0jC9ifJ; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4LC67h3F4fz9s1l for ; Tue, 31 May 2022 19:15:28 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4LC67h252rz3bkk for ; Tue, 31 May 2022 19:15:28 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=W0jC9ifJ; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::1030; helo=mail-pj1-x1030.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=W0jC9ifJ; dkim-atps=neutral Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4LC67d6JJfz3bf9 for ; Tue, 31 May 2022 19:15:25 +1000 (AEST) Received: by mail-pj1-x1030.google.com with SMTP id m14-20020a17090a414e00b001df77d29587so2002945pjg.2 for ; Tue, 31 May 2022 02:15:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IT0ZU7o+1IxesbGsBKl+nAlyZibUzobJDuUOWxn6lf8=; b=W0jC9ifJYHVZmXc6MmyhsrC5Au33vWMYGcPgwPAqOQ1vgVVAZpOR3WTcld5D769py5 J+I3YDrIxGSG0EhlqgDlJpKEq2O1YfzhlTzLkiPZHIMpBhxIzyhBtYZvFu4WRbS7col/ CLglAEJFqeGKbuMJ6bQnOa4oWRyAdd2tctlXE+/EyGM0W7xFxkBf2hgGiLV9RRNQFEAe qZKI7BlaAXTFiN1RzInUJuJppeiJktf/D8g1VphZad6Ycr3rpZsBs9JAeSa1/T++gEhU Mrg4x8BFZMwSbmijimy/Qf0AmiajkegtXQ5oiCQ3yp8sxPIDWQR8lP0X75H2bSZCCbrE lu7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IT0ZU7o+1IxesbGsBKl+nAlyZibUzobJDuUOWxn6lf8=; b=KZv/31VTXqmn233htOCBoJJNAs0L6lrUBQ3iLSeuyK7qUCkIreRCIuh5zeco/Y4v3q j8Dadj7VsTiyauSFnBVx4B9KyLQJb3WTwFJ6USB6cOrpecU8IK1xRKWACHJUSrAFIIY1 G71+F/qKVzLLKC/bN4YN5X6cOVwIBoNShG9sESajxrh9ZC3dZC44RhWcnMeBb03FPbgd BmbZYxTwk6I3+JCREUvrkqCKgi+7IJY8cdgZqebcILL6Jqh7ln09/4D+2iOdtkS/3dmN 9tGloL03aSpBrNBQH9Z39D4Gw1vlhdvpZj5FQqepe2eyhbbEFyUCAWna+KX50Y3323S/ HKNg== X-Gm-Message-State: AOAM533wklrwAXr5ngvbtA6iBOUyVCsEiuzQC3TQ13+XdIWJcdQq2w5Z LEkzIUyoVMV65oKVu6ycHte9sE1oAMkWEQ== X-Google-Smtp-Source: ABdhPJw1iJ2YESa0hZ76VHrwiWUolN76wRhvyACoX6tdWE3nW2FCmJNJRhlw7a16O3h8T02uw1L+XA== X-Received: by 2002:a17:902:a988:b0:158:9877:6c2c with SMTP id bh8-20020a170902a98800b0015898776c2cmr60597794plb.80.1653988523425; Tue, 31 May 2022 02:15:23 -0700 (PDT) Received: from bobo.ozlabs.ibm.com (220-245-15-130.tpgi.com.au. [220.245.15.130]) by smtp.gmail.com with ESMTPSA id t10-20020a17090a950a00b001e2ebcce5d5sm1282857pjo.37.2022.05.31.02.15.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 02:15:23 -0700 (PDT) From: Nicholas Piggin To: pdbg@lists.ozlabs.org Date: Tue, 31 May 2022 19:14:56 +1000 Message-Id: <20220531091457.2208488-10-npiggin@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220531091457.2208488-1-npiggin@gmail.com> References: <20220531091457.2208488-1-npiggin@gmail.com> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 09/10] gdbserver: Fix POWER10 fused-core SPATTN register handling 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: Nicholas Piggin Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" POWER10 in fused-core mode, when a thread executes an attn instruction, the SPATTN thread bits are set according to fused-core thread ID. The SPATTN registers for both small cores become set. So use fc_id, and add logic to clear thread IDs that belong to the other small core in the pair. Signed-off-by: Nicholas Piggin --- src/pdbgproxy.c | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/src/pdbgproxy.c b/src/pdbgproxy.c index 29845762..5d06c243 100644 --- a/src/pdbgproxy.c +++ b/src/pdbgproxy.c @@ -928,39 +928,56 @@ static void v_contc(uint64_t *stack, void *priv) static bool thread_check_attn(struct pdbg_target *target) { struct thread *thread = target_to_thread(target); - struct pdbg_target *core; + struct pdbg_target *parent; uint64_t spattn; if (pdbg_target_compatible(target, "ibm,power8-thread")) { return true; /* XXX */ } else if (pdbg_target_compatible(target, "ibm,power9-thread")) { - core = pdbg_target_require_parent("core", target); - if (pib_read(core, P9_SPATTN, &spattn)) { + parent = pdbg_target_require_parent("core", target); + if (pib_read(parent, P9_SPATTN, &spattn)) { PR_ERROR("SPATTN read failed\n"); return false; } + /* XXX: does this need to use fc_id like P10? */ if (spattn & PPC_BIT(1 + 4*thread->id)) { uint64_t mask = ~PPC_BIT(1 + 4*thread->id); - if (pib_write(core, P9_SPATTN_AND, mask)) { + if (pib_write(parent, P9_SPATTN_AND, mask)) { PR_ERROR("SPATTN clear failed\n"); return false; } return true; } + } else if (pdbg_target_compatible(target, "ibm,power10-thread")) { - core = pdbg_target_require_parent("core", target); - if (pib_read(core, P10_SPATTN, &spattn)) { + struct core *core; + + parent = pdbg_target_require_parent("core", target); + core = target_to_core(target); + + if (pib_read(parent, P10_SPATTN, &spattn)) { PR_ERROR("SPATTN read failed\n"); return false; } - if (spattn & PPC_BIT(1 + 4*thread->id)) { - uint64_t mask = ~PPC_BIT(1 + 4*thread->id); + /* Workaround SPATTN being set in both small-core regs */ + if (core->status.fused_core_mode && + (spattn & PPC_BIT(1 + 4*(thread->fc_id ^ 1)))) { + uint64_t mask = ~PPC_BIT(1 + 4*(thread->fc_id ^ 1)); + + if (pib_write(parent, P10_SPATTN_AND, mask)) { + PR_ERROR("SPATTN clear failed\n"); + return false; + } + } + + if (spattn & PPC_BIT(1 + 4*thread->fc_id)) { + uint64_t mask = ~PPC_BIT(1 + 4*thread->fc_id); - if (pib_write(core, P10_SPATTN_AND, mask)) { + if (pib_write(parent, P10_SPATTN_AND, mask)) { PR_ERROR("SPATTN clear failed\n"); return false; } From patchwork Tue May 31 09:14:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 1637269 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=fl2TRUze; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=112.213.38.117; helo=lists.ozlabs.org; envelope-from=pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4LC67p4LgWz9s1l for ; Tue, 31 May 2022 19:15:34 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4LC67p3Ftfz3bgC for ; Tue, 31 May 2022 19:15:34 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=fl2TRUze; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::1035; helo=mail-pj1-x1035.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=fl2TRUze; dkim-atps=neutral Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4LC67h1hJWz3bkQ for ; Tue, 31 May 2022 19:15:27 +1000 (AEST) Received: by mail-pj1-x1035.google.com with SMTP id v5-20020a17090a7c0500b001df84fa82f8so1678270pjf.5 for ; Tue, 31 May 2022 02:15:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3+x5cIv7M5fDzddG56XzhHsgcD1hdyGBhuQgGAfs3Bw=; b=fl2TRUzedZOOI1VHnBlQ/61uGHYbaKP2p+FEDUDL4oFLPL+juDN7LXCCU4ymmNLj+8 UgLFKglDIeVZH3BO/7jeCbtgGGUu6XlIHQLhThAkIpyFje5b/SvzYfeDxXKD71fvFDY3 GZhS9U+AR0aPL5UBqMpi0buRlrsBy+ZBmMawEmgWxwS2P3e0S7r/XRhLPuP3yPmW3+2R kOrmEJFrCCeNwGjFQx+/UM5K27hMOn5TvhyPAhkAKfhxxggkZQZKRf7C/AB6QjIxs8lZ S5VSTx403mJCB9D3VrMKIc/ju+LX+k5pse+IIAGXDmbbXpwaPMS3wzKAp5+rAnYQB0aC 1W0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3+x5cIv7M5fDzddG56XzhHsgcD1hdyGBhuQgGAfs3Bw=; b=7fttZhu1vaxuAO6MRyg6TL5sKSKW7S8KMN91bv5de1q5Rzit+GiNLZ8y9c4gl5jArS sDqmMuVoNON9ydtFDeSY7PNhkgDd8f7EPxiwLM3sj1rXYKxhrLpHY8/8Dc6gFPJMu1eo 8WKDXTiQcje4L2d+fA6sCo3JZol3xIP2HWqBqGgyrb1Gl4QNLst1v84Ss9ncKR+FTC/E c7919ziKKjcMKBJn4NaIpVv2dqyQMnv83a90+jycsOBkVeJjzeHXyKxjUoul6vxVVn37 01yHdep4bisTKce/QxPsjOxub4PgFEU5tT8SWGBkX1vQ9ckjhq8HRAJeALoA/mW+Snid 0ADw== X-Gm-Message-State: AOAM531pqXrWOeJDOOKUekAcwnynrKe1HUxb7DHAdS9u2SvQ0bll9RzM Zhj59Q4h2MOgfG6ZEoecGHtHZ9aWVczm8A== X-Google-Smtp-Source: ABdhPJzukavlMsq6l8Led2CUpl5X2fdtXE+krcAho5usDtDPxWggUnR+DKOcUEW2hN23yTljStyWKg== X-Received: by 2002:a17:902:e552:b0:163:6a5e:4e08 with SMTP id n18-20020a170902e55200b001636a5e4e08mr27364847plf.130.1653988525797; Tue, 31 May 2022 02:15:25 -0700 (PDT) Received: from bobo.ozlabs.ibm.com (220-245-15-130.tpgi.com.au. [220.245.15.130]) by smtp.gmail.com with ESMTPSA id t10-20020a17090a950a00b001e2ebcce5d5sm1282857pjo.37.2022.05.31.02.15.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 02:15:25 -0700 (PDT) From: Nicholas Piggin To: pdbg@lists.ozlabs.org Date: Tue, 31 May 2022 19:14:57 +1000 Message-Id: <20220531091457.2208488-11-npiggin@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220531091457.2208488-1-npiggin@gmail.com> References: <20220531091457.2208488-1-npiggin@gmail.com> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 10/10] gdbserver: Add a note about the attn_handler service on the BMC 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: Nicholas Piggin Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" gdbserver's use of attn for breakpoints is not well integrated into the rest of the firmware stack at the moment. attn firing can cause the BMC to perform error handling (e.g., PEL, reboot). Add a note to the README to disable the attn_handler.service if breakpoints are to be used with gdbserver. While we're here update the documentation to reflect that we no longer have to stop all threads before running gdbserver. Signed-off-by: Nicholas Piggin --- README.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f97b6824..338dba2e 100644 --- a/README.md +++ b/README.md @@ -540,12 +540,15 @@ Memory access can only be performed on kernel memory. To run a gdbserver on a machine from a BMC running OpenBMC: -Stop all the threads of the core(s) you want to look at. Ideally all -threads in the machine should be debugged: +* Read NOTES and set up the BMC and host as recommended. + +* (Optional) Stop the threads of the core(s) you want to look at. Ideally + all threads in the machine should be debugged: $ ./pdbg -a stop -Run gdbserver on the target threads, accessible through port 44 +* Run gdbserver on the target threads, accessible through port 44 + $ ./pdbg -a gdbserver 44 The thread-id tid is set to the PIR of the corresponding thread, the @@ -580,6 +583,12 @@ good idea. misbehaving, booting Linux with powersave=off is the first thing to try. 5. attn instructions seem to cause host hangs on POWER9. gdb breakpoints should not be used. +6. attn instructions can cause the service processor to begin error handling. + If breakpoints are to be used, the attn handler service on the BMC should + be stopped first (don't forget to start it again when done). + + systemctl stop attn_handler.service + ## Submitting patches