mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: stable-review@kernel.org, torvalds@linux-foundation.org,
	akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk,
	Mark Langsdorf <mark.langsdorf@amd.com>,
	Joerg Roedel <joerg.roedel@amd.com>,
	jbarnes@virtuousgeek.org, Ingo Molnar <mingo@elte.hu>
Subject: [patch 14/28] x86: enable GART-IOMMU only after setting up protection methods
Date: Thu, 13 Aug 2009 12:40:35 -0700	[thread overview]
Message-ID: <20090813194337.619553936@mini.kroah.org> (raw)
In-Reply-To: <20090813194554.GA13947@kroah.com>

[-- Attachment #1: x86-enable-gart-iommu-only-after-setting-up-protection-methods.patch --]
[-- Type: text/plain, Size: 1987 bytes --]

2.6.27-stable review patch.  If anyone has any objections, please let us know.

------------------

From: Mark Langsdorf <mark.langsdorf@amd.com>

commit fe2245c905631a3a353504fc04388ce3dfaf9d9e upstream.

The current code to set up the GART as an IOMMU enables GART
translations before it removes the aperture from the kernel memory
map, sets the GART PTEs to UC, sets up the guard and scratch
pages, or does a wbinvd().  This leaves the possibility of cache
aliasing open and can cause system crashes.

Re-order the code so as to enable the GART translations only
after all safeguards are in place and the tlb has been flushed.

AMD has tested this patch on both Istanbul systems and 1st
generation Opteron systems with APG enabled and seen no adverse
effects.  Istanbul systems with HT Assist enabled sometimes
see MCE errors due to cache artifacts with the unmodified
code.

Signed-off-by: Mark Langsdorf <mark.langsdorf@amd.com>
Cc: Joerg Roedel <joerg.roedel@amd.com>
Cc: akpm@linux-foundation.org
Cc: jbarnes@virtuousgeek.org
Signed-off-by: Ingo Molnar <mingo@elte.hu>

---
 arch/x86/kernel/pci-gart_64.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

--- a/arch/x86/kernel/pci-gart_64.c
+++ b/arch/x86/kernel/pci-gart_64.c
@@ -658,8 +658,6 @@ static __init int init_k8_gatt(struct ag
 	memset(gatt, 0, gatt_size);
 	agp_gatt_table = gatt;
 
-	enable_gart_translations();
-
 	error = sysdev_class_register(&gart_sysdev_class);
 	if (!error)
 		error = sysdev_register(&device_gart);
@@ -828,6 +826,14 @@ void __init gart_iommu_init(void)
 	wbinvd();
 
 	/*
+	 * Now all caches are flushed and we can safely enable
+	 * GART hardware.  Doing it early leaves the possibility
+	 * of stale cache entries that can lead to GART PTE
+	 * errors.
+	 */
+	enable_gart_translations();
+
+	/*
 	 * Try to workaround a bug (thanks to BenH):
 	 * Set unmapped entries to a scratch page instead of 0.
 	 * Any prefetches that hit unmapped entries won't get an bus abort



  parent reply	other threads:[~2009-08-13 19:47 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20090813194021.446758568@mini.kroah.org>
2009-08-13 19:45 ` [patch 00/28] 2.6.27.30-stable review Greg KH
2009-08-13 19:40   ` [patch 01/28] hugetlbfs: fix i_blocks accounting Greg KH
2009-08-13 19:40   ` [patch 02/28] hwmon: (smsc47m1) Differentiate between LPC47M233 and LPC47M292 Greg KH
2009-08-13 19:40   ` [patch 03/28] i2c/tsl2550: Fix lux value in dark environment Greg KH
2009-08-13 19:40   ` [patch 04/28] SCSI: libsas: reuse the original port when hotplugging phys in wide ports Greg KH
2009-08-13 19:40   ` [patch 05/28] Make SCSI SG v4 driver enabled by default and remove EXPERIMENTAL dependency, since udev depends on BSG Greg KH
2009-08-13 19:40   ` [patch 06/28] page-allocator: preserve PFN ordering when __GFP_COLD is set Greg KH
2009-08-13 19:40   ` [patch 07/28] sysfs: fix hardlink count on device_move Greg KH
2009-08-13 19:40   ` [patch 08/28] thinkpad-acpi: disable broken bay and dock subdrivers Greg KH
2009-08-13 19:40   ` [patch 09/28] USB: storage: raise timeout in usb_stor_Bulk_max_lun Greg KH
2009-08-13 19:40   ` [patch 10/28] x86: fix assembly constraints in native_save_fl() Greg KH
2009-08-13 19:40   ` [patch 11/28] parisc: ensure broadcast tlb purge runs single threaded Greg KH
2009-08-13 19:40   ` [patch 12/28] ieee1394: sbp2: add support for disks >2 TB (and 16 bytes long CDBs) Greg KH
2009-08-13 19:40   ` [patch 13/28] firewire: " Greg KH
2009-08-13 19:40   ` Greg KH [this message]
2009-08-13 19:40   ` [patch 15/28] asix: new device ids Greg KH
2009-08-13 19:40   ` [patch 16/28] compat_ioctl: hook up compat handler for FIEMAP ioctl Greg KH
2009-08-13 19:40   ` [patch 17/28] execve: must clear current->clear_child_tid Greg KH
2009-08-13 19:40   ` [patch 18/28] flat: fix uninitialized ptr with shared libs Greg KH
2009-08-13 19:40   ` [patch 19/28] USB: devio: Properly do access_ok() checks Greg KH
2009-08-13 19:40   ` [patch 20/28] USB: ftdi_sio: add vendor and product id for Bayer glucose meter serial converter cable Greg KH
2009-08-13 19:40   ` [patch 21/28] USB: ftdi_sio: add product_id for Marvell OpenRD Base, Client Greg KH
2009-08-13 19:40   ` [patch 22/28] USB: storage: include Prolific Technology USB drive in unusual_devs list Greg KH
2009-08-13 19:40   ` [patch 23/28] USB: usbfs: fix -ENOENT error code to be -ENODEV Greg KH
2009-08-13 19:40   ` [patch 24/28] mm_for_maps: simplify, use ptrace_may_access() Greg KH
2009-08-13 19:40   ` [patch 25/28] mm_for_maps: shift down_read(mmap_sem) to the caller Greg KH
2009-08-13 19:40   ` [patch 26/28] Make sock_sendpage() use kernel_sendpage() Greg KH
2009-08-13 19:40   ` [patch 27/28] ALSA: hda - Add missing vmaster initialization for ALC269 Greg KH
2009-08-13 19:59     ` Linus Torvalds
2009-08-13 20:12       ` Greg KH
2009-08-14  6:56         ` Takashi Iwai
2009-08-14 17:14           ` Greg KH
2009-08-13 19:40   ` [patch 28/28] NFS: Fix an O_DIRECT Oops Greg KH

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=20090813194337.619553936@mini.kroah.org \
    --to=gregkh@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=jbarnes@virtuousgeek.org \
    --cc=joerg.roedel@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.langsdorf@amd.com \
    --cc=mingo@elte.hu \
    --cc=stable-review@kernel.org \
    --cc=stable@kernel.org \
    --cc=torvalds@linux-foundation.org \
    /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

Powered by JetHome