From patchwork Wed Feb 23 05:34:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 1596507 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=NdEGprrG; 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)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4K3PrM2lXQz9sG7 for ; Wed, 23 Feb 2022 16:35:15 +1100 (AEDT) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4K3PrJ71Yqz3bWR for ; Wed, 23 Feb 2022 16:35:12 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=NdEGprrG; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::102d; helo=mail-pj1-x102d.google.com; envelope-from=joel.stan@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=NdEGprrG; dkim-atps=neutral Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) (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 4K3Pr620wjz30hm for ; Wed, 23 Feb 2022 16:35:01 +1100 (AEDT) Received: by mail-pj1-x102d.google.com with SMTP id ev16-20020a17090aead000b001bc3835fea8so1760530pjb.0 for ; Tue, 22 Feb 2022 21:35:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CBgymKNiiPdDxkev1jwPfxDqzN2dgvELSVNWYuQ51Hw=; b=NdEGprrGsHaeCkazlBkXGUaFj8eqXZUCJ6876nT0fyXxD4Zpj3tAWVEghPP32AJotq eRGBQ1Adu9vBlgoUNeyw4qrJMquG3j3F8CrVXtEREJOAijxP5z/jPgreYB2KSw3oQpNo mp2ha0/MeiXzB7mAE6MtwMtYQlG3/T26R4k3d4naqZOio+6DqiXz8jQclJC0y7dZBs8E NPC8K7JCfl5UC8voS1o+8FMsB9c8AxTsLmOwjWgtKCD3uoPi5+1FiJFK9EOvWcYhZeem dkezFF/lUM2Of+7bfIaFF3q0EoVq6AZXpJEyffJxNRIPeahTU8RcWdEWa8RiwgulKjkN v1Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=CBgymKNiiPdDxkev1jwPfxDqzN2dgvELSVNWYuQ51Hw=; b=vLA8aZ4clYntxXJEQneS9EX8chhCAhB0u4e1RkYkMgluaEkmBKQiikwpms1LsBTnJ/ SYFzxWLnwwhMBDRrJsIlVtyoomw88woNyEfpNwn3X5Tf41cuDJZ/IFdMNiHgnl2J3CI+ P9qhXaADZqPdvfeP68cXZTpUWIDWnCYd+1XCn+npCYNki3KPGm3l5HZGYn5Ys32rxK5m 8tQ5tcsJY9boip7JbRNs8paQfWTcO63pnPaICzIG78Z7PHXtz9vZfRFo+iFRwU/iYpzU KP6jb/mdRdVEmi2M7tgixKLZNLh5urYiU8sDBNM2s3yKPZOGaVga8KS2IXYWjK5r09f7 iYWw== X-Gm-Message-State: AOAM5305S+D/VbHqWMiCCiePGoisJ2bNyMqnr7Ai1kE786/D96vaXECC x83ErEFDvLRXbLfTuFg+MUsos2k9NR4= X-Google-Smtp-Source: ABdhPJxApOhuwosBrD6WJrTjN3B/f8t0HIWNVCOXW8g0bU5zqWhw9pU1TEqLCTWYQm5VMpXtEbScWw== X-Received: by 2002:a17:90b:23c7:b0:1bc:50bb:56dc with SMTP id md7-20020a17090b23c700b001bc50bb56dcmr7657481pjb.140.1645594499897; Tue, 22 Feb 2022 21:34:59 -0800 (PST) Received: from localhost.localdomain ([45.124.203.14]) by smtp.gmail.com with ESMTPSA id s48sm18029286pfw.111.2022.02.22.21.34.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 21:34:59 -0800 (PST) From: Joel Stanley To: pdbg@lists.ozlabs.org, Nicholas Piggin Date: Wed, 23 Feb 2022 16:04:44 +1030 Message-Id: <20220223053446.262033-2-joel@jms.id.au> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220223053446.262033-1-joel@jms.id.au> References: <20220223053446.262033-1-joel@jms.id.au> MIME-Version: 1.0 Subject: [Pdbg] [PATCH v2 1/3] configure: Add configure check for 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" From: Amitay Isaacs This is required for sbefifo ioctl definition. Signed-off-by: Amitay Isaacs Signed-off-by: Joel Stanley --- v2: no change configure.ac | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/configure.ac b/configure.ac index 8b4a012177b2..7b5dacafd2ec 100644 --- a/configure.ac +++ b/configure.ac @@ -34,6 +34,11 @@ else AC_SUBST([LIBFDT], ["-lfdt"]) fi +AC_CHECK_HEADER([linux/fsi.h], + [AC_DEFINE([HAVE_LINUX_FSI_H], 1, + [Define to 1 if you have the header file])], + []) + AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([Makefile]) From patchwork Wed Feb 23 05:34:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 1596508 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=Jdpirbhe; 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)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4K3PrM6CB5z9sG1 for ; Wed, 23 Feb 2022 16:35:15 +1100 (AEDT) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4K3PrM0gLGz3bTD for ; Wed, 23 Feb 2022 16:35:15 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=Jdpirbhe; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::630; helo=mail-pl1-x630.google.com; envelope-from=joel.stan@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=Jdpirbhe; dkim-atps=neutral Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) (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 4K3Pr91wlxz30Qq for ; Wed, 23 Feb 2022 16:35:05 +1100 (AEDT) Received: by mail-pl1-x630.google.com with SMTP id z2so9025508plg.8 for ; Tue, 22 Feb 2022 21:35:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/UTi5UvkrROeD59PFh0c7zfu9quF/ZzEWVc0WK1v6z8=; b=JdpirbherFZR6de8HtghHbj3MjQvtq5sXk6UMqmOWLkRTIutU1a8O9cjxz2gWM3Imi 4JrUBkcEYACdUVKwC1ULOYfXLHpuTihmjOmysQGE5hGo5qACxoU354VGB74UABqZykLw CNlABechdn2CcwvFr3MvrXK3S1yuJCmacfyyHzFjFejvzFgGXv3lGh1Wl/nVy5rEG/V9 F5OiQg09ZNzVZcUMYYiGj2njejW5Bxb8hKp0YAJbvG5VHLqrDyhxnf68OWlm+MvOI/Q4 WttJVwHhm3ZnFQGZ4pHod5Acx+1Q8eQzksMgerKJEDLSsaQYdVyedhC4pD78Hikbk+Ya q4KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=/UTi5UvkrROeD59PFh0c7zfu9quF/ZzEWVc0WK1v6z8=; b=NNWTYnIHNpzR3j4eGSVwH8lCIch3wmI+HoODOpHWxUpbzdKfHbrIjZdoep7LdeGQW7 98DLKrQgYcRLHL4j8PUEmtop/4lTKyQmAH1vnPnJXkgZS/GkQnJs7+4UXxi6arPXeFKS MRtCzkSHiJ9qcMYaKeqXZ7ev3SJ1B98JvxTzN8v5k99afHTvj6nFxNnNIIkWDJX87+t+ 961Dr3KBaeclrJNtiLgnKK5jNAWwwe4lwOk3FJirDfDfgQOGYB5jOPAl4iOGa/vsQFi7 fJbI5RoXPFo7JbHWhgCMSsQ8UZxNzQ8dAWRA7IoxC5NlKFuhVezOkp1RXhAlTH/PF1xp z55w== X-Gm-Message-State: AOAM532aV/5coE0XmSA4oREavwycT0Py5lR4lCyekuHXKlwQFYNiedZE K08S6hIz00K1C1krdKkzj+14EZPauW0= X-Google-Smtp-Source: ABdhPJxEYXsLEvue0F9+1v1HgbFoWmWTY1ohpFb0payCe1eM7fNq4oCZB08doar/IOfgzT8YWx0mvA== X-Received: by 2002:a17:902:704b:b0:14d:2c86:387 with SMTP id h11-20020a170902704b00b0014d2c860387mr26614609plt.1.1645594503322; Tue, 22 Feb 2022 21:35:03 -0800 (PST) Received: from localhost.localdomain ([45.124.203.14]) by smtp.gmail.com with ESMTPSA id s48sm18029286pfw.111.2022.02.22.21.35.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 21:35:02 -0800 (PST) From: Joel Stanley To: pdbg@lists.ozlabs.org, Nicholas Piggin Date: Wed, 23 Feb 2022 16:04:45 +1030 Message-Id: <20220223053446.262033-3-joel@jms.id.au> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220223053446.262033-1-joel@jms.id.au> References: <20220223053446.262033-1-joel@jms.id.au> MIME-Version: 1.0 Subject: [Pdbg] [PATCH v2 2/3] libsbefifo: Add long read timeout API 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" From: Amitay Isaacs Add a function to set the long read timeout on a sbefifo context, and to reset it afterwards. This will be used by chip-ops that require a long timeout. Signed-off-by: Amitay Isaacs Signed-off-by: Joel Stanley --- v2: Split out setting of long timeout from patch Correct ioctl unimplemented errno libsbefifo/sbefifo_private.h | 2 ++ libsbefifo/connect.c | 41 ++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/libsbefifo/sbefifo_private.h b/libsbefifo/sbefifo_private.h index 3c5ebcefb288..373f7f3c90ed 100644 --- a/libsbefifo/sbefifo_private.h +++ b/libsbefifo/sbefifo_private.h @@ -83,6 +83,8 @@ struct sbefifo_context { uint32_t ffdc_len; }; +int sbefifo_set_long_timeout(struct sbefifo_context *sctx); +int sbefifo_reset_timeout(struct sbefifo_context *sctx); void sbefifo_debug(const char *fmt, ...); void sbefifo_ffdc_clear(struct sbefifo_context *sctx); diff --git a/libsbefifo/connect.c b/libsbefifo/connect.c index 1d23af5ec896..27e8976cb2dc 100644 --- a/libsbefifo/connect.c +++ b/libsbefifo/connect.c @@ -21,6 +21,17 @@ #include #include #include +#include + +#ifdef HAVE_LINUX_FSI_H +#include +#else +#include +#endif /* HAVE_LINUX_FSI_H */ + +#ifndef FSI_SBEFIFO_READ_TIMEOUT +#define FSI_SBEFIFO_READ_TIMEOUT _IOW('s', 0x00, unsigned int) +#endif #include "libsbefifo.h" #include "sbefifo_private.h" @@ -106,6 +117,36 @@ int sbefifo_proc(struct sbefifo_context *sctx) return sctx->proc; } +int sbefifo_set_long_timeout(struct sbefifo_context *sctx) +{ + unsigned int long_timeout = 30; + int rc; + + LOG("long_timeout: %u sec\n", long_timeout); + rc = ioctl(sctx->fd, FSI_SBEFIFO_READ_TIMEOUT, &long_timeout); + if (rc == -1 && errno == ENOTTY) { + /* Do not fail if kernel does not implement ioctl */ + rc = 0; + } + + return rc; +} + +int sbefifo_reset_timeout(struct sbefifo_context *sctx) +{ + unsigned int timeout = 0; + int rc; + + LOG("reset_timeout\n"); + rc = ioctl(sctx->fd, FSI_SBEFIFO_READ_TIMEOUT, &timeout); + if (rc == -1 && errno == ENOTTY) { + /* Do not fail if kernel does not implement ioctl */ + rc = 0; + } + + return rc; +} + void sbefifo_debug(const char *fmt, ...) { va_list ap; From patchwork Wed Feb 23 05:34:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 1596509 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=ObOasNQf; 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)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4K3PrN6c4vz9sG1 for ; Wed, 23 Feb 2022 16:35:16 +1100 (AEDT) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4K3PrN15f8z3bPS for ; Wed, 23 Feb 2022 16:35:16 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=ObOasNQf; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::536; helo=mail-pg1-x536.google.com; envelope-from=joel.stan@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=ObOasNQf; dkim-atps=neutral Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) (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 4K3PrF0x2Jz30Qq for ; Wed, 23 Feb 2022 16:35:09 +1100 (AEDT) Received: by mail-pg1-x536.google.com with SMTP id 75so18944462pgb.4 for ; Tue, 22 Feb 2022 21:35:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mI/64IGQpUWZESWgyrHOiWpjdVwdHRPX57/ZfI/hwBY=; b=ObOasNQfZd13QVEphFElAg3kjdOX/zGeSTUv/0eDyBURa5Rlo8AKlS5B8eYsaut0og IuRswMXNB8nFVB01+QI+CCPx1pTWXMMcUenvE7eRrNoEqLV2cQF14gumlFr2eN6fFcL2 vnNB1J8S92nBY6mcGlzrbqo+QDk6cFPNE2E1CD38cdz9117Zj0ZpFkH16sHRx6toZDC5 6cs+UfH5LAEOmo/mlFVc2Wz0bSq8HT7XE/x4nvUDuHVOuHpfudZUINLTdfj0uQFOnB5b BXBRaWa2+E1wamO9flDDp3Dgkp9uMl9neVCUDQWZ3fnRGGr2SKQIiw8n0rEeUYwRFm/1 4fdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=mI/64IGQpUWZESWgyrHOiWpjdVwdHRPX57/ZfI/hwBY=; b=MGlBEPiahakEENa5vvx8LqF4TwA4ZyK5MJGGZD/whjf0MXuyWgVvPcuvpUSZedqWqd ito7SSKBMefAMeNZbueDJfPEhg56P4ZU3xCpPtvt6ebdNSlk7pLCFr5zu+J52x9G+Lwl 9jwPhRPCUIsdLlLE2PbzJsh/0+0KJqCg+FanNZpqn1Lm7n1T9j7O8S0rQBGz5scwXLuq Y3A9rd36i7mBWyQpnPCgSMjfRAXPH/MXCgLp938mvJOC7lbBEGGoO+DRG30RvEF3LGC7 UxiOxMs05tewE7AGslaH2DNYzukmcqbQrSlmJZjl6gNeBKKKJFbHbHvAzsUB9pIm1xU6 j4+g== X-Gm-Message-State: AOAM5314ZjpHlz35QPIGwo8tPqWimf9U7XDs2YfUC8F+x6NoLnOTWlcX W5FXX0qeVIrpDmywcrhnW3MB3cla6PM= X-Google-Smtp-Source: ABdhPJwRHGjcttWTSpj0/uZxWvV17wtWpbdQylABpRGWfALwNB52BTCwwxN82VX4se+rNoFJj9CoHg== X-Received: by 2002:a63:90c8:0:b0:365:5cc7:e776 with SMTP id a191-20020a6390c8000000b003655cc7e776mr22136462pge.13.1645594506902; Tue, 22 Feb 2022 21:35:06 -0800 (PST) Received: from localhost.localdomain ([45.124.203.14]) by smtp.gmail.com with ESMTPSA id s48sm18029286pfw.111.2022.02.22.21.35.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 21:35:05 -0800 (PST) From: Joel Stanley To: pdbg@lists.ozlabs.org, Nicholas Piggin Date: Wed, 23 Feb 2022 16:04:46 +1030 Message-Id: <20220223053446.262033-4-joel@jms.id.au> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220223053446.262033-1-joel@jms.id.au> References: <20220223053446.262033-1-joel@jms.id.au> MIME-Version: 1.0 Subject: [Pdbg] [PATCH v2 3/3] libsbefifo: Set long read timeout for chip-ops 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" From: Amitay Isaacs SBE interface specification lists several sbe chip-ops that require long read timeout as those chip-ops can take up to 30 seconds to complete. Reset the long timeout back to the default after performing the chip-op. The list of chip-ops from the spec (v2.0): 0xA1 0x01 Execute istep 0xA2 0x05 Execute multi-SCOM 0xA3 0x01 Get Ring 0x02 Set Ring 0xA4 0x01 Get Memory 0x02 Put Memory 0x03 Get SRAM 0x04 Put SRAM 0xA5 0x01 Get Architected Register 0x02 Put Architected Register 0xA6 0x01 Control Fast Array 0x02 Control Trace Array 0xA8 0x03 Quiesce SBE 0xA9 0x01 Enter MPIPL 0x02 Continue MPIPL 0x04 TI Info Signed-off-by: Amitay Isaacs Signed-off-by: Joel Stanley --- v2: Split out from second patch Add list of ops from spec to commit message libsbefifo/cmd_array.c | 12 ++++++++++++ libsbefifo/cmd_control.c | 6 ++++++ libsbefifo/cmd_generic.c | 6 ++++++ libsbefifo/cmd_memory.c | 23 +++++++++++++++++++++++ libsbefifo/cmd_mpipl.c | 18 ++++++++++++++++++ libsbefifo/cmd_register.c | 12 ++++++++++++ libsbefifo/cmd_ring.c | 18 ++++++++++++++++++ 7 files changed, 95 insertions(+) diff --git a/libsbefifo/cmd_array.c b/libsbefifo/cmd_array.c index 1ff8c03d7278..d579eafdfb77 100644 --- a/libsbefifo/cmd_array.c +++ b/libsbefifo/cmd_array.c @@ -69,12 +69,18 @@ int sbefifo_control_fast_array(struct sbefifo_context *sctx, uint16_t target_typ if (rc) return rc; + rc = sbefifo_set_long_timeout(sctx); + if (rc) + return rc; + out_len = 0; rc = sbefifo_operation(sctx, msg, msg_len, &out, &out_len); free(msg); if (rc) return rc; + sbefifo_reset_timeout(sctx); + rc = sbefifo_control_fast_array_pull(out, out_len); if (out) free(out); @@ -136,6 +142,10 @@ int sbefifo_control_trace_array(struct sbefifo_context *sctx, uint16_t target_ty if (rc) return rc; + rc = sbefifo_set_long_timeout(sctx); + if (rc) + return rc; + /* The size of returned data is just a guess */ out_len = 16 * sizeof(uint32_t); rc = sbefifo_operation(sctx, msg, msg_len, &out, &out_len); @@ -143,6 +153,8 @@ int sbefifo_control_trace_array(struct sbefifo_context *sctx, uint16_t target_ty if (rc) return rc; + sbefifo_reset_timeout(sctx); + rc = sbefifo_control_trace_array_pull(out, out_len, trace_data, trace_data_len); if (out) free(out); diff --git a/libsbefifo/cmd_control.c b/libsbefifo/cmd_control.c index e64f555c665d..5fb44d7a80cc 100644 --- a/libsbefifo/cmd_control.c +++ b/libsbefifo/cmd_control.c @@ -64,12 +64,18 @@ int sbefifo_istep_execute(struct sbefifo_context *sctx, uint8_t major, uint8_t m if (rc) return rc; + rc = sbefifo_set_long_timeout(sctx); + if (rc) + return rc; + out_len = 0; rc = sbefifo_operation(sctx, msg, msg_len, &out, &out_len); free(msg); if (rc) return rc; + sbefifo_reset_timeout(sctx); + rc = sbefifo_istep_execute_pull(out, out_len); if (out) free(out); diff --git a/libsbefifo/cmd_generic.c b/libsbefifo/cmd_generic.c index 16c61f4a7863..d0514cd1da6b 100644 --- a/libsbefifo/cmd_generic.c +++ b/libsbefifo/cmd_generic.c @@ -199,12 +199,18 @@ int sbefifo_quiesce(struct sbefifo_context *sctx) if (rc) return rc; + rc = sbefifo_set_long_timeout(sctx); + if (rc) + return rc; + out_len = 0; rc = sbefifo_operation(sctx, msg, msg_len, &out, &out_len); free(msg); if (rc) return rc; + sbefifo_reset_timeout(sctx); + rc = sbefifo_quiesce_pull(out, out_len); if (out) free(out); diff --git a/libsbefifo/cmd_memory.c b/libsbefifo/cmd_memory.c index 4195a1269963..7390ee36d435 100644 --- a/libsbefifo/cmd_memory.c +++ b/libsbefifo/cmd_memory.c @@ -125,6 +125,10 @@ int sbefifo_mem_get(struct sbefifo_context *sctx, uint64_t addr, uint32_t size, if (rc) return rc; + rc = sbefifo_set_long_timeout(sctx); + if (rc) + return rc; + /* length is 6th word in the request */ len = be32toh(*(uint32_t *)(msg + 20)); extra_bytes = 0; @@ -141,6 +145,7 @@ int sbefifo_mem_get(struct sbefifo_context *sctx, uint64_t addr, uint32_t size, if (rc) return rc; + sbefifo_reset_timeout(sctx); rc = sbefifo_mem_get_pull(out, out_len, addr, size, flags, data); if (out) @@ -206,12 +211,18 @@ int sbefifo_mem_put(struct sbefifo_context *sctx, uint64_t addr, uint8_t *data, if (rc) return rc; + rc = sbefifo_set_long_timeout(sctx); + if (rc) + return rc; + out_len = 1 * 4; rc = sbefifo_operation(sctx, msg, msg_len, &out, &out_len); free(msg); if (rc) return rc; + sbefifo_reset_timeout(sctx); + rc = sbefifo_mem_put_pull(out, out_len); if (out) free(out); @@ -295,6 +306,10 @@ int sbefifo_sram_get(struct sbefifo_context *sctx, uint16_t chiplet_id, uint64_t if (rc) return rc; + rc = sbefifo_set_long_timeout(sctx); + if (rc) + return rc; + /* length is 6th word in the request */ len = be32toh(*(uint32_t *)(msg + 20)); @@ -304,6 +319,8 @@ int sbefifo_sram_get(struct sbefifo_context *sctx, uint16_t chiplet_id, uint64_t if (rc) return rc; + sbefifo_reset_timeout(sctx); + rc = sbefifo_sram_get_pull(out, out_len, addr, size, data, data_len); if (out) free(out); @@ -375,12 +392,18 @@ int sbefifo_sram_put(struct sbefifo_context *sctx, uint16_t chiplet_id, uint64_t if (rc) return rc; + rc = sbefifo_set_long_timeout(sctx); + if (rc) + return rc; + out_len = 4; rc = sbefifo_operation(sctx, msg, msg_len, &out, &out_len); free(msg); if (rc) return rc; + sbefifo_reset_timeout(sctx); + rc = sbefifo_sram_put_pull(out, out_len); if (out) free(out); diff --git a/libsbefifo/cmd_mpipl.c b/libsbefifo/cmd_mpipl.c index 1d3249483375..9248b9536886 100644 --- a/libsbefifo/cmd_mpipl.c +++ b/libsbefifo/cmd_mpipl.c @@ -61,12 +61,18 @@ int sbefifo_mpipl_enter(struct sbefifo_context *sctx) if (rc) return rc; + rc = sbefifo_set_long_timeout(sctx); + if (rc) + return rc; + out_len = 0; rc = sbefifo_operation(sctx, msg, msg_len, &out, &out_len); free(msg); if (rc) return rc; + sbefifo_reset_timeout(sctx); + rc = sbefifo_mpipl_enter_pull(out, out_len); if (out) free(out); @@ -112,12 +118,18 @@ int sbefifo_mpipl_continue(struct sbefifo_context *sctx) if (rc) return rc; + rc = sbefifo_set_long_timeout(sctx); + if (rc) + return rc; + out_len = 0; rc = sbefifo_operation(sctx, msg, msg_len, &out, &out_len); free(msg); if (rc) return rc; + sbefifo_reset_timeout(sctx); + rc = sbefifo_mpipl_continue_pull(out, out_len); if (out) free(out); @@ -224,12 +236,18 @@ int sbefifo_mpipl_get_ti_info(struct sbefifo_context *sctx, uint8_t **data, uint if (rc) return rc; + rc = sbefifo_set_long_timeout(sctx); + if (rc) + return rc; + out_len = 0; rc = sbefifo_operation(sctx, msg, msg_len, &out, &out_len); free(msg); if (rc) return rc; + sbefifo_reset_timeout(sctx); + rc = sbefifo_mpipl_get_ti_info_pull(out, out_len, data, data_len); if (out) free(out); diff --git a/libsbefifo/cmd_register.c b/libsbefifo/cmd_register.c index 1e74b6ec4eb9..076b774cb905 100644 --- a/libsbefifo/cmd_register.c +++ b/libsbefifo/cmd_register.c @@ -88,12 +88,18 @@ int sbefifo_register_get(struct sbefifo_context *sctx, uint8_t core_id, uint8_t if (rc) return rc; + rc = sbefifo_set_long_timeout(sctx); + if (rc) + return rc; + out_len = reg_count * 8; rc = sbefifo_operation(sctx, msg, msg_len, &out, &out_len); free(msg); if (rc) return rc; + sbefifo_reset_timeout(sctx); + rc = sbefifo_register_get_pull(out, out_len, reg_count, value); if (out) free(out); @@ -154,12 +160,18 @@ int sbefifo_register_put(struct sbefifo_context *sctx, uint8_t core_id, uint8_t if (rc) return rc; + rc = sbefifo_set_long_timeout(sctx); + if (rc) + return rc; + out_len = 0; rc = sbefifo_operation(sctx, msg, msg_len, &out, &out_len); free(msg); if (rc) return rc; + sbefifo_reset_timeout(sctx); + rc = sbefifo_register_put_pull(out, out_len); if (out) free(out); diff --git a/libsbefifo/cmd_ring.c b/libsbefifo/cmd_ring.c index 44e8effc4c99..cffb3a119b02 100644 --- a/libsbefifo/cmd_ring.c +++ b/libsbefifo/cmd_ring.c @@ -71,6 +71,10 @@ int sbefifo_ring_get(struct sbefifo_context *sctx, uint32_t ring_addr, uint32_t if (rc) return rc; + rc = sbefifo_set_long_timeout(sctx); + if (rc) + return rc; + /* multiples of 64 bits */ out_len = (ring_len_bits + 63) / 8; rc = sbefifo_operation(sctx, msg, msg_len, &out, &out_len); @@ -78,6 +82,8 @@ int sbefifo_ring_get(struct sbefifo_context *sctx, uint32_t ring_addr, uint32_t if (rc) return rc; + sbefifo_reset_timeout(sctx); + rc = sbefifo_ring_get_pull(out, out_len, ring_len_bits, ring_data, ring_len); if (out) free(out); @@ -125,12 +131,18 @@ int sbefifo_ring_put(struct sbefifo_context *sctx, uint16_t ring_mode, uint8_t * if (rc) return rc; + rc = sbefifo_set_long_timeout(sctx); + if (rc) + return rc; + out_len = 0; rc = sbefifo_operation(sctx, msg, msg_len, &out, &out_len); free(msg); if (rc) return rc; + sbefifo_reset_timeout(sctx); + rc = sbefifo_ring_put_pull(out, out_len); if (out) free(out); @@ -185,12 +197,18 @@ int sbefifo_ring_put_from_image(struct sbefifo_context *sctx, uint16_t target, u if (rc) return rc; + rc = sbefifo_set_long_timeout(sctx); + if (rc) + return rc; + out_len = 0; rc = sbefifo_operation(sctx, msg, msg_len, &out, &out_len); free(out); if (rc) return rc; + sbefifo_reset_timeout(sctx); + rc = sbefifo_ring_put_from_image_pull(out, out_len); if (out) free(out);