diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2012-01-06 09:38:15 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2012-01-09 07:10:09 -0500 |
commit | 67e915e49a12ee08c22cb1db746bafd909988f85 (patch) | |
tree | 6786118f5a2930e675e66a27e3cdc1a12c54b55a /drivers/gpu/drm/radeon | |
parent | cc1f71942944890c7e05fc55dc4427c94b63d4f1 (diff) |
drm/radeon/kms: check if vm is supported in VA ioctl
Add a VM manager enabled field and use it to check if
vm is enabled.
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: jglisse@redhat.com
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon.h | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_cs.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_gart.c | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_gem.c | 5 |
4 files changed, 18 insertions, 3 deletions
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 7cb63cd2e738..73e05cb85eca 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -668,6 +668,8 @@ struct radeon_vm_manager { | |||
668 | unsigned nvm; | 668 | unsigned nvm; |
669 | /* vram base address for page table entry */ | 669 | /* vram base address for page table entry */ |
670 | u64 vram_base_offset; | 670 | u64 vram_base_offset; |
671 | /* is vm enabled? */ | ||
672 | bool enabled; | ||
671 | }; | 673 | }; |
672 | 674 | ||
673 | /* | 675 | /* |
diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c index 17af0e83c328..435a3d970ab8 100644 --- a/drivers/gpu/drm/radeon/radeon_cs.c +++ b/drivers/gpu/drm/radeon/radeon_cs.c | |||
@@ -234,8 +234,8 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data) | |||
234 | } | 234 | } |
235 | 235 | ||
236 | if ((p->cs_flags & RADEON_CS_USE_VM) && | 236 | if ((p->cs_flags & RADEON_CS_USE_VM) && |
237 | (p->rdev->family < CHIP_CAYMAN)) { | 237 | !p->rdev->vm_manager.enabled) { |
238 | DRM_ERROR("VM not supported on asic!\n"); | 238 | DRM_ERROR("VM not active on asic!\n"); |
239 | if (p->chunk_relocs_idx != -1) | 239 | if (p->chunk_relocs_idx != -1) |
240 | kfree(p->chunks[p->chunk_relocs_idx].kdata); | 240 | kfree(p->chunks[p->chunk_relocs_idx].kdata); |
241 | if (p->chunk_flags_idx != -1) | 241 | if (p->chunk_flags_idx != -1) |
diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c index 3ef58cab18c9..8597d2c016e6 100644 --- a/drivers/gpu/drm/radeon/radeon_gart.c +++ b/drivers/gpu/drm/radeon/radeon_gart.c | |||
@@ -286,6 +286,8 @@ int radeon_vm_manager_init(struct radeon_device *rdev) | |||
286 | { | 286 | { |
287 | int r; | 287 | int r; |
288 | 288 | ||
289 | rdev->vm_manager.enabled = false; | ||
290 | |||
289 | /* mark first vm as always in use, it's the system one */ | 291 | /* mark first vm as always in use, it's the system one */ |
290 | r = radeon_sa_bo_manager_init(rdev, &rdev->vm_manager.sa_manager, | 292 | r = radeon_sa_bo_manager_init(rdev, &rdev->vm_manager.sa_manager, |
291 | rdev->vm_manager.max_pfn * 8, | 293 | rdev->vm_manager.max_pfn * 8, |
@@ -295,7 +297,12 @@ int radeon_vm_manager_init(struct radeon_device *rdev) | |||
295 | (rdev->vm_manager.max_pfn * 8) >> 10); | 297 | (rdev->vm_manager.max_pfn * 8) >> 10); |
296 | return r; | 298 | return r; |
297 | } | 299 | } |
298 | return rdev->vm_manager.funcs->init(rdev); | 300 | |
301 | r = rdev->vm_manager.funcs->init(rdev); | ||
302 | if (r == 0) | ||
303 | rdev->vm_manager.enabled = true; | ||
304 | |||
305 | return r; | ||
299 | } | 306 | } |
300 | 307 | ||
301 | /* cs mutex must be lock */ | 308 | /* cs mutex must be lock */ |
@@ -334,6 +341,7 @@ void radeon_vm_manager_fini(struct radeon_device *rdev) | |||
334 | radeon_vm_manager_suspend(rdev); | 341 | radeon_vm_manager_suspend(rdev); |
335 | rdev->vm_manager.funcs->fini(rdev); | 342 | rdev->vm_manager.funcs->fini(rdev); |
336 | radeon_sa_bo_manager_fini(rdev, &rdev->vm_manager.sa_manager); | 343 | radeon_sa_bo_manager_fini(rdev, &rdev->vm_manager.sa_manager); |
344 | rdev->vm_manager.enabled = false; | ||
337 | } | 345 | } |
338 | 346 | ||
339 | int radeon_vm_manager_start(struct radeon_device *rdev) | 347 | int radeon_vm_manager_start(struct radeon_device *rdev) |
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c index 003eeec1b688..7337850af2fa 100644 --- a/drivers/gpu/drm/radeon/radeon_gem.c +++ b/drivers/gpu/drm/radeon/radeon_gem.c | |||
@@ -404,6 +404,11 @@ int radeon_gem_va_ioctl(struct drm_device *dev, void *data, | |||
404 | u32 invalid_flags; | 404 | u32 invalid_flags; |
405 | int r = 0; | 405 | int r = 0; |
406 | 406 | ||
407 | if (!rdev->vm_manager.enabled) { | ||
408 | args->operation = RADEON_VA_RESULT_ERROR; | ||
409 | return -ENOTTY; | ||
410 | } | ||
411 | |||
407 | /* !! DONT REMOVE !! | 412 | /* !! DONT REMOVE !! |
408 | * We don't support vm_id yet, to be sure we don't have have broken | 413 | * We don't support vm_id yet, to be sure we don't have have broken |
409 | * userspace, reject anyone trying to use non 0 value thus moving | 414 | * userspace, reject anyone trying to use non 0 value thus moving |