From patchwork Wed Jun 10 05:24: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: 1306455 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 49hb5p2DZQz9sRR for ; Wed, 10 Jun 2020 15:24:46 +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=kUMX6cNi; 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 49hb5n4QmtzDqP5 for ; Wed, 10 Jun 2020 15:24:45 +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 49hb5d0q68zDqMC for ; Wed, 10 Jun 2020 15:24:37 +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=kUMX6cNi; 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 49hb5c5xKnz9sSF; Wed, 10 Jun 2020 15:24:36 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1591766676; bh=YK5Mj9dgN5C3FUkUPL0mdDel+1NapKBzhM3R4CZUIAo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kUMX6cNi3qyGCZ42lEKqJHePI1v8P5G5T1GWSfUwFSTqhJZii87sMqNluqLHjP+XR i2vMbhWKFwoVrDJC8CZTB53G6eBBLL4mE1HEDdP3XxAZIbrjR9jygvg3oKwArTGZ9N v2+9k5nb4nR8sxw/UTK2o7VRjWogCK5eRS/N3vWZjVQDDeadwItniL3+jT/Tk2HFrT wCY20QcnkoKIv4k9VXHnI+Fy1FKLtWs5gvmQECy+siz4qzq5VXt03ia7yhHgu/fyfN dp61b9bCIlmmzjBPK1IgX7TZrbQ6QTy1Kf1KneOmeNKK53RAGrr7JUI96aJJ8vMmdX h7slUCUUHBlMA== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Wed, 10 Jun 2020 15:24:20 +1000 Message-Id: <20200610052426.150225-2-amitay@ozlabs.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200610052426.150225-1-amitay@ozlabs.org> References: <20200610052426.150225-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH v2 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 Reviewed-by: Alistair Popple --- 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 Wed Jun 10 05:24: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: 1306456 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 49hb5w421jz9sRR for ; Wed, 10 Jun 2020 15:24:52 +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=Q0SqbCq1; 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 49hb5v5Z7PzDqXs for ; Wed, 10 Jun 2020 15:24:51 +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 49hb5d4V8HzDqMC for ; Wed, 10 Jun 2020 15:24:37 +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=Q0SqbCq1; 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 49hb5d1HZpz9sSS; Wed, 10 Jun 2020 15:24:37 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1591766677; bh=r2pb+0fYN39MWH36Y/QEiaZe0FPLfOs9m7jT+UoOUwc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q0SqbCq1+l6Desg6bYhwc6CmgF/6UsEPmcmA9MqdC+oKqBOPheSILtlbcCi/JJysX 6bRVP4DzMGoqgHEeCYrOEZlBAZruGt59LZtcZzsKtrtxxdD7NNDmWATlnu/XiSBZEb lY5JagD1bEwi75iRtr+xMbyRdM9mvIRrX0P9h1jTqkXIYzEZTFVZb/IO+9VjCohzQ+ fMJr0TonibfuG+aXDSHtMej5A/GcAWGIKgwGCtutUM3P9D/eV+ffDhylOw9LjGK4TW n2Re6za1AIx7DvfXRN7sZjtjc3nCghmTSUF23jdRY9vBGXQI1MQIf6ZucMm6w8+ebo x4+NO01gotxaA== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Wed, 10 Jun 2020 15:24:21 +1000 Message-Id: <20200610052426.150225-3-amitay@ozlabs.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200610052426.150225-1-amitay@ozlabs.org> References: <20200610052426.150225-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH v2 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 Reviewed-by: Alistair Popple --- 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 Wed Jun 10 05:24: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: 1306457 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 49hb5z6fr7z9sSF for ; Wed, 10 Jun 2020 15:24:55 +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=rEDsq4+f; 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 49hb5z53szzDqXl for ; Wed, 10 Jun 2020 15:24:55 +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 49hb5d6PMCzDqMF for ; Wed, 10 Jun 2020 15:24:37 +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=rEDsq4+f; 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 49hb5d3ysPz9sRR; Wed, 10 Jun 2020 15:24:37 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1591766677; bh=GSBKDcAaTJm9FrdWKRwkoQSRcuBI1GhPrbwplKdd60g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rEDsq4+fdeHzmFZ+8IuB9F77PK4+Cw5arHi+laL/M+D1pS4S7W6nhASUgMUFX8Mq2 +PLfD5SXPpiZD3xLzu+zJ/728eQATpwuNHze74ZIFYE2hn7Eh5LtH/HFNtdtURBNlE EraLYOfOtOs4n0dfJjLCSwXtyJr3V9R7IsQeUeLhO7vN2F1QgU2+Y5du8jy6rAyZFY AUG2CeCDxeKSAK+GEIwgZnTxtbON5Cy17tvhQqGfYpc6CTpzuf8SJnxFfc69Wr3Dmb WDz/ultvSnW4OzeYK6FpF9CyDygpCZPdEHfRIDv0tx9BFnmCHIvtkjQExiOPbMOosG 0gl5Fj1BkcJpg== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Wed, 10 Jun 2020 15:24:22 +1000 Message-Id: <20200610052426.150225-4-amitay@ozlabs.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200610052426.150225-1-amitay@ozlabs.org> References: <20200610052426.150225-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH v2 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 Reviewed-by: Alistair Popple --- 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 Wed Jun 10 05:24: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: 1306458 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 49hb644Zk3z9sRR for ; Wed, 10 Jun 2020 15:25:00 +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=t2tBNv0y; 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 49hb64107FzDqXQ for ; Wed, 10 Jun 2020 15:25:00 +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 49hb5f1w3pzDqMC for ; Wed, 10 Jun 2020 15:24:38 +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=t2tBNv0y; 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 49hb5d6szYz9sSF; Wed, 10 Jun 2020 15:24:37 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1591766678; bh=IK8dvQJaMjRjy8DiRaQ55dzPXOhwqsNyELUttJWkeFI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t2tBNv0yHcOpgNHCHNEmBGsciSeMTTUw0a4aka+CZFTu38n51Simn/oLLd6NOKYbF go0BiRCrkZIqDcyNAw5eM6D7GlGYDsiK8ZOpn5ru8KXgCyHZRSZ47VXlyw/YUFdneF DrRFpY1X4/HJKBVNnAoA2dLg9XQKtUdTTfuChtimh+NJoei/tdY3oUfJsZEWlgc7kW IcrdO8Dop9HnN7fjc8Uqjm6NF1lx91CAmJ8A1qPMCXPsBYmYSPhlcx8UetlEonp4gO mbwyxOv3loNKuaUWDIooLjWF5u1FzfDzjNSW/X9beiSSTQrzA1nQGNc3nO+J1O3yw5 HhAo/g5KwNTuA== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Wed, 10 Jun 2020 15:24:23 +1000 Message-Id: <20200610052426.150225-5-amitay@ozlabs.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200610052426.150225-1-amitay@ozlabs.org> References: <20200610052426.150225-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH v2 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 Reviewed-by: Alistair Popple --- 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 Wed Jun 10 05:24: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: 1306459 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 49hb675Przz9sSF for ; Wed, 10 Jun 2020 15:25:03 +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=FRsPn95Q; 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 49hb674mhczDqMF for ; Wed, 10 Jun 2020 15:25:03 +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 49hb5f4zX2zDqMC for ; Wed, 10 Jun 2020 15:24:38 +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=FRsPn95Q; 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 49hb5f2NYLz9sRR; Wed, 10 Jun 2020 15:24:38 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1591766678; bh=c/ruJo0s2BoO8ZpOALxQHKV+JfpH8IjMxQmyoRcJZps=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FRsPn95Q9uVQGaJZV47lBEBH5yBhbEFLWUbO5ovPxZEG2ptxkgrs+zecG9+Kkv127 5b1/fMme5fwJhmzwOAFKuUuCvXhSRzCtakVNwnzpkaTcMHVVBx7pq/pFXAqZQk8RnY nrwUTnrzuI6RM9N8/ikW2N2i8A5dLdf6+L2Mhg4dyOGTXQyHSDvQpMbTA1iDsOF6xD L9gs6acIA/AoUD6prp1YtlLMpYOI8dQh76Eqnkm53pNK0jsGQHaDSGcH2+FG9c/9QN PdbATO7gefVXm568BWuuUSwazbseVzHtn9oUSS62O3kYSeS8472kSIFMqcEzUyCinM kcLRakSzN0Xdg== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Wed, 10 Jun 2020 15:24:24 +1000 Message-Id: <20200610052426.150225-6-amitay@ozlabs.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200610052426.150225-1-amitay@ozlabs.org> References: <20200610052426.150225-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH v2 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. So avoid scanning fsi bus, if any of the devices are opened. Signed-off-by: Amitay Isaacs Reviewed-by: Alistair Popple Reviewed-by: Joel Stanley --- libpdbg/kernel.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/libpdbg/kernel.c b/libpdbg/kernel.c index 2cc81f2..c63ef93 100644 --- a/libpdbg/kernel.c +++ b/libpdbg/kernel.c @@ -149,6 +149,7 @@ int kernel_fsi_probe(struct pdbg_target *target) const char *kernel_path = kernel_get_fsi_path(); const char *fsi_path; char *path; + static bool first_probe = true; if (!kernel_path) return -1; @@ -163,23 +164,30 @@ int kernel_fsi_probe(struct pdbg_target *target) } while (tries) { - /* Open first raw device */ fsi->fd = open(path, O_RDWR | O_SYNC); if (fsi->fd >= 0) { free(path); + first_probe = false; return 0; } tries--; - /* Scan */ - kernel_fsi_scan_devices(); - sleep(1); - } - if (fsi->fd < 0) { - PR_ERROR("Unable to open %s\n", path); - free(path); + /* + * 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 if + * some devices are already probed. + */ + if (first_probe) { + kernel_fsi_scan_devices(); + sleep(1); + } else { + break; + } } + PR_ERROR("Unable to open %s\n", path); + free(path); return -1; } From patchwork Wed Jun 10 05:24: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: 1306460 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 49hb6C6jfmz9sSF for ; Wed, 10 Jun 2020 15:25:07 +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=pW32IUfL; 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 49hb6C4Qr4zDqXs for ; Wed, 10 Jun 2020 15:25:07 +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 49hb5g1ywdzDqMF for ; Wed, 10 Jun 2020 15:24: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=pW32IUfL; 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 49hb5f5RZHz9sSS; Wed, 10 Jun 2020 15:24:38 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1591766679; bh=sNn37WTE1cHaoAOlnL5R3xouzGjwNNpWzkB5dw+MOCo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pW32IUfLLJ+rZy1sz5y4dxWl+6Gzr3nqa/PBoIcWXFlQKQ3M92DhTOb1UBXIGes3P kBdkwx6yamESeQ5fla1U4CRlih7xLWIg5bsKAmg5MKe5+6CbvV38hKn6DRdpjHiQWt KWbpNR3zrTxcRSZi5q3/g0c8RSMwLoqKw1naYGmbjnC7WBleHzcOT+DhztulzijTgP CFQS+0YNjh3u2vUHkBxrPWtMgEG5QpxEJEp4yiUthfosAYDfdxlNW6CDu8XB3H1FU2 DC7jhiNikuQI0tU3B3OhTnpNEYLCpAriHrNnNBClI2dhPWtUamuarKm32yyOcAOK/+ gJVYKGqLUJ0jA== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Wed, 10 Jun 2020 15:24:25 +1000 Message-Id: <20200610052426.150225-7-amitay@ozlabs.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200610052426.150225-1-amitay@ozlabs.org> References: <20200610052426.150225-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH v2 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 Reviewed-by: Alistair Popple --- libpdbg/kernel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libpdbg/kernel.c b/libpdbg/kernel.c index c63ef93..b2b977b 100644 --- a/libpdbg/kernel.c +++ b/libpdbg/kernel.c @@ -186,7 +186,7 @@ int kernel_fsi_probe(struct pdbg_target *target) } } - PR_ERROR("Unable to open %s\n", path); + PR_INFO("Unable to open %s\n", path); free(path); return -1; } @@ -250,7 +250,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 Wed Jun 10 05:24: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: 1306461 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 49hb6G6y9nz9sRR for ; Wed, 10 Jun 2020 15:25: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=KDMa9ji4; 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 49hb6G5Zs9zDqXW for ; Wed, 10 Jun 2020 15:25: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 49hb5g5rbczDqMC for ; Wed, 10 Jun 2020 15:24: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=KDMa9ji4; 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 49hb5g2Qghz9sSF; Wed, 10 Jun 2020 15:24:39 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1591766679; bh=J8fnBkNpuzfzsvqylqVyLlldcLmdgPK0gz+OVzll8/4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KDMa9ji4tekFzHybohdtjlnqtZ1P8aY3BoSW4rHXiiynNZ/TLlxapaTKJstVfkTP1 TsDq2g1W4Ldsmha9g+QeUKdeHSHFU7JaQ/zLcR+YlXpOV5Au6gRF4FKSDla6Iv9lHA LHYmjQ8rlPC2ytjpLCw2kL8eLDCakYsNl8klteImlKX1WaZAz5WVMSDFGXMU9OQHcA rUu3/tUVs7zF0RQivui1h7rCiDErJRHfMkPV5SwzEaGM7w8aHdNPkJjFZKmex0I0xG b86pfJiAC1PbZ7NgbgF0ghOaguAJ4f5hp9RHBlSoNjveFaDPqwy+8253olPwhek+qL DA9y86PtpiJ3g== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Wed, 10 Jun 2020 15:24:26 +1000 Message-Id: <20200610052426.150225-8-amitay@ozlabs.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200610052426.150225-1-amitay@ozlabs.org> References: <20200610052426.150225-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH v2 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 Reviewed-by: Alistair Popple --- 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