From patchwork Thu Mar 3 01:46:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 1600132 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=R0k6dDuI; 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 4K8DP63nWtz9sFq for ; Thu, 3 Mar 2022 12:46:50 +1100 (AEDT) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4K8DP53dVpz3bbn for ; Thu, 3 Mar 2022 12:46:49 +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=R0k6dDuI; 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=R0k6dDuI; 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 4K8DP307N0z3bSh for ; Thu, 3 Mar 2022 12:46:46 +1100 (AEDT) Received: by mail-pj1-x102d.google.com with SMTP id m11-20020a17090a7f8b00b001beef6143a8so3479805pjl.4 for ; Wed, 02 Mar 2022 17:46:47 -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=UElblV6ev+eRD+Z8jlDpoRftTtpiNHqt+r2uJbHxtDI=; b=R0k6dDuIvFv2QTua1uhNNBcVpwo5FNN0uEtnzGgPJTywdd5hGjbzXyRsMVC6HpRFsg blbCKLnBPmu4xPd/M62MKeZvrabIC+2oCUqRBBCt4Si1/PqtVtm1wtZzHBpIDXLeM+vF h3lTm4bDP++7yjbIhKvjhi5zlCRd2pPxCqMPxqc33K+6hTvFtDaer/3A0VgJroDgeYC6 QbAOmKuRsbaEPE38HsWDimF8AB6+IpJIz3Hbfb8IhBCOPuHj/ZPAecH7wMttoDiDhtT5 nCjGhCSRoNEE874KBjmnd96vq9r+bGCPamTArc30MNpd4EabVvuCq0PuCcszwJGMeXQC KMDg== 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=UElblV6ev+eRD+Z8jlDpoRftTtpiNHqt+r2uJbHxtDI=; b=nOqnolWeFxKnDEMMcGAZniCwJY1u93OBrU7zH5wWmH4M++dgmBs90S2wmB0GJCNnd2 r8HduACdLO9/5fTOhgM9N/XI94CoyYyQNT+ritYf0/iUZFXJHrxUi0MB4POQbujSIFPk 9/BQui1odobxT9W6ThE0fZ1XOVt4vaHSPDAx74ZgTzBcZl0d+gf16cgPtGirDwKok5IR 7YveTjkOhlIYNghfh2Hy08pZqdJLAsZGlHbXQMjqq4scoypIXOU4m6x2EI3B0SJzvSqd +bh3o07U1NlD1Fpny7Z8LM/1Z0t6IJynkcVfKbG8gkIjGxapOo+Y8/l2gDv7moX4AKjg wyfw== X-Gm-Message-State: AOAM532JKCEXfFFeZ/mvo2hWWGKqIyTXKqf6rJnboR+nGNtFVqg2mhAp 4O5OxgEGV+IEWWcFph33ISLzTptlXjsN5w== X-Google-Smtp-Source: ABdhPJxuhXWyarE1L9Ke9C1ZLch51DUecouJ9dlOaoIaqBbO9faoQbPNZWasiq0AqRsGCfMqdsDBnQ== X-Received: by 2002:a17:903:1c7:b0:151:5b67:27e4 with SMTP id e7-20020a17090301c700b001515b6727e4mr21659316plh.0.1646272004960; Wed, 02 Mar 2022 17:46:44 -0800 (PST) Received: from localhost.localdomain ([45.124.203.14]) by smtp.gmail.com with ESMTPSA id 23-20020a17090a0b9700b001b8f602eaeasm6334070pjr.53.2022.03.02.17.46.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 17:46:43 -0800 (PST) From: Joel Stanley To: pdbg@lists.ozlabs.org, Nicholas Piggin Date: Thu, 3 Mar 2022 12:16:15 +1030 Message-Id: <20220303014616.757411-3-joel@jms.id.au> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220303014616.757411-1-joel@jms.id.au> References: <20220303014616.757411-1-joel@jms.id.au> MIME-Version: 1.0 Subject: [Pdbg] [PATCH v3 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 --- 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;