ia64/xen-unstable

view linux-2.6.8.1-patches/agpgart.patch @ 2621:9402048e2325

bitkeeper revision 1.1159.1.218 (416a8128OiHXHyk_Sy8FsA0YUQcEnA)

Merge freefall.cl.cam.ac.uk:/auto/groups/xeno/users/cl349/BK/xeno.bk-26dom0
into freefall.cl.cam.ac.uk:/local/scratch/cl349/xeno.bk-26dom0
author cl349@freefall.cl.cam.ac.uk
date Mon Oct 11 12:48:40 2004 +0000 (2004-10-11)
parents aed97013f9fe
children
line source
1 --- linux-2.6.8.1/drivers/char/agp/ali-agp.c 2004-08-14 11:55:35.000000000 +0100
2 +++ linux-2.6.8.1-xen0/drivers/char/agp/ali-agp.c 2004-09-05 05:55:58.876495340 +0100
3 @@ -150,7 +150,7 @@
4 pci_read_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL, &temp);
5 pci_write_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL,
6 (((temp & ALI_CACHE_FLUSH_ADDR_MASK) |
7 - virt_to_phys(addr)) | ALI_CACHE_FLUSH_EN ));
8 + virt_to_bus(addr)) | ALI_CACHE_FLUSH_EN ));
9 return addr;
10 }
12 @@ -174,7 +174,7 @@
13 pci_read_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL, &temp);
14 pci_write_config_dword(agp_bridge->dev, ALI_CACHE_FLUSH_CTRL,
15 (((temp & ALI_CACHE_FLUSH_ADDR_MASK) |
16 - virt_to_phys(addr)) | ALI_CACHE_FLUSH_EN));
17 + virt_to_bus(addr)) | ALI_CACHE_FLUSH_EN));
18 agp_generic_destroy_page(addr);
19 }
21 --- linux-2.6.8.1/drivers/char/agp/amd-k7-agp.c 2004-08-14 11:56:24.000000000 +0100
22 +++ linux-2.6.8.1-xen0/drivers/char/agp/amd-k7-agp.c 2004-09-05 05:55:58.877495108 +0100
23 @@ -43,7 +43,7 @@
25 SetPageReserved(virt_to_page(page_map->real));
26 global_cache_flush();
27 - page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real),
28 + page_map->remapped = ioremap_nocache(virt_to_bus(page_map->real),
29 PAGE_SIZE);
30 if (page_map->remapped == NULL) {
31 ClearPageReserved(virt_to_page(page_map->real));
32 @@ -152,7 +152,7 @@
34 agp_bridge->gatt_table_real = (u32 *)page_dir.real;
35 agp_bridge->gatt_table = (u32 *)page_dir.remapped;
36 - agp_bridge->gatt_bus_addr = virt_to_phys(page_dir.real);
37 + agp_bridge->gatt_bus_addr = virt_to_bus(page_dir.real);
39 /* Get the address for the gart region.
40 * This is a bus address even on the alpha, b/c its
41 @@ -166,7 +166,7 @@
42 /* Calculate the agp offset */
43 for (i = 0; i < value->num_entries / 1024; i++, addr += 0x00400000) {
44 page_dir.remapped[GET_PAGE_DIR_OFF(addr)] =
45 - virt_to_phys(amd_irongate_private.gatt_pages[i]->real);
46 + virt_to_bus(amd_irongate_private.gatt_pages[i]->real);
47 page_dir.remapped[GET_PAGE_DIR_OFF(addr)] |= 0x00000001;
48 }
50 --- linux-2.6.8.1/drivers/char/agp/amd64-agp.c 2004-08-14 11:55:47.000000000 +0100
51 +++ linux-2.6.8.1-xen0/drivers/char/agp/amd64-agp.c 2004-09-05 05:55:58.877495108 +0100
52 @@ -212,7 +212,7 @@
54 static int amd_8151_configure(void)
55 {
56 - unsigned long gatt_bus = virt_to_phys(agp_bridge->gatt_table_real);
57 + unsigned long gatt_bus = virt_to_bus(agp_bridge->gatt_table_real);
59 /* Configure AGP regs in each x86-64 host bridge. */
60 for_each_nb() {
61 @@ -521,7 +521,7 @@
62 {
63 struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
65 - release_mem_region(virt_to_phys(bridge->gatt_table_real),
66 + release_mem_region(virt_to_bus(bridge->gatt_table_real),
67 amd64_aperture_sizes[bridge->aperture_size_idx].size);
68 agp_remove_bridge(bridge);
69 agp_put_bridge(bridge);
70 --- linux-2.6.8.1/drivers/char/agp/ati-agp.c 2004-08-14 11:55:48.000000000 +0100
71 +++ linux-2.6.8.1-xen0/drivers/char/agp/ati-agp.c 2004-09-05 05:55:58.877495108 +0100
72 @@ -64,7 +64,7 @@
74 /* CACHE_FLUSH(); */
75 global_cache_flush();
76 - page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real),
77 + page_map->remapped = ioremap_nocache(virt_to_bus(page_map->real),
78 PAGE_SIZE);
79 if (page_map->remapped == NULL || err) {
80 ClearPageReserved(virt_to_page(page_map->real));
81 --- linux-2.6.8.1/drivers/char/agp/backend.c 2004-08-14 11:55:47.000000000 +0100
82 +++ linux-2.6.8.1-xen0/drivers/char/agp/backend.c 2004-09-05 05:55:58.878494876 +0100
83 @@ -142,7 +142,7 @@
84 return -ENOMEM;
85 }
87 - bridge->scratch_page_real = virt_to_phys(addr);
88 + bridge->scratch_page_real = virt_to_bus(addr);
89 bridge->scratch_page =
90 bridge->driver->mask_memory(bridge->scratch_page_real, 0);
91 }
92 @@ -186,7 +186,7 @@
93 err_out:
94 if (bridge->driver->needs_scratch_page)
95 bridge->driver->agp_destroy_page(
96 - phys_to_virt(bridge->scratch_page_real));
97 + bus_to_virt(bridge->scratch_page_real));
98 if (got_gatt)
99 bridge->driver->free_gatt_table();
100 if (got_keylist) {
101 @@ -211,7 +211,7 @@
102 if (bridge->driver->agp_destroy_page &&
103 bridge->driver->needs_scratch_page)
104 bridge->driver->agp_destroy_page(
105 - phys_to_virt(bridge->scratch_page_real));
106 + bus_to_virt(bridge->scratch_page_real));
107 }
109 static const drm_agp_t drm_agp = {
110 --- linux-2.6.8.1/drivers/char/agp/generic.c 2004-08-14 11:55:10.000000000 +0100
111 +++ linux-2.6.8.1-xen0/drivers/char/agp/generic.c 2004-09-05 05:55:58.879494644 +0100
112 @@ -127,7 +127,7 @@
113 }
114 if (curr->page_count != 0) {
115 for (i = 0; i < curr->page_count; i++) {
116 - agp_bridge->driver->agp_destroy_page(phys_to_virt(curr->memory[i]));
117 + agp_bridge->driver->agp_destroy_page(bus_to_virt(curr->memory[i]));
118 }
119 }
120 agp_free_key(curr->key);
121 @@ -181,7 +181,7 @@
122 return NULL;
123 }
124 new->memory[i] =
125 - agp_bridge->driver->mask_memory(virt_to_phys(addr), type);
126 + agp_bridge->driver->mask_memory(virt_to_bus(addr), type);
127 new->page_count++;
128 }
130 @@ -636,6 +636,7 @@
131 int i;
132 void *temp;
133 struct page *page;
134 + dma_addr_t dma;
136 /* The generic routines can't handle 2 level gatt's */
137 if (agp_bridge->driver->size_type == LVL2_APER_SIZE)
138 @@ -674,8 +675,10 @@
139 break;
140 }
142 - table = (char *) __get_free_pages(GFP_KERNEL,
143 - page_order);
144 + table = dma_alloc_coherent(
145 + &agp_bridge->dev->dev,
146 + PAGE_SIZE << page_order, &dma,
147 + GFP_KERNEL);
149 if (table == NULL) {
150 i++;
151 @@ -706,7 +709,9 @@
152 size = ((struct aper_size_info_fixed *) temp)->size;
153 page_order = ((struct aper_size_info_fixed *) temp)->page_order;
154 num_entries = ((struct aper_size_info_fixed *) temp)->num_entries;
155 - table = (char *) __get_free_pages(GFP_KERNEL, page_order);
156 + table = dma_alloc_coherent(
157 + &agp_bridge->dev->dev,
158 + PAGE_SIZE << page_order, &dma, GFP_KERNEL);
159 }
161 if (table == NULL)
162 @@ -721,7 +726,7 @@
163 agp_gatt_table = (void *)table;
165 agp_bridge->driver->cache_flush();
166 - agp_bridge->gatt_table = ioremap_nocache(virt_to_phys(table),
167 + agp_bridge->gatt_table = ioremap_nocache(virt_to_bus(table),
168 (PAGE_SIZE * (1 << page_order)));
169 agp_bridge->driver->cache_flush();
171 @@ -729,11 +734,12 @@
172 for (page = virt_to_page(table); page <= virt_to_page(table_end); page++)
173 ClearPageReserved(page);
175 - free_pages((unsigned long) table, page_order);
176 + dma_free_coherent(&agp_bridge->dev->dev, PAGE_SIZE<<page_order,
177 + table, dma);
179 return -ENOMEM;
180 }
181 - agp_bridge->gatt_bus_addr = virt_to_phys(agp_bridge->gatt_table_real);
182 + agp_bridge->gatt_bus_addr = virt_to_bus(table);
184 /* AK: bogus, should encode addresses > 4GB */
185 for (i = 0; i < num_entries; i++)
186 @@ -785,7 +791,8 @@
187 for (page = virt_to_page(table); page <= virt_to_page(table_end); page++)
188 ClearPageReserved(page);
190 - free_pages((unsigned long) agp_bridge->gatt_table_real, page_order);
191 + dma_free_coherent(&agp_bridge->dev->dev, PAGE_SIZE<<page_order,
192 + agp_bridge->gatt_table_real, agp_bridge->gatt_bus_addr);
194 agp_gatt_table = NULL;
195 agp_bridge->gatt_table = NULL;
196 --- linux-2.6.8.1/drivers/char/agp/hp-agp.c 2004-08-14 11:55:59.000000000 +0100
197 +++ linux-2.6.8.1-xen0/drivers/char/agp/hp-agp.c 2004-09-05 05:55:58.879494644 +0100
198 @@ -110,7 +110,7 @@
199 hp->gart_size = HP_ZX1_GART_SIZE;
200 hp->gatt_entries = hp->gart_size / hp->io_page_size;
202 - hp->io_pdir = phys_to_virt(INREG64(hp->ioc_regs, HP_ZX1_PDIR_BASE));
203 + hp->io_pdir = bus_to_virt(INREG64(hp->ioc_regs, HP_ZX1_PDIR_BASE));
204 hp->gatt = &hp->io_pdir[HP_ZX1_IOVA_TO_PDIR(hp->gart_base)];
206 if (hp->gatt[0] != HP_ZX1_SBA_IOMMU_COOKIE) {
207 @@ -248,7 +248,7 @@
208 agp_bridge->mode = INREG32(hp->lba_regs, hp->lba_cap_offset + PCI_AGP_STATUS);
210 if (hp->io_pdir_owner) {
211 - OUTREG64(hp->ioc_regs, HP_ZX1_PDIR_BASE, virt_to_phys(hp->io_pdir));
212 + OUTREG64(hp->ioc_regs, HP_ZX1_PDIR_BASE, virt_to_bus(hp->io_pdir));
213 OUTREG64(hp->ioc_regs, HP_ZX1_TCNFG, hp->io_tlb_ps);
214 OUTREG64(hp->ioc_regs, HP_ZX1_IMASK, ~(HP_ZX1_IOVA_SIZE - 1));
215 OUTREG64(hp->ioc_regs, HP_ZX1_IBASE, hp->iova_base | 0x1);
216 --- linux-2.6.8.1/drivers/char/agp/i460-agp.c 2004-08-14 11:55:34.000000000 +0100
217 +++ linux-2.6.8.1-xen0/drivers/char/agp/i460-agp.c 2004-09-05 05:55:58.879494644 +0100
218 @@ -371,7 +371,7 @@
219 }
220 memset(lp->alloced_map, 0, map_size);
222 - lp->paddr = virt_to_phys(lpage);
223 + lp->paddr = virt_to_bus(lpage);
224 lp->refcount = 0;
225 atomic_add(I460_KPAGES_PER_IOPAGE, &agp_bridge->current_memory_agp);
226 return 0;
227 @@ -382,7 +382,7 @@
228 kfree(lp->alloced_map);
229 lp->alloced_map = NULL;
231 - free_pages((unsigned long) phys_to_virt(lp->paddr), I460_IO_PAGE_SHIFT - PAGE_SHIFT);
232 + free_pages((unsigned long) bus_to_virt(lp->paddr), I460_IO_PAGE_SHIFT - PAGE_SHIFT);
233 atomic_sub(I460_KPAGES_PER_IOPAGE, &agp_bridge->current_memory_agp);
234 }
236 --- linux-2.6.8.1/drivers/char/agp/intel-agp.c 2004-08-14 11:55:32.000000000 +0100
237 +++ linux-2.6.8.1-xen0/drivers/char/agp/intel-agp.c 2004-09-05 05:55:58.880494412 +0100
238 @@ -285,7 +285,7 @@
239 if (new == NULL)
240 return NULL;
242 - new->memory[0] = virt_to_phys(addr);
243 + new->memory[0] = virt_to_bus(addr);
244 if (pg_count == 4) {
245 /* kludge to get 4 physical pages for ARGB cursor */
246 new->memory[1] = new->memory[0] + PAGE_SIZE;
247 @@ -328,10 +328,10 @@
248 agp_free_key(curr->key);
249 if(curr->type == AGP_PHYS_MEMORY) {
250 if (curr->page_count == 4)
251 - i8xx_destroy_pages(phys_to_virt(curr->memory[0]));
252 + i8xx_destroy_pages(bus_to_virt(curr->memory[0]));
253 else
254 agp_bridge->driver->agp_destroy_page(
255 - phys_to_virt(curr->memory[0]));
256 + bus_to_virt(curr->memory[0]));
257 vfree(curr->memory);
258 }
259 kfree(curr);
260 --- linux-2.6.8.1/drivers/char/agp/intel-mch-agp.c 2004-08-14 11:54:49.000000000 +0100
261 +++ linux-2.6.8.1-xen0/drivers/char/agp/intel-mch-agp.c 2004-09-05 05:55:58.880494412 +0100
262 @@ -51,7 +51,7 @@
263 if (new == NULL)
264 return NULL;
266 - new->memory[0] = agp_bridge->driver->mask_memory(virt_to_phys(addr), type);
267 + new->memory[0] = agp_bridge->driver->mask_memory(virt_to_bus(addr), type);
268 new->page_count = 1;
269 new->num_scratch_pages = 1;
270 new->type = AGP_PHYS_MEMORY;
271 @@ -63,7 +63,7 @@
272 {
273 agp_free_key(curr->key);
274 if(curr->type == AGP_PHYS_MEMORY) {
275 - agp_bridge->driver->agp_destroy_page(phys_to_virt(curr->memory[0]));
276 + agp_bridge->driver->agp_destroy_page(bus_to_virt(curr->memory[0]));
277 vfree(curr->memory);
278 }
279 kfree(curr);
280 --- linux-2.6.8.1/drivers/char/agp/sworks-agp.c 2004-08-14 11:55:10.000000000 +0100
281 +++ linux-2.6.8.1-xen0/drivers/char/agp/sworks-agp.c 2004-09-05 05:55:58.881494180 +0100
282 @@ -51,7 +51,7 @@
283 }
284 SetPageReserved(virt_to_page(page_map->real));
285 global_cache_flush();
286 - page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real),
287 + page_map->remapped = ioremap_nocache(virt_to_bus(page_map->real),
288 PAGE_SIZE);
289 if (page_map->remapped == NULL) {
290 ClearPageReserved(virt_to_page(page_map->real));
291 @@ -164,7 +164,7 @@
292 for(i = 0; i < 1024; i++) {
293 serverworks_private.scratch_dir.remapped[i] = (unsigned long) agp_bridge->scratch_page;
294 page_dir.remapped[i] =
295 - virt_to_phys(serverworks_private.scratch_dir.real);
296 + virt_to_bus(serverworks_private.scratch_dir.real);
297 page_dir.remapped[i] |= 0x00000001;
298 }
300 @@ -177,7 +177,7 @@
302 agp_bridge->gatt_table_real = (u32 *)page_dir.real;
303 agp_bridge->gatt_table = (u32 *)page_dir.remapped;
304 - agp_bridge->gatt_bus_addr = virt_to_phys(page_dir.real);
305 + agp_bridge->gatt_bus_addr = virt_to_bus(page_dir.real);
307 /* Get the address for the gart region.
308 * This is a bus address even on the alpha, b/c its
309 @@ -191,7 +191,7 @@
311 for(i = 0; i < value->num_entries / 1024; i++) {
312 page_dir.remapped[i] =
313 - virt_to_phys(serverworks_private.gatt_pages[i]->real);
314 + virt_to_bus(serverworks_private.gatt_pages[i]->real);
315 page_dir.remapped[i] |= 0x00000001;
316 }
318 --- linux-2.6.8.1/drivers/char/agp/uninorth-agp.c 2004-08-14 11:55:32.000000000 +0100
319 +++ linux-2.6.8.1-xen0/drivers/char/agp/uninorth-agp.c 2004-09-05 05:55:58.881494180 +0100
320 @@ -200,7 +200,7 @@
322 agp_bridge->gatt_table_real = (u32 *) table;
323 agp_bridge->gatt_table = (u32 *)table;
324 - agp_bridge->gatt_bus_addr = virt_to_phys(table);
325 + agp_bridge->gatt_bus_addr = virt_to_bus(table);
327 for (i = 0; i < num_entries; i++) {
328 agp_bridge->gatt_table[i] =
329 --- linux-2.6.8.1/include/asm-i386/agp.h 2004-08-14 11:54:47.000000000 +0100
330 +++ linux-2.6.8.1-xen0/include/asm-i386/agp.h 2004-09-05 05:57:26.040268956 +0100
331 @@ -3,6 +3,7 @@
333 #include <asm/pgtable.h>
334 #include <asm/cacheflush.h>
335 +#include <asm/system.h>
337 /*
338 * Functions to keep the agpgart mappings coherent with the MMU.
339 @@ -19,6 +20,6 @@
340 /* Could use CLFLUSH here if the cpu supports it. But then it would
341 need to be called for each cacheline of the whole page so it may not be
342 worth it. Would need a page for it. */
343 -#define flush_agp_cache() asm volatile("wbinvd":::"memory")
344 +#define flush_agp_cache() wbinvd()
346 #endif