From patchwork Tue May 26 05:12:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1297691 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 49WMY54VZwz9sSk for ; Tue, 26 May 2020 15:12:57 +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=FlZwP8Jz; 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 49WMY53PHwzDqHl for ; Tue, 26 May 2020 15:12:57 +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) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 49WMXl756nzDqHl for ; Tue, 26 May 2020 15:12:39 +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=FlZwP8Jz; 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 49WMXl3wBYz9sRY; Tue, 26 May 2020 15:12:39 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1590469959; bh=YK5Mj9dgN5C3FUkUPL0mdDel+1NapKBzhM3R4CZUIAo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FlZwP8JzTMFY9NOyIw4FoeeSfarGu6znaUxNB1GDJMwiyfVkpRjceHbna6LhQgkQE hbw6uc7y8dPIAq7/VaSE+rlbcNUFuNmMwN+NEUyfNpqU8ZJFrwNfS3XbD9dFW8QT+h QRq79HHioGhmDQ2Ypwoz+4E+ayeSgnMkNyKySdYcfJkI+XlIOo+dV15O2iCsHHpXWc 02vjHNFSsdZzJpEgkgqzmBpV73MmtpL4cjqBW10CqZuzHmz+Exv6ffv4lWCzvOUvgH ubLCKOeAyhW6awa5rW/SmRTc7604hfiWSk9x/IQXre9wOCdOQc26H78RSRIAtEs8AK jo/AtYWc0TywA== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Tue, 26 May 2020 15:12:20 +1000 Message-Id: <20200526051226.70904-2-amitay@ozlabs.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200526051226.70904-1-amitay@ozlabs.org> References: <20200526051226.70904-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 1/7] libpdbg: Store fsi_fd state information in fsi structure 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" This allows to have different fd for different fsi targets. Also, we can close the fd cleanly in release procedure. Signed-off-by: Amitay Isaacs --- libpdbg/hwunit.h | 1 + libpdbg/kernel.c | 87 +++++++++++++++++++++++------------------------- 2 files changed, 43 insertions(+), 45 deletions(-) diff --git a/libpdbg/hwunit.h b/libpdbg/hwunit.h index 61aea0f..e3a8426 100644 --- a/libpdbg/hwunit.h +++ b/libpdbg/hwunit.h @@ -112,6 +112,7 @@ struct fsi { int (*read)(struct fsi *, uint32_t, uint32_t *); int (*write)(struct fsi *, uint32_t, uint32_t); enum chip_type chip_type; + int fd; }; #define target_to_fsi(x) container_of(x, struct fsi, target) diff --git a/libpdbg/kernel.c b/libpdbg/kernel.c index c4637a7..7914e50 100644 --- a/libpdbg/kernel.c +++ b/libpdbg/kernel.c @@ -33,7 +33,6 @@ #define OPENFSI_LEGACY_PATH "/sys/bus/platform/devices/gpio-fsi/" #define OPENFSI_PATH "/sys/class/fsi-master/" -int fsi_fd; const char *fsi_base; const char *kernel_get_fsi_path(void) @@ -66,14 +65,14 @@ static int kernel_fsi_getcfam(struct fsi *fsi, uint32_t addr64, uint32_t *value) int rc; uint32_t tmp, addr = (addr64 & 0x7ffc00) | ((addr64 & 0x3ff) << 2); - rc = lseek(fsi_fd, addr, SEEK_SET); + rc = lseek(fsi->fd, addr, SEEK_SET); if (rc < 0) { rc = errno; PR_WARNING("seek failed: %s\n", strerror(errno)); return rc; } - rc = read(fsi_fd, &tmp, 4); + rc = read(fsi->fd, &tmp, 4); if (rc < 0) { rc = errno; if ((addr64 & 0xfff) != 0xc09) @@ -93,7 +92,7 @@ static int kernel_fsi_putcfam(struct fsi *fsi, uint32_t addr64, uint32_t data) int rc; uint32_t tmp, addr = (addr64 & 0x7ffc00) | ((addr64 & 0x3ff) << 2); - rc = lseek(fsi_fd, addr, SEEK_SET); + rc = lseek(fsi->fd, addr, SEEK_SET); if (rc < 0) { rc = errno; PR_WARNING("seek failed: %s\n", strerror(errno)); @@ -101,7 +100,7 @@ static int kernel_fsi_putcfam(struct fsi *fsi, uint32_t addr64, uint32_t data) } tmp = htobe32(data); - rc = write(fsi_fd, &tmp, 4); + rc = write(fsi->fd, &tmp, 4); if (rc < 0) { rc = errno; PR_ERROR("Failed to write to 0x%08" PRIx32 " (%016" PRIx32 ")\n", addr, addr64); @@ -111,16 +110,6 @@ static int kernel_fsi_putcfam(struct fsi *fsi, uint32_t addr64, uint32_t data) return 0; } -#if 0 -/* TODO: At present we don't have a generic destroy method as there aren't many - * use cases for it. So for the moment we can just let the OS close the file - * descriptor on exit. */ -static void kernel_fsi_destroy(struct pdbg_target *target) -{ - close(fsi_fd); -} -#endif - static void kernel_fsi_scan_devices(void) { const char one = '1'; @@ -154,51 +143,59 @@ static void kernel_fsi_scan_devices(void) int kernel_fsi_probe(struct pdbg_target *target) { - if (!fsi_fd) { - int tries = 5; - int rc; - const char *kernel_path = kernel_get_fsi_path(); - char *path; - - if (!kernel_path) - return -1; - - rc = asprintf(&path, "%s/fsi0/slave@00:00/raw", kernel_get_fsi_path()); - if (rc < 0) { - PR_ERROR("Unable create fsi path\n"); - return rc; - } + struct fsi *fsi = target_to_fsi(target); + int tries = 5; + int rc; + const char *kernel_path = kernel_get_fsi_path(); + char *path; - while (tries) { - /* Open first raw device */ - fsi_fd = open(path, O_RDWR | O_SYNC); - if (fsi_fd >= 0) { - free(path); - return 0; - } - tries--; - - /* Scan */ - kernel_fsi_scan_devices(); - sleep(1); - } - if (fsi_fd < 0) { - PR_ERROR("Unable to open %s\n", path); + if (!kernel_path) + return -1; + + rc = asprintf(&path, "%s/fsi0/slave@00:00/raw", kernel_get_fsi_path()); + if (rc < 0) { + PR_ERROR("Unable create fsi path\n"); + return rc; + } + + while (tries) { + /* Open first raw device */ + fsi->fd = open(path, O_RDWR | O_SYNC); + if (fsi->fd >= 0) { free(path); - return -1; + return 0; } + tries--; + /* Scan */ + kernel_fsi_scan_devices(); + sleep(1); + } + if (fsi->fd < 0) { + PR_ERROR("Unable to open %s\n", path); + free(path); } return -1; } +static void kernel_fsi_release(struct pdbg_target *target) +{ + struct fsi *fsi = target_to_fsi(target); + + if (fsi->fd != -1) { + close(fsi->fd); + fsi->fd = -1; + } +} + static struct fsi kernel_fsi = { .target = { .name = "Kernel based FSI master", .compatible = "ibm,kernel-fsi", .class = "fsi", .probe = kernel_fsi_probe, + .release = kernel_fsi_release, }, .read = kernel_fsi_getcfam, .write = kernel_fsi_putcfam, From patchwork Tue May 26 05:12:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1297692 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 49WMYB0brwz9sSk for ; Tue, 26 May 2020 15:13:02 +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=pVcd0dLP; 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 49WMY96X1dzDqMV for ; Tue, 26 May 2020 15:13:01 +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)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 49WMXm1lSDzDqM0 for ; Tue, 26 May 2020 15:12:40 +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=pVcd0dLP; 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 49WMXl6NXqz9sSk; Tue, 26 May 2020 15:12:39 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1590469960; bh=r2pb+0fYN39MWH36Y/QEiaZe0FPLfOs9m7jT+UoOUwc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pVcd0dLPrI6KI9aowmw5HRwQiZd86BvYUXv1sapMC+83l1CNoMpgr/MLefTd6eMvd cYL1zAVi3SKVjyYRHfG1Q9sZ4jE1iikgKnoXroz9iyzrI800n8SOQ9f9nAi3IV1vfk M8UZAC8TrHqXl0xVBSqbrF/lKeMYFNo3E6uDj8ZlMb8khn2kl3oagpMtc5LEUtsy1+ VTjqv0MDfm6+3Zy/p/aSSfEL2r1xiKJIhzouNHEAFnAQGXBA/Nvayanlv+FfQ4ohzR alCWXyM4LMZQMGfily1ZyY6z/fYkwsdKAA/LtvvXrd1YZDbebW2xMSesCnFIlP0UH7 KkbNquFIIT+Mg== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Tue, 26 May 2020 15:12:21 +1000 Message-Id: <20200526051226.70904-3-amitay@ozlabs.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200526051226.70904-1-amitay@ozlabs.org> References: <20200526051226.70904-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 2/7] libpdbg: Do not hard-code fsi device path 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/kernel.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libpdbg/kernel.c b/libpdbg/kernel.c index 7914e50..2cc81f2 100644 --- a/libpdbg/kernel.c +++ b/libpdbg/kernel.c @@ -147,12 +147,16 @@ int kernel_fsi_probe(struct pdbg_target *target) int tries = 5; int rc; const char *kernel_path = kernel_get_fsi_path(); + const char *fsi_path; char *path; if (!kernel_path) return -1; - rc = asprintf(&path, "%s/fsi0/slave@00:00/raw", kernel_get_fsi_path()); + fsi_path = pdbg_target_property(target, "device-path", NULL); + assert(fsi_path); + + rc = asprintf(&path, "%s%s", kernel_get_fsi_path(), fsi_path); if (rc < 0) { PR_ERROR("Unable create fsi path\n"); return rc; From patchwork Tue May 26 05:12:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1297693 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 49WMYG2Q5sz9sRY for ; Tue, 26 May 2020 15:13:06 +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=BUa2eezb; 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 49WMYF5dP5zDqMX for ; Tue, 26 May 2020 15:13:05 +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)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 49WMXm5LBkzDqHl for ; Tue, 26 May 2020 15:12:40 +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=BUa2eezb; 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 49WMXm22Smz9sSs; Tue, 26 May 2020 15:12:40 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1590469960; bh=GSBKDcAaTJm9FrdWKRwkoQSRcuBI1GhPrbwplKdd60g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BUa2eezbF6HyO0Plbv07hFrZqRtMoBndQRWo1A7SNRHJj990ODIBXE67GSsJZo5D2 meGCEXYP4yUbs2k99aTPinIeTzuDRn6MU77yZNWhhuxmnjDYFDzNGlJMAWfTmEaVub dJ3dSDBJwEdcGt7QgBjujCYs66Qv/Vr8ebqa4SjR9Crwq3w4ktoyxsmn2hNWzVNCmU HDlhb6OfYB+3n+OpHQhXJMxB8A6D43++TzsU7KfW8gSpP67/+o70A0GdRnzwqX6CNl K+ZGVCk+n+w842uT7CocTuxKtzSBCy2yAdgdUxXZfhEtOEeke9XsbzmfQQYUToURyT iuYPNezGVtiZg== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Tue, 26 May 2020 15:12:22 +1000 Message-Id: <20200526051226.70904-4-amitay@ozlabs.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200526051226.70904-1-amitay@ozlabs.org> References: <20200526051226.70904-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 3/7] dts: Add fsi device (relative) path for kernel fsi driver 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 --- bmc-kernel.dts.m4 | 1 + bmc-sbefifo.dts.m4 | 1 + 2 files changed, 2 insertions(+) diff --git a/bmc-kernel.dts.m4 b/bmc-kernel.dts.m4 index 7cf43cf..ff9f527 100644 --- a/bmc-kernel.dts.m4 +++ b/bmc-kernel.dts.m4 @@ -54,6 +54,7 @@ define(`FSI_PRE', #size-cells = <0x1>; reg = <0x0 0x$1 0x8000>; compatible = "ibm,kernel-fsi"; + device-path = "/fsi0/slave@00:00/raw"; index = <0x$2>; system-path = "/proc$2/fsi"; status = "mustexist"; diff --git a/bmc-sbefifo.dts.m4 b/bmc-sbefifo.dts.m4 index f4ec4ab..1ffbce4 100644 --- a/bmc-sbefifo.dts.m4 +++ b/bmc-sbefifo.dts.m4 @@ -45,6 +45,7 @@ define(`FSI_PRE', #address-cells = <0x2>; #size-cells = <0x1>; compatible = "ibm,kernel-fsi"; + device-path = "/fsi0/slave@00:00/raw"; reg = <0x0 0x$1 0x8000>; index = <0x$2>; status = "mustexist"; From patchwork Tue May 26 05:12:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1297694 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 49WMYL5hpMz9sRY for ; Tue, 26 May 2020 15:13:10 +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=SjhwV46i; 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 49WMYL3PVJzDqM3 for ; Tue, 26 May 2020 15:13:10 +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)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 49WMXn1SfKzDqHl for ; Tue, 26 May 2020 15:12:41 +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=SjhwV46i; 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 49WMXm5fQQz9sRY; Tue, 26 May 2020 15:12:40 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1590469960; bh=IK8dvQJaMjRjy8DiRaQ55dzPXOhwqsNyELUttJWkeFI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SjhwV46i/LUKAMn93j0nxEB/y4c05L4lIIWAz1SKOJkv2J4x2L5XvSYd8wkm2Tg20 omy8TO71b644ZNTAIB6ZViyMgQL24dUh/dgpkmqgXtykpuqT0X2mktHo9N83dY18BT ZZcdQAniZMAWEu7QTEYr4yFJp9b5f+EnZhc9aUSeWT1kKWsJjA1JSgIZba0iw3fXjw 0296GYCTk1JBvEQktbM0WuLH560HBGaZ73Wg3kqSaXDxKImQwMl37ZCmkmx49bEJVH Auv7DKXZWhy9rgd8BvC3KlKbB/wWhwb8r/GZRAIOn9VF06KDSNluzT98dkja51XrtZ xhddCRTfdn0Bw== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Tue, 26 May 2020 15:12:23 +1000 Message-Id: <20200526051226.70904-5-amitay@ozlabs.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200526051226.70904-1-amitay@ozlabs.org> References: <20200526051226.70904-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 4/7] dts: Switch to kernel fsi driver in sbefifo backend 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 --- bmc-sbefifo.dts.m4 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bmc-sbefifo.dts.m4 b/bmc-sbefifo.dts.m4 index 1ffbce4..84c392e 100644 --- a/bmc-sbefifo.dts.m4 +++ b/bmc-sbefifo.dts.m4 @@ -70,7 +70,8 @@ define(`HMFSI', hmfsi@$1 { #address-cells = <0x2>; #size-cells = <0x1>; - compatible = "ibm,fsi-hmfsi"; + compatible = "ibm,kernel-fsi"; + device-path = "/fsi1/slave@0$2:00/raw"; reg = <0x0 0x$1 0x8000>; port = <0x$2>; index = <0x$3>; From patchwork Tue May 26 05:12:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1297695 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 49WMYP38Rmz9sSk for ; Tue, 26 May 2020 15:13:13 +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=pXTCL57Z; 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 49WMYP1wRPzDqMN for ; Tue, 26 May 2020 15:13:13 +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)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 49WMXn6mCJzDqHl for ; Tue, 26 May 2020 15:12:41 +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=pXTCL57Z; 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 49WMXn4DrVz9sRY; Tue, 26 May 2020 15:12:41 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1590469961; bh=NrsATHm5D79+rY4ugZWHD6wv1eup4QuFrf2nUvN+qs4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pXTCL57ZxHMVb6Ogn1uzBElPUOzJLb3wqWPx3u2djMz65q/FIzfP/mWFDeiaLSg7Z F0WoOehEgAL7PxZ3WIyEXHp05PTykMKPWW1071chqIEzX/LtBqKMJmsvV6asntuTRP +XjhnkzFRxzhoh6yux1m5QdQm8Mz3NJbmWtrI0Cd0k7TaTlU68xUTmcVVT14fWa85l mDBIPtU6+S5sSdFo7a8x2vIQFZzUP8BM4/Hrd2101Ilebl4pLF2hpuAtu1oCAB7err 5YyrvXLm/n6+JJ0BXlHpKHA4K5hV3idG/woRYd2pYoNhB9HzKKKFC+68ZIB043/Aye MKG2mh9YoS7Qw== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Tue, 26 May 2020 15:12:24 +1000 Message-Id: <20200526051226.70904-6-amitay@ozlabs.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200526051226.70904-1-amitay@ozlabs.org> References: <20200526051226.70904-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 5/7] libpdbg: Rescan fsi bus only once 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" On rescan, kernel driver re-creates all the slave devices. This invalidates all the slave deviced opened before the scan. Signed-off-by: Amitay Isaacs --- libpdbg/kernel.c | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/libpdbg/kernel.c b/libpdbg/kernel.c index 2cc81f2..912895a 100644 --- a/libpdbg/kernel.c +++ b/libpdbg/kernel.c @@ -116,6 +116,15 @@ static void kernel_fsi_scan_devices(void) const char *kernel_path = kernel_get_fsi_path(); char *path; int rc, fd; + static bool scanned = false; + + /* + * On fsi bus rescan, kernel re-creates all the slave device entries. + * It means any currently open devices will be invalid and need to be + * re-opened. So avoid scanning multiple times. + */ + if (scanned) + return; if (!kernel_path) return; @@ -139,12 +148,13 @@ static void kernel_fsi_scan_devices(void) free(path); close(fd); + + scanned = true; } int kernel_fsi_probe(struct pdbg_target *target) { struct fsi *fsi = target_to_fsi(target); - int tries = 5; int rc; const char *kernel_path = kernel_get_fsi_path(); const char *fsi_path; @@ -162,24 +172,19 @@ int kernel_fsi_probe(struct pdbg_target *target) return rc; } - while (tries) { - /* Open first raw device */ - fsi->fd = open(path, O_RDWR | O_SYNC); - if (fsi->fd >= 0) { - free(path); - return 0; - } - tries--; - - /* Scan */ - kernel_fsi_scan_devices(); - sleep(1); - } - if (fsi->fd < 0) { - PR_ERROR("Unable to open %s\n", path); + /* Always scan the fsi bus once */ + kernel_fsi_scan_devices(); + sleep(1); + + /* Open first raw device */ + fsi->fd = open(path, O_RDWR | O_SYNC); + if (fsi->fd >= 0) { free(path); + return 0; } + PR_ERROR("Unable to open %s\n", path); + free(path); return -1; } From patchwork Tue May 26 05:12:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1297696 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 49WMYT2dKdz9sSt for ; Tue, 26 May 2020 15:13:17 +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=wMx+pHX/; 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 49WMYT1WqJzDqHl for ; Tue, 26 May 2020 15:13:17 +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 49WMXp2qF3zDqHl for ; Tue, 26 May 2020 15:12:42 +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=wMx+pHX/; 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 49WMXp04HPz9sSk; Tue, 26 May 2020 15:12:41 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1590469962; bh=5m1hXjtA00hMF96RMbnZg8OM6Tm8CndFHypeqJSDhvY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wMx+pHX/ONXXo145c/sUn+oSPgsNvRgZrfid+L6hVMtMN6/M6UOq3eQllpYaV9zwu hSyVtOzRy2voYkDm/Xd0fU+SGUn53TKuSlXk7LPIA5O5I5dCXi9znYzcQRtVcRmLFU eYs4taAIgAMiS1M4z47tMrep4zdky4VqG8lLvMHsW5BuRgkgllByRabQnfR+JGUwlr R2I1Zcn8xZwkmzFKx36UsS3sEviRcENp2ebdhM9MORb5jqSlxRKI44iMr0RmQxcf2n S+pya54+5VQHxw6KV5G31lLAP9o4LYQLJ7qjjYq2lISxjmOIIwjwrgv1Pf7Xfigj3V 7mGs+SQBxrbGw== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Tue, 26 May 2020 15:12:25 +1000 Message-Id: <20200526051226.70904-7-amitay@ozlabs.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200526051226.70904-1-amitay@ozlabs.org> References: <20200526051226.70904-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 6/7] libpdbg: If device path does not exist, log at INFO level 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/kernel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libpdbg/kernel.c b/libpdbg/kernel.c index 912895a..3dd1262 100644 --- a/libpdbg/kernel.c +++ b/libpdbg/kernel.c @@ -183,7 +183,7 @@ int kernel_fsi_probe(struct pdbg_target *target) return 0; } - PR_ERROR("Unable to open %s\n", path); + PR_INFO("Unable to open %s\n", path); free(path); return -1; } @@ -247,7 +247,7 @@ static int kernel_pib_probe(struct pdbg_target *target) pib->fd = open(scom_path, O_RDWR | O_SYNC); if (pib->fd < 0) { - PR_ERROR("Unable to open %s\n", scom_path); + PR_INFO("Unable to open %s\n", scom_path); return -1; } From patchwork Tue May 26 05:12:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1297697 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49WMYZ0T5Rz9sSk for ; Tue, 26 May 2020 15:13:22 +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=JJfR7qHj; 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 49WMYY6cGxzDqMf for ; Tue, 26 May 2020 15:13:21 +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)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 49WMXp6h6vzDqHl for ; Tue, 26 May 2020 15:12:42 +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=JJfR7qHj; 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 49WMXp3GNFz9sRY; Tue, 26 May 2020 15:12:42 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1590469962; bh=J8fnBkNpuzfzsvqylqVyLlldcLmdgPK0gz+OVzll8/4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JJfR7qHjaEliTIF7rZwoBNXuxaQ+0mIZfZU75fQyuKCvcNIS7N4LBwGio1Ac5sm3K ugnFxfiDaMXn2IUMEslkGmABBf96TkSzSWv2Yk7nr1xJtf8MFnIkxsWrwbMjtxzdZ2 ZII762tskO7y3OcZfguSL2E1lfyj+DLPAePXCsClULrtHamQC/sHvDtBXjiFjXn/PT cC8NgsUXUoxf1GJY8+NKBThYpt2tT3j4VP0kS8HLBvaSAUtsGjGZNzv5zdTIFKOlQF 5Gh0pxVR+8wVn9DTqy7OKehikeBT1607oMCqecfTLcYyMPkGi+9cshZAc5ma+33hXw 8Au5tzmFdFPZw== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Tue, 26 May 2020 15:12:26 +1000 Message-Id: <20200526051226.70904-8-amitay@ozlabs.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200526051226.70904-1-amitay@ozlabs.org> References: <20200526051226.70904-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 7/7] libpdbg: Drop unused definitions 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/dtb.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libpdbg/dtb.c b/libpdbg/dtb.c index 97af0b5..aad6a21 100644 --- a/libpdbg/dtb.c +++ b/libpdbg/dtb.c @@ -50,8 +50,6 @@ #include "p9.dt.h" #define AMI_BMC "/proc/ractrends/Helper/FwInfo" -#define OPENFSI_BMC "/sys/bus/platform/devices/gpio-fsi/fsi0/" -#define FSI_CFAM_ID "/sys/devices/platform/gpio-fsi/fsi0/slave@00:00/cfam_id" #define XSCOM_BASE_PATH "/sys/kernel/debug/powerpc/scom" #define CHIP_ID_P8 0xea