From patchwork Fri Dec 15 02:59:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balbir Singh X-Patchwork-Id: 848853 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.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yyb0F62xqz9t3m for ; Fri, 15 Dec 2017 14:05:33 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="T+wW/Xfs"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3yyb0F3CWbzDqmD for ; Fri, 15 Dec 2017 14:05:33 +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.b="T+wW/Xfs"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c05::243; helo=mail-pg0-x243.google.com; envelope-from=bsingharora@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="T+wW/Xfs"; dkim-atps=neutral Received: from mail-pg0-x243.google.com (mail-pg0-x243.google.com [IPv6:2607:f8b0:400e:c05::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3yyZsh6ftTzDrV0 for ; Fri, 15 Dec 2017 13:59:52 +1100 (AEDT) Received: by mail-pg0-x243.google.com with SMTP id b18so4834538pgv.10 for ; Thu, 14 Dec 2017 18:59:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=AkISO4v6xoIXtXwr1u/cqhWlq/61ldT5H+DFAFg4rlc=; b=T+wW/XfsxuA9TUYYE/IuOCTknlJmETb64S6XqgcdaMfGjywzRt/ZHmUXueui1BF4b8 6Zzgy1tF6Kr+WUWmFD8bLBAeqp0XYKmjXvYMtUYlh+dRkuByCg/TkCe0tsC6cNnxNeL5 n1hPK2sTG/bnk+WIs6YD3249y48M3cFAMx67+jzYURPTtDAR17HuAETdjDTaHnWMof5g z45rooRCduMjaNKLdF9+qoElCuOZN9r90nQe/oH+VOrnOU1iXxTGufAhkRrPb3wvIR2W j1s9XOvtWCZXdXsmWUsZr+5zgGQqH/ZTlTBNaFCtrVdONaleJiM79s6Jb2VyhbrhOmG9 rohg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=AkISO4v6xoIXtXwr1u/cqhWlq/61ldT5H+DFAFg4rlc=; b=htxPOiq33apyHJJcsaNdvI7k0adUoetirJLZNXmRTm7RVgkdmTsSk69YMe5PtsOuNu naqej5RQkLc8q5ynxPGlNMaOWxu3aMcRWwd625aJ3hf6mr/U0KS72EpqIhZAi2QVFNJH 0Ho2D9JL4CXMuWs/5nBcMl609MxYAEkFX9bQhOZilA2BwZQcPltwPw1bwklWbpbQSWRI srDrFoX/4aH0M8Y/Ynch6zA4kzqXMsppALM4oa5CmJjqKMNfXt460cr0v65fIpKjaUty 0reqhEZEjY/aKAsdQJhYkCkIvosB8kfRVZU8vzuteQ+0VPDmUdsSodo+/7rVLAnoXBos yusw== X-Gm-Message-State: AKGB3mIPyzVNfGPuwSroUdOhfR6hUk7jWS41WeE7ysIvvo7caQ5lEd2j /jnPmLG++cdY/MEaSX8BBmM= X-Google-Smtp-Source: ACJfBounq11F5XTyDfFV9roQZdw22Tt6Lz/NOihWO/d4CCy+dq/2uWIws/85hcVyMDpvolpQarR1Iw== X-Received: by 10.98.3.5 with SMTP id 5mr11746816pfd.42.1513306790358; Thu, 14 Dec 2017 18:59:50 -0800 (PST) Received: from localhost.au.ibm.com (14-202-194-140.static.tpgi.com.au. [14.202.194.140]) by smtp.googlemail.com with ESMTPSA id x21sm10125685pfi.174.2017.12.14.18.59.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Dec 2017 18:59:49 -0800 (PST) From: Balbir Singh To: alistair@popple.id.au Date: Fri, 15 Dec 2017 13:59:42 +1100 Message-Id: <20171215025942.3983-1-bsingharora@gmail.com> X-Mailer: git-send-email 2.13.6 Subject: [Skiboot] [PATCH] hw/npu2: support creset of npu2 devices X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: skiboot@lists.ozlabs.org MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" creset calls in the hw procedure that resets the PHY, we don't take them out of reset, just put them in reset. Signed-off-by: Balbir Singh Acked-by: Alistair Popple --- hw/npu2-hw-procedures.c | 2 +- hw/npu2.c | 21 ++++++++++++++++++++- include/npu2.h | 1 + 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/hw/npu2-hw-procedures.c b/hw/npu2-hw-procedures.c index 1318e867..dfff4a2a 100644 --- a/hw/npu2-hw-procedures.c +++ b/hw/npu2-hw-procedures.c @@ -233,7 +233,7 @@ static bool poll_fence_status(struct npu2_dev *ndev, uint64_t val) } /* Procedure 1.2.1 - Reset NPU/NDL */ -static uint32_t reset_ntl(struct npu2_dev *ndev) +uint32_t reset_ntl(struct npu2_dev *ndev) { uint64_t val; diff --git a/hw/npu2.c b/hw/npu2.c index 7ffb0941..ee75b6fd 100644 --- a/hw/npu2.c +++ b/hw/npu2.c @@ -1170,6 +1170,25 @@ static int64_t npu2_freset(struct pci_slot *slot __unused) return OPAL_SUCCESS; } +static int64_t npu2_creset(struct pci_slot *slot) +{ + struct npu2 *p; + int i; + struct npu2_dev *ndev; + + p = phb_to_npu2(slot->phb); + NPU2INF(p, "Creset PHB state\n"); + + for (i = 0; i < p->total_devices; i++) { + ndev = &p->devices[i]; + if (ndev) { + NPU2DEVINF(ndev, "Resetting device\n"); + reset_ntl(ndev); + } + } + return OPAL_SUCCESS; +} + static struct pci_slot *npu2_slot_create(struct phb *phb) { struct pci_slot *slot; @@ -1191,7 +1210,7 @@ static struct pci_slot *npu2_slot_create(struct phb *phb) slot->ops.poll_link = NULL; slot->ops.hreset = npu2_hreset; slot->ops.freset = npu2_freset; - slot->ops.creset = NULL; + slot->ops.creset = npu2_creset; return slot; } diff --git a/include/npu2.h b/include/npu2.h index dae152a6..c1f39616 100644 --- a/include/npu2.h +++ b/include/npu2.h @@ -162,5 +162,6 @@ int64_t npu2_dev_procedure(void *dev, struct pci_cfg_reg_filter *pcrf, void npu2_dev_procedure_reset(struct npu2_dev *dev); void npu2_set_link_flag(struct npu2_dev *ndev, uint8_t flag); void npu2_clear_link_flag(struct npu2_dev *ndev, uint8_t flag); +uint32_t reset_ntl(struct npu2_dev *ndev); extern int nv_zcal_nominal; #endif /* __NPU2_H */