diff options
author | Andrew Lewycky <Andrew.Lewycky@amd.com> | 2013-11-13 15:54:17 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2013-11-15 15:56:22 -0500 |
commit | d5754ab8f9b0f36ab3d6825a3555db48f28145d4 (patch) | |
tree | 0c942f43eacfaee5c1b56ea0c5330cfa790f738a /drivers/gpu/drm/radeon/cik.c | |
parent | 4cc948b94a222c310ae089c36718aac7a03aec90 (diff) |
drm/radeon: use a single doorbell for cik kms compute
A single doorbell page is plenty for cik kms compute.
Use a single page and manage doorbell allocation by
individual doorbells rather than pages. Identify
doorbells by their index rather than byte offset.
Signed-off-by: Andrew Lewycky <Andrew.Lewycky@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/cik.c')
-rw-r--r-- | drivers/gpu/drm/radeon/cik.c | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c index c1698978a8f1..08aa58ef8d0a 100644 --- a/drivers/gpu/drm/radeon/cik.c +++ b/drivers/gpu/drm/radeon/cik.c | |||
@@ -1560,17 +1560,17 @@ u32 cik_get_xclk(struct radeon_device *rdev) | |||
1560 | * cik_mm_rdoorbell - read a doorbell dword | 1560 | * cik_mm_rdoorbell - read a doorbell dword |
1561 | * | 1561 | * |
1562 | * @rdev: radeon_device pointer | 1562 | * @rdev: radeon_device pointer |
1563 | * @offset: byte offset into the aperture | 1563 | * @index: doorbell index |
1564 | * | 1564 | * |
1565 | * Returns the value in the doorbell aperture at the | 1565 | * Returns the value in the doorbell aperture at the |
1566 | * requested offset (CIK). | 1566 | * requested doorbell index (CIK). |
1567 | */ | 1567 | */ |
1568 | u32 cik_mm_rdoorbell(struct radeon_device *rdev, u32 offset) | 1568 | u32 cik_mm_rdoorbell(struct radeon_device *rdev, u32 index) |
1569 | { | 1569 | { |
1570 | if (offset < rdev->doorbell.size) { | 1570 | if (index < rdev->doorbell.num_doorbells) { |
1571 | return readl(((void __iomem *)rdev->doorbell.ptr) + offset); | 1571 | return readl(rdev->doorbell.ptr + index); |
1572 | } else { | 1572 | } else { |
1573 | DRM_ERROR("reading beyond doorbell aperture: 0x%08x!\n", offset); | 1573 | DRM_ERROR("reading beyond doorbell aperture: 0x%08x!\n", index); |
1574 | return 0; | 1574 | return 0; |
1575 | } | 1575 | } |
1576 | } | 1576 | } |
@@ -1579,18 +1579,18 @@ u32 cik_mm_rdoorbell(struct radeon_device *rdev, u32 offset) | |||
1579 | * cik_mm_wdoorbell - write a doorbell dword | 1579 | * cik_mm_wdoorbell - write a doorbell dword |
1580 | * | 1580 | * |
1581 | * @rdev: radeon_device pointer | 1581 | * @rdev: radeon_device pointer |
1582 | * @offset: byte offset into the aperture | 1582 | * @index: doorbell index |
1583 | * @v: value to write | 1583 | * @v: value to write |
1584 | * | 1584 | * |
1585 | * Writes @v to the doorbell aperture at the | 1585 | * Writes @v to the doorbell aperture at the |
1586 | * requested offset (CIK). | 1586 | * requested doorbell index (CIK). |
1587 | */ | 1587 | */ |
1588 | void cik_mm_wdoorbell(struct radeon_device *rdev, u32 offset, u32 v) | 1588 | void cik_mm_wdoorbell(struct radeon_device *rdev, u32 index, u32 v) |
1589 | { | 1589 | { |
1590 | if (offset < rdev->doorbell.size) { | 1590 | if (index < rdev->doorbell.num_doorbells) { |
1591 | writel(v, ((void __iomem *)rdev->doorbell.ptr) + offset); | 1591 | writel(v, rdev->doorbell.ptr + index); |
1592 | } else { | 1592 | } else { |
1593 | DRM_ERROR("writing beyond doorbell aperture: 0x%08x!\n", offset); | 1593 | DRM_ERROR("writing beyond doorbell aperture: 0x%08x!\n", index); |
1594 | } | 1594 | } |
1595 | } | 1595 | } |
1596 | 1596 | ||
@@ -4054,7 +4054,7 @@ void cik_compute_ring_set_wptr(struct radeon_device *rdev, | |||
4054 | struct radeon_ring *ring) | 4054 | struct radeon_ring *ring) |
4055 | { | 4055 | { |
4056 | rdev->wb.wb[ring->wptr_offs/4] = cpu_to_le32(ring->wptr); | 4056 | rdev->wb.wb[ring->wptr_offs/4] = cpu_to_le32(ring->wptr); |
4057 | WDOORBELL32(ring->doorbell_offset, ring->wptr); | 4057 | WDOORBELL32(ring->doorbell_index, ring->wptr); |
4058 | } | 4058 | } |
4059 | 4059 | ||
4060 | /** | 4060 | /** |
@@ -4395,10 +4395,6 @@ static int cik_cp_compute_resume(struct radeon_device *rdev) | |||
4395 | return r; | 4395 | return r; |
4396 | } | 4396 | } |
4397 | 4397 | ||
4398 | /* doorbell offset */ | ||
4399 | rdev->ring[idx].doorbell_offset = | ||
4400 | (rdev->ring[idx].doorbell_page_num * PAGE_SIZE) + 0; | ||
4401 | |||
4402 | /* init the mqd struct */ | 4398 | /* init the mqd struct */ |
4403 | memset(buf, 0, sizeof(struct bonaire_mqd)); | 4399 | memset(buf, 0, sizeof(struct bonaire_mqd)); |
4404 | 4400 | ||
@@ -4510,7 +4506,7 @@ static int cik_cp_compute_resume(struct radeon_device *rdev) | |||
4510 | RREG32(CP_HQD_PQ_DOORBELL_CONTROL); | 4506 | RREG32(CP_HQD_PQ_DOORBELL_CONTROL); |
4511 | mqd->queue_state.cp_hqd_pq_doorbell_control &= ~DOORBELL_OFFSET_MASK; | 4507 | mqd->queue_state.cp_hqd_pq_doorbell_control &= ~DOORBELL_OFFSET_MASK; |
4512 | mqd->queue_state.cp_hqd_pq_doorbell_control |= | 4508 | mqd->queue_state.cp_hqd_pq_doorbell_control |= |
4513 | DOORBELL_OFFSET(rdev->ring[idx].doorbell_offset / 4); | 4509 | DOORBELL_OFFSET(rdev->ring[idx].doorbell_index); |
4514 | mqd->queue_state.cp_hqd_pq_doorbell_control |= DOORBELL_EN; | 4510 | mqd->queue_state.cp_hqd_pq_doorbell_control |= DOORBELL_EN; |
4515 | mqd->queue_state.cp_hqd_pq_doorbell_control &= | 4511 | mqd->queue_state.cp_hqd_pq_doorbell_control &= |
4516 | ~(DOORBELL_SOURCE | DOORBELL_HIT); | 4512 | ~(DOORBELL_SOURCE | DOORBELL_HIT); |
@@ -7841,14 +7837,14 @@ int cik_init(struct radeon_device *rdev) | |||
7841 | ring = &rdev->ring[CAYMAN_RING_TYPE_CP1_INDEX]; | 7837 | ring = &rdev->ring[CAYMAN_RING_TYPE_CP1_INDEX]; |
7842 | ring->ring_obj = NULL; | 7838 | ring->ring_obj = NULL; |
7843 | r600_ring_init(rdev, ring, 1024 * 1024); | 7839 | r600_ring_init(rdev, ring, 1024 * 1024); |
7844 | r = radeon_doorbell_get(rdev, &ring->doorbell_page_num); | 7840 | r = radeon_doorbell_get(rdev, &ring->doorbell_index); |
7845 | if (r) | 7841 | if (r) |
7846 | return r; | 7842 | return r; |
7847 | 7843 | ||
7848 | ring = &rdev->ring[CAYMAN_RING_TYPE_CP2_INDEX]; | 7844 | ring = &rdev->ring[CAYMAN_RING_TYPE_CP2_INDEX]; |
7849 | ring->ring_obj = NULL; | 7845 | ring->ring_obj = NULL; |
7850 | r600_ring_init(rdev, ring, 1024 * 1024); | 7846 | r600_ring_init(rdev, ring, 1024 * 1024); |
7851 | r = radeon_doorbell_get(rdev, &ring->doorbell_page_num); | 7847 | r = radeon_doorbell_get(rdev, &ring->doorbell_index); |
7852 | if (r) | 7848 | if (r) |
7853 | return r; | 7849 | return r; |
7854 | 7850 | ||