aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/agp/uninorth-agp.c
diff options
context:
space:
mode:
authorJerome Glisse <jglisse@redhat.com>2010-04-20 11:43:34 -0400
committerDave Airlie <airlied@redhat.com>2010-04-22 23:59:18 -0400
commit61cf059325a30995a78c5001db2ed2a8ab1d4c36 (patch)
tree0c674f3252032a780e9496c466c7fce2c1b084e0 /drivers/char/agp/uninorth-agp.c
parent2d2ef822758e3f5da59c40a392d0c6d89394d4b4 (diff)
agp: use scratch page on memory remove and at GATT creation V4
Convert most AGP chipset to use scratch page as default entries. This help avoiding GPU querying 0 address and trigger computer fault. With KMS and memory manager we bind/unbind AGP memory constantly and it seems that some GPU are still doing AGP traffic even after GPU report being idle with the memory segment. Tested (radeon GPU KMS + Xorg + compiz + glxgears + quake3) on : - SIS 1039:0001 & 1039:0003 - Intel 865 8086:2571 Compile tested for other bridges V2 enable scratch page on uninorth V3 fix unbound check in uninorth insert memory (Michel Dänzer) V4 rebase on top of drm-next branch with the lastest intel AGP changeset (stable should use version V3 of the patch) Signed-off-by: Jerome Glisse <jglisse@redhat.com> Signed-off-by: Michel Dänzer <michel@daenzer.net> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/char/agp/uninorth-agp.c')
-rw-r--r--drivers/char/agp/uninorth-agp.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/char/agp/uninorth-agp.c b/drivers/char/agp/uninorth-agp.c
index 6f48931ac1ce..95db71360d24 100644
--- a/drivers/char/agp/uninorth-agp.c
+++ b/drivers/char/agp/uninorth-agp.c
@@ -28,6 +28,7 @@
28 */ 28 */
29static int uninorth_rev; 29static int uninorth_rev;
30static int is_u3; 30static int is_u3;
31static u32 scratch_value;
31 32
32#define DEFAULT_APERTURE_SIZE 256 33#define DEFAULT_APERTURE_SIZE 256
33#define DEFAULT_APERTURE_STRING "256" 34#define DEFAULT_APERTURE_STRING "256"
@@ -172,7 +173,7 @@ static int uninorth_insert_memory(struct agp_memory *mem, off_t pg_start, int ty
172 173
173 gp = (u32 *) &agp_bridge->gatt_table[pg_start]; 174 gp = (u32 *) &agp_bridge->gatt_table[pg_start];
174 for (i = 0; i < mem->page_count; ++i) { 175 for (i = 0; i < mem->page_count; ++i) {
175 if (gp[i]) { 176 if (gp[i] != scratch_value) {
176 dev_info(&agp_bridge->dev->dev, 177 dev_info(&agp_bridge->dev->dev,
177 "uninorth_insert_memory: entry 0x%x occupied (%x)\n", 178 "uninorth_insert_memory: entry 0x%x occupied (%x)\n",
178 i, gp[i]); 179 i, gp[i]);
@@ -214,8 +215,9 @@ int uninorth_remove_memory(struct agp_memory *mem, off_t pg_start, int type)
214 return 0; 215 return 0;
215 216
216 gp = (u32 *) &agp_bridge->gatt_table[pg_start]; 217 gp = (u32 *) &agp_bridge->gatt_table[pg_start];
217 for (i = 0; i < mem->page_count; ++i) 218 for (i = 0; i < mem->page_count; ++i) {
218 gp[i] = 0; 219 gp[i] = scratch_value;
220 }
219 mb(); 221 mb();
220 uninorth_tlbflush(mem); 222 uninorth_tlbflush(mem);
221 223
@@ -421,8 +423,13 @@ static int uninorth_create_gatt_table(struct agp_bridge_data *bridge)
421 423
422 bridge->gatt_bus_addr = virt_to_phys(table); 424 bridge->gatt_bus_addr = virt_to_phys(table);
423 425
426 if (is_u3)
427 scratch_value = (page_to_phys(agp_bridge->scratch_page_page) >> PAGE_SHIFT) | 0x80000000UL;
428 else
429 scratch_value = cpu_to_le32((page_to_phys(agp_bridge->scratch_page_page) & 0xFFFFF000UL) |
430 0x1UL);
424 for (i = 0; i < num_entries; i++) 431 for (i = 0; i < num_entries; i++)
425 bridge->gatt_table[i] = 0; 432 bridge->gatt_table[i] = scratch_value;
426 433
427 return 0; 434 return 0;
428 435
@@ -519,6 +526,7 @@ const struct agp_bridge_driver uninorth_agp_driver = {
519 .agp_destroy_pages = agp_generic_destroy_pages, 526 .agp_destroy_pages = agp_generic_destroy_pages,
520 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 527 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
521 .cant_use_aperture = true, 528 .cant_use_aperture = true,
529 .needs_scratch_page = true,
522}; 530};
523 531
524const struct agp_bridge_driver u3_agp_driver = { 532const struct agp_bridge_driver u3_agp_driver = {