Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm...
[deliverable/linux.git] / drivers / gpu / drm / amd / amdgpu / amdgpu_device.c
index 51bfc114584ed5e2fcd086efed40b57f344d2c4f..2139da773da68d410f4310a321d73634166d89d2 100644 (file)
@@ -635,31 +635,6 @@ bool amdgpu_card_posted(struct amdgpu_device *adev)
 
 }
 
-/**
- * amdgpu_boot_test_post_card - check and possibly initialize the hw
- *
- * @adev: amdgpu_device pointer
- *
- * Check if the asic is initialized and if not, attempt to initialize
- * it (all asics).
- * Returns true if initialized or false if not.
- */
-bool amdgpu_boot_test_post_card(struct amdgpu_device *adev)
-{
-       if (amdgpu_card_posted(adev))
-               return true;
-
-       if (adev->bios) {
-               DRM_INFO("GPU not posted. posting now...\n");
-               if (adev->is_atom_bios)
-                       amdgpu_atom_asic_init(adev->mode_info.atom_context);
-               return true;
-       } else {
-               dev_err(adev->dev, "Card not posted and no BIOS - ignoring\n");
-               return false;
-       }
-}
-
 /**
  * amdgpu_dummy_page_init - init dummy page used by the driver
  *
@@ -959,12 +934,6 @@ static void amdgpu_check_arguments(struct amdgpu_device *adev)
                         amdgpu_sched_jobs);
                amdgpu_sched_jobs = roundup_pow_of_two(amdgpu_sched_jobs);
        }
-       /* vramlimit must be a power of two */
-       if (!amdgpu_check_pot_argument(amdgpu_vram_limit)) {
-               dev_warn(adev->dev, "vram limit (%d) must be a power of 2\n",
-                               amdgpu_vram_limit);
-               amdgpu_vram_limit = 0;
-       }
 
        if (amdgpu_gart_size != -1) {
                /* gtt size must be power of two and greater or equal to 32M */
@@ -1434,7 +1403,7 @@ int amdgpu_device_init(struct amdgpu_device *adev,
        adev->mman.buffer_funcs = NULL;
        adev->mman.buffer_funcs_ring = NULL;
        adev->vm_manager.vm_pte_funcs = NULL;
-       adev->vm_manager.vm_pte_funcs_ring = NULL;
+       adev->vm_manager.vm_pte_num_rings = 0;
        adev->gart.gart_funcs = NULL;
        adev->fence_context = fence_context_alloc(AMDGPU_MAX_RINGS);
 
@@ -1455,9 +1424,8 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 
        /* mutex initialization are all done here so we
         * can recall function without having locking issues */
-       mutex_init(&adev->ring_lock);
+       mutex_init(&adev->vm_manager.lock);
        atomic_set(&adev->irq.ih.lock, 0);
-       mutex_init(&adev->gem.mutex);
        mutex_init(&adev->pm.mutex);
        mutex_init(&adev->gfx.gpu_clock_mutex);
        mutex_init(&adev->srbm_mutex);
@@ -1531,8 +1499,13 @@ int amdgpu_device_init(struct amdgpu_device *adev,
                return r;
        }
 
+       /* See if the asic supports SR-IOV */
+       adev->virtualization.supports_sr_iov =
+               amdgpu_atombios_has_gpu_virtualization_table(adev);
+
        /* Post card if necessary */
-       if (!amdgpu_card_posted(adev)) {
+       if (!amdgpu_card_posted(adev) ||
+           adev->virtualization.supports_sr_iov) {
                if (!adev->bios) {
                        dev_err(adev->dev, "Card not posted and no BIOS - ignoring\n");
                        return -EINVAL;
@@ -1577,11 +1550,6 @@ int amdgpu_device_init(struct amdgpu_device *adev,
                return r;
        }
 
-       r = amdgpu_ctx_init(adev, AMD_SCHED_PRIORITY_KERNEL, &adev->kernel_ctx);
-       if (r) {
-               dev_err(adev->dev, "failed to create kernel context (%d).\n", r);
-               return r;
-       }
        r = amdgpu_ib_ring_tests(adev);
        if (r)
                DRM_ERROR("ib ring test failed (%d).\n", r);
@@ -1645,7 +1613,6 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
        adev->shutdown = true;
        /* evict vram memory */
        amdgpu_bo_evict_vram(adev);
-       amdgpu_ctx_fini(&adev->kernel_ctx);
        amdgpu_ib_pool_fini(adev);
        amdgpu_fence_driver_fini(adev);
        amdgpu_fbdev_fini(adev);
@@ -1894,6 +1861,9 @@ int amdgpu_gpu_reset(struct amdgpu_device *adev)
 
 retry:
        r = amdgpu_asic_reset(adev);
+       /* post card */
+       amdgpu_atom_asic_init(adev->mode_info.atom_context);
+
        if (!r) {
                dev_info(adev->dev, "GPU reset succeeded, trying to resume\n");
                r = amdgpu_resume(adev);
This page took 0.02989 seconds and 5 git commands to generate.