From patchwork Wed Jun 19 12:44:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frederic Barrat X-Patchwork-Id: 1118697 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 45TPtB3VSQz9s6w for ; Wed, 19 Jun 2019 22:49:54 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 45TPtB22p2zDqyk for ; Wed, 19 Jun 2019 22:49:54 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=linux.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=fbarrat@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 45TPnV3cVPzDqnv for ; Wed, 19 Jun 2019 22:45:50 +1000 (AEST) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x5JCYPTD029775 for ; Wed, 19 Jun 2019 08:45:47 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2t7kj461ph-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 19 Jun 2019 08:45:43 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 19 Jun 2019 13:45:15 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 19 Jun 2019 13:45:12 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x5JCjBlH58916876 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Jun 2019 12:45:11 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F044411C058; Wed, 19 Jun 2019 12:45:10 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A899411C054; Wed, 19 Jun 2019 12:45:10 +0000 (GMT) Received: from pic2.home (unknown [9.145.171.67]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 19 Jun 2019 12:45:10 +0000 (GMT) From: Frederic Barrat To: skiboot@lists.ozlabs.org, andrew.donnellan@au1.ibm.com, clombard@linux.ibm.com Date: Wed, 19 Jun 2019 14:44:58 +0200 X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19061912-0020-0000-0000-0000034B794C X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19061912-0021-0000-0000-0000219ECCE9 Message-Id: <20190619124510.25182-1-fbarrat@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-19_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=621 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906190104 Subject: [Skiboot] [RFC 00/12] opencapi: enable card reset and link retraining X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: arbab@linux.ibm.com, groug@kaod.org Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" This series sets the groundwork to allow to reset an opencapi adapter from linux. The main intentent is to refresh linux' view of the device when flashing a new FPGA image. Sending as an RFC, as it's built on top of another RFC series from Oliver: https://lists.ozlabs.org/pipermail/skiboot/2019-April/013869.html which I'm reusing to control the slot power state. The approach taken is to use the PCI hotplug framework. We define a (virtual) slot for the (virtual) opencapi PHB. It allows linux to control the slot state to unplug (set the opencapi adapter in reset) and replug (release reset and retrain the link). On replug, the PCI devices go through PCI enumeration, so BARs for the new image will be properly reassigned. Most of those patches are really to allow to retrain the link reliably. Activating the hotplug framewore is done in patch 10, by adding the required properties in the device tree and implementing the slot power state callbacks on the PHB. We have a dependency on the version of the DLx and TLx used on the FPGA to make sure they are reset properly. The hw enablement team has provided fixes for a while now, so we should be good. Frederic Barrat (12): npu2-hw-procedures: Move some opencapi PHY settings in one-off init npu2-opencapi: Make sure the PCI slot has the proper ID npu2-hw-procedures: Fix link retraining on reset npu2-opencapi: Rework link training timeout npu2-opencapi: Tweak fundamental reset sequence npu2-opencapi: Simplify freset states npu2-opencapi: Detect PHY reset errors npu2-opencapi: Improve error reporting to the OS npu2-opencapi: tweak to Oliver's RFC series npu2-opencapi: Activate PCI hotplug on opencapi slot npu2-opencapi: Handle OPAL_UNMAP_PE operation on set_pe() callback npu2-opencapi: Log an warning when resetting a broken device core/pci-opal.c | 73 ++++++++++++------- core/pci-slot.c | 3 + hw/npu2-common.c | 7 ++ hw/npu2-hw-procedures.c | 64 +++++++++++------ hw/npu2-opencapi.c | 155 ++++++++++++++++++++++++++++------------ include/npu2.h | 10 ++- 6 files changed, 214 insertions(+), 98 deletions(-)