ARM: tegra: Put contiguous FBs into a linear map
Hiroshi Doyu [Wed, 28 Aug 2013 09:26:21 +0000 (12:26 +0300)]
Put contiguous FB areas into a sigle linear map to avoid gap pages
being inserted.

HACK: Till per device IOVA management is introduced.

Bug 1356760

Change-Id: I043fb0d20bd247e212728e01090bf8568a973dd9
Signed-off-by: Hiroshi Doyu <hdoyu@nvidia.com>
Reviewed-on: http://git-master/r/267297
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Krishna Reddy <vdumpa@nvidia.com>

arch/arm/mach-tegra/common.c
arch/arm/mach-tegra/devices.c

index b75d068..e8ba66b 100644 (file)
@@ -2099,10 +2099,10 @@ void __init tegra_reserve(unsigned long carveout_size, unsigned long fb_size,
 
        map[0].start = tegra_fb_start;
        map[0].size = tegra_fb_size;
-       map[1].start = tegra_bootloader_fb_start;
-       map[1].size = tegra_bootloader_fb_size;
-       map[2].start = tegra_fb2_start;
-       map[2].size = tegra_fb2_size;
+       map[1].start = tegra_fb2_start;
+       map[1].size = tegra_fb2_size;
+       map[2].start = tegra_bootloader_fb_start;
+       map[2].size = tegra_bootloader_fb_size;
        map[3].start = tegra_bootloader_fb2_start;
        map[3].size = tegra_bootloader_fb2_size;
 
index 6c4efb4..7e40e74 100644 (file)
@@ -2101,14 +2101,20 @@ void tegra_fb_linear_set(struct iommu_linear_map *map)
 {
        int i;
        struct iommu_linear_map *p = &tegra_fb_linear_map[0];
+       dma_addr_t prev_end = 0;
 
        for (i = 0; i < ARRAY_SIZE(tegra_fb_linear_map) - 1; i++) {
                if (!map->size)
                        continue;
 
-               p->start = map[i].start;
-               p->size = map[i].size;
-               p++;
+               p->size += map[i].size;
+               if (prev_end == map[i].start) {
+                       prev_end += p->size;
+               } else {
+                       p->start = map[i].start;
+                       prev_end = p->start + p->size;
+                       p++;
+               }
        }
 }