From ef3eb76f0e700954bc865e86f9107f34e214216e Mon Sep 17 00:00:00 2001
From: Liu Jiang <jiang.liu@linux.intel.com>
Date: Wed, 30 Sep 2015 00:57:33 +0800
Subject: [PATCH] Gather debug info

---
 drivers/gpu/drm/radeon/radeon_device.c | 2 ++
 drivers/pci/msi.c                      | 3 +++
 drivers/pci/pci-driver.c               | 8 ++++++++
 3 files changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index d8319da..425515f 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -1627,10 +1627,12 @@ int radeon_suspend_kms(struct drm_device *dev, bool suspend, bool fbcon)
 
 	radeon_agp_suspend(rdev);
 
+	dev_warn(&dev->pdev->dev, "irqdomain: before save pci state: msi%d irq%d\n", dev->pdev->msi_enabled, dev->pdev->irq);
 	pci_save_state(dev->pdev);
 	if (suspend) {
 		/* Shut down the device */
 		pci_disable_device(dev->pdev);
+		dev_warn(&dev->pdev->dev, "irqdomain: before save pci state: msi%d irq%d\n", dev->pdev->msi_enabled, dev->pdev->irq);
 		pci_set_power_state(dev->pdev, PCI_D3hot);
 	}
 
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index d449714..c789bf1 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -405,6 +405,7 @@ static void __pci_restore_msi_state(struct pci_dev *dev)
 		return;
 
 	entry = irq_get_msi_desc(dev->irq);
+	dev_warn(&dev->dev, "irqdomain: restore msi config irq%d, entry%p\n", dev->irq, entry);
 
 	pci_intx_for_msi(dev, 0);
 	pci_msi_set_enable(dev, 0);
@@ -602,6 +603,7 @@ static int msi_capability_init(struct pci_dev *dev, int nvec)
 	int ret;
 	unsigned mask;
 
+	dev_warn(&dev->dev, "irqdomain: enable msi\n");
 	pci_msi_set_enable(dev, 0);	/* Disable MSI during set up */
 
 	entry = msi_setup_entry(dev, nvec);
@@ -872,6 +874,7 @@ void pci_msi_shutdown(struct pci_dev *dev)
 	if (!pci_msi_enable || !dev || !dev->msi_enabled)
 		return;
 
+	dev_warn(&dev->dev, "irqdomain: shutdown msi\n");
 	BUG_ON(list_empty(dev_to_msi_list(&dev->dev)));
 	desc = first_pci_msi_entry(dev);
 
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index dd652f2..15352c1 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -864,6 +864,7 @@ static int pci_pm_freeze(struct device *dev)
 	struct pci_dev *pci_dev = to_pci_dev(dev);
 	const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
 
+	dev_warn(dev, "irqdomain: freeze msi %d irq%d\n", pci_dev->msi_enabled, pci_dev->irq);
 	if (pci_has_legacy_pm_support(pci_dev))
 		return pci_legacy_suspend(dev, PMSG_FREEZE);
 
@@ -901,6 +902,7 @@ static int pci_pm_freeze_noirq(struct device *dev)
 	struct pci_dev *pci_dev = to_pci_dev(dev);
 	struct device_driver *drv = dev->driver;
 
+	dev_warn(dev, "irqdomain: freeze_noirq msi %d irq%d\n", pci_dev->msi_enabled, pci_dev->irq);
 	if (pci_has_legacy_pm_support(pci_dev))
 		return pci_legacy_suspend_late(dev, PMSG_FREEZE);
 
@@ -930,6 +932,7 @@ static int pci_pm_thaw_noirq(struct device *dev)
 	struct device_driver *drv = dev->driver;
 	int error = 0;
 
+	dev_warn(dev, "irqdomain: thaw_noirq msi %d irq%d\n", pci_dev->msi_enabled, pci_dev->irq);
 	if (pcibios_pm_ops.thaw_noirq) {
 		error = pcibios_pm_ops.thaw_noirq(dev);
 		if (error)
@@ -953,6 +956,7 @@ static int pci_pm_thaw(struct device *dev)
 	const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
 	int error = 0;
 
+	dev_warn(dev, "irqdomain: thaw msi %d irq%d\n", pci_dev->msi_enabled, pci_dev->irq);
 	if (pcibios_pm_ops.thaw) {
 		error = pcibios_pm_ops.thaw(dev);
 		if (error)
@@ -979,6 +983,7 @@ static int pci_pm_poweroff(struct device *dev)
 	struct pci_dev *pci_dev = to_pci_dev(dev);
 	const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
 
+	dev_warn(dev, "irqdomain: poweroff msi %d irq%d\n", pci_dev->msi_enabled, pci_dev->irq);
 	if (pci_has_legacy_pm_support(pci_dev))
 		return pci_legacy_suspend(dev, PMSG_HIBERNATE);
 
@@ -1014,6 +1019,7 @@ static int pci_pm_poweroff_noirq(struct device *dev)
 	struct pci_dev *pci_dev = to_pci_dev(dev);
 	struct device_driver *drv = dev->driver;
 
+	dev_warn(dev, "irqdomain: poweroff_noirq msi %d irq%d\n", pci_dev->msi_enabled, pci_dev->irq);
 	if (pci_has_legacy_pm_support(to_pci_dev(dev)))
 		return pci_legacy_suspend_late(dev, PMSG_HIBERNATE);
 
@@ -1055,6 +1061,7 @@ static int pci_pm_restore_noirq(struct device *dev)
 	struct device_driver *drv = dev->driver;
 	int error = 0;
 
+	dev_warn(dev, "irqdomain: restore_noirq msi %d irq%d\n", pci_dev->msi_enabled, pci_dev->irq);
 	if (pcibios_pm_ops.restore_noirq) {
 		error = pcibios_pm_ops.restore_noirq(dev);
 		if (error)
@@ -1078,6 +1085,7 @@ static int pci_pm_restore(struct device *dev)
 	const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
 	int error = 0;
 
+	dev_warn(dev, "irqdomain: restore msi %d irq%d\n", pci_dev->msi_enabled, pci_dev->irq);
 	if (pcibios_pm_ops.restore) {
 		error = pcibios_pm_ops.restore(dev);
 		if (error)
-- 
1.9.1

