Skip to contentSkip to conversation

: Save MSI state before suspend.

PATCH Applied Michael Chan 4 participants 7 messages Feb 13, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/8 : Save MSI state before suspend.

[TG3]: Save MSI state before suspend.

This fixes the following problem:

http://bugzilla.kernel.org/show_bug.cgi?id=7969

The MSI state needs to be saved during suspend. PCI state saved during tg3_init_one() does not contain valid MSI state because MSI hasn't been enabled.

drivers/net/tg3.c +3 -0
index e136bae..0b5b8e7 100644
@@ -12016,6 +12016,9 @@ static int tg3_suspend(struct pci_dev *p
 	tp->tg3_flags &= ~TG3_FLAG_INIT_COMPLETE;
 	tg3_full_unlock(tp);
 
+	/* Save MSI address and data for resume.  */
+	pci_save_state(pdev);
+
 	err = tg3_set_power_state(tp, pci_choose_state(pdev, state));
 	if (err) {
 		tg3_full_lock(tp, 0);
#2 lore raw
Quoted 4 lines · Jeff Garzik

I'm curious if, after this patch is applied, all the pci_save_state() calls are truly necessary?

The others are necessary to save/restore the memory enable bit in the PCI command register. This bit gets reset after chip reset.

#3 lore raw
In reply to Michael Chan
Quoted 4 lines · On Tue, 13 Feb 2007 12:13:32 -0800 "Michael Chan" <[email protected]> wrote:

[TG3]: Save MSI state before suspend.

This fixes the following problem:

Quoted 8 lines

http://bugzilla.kernel.org/show_bug.cgi?id=7969

The MSI state needs to be saved during suspend. PCI state saved during tg3_init_one() does not contain valid MSI state because MSI hasn't been enabled.

I think you have to move the original pci_save_state call, otherwise you will call pci_save_state twice and leak memory. pci_save_state allocates memory to store MSI and other information. Look at pci_save_pcie_state etc.

Signature · 1 line
Stephen Hemminger <[email protected]>
#4 lore raw
Quoted 4 lines · Stephen Hemminger

I think you have to move the original pci_save_state call, otherwise you will call pci_save_state twice and leak memory. pci_save_state allocates memory to store MSI and other information. Look at pci_save_pcie_state etc.

That's a bug in the PCI layer. Patches welcome...

Jeff

#5 lore raw
In reply to Stephen Hemminger
Quoted 6 lines · Stephen Hemminger

I think you have to move the original pci_save_state call, otherwise you will call pci_save_state twice and leak memory. pci_save_state allocates memory to store MSI and other information. Look at pci_save_pcie_state etc.

I think it is ok the way it is. We call pci_restore_state() at least once during tg3_chip_reset(). This will free any memory allocated during tg3_init_one()'s call to pci_save_state(), before we even get to tg3_suspend().

The memory allocated in tg3_suspend()'s call to pci_save_state() will be freed when tg3_resume() calls pci_restore_state().

maintainer Applied
#6 lore raw
In reply to Michael Chan

From: "Michael Chan" <[email protected]>
Date: Tue, 13 Feb 2007 12:13:32 -0800

Quoted 11 lines

[TG3]: Save MSI state before suspend.

This fixes the following problem:

http://bugzilla.kernel.org/show_bug.cgi?id=7969

The MSI state needs to be saved during suspend. PCI state saved during tg3_init_one() does not contain valid MSI state because MSI hasn't been enabled.

Applied.