History

drm/ttm: fix DMA32 handling in the global page pool

When we have mixed DMA32 and non DMA32 device in one system it could otherwise happen that the DMA32 device gets pages it can't work with.

Christian König committed 5 years ago

Commit 3e3e59e1 parent 295992f1 file · +22 −0Browse files

Unified · Split

drivers/gpu/drm/ttm/ttm_pool.c+22−0
@@ -63,6 +63,9 @@ static atomic_long_t allocated_pages; · 62 unmodified lines
6363 static struct ttm_pool_type global_write_combined[MAX_ORDER];
6464 static struct ttm_pool_type global_uncached[MAX_ORDER];
6565
66+static struct ttm_pool_type global_dma32_write_combined[MAX_ORDER];
67+static struct ttm_pool_type global_dma32_uncached[MAX_ORDER];
68+
6669 static spinlock_t shrinker_lock;
6770 static struct list_head shrinker_list;
6871 static struct shrinker mm_shrinker;
@@ -290,8 +293,14 @@ static struct ttm_pool_type *ttm_pool_select_type(struct ttm_pool *pool, · 221 unmodified lines
290293 #ifdef CONFIG_X86
291294 switch (caching) {
292295 case ttm_write_combined:
296+ if (pool->use_dma32)
297+ return &global_dma32_write_combined[order];
298+
293299 return &global_write_combined[order];
294300 case ttm_uncached:
301+ if (pool->use_dma32)
302+ return &global_dma32_uncached[order];
303+
295304 return &global_uncached[order];
296305 default:
297306 break;
@@ -570,6 +579,11 @@ int ttm_pool_debugfs(struct ttm_pool *pool, struct seq_file *m) · 272 unmodified lines
570579 seq_puts(m, "uc\t:");
571580 ttm_pool_debugfs_orders(global_uncached, m);
572581
582+ seq_puts(m, "wc 32\t:");
583+ ttm_pool_debugfs_orders(global_dma32_write_combined, m);
584+ seq_puts(m, "uc 32\t:");
585+ ttm_pool_debugfs_orders(global_dma32_uncached, m);
586+
573587 for (i = 0; i < TTM_NUM_CACHING_TYPES; ++i) {
574588 seq_puts(m, "DMA ");
575589 switch (i) {
@@ -640,6 +654,11 @@ int ttm_pool_mgr_init(unsigned long num_pages) · 64 unmodified lines
640654 ttm_pool_type_init(&global_write_combined[i], NULL,
641655 ttm_write_combined, i);
642656 ttm_pool_type_init(&global_uncached[i], NULL, ttm_uncached, i);
657+
658+ ttm_pool_type_init(&global_dma32_write_combined[i], NULL,
659+ ttm_write_combined, i);
660+ ttm_pool_type_init(&global_dma32_uncached[i], NULL,
661+ ttm_uncached, i);
643662 }
644663
645664 mm_shrinker.count_objects = ttm_pool_shrinker_count;
@@ -660,6 +679,9 @@ void ttm_pool_mgr_fini(void) · 14 unmodified lines
660679 for (i = 0; i < MAX_ORDER; ++i) {
661680 ttm_pool_type_fini(&global_write_combined[i]);
662681 ttm_pool_type_fini(&global_uncached[i]);
682+
683+ ttm_pool_type_fini(&global_dma32_write_combined[i]);
684+ ttm_pool_type_fini(&global_dma32_uncached[i]);
663685 }
664686
665687 unregister_shrinker(&mm_shrinker);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t