ia64/xen-unstable

view patches/linux-2.6.9/agpgart.patch @ 3697:0156bb4ae3d7

bitkeeper revision 1.1159.212.112 (4207b382VvZgSA3Pg79SQESssYJbHQ)

More x86_64 fixes.
Signed-off-by: keir.fraser@cl.cam.ac.uk
author kaf24@scramble.cl.cam.ac.uk
date Mon Feb 07 18:29:22 2005 +0000 (2005-02-07)
parents c23dd7ec1f54
children 0a4b76b6b5a0
line source
1 diff -ur linux-2.6.9/drivers/char/agp/ali-agp.c linux-2.6.9-new/drivers/char/agp/ali-agp.c
2 --- linux-2.6.9/drivers/char/agp/ali-agp.c 2004-10-18 22:54:38.000000000 +0100
3 +++ linux-2.6.9-new/drivers/char/agp/ali-agp.c 2004-11-28 19:32:03.000000000 +0000
4 @@ -150,7 +150,7 @@
5 pci_read_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL, &temp);
6 pci_write_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL,
7 (((temp & ALI_CACHE_FLUSH_ADDR_MASK) |
8 - virt_to_phys(addr)) | ALI_CACHE_FLUSH_EN ));
9 + virt_to_bus(addr)) | ALI_CACHE_FLUSH_EN ));
10 return addr;
11 }
13 @@ -174,7 +174,7 @@
14 pci_read_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL, &temp);
15 pci_write_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL,
16 (((temp & ALI_CACHE_FLUSH_ADDR_MASK) |
17 - virt_to_phys(addr)) | ALI_CACHE_FLUSH_EN));
18 + virt_to_bus(addr)) | ALI_CACHE_FLUSH_EN));
19 agp_generic_destroy_page(addr);
20 }
22 diff -ur linux-2.6.9/drivers/char/agp/amd-k7-agp.c linux-2.6.9-new/drivers/char/agp/amd-k7-agp.c
23 --- linux-2.6.9/drivers/char/agp/amd-k7-agp.c 2004-10-18 22:55:36.000000000 +0100
24 +++ linux-2.6.9-new/drivers/char/agp/amd-k7-agp.c 2004-11-28 19:36:39.000000000 +0000
25 @@ -43,7 +43,7 @@
27 SetPageReserved(virt_to_page(page_map->real));
28 global_cache_flush();
29 - page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real),
30 + page_map->remapped = ioremap_nocache(virt_to_bus(page_map->real),
31 PAGE_SIZE);
32 if (page_map->remapped == NULL) {
33 ClearPageReserved(virt_to_page(page_map->real));
34 @@ -152,7 +152,7 @@
36 agp_bridge->gatt_table_real = (u32 *)page_dir.real;
37 agp_bridge->gatt_table = (u32 __iomem *)page_dir.remapped;
38 - agp_bridge->gatt_bus_addr = virt_to_phys(page_dir.real);
39 + agp_bridge->gatt_bus_addr = virt_to_bus(page_dir.real);
41 /* Get the address for the gart region.
42 * This is a bus address even on the alpha, b/c its
43 @@ -165,7 +165,7 @@
45 /* Calculate the agp offset */
46 for (i = 0; i < value->num_entries / 1024; i++, addr += 0x00400000) {
47 - writel(virt_to_phys(amd_irongate_private.gatt_pages[i]->real) | 1,
48 + writel(virt_to_bus(amd_irongate_private.gatt_pages[i]->real) | 1,
49 page_dir.remapped+GET_PAGE_DIR_OFF(addr));
50 }
52 diff -ur linux-2.6.9/drivers/char/agp/amd64-agp.c linux-2.6.9-new/drivers/char/agp/amd64-agp.c
53 --- linux-2.6.9/drivers/char/agp/amd64-agp.c 2004-10-18 22:54:38.000000000 +0100
54 +++ linux-2.6.9-new/drivers/char/agp/amd64-agp.c 2004-11-28 19:32:03.000000000 +0000
55 @@ -212,7 +212,7 @@
57 static int amd_8151_configure(void)
58 {
59 - unsigned long gatt_bus = virt_to_phys(agp_bridge->gatt_table_real);
60 + unsigned long gatt_bus = virt_to_bus(agp_bridge->gatt_table_real);
62 /* Configure AGP regs in each x86-64 host bridge. */
63 for_each_nb() {
64 @@ -521,7 +521,7 @@
65 {
66 struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
68 - release_mem_region(virt_to_phys(bridge->gatt_table_real),
69 + release_mem_region(virt_to_bus(bridge->gatt_table_real),
70 amd64_aperture_sizes[bridge->aperture_size_idx].size);
71 agp_remove_bridge(bridge);
72 agp_put_bridge(bridge);
73 diff -ur linux-2.6.9/drivers/char/agp/ati-agp.c linux-2.6.9-new/drivers/char/agp/ati-agp.c
74 --- linux-2.6.9/drivers/char/agp/ati-agp.c 2004-10-18 22:54:40.000000000 +0100
75 +++ linux-2.6.9-new/drivers/char/agp/ati-agp.c 2004-11-28 19:32:03.000000000 +0000
76 @@ -64,7 +64,7 @@
78 /* CACHE_FLUSH(); */
79 global_cache_flush();
80 - page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real),
81 + page_map->remapped = ioremap_nocache(virt_to_bus(page_map->real),
82 PAGE_SIZE);
83 if (page_map->remapped == NULL || err) {
84 ClearPageReserved(virt_to_page(page_map->real));
85 diff -ur linux-2.6.9/drivers/char/agp/backend.c linux-2.6.9-new/drivers/char/agp/backend.c
86 --- linux-2.6.9/drivers/char/agp/backend.c 2004-10-18 22:54:39.000000000 +0100
87 +++ linux-2.6.9-new/drivers/char/agp/backend.c 2004-11-28 19:32:03.000000000 +0000
88 @@ -142,7 +142,7 @@
89 return -ENOMEM;
90 }
92 - bridge->scratch_page_real = virt_to_phys(addr);
93 + bridge->scratch_page_real = virt_to_bus(addr);
94 bridge->scratch_page =
95 bridge->driver->mask_memory(bridge->scratch_page_real, 0);
96 }
97 @@ -186,7 +186,7 @@
98 err_out:
99 if (bridge->driver->needs_scratch_page)
100 bridge->driver->agp_destroy_page(
101 - phys_to_virt(bridge->scratch_page_real));
102 + bus_to_virt(bridge->scratch_page_real));
103 if (got_gatt)
104 bridge->driver->free_gatt_table();
105 if (got_keylist) {
106 @@ -211,7 +211,7 @@
107 if (bridge->driver->agp_destroy_page &&
108 bridge->driver->needs_scratch_page)
109 bridge->driver->agp_destroy_page(
110 - phys_to_virt(bridge->scratch_page_real));
111 + bus_to_virt(bridge->scratch_page_real));
112 }
114 static const drm_agp_t drm_agp = {
115 diff -ur linux-2.6.9/drivers/char/agp/efficeon-agp.c linux-2.6.9-new/drivers/char/agp/efficeon-agp.c
116 --- linux-2.6.9/drivers/char/agp/efficeon-agp.c 2004-10-18 22:53:06.000000000 +0100
117 +++ linux-2.6.9-new/drivers/char/agp/efficeon-agp.c 2004-11-28 19:38:28.000000000 +0000
118 @@ -219,7 +219,7 @@
120 efficeon_private.l1_table[index] = page;
122 - value = __pa(page) | pati | present | index;
123 + value = virt_to_bus(page) | pati | present | index;
125 pci_write_config_dword(agp_bridge->dev,
126 EFFICEON_ATTPAGE, value);
127 diff -ur linux-2.6.9/drivers/char/agp/generic.c linux-2.6.9-new/drivers/char/agp/generic.c
128 --- linux-2.6.9/drivers/char/agp/generic.c 2004-10-18 22:53:50.000000000 +0100
129 +++ linux-2.6.9-new/drivers/char/agp/generic.c 2004-11-28 19:32:03.000000000 +0000
130 @@ -128,7 +128,7 @@
131 }
132 if (curr->page_count != 0) {
133 for (i = 0; i < curr->page_count; i++) {
134 - agp_bridge->driver->agp_destroy_page(phys_to_virt(curr->memory[i]));
135 + agp_bridge->driver->agp_destroy_page(bus_to_virt(curr->memory[i]));
136 }
137 }
138 agp_free_key(curr->key);
139 @@ -182,7 +182,7 @@
140 return NULL;
141 }
142 new->memory[i] =
143 - agp_bridge->driver->mask_memory(virt_to_phys(addr), type);
144 + agp_bridge->driver->mask_memory(virt_to_bus(addr), type);
145 new->page_count++;
146 }
148 @@ -637,6 +637,7 @@
149 int i;
150 void *temp;
151 struct page *page;
152 + dma_addr_t dma;
154 /* The generic routines can't handle 2 level gatt's */
155 if (agp_bridge->driver->size_type == LVL2_APER_SIZE)
156 @@ -675,8 +676,10 @@
157 break;
158 }
160 - table = (char *) __get_free_pages(GFP_KERNEL,
161 - page_order);
162 + table = dma_alloc_coherent(
163 + &agp_bridge->dev->dev,
164 + PAGE_SIZE << page_order, &dma,
165 + GFP_KERNEL);
167 if (table == NULL) {
168 i++;
169 @@ -707,7 +710,9 @@
170 size = ((struct aper_size_info_fixed *) temp)->size;
171 page_order = ((struct aper_size_info_fixed *) temp)->page_order;
172 num_entries = ((struct aper_size_info_fixed *) temp)->num_entries;
173 - table = (char *) __get_free_pages(GFP_KERNEL, page_order);
174 + table = dma_alloc_coherent(
175 + &agp_bridge->dev->dev,
176 + PAGE_SIZE << page_order, &dma, GFP_KERNEL);
177 }
179 if (table == NULL)
180 @@ -722,7 +727,7 @@
181 agp_gatt_table = (void *)table;
183 agp_bridge->driver->cache_flush();
184 - agp_bridge->gatt_table = ioremap_nocache(virt_to_phys(table),
185 + agp_bridge->gatt_table = ioremap_nocache(virt_to_bus(table),
186 (PAGE_SIZE * (1 << page_order)));
187 agp_bridge->driver->cache_flush();
189 @@ -730,11 +735,12 @@
190 for (page = virt_to_page(table); page <= virt_to_page(table_end); page++)
191 ClearPageReserved(page);
193 - free_pages((unsigned long) table, page_order);
194 + dma_free_coherent(&agp_bridge->dev->dev, PAGE_SIZE<<page_order,
195 + table, dma);
197 return -ENOMEM;
198 }
199 - agp_bridge->gatt_bus_addr = virt_to_phys(agp_bridge->gatt_table_real);
200 + agp_bridge->gatt_bus_addr = virt_to_bus(table);
202 /* AK: bogus, should encode addresses > 4GB */
203 for (i = 0; i < num_entries; i++)
204 @@ -786,7 +792,8 @@
205 for (page = virt_to_page(table); page <= virt_to_page(table_end); page++)
206 ClearPageReserved(page);
208 - free_pages((unsigned long) agp_bridge->gatt_table_real, page_order);
209 + dma_free_coherent(&agp_bridge->dev->dev, PAGE_SIZE<<page_order,
210 + agp_bridge->gatt_table_real, agp_bridge->gatt_bus_addr);
212 agp_gatt_table = NULL;
213 agp_bridge->gatt_table = NULL;
214 diff -ur linux-2.6.9/drivers/char/agp/hp-agp.c linux-2.6.9-new/drivers/char/agp/hp-agp.c
215 --- linux-2.6.9/drivers/char/agp/hp-agp.c 2004-10-18 22:54:55.000000000 +0100
216 +++ linux-2.6.9-new/drivers/char/agp/hp-agp.c 2004-11-28 19:32:03.000000000 +0000
217 @@ -110,7 +110,7 @@
218 hp->gart_size = HP_ZX1_GART_SIZE;
219 hp->gatt_entries = hp->gart_size / hp->io_page_size;
221 - hp->io_pdir = phys_to_virt(INREG64(hp->ioc_regs, HP_ZX1_PDIR_BASE));
222 + hp->io_pdir = bus_to_virt(INREG64(hp->ioc_regs, HP_ZX1_PDIR_BASE));
223 hp->gatt = &hp->io_pdir[HP_ZX1_IOVA_TO_PDIR(hp->gart_base)];
225 if (hp->gatt[0] != HP_ZX1_SBA_IOMMU_COOKIE) {
226 @@ -248,7 +248,7 @@
227 agp_bridge->mode = INREG32(hp->lba_regs, hp->lba_cap_offset + PCI_AGP_STATUS);
229 if (hp->io_pdir_owner) {
230 - OUTREG64(hp->ioc_regs, HP_ZX1_PDIR_BASE, virt_to_phys(hp->io_pdir));
231 + OUTREG64(hp->ioc_regs, HP_ZX1_PDIR_BASE, virt_to_bus(hp->io_pdir));
232 OUTREG64(hp->ioc_regs, HP_ZX1_TCNFG, hp->io_tlb_ps);
233 OUTREG64(hp->ioc_regs, HP_ZX1_IMASK, ~(HP_ZX1_IOVA_SIZE - 1));
234 OUTREG64(hp->ioc_regs, HP_ZX1_IBASE, hp->iova_base | 0x1);
235 diff -ur linux-2.6.9/drivers/char/agp/i460-agp.c linux-2.6.9-new/drivers/char/agp/i460-agp.c
236 --- linux-2.6.9/drivers/char/agp/i460-agp.c 2004-10-18 22:54:32.000000000 +0100
237 +++ linux-2.6.9-new/drivers/char/agp/i460-agp.c 2004-11-28 19:32:03.000000000 +0000
238 @@ -371,7 +371,7 @@
239 }
240 memset(lp->alloced_map, 0, map_size);
242 - lp->paddr = virt_to_phys(lpage);
243 + lp->paddr = virt_to_bus(lpage);
244 lp->refcount = 0;
245 atomic_add(I460_KPAGES_PER_IOPAGE, &agp_bridge->current_memory_agp);
246 return 0;
247 @@ -382,7 +382,7 @@
248 kfree(lp->alloced_map);
249 lp->alloced_map = NULL;
251 - free_pages((unsigned long) phys_to_virt(lp->paddr), I460_IO_PAGE_SHIFT - PAGE_SHIFT);
252 + free_pages((unsigned long) bus_to_virt(lp->paddr), I460_IO_PAGE_SHIFT - PAGE_SHIFT);
253 atomic_sub(I460_KPAGES_PER_IOPAGE, &agp_bridge->current_memory_agp);
254 }
256 diff -ur linux-2.6.9/drivers/char/agp/intel-agp.c linux-2.6.9-new/drivers/char/agp/intel-agp.c
257 --- linux-2.6.9/drivers/char/agp/intel-agp.c 2004-10-18 22:54:08.000000000 +0100
258 +++ linux-2.6.9-new/drivers/char/agp/intel-agp.c 2004-11-28 19:37:22.000000000 +0000
259 @@ -285,7 +285,7 @@
260 if (new == NULL)
261 return NULL;
263 - new->memory[0] = virt_to_phys(addr);
264 + new->memory[0] = virt_to_bus(addr);
265 if (pg_count == 4) {
266 /* kludge to get 4 physical pages for ARGB cursor */
267 new->memory[1] = new->memory[0] + PAGE_SIZE;
268 @@ -328,10 +328,10 @@
269 agp_free_key(curr->key);
270 if(curr->type == AGP_PHYS_MEMORY) {
271 if (curr->page_count == 4)
272 - i8xx_destroy_pages(phys_to_virt(curr->memory[0]));
273 + i8xx_destroy_pages(bus_to_virt(curr->memory[0]));
274 else
275 agp_bridge->driver->agp_destroy_page(
276 - phys_to_virt(curr->memory[0]));
277 + bus_to_virt(curr->memory[0]));
278 vfree(curr->memory);
279 }
280 kfree(curr);
281 diff -ur linux-2.6.9/drivers/char/agp/intel-mch-agp.c linux-2.6.9-new/drivers/char/agp/intel-mch-agp.c
282 --- linux-2.6.9/drivers/char/agp/intel-mch-agp.c 2004-10-18 22:53:13.000000000 +0100
283 +++ linux-2.6.9-new/drivers/char/agp/intel-mch-agp.c 2004-11-28 19:32:03.000000000 +0000
284 @@ -51,7 +51,7 @@
285 if (new == NULL)
286 return NULL;
288 - new->memory[0] = agp_bridge->driver->mask_memory(virt_to_phys(addr), type);
289 + new->memory[0] = agp_bridge->driver->mask_memory(virt_to_bus(addr), type);
290 new->page_count = 1;
291 new->num_scratch_pages = 1;
292 new->type = AGP_PHYS_MEMORY;
293 @@ -63,7 +63,7 @@
294 {
295 agp_free_key(curr->key);
296 if(curr->type == AGP_PHYS_MEMORY) {
297 - agp_bridge->driver->agp_destroy_page(phys_to_virt(curr->memory[0]));
298 + agp_bridge->driver->agp_destroy_page(bus_to_virt(curr->memory[0]));
299 vfree(curr->memory);
300 }
301 kfree(curr);
302 diff -ur linux-2.6.9/drivers/char/agp/sworks-agp.c linux-2.6.9-new/drivers/char/agp/sworks-agp.c
303 --- linux-2.6.9/drivers/char/agp/sworks-agp.c 2004-10-18 22:53:50.000000000 +0100
304 +++ linux-2.6.9-new/drivers/char/agp/sworks-agp.c 2004-11-28 19:38:02.000000000 +0000
305 @@ -51,7 +51,7 @@
306 }
307 SetPageReserved(virt_to_page(page_map->real));
308 global_cache_flush();
309 - page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real),
310 + page_map->remapped = ioremap_nocache(virt_to_bus(page_map->real),
311 PAGE_SIZE);
312 if (page_map->remapped == NULL) {
313 ClearPageReserved(virt_to_page(page_map->real));
314 @@ -162,7 +162,7 @@
315 /* Create a fake scratch directory */
316 for(i = 0; i < 1024; i++) {
317 writel(agp_bridge->scratch_page, serverworks_private.scratch_dir.remapped+i);
318 - writel(virt_to_phys(serverworks_private.scratch_dir.real) | 1, page_dir.remapped+i);
319 + writel(virt_to_bus(serverworks_private.scratch_dir.real) | 1, page_dir.remapped+i);
320 }
322 retval = serverworks_create_gatt_pages(value->num_entries / 1024);
323 @@ -174,7 +174,7 @@
325 agp_bridge->gatt_table_real = (u32 *)page_dir.real;
326 agp_bridge->gatt_table = (u32 __iomem *)page_dir.remapped;
327 - agp_bridge->gatt_bus_addr = virt_to_phys(page_dir.real);
328 + agp_bridge->gatt_bus_addr = virt_to_bus(page_dir.real);
330 /* Get the address for the gart region.
331 * This is a bus address even on the alpha, b/c its
332 @@ -187,7 +187,7 @@
333 /* Calculate the agp offset */
335 for(i = 0; i < value->num_entries / 1024; i++)
336 - writel(virt_to_phys(serverworks_private.gatt_pages[i]->real)|1, page_dir.remapped+i);
337 + writel(virt_to_bus(serverworks_private.gatt_pages[i]->real)|1, page_dir.remapped+i);
339 return 0;
340 }
341 diff -ur linux-2.6.9/drivers/char/agp/uninorth-agp.c linux-2.6.9-new/drivers/char/agp/uninorth-agp.c
342 --- linux-2.6.9/drivers/char/agp/uninorth-agp.c 2004-10-18 22:54:29.000000000 +0100
343 +++ linux-2.6.9-new/drivers/char/agp/uninorth-agp.c 2004-11-28 19:32:03.000000000 +0000
344 @@ -200,7 +200,7 @@
346 agp_bridge->gatt_table_real = (u32 *) table;
347 agp_bridge->gatt_table = (u32 *)table;
348 - agp_bridge->gatt_bus_addr = virt_to_phys(table);
349 + agp_bridge->gatt_bus_addr = virt_to_bus(table);
351 for (i = 0; i < num_entries; i++) {
352 agp_bridge->gatt_table[i] =
353 diff -ur linux-2.6.9/include/asm-i386/agp.h linux-2.6.9-new/include/asm-i386/agp.h
354 --- linux-2.6.9/include/asm-i386/agp.h 2004-10-18 22:53:06.000000000 +0100
355 +++ linux-2.6.9-new/include/asm-i386/agp.h 2004-11-28 19:32:03.000000000 +0000
356 @@ -3,6 +3,7 @@
358 #include <asm/pgtable.h>
359 #include <asm/cacheflush.h>
360 +#include <asm/system.h>
362 /*
363 * Functions to keep the agpgart mappings coherent with the MMU.
364 @@ -19,6 +20,6 @@
365 /* Could use CLFLUSH here if the cpu supports it. But then it would
366 need to be called for each cacheline of the whole page so it may not be
367 worth it. Would need a page for it. */
368 -#define flush_agp_cache() asm volatile("wbinvd":::"memory")
369 +#define flush_agp_cache() wbinvd()
371 #endif