diff options
author | Andres Rodriguez <andresx7@gmail.com> | 2017-04-04 17:18:28 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-05-31 16:48:57 -0400 |
commit | de65513af1124b28f2a858bc19b71a54dd93824e (patch) | |
tree | 1ae7ec152cfeb244704fe5bbc434a1b6822cbf16 /drivers/gpu | |
parent | e33fec4835b9d2b1f8f8b1eb7c3415ab75a0faf5 (diff) |
drm/amdgpu: remove hardcoded queue_mask in PACKET3_SET_RESOURCES
The assumption that we are only using the first pipe no longer holds.
Instead, calculate the queue_mask from the queue_bitmap.
Acked-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Andres Rodriguez <andresx7@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 20 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 20 |
2 files changed, 36 insertions, 4 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c index 65c45ae67157..bd0b2310f1d9 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | |||
@@ -4734,8 +4734,24 @@ static int gfx_v8_0_kiq_kcq_enable(struct amdgpu_device *adev) | |||
4734 | { | 4734 | { |
4735 | struct amdgpu_ring *kiq_ring = &adev->gfx.kiq.ring; | 4735 | struct amdgpu_ring *kiq_ring = &adev->gfx.kiq.ring; |
4736 | uint32_t scratch, tmp = 0; | 4736 | uint32_t scratch, tmp = 0; |
4737 | uint64_t queue_mask = 0; | ||
4737 | int r, i; | 4738 | int r, i; |
4738 | 4739 | ||
4740 | for (i = 0; i < AMDGPU_MAX_COMPUTE_QUEUES; ++i) { | ||
4741 | if (!test_bit(i, adev->gfx.mec.queue_bitmap)) | ||
4742 | continue; | ||
4743 | |||
4744 | /* This situation may be hit in the future if a new HW | ||
4745 | * generation exposes more than 64 queues. If so, the | ||
4746 | * definition of queue_mask needs updating */ | ||
4747 | if (WARN_ON(i > (sizeof(queue_mask)*8))) { | ||
4748 | DRM_ERROR("Invalid KCQ enabled: %d\n", i); | ||
4749 | break; | ||
4750 | } | ||
4751 | |||
4752 | queue_mask |= (1ull << i); | ||
4753 | } | ||
4754 | |||
4739 | r = amdgpu_gfx_scratch_get(adev, &scratch); | 4755 | r = amdgpu_gfx_scratch_get(adev, &scratch); |
4740 | if (r) { | 4756 | if (r) { |
4741 | DRM_ERROR("Failed to get scratch reg (%d).\n", r); | 4757 | DRM_ERROR("Failed to get scratch reg (%d).\n", r); |
@@ -4752,8 +4768,8 @@ static int gfx_v8_0_kiq_kcq_enable(struct amdgpu_device *adev) | |||
4752 | /* set resources */ | 4768 | /* set resources */ |
4753 | amdgpu_ring_write(kiq_ring, PACKET3(PACKET3_SET_RESOURCES, 6)); | 4769 | amdgpu_ring_write(kiq_ring, PACKET3(PACKET3_SET_RESOURCES, 6)); |
4754 | amdgpu_ring_write(kiq_ring, 0); /* vmid_mask:0 queue_type:0 (KIQ) */ | 4770 | amdgpu_ring_write(kiq_ring, 0); /* vmid_mask:0 queue_type:0 (KIQ) */ |
4755 | amdgpu_ring_write(kiq_ring, 0x000000FF); /* queue mask lo */ | 4771 | amdgpu_ring_write(kiq_ring, lower_32_bits(queue_mask)); /* queue mask lo */ |
4756 | amdgpu_ring_write(kiq_ring, 0); /* queue mask hi */ | 4772 | amdgpu_ring_write(kiq_ring, upper_32_bits(queue_mask)); /* queue mask hi */ |
4757 | amdgpu_ring_write(kiq_ring, 0); /* gws mask lo */ | 4773 | amdgpu_ring_write(kiq_ring, 0); /* gws mask lo */ |
4758 | amdgpu_ring_write(kiq_ring, 0); /* gws mask hi */ | 4774 | amdgpu_ring_write(kiq_ring, 0); /* gws mask hi */ |
4759 | amdgpu_ring_write(kiq_ring, 0); /* oac mask */ | 4775 | amdgpu_ring_write(kiq_ring, 0); /* oac mask */ |
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c index db1d50e45985..155a13911023 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | |||
@@ -2608,8 +2608,24 @@ static int gfx_v9_0_kiq_kcq_enable(struct amdgpu_device *adev) | |||
2608 | { | 2608 | { |
2609 | struct amdgpu_ring *kiq_ring = &adev->gfx.kiq.ring; | 2609 | struct amdgpu_ring *kiq_ring = &adev->gfx.kiq.ring; |
2610 | uint32_t scratch, tmp = 0; | 2610 | uint32_t scratch, tmp = 0; |
2611 | uint64_t queue_mask = 0; | ||
2611 | int r, i; | 2612 | int r, i; |
2612 | 2613 | ||
2614 | for (i = 0; i < AMDGPU_MAX_COMPUTE_QUEUES; ++i) { | ||
2615 | if (!test_bit(i, adev->gfx.mec.queue_bitmap)) | ||
2616 | continue; | ||
2617 | |||
2618 | /* This situation may be hit in the future if a new HW | ||
2619 | * generation exposes more than 64 queues. If so, the | ||
2620 | * definition of queue_mask needs updating */ | ||
2621 | if (WARN_ON(i > (sizeof(queue_mask)*8))) { | ||
2622 | DRM_ERROR("Invalid KCQ enabled: %d\n", i); | ||
2623 | break; | ||
2624 | } | ||
2625 | |||
2626 | queue_mask |= (1ull << i); | ||
2627 | } | ||
2628 | |||
2613 | r = amdgpu_gfx_scratch_get(adev, &scratch); | 2629 | r = amdgpu_gfx_scratch_get(adev, &scratch); |
2614 | if (r) { | 2630 | if (r) { |
2615 | DRM_ERROR("Failed to get scratch reg (%d).\n", r); | 2631 | DRM_ERROR("Failed to get scratch reg (%d).\n", r); |
@@ -2628,8 +2644,8 @@ static int gfx_v9_0_kiq_kcq_enable(struct amdgpu_device *adev) | |||
2628 | amdgpu_ring_write(kiq_ring, PACKET3(PACKET3_SET_RESOURCES, 6)); | 2644 | amdgpu_ring_write(kiq_ring, PACKET3(PACKET3_SET_RESOURCES, 6)); |
2629 | amdgpu_ring_write(kiq_ring, PACKET3_SET_RESOURCES_VMID_MASK(0) | | 2645 | amdgpu_ring_write(kiq_ring, PACKET3_SET_RESOURCES_VMID_MASK(0) | |
2630 | PACKET3_SET_RESOURCES_QUEUE_TYPE(0)); /* vmid_mask:0 queue_type:0 (KIQ) */ | 2646 | PACKET3_SET_RESOURCES_QUEUE_TYPE(0)); /* vmid_mask:0 queue_type:0 (KIQ) */ |
2631 | amdgpu_ring_write(kiq_ring, 0x000000FF); /* queue mask lo */ | 2647 | amdgpu_ring_write(kiq_ring, lower_32_bits(queue_mask)); /* queue mask lo */ |
2632 | amdgpu_ring_write(kiq_ring, 0); /* queue mask hi */ | 2648 | amdgpu_ring_write(kiq_ring, upper_32_bits(queue_mask)); /* queue mask hi */ |
2633 | amdgpu_ring_write(kiq_ring, 0); /* gws mask lo */ | 2649 | amdgpu_ring_write(kiq_ring, 0); /* gws mask lo */ |
2634 | amdgpu_ring_write(kiq_ring, 0); /* gws mask hi */ | 2650 | amdgpu_ring_write(kiq_ring, 0); /* gws mask hi */ |
2635 | amdgpu_ring_write(kiq_ring, 0); /* oac mask */ | 2651 | amdgpu_ring_write(kiq_ring, 0); /* oac mask */ |