diff options
Diffstat (limited to 'drivers/gpu/drm/msm/msm_gpu.c')
-rw-r--r-- | drivers/gpu/drm/msm/msm_gpu.c | 42 |
1 files changed, 16 insertions, 26 deletions
diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c index 4583d61556f5..0cfe3f426ee4 100644 --- a/drivers/gpu/drm/msm/msm_gpu.c +++ b/drivers/gpu/drm/msm/msm_gpu.c | |||
@@ -17,6 +17,7 @@ | |||
17 | 17 | ||
18 | #include "msm_gpu.h" | 18 | #include "msm_gpu.h" |
19 | #include "msm_gem.h" | 19 | #include "msm_gem.h" |
20 | #include "msm_mmu.h" | ||
20 | 21 | ||
21 | 22 | ||
22 | /* | 23 | /* |
@@ -25,20 +26,10 @@ | |||
25 | 26 | ||
26 | #ifdef CONFIG_MSM_BUS_SCALING | 27 | #ifdef CONFIG_MSM_BUS_SCALING |
27 | #include <mach/board.h> | 28 | #include <mach/board.h> |
28 | #include <mach/kgsl.h> | 29 | static void bs_init(struct msm_gpu *gpu) |
29 | static void bs_init(struct msm_gpu *gpu, struct platform_device *pdev) | ||
30 | { | 30 | { |
31 | struct drm_device *dev = gpu->dev; | 31 | if (gpu->bus_scale_table) { |
32 | struct kgsl_device_platform_data *pdata; | 32 | gpu->bsc = msm_bus_scale_register_client(gpu->bus_scale_table); |
33 | |||
34 | if (!pdev) { | ||
35 | dev_err(dev->dev, "could not find dtv pdata\n"); | ||
36 | return; | ||
37 | } | ||
38 | |||
39 | pdata = pdev->dev.platform_data; | ||
40 | if (pdata->bus_scale_table) { | ||
41 | gpu->bsc = msm_bus_scale_register_client(pdata->bus_scale_table); | ||
42 | DBG("bus scale client: %08x", gpu->bsc); | 33 | DBG("bus scale client: %08x", gpu->bsc); |
43 | } | 34 | } |
44 | } | 35 | } |
@@ -59,7 +50,7 @@ static void bs_set(struct msm_gpu *gpu, int idx) | |||
59 | } | 50 | } |
60 | } | 51 | } |
61 | #else | 52 | #else |
62 | static void bs_init(struct msm_gpu *gpu, struct platform_device *pdev) {} | 53 | static void bs_init(struct msm_gpu *gpu) {} |
63 | static void bs_fini(struct msm_gpu *gpu) {} | 54 | static void bs_fini(struct msm_gpu *gpu) {} |
64 | static void bs_set(struct msm_gpu *gpu, int idx) {} | 55 | static void bs_set(struct msm_gpu *gpu, int idx) {} |
65 | #endif | 56 | #endif |
@@ -307,8 +298,6 @@ int msm_gpu_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit, | |||
307 | struct msm_drm_private *priv = dev->dev_private; | 298 | struct msm_drm_private *priv = dev->dev_private; |
308 | int i, ret; | 299 | int i, ret; |
309 | 300 | ||
310 | mutex_lock(&dev->struct_mutex); | ||
311 | |||
312 | submit->fence = ++priv->next_fence; | 301 | submit->fence = ++priv->next_fence; |
313 | 302 | ||
314 | gpu->submitted_fence = submit->fence; | 303 | gpu->submitted_fence = submit->fence; |
@@ -340,7 +329,6 @@ int msm_gpu_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit, | |||
340 | msm_gem_move_to_active(&msm_obj->base, gpu, true, submit->fence); | 329 | msm_gem_move_to_active(&msm_obj->base, gpu, true, submit->fence); |
341 | } | 330 | } |
342 | hangcheck_timer_reset(gpu); | 331 | hangcheck_timer_reset(gpu); |
343 | mutex_unlock(&dev->struct_mutex); | ||
344 | 332 | ||
345 | return ret; | 333 | return ret; |
346 | } | 334 | } |
@@ -363,6 +351,7 @@ int msm_gpu_init(struct drm_device *drm, struct platform_device *pdev, | |||
363 | struct msm_gpu *gpu, const struct msm_gpu_funcs *funcs, | 351 | struct msm_gpu *gpu, const struct msm_gpu_funcs *funcs, |
364 | const char *name, const char *ioname, const char *irqname, int ringsz) | 352 | const char *name, const char *ioname, const char *irqname, int ringsz) |
365 | { | 353 | { |
354 | struct iommu_domain *iommu; | ||
366 | int i, ret; | 355 | int i, ret; |
367 | 356 | ||
368 | gpu->dev = drm; | 357 | gpu->dev = drm; |
@@ -428,13 +417,14 @@ int msm_gpu_init(struct drm_device *drm, struct platform_device *pdev, | |||
428 | * and have separate page tables per context. For now, to keep things | 417 | * and have separate page tables per context. For now, to keep things |
429 | * simple and to get something working, just use a single address space: | 418 | * simple and to get something working, just use a single address space: |
430 | */ | 419 | */ |
431 | gpu->iommu = iommu_domain_alloc(&platform_bus_type); | 420 | iommu = iommu_domain_alloc(&platform_bus_type); |
432 | if (!gpu->iommu) { | 421 | if (iommu) { |
433 | dev_err(drm->dev, "failed to allocate IOMMU\n"); | 422 | dev_info(drm->dev, "%s: using IOMMU\n", name); |
434 | ret = -ENOMEM; | 423 | gpu->mmu = msm_iommu_new(drm, iommu); |
435 | goto fail; | 424 | } else { |
425 | dev_info(drm->dev, "%s: no IOMMU, fallback to VRAM carveout!\n", name); | ||
436 | } | 426 | } |
437 | gpu->id = msm_register_iommu(drm, gpu->iommu); | 427 | gpu->id = msm_register_mmu(drm, gpu->mmu); |
438 | 428 | ||
439 | /* Create ringbuffer: */ | 429 | /* Create ringbuffer: */ |
440 | gpu->rb = msm_ringbuffer_new(gpu, ringsz); | 430 | gpu->rb = msm_ringbuffer_new(gpu, ringsz); |
@@ -452,7 +442,7 @@ int msm_gpu_init(struct drm_device *drm, struct platform_device *pdev, | |||
452 | goto fail; | 442 | goto fail; |
453 | } | 443 | } |
454 | 444 | ||
455 | bs_init(gpu, pdev); | 445 | bs_init(gpu); |
456 | 446 | ||
457 | return 0; | 447 | return 0; |
458 | 448 | ||
@@ -474,6 +464,6 @@ void msm_gpu_cleanup(struct msm_gpu *gpu) | |||
474 | msm_ringbuffer_destroy(gpu->rb); | 464 | msm_ringbuffer_destroy(gpu->rb); |
475 | } | 465 | } |
476 | 466 | ||
477 | if (gpu->iommu) | 467 | if (gpu->mmu) |
478 | iommu_domain_free(gpu->iommu); | 468 | gpu->mmu->funcs->destroy(gpu->mmu); |
479 | } | 469 | } |