diff options
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_bo.c | 11 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_ttm.c | 13 | ||||
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_bo.c | 22 | ||||
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_bo_util.c | 19 | ||||
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c | 6 | ||||
-rw-r--r-- | include/drm/ttm/ttm_bo_driver.h | 12 |
6 files changed, 5 insertions, 78 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 288c2ecd937a..34be1924218f 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c | |||
@@ -390,13 +390,6 @@ nouveau_bo_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, | |||
390 | man->available_caching = TTM_PL_FLAG_UNCACHED | | 390 | man->available_caching = TTM_PL_FLAG_UNCACHED | |
391 | TTM_PL_FLAG_WC; | 391 | TTM_PL_FLAG_WC; |
392 | man->default_caching = TTM_PL_FLAG_WC; | 392 | man->default_caching = TTM_PL_FLAG_WC; |
393 | |||
394 | man->io_addr = NULL; | ||
395 | man->io_offset = drm_get_resource_start(dev, 1); | ||
396 | man->io_size = drm_get_resource_len(dev, 1); | ||
397 | if (man->io_size > nouveau_mem_fb_amount(dev)) | ||
398 | man->io_size = nouveau_mem_fb_amount(dev); | ||
399 | |||
400 | man->gpu_offset = dev_priv->vm_vram_base; | 393 | man->gpu_offset = dev_priv->vm_vram_base; |
401 | break; | 394 | break; |
402 | case TTM_PL_TT: | 395 | case TTM_PL_TT: |
@@ -417,10 +410,6 @@ nouveau_bo_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, | |||
417 | dev_priv->gart_info.type); | 410 | dev_priv->gart_info.type); |
418 | return -EINVAL; | 411 | return -EINVAL; |
419 | } | 412 | } |
420 | |||
421 | man->io_offset = dev_priv->gart_info.aper_base; | ||
422 | man->io_size = dev_priv->gart_info.aper_size; | ||
423 | man->io_addr = NULL; | ||
424 | man->gpu_offset = dev_priv->vm_gart_base; | 413 | man->gpu_offset = dev_priv->vm_gart_base; |
425 | break; | 414 | break; |
426 | default: | 415 | default: |
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index 62b4b800e0a3..91030eab22b0 100644 --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c | |||
@@ -161,21 +161,13 @@ static int radeon_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, | |||
161 | (unsigned)type); | 161 | (unsigned)type); |
162 | return -EINVAL; | 162 | return -EINVAL; |
163 | } | 163 | } |
164 | man->io_offset = rdev->mc.agp_base; | ||
165 | man->io_size = rdev->mc.gtt_size; | ||
166 | man->io_addr = NULL; | ||
167 | if (!rdev->ddev->agp->cant_use_aperture) | 164 | if (!rdev->ddev->agp->cant_use_aperture) |
168 | man->flags = TTM_MEMTYPE_FLAG_MAPPABLE; | 165 | man->flags = TTM_MEMTYPE_FLAG_MAPPABLE; |
169 | man->available_caching = TTM_PL_FLAG_UNCACHED | | 166 | man->available_caching = TTM_PL_FLAG_UNCACHED | |
170 | TTM_PL_FLAG_WC; | 167 | TTM_PL_FLAG_WC; |
171 | man->default_caching = TTM_PL_FLAG_WC; | 168 | man->default_caching = TTM_PL_FLAG_WC; |
172 | } else | ||
173 | #endif | ||
174 | { | ||
175 | man->io_offset = 0; | ||
176 | man->io_size = 0; | ||
177 | man->io_addr = NULL; | ||
178 | } | 169 | } |
170 | #endif | ||
179 | break; | 171 | break; |
180 | case TTM_PL_VRAM: | 172 | case TTM_PL_VRAM: |
181 | /* "On-card" video ram */ | 173 | /* "On-card" video ram */ |
@@ -184,9 +176,6 @@ static int radeon_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, | |||
184 | TTM_MEMTYPE_FLAG_MAPPABLE; | 176 | TTM_MEMTYPE_FLAG_MAPPABLE; |
185 | man->available_caching = TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_WC; | 177 | man->available_caching = TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_WC; |
186 | man->default_caching = TTM_PL_FLAG_WC; | 178 | man->default_caching = TTM_PL_FLAG_WC; |
187 | man->io_addr = NULL; | ||
188 | man->io_offset = rdev->mc.aper_base; | ||
189 | man->io_size = rdev->mc.aper_size; | ||
190 | break; | 179 | break; |
191 | default: | 180 | default: |
192 | DRM_ERROR("Unsupported memory type %u\n", (unsigned)type); | 181 | DRM_ERROR("Unsupported memory type %u\n", (unsigned)type); |
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index b42e3fae1bd5..3b5b094b1397 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c | |||
@@ -79,8 +79,6 @@ static void ttm_mem_type_debug(struct ttm_bo_device *bdev, int mem_type) | |||
79 | printk(KERN_ERR TTM_PFX " use_type: %d\n", man->use_type); | 79 | printk(KERN_ERR TTM_PFX " use_type: %d\n", man->use_type); |
80 | printk(KERN_ERR TTM_PFX " flags: 0x%08X\n", man->flags); | 80 | printk(KERN_ERR TTM_PFX " flags: 0x%08X\n", man->flags); |
81 | printk(KERN_ERR TTM_PFX " gpu_offset: 0x%08lX\n", man->gpu_offset); | 81 | printk(KERN_ERR TTM_PFX " gpu_offset: 0x%08lX\n", man->gpu_offset); |
82 | printk(KERN_ERR TTM_PFX " io_offset: 0x%08lX\n", man->io_offset); | ||
83 | printk(KERN_ERR TTM_PFX " io_size: %ld\n", man->io_size); | ||
84 | printk(KERN_ERR TTM_PFX " size: %llu\n", man->size); | 82 | printk(KERN_ERR TTM_PFX " size: %llu\n", man->size); |
85 | printk(KERN_ERR TTM_PFX " available_caching: 0x%08X\n", | 83 | printk(KERN_ERR TTM_PFX " available_caching: 0x%08X\n", |
86 | man->available_caching); | 84 | man->available_caching); |
@@ -1563,26 +1561,6 @@ bool ttm_mem_reg_is_pci(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem) | |||
1563 | return true; | 1561 | return true; |
1564 | } | 1562 | } |
1565 | 1563 | ||
1566 | int ttm_bo_pci_offset(struct ttm_bo_device *bdev, | ||
1567 | struct ttm_mem_reg *mem, | ||
1568 | unsigned long *bus_base, | ||
1569 | unsigned long *bus_offset, unsigned long *bus_size) | ||
1570 | { | ||
1571 | struct ttm_mem_type_manager *man = &bdev->man[mem->mem_type]; | ||
1572 | |||
1573 | *bus_size = 0; | ||
1574 | if (!(man->flags & TTM_MEMTYPE_FLAG_MAPPABLE)) | ||
1575 | return -EINVAL; | ||
1576 | |||
1577 | if (ttm_mem_reg_is_pci(bdev, mem)) { | ||
1578 | *bus_offset = mem->mm_node->start << PAGE_SHIFT; | ||
1579 | *bus_size = mem->num_pages << PAGE_SHIFT; | ||
1580 | *bus_base = man->io_offset + (uintptr_t)man->io_addr; | ||
1581 | } | ||
1582 | |||
1583 | return 0; | ||
1584 | } | ||
1585 | |||
1586 | void ttm_bo_unmap_virtual(struct ttm_buffer_object *bo) | 1564 | void ttm_bo_unmap_virtual(struct ttm_buffer_object *bo) |
1587 | { | 1565 | { |
1588 | struct ttm_bo_device *bdev = bo->bdev; | 1566 | struct ttm_bo_device *bdev = bo->bdev; |
diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c index d58eeb5ed22b..333b401ca4c9 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_util.c +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c | |||
@@ -83,24 +83,13 @@ EXPORT_SYMBOL(ttm_bo_move_ttm); | |||
83 | 83 | ||
84 | int ttm_mem_io_reserve(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem) | 84 | int ttm_mem_io_reserve(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem) |
85 | { | 85 | { |
86 | struct ttm_mem_type_manager *man = &bdev->man[mem->mem_type]; | ||
87 | int ret; | 86 | int ret; |
88 | 87 | ||
89 | if (bdev->driver->io_mem_reserve) { | 88 | if (!mem->bus.io_reserved) { |
90 | if (!mem->bus.io_reserved) { | 89 | mem->bus.io_reserved = true; |
91 | mem->bus.io_reserved = true; | 90 | ret = bdev->driver->io_mem_reserve(bdev, mem); |
92 | ret = bdev->driver->io_mem_reserve(bdev, mem); | ||
93 | if (unlikely(ret != 0)) | ||
94 | return ret; | ||
95 | } | ||
96 | } else { | ||
97 | ret = ttm_bo_pci_offset(bdev, mem, &mem->bus.base, &mem->bus.offset, &mem->bus.size); | ||
98 | if (unlikely(ret != 0)) | 91 | if (unlikely(ret != 0)) |
99 | return ret; | 92 | return ret; |
100 | mem->bus.addr = NULL; | ||
101 | if (!(man->flags & TTM_MEMTYPE_FLAG_NEEDS_IOREMAP)) | ||
102 | mem->bus.addr = (void *)(((u8 *)man->io_addr) + mem->bus.offset); | ||
103 | mem->bus.is_iomem = (mem->bus.size > 0) ? 1 : 0; | ||
104 | } | 93 | } |
105 | return 0; | 94 | return 0; |
106 | } | 95 | } |
@@ -149,7 +138,7 @@ void ttm_mem_reg_iounmap(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem, | |||
149 | 138 | ||
150 | man = &bdev->man[mem->mem_type]; | 139 | man = &bdev->man[mem->mem_type]; |
151 | 140 | ||
152 | if (virtual && (man->flags & TTM_MEMTYPE_FLAG_NEEDS_IOREMAP || mem->bus.addr == NULL)) | 141 | if (virtual && mem->bus.addr == NULL) |
153 | iounmap(virtual); | 142 | iounmap(virtual); |
154 | ttm_mem_io_free(bdev, mem); | 143 | ttm_mem_io_free(bdev, mem); |
155 | } | 144 | } |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c b/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c index f3558968fdff..c4f5114aee7c 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c | |||
@@ -137,9 +137,6 @@ int vmw_invalidate_caches(struct ttm_bo_device *bdev, uint32_t flags) | |||
137 | int vmw_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, | 137 | int vmw_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, |
138 | struct ttm_mem_type_manager *man) | 138 | struct ttm_mem_type_manager *man) |
139 | { | 139 | { |
140 | struct vmw_private *dev_priv = | ||
141 | container_of(bdev, struct vmw_private, bdev); | ||
142 | |||
143 | switch (type) { | 140 | switch (type) { |
144 | case TTM_PL_SYSTEM: | 141 | case TTM_PL_SYSTEM: |
145 | /* System memory */ | 142 | /* System memory */ |
@@ -151,10 +148,7 @@ int vmw_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, | |||
151 | case TTM_PL_VRAM: | 148 | case TTM_PL_VRAM: |
152 | /* "On-card" video ram */ | 149 | /* "On-card" video ram */ |
153 | man->gpu_offset = 0; | 150 | man->gpu_offset = 0; |
154 | man->io_offset = dev_priv->vram_start; | ||
155 | man->io_size = dev_priv->vram_size; | ||
156 | man->flags = TTM_MEMTYPE_FLAG_FIXED | TTM_MEMTYPE_FLAG_MAPPABLE; | 151 | man->flags = TTM_MEMTYPE_FLAG_FIXED | TTM_MEMTYPE_FLAG_MAPPABLE; |
157 | man->io_addr = NULL; | ||
158 | man->available_caching = TTM_PL_MASK_CACHING; | 152 | man->available_caching = TTM_PL_MASK_CACHING; |
159 | man->default_caching = TTM_PL_FLAG_WC; | 153 | man->default_caching = TTM_PL_FLAG_WC; |
160 | break; | 154 | break; |
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h index da39865d67d8..7720b1787e23 100644 --- a/include/drm/ttm/ttm_bo_driver.h +++ b/include/drm/ttm/ttm_bo_driver.h | |||
@@ -176,8 +176,6 @@ struct ttm_tt { | |||
176 | 176 | ||
177 | #define TTM_MEMTYPE_FLAG_FIXED (1 << 0) /* Fixed (on-card) PCI memory */ | 177 | #define TTM_MEMTYPE_FLAG_FIXED (1 << 0) /* Fixed (on-card) PCI memory */ |
178 | #define TTM_MEMTYPE_FLAG_MAPPABLE (1 << 1) /* Memory mappable */ | 178 | #define TTM_MEMTYPE_FLAG_MAPPABLE (1 << 1) /* Memory mappable */ |
179 | #define TTM_MEMTYPE_FLAG_NEEDS_IOREMAP (1 << 2) /* Fixed memory needs ioremap | ||
180 | before kernel access. */ | ||
181 | #define TTM_MEMTYPE_FLAG_CMA (1 << 3) /* Can't map aperture */ | 179 | #define TTM_MEMTYPE_FLAG_CMA (1 << 3) /* Can't map aperture */ |
182 | 180 | ||
183 | /** | 181 | /** |
@@ -189,13 +187,6 @@ struct ttm_tt { | |||
189 | * managed by this memory type. | 187 | * managed by this memory type. |
190 | * @gpu_offset: If used, the GPU offset of the first managed page of | 188 | * @gpu_offset: If used, the GPU offset of the first managed page of |
191 | * fixed memory or the first managed location in an aperture. | 189 | * fixed memory or the first managed location in an aperture. |
192 | * @io_offset: The io_offset of the first managed page of IO memory or | ||
193 | * the first managed location in an aperture. For TTM_MEMTYPE_FLAG_CMA | ||
194 | * memory, this should be set to NULL. | ||
195 | * @io_size: The size of a managed IO region (fixed memory or aperture). | ||
196 | * @io_addr: Virtual kernel address if the io region is pre-mapped. For | ||
197 | * TTM_MEMTYPE_FLAG_NEEDS_IOREMAP there is no pre-mapped io map and | ||
198 | * @io_addr should be set to NULL. | ||
199 | * @size: Size of the managed region. | 190 | * @size: Size of the managed region. |
200 | * @available_caching: A mask of available caching types, TTM_PL_FLAG_XX, | 191 | * @available_caching: A mask of available caching types, TTM_PL_FLAG_XX, |
201 | * as defined in ttm_placement_common.h | 192 | * as defined in ttm_placement_common.h |
@@ -221,9 +212,6 @@ struct ttm_mem_type_manager { | |||
221 | bool use_type; | 212 | bool use_type; |
222 | uint32_t flags; | 213 | uint32_t flags; |
223 | unsigned long gpu_offset; | 214 | unsigned long gpu_offset; |
224 | unsigned long io_offset; | ||
225 | unsigned long io_size; | ||
226 | void *io_addr; | ||
227 | uint64_t size; | 215 | uint64_t size; |
228 | uint32_t available_caching; | 216 | uint32_t available_caching; |
229 | uint32_t default_caching; | 217 | uint32_t default_caching; |