From patchwork Fri Jan 28 06:12:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1585509 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; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=qqoNbJ1k; 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 (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JlRvV033Zz9t3b for ; Fri, 28 Jan 2022 17:12:37 +1100 (AEDT) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4JlRvS3nQrz3bSs for ; Fri, 28 Jan 2022 17:12:36 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=qqoNbJ1k; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee2:21ea]) (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 4JlRvN70rrz301M for ; Fri, 28 Jan 2022 17:12:32 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=qqoNbJ1k; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4JlRvN3X5dz4xcS; Fri, 28 Jan 2022 17:12:32 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ozlabs.org; s=201707; t=1643350352; bh=dLRk2L2lYXglM8NejQ/xXy/3Zof1n0gJ6wsjbmBxOy0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qqoNbJ1kR1Pd5y2cIpC+A5lHQVYOk7vtaNnL+XWTi/j0reDyjE2OrCJUNfAekFwN4 SJ+f/Vri4hwTDp5zvSrpiHKR0C3NFTcn4mvpxO5IP3iS5XNBj3lncENNIUbQNHfvyR wxwpk1BgltIFcL4gPS4s/JXkW5PaRwLE3LuopjFmkndTfkRf/E7y9e8Df+RCm1AzP4 5fY8B8zmNVKvBw92BgfuGQ4zzP79FW5tsHChniOE5ZmHXAXPSeonVccOwPVOe6j7Ps Xx1uUELovUfvZ2zKk9hxneDxykcRNE5FVQsxul2QfpaY6cHzk0lShad9GaaFE0N2uO DEVDSZ8PdNbIQ== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Fri, 28 Jan 2022 17:12:19 +1100 Message-Id: <20220128061221.1054173-2-amitay@ozlabs.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220128061221.1054173-1-amitay@ozlabs.org> References: <20220128061221.1054173-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 1/3] libpdbg: Add api to set short/long running application context X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "mailing list for https://github.com/open-power/pdbg development" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Amitay Isaacs Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" For P10 systems, BMC applications use libpdbg for hardware access and are typically long running. Such applications may need slightly different behaviour of libpdbg when doing probe or other hardware access than pdbg tool. The default behaviour of libpdbg is set to be used in long running application. Pdbg tool (or similar applications, e.g. ecmd) can set the short running application context explicitly using pdbg_context_short(). Signed-off-by: Amitay Isaacs --- libpdbg/libpdbg.c | 17 +++++++++++++++++ libpdbg/libpdbg.h | 9 +++++++++ libpdbg/target.h | 2 ++ 3 files changed, 28 insertions(+) diff --git a/libpdbg/libpdbg.c b/libpdbg/libpdbg.c index bca727e..a153b07 100644 --- a/libpdbg/libpdbg.c +++ b/libpdbg/libpdbg.c @@ -5,6 +5,7 @@ #include "libpdbg.h" static pdbg_progress_tick_t progress_tick; +static bool pdbg_short_context = false; struct pdbg_target *get_parent(struct pdbg_target *target, bool system) { @@ -342,3 +343,19 @@ void pdbg_set_progress_tick(pdbg_progress_tick_t fn) { progress_tick = fn; } + +bool pdbg_context_short(void) +{ + if (pdbg_target_root()) { + pdbg_log(PDBG_ERROR, "pdbg_context_short() must be called before pdbg_targets_init()\n"); + return false; + } + + pdbg_short_context = true; + return true; +} + +bool pdbg_context_is_short(void) +{ + return pdbg_short_context; +} diff --git a/libpdbg/libpdbg.h b/libpdbg/libpdbg.h index 633d571..05e54f7 100644 --- a/libpdbg/libpdbg.h +++ b/libpdbg/libpdbg.h @@ -1441,6 +1441,15 @@ void pdbg_set_loglevel(int loglevel); */ void pdbg_log(int loglevel, const char *fmt, ...); +/** + * @brief Set the library context for short running application + * + * This distinguishes the long running applications using libpdbg from the + * pdbg tool like applications which terminate after short execution and do + * not set particular hardware state for a long time. + */ +bool pdbg_context_short(void); + #ifdef __cplusplus } #endif diff --git a/libpdbg/target.h b/libpdbg/target.h index 5fb4e63..5cc694c 100644 --- a/libpdbg/target.h +++ b/libpdbg/target.h @@ -95,4 +95,6 @@ bool target_is_virtual(struct pdbg_target *target); struct pdbg_target *target_to_real(struct pdbg_target *target, bool strict); struct pdbg_target *target_to_virtual(struct pdbg_target *target, bool strict); +bool pdbg_context_is_short(void); + #endif From patchwork Fri Jan 28 06:12:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1585512 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; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=MxAmRtC0; 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 (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JlRvW6tvyz9t3b for ; Fri, 28 Jan 2022 17:12:39 +1100 (AEDT) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4JlRvW52Y3z30Mn for ; Fri, 28 Jan 2022 17:12:39 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=MxAmRtC0; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee2:21ea]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4JlRvP19hfz30QR for ; Fri, 28 Jan 2022 17:12:33 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=MxAmRtC0; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4JlRvN49LZz4xcV; Fri, 28 Jan 2022 17:12:32 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ozlabs.org; s=201707; t=1643350352; bh=eoMyWHbi6c4vMwZIY1zDkATbBssA933T/do0tW2Towc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MxAmRtC0lbl8n49PCtFzI8RSu9vhKFVymKIX+HMZo37hzzG5MoaflV+yNOgfpYO9x 9XxRFD9eOQf1clTazNxC0hMDRjLCknD8InmMN3U8MhmGE4JciDWVAKmCYIeu8Vwyyz dUAS8FqKIahWLNMH4Jn7lH+ShflcVcLAwuFZ8/ZjiYDDQTMnUXa7rOExCBeKwfTudD +wwPOYV3L11Qrzz/Pc0SrCSGV6sMCypIWR2c3JrmZMNEIJwZS6beJVRdYN05vSOxBb SxtOwIyQjsZa7yWi1LYxahKM7tPspBm+6vFhHb4i2Pr2hKBxjAL9Ewlv/R8dHX/BbA LXP+l1Kan5R7Q== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Fri, 28 Jan 2022 17:12:20 +1100 Message-Id: <20220128061221.1054173-3-amitay@ozlabs.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220128061221.1054173-1-amitay@ozlabs.org> References: <20220128061221.1054173-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 2/3] main: Set the short running application context for pdbg tool X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "mailing list for https://github.com/open-power/pdbg development" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Amitay Isaacs Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Signed-off-by: Amitay Isaacs --- src/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main.c b/src/main.c index 461033e..3da15cc 100644 --- a/src/main.c +++ b/src/main.c @@ -597,6 +597,8 @@ int main(int argc, char *argv[]) return 1; } + pdbg_context_short(); + if (backend) if (!pdbg_set_backend(backend, device_node)) return 1; From patchwork Fri Jan 28 06:12:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1585510 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; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=ZQNs5srN; 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 (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JlRvV06Ldz9t56 for ; Fri, 28 Jan 2022 17:12:37 +1100 (AEDT) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4JlRvT3swkz3bTH for ; Fri, 28 Jan 2022 17:12:37 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=ZQNs5srN; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee2:21ea]) (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 4JlRvP0Fd2z30Mn for ; Fri, 28 Jan 2022 17:12:33 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=ZQNs5srN; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4JlRvN53Fhz4xcY; Fri, 28 Jan 2022 17:12:32 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ozlabs.org; s=201707; t=1643350352; bh=aobJKzRmRr5Lm0WcePujcdsfkZCYday5d1OzKrmcprI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZQNs5srNVJ5PFIX4vONyEdMI2EXSW3VD7mLdHm76I0m/kV+n97beQKN7A8PFAXz2J Vqahf1iEqUpaVdT6aHhZ4ACMKjz3y53sjztJI994mIO+aFjWj8cl3EVj1eoKBeWKCE xOowoKdfFQvChUhRkRlEyMm/ay6Fyvb+yAjnvnstFbb67+/njN4uZNCgAsDUgD/C3h 0IkCRE7k1UZS7b+Y+QUCPCew0JAFEXoNKRystrrDki8LXCYfBGWuyss/QVVEiLmpuY bOqXyJa8FSZZ1ct980vxVZMeiotcElSm0zrqvdXQ8J8ew7zFzrhCC+ISQ2cRdwDQg1 u1B9Xko48myyA== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Fri, 28 Jan 2022 17:12:21 +1100 Message-Id: <20220128061221.1054173-4-amitay@ozlabs.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220128061221.1054173-1-amitay@ozlabs.org> References: <20220128061221.1054173-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 3/3] libpdbg: For p10 do not assert special wakeup for core by default X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "mailing list for https://github.com/open-power/pdbg development" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Amitay Isaacs Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" For p10 systems, the default behaviour (for long running bmc applications) of libpdbg is to not assert special wakeup, as the applications are not supposed to use special wakeup. So only assert special wakeup if running short applications such as pdbg tool. Signed-off-by: Amitay Isaacs --- libpdbg/p10chip.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libpdbg/p10chip.c b/libpdbg/p10chip.c index f5c3b9f..e0d9ee2 100644 --- a/libpdbg/p10chip.c +++ b/libpdbg/p10chip.c @@ -200,6 +200,16 @@ static int p10_core_probe(struct pdbg_target *target) uint64_t value; int i = 0; + /* + * BMC applications using libpdbg, do not need special wakeup + * asserted by default. Only when running pdbg tool or equivalent + * assert special wakeup. + */ + if (!pdbg_context_is_short()) { + core->release_spwkup = false; + return 0; + } + CHECK_ERR(pib_write(target, QME_SPWU_FSP, PPC_BIT(0))); do { usleep(1000);