From patchwork Mon Jan 13 06:07:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Yu X-Patchwork-Id: 11329687 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7CE20139A for ; Mon, 13 Jan 2020 06:08:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6533624654 for ; Mon, 13 Jan 2020 06:08:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730659AbgAMGIk (ORCPT ); Mon, 13 Jan 2020 01:08:40 -0500 Received: from mga05.intel.com ([192.55.52.43]:47086 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725909AbgAMGIk (ORCPT ); Mon, 13 Jan 2020 01:08:40 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Jan 2020 22:08:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,427,1571727600"; d="scan'208";a="304750793" Received: from chenyu-office.sh.intel.com ([10.239.158.173]) by orsmga001.jf.intel.com with ESMTP; 12 Jan 2020 22:08:38 -0800 From: Chen Yu To: linux-pci@vger.kernel.org Cc: Chen Yu , Bjorn Helgaas , "Rafael J. Wysocki" , Len Brown , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] PCI/PM: Print the pci config space of devices before suspend Date: Mon, 13 Jan 2020 14:07:24 +0800 Message-Id: <20200113060724.19571-1-yu.c.chen@intel.com> X-Mailer: git-send-email 2.17.1 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The pci config space was found to be insane during resume from hibernation(S4, or suspend to disk) on a VM: serial 0000:00:16.3: restoring config space at offset 0x14 (was 0x9104e000, writing 0xffffffff) Either the snapshot on the disk has been scribbled or the pci config space becomes invalid before suspend. To narrow down and benefit future debugging, print the pci config space being saved before suspend, which is symmetric to the log in pci_restore_config_dword(). Cc: Bjorn Helgaas Cc: "Rafael J. Wysocki" Cc: Len Brown Cc: linux-pci@vger.kernel.org Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Chen Yu --- drivers/pci/pci.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index e87196cc1a7f..34cde70440c3 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -1372,8 +1372,11 @@ int pci_save_state(struct pci_dev *dev) { int i; /* XXX: 100% dword access ok here? */ - for (i = 0; i < 16; i++) + for (i = 0; i < 16; i++) { pci_read_config_dword(dev, i * 4, &dev->saved_config_space[i]); + pci_dbg(dev, "saving config space at offset %#x (reading %#x)\n", + i * 4, dev->saved_config_space[i]); + } dev->state_saved = true; i = pci_save_pcie_state(dev);