From patchwork Wed May 6 05:49:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1284068 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49H5KS5Hdyz9sSt for ; Wed, 6 May 2020 15:50:20 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=w8B6/Ggi; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 49H5KS4KKPzDql6 for ; Wed, 6 May 2020 15:50:20 +1000 (AEST) X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [203.11.71.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 49H5K12xtVzDqkk for ; Wed, 6 May 2020 15:49:57 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=w8B6/Ggi; 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 49H5K10czMz9sSt; Wed, 6 May 2020 15:49:57 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1588744197; bh=FvPcon8BPkgPqEj9C+faJEWDn+tw/gcJ8etfhQhROAY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w8B6/GgipMBAXMKBdnnaWlZTowxcZyQa0Mw4B/w5q0ITO4Rrtisrcz1l9FCog0XTK wWeCAFYxjUghDPmhtFSp1qbQiqm3kNSAwwp0zFnuOgSKrzRa1ckTpAbRK6wKL+KMTH GF9W11YbX4HrJQm3uknOL8Dkafv5l7R8Yzy6Ih9x8t51DH/bkDOUREi2mzSZvTVaZo i6IS55hNQwY4KQHbnI0/PJ7OxAu+7xp2wq/SK06hqXHtqqLFzIgafDQ4thaWzOhfCt x9E7xvhv4nyS0k0aKJztsidri7PPsqLZI2hA03YS7WsOU7yA/lyQuMIeaiMyNlFfL4 Zx1Hivu9kb1ng== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Wed, 6 May 2020 15:49:46 +1000 Message-Id: <20200506054948.153723-2-amitay@ozlabs.org> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200506054948.153723-1-amitay@ozlabs.org> References: <20200506054948.153723-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 1/3] libsbeinfo: Add GET_TI_INFO chip-op 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 --- libsbefifo/cmd_mpipl.c | 57 ++++++++++++++++++++++++++++++++++++ libsbefifo/libsbefifo.h | 2 +- libsbefifo/sbefifo_private.h | 1 + 3 files changed, 59 insertions(+), 1 deletion(-) diff --git a/libsbefifo/cmd_mpipl.c b/libsbefifo/cmd_mpipl.c index e397db4..1d32494 100644 --- a/libsbefifo/cmd_mpipl.c +++ b/libsbefifo/cmd_mpipl.c @@ -179,3 +179,60 @@ int sbefifo_mpipl_stopclocks(struct sbefifo_context *sctx, uint16_t target_type, return rc; } + +static int sbefifo_mpipl_get_ti_info_push(uint8_t **buf, uint32_t *buflen) +{ + uint32_t *msg; + uint32_t nwords, cmd; + + nwords = 2; + *buflen = nwords * sizeof(uint32_t); + msg = malloc(*buflen); + if (!msg) + return ENOMEM; + + cmd = SBEFIFO_CMD_CLASS_MPIPL | SBEFIFO_CMD_GET_TI_INFO; + + msg[0] = htobe32(nwords); + msg[1] = htobe32(cmd); + + *buf = (uint8_t *)msg; + return 0; +} + +static int sbefifo_mpipl_get_ti_info_pull(uint8_t *buf, uint32_t buflen, uint8_t **data, uint32_t *data_len) +{ + if (buflen < 4) + return EPROTO; + + *data_len = be32toh(*(uint32_t *) &buf[buflen-4]); + *data = malloc(*data_len); + if (! *data) + return ENOMEM; + + memcpy(*data, buf, *data_len); + return 0; +} + +int sbefifo_mpipl_get_ti_info(struct sbefifo_context *sctx, uint8_t **data, uint32_t *data_len) +{ + uint8_t *msg, *out; + uint32_t msg_len, out_len; + int rc; + + rc = sbefifo_mpipl_get_ti_info_push(&msg, &msg_len); + if (rc) + return rc; + + out_len = 0; + rc = sbefifo_operation(sctx, msg, msg_len, &out, &out_len); + free(msg); + if (rc) + return rc; + + rc = sbefifo_mpipl_get_ti_info_pull(out, out_len, data, data_len); + if (out) + free(out); + + return rc; +} diff --git a/libsbefifo/libsbefifo.h b/libsbefifo/libsbefifo.h index 5a0f745..2efb25c 100644 --- a/libsbefifo/libsbefifo.h +++ b/libsbefifo/libsbefifo.h @@ -124,6 +124,6 @@ int sbefifo_quiesce(struct sbefifo_context *sctx); int sbefifo_mpipl_enter(struct sbefifo_context *sctx); int sbefifo_mpipl_continue(struct sbefifo_context *sctx); int sbefifo_mpipl_stopclocks(struct sbefifo_context *sctx, uint16_t target_type, uint8_t chiplet_id); - +int sbefifo_mpipl_get_ti_info(struct sbefifo_context *sctx, uint8_t **data, uint32_t *data_len); #endif /* __LIBSBEFIFO_H__ */ diff --git a/libsbefifo/sbefifo_private.h b/libsbefifo/sbefifo_private.h index ef432c4..d94112f 100644 --- a/libsbefifo/sbefifo_private.h +++ b/libsbefifo/sbefifo_private.h @@ -61,6 +61,7 @@ #define SBEFIFO_CMD_ENTER_MPIPL 0x01 #define SBEFIFO_CMD_CONTINUE_MPIPL 0x02 #define SBEFIFO_CMD_STOP_CLOCKS 0x03 +#define SBEFIFO_CMD_GET_TI_INFO 0x04 struct sbefifo_context { int fd; From patchwork Wed May 6 05:49:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1284066 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49H5KJ0gW1z9sSt for ; Wed, 6 May 2020 15:50:12 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=w6+7HhjS; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 49H5KH6rz1zDqlP for ; Wed, 6 May 2020 15:50:11 +1000 (AEST) X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [203.11.71.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 49H5K15K9dzDqkm for ; Wed, 6 May 2020 15:49:57 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=w6+7HhjS; 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 49H5K13HYZz9sSw; Wed, 6 May 2020 15:49:57 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1588744197; bh=7BRdskAMOAI3mqpounhXhabrGpmdP7youn+jzddCfsA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w6+7HhjSC9H4r+e7gWqG9RW9SWSBlZ/KYdQ5MLjrwK2tvQTMBRDgi4onX+9toxRmi uBvgp8wfpMUernu4ooUm7vMiUqO+NfRpsgxaHNGabiTPD8QZ/zqUaLrjzc9jUrZCM+ tLDHKSo96q7v0DeHNHkCKBPj0gGC/Qqe9UA7z4EkK055kSgX/IbcFFIQl34jWznhOC 8S/jRGJ67cXPShfUjHXcCydCV2rYFOsRE064cWrJilhGGb8FjYnzgoCUEwsg5puXqN QCBC0w24zWwZgTVx3aGyN6jNjD9czPadMd8HcjQdFIDJDhFtnjV+bCDyzloob/dyVq YvdqR8V5xmZ5w== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Wed, 6 May 2020 15:49:47 +1000 Message-Id: <20200506054948.153723-3-amitay@ozlabs.org> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200506054948.153723-1-amitay@ozlabs.org> References: <20200506054948.153723-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 2/3] libpdbg: Add mpipl_get_ti_info procedure to chipop 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 --- libpdbg/hwunit.h | 1 + libpdbg/sbefifo.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/libpdbg/hwunit.h b/libpdbg/hwunit.h index c30c048..61aea0f 100644 --- a/libpdbg/hwunit.h +++ b/libpdbg/hwunit.h @@ -76,6 +76,7 @@ struct chipop { int (*istep)(struct chipop *, uint32_t major, uint32_t minor); int (*mpipl_enter)(struct chipop *); int (*mpipl_continue)(struct chipop *); + int (*mpipl_get_ti_info)(struct chipop *, uint8_t **, uint32_t *); }; #define target_to_chipop(x) container_of(x, struct chipop, target) diff --git a/libpdbg/sbefifo.c b/libpdbg/sbefifo.c index 3b2a786..eadce10 100644 --- a/libpdbg/sbefifo.c +++ b/libpdbg/sbefifo.c @@ -195,6 +195,14 @@ static int sbefifo_op_mpipl_enter(struct chipop *chipop) return sbefifo_mpipl_enter(sctx); } +static int sbefifo_op_mpipl_get_ti_info(struct chipop *chipop, uint8_t **data, uint32_t *data_len) +{ + struct sbefifo *sbefifo = target_to_sbefifo(chipop->target.parent); + struct sbefifo_context *sctx = sbefifo->get_sbefifo_context(sbefifo); + + return sbefifo_mpipl_get_ti_info(sctx, data, data_len); +} + static struct sbefifo *pib_to_sbefifo(struct pdbg_target *pib) { struct pdbg_target *target; @@ -399,6 +407,7 @@ static struct chipop sbefifo_chipop = { .istep = sbefifo_op_istep, .mpipl_enter = sbefifo_op_mpipl_enter, .mpipl_continue = sbefifo_op_mpipl_continue, + .mpipl_get_ti_info = sbefifo_op_mpipl_get_ti_info, }; DECLARE_HW_UNIT(sbefifo_chipop); From patchwork Wed May 6 05:49:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1284069 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49H5KZ0S03z9sSy for ; Wed, 6 May 2020 15:50:26 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=MYk2nKY5; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 49H5KY1Y3gzDqlD for ; Wed, 6 May 2020 15:50:25 +1000 (AEST) X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 49H5K2328QzDqkg for ; Wed, 6 May 2020 15:49:58 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=MYk2nKY5; 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 49H5K15hY1z9sSy; Wed, 6 May 2020 15:49:57 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1588744197; bh=PHp9MP0LmbChLMPrWWtLvysQbEQ6rGpd7TsWGjTbd/8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MYk2nKY5HZXs+gQzqwhcEyFfxOcSG7VV4jBbzuMHAUHxZ0LAMiXTpFIVQ9SP1oqne hCUWSu5TMmjUPsPVbbxSqqLGIRf573EBbGWvbVC6jEfBgIEAz2e9HCBOC5VFiC+Rlp Nn/QAWXC6lewobGtY5F0a+1kZSukl96CRMbSTa+U2wsoaJaqgaNvDNe3WjqPRhl9TS X0wCSXvR1KXDAPMhYNHSbPLgipwr6FD9d64utas6etjwTGYLBsjs2M1Ycyu/+wfKEC 73nk4+TQ4ZcK/Z7+Xojmv9xms6AxOZSsiUpHSNFO3ueOm9BI1szG5UCg9NiFhERBzS 4cHvJ0Ze7NZsw== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Wed, 6 May 2020 15:49:48 +1000 Message-Id: <20200506054948.153723-4-amitay@ozlabs.org> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200506054948.153723-1-amitay@ozlabs.org> References: <20200506054948.153723-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 3/3] libpdbg: Add api to get ti info 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 --- libpdbg/libpdbg.h | 11 +++++++++++ libpdbg/target.c | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/libpdbg/libpdbg.h b/libpdbg/libpdbg.h index bdc6cea..b16b3a9 100644 --- a/libpdbg/libpdbg.h +++ b/libpdbg/libpdbg.h @@ -1257,6 +1257,17 @@ int sbe_mpipl_enter(struct pdbg_target *target); */ int sbe_mpipl_continue(struct pdbg_target *target); +/** + * @brief Get ti info + * + * @param[in] target pib target to operate on + * @param[out] data TI information + * @param[out] data_len length of the data + * + * @return 0 on success, -1 on failure + */ +int sbe_mpipl_get_ti_info(struct pdbg_target *target, uint8_t **data, uint32_t *data_len); + /** * @brief Type for specifying a progress callback for long running * operations diff --git a/libpdbg/target.c b/libpdbg/target.c index 501e019..99bce92 100644 --- a/libpdbg/target.c +++ b/libpdbg/target.c @@ -345,6 +345,17 @@ int sbe_mpipl_continue(struct pdbg_target *target) return chipop->mpipl_continue(chipop); } +int sbe_mpipl_get_ti_info(struct pdbg_target *target, uint8_t **data, uint32_t *data_len) +{ + struct chipop *chipop; + + chipop = pib_to_chipop(target); + if (!chipop) + return -1; + + return chipop->mpipl_get_ti_info(chipop, data, data_len); +} + uint32_t sbe_ffdc_get(struct pdbg_target *target, const uint8_t **ffdc, uint32_t *ffdc_len) { struct chipop *chipop;