public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@suse.cz>
To: Patrick <ragamuffin@datacomm.ch>
Cc: linux-kernel@vger.kernel.org
Subject: Re: >3G => iommu => suspend problems -- was Re: SB600 AHCI: Hard Disk Corruption
Date: Sun, 25 May 2008 23:10:16 +0200	[thread overview]
Message-ID: <20080525211016.GA32478@elf.ucw.cz> (raw)
In-Reply-To: <20080525203921.GB18781@elf.ucw.cz>

Hi!

> > > iommu problem? Try it with mem=3G.
> > 
> > YES! :-) How did you know?
> 
> Guess how... I hit it myself.
> 
> > So how are we going to get this fixed???
> 
> Write a patch, submit it? ;-).

Can you try this one? It should prevent suspend in the broken cases,
but allow it in mem=4G config.

								Pavel

iommu/gart support misses suspend/resume code, which can do bad stuff,
including memory corruption on resume. Prevent system suspend in case
we would be unable to resume.

Signed-off-by: Pavel Machek <pavel@suse.cz>

---
commit 7724af033ea084f0b037ae8a2032da5e40255088
tree 06de661a106ba83a96cab2ee0e76e3f3c44823ab
parent e9f4353b46ec2b05f73e1a84085c305de211bd3e
author Pavel <pavel@amd.ucw.cz> Sun, 25 May 2008 23:08:17 +0200
committer Pavel <pavel@amd.ucw.cz> Sun, 25 May 2008 23:08:17 +0200

 arch/x86/kernel/pci-gart_64.c |   31 ++++++++++++++++++++++++++++++-
 1 files changed, 30 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c
index 620ec3a..926af9c 100644
--- a/arch/x86/kernel/pci-gart_64.c
+++ b/arch/x86/kernel/pci-gart_64.c
@@ -26,6 +26,7 @@ #include <linux/bitops.h>
 #include <linux/kdebug.h>
 #include <linux/scatterlist.h>
 #include <linux/iommu-helper.h>
+#include <linux/sysdev.h>
 #include <asm/atomic.h>
 #include <asm/io.h>
 #include <asm/mtrr.h>
@@ -548,6 +549,28 @@ static __init unsigned read_aperture(str
 	return aper_base;
 }
 
+static int gart_resume(struct sys_device *dev)
+{
+	return 0;
+}
+
+static int gart_suspend(struct sys_device *dev, pm_message_t state)
+{
+	return -EINVAL;
+}
+
+static struct sysdev_class gart_sysdev_class = {
+	.name = "gart",
+	.suspend = gart_suspend,
+	.resume = gart_resume,
+
+};
+
+static struct sys_device device_gart = {
+	.id	= 0,
+	.cls	= &gart_sysdev_class,
+};
+
 /*
  * Private Northbridge GATT initialization in case we cannot use the
  * AGP driver for some reason.
@@ -558,7 +581,7 @@ static __init int init_k8_gatt(struct ag
 	unsigned aper_base, new_aper_base;
 	struct pci_dev *dev;
 	void *gatt;
-	int i;
+	int i, error;
 
 	printk(KERN_INFO "PCI-DMA: Disabling AGP.\n");
 	aper_size = aper_base = info->aper_size = 0;
@@ -595,6 +618,12 @@ static __init int init_k8_gatt(struct ag
 		dev = k8_northbridges[i];
 		enable_gart_translation(dev, __pa(gatt));
 	}
+	
+	error = sysdev_class_register(&gart_sysdev_class);
+	if (!error)
+		error = sysdev_register(&device_gart);
+	if (error)
+		panic("Could not register gart_sysdev -- would corrupt data on next suspend");
 	flush_gart();
 
 	printk(KERN_INFO "PCI-DMA: aperture base @ %x size %u KB\n",


-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

  reply	other threads:[~2008-05-25 21:09 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-25 12:10 SB600 AHCI: Hard Disk Corruption Patrick
2008-05-25 12:16 ` Patrick
2008-05-25 17:38 ` Pavel Machek
2008-05-25 20:08   ` Patrick
2008-05-25 20:39     ` >3G => iommu => suspend problems -- was " Pavel Machek
2008-05-25 21:10       ` Pavel Machek [this message]
2008-05-26 15:31         ` Patrick
2008-05-27 11:22           ` Pavel Machek
2008-05-29 18:44             ` Patrick
2008-05-29 18:51               ` Patrick
2008-05-29 21:05               ` Patrick
2008-06-03 22:33             ` Rafael J. Wysocki
2008-06-06 13:20               ` Pavel Machek
2008-06-08 22:36                 ` Rafael J. Wysocki
     [not found]                   ` <20080609124630.GA28799@elte.hu>
2008-06-09 22:10                     ` [PATCH] x86 GART: Add resume handling (was: Re: >3G => iommu => suspend problems -- was Re: SB600 AHCI: Hard Disk Corruption) Rafael J. Wysocki
2008-06-10 10:03                       ` Rafael J. Wysocki
2008-06-12  9:34                         ` Ingo Molnar
2008-06-11 11:43                   ` >3G => iommu => suspend problems -- was Re: SB600 AHCI: Hard Disk Corruption Patrick
2008-06-11 14:38                     ` Rafael J. Wysocki
2008-06-11 15:04                       ` Andi Kleen
2008-07-03 17:35                         ` Patrick
2008-08-07  8:17                           ` Pavel Machek
2008-08-08 22:40                             ` Patrick
2008-09-02  8:05                               ` Pavel Machek
2008-05-27 10:23         ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080525211016.GA32478@elf.ucw.cz \
    --to=pavel@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ragamuffin@datacomm.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox