agp/intel: Fix the pre-9xx chipset flush.
commit7abf3aa8294d95e3f0be375f30e8d933f874ada0
authorEric Anholt <eric@anholt.net>
Fri, 11 Sep 2009 00:48:48 +0000 (10 17:48 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 5 Oct 2009 16:32:12 +0000 (5 09:32 -0700)
tree7e80a110c328a13e6ec26f9cd54c93791fa1c814
parent522bb748440e5765e6f73b417544f821e27940a9
agp/intel: Fix the pre-9xx chipset flush.

commit e517a5e97080bbe52857bd0d7df9b66602d53c4d upstream.

Ever since we enabled GEM, the pre-9xx chipsets (particularly 865) have had
serious stability issues.  Back in May a wbinvd was added to the DRM to
work around much of the problem.  Some failure remained -- easily visible
by dragging a window around on an X -retro desktop, or by looking at bugzilla.

The chipset flush was on the right track -- hitting the right amount of
memory, and it appears to be the only way to flush on these chipsets, but the
flush page was mapped uncached.  As a result, the writes trying to clear the
writeback cache ended up bypassing the cache, and not flushing anything!  The
wbinvd would flush out other writeback data and often cause the data we wanted
to get flushed, but not always.  By removing the setting of the page to UC
and instead just clflushing the data we write to try to flush it, we get the
desired behavior with no wbinvd.

This exports clflush_cache_range(), which was laying around and happened to
basically match the code I was otherwise going to copy from the DRM.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Brice Goglin <Brice.Goglin@ens-lyon.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/x86/mm/pageattr.c
drivers/char/agp/intel-agp.c
drivers/gpu/drm/i915/i915_gem.c