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; }