Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 233647
b: refs/heads/master
c: bdb8b97
h: refs/heads/master
i:
  233645: 0dc01fa
  233643: 6a8f09b
  233639: af51f25
  233631: 55df1d4
v: v3
  • Loading branch information
Chris Wilson committed Feb 22, 2011
1 parent 8ccf418 commit 31034df
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 36 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a36dbec57e9a665d69cd2e1a673153ddb2d62785
refs/heads/master: bdb8b975fc66e081c3f39be6267701f8226d11aa
1 change: 1 addition & 0 deletions trunk/drivers/char/agp/intel-agp.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
#define INTEL_GMCH_GMS_STOLEN_352M (0xd << 4)

#define I915_IFPADDR 0x60
#define I830_HIC 0x70

/* Intel 965G registers */
#define I965_MSAC 0x62
Expand Down
56 changes: 21 additions & 35 deletions trunk/drivers/char/agp/intel-gtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <linux/kernel.h>
#include <linux/pagemap.h>
#include <linux/agp_backend.h>
#include <linux/delay.h>
#include <asm/smp.h>
#include "agp.h"
#include "intel-agp.h"
Expand Down Expand Up @@ -70,12 +71,8 @@ static struct _intel_private {
u32 __iomem *gtt; /* I915G */
bool clear_fake_agp; /* on first access via agp, fill with scratch */
int num_dcache_entries;
union {
void __iomem *i9xx_flush_page;
void *i8xx_flush_page;
};
void __iomem *i9xx_flush_page;
char *i81x_gtt_table;
struct page *i8xx_page;
struct resource ifp_resource;
int resource_valid;
struct page *scratch_page;
Expand Down Expand Up @@ -722,28 +719,6 @@ static int intel_fake_agp_fetch_size(void)

static void i830_cleanup(void)
{
if (intel_private.i8xx_flush_page) {
kunmap(intel_private.i8xx_flush_page);
intel_private.i8xx_flush_page = NULL;
}

__free_page(intel_private.i8xx_page);
intel_private.i8xx_page = NULL;
}

static void intel_i830_setup_flush(void)
{
/* return if we've already set the flush mechanism up */
if (intel_private.i8xx_page)
return;

intel_private.i8xx_page = alloc_page(GFP_KERNEL);
if (!intel_private.i8xx_page)
return;

intel_private.i8xx_flush_page = kmap(intel_private.i8xx_page);
if (!intel_private.i8xx_flush_page)
i830_cleanup();
}

/* The chipset_flush interface needs to get data that has already been
Expand All @@ -758,14 +733,27 @@ static void intel_i830_setup_flush(void)
*/
static void i830_chipset_flush(void)
{
unsigned int *pg = intel_private.i8xx_flush_page;
unsigned long timeout = jiffies + msecs_to_jiffies(1000);

/* Forcibly evict everything from the CPU write buffers.
* clflush appears to be insufficient.
*/
wbinvd_on_all_cpus();

/* Now we've only seen documents for this magic bit on 855GM,
* we hope it exists for the other gen2 chipsets...
*
* Also works as advertised on my 845G.
*/
writel(readl(intel_private.registers+I830_HIC) | (1<<31),
intel_private.registers+I830_HIC);

memset(pg, 0, 1024);
while (readl(intel_private.registers+I830_HIC) & (1<<31)) {
if (time_after(jiffies, timeout))
break;

if (cpu_has_clflush)
clflush_cache_range(pg, 1024);
else if (wbinvd_on_all_cpus() != 0)
printk(KERN_ERR "Timed out waiting for cache flush.\n");
udelay(50);
}
}

static void i830_write_entry(dma_addr_t addr, unsigned int entry,
Expand Down Expand Up @@ -849,8 +837,6 @@ static int i830_setup(void)

intel_private.gtt_bus_addr = reg_addr + I810_PTE_BASE;

intel_i830_setup_flush();

return 0;
}

Expand Down

0 comments on commit 31034df

Please sign in to comment.