amdgpu support for Navi10
Subsystems (5)
Re: [PATCH 092/459] drm/amdgpu: add ib preemption status in amdgpu_job
In reply to a message not in the archiveAm 17.06.19 um 21:10 schrieb Alex Deucher:
Quoted 19 lines
From: Jack Xiao <[email protected]>
Add ib preemption status in
amdgpu_job, so that ring level function can detect preemption and program for resuming it.Acked-by Alex Deucher <[email protected]>Reviewed-by Hawking Zhang <[email protected]>Signed-off-by Jack Xiao <[email protected]>Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_job.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, · line 211
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1
-1@@ -208,7 +208,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, skip_preamble = ring->current_ctx == fence_ctx;if (job && ring->funcs->emit_cntxcntl) { - status |= job->preamble_status; + status |= job->preemption_status;
That actually looks completely incorrect to me since it breaks the old status handling.
Christian.
Quoted 17 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +0
-0amdgpu_ring_emit_cntxcntl (ring, status); }drivers/gpu/drm/amd/amdgpu/amdgpu_job.h +2
-0@@ -29,6 +29,8 @@#define AMDGPU_PREAMBLE_IB_PRESENT_FIRST (1 << 1)/* bit set means context switch occured */ #define AMDGPU_HAVE_CTX_SWITCH (1 << 2) +/* bit set means IB is preempted */ +#define AMDGPU_IB_PREEMPTED (1 << 3)#define to_amdgpu_job (sched_job) \ container_of((sched_job), struct amdgpu_job, base)
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h struct amdgpu_job { · line 53
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h +1
-0@@ -45,6 +47,7 @@ struct amdgpu_job {struct amdgpu_ib *ibs;struct dma_fence *fence;/* the hw fence */ uint32_t preamble_status; +uint32_t preemption_status;uint32_t num_ibs;void *owner;bool vm_needs_flush;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 8429fbeb-fbb2-b71d-e146-c8f4c0959063-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
RE: [PATCH 092/459] drm/amdgpu: add ib preemption status in amdgpu_job
In original patch, there is no deletion on job->preamble_status.
Regards,
Jack
-----Original Message-----
From: Christian König <[email protected]>
Sent: Tuesday, June 18, 2019 4:04 PM
To: Alex Deucher <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Xiao, Jack <[email protected]>; Zhang, Hawking <[email protected]>
Subject: Re: [PATCH 092/459] drm/amdgpu: add ib preemption status in amdgpu_job
Am 17.06.19 um 21:10 schrieb Alex Deucher:
Quoted 20 lines
From: Jack Xiao <[email protected]>
Add ib preemption status in
amdgpu_job, so that ring level function can detect preemption and program for resuming it.Acked-by Alex Deucher <[email protected]>Reviewed-by Hawking Zhang <[email protected]>Signed-off-by Jack Xiao <[email protected]>Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_job.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c int amdgpu_ib_schedule(struct amdgpu_ring *ring, · line 212
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1
-1@@ -208,7 +208,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring,unsigned num_ibs, skip_preamble = ring->current_ctx == fence_ctx;if (job && ring->funcs->emit_cntxcntl) { - status |= job->preamble_status; + status |= job->preemption_status;
That actually looks completely incorrect to me since it breaks the old status handling.
Christian.
Quoted 21 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +0
-0amdgpu_ring_emit_cntxcntl (ring, status); }drivers/gpu/drm/amd/amdgpu/amdgpu_job.h +2
-0@@ -29,6 +29,8 @@#define AMDGPU_PREAMBLE_IB_PRESENT_FIRST (1 << 1)/* bit set means context switch occured */ #define AMDGPU_HAVE_CTX_SWITCH (1 << 2) +/* bit set means IB is preempted */ +#define AMDGPU_IB_PREEMPTED (1 << 3)#define to_amdgpu_job (sched_job) \ container_of((sched_job), struct amdgpu_job, base) @@ -45,6 +47,7@@ struct
amdgpu_job{
structamdgpu_ib*ibs;
structdma_fence*fence; /* the hw fence */
uint32_tpreamble_status;
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h struct amdgpu_job { · line 53
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h +1
-0+uint32_t preemption_status;uint32_t num_ibs;void *owner;bool vm_needs_flush;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): MN2PR12MB3437D15684332D5E9DFA1715EFEA0-rweVpJHSKTo+c0MJbz0MrQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
Re: [PATCH 092/459] drm/amdgpu: add ib preemption status in amdgpu_job
Yeah thought so, cause that would break immediately and won't work at all.
It must be something like a merge or rebase artifact.
What's the best way to fix that up? In other words how should it look like?
Christian.
Am 18.06.19 um 10:32 schrieb Xiao, Jack:
Quoted 58 lines
In original patch, there is no deletion on
job->preamble_status.Regards,
Jack-----Original Message-----
From: Christian König <[email protected]>
Sent: Tuesday, June 18, 2019 4:04 PM
To: Alex Deucher <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Xiao, Jack <[email protected]>; Zhang, Hawking <[email protected]>
Subject: Re: [PATCH 092/459] drm/amdgpu: add ib preemption status inamdgpu_jobAm 17.06.19 um 21:10 schrieb Alex Deucher:
Quoted 20 lines
From: Jack Xiao <[email protected]>
Add ib preemption status in
amdgpu_job, so that ring level function can detect preemption and program for resuming it.Acked-by Alex Deucher <[email protected]>Reviewed-by Hawking Zhang <[email protected]>Signed-off-by Jack Xiao <[email protected]>Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_job.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +0
-0drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c int amdgpu_ib_schedule(struct amdgpu_ring *ring, · line 212
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1
-1@@ -208,7 +208,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring,unsigned num_ibs, skip_preamble = ring->current_ctx == fence_ctx;if (job && ring->funcs->emit_cntxcntl) { - status |= job->preamble_status; + status |= job->preemption_status;That actually looks completely incorrect to me since it breaks the old status handling.
Christian.
Quoted 15 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +0
-0amdgpu_ring_emit_cntxcntl (ring, status); }drivers/gpu/drm/amd/amdgpu/amdgpu_job.h +2
-0@@ -29,6 +29,8 @@#define AMDGPU_PREAMBLE_IB_PRESENT_FIRST (1 << 1)/* bit set means context switch occured */ #define AMDGPU_HAVE_CTX_SWITCH (1 << 2) +/* bit set means IB is preempted */ +#define AMDGPU_IB_PREEMPTED (1 << 3)
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h struct amdgpu_job { · line 53
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h +0
-0#define to_amdgpu_job (sched_job) \ container_of((sched_job), struct amdgpu_job, base) @@ -45,6 +47,7@@ struct amdgpu_job { struct amdgpu_ib *ibs; struct dma_fence *fence; /* the hw fence */ uint32_t preamble_status;drivers/gpu/drm/amd/amdgpu/amdgpu_job.h +1
-0+uint32_t preemption_status;uint32_t num_ibs;void *owner;bool vm_needs_flush;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 450d50ba-3c79-7199-d2f9-eac5e86b1f8f-5C7GfCeVMHo@public.gmane.org
RE: [PATCH 092/459] drm/amdgpu: add ib preemption status in amdgpu_job
I sent out a separate patch to add job->preamble_status back.
Regards,
Jack
-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: Tuesday, June 18, 2019 5:03 PM
To: Xiao, Jack <[email protected]>; Alex Deucher <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>
Subject: Re: [PATCH 092/459] drm/amdgpu: add ib preemption status in amdgpu_job
Yeah thought so, cause that would break immediately and won't work at all.
It must be something like a merge or rebase artifact.
What's the best way to fix that up? In other words how should it look like?
Christian.
Am 18.06.19 um 10:32 schrieb Xiao, Jack:
Quoted 61 lines
In original patch, there is no deletion on
job->preamble_status.Regards,
Jack-----Original Message-----
From: Christian König <[email protected]>
Sent: Tuesday, June 18, 2019 4:04 PM
To: Alex Deucher <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Xiao, Jack <[email protected]>; Zhang, Hawking <[email protected]>
Subject: Re: [PATCH 092/459] drm/amdgpu: add ib preemption status inamdgpu_jobAm 17.06.19 um 21:10 schrieb Alex Deucher:
Quoted 20 lines
From: Jack Xiao <[email protected]>
Add ib preemption status in
amdgpu_job, so that ring level function can detect preemption and program for resuming it.Acked-by Alex Deucher <[email protected]>Reviewed-by Hawking Zhang <[email protected]>Signed-off-by Jack Xiao <[email protected]>Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_job.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +0
-0drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c int amdgpu_ib_schedule(struct amdgpu_ring *ring, · line 212
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +1
-1@@ -208,7 +208,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring,unsigned num_ibs, skip_preamble = ring->current_ctx == fence_ctx;if (job && ring->funcs->emit_cntxcntl) { - status |= job->preamble_status; + status |= job->preemption_status;That actually looks completely incorrect to me since it breaks the old status handling.
Christian.
Quoted 15 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +0
-0amdgpu_ring_emit_cntxcntl (ring, status); }drivers/gpu/drm/amd/amdgpu/amdgpu_job.h +2
-0@@ -29,6 +29,8 @@#define AMDGPU_PREAMBLE_IB_PRESENT_FIRST (1 << 1)/* bit set means context switch occured */ #define AMDGPU_HAVE_CTX_SWITCH (1 << 2) +/* bit set means IB is preempted */ +#define AMDGPU_IB_PREEMPTED (1 << 3)
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_job.h +2
-0#define to_amdgpu_job (sched_job) \ container_of((sched_job), struct amdgpu_job, base) @@ -45,6 +47,7 @@ struct amdgpu_job {struct amdgpu_ib *ibs;struct dma_fence *fence;/* the hw fence */ uint32_t preamble_status; +uint32_t preemption_status;uint32_t num_ibs;void *owner;bool vm_needs_flush;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 93/459 drm/amdgpu/sdma: allocate CSA per sdma ring
In reply to a message not in the archiveFrom: Jack Xiao <[email protected]>
Allocate CSA for the given sdma ring.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 27 ++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +27 -0
@@ -24,6 +24,10 @@#include "amdgpu.h" #include "amdgpu_sdma.h" +#define AMDGPU_CSA_SDMA_SIZE 64 +/* SDMA CSA reside in the 3rd page of CSA */ +#define AMDGPU_CSA_SDMA_OFFSET (4096 * 2) +/* * GPU SDMA IP block helpers function. */
@@ -56,3 +60,26 @@ int amdgpu_sdma_get_index_from_ring(struct amdgpu_ring *ring, uint32_t *index)return -EINVAL ; } + +uint64_t amdgpu_sdma_get_csa_mc_addr (struct amdgpu_ring *ring, +unsigned vmid) +{ +struct amdgpu_device *adev = ring->adev; +uint64_t csa_mc_addr; +uint32_t index =0 ; +int r; + +if (vmid ==0 || !amdgpu_mcbp) +return 0 ; + + r =amdgpu_sdma_get_index_from_ring (ring, &index); + +if (r || index >31 ) + csa_mc_addr =0 ; +else + csa_mc_addr =amdgpu_csa_vaddr (adev) + +AMDGPU_CSA_SDMA_OFFSET + + index *AMDGPU_CSA_SDMA_SIZE ; + +return csa_mc_addr; +}
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.h +1 -1
@@ -97,5 +97,5 @@ struct amdgpu_buffer_funcs {struct amdgpu_sdma_instance *amdgpu_sdma_get_instance_from_ring (struct amdgpu_ring *ring);int amdgpu_sdma_get_index_from_ring (struct amdgpu_ring *ring,uint32_t *index); - +uint64_t amdgpu_sdma_get_csa_mc_addr (struct amdgpu_ring *ring,unsigned vmid);#endif
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 94/459 drm/amdgpu: program for resuming preempted ib
In reply to a message not in the archiveFrom: Jack Xiao <[email protected]>
For new submission ib, CE/DE metadata should be programmed to 0; for partially execution ib, CE/DE metadata should be restored.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 1 + 2 files changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c +1 -0
@@ -47,6 +47,7 @@ int amdgpu_allocate_static_csa(struct amdgpu_device *adev, struct amdgpu_bo **boreturn -ENOMEM ;memset (ptr,0 , size); + adev->virt.csa_cpu_addr = ptr;return 0 ; }
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +1 -0
@@ -253,6 +253,7 @@ typedef struct amdgim_vf2pf_info_v2 amdgim_vf2pf_info ;struct amdgpu_virt {uint32_t caps;struct amdgpu_bo *csa_obj; +void *csa_cpu_addr;bool chained_ib_support;uint32_t reg_val_offs;struct amdgpu_irq_src ack_irq;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 95/459 drm/amdgpu: add mcbp unit test in debugfs (v2)
In reply to a message not in the archiveFrom: Jack Xiao <[email protected]>
The MCBP unit test is used to test the functionality of MCBP. It emualtes to send preemption request and resubmit the unfinished jobs.
v2: squash in fixes (Alex)
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 156 ++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 1 + 4 files changed, 159 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -763,6 +763,7 @@ struct amdgpu_device {struct amdgpu_debugfs debugfs[AMDGPU_DEBUGFS_MAX_COMPONENTS ];unsigned debugfs_count;#if defined(CONFIG_DEBUG_FS ) +struct dentry *debugfs_preempt;struct dentry *debugfs_regs[AMDGPU_DEBUGFS_MAX_COMPONENTS ];#endif struct amdgpu_atif *atif;
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +156 -0
173 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.h +1 -0
@@ -34,6 +34,7 @@ struct amdgpu_debugfs {int amdgpu_debugfs_regs_init (struct amdgpu_device *adev);void amdgpu_debugfs_regs_cleanup (struct amdgpu_device *adev);int amdgpu_debugfs_init (struct amdgpu_device *adev); +void amdgpu_debugfs_preempt_cleanup (struct amdgpu_device *adev);int amdgpu_debugfs_add_files (struct amdgpu_device *adev,const struct drm_info_list *files,unsigned nfiles);
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
@@ -2831,6 +2831,7 @@ void amdgpu_device_fini(struct amdgpu_device *adev)amdgpu_debugfs_regs_cleanup (adev);device_remove_file (adev->dev, &dev_attr_pcie_replay_count);amdgpu_ucode_sysfs_fini (adev); +amdgpu_debugfs_preempt_cleanup (adev); }
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 96/459 drm/amdgpu: mark the partial job as preempted in mcbp unit test
In reply to a message not in the archiveFrom: Jack Xiao <[email protected]>
In mcbp unit test, the test should detect the preempted job which may be a partial execution ib and mark it as preempted; so that the gfx block can correctly generate PM4 frame.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 44 +++++++++++++++------ 1 file changed, 32 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +32 -12
@@ -976,12 +976,40 @@ static void amdgpu_ib_preempt_job_recovery(struct drm_gpu_scheduler *sched)spin_unlock (&sched->job_list_lock); } +static void amdgpu_ib_preempt_mark_partial_job (struct amdgpu_ring *ring) +{ +struct amdgpu_job *job; +struct drm_sched_job *s_job; +uint32_t preempt_seq; +struct dma_fence *fence, **ptr; +struct amdgpu_fence_driver *drv = &ring->fence_drv; +struct drm_gpu_scheduler *sched = &ring->sched; + +if (ring->funcs->type !=AMDGPU_RING_TYPE_GFX ) +return ; + + preempt_seq =le32_to_cpu (*(drv->cpu_addr +2 )); +if (preempt_seq <=atomic_read (&drv->last_seq)) +return ; + + preempt_seq &= drv->num_fences_mask; + ptr = &drv->fences[preempt_seq]; + fence =rcu_dereference_protected (*ptr,1 ); + +spin_lock (&sched->job_list_lock); +list_for_each_entry (s_job, &sched->ring_mirror_list, node) { + job =to_amdgpu_job (s_job); +if (job->fence == fence) +/* mark the job as preempted */ + job->preemption_status |=AMDGPU_IB_PREEMPTED ; + } +spin_unlock (&sched->job_list_lock); +} +static int amdgpu_debugfs_ib_preempt (void *data,u64 val) {int r, resched, length;struct amdgpu_ring *ring; -struct drm_sched_job *s_job; -struct amdgpu_job *job;struct dma_fence **fences =NULL ;struct amdgpu_device *adev = (struct amdgpu_device *)data;
@@ -1020,21 +1048,13 @@ static int amdgpu_debugfs_ib_preempt(void *data, u64 val) ring->fence_drv.sync_seq) {DRM_INFO ("ring %d was preempted\n" , ring->idx); +amdgpu_ib_preempt_mark_partial_job (ring); +/* swap out the old fences */ amdgpu_ib_preempt_fences_swap (ring, fences);amdgpu_fence_driver_force_completion (ring); - s_job =list_first_entry_or_null ( - &ring->sched.ring_mirror_list, - struct drm_sched_job, node); -if (s_job) { - job =to_amdgpu_job (s_job); -/* mark the job as preempted */ -/* job->preemption_status |= -AMDGPU_IB_PREEMPTED; */ - } -/* resubmit unfinished jobs */ amdgpu_ib_preempt_job_recovery (&ring->sched);
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 97/459 drm/amdgpu/discovery: add ip discovery initial support
In reply to a message not in the archiveFrom: Xiaojie Yuan <[email protected]>
v2: prefix struct and function names with 'amdgpu'
v3: read table binary from vram using mmMM_INDEX and mmMM_DATA
update TABLE_BINARY_MAX_SIZE to 64kb (1 TMR)
add 'instance_number' field per ip info
consider endianness and replace uint8/16/32_t with u8/16/32 initialize register base addresses
initialize adev->gfx.config and adev->gfx.cu_info to replace gpu info fw get major and minor version using a single api
don't expose internal data structures in amdgpu_discovery.h
v4: RCC_CONFIG_MEMSIZE is in MB units
hold mmio_idx_lock while reading ip discovery binary
v5: pick out discovery.h as a cross-OS header
do structure pointer cast directly
consider endianness while using the member of structure convert base addresses to dword
at boot up, PSP BL copies ip discovery binary from VBIOS(SPIROM) image to the top of the frame buffer (just below the reserved regions for PSP & SMU).
ip discovery data table includes the collection of each ip's identification number, base addresses, version number, and harvest setting placeholder.
gc data table includes gfx info structure.
--- drivers/gpu/drm/amd/amdgpu/Makefile | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 4 + drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 401 ++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.h | 34 ++ drivers/gpu/drm/amd/include/discovery.h | 145 +++++++ 5 files changed, 585 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.h create mode 100644 drivers/gpu/drm/amd/include/discovery.h
drivers/gpu/drm/amd/amdgpu/Makefile +1 -1
@@ -54,7 +54,7 @@ amdgpu-y += amdgpu_device.o amdgpu_kms.o \ amdgpu_gtt_mgr.o amdgpu_vram_mgr.o amdgpu_virt.o amdgpu_atomfirmware.o \ amdgpu_vf_error.o amdgpu_sched.o amdgpu_debugfs.o amdgpu_ids.o \ amdgpu_gmc.o amdgpu_xgmi.o amdgpu_csa.o amdgpu_ras.o amdgpu_vm_cpu.o \ - amdgpu_vm_sdma.o + amdgpu_vm_sdma.o amdgpu_discovery.o # add asic specific block amdgpu-$(CONFIG_DRM_AMDGPU_CIK)+= cik.o cik_ih.o kv_smc.o kv_dpm.o \
drivers/gpu/drm/amd/amdgpu/amdgpu.h +4 -0
@@ -84,6 +84,7 @@#include "amdgpu_doorbell.h" #include "amdgpu_amdkfd.h" #include "amdgpu_smu.h" +#include "amdgpu_discovery.h" #define MAX_GPU_INSTANCE 16
@@ -914,6 +915,9 @@ struct amdgpu_device {/* display related functionality */ struct amdgpu_display_manager dm; +/* discovery */ +uint8_t *discovery; +struct amdgpu_ip_block ip_blocks[AMDGPU_MAX_IP_NUM ];int num_ip_blocks;struct mutex mn_lock;
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c new file +401 -0
401 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.h new file +34 -0
@@ -0,0 +1,34 @@ +/* +* Copyright 2018 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +* +*/ + +#ifndef __AMDGPU_DISCOVERY__ +#define __AMDGPU_DISCOVERY__ + +int amdgpu_discovery_init (struct amdgpu_device *adev); +void amdgpu_discovery_fini (struct amdgpu_device *adev); +int amdgpu_discovery_reg_base_init (struct amdgpu_device *adev); +int amdgpu_discovery_get_ip_version (struct amdgpu_device *adev,int hw_id, +int *major,int *minor); +int amdgpu_discovery_get_gfx_info (struct amdgpu_device *adev); + +#endif /* __AMDGPU_DISCOVERY__ */
drivers/gpu/drm/amd/include/discovery.h new file +145 -0
145 lines not on this page · raw message
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 98/459 drm/amdgpu/discovery: fix calculations of some gfx info
In reply to a message not in the archiveFrom: Xiaojie Yuan <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +6 -4
@@ -381,8 +381,9 @@ int amdgpu_discovery_get_gfx_info(struct amdgpu_device *adev) le16_to_cpu(bhdr->table_list[GC].offset)); adev->gfx.config.max_shader_engines =le32_to_cpu (gc_info->gc_num_se); - adev->gfx.config.max_cu_per_sh =le32_to_cpu (gc_info->gc_num_wgp0_per_sa); - adev->gfx.config.max_sh_per_se =le32_to_cpu (gc_info->gc_num_wgp1_per_sa); + adev->gfx.config.max_cu_per_sh =2 * (le32_to_cpu (gc_info->gc_num_wgp0_per_sa) + +le32_to_cpu (gc_info->gc_num_wgp1_per_sa)); + adev->gfx.config.max_sh_per_se =le32_to_cpu (gc_info->gc_num_sa_per_se); adev->gfx.config.max_backends_per_se =le32_to_cpu (gc_info->gc_num_rb_per_se); adev->gfx.config.max_texture_channel_caches =le32_to_cpu (gc_info->gc_num_gl2c); adev->gfx.config.max_gprs =le32_to_cpu (gc_info->gc_num_gprs);
@@ -394,8 +395,9 @@ int amdgpu_discovery_get_gfx_info(struct amdgpu_device *adev) adev->gfx.cu_info.max_waves_per_simd =le32_to_cpu (gc_info->gc_max_waves_per_simd); adev->gfx.cu_info.max_scratch_slots_per_cu =le32_to_cpu (gc_info->gc_max_scratch_slots_per_cu); adev->gfx.cu_info.lds_size =le32_to_cpu (gc_info->gc_lds_size); - adev->gfx.config.num_sc_per_sh =le32_to_cpu (gc_info->gc_num_sc_per_se); - adev->gfx.config.num_packer_per_sc =le32_to_cpu (gc_info->gc_num_sa_per_se); + adev->gfx.config.num_sc_per_sh =le32_to_cpu (gc_info->gc_num_sc_per_se) / +le32_to_cpu (gc_info->gc_num_sa_per_se); + adev->gfx.config.num_packer_per_sc =le32_to_cpu (gc_info->gc_num_packer_per_sc);return 0 ; }
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 99/459 drm/amdgpu/discovery: update definitions of table_info and binary_header
In reply to a message not in the archiveFrom: Xiaojie Yuan <[email protected]>
--- drivers/gpu/drm/amd/include/discovery.h | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/include/discovery.h +4 -0
@@ -46,12 +46,16 @@ typedef struct table_info {uint16_t offset;/* Byte offset */ uint16_t checksum;/* Byte sum of the table */ +uint16_t size;/* Table size */ +uint16_t padding; } table_info; typedef struct binary_header { /* psp structure should go at the top of this structure */ uint32_t binary_signature; /* 0x7, 0x14, 0x21, 0x28 */ + uint16_t version_major; + uint16_t version_minor; uint16_t binary_checksum; /* Byte sum of the binary after this field */ uint16_t binary_size; /* Binary Size*/ table_info table_list[TOTAL_TABLES];
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 100/459 drm/amdgpu/discovery: add harvest info data table
In reply to a message not in the archiveFrom: Xiaojie Yuan <[email protected]>
--- drivers/gpu/drm/amd/include/discovery.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/include/discovery.h +17 -1
@@ -33,7 +33,7 @@ typedef enum {IP_DISCOVERY =0 ,GC , -TABLE_3 , +HARVEST_INFO ,TABLE_4 ,RESERVED_1 , RESERVED_2,
@@ -144,6 +144,22 @@ struct gc_info_v1_0 { uint32_t gc_num_gl2a; }; +typedef struct harvest_info_header { +uint32_t signature;/* Table Signature */ +uint32_t version;/* Table Version */ +}harvest_info_header ; + +typedef struct harvest_info { +uint16_t hw_id;/* Hardware ID */ +uint8_t number_instance;/* Instance of the IP */ +uint8_t reserved;/* Reserved for alignment */ +}harvest_info ; + +typedef struct harvest_table { +harvest_info_header header; +harvest_info list[32 ]; +}harvest_table ; +#pragma pack()#endif
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 101/459 drm/amdgpu/discovery: use hardcoded mmRCC_CONFIG_MEMSIZE
In reply to a message not in the archiveFrom: Xiaojie Yuan <[email protected]>
register base offset of nbio is not known before IP Discovery table is parsed, so hardcode this value.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +6 -6
@@ -28,10 +28,11 @@#include "nbio/nbio_2_3_offset.h" #include "discovery.h" -#define mmMM_INDEX 0x0 -#define mmMM_INDEX_HI 0x6 -#define mmMM_DATA 0x1 -#define HW_ID_MAX 300 +#define mmRCC_CONFIG_MEMSIZE 0xde3 +#define mmMM_INDEX 0x0 +#define mmMM_INDEX_HI 0x6 +#define mmMM_DATA 0x1 +#define HW_ID_MAX 300const char *hw_id_names[HW_ID_MAX ] = { [MP1_HWID ] ="MP1" ,
@@ -134,8 +135,7 @@ static int hw_id_map[MAX_HWIP] = {static int amdgpu_discovery_read_binary (struct amdgpu_device *adev,uint8_t *binary) {uint32_t *p = (uint32_t *)binary; -uint64_t vram_size =RREG32_SOC15 (NBIO ,0 , - mmRCC_DEV0_EPF0_RCC_CONFIG_MEMSIZE) *1024 *1024 ; +uint64_t vram_size = (uint64_t )RREG32 (mmRCC_CONFIG_MEMSIZE) <<20 ;uint64_t pos = vram_size -BINARY_MAX_SIZE ;unsigned long flags;
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 102/459 drm/amdgpu/discovery: fix hwid for nbio
In reply to a message not in the archiveFrom: Xiaojie Yuan <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +1 -1
@@ -117,7 +117,7 @@ static int hw_id_map[MAX_HWIP] = { [SDMA1_HWIP] = SDMA1_HWID, [MMHUB_HWIP] = MMHUB_HWID, [ATHUB_HWIP] = ATHUB_HWID, - [NBIO_HWIP] = DBGU_NBIO_HWID, + [NBIO_HWIP] = NBIF_HWID, [MP0_HWIP] = MP0_HWID, [MP1_HWIP] = MP1_HWID, [UVD_HWIP] = UVD_HWID,
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 103/459 drm/amdgpu/discovery: stop taking psp header into account
In reply to a message not in the archiveFrom: Xiaojie Yuan <[email protected]>
psp will write a header to vram, but the value exposed in RCC_CONFIG_MEMSIZE does not include the memory that this header is written to. Therefore, the interpretation of the table does not need to take the psp header into account.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +5 -6
@@ -189,7 +189,7 @@ int amdgpu_discovery_init(struct amdgpu_device *adev) goto out; } - bhdr = (struct binary_header *)(adev->discovery +PSP_HEADER_SIZE ); + bhdr = (struct binary_header *)adev->discovery;if (le32_to_cpu (bhdr->binary_signature) !=BINARY_SIGNATURE ) {DRM_ERROR ("invalid ip discovery binary signature\n" );
@@ -197,8 +197,7 @@ int amdgpu_discovery_init(struct amdgpu_device *adev) goto out; } - offset =PSP_HEADER_SIZE + - offsetof(struct binary_header , binary_checksum) + + offset = offsetof(struct binary_header , binary_checksum) +sizeof (bhdr->binary_checksum); size = bhdr->binary_size - offset; checksum = bhdr->binary_checksum;
@@ -275,7 +274,7 @@ int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev)return -EINVAL ; } - bhdr = (struct binary_header *)(adev->discovery +PSP_HEADER_SIZE ); + bhdr = (struct binary_header *)adev->discovery; ihdr = (struct ip_discovery_header *)(adev->discovery +le16_to_cpu (bhdr->table_list[IP_DISCOVERY ].offset)); num_dies =le16_to_cpu (ihdr->num_dies);
@@ -338,7 +337,7 @@ int amdgpu_discovery_get_ip_version(struct amdgpu_device *adev, int hw_id,return -EINVAL ; } - bhdr = (struct binary_header *)(adev->discovery +PSP_HEADER_SIZE ); + bhdr = (struct binary_header *)adev->discovery; ihdr = (struct ip_discovery_header *)(adev->discovery +le16_to_cpu (bhdr->table_list[IP_DISCOVERY ].offset)); num_dies =le16_to_cpu (ihdr->num_dies);
@@ -376,7 +375,7 @@ int amdgpu_discovery_get_gfx_info(struct amdgpu_device *adev)return -EINVAL ; } - bhdr = (struct binary_header *)(adev->discovery +PSP_HEADER_SIZE ); + bhdr = (struct binary_header *)adev->discovery; gc_info = (struct gc_info_v1_0 *)(adev->discovery +le16_to_cpu (bhdr->table_list[GC ].offset));
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 104/459 drm/amdgpu/discovery: update definition for struct die_header
In reply to a message not in the archiveFrom: Xiaojie Yuan <[email protected]>
--- drivers/gpu/drm/amd/include/discovery.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/include/discovery.h +2 -2
@@ -99,8 +99,8 @@ typedef struct iptypedef struct die_header { -uint32_t die_id; -uint32_t num_ips; +uint16_t die_id; +uint16_t num_ips; }die_header ; typedef struct ip_structure
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 105/459 drm/amdgpu/discovery: stop converting the units of base addresses
In reply to a message not in the archiveFrom: Xiaojie Yuan <[email protected]>
the unit is already in dword
--- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +3 -3
@@ -300,11 +300,11 @@ int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev)for (k =0 ; k < num_base_address; k++) {/* -* convert the endianness and unit (in dword) of base addresses in place, +* convert the endianness of base addresses in place, * so that we don't need to convert them when accessing adev->reg_offset. */ - ip->base_address[k] =le32_to_cpu (ip->base_address[k]) >>2 ; -DRM_DEBUG ("\t0x%08x\n" , ip->base_address[k] <<2 ); + ip->base_address[k] =le32_to_cpu (ip->base_address[k]); +DRM_DEBUG ("\t0x%08x\n" , ip->base_address[k]); } adev->reg_offset[hw_ip][ip->number_instance] =
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 106/459 drm/amdgpu/discovery: add module param for ip discovery enablement
In reply to a message not in the archiveFrom: Xiaojie Yuan <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 10 ++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++++ 3 files changed, 16 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -161,6 +161,7 @@ extern int amdgpu_ras_enable;extern uint amdgpu_ras_mask;extern int amdgpu_async_gfx_ring;extern int amdgpu_mcbp; +extern int amdgpu_discovery;#ifdef CONFIG_DRM_AMDGPU_SI extern int amdgpu_si_support;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +10 -0
@@ -2577,6 +2577,14 @@ int amdgpu_device_init(struct amdgpu_device *adev,if (amdgpu_mcbp)DRM_INFO ("MCBP is enabled\n" ); +if (amdgpu_discovery) { + r =amdgpu_discovery_init (adev); +if (r) { +dev_err (adev->dev,"amdgpu_discovery_init failed\n" ); +return r; + } + } +/* early init functions */ r =amdgpu_device_ip_early_init (adev);if (r)
@@ -2832,6 +2840,8 @@ void amdgpu_device_fini(struct amdgpu_device *adev)device_remove_file (adev->dev, &dev_attr_pcie_replay_count);amdgpu_ucode_sysfs_fini (adev);amdgpu_debugfs_preempt_cleanup (adev); +if (amdgpu_discovery) +amdgpu_discovery_fini (adev); }
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +5 -0
@@ -138,6 +138,7 @@ uint amdgpu_smu_memory_pool_size = 0;uint amdgpu_dc_feature_mask =0 ;int amdgpu_async_gfx_ring =1 ;int amdgpu_mcbp =0 ; +int amdgpu_discovery =0 ;struct amdgpu_mgpu_info mgpu_info = { .mutex =__MUTEX_INITIALIZER (mgpu_info.mutex),
@@ -579,6 +580,10 @@ MODULE_PARM_DESC(mcbp, "Enable Mid-command buffer preemption (0 = disabled (default), 1 = enabled)");module_param_named (mcbp, amdgpu_mcbp, int,0444 ); +MODULE_PARM_DESC (discovery, +"Allow driver to discover hardware IPs from IP Discovery table at the top of VRAM" ); +module_param_named (discovery, amdgpu_discovery, int,0444 ); +#ifdef CONFIG_HSA_AMD /** * DOC: sched_policy (int)
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 107/459 drm/amdgpu/discovery: refactor ip list traversal
In reply to a message not in the archiveFrom: Xiaojie Yuan <[email protected]>
for each ip, check whether it is needed by amdgpu driver, if yes, record its base addresses
v2: change some DRM_INFO to DRM_DEBUG
v3: remove unused variable (Alex)
--- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 71 +++++++++++-------- 1 file changed, 42 insertions(+), 29 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +42 -29
@@ -266,7 +266,6 @@ int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev)uint16_t num_ips;uint8_t num_base_address;int hw_ip; -int hw_id;int i, j, k;if (!adev->discovery) {
@@ -279,40 +278,54 @@ int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev) le16_to_cpu(bhdr->table_list[IP_DISCOVERY].offset)); num_dies =le16_to_cpu (ihdr->num_dies); -for (hw_ip =0 ; hw_ip <MAX_HWIP ; hw_ip++) { - hw_id = hw_id_map[hw_ip]; - -for (i =0 ; i < num_dies; i++) { - die_offset =le16_to_cpu (ihdr->die_info[i].die_offset); - dhdr = (struct die_header *)(adev->discovery + die_offset); - num_ips =le16_to_cpu (dhdr->num_ips); - ip_offset = die_offset +sizeof (*dhdr); - -for (j =0 ; j < num_ips; j++) { - ip = (struct ip *)(adev->discovery + ip_offset); - num_base_address = ip->num_base_address; - -if (le16_to_cpu (ip->hw_id) == hw_id) { -DRM_DEBUG ("%s(%d) v%d.%d.%d:\n" , - hw_id_names[hw_id], hw_id, - ip->major, ip->minor, - ip->revision); - -for (k =0 ; k < num_base_address; k++) { -/* -* convert the endianness of base addresses in place, -* so that we don't need to convert them when accessing adev->reg_offset. -*/ - ip->base_address[k] =le32_to_cpu (ip->base_address[k]); -DRM_DEBUG ("\t0x%08x\n" , ip->base_address[k]); - } +DRM_DEBUG ("number of dies: %d\n" , num_dies); +for (i =0 ; i < num_dies; i++) { + die_offset =le16_to_cpu (ihdr->die_info[i].die_offset); + dhdr = (struct die_header *)(adev->discovery + die_offset); + num_ips =le16_to_cpu (dhdr->num_ips); + ip_offset = die_offset +sizeof (*dhdr); + +if (le16_to_cpu (dhdr->die_id) != i) { +DRM_ERROR ("invalid die id %d, expected %d\n" , +le16_to_cpu (dhdr->die_id), i); +return -EINVAL ; + } + +DRM_DEBUG ("number of hardware IPs on die%d: %d\n" , +le16_to_cpu (dhdr->die_id), num_ips); + +for (j =0 ; j < num_ips; j++) { + ip = (struct ip *)(adev->discovery + ip_offset); + num_base_address = ip->num_base_address; + +DRM_DEBUG ("%s(%d) #%d v%d.%d.%d:\n" , + hw_id_names[le16_to_cpu (ip->hw_id)], +le16_to_cpu (ip->hw_id), + ip->number_instance, + ip->major, ip->minor, + ip->revision); + +for (k =0 ; k < num_base_address; k++) { +/* +* convert the endianness of base addresses in place, +* so that we don't need to convert them when accessing adev->reg_offset. +*/ + ip->base_address[k] =le32_to_cpu (ip->base_address[k]); +DRM_DEBUG ("\t0x%08x\n" , ip->base_address[k]); + } + +for (hw_ip =0 ; hw_ip <MAX_HWIP ; hw_ip++) { +if (hw_id_map[hw_ip] ==le16_to_cpu (ip->hw_id)) { +DRM_INFO ("set register base offset for %s\n" , + hw_id_names[le16_to_cpu (ip->hw_id)]); adev->reg_offset[hw_ip][ip->number_instance] = ip->base_address; } - ip_offset +=sizeof (*ip) +4 * (ip->num_base_address -1 ); } + + ip_offset +=sizeof (*ip) +4 * (ip->num_base_address -1 ); } }
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 108/459 drm/amdgpu: disable concurrent flushes for Navi10 v2
In reply to a message not in the archiveFrom: Christian König <[email protected]>
Navi10 have a bug in the SDMA which can theoretically cause memory corruption with concurrent VMID flushes
v2: explicitely check Navi10
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +5 -2
@@ -364,8 +364,11 @@ static int amdgpu_vmid_grab_used(struct amdgpu_vm *vm,if (updates && (!flushed ||dma_fence_is_later (updates, flushed))) needs_flush = true; -/* Concurrent flushes are only possible starting with Vega10 */ -if (adev->asic_type <CHIP_VEGA10 && needs_flush) +/* Concurrent flushes are only possible starting with Vega10 and +* are broken on Navi10 and Navi14. +*/ +if (needs_flush && (adev->asic_type <CHIP_VEGA10 || + adev->asic_type ==CHIP_NAVI10 ))continue ;/* Good, we can use this VMID. Remember this submission as
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 109/459 drm/amdgpu: add pa_sc_tile_steering_override to drm_amdgpu_info_device
In reply to a message not in the archiveFrom: Hawking Zhang <[email protected]>
the initial/default value of pa_sc_tile_steering_override need to be exposed to user mode driver
--- include/uapi/drm/amdgpu_drm.h | 2 ++ 1 file changed, 2 insertions(+)
include/uapi/drm/amdgpu_drm.h +2 -0
@@ -995,6 +995,8 @@ struct drm_amdgpu_info_device {__u64 high_va_offset;/** The maximum high virtual address */ __u64 high_va_max; +/* gfx10 pa_sc_tile_steering_override */ +__u32 pa_sc_tile_steering_override; };struct drm_amdgpu_info_hw_ip {
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 110/459 drm/amdgpu: set the default value of pa_sc_tile_steering_override
In reply to a message not in the archiveFrom: Hawking Zhang <[email protected]>
So userspace can access it.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +4 -0
@@ -762,6 +762,10 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file dev_info.gs_prim_buffer_depth = adev->gfx.config.gs_prim_buffer_depth; dev_info.max_gs_waves_per_vgt = adev->gfx.config.max_gs_threads; +if (adev->family >=AMDGPU_FAMILY_NV ) + dev_info.pa_sc_tile_steering_override = + adev->gfx.config.pa_sc_tile_steering_override; +return copy_to_user (out, &dev_info,min ((size_t )size,sizeof (dev_info))) ? -EFAULT :0 ; }
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 111/459 drm/amdgpu: add initial support for sdma v5.0 (v6)
In reply to a message not in the archiveFrom: Hawking Zhang <[email protected]>
SDMA (System DMA) is a general purpose DMA engine usable by UMDs for transfers or the kernel for paging or GPUVM updates.
v1: support basic funcitonalites includes rb, ib, vm,
copy buffer and trap irq
v2: convert to use new get_vm_pde in emit_vm_flush
v3: retire amdgpu_ttm_set_active_vram_size from sdma v5
v4: retire the redundant hdp_invalidate implementation
v5: squash in updates
v6: some golden regs moved to vbios
--- drivers/gpu/drm/amd/amdgpu/Makefile | 3 +- drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 1685 ++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/sdma_v5_0.h | 45 + 3 files changed, 1732 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c create mode 100644 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.h
drivers/gpu/drm/amd/amdgpu/Makefile +2 -1
@@ -117,7 +117,8 @@ amdgpu-y += \ amdgpu_sdma.o \ sdma_v2_4.o \ sdma_v3_0.o \ - sdma_v4_0.o + sdma_v4_0.o \ + sdma_v5_0.o # add UVD block amdgpu-y += \
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c new file +1685 -0
1,685 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.h new file +45 -0
45 lines not on this page · raw message
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 112/459 drm/amdgpu: add Navi10 VCN firmware support
In reply to a message not in the archiveFrom: Leo Liu <[email protected]>
Add Navi10 to VCN family
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +5 -0
@@ -45,10 +45,12 @@#define FIRMWARE_RAVEN "amdgpu/raven_vcn.bin"#define FIRMWARE_PICASSO "amdgpu/picasso_vcn.bin"#define FIRMWARE_RAVEN2 "amdgpu/raven2_vcn.bin" +#define FIRMWARE_NAVI10 "amdgpu/navi10_vcn.bin"MODULE_FIRMWARE (FIRMWARE_RAVEN );MODULE_FIRMWARE (FIRMWARE_PICASSO );MODULE_FIRMWARE (FIRMWARE_RAVEN2 ); +MODULE_FIRMWARE (FIRMWARE_NAVI10 );static void amdgpu_vcn_idle_work_handler (struct work_struct *work);
@@ -71,6 +73,9 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)else fw_name =FIRMWARE_RAVEN ;break ; +case CHIP_NAVI10 : + fw_name =FIRMWARE_NAVI10 ; +break ;default :return -EINVAL ; }
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 113/459 drm/amdgpu: add VCN2.0 decode ring test
In reply to a message not in the archiveFrom: Leo Liu <[email protected]>
Add internal register offset for registers involving in ring tests
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 8 +++----- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 5 +++++ drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c | 3 +++ 3 files changed, 11 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +3 -5
@@ -312,17 +312,15 @@ int amdgpu_vcn_dec_ring_test_ring(struct amdgpu_ring *ring)unsigned i;int r; -WREG32 (SOC15_REG_OFFSET (UVD ,0 , mmUVD_SCRATCH9),0xCAFEDEAD ); +WREG32 (adev->vcn.external.scratch9,0xCAFEDEAD ); r =amdgpu_ring_alloc (ring,3 );if (r)return r; - -amdgpu_ring_write (ring, -PACKET0 (SOC15_REG_OFFSET (UVD ,0 , mmUVD_SCRATCH9),0 )); +amdgpu_ring_write (ring,PACKET0 (adev->vcn.internal.scratch9,0 ));amdgpu_ring_write (ring,0xDEADBEEF );amdgpu_ring_commit (ring);for (i =0 ; i < adev->usec_timeout; i++) { - tmp =RREG32 (SOC15_REG_OFFSET (UVD ,0 , mmUVD_SCRATCH9)); + tmp =RREG32 (adev->vcn.external.scratch9);if (tmp ==0xDEADBEEF )break ;DRM_UDELAY (1 );
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +5 -0
@@ -87,6 +87,10 @@ struct dpg_pause_state {enum internal_dpg_state jpeg; }; +struct amdgpu_vcn_reg { +unsigned scratch9; +}; +struct amdgpu_vcn {struct amdgpu_bo *vcpu_bo;void *cpu_addr;
@@ -102,6 +106,7 @@ struct amdgpu_vcn {unsigned num_enc_rings;enum amd_powergating_state cur_state;struct dpg_pause_state pause_state; +struct amdgpu_vcn_reg internal, external;int (*pause_dpg_mode)(struct amdgpu_device *adev,struct dpg_pause_state *new_state); };
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +3 -0
@@ -128,6 +128,9 @@ static int vcn_v1_0_sw_init(void *handle)if (r)return r; + adev->vcn.internal.scratch9 = adev->vcn.external.scratch9 = +SOC15_REG_OFFSET (UVD ,0 , mmUVD_SCRATCH9); +for (i =0 ; i < adev->vcn.num_enc_rings; ++i) { ring = &adev->vcn.ring_enc[i];sprintf (ring->name,"vcn_enc%d" , i);
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 114/459 drm/amdgpu: add VCN2.0 decode ib test
In reply to a message not in the archiveFrom: Leo Liu <[email protected]>
Add internal register offset for registers involving in ib tests
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 8 ++++---- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 6 +++++- drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c | 8 ++++++++ 3 files changed, 17 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +4 -4
@@ -349,14 +349,14 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring, ib = &job->ibs[0 ]; addr =amdgpu_bo_gpu_offset (bo); - ib->ptr[0 ] =PACKET0 (SOC15_REG_OFFSET (UVD ,0 , mmUVD_GPCOM_VCPU_DATA0),0 ); + ib->ptr[0 ] =PACKET0 (adev->vcn.internal.data0,0 ); ib->ptr[1 ] = addr; - ib->ptr[2 ] =PACKET0 (SOC15_REG_OFFSET (UVD ,0 , mmUVD_GPCOM_VCPU_DATA1),0 ); + ib->ptr[2 ] =PACKET0 (adev->vcn.internal.data1,0 ); ib->ptr[3 ] = addr >>32 ; - ib->ptr[4 ] =PACKET0 (SOC15_REG_OFFSET (UVD ,0 , mmUVD_GPCOM_VCPU_CMD),0 ); + ib->ptr[4 ] =PACKET0 (adev->vcn.internal.cmd,0 ); ib->ptr[5 ] =0 ;for (i =6 ; i <16 ; i +=2 ) { - ib->ptr[i] =PACKET0 (SOC15_REG_OFFSET (UVD ,0 , mmUVD_NO_OP),0 ); + ib->ptr[i] =PACKET0 (adev->vcn.internal.nop,0 ); ib->ptr[i+1 ] =0 ; } ib->length_dw =16 ;
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +5 -1
@@ -25,7 +25,7 @@#define __AMDGPU_VCN_H__#define AMDGPU_VCN_STACK_SIZE (128*1024) -#define AMDGPU_VCN_CONTEXT_SIZE (512*1024) +#define AMDGPU_VCN_CONTEXT_SIZE (512*1024)#define AMDGPU_VCN_FIRMWARE_OFFSET 256#define AMDGPU_VCN_MAX_ENC_RINGS 3
@@ -88,6 +88,10 @@ struct dpg_pause_state { };struct amdgpu_vcn_reg { +unsigned data0; +unsigned data1; +unsigned cmd; +unsigned nop;unsigned scratch9; };
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +8 -0
@@ -130,6 +130,14 @@ static int vcn_v1_0_sw_init(void *handle) adev->vcn.internal.scratch9 = adev->vcn.external.scratch9 =SOC15_REG_OFFSET (UVD ,0 , mmUVD_SCRATCH9); + adev->vcn.internal.data0 = adev->vcn.external.data0 = +SOC15_REG_OFFSET (UVD ,0 , mmUVD_GPCOM_VCPU_DATA0); + adev->vcn.internal.data1 = adev->vcn.external.data1 = +SOC15_REG_OFFSET (UVD ,0 , mmUVD_GPCOM_VCPU_DATA1); + adev->vcn.internal.cmd = adev->vcn.external.cmd = +SOC15_REG_OFFSET (UVD ,0 , mmUVD_GPCOM_VCPU_CMD); + adev->vcn.internal.nop = adev->vcn.external.nop = +SOC15_REG_OFFSET (UVD ,0 , mmUVD_NO_OP);for (i =0 ; i < adev->vcn.num_enc_rings; ++i) { ring = &adev->vcn.ring_enc[i];
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 115/459 drm/amdgpu: add JPEG2.0 decode ring test
In reply to a message not in the archiveFrom: Leo Liu <[email protected]>
Use register from JPEG tile, the UVD tile reg won't work for JPEG
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 8 +++----- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 1 + drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c | 2 ++ 3 files changed, 6 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +3 -5
@@ -631,19 +631,17 @@ int amdgpu_vcn_jpeg_ring_test_ring(struct amdgpu_ring *ring)unsigned i;int r; -WREG32 (SOC15_REG_OFFSET (UVD ,0 , mmUVD_SCRATCH9),0xCAFEDEAD ); +WREG32 (adev->vcn.external.jpeg_pitch,0xCAFEDEAD ); r =amdgpu_ring_alloc (ring,3 ); -if (r)return r; -amdgpu_ring_write (ring, -PACKETJ (SOC15_REG_OFFSET (UVD ,0 , mmUVD_SCRATCH9),0 ,0 ,0 )); +amdgpu_ring_write (ring,PACKET0 (adev->vcn.internal.jpeg_pitch,0 ));amdgpu_ring_write (ring,0xDEADBEEF );amdgpu_ring_commit (ring);for (i =0 ; i < adev->usec_timeout; i++) { - tmp =RREG32 (SOC15_REG_OFFSET (UVD ,0 , mmUVD_SCRATCH9)); + tmp =RREG32 (adev->vcn.external.jpeg_pitch);if (tmp ==0xDEADBEEF )break ;DRM_UDELAY (1 );
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +1 -0
@@ -93,6 +93,7 @@ struct amdgpu_vcn_reg{unsigned cmd;unsigned nop;unsigned scratch9; +unsigned jpeg_pitch; };struct amdgpu_vcn {
drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c +2 -0
@@ -154,6 +154,8 @@ static int vcn_v1_0_sw_init(void *handle)return r; adev->vcn.pause_dpg_mode = vcn_v1_0_pause_dpg_mode; + adev->vcn.internal.jpeg_pitch = adev->vcn.external.jpeg_pitch = +SOC15_REG_OFFSET (UVD ,0 , mmUVD_JPEG_PITCH);return 0 ; }
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 116/459 drm/amdgpu: add JPEG2.0 decode ring ib test
In reply to a message not in the archiveFrom: Leo Liu <[email protected]>
Add internal register offset for registers involving in ib tests
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +2 -2
@@ -669,7 +669,7 @@ static int amdgpu_vcn_jpeg_set_reg(struct amdgpu_ring *ring, uint32_t handle, ib = &job->ibs[0 ]; - ib->ptr[0 ] =PACKETJ (SOC15_REG_OFFSET (UVD ,0 , mmUVD_SCRATCH9),0 ,0 ,PACKETJ_TYPE0 ); + ib->ptr[0 ] =PACKETJ (adev->vcn.internal.jpeg_pitch,0 ,0 ,PACKETJ_TYPE0 ); ib->ptr[1 ] =0xDEADBEEF ;for (i =2 ; i <16 ; i +=2 ) { ib->ptr[i] =PACKETJ (0 ,0 ,0 ,PACKETJ_TYPE6 );
@@ -715,7 +715,7 @@ int amdgpu_vcn_jpeg_ring_test_ib(struct amdgpu_ring *ring, long timeout) }for (i =0 ; i < adev->usec_timeout; i++) { - tmp =RREG32 (SOC15_REG_OFFSET (UVD ,0 , mmUVD_SCRATCH9)); + tmp =RREG32 (adev->vcn.external.jpeg_pitch);if (tmp ==0xDEADBEEF )break ;DRM_UDELAY (1 );
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx