aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/ttm/ttm_memory.c
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2017-07-04 10:56:24 -0400
committerAlex Deucher <alexander.deucher@amd.com>2017-10-06 17:44:16 -0400
commitd188bfa5532ce5b426681d8530ff1a9683eea0ad (patch)
treee08c1118cde71094a9f014870e08f0889bf2f615 /drivers/gpu/drm/ttm/ttm_memory.c
parentf9ebec52b5f115a0b06cdabe3036b858bfbb588a (diff)
drm/ttm: add support for different pool sizes
Correctly handle different page sizes in the memory accounting. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/ttm/ttm_memory.c')
-rw-r--r--drivers/gpu/drm/ttm/ttm_memory.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_memory.c b/drivers/gpu/drm/ttm/ttm_memory.c
index 4f9978cbc5bc..e96374990398 100644
--- a/drivers/gpu/drm/ttm/ttm_memory.c
+++ b/drivers/gpu/drm/ttm/ttm_memory.c
@@ -546,7 +546,7 @@ int ttm_mem_global_alloc(struct ttm_mem_global *glob, uint64_t memory,
546EXPORT_SYMBOL(ttm_mem_global_alloc); 546EXPORT_SYMBOL(ttm_mem_global_alloc);
547 547
548int ttm_mem_global_alloc_page(struct ttm_mem_global *glob, 548int ttm_mem_global_alloc_page(struct ttm_mem_global *glob,
549 struct page *page) 549 struct page *page, uint64_t size)
550{ 550{
551 551
552 struct ttm_mem_zone *zone = NULL; 552 struct ttm_mem_zone *zone = NULL;
@@ -563,10 +563,11 @@ int ttm_mem_global_alloc_page(struct ttm_mem_global *glob,
563 if (glob->zone_dma32 && page_to_pfn(page) > 0x00100000UL) 563 if (glob->zone_dma32 && page_to_pfn(page) > 0x00100000UL)
564 zone = glob->zone_kernel; 564 zone = glob->zone_kernel;
565#endif 565#endif
566 return ttm_mem_global_alloc_zone(glob, zone, PAGE_SIZE, false, false); 566 return ttm_mem_global_alloc_zone(glob, zone, size, false, false);
567} 567}
568 568
569void ttm_mem_global_free_page(struct ttm_mem_global *glob, struct page *page) 569void ttm_mem_global_free_page(struct ttm_mem_global *glob, struct page *page,
570 uint64_t size)
570{ 571{
571 struct ttm_mem_zone *zone = NULL; 572 struct ttm_mem_zone *zone = NULL;
572 573
@@ -577,10 +578,9 @@ void ttm_mem_global_free_page(struct ttm_mem_global *glob, struct page *page)
577 if (glob->zone_dma32 && page_to_pfn(page) > 0x00100000UL) 578 if (glob->zone_dma32 && page_to_pfn(page) > 0x00100000UL)
578 zone = glob->zone_kernel; 579 zone = glob->zone_kernel;
579#endif 580#endif
580 ttm_mem_global_free_zone(glob, zone, PAGE_SIZE); 581 ttm_mem_global_free_zone(glob, zone, size);
581} 582}
582 583
583
584size_t ttm_round_pot(size_t size) 584size_t ttm_round_pot(size_t size)
585{ 585{
586 if ((size & (size - 1)) == 0) 586 if ((size & (size - 1)) == 0)