drm: add func to get max iomem address v2
authorChunming Zhou <david1.zhou@amd.com>
Fri, 9 Feb 2018 02:44:08 +0000 (10:44 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 13 Feb 2018 16:57:59 +0000 (11:57 -0500)
it will be used to check if the driver needs swiotlb
v2: Don't use inline, instead, move function to drm_memory.c (Michel Daenzer <michel@daenzer.net>)

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Monk Liu <monk.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180209024410.1469-1-david1.zhou@amd.com
drivers/gpu/drm/drm_memory.c
include/drm/drm_cache.h

index fc0ebd273ef827d140993fda0ac8e2650c19632e..7ca500b8c399518fc0e4a01898a7ab75ddd47967 100644 (file)
@@ -149,3 +149,16 @@ void drm_legacy_ioremapfree(struct drm_local_map *map, struct drm_device *dev)
                iounmap(map->handle);
 }
 EXPORT_SYMBOL(drm_legacy_ioremapfree);
+
+u64 drm_get_max_iomem(void)
+{
+       struct resource *tmp;
+       u64 max_iomem = 0;
+
+       for (tmp = iomem_resource.child; tmp; tmp = tmp->sibling) {
+               max_iomem = max(max_iomem,  tmp->end);
+       }
+
+       return max_iomem;
+}
+EXPORT_SYMBOL(drm_get_max_iomem);
index beab0f0d0cfba9f5310b4dafbe09862e2dd25054..bfe1639df02da3a705a0c9c588336b0068713d7f 100644 (file)
@@ -38,6 +38,8 @@
 void drm_clflush_pages(struct page *pages[], unsigned long num_pages);
 void drm_clflush_sg(struct sg_table *st);
 void drm_clflush_virt_range(void *addr, unsigned long length);
+u64 drm_get_max_iomem(void);
+
 
 static inline bool drm_arch_can_wc_memory(void)
 {