From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755212Ab2AXALX (ORCPT ); Mon, 23 Jan 2012 19:11:23 -0500 Received: from mga11.intel.com ([192.55.52.93]:62150 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754804Ab2AXALV (ORCPT ); Mon, 23 Jan 2012 19:11:21 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.71,315,1320652800"; d="scan'208";a="110061155" From: Allen Kay To: linux-pci-owner@vger.kernel.org Cc: jesse.barnes@intel.com, matt.wilcox@intel.com, linux-kernel@vger.kernel.org, jean.guyader@eu.citrix.com, allen.m.kay@intel.com Subject: [RFC][PATCH 1/1] check for pci bar restore completion and retry Date: Mon, 23 Jan 2012 15:55:55 -0800 Message-Id: <1327362955-4137-1-git-send-email-allen.m.kay@intel.com> X-Mailer: git-send-email 1.6.0.6 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On some OEM systems, pci_restore_state() is called while FLR has not yet completed. As a result, PCI BAR register restore is not successful. This fix reads back the restored value and compares it with saved value and re-tries 10 times before giving up. Signed-off-by: Jean Guyader Signed-off-by: Allen Kay --- drivers/pci/pci.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index af295bb..0549050 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -959,6 +959,7 @@ void pci_restore_state(struct pci_dev *dev) { int i; u32 val; + int tries; if (!dev->state_saved) return; @@ -973,12 +974,16 @@ void pci_restore_state(struct pci_dev *dev) */ for (i = 15; i >= 0; i--) { pci_read_config_dword(dev, i * 4, &val); - if (val != dev->saved_config_space[i]) { + tries = 10; + while (tries && val != dev->saved_config_space[i]) { dev_dbg(&dev->dev, "restoring config " "space at offset %#x (was %#x, writing %#x)\n", i, val, (int)dev->saved_config_space[i]); pci_write_config_dword(dev,i * 4, dev->saved_config_space[i]); + pci_read_config_dword(dev, i * 4, &val); + mdelay(10); + tries--; } } pci_restore_pcix_state(dev); -- 1.6.0.6