Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Mar 2018 19:24:49 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r331816 - stable/11/sys/dev/mlx5/mlx5_core
Message-ID:  <201803301924.w2UJOn7e004639@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Fri Mar 30 19:24:49 2018
New Revision: 331816
URL: https://svnweb.freebsd.org/changeset/base/331816

Log:
  MFC r331453:
  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@
  Sponsored by:	Mellanox Technologies

Modified:
  stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c
==============================================================================
--- stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c	Fri Mar 30 19:23:46 2018	(r331815)
+++ stable/11/sys/dev/mlx5/mlx5_core/mlx5_main.c	Fri Mar 30 19:24:49 2018	(r331816)
@@ -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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803301924.w2UJOn7e004639>