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