From patchwork Wed Jul 29 11:52:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 1338306 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 4BGslp2PvPz9sV4 for ; Wed, 29 Jul 2020 22:09:10 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: 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=20161025 header.b=gqXqlLEn; 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 4BGsln60R9zDqxb for ; Wed, 29 Jul 2020 22:09:09 +1000 (AEST) X-Original-To: openbmc@lists.ozlabs.org Delivered-To: openbmc@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::1044; helo=mail-pj1-x1044.google.com; envelope-from=joel.stan@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=jms.id.au 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=20161025 header.b=gqXqlLEn; dkim-atps=neutral Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) (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 4BGsP90K43zDqLB for ; Wed, 29 Jul 2020 21:53:00 +1000 (AEST) Received: by mail-pj1-x1044.google.com with SMTP id a9so1764100pjd.3 for ; Wed, 29 Jul 2020 04:53:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jBwyH16q8ID5M7mEXLpDARx1ZsyJ+Y5NumjRCWriK0M=; b=gqXqlLEnAtX50TurZkPgwf87jszNzH7J2I4f9xeZQQTjk6/TqebphkQtutHme+2rR7 vmhZPjcUH68pia8sRLYORu/R/R9CItX3rLTnM52ZjGkJ2eF3d9kBtswU/E2iVUH40dic 4X3LiCVPlR5EApQueUPaNOINYkN4aHEcmrFBekapRDlC0bE4xQ2i2lkaET1MczUpDxHb IR3IC4cMCW7FDlcCQmpobQRNsMf7/yZltXxBAj6eBTslUNEqKsNQmWZ/P8XHW+o++Q/h aVox19co3ziV5bxf4FUejSueGzicD9x9daKkBP47YdD1sw6sKAPLLTNVnmxDxM2KH3jO DOHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=jBwyH16q8ID5M7mEXLpDARx1ZsyJ+Y5NumjRCWriK0M=; b=IddqyOimIyPBkb9QnHjm391k9qXgsrOlV8nSNljT1//rDdHAp7rhSHPQnONCjOrjBJ ls59BiP+HyOAsgFfVmYcVXf/crKs6tLuRSk+vSrpnznGQeXgMd4ni5Oy71lBCyrFMg4U ZLn5JZCVSSKfHaVNeix14sNI1mB9VjcpUsZ/iYL8ITNYdzR0U3kKV7+UKU6raOhPm/L4 Xf3Hy4KYAOF10idMLfCCWJYYp3b2aU+zPei09GG3WvQJ9vfNF9kn/G8m+FzNSIAkS02v PeEUuUNwbNFcbFiGxKm0Ig0LSFB/bLac7C6SqvsoOCPJ4hpMBd4D8nWmkPLGqPzKYtYP T9ag== X-Gm-Message-State: AOAM533sLgO/CAehBymJx5nKBntvl58IkKZZ5ZY3rxSH5lrHyG3z84Ex Sod+9LInwNd55PrqBYvPp4k3KAcZhg0= X-Google-Smtp-Source: ABdhPJyjcVh7ahCnDPffTwLAcfcCtm+8zIpTf5XkfCa61XIsPsigb9/i7t9k0kz1VFhD4bxsmis1GQ== X-Received: by 2002:a17:902:a40f:: with SMTP id p15mr26743663plq.221.1596023577117; Wed, 29 Jul 2020 04:52:57 -0700 (PDT) Received: from localhost.localdomain ([45.124.203.15]) by smtp.gmail.com with ESMTPSA id 207sm2203292pfz.203.2020.07.29.04.52.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2020 04:52:55 -0700 (PDT) From: Joel Stanley To: openbmc@lists.ozlabs.org, Andrew Jeffery Subject: [PATCH linux dev-5.7 1/2] fsi: scom: Add dev_dbg in put_scom and get_scom paths Date: Wed, 29 Jul 2020 21:22:43 +0930 Message-Id: <20200729115244.357600-2-joel@jms.id.au> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200729115244.357600-1-joel@jms.id.au> References: <20200729115244.357600-1-joel@jms.id.au> MIME-Version: 1.0 X-BeenThere: openbmc@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development list for OpenBMC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eddie James Errors-To: openbmc-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "openbmc" This helps understand scom failures by producing more information about the state of the slave. Signed-off-by: Joel Stanley --- drivers/fsi/fsi-scom.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/fsi/fsi-scom.c b/drivers/fsi/fsi-scom.c index 004dc03ccf09..55f30abd20b2 100644 --- a/drivers/fsi/fsi-scom.c +++ b/drivers/fsi/fsi-scom.c @@ -240,6 +240,8 @@ static int handle_fsi2pib_status(struct scom_device *scom, uint32_t status) { uint32_t dummy = -1; + dev_dbg(&scom->dev, "handle_fsi2pib_status %08x\n", status); + if (status & SCOM_STATUS_PROTECTION) return -EPERM; if (status & SCOM_STATUS_PARITY) { @@ -288,8 +290,12 @@ static int put_scom(struct scom_device *scom, uint64_t value, int rc, retries; for (retries = 0; retries < SCOM_MAX_RETRIES; retries++) { + dev_dbg(&scom->dev, "put_scom retry %d\n", retries); + rc = raw_put_scom(scom, value, addr, &status); if (rc) { + dev_dbg(&scom->dev, "raw_put_scom failed rc = %d\n", rc); + /* Try resetting the bridge if FSI fails */ if (rc != -ENODEV && retries == 0) { fsi_device_write(scom->fsi_dev, SCOM_FSI2PIB_RESET_REG, @@ -322,9 +328,13 @@ static int get_scom(struct scom_device *scom, uint64_t *value, int rc, retries; for (retries = 0; retries < SCOM_MAX_RETRIES; retries++) { + dev_dbg(&scom->dev, "get_scom retry %d\n", retries); + rc = raw_get_scom(scom, value, addr, &status); if (rc) { /* Try resetting the bridge if FSI fails */ + dev_dbg(&scom->dev, "raw_get_scom failed rc = %d\n", rc); + if (rc != -ENODEV && retries == 0) { fsi_device_write(scom->fsi_dev, SCOM_FSI2PIB_RESET_REG, &dummy, sizeof(uint32_t)); From patchwork Wed Jul 29 11:52:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 1338313 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 4BGspg4NNkz9sR4 for ; Wed, 29 Jul 2020 22:11:39 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: 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=20161025 header.b=bRlZe9Hc; 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 4BGspg1L8XzDqFK for ; Wed, 29 Jul 2020 22:11:39 +1000 (AEST) X-Original-To: openbmc@lists.ozlabs.org Delivered-To: openbmc@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::643; helo=mail-pl1-x643.google.com; envelope-from=joel.stan@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=jms.id.au 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=20161025 header.b=bRlZe9Hc; dkim-atps=neutral Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) (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 4BGsPC2N7vzDqdP for ; Wed, 29 Jul 2020 21:53:03 +1000 (AEST) Received: by mail-pl1-x643.google.com with SMTP id p1so11694421pls.4 for ; Wed, 29 Jul 2020 04:53:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=St/+7ayviEgbDLRj84Q1cvjlQL2oZHoqqklevGup+Ek=; b=bRlZe9HcKiiUD24qNFkc3iKEetyRovEYNUmvKbGUotPZOb4sRnH6QoD++oVYbZZlwP rjMYSGSx/GW4ad1tDu/jBvsaHUuvpM+t1b829AhspY4FepZn2dDdXcxJJqq8C8haWJu/ kd3eNxiQAohbLALOMD/dfichl9oZJuyoy/rHCUvWuJd2nLTqimyklZ3lKQlPb+7kaSnd NQjbFOgCtq0r6P49lFDqjOo1JK1DuZiKdS37H30JfSZQ+sPANmXjmFbOzT8EqEirvtGG yKiQISi0+LIRWk7kT351ye8bdrYqf9OMTEvRzEyNeEeFrsCXaqwHW0+Rck1AluF0mvPP /VkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=St/+7ayviEgbDLRj84Q1cvjlQL2oZHoqqklevGup+Ek=; b=nrGgyIwK2grEMuonIhTi7bvHC5KDDEwzc+dOu9I7YPZDZ4X6ppI1XPgWJuqnFDoN0g sjNjz2u5VEnlF4u3KoRdjBvvAncqClbSXWmxs1bmlmN1jAxcBv0cQeOJenFSzqED6GjT NauTbiGw47IUzFZISvYlZ3uIQWDM7kePwRGuYtwgaHAPs78mePcvUVwmAYzCtHt13qOM 4JwIioJIkNykk7NqkTPUY4ygl0TtcBuarBbb2Sz3b4E/NoWXkiA9BQ18gjppwUVKUACE FHLhn1e0LnWhy+oIfWxj+swZKQK8lvDJcv6jXViK4XK3WBatrR7gB8HM/G/oVasMRn7X BAcA== X-Gm-Message-State: AOAM530l3jM0rKQfunSj4YpByOBT73xxYJK68evctMaaTcIkI8MX2DmU TMMo3d27wovnW4L3/MFVEPZOBWXnMmc= X-Google-Smtp-Source: ABdhPJwdJ8JoZ9Y+6DHWdpuK+OKbnbGKQNqA0D9GLrncgkimJv041XhRkbuDlitJjhTJ3hV4vBI9YA== X-Received: by 2002:a17:90b:19cc:: with SMTP id nm12mr9225621pjb.144.1596023580254; Wed, 29 Jul 2020 04:53:00 -0700 (PDT) Received: from localhost.localdomain ([45.124.203.15]) by smtp.gmail.com with ESMTPSA id 207sm2203292pfz.203.2020.07.29.04.52.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2020 04:52:59 -0700 (PDT) From: Joel Stanley To: openbmc@lists.ozlabs.org, Andrew Jeffery Subject: [PATCH linux dev-5.7 2/2] fsi: scom: Handle FSI2PIB timeout Date: Wed, 29 Jul 2020 21:22:44 +0930 Message-Id: <20200729115244.357600-3-joel@jms.id.au> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200729115244.357600-1-joel@jms.id.au> References: <20200729115244.357600-1-joel@jms.id.au> MIME-Version: 1.0 X-BeenThere: openbmc@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development list for OpenBMC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eddie James Errors-To: openbmc-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "openbmc" When the scom engine indicates a FSI2PIB timeout we can recover by writing any value to the reset register. On a machine capable of doing SCOMs, the 0x30000 address will fail and cause subsequent accesses to fail: $ pdbg -p0 -b kernel getscom 0xf000f p0: 0x00000000000f000f = 0x120da04900800000 (/proc0/pib) $ pdbg -p0 -b kernel getscom 0x30000 p0: 0x0000000000030000 failed (/proc0/pib) $ pdbg -p0 -b kernel getscom 0xf000f p0: 0x00000000000f000f failed (/proc0/pib) After this patch, the kernel will detect and clear the error, allowing subsequent accesses to succeed: $ pdbg -p0 -b kernel getscom 0xf000f p0: 0x00000000000f000f = 0x120da04900800000 (/proc0/pib) $ pdbg -p0 -b kernel getscom 0x30000 p0: 0x0000000000030000 failed (/proc0/pib) $ pdbg -p0 -b kernel getscom 0xf000f p0: 0x00000000000f000f = 0x120da04900800000 (/proc0/pib) Signed-off-by: Joel Stanley --- drivers/fsi/fsi-scom.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/fsi/fsi-scom.c b/drivers/fsi/fsi-scom.c index 55f30abd20b2..dc6db25a6a8a 100644 --- a/drivers/fsi/fsi-scom.c +++ b/drivers/fsi/fsi-scom.c @@ -38,6 +38,15 @@ #define SCOM_STATUS_PIB_RESP_MASK 0x00007000 #define SCOM_STATUS_PIB_RESP_SHIFT 12 +/* Values the SCOM_STATUS_PIB_RESP_MASK can take */ +#define SCOM_PIB_ERR_XSCOM_BLOCKED 0x00004000 +#define SCOM_PIB_ERR_CHIPLET_OFFLINE 0x00002000 +#define SCOM_PIB_ERR_PARTIAL_GOOD 0x00006000 +#define SCOM_PIB_ERR_INVALID_ADDR 0x00001000 +#define SCOM_PIB_ERR_CLOCK 0x00005000 +#define SCOM_PIB_ERR_HANDSHAKE 0x00003000 +#define SCOM_PIB_ERR_TIMEOUT 0x00007000 + #define SCOM_STATUS_ANY_ERR (SCOM_STATUS_PROTECTION | \ SCOM_STATUS_PARITY | \ SCOM_STATUS_PIB_ABORT | \ @@ -249,9 +258,19 @@ static int handle_fsi2pib_status(struct scom_device *scom, uint32_t status) sizeof(uint32_t)); return -EIO; } + + if (status & SCOM_PIB_ERR_TIMEOUT) { + dev_dbg(&scom->dev, "PIB timeout, recovering\n"); + fsi_device_write(scom->fsi_dev, SCOM_FSI2PIB_RESET_REG, + &dummy, sizeof(uint32_t)); + /* Return -EBUSY to force a retry */ + return -EBUSY; + } + /* Return -EBUSY on PIB abort to force a retry */ if (status & SCOM_STATUS_PIB_ABORT) return -EBUSY; + return 0; }