From owner-svn-src-all@freebsd.org Fri Mar 23 18:34:36 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3F14F62935; Fri, 23 Mar 2018 18:34:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A254E8515F; Fri, 23 Mar 2018 18:34:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 99287239A6; Fri, 23 Mar 2018 18:34:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NIYZKb066036; Fri, 23 Mar 2018 18:34:35 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NIYZ5j066035; Fri, 23 Mar 2018 18:34:35 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201803231834.w2NIYZ5j066035@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 23 Mar 2018 18:34:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331453 - head/sys/dev/mlx5/mlx5_core X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 331453 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 18:34:36 -0000 Author: hselasky Date: Fri Mar 23 18:34:35 2018 New Revision: 331453 URL: https://svnweb.freebsd.org/changeset/base/331453 Log: Don't save PCI state when PCI error is detected in mlx5core. When a PCI error is detected the PCI state could be corrupt, don't save it in that flow. Save the state after initialization. After restoring the PCI state during slot reset save it again, restoring the state destroys the previously saved state info. Submitted by: slavash@ MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Fri Mar 23 18:32:03 2018 (r331452) +++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Fri Mar 23 18:34:35 2018 (r331453) @@ -1224,6 +1224,7 @@ static int init_one(struct pci_dev *pdev, goto clean_health; } + pci_save_state(pdev->dev.bsddev); return 0; clean_health: @@ -1264,7 +1265,6 @@ static pci_ers_result_t mlx5_pci_err_detected(struct p mlx5_enter_error_state(dev, false); mlx5_unload_one(dev, priv, false); if (state) { - pci_save_state(pdev->dev.bsddev); mlx5_drain_health_wq(dev); mlx5_pci_disable_device(dev); } @@ -1289,6 +1289,7 @@ static pci_ers_result_t mlx5_pci_slot_reset(struct pci pci_set_master(pdev); pci_set_powerstate(pdev->dev.bsddev, PCI_POWERSTATE_D0); pci_restore_state(pdev->dev.bsddev); + pci_save_state(pdev->dev.bsddev); return err ? PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_RECOVERED; } @@ -1343,7 +1344,6 @@ static void mlx5_pci_resume(struct pci_dev *pdev) dev_info(&pdev->dev, "%s was called\n", __func__); - pci_save_state(pdev->dev.bsddev); wait_vital(pdev); err = mlx5_load_one(dev, priv, false);