META-DATA init packages patches v2
Subsystems (2)
cover META-DATA init packages patches v2
*** BLURB HERE ***
Monk Liu (5):
drm/amdgpu:add META_DATA struct for CSA/SRIOV v2 drm/amdgpu:implement ring_write_multiple drm/amdgpu:implement CE/DE meta-init routines drm/amdgpu:introduce new flag to identify VM domain for cntx_ctrl drm/amdgpu:in cntx_ctrl we need insert meta-init for CE/DE
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 32 +++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 3 + drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 1 + drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 76 +++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/vi.h | 112 +++++++++++++++++++++++++++++++ 5 files changed, 224 insertions(+)
Signature · 6 lines
2.7.4 _______________________________________________ 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): 1484622027-20450-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org
PATCH 1/5 drm/amdgpu:add META_DATA struct for CSA/SRIOV v2
META-DATA is used in GFX cmd submit, we have two format suit for META-DATA-init, one is legacy and another is for chained-ib preempt, which is used in vulkan UMD.
v2: drop use CP version number to judge if chain-ib supports or not, we wait for it mature
--- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 1 + drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 7 ++ drivers/gpu/drm/amd/amdgpu/vi.h | 112 +++++++++++++++++++++++++++++++ 3 files changed, 120 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +1 -0
@@ -34,6 +34,7 @@ struct amdgpu_virt {uint32_t caps;struct amdgpu_bo *csa_obj;uint64_t csa_vmid0_addr; +bool chained_ib_support; };#define AMDGPU_CSA_SIZE (8 * 1024)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +7 -0
@@ -941,6 +941,13 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) goto out; cp_hdr = (const struct gfx_firmware_header_v1_0 *)adev->gfx.me_fw->data; adev->gfx.me_fw_version =le32_to_cpu (cp_hdr->header.ucode_version); + +/* chain ib ucode isn't formal released, just disable it by far +* TODO: when ucod ready we should use ucode version to judge if +* chain-ib support or not. +*/ + adev->virt.chained_ib_support = false; + adev->gfx.me_feature_version =le32_to_cpu (cp_hdr->ucode_feature_version);snprintf (fw_name,sizeof (fw_name),"amdgpu/%s_ce.bin" , chip_name);
drivers/gpu/drm/amd/amdgpu/vi.h +112 -0
116 lines not on this page · raw message
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/5 drm/amdgpu:implement ring_write_multiple
In reply to a message not in the archive--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +31 -0
@@ -1599,6 +1599,37 @@ static inline void amdgpu_ring_write(struct amdgpu_ring *ring, uint32_t v) ring->count_dw--; } +static inline void amdgpu_ring_write_multiple (struct amdgpu_ring *ring,void *src,int count_dw) +{ +unsigned occupied, chunk1, chunk2; +void *dst; + +if (ring->count_dw < count_dw) { +DRM_ERROR ("amdgpu: writing more dwords to the ring than expected!\n" ); + }else { + occupied = ring->wptr & ring->ptr_mask; + dst = (void *)&ring->ring[occupied]; + chunk1 = ring->ptr_mask +1 - occupied; + chunk1 = (chunk1 >= count_dw) ? count_dw: chunk1; + chunk2 = count_dw - chunk1; + chunk1 <<=2 ; + chunk2 <<=2 ; + +if (chunk1) +memcpy (dst, src, chunk1); + +if (chunk2) { + src += chunk1; + dst = (void *)ring->ring; +memcpy (dst, src, chunk2); + } + + ring->wptr += count_dw; + ring->wptr &= ring->ptr_mask; + ring->count_dw -= count_dw; + } +} +static inline struct amdgpu_sdma_instance *amdgpu_get_sdma_instance (struct amdgpu_ring *ring) {
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/5 drm/amdgpu:implement CE/DE meta-init routines
In reply to a message not in the archivethose package need to insert into ring buffer for SRIOV case. they are used to let CP do preemption.
--- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 61 +++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +61 -0
@@ -657,6 +657,8 @@ static void gfx_v8_0_set_gds_init(struct amdgpu_device *adev);static void gfx_v8_0_set_rlc_funcs (struct amdgpu_device *adev);static u32 gfx_v8_0_get_csb_size (struct amdgpu_device *adev);static void gfx_v8_0_get_cu_info (struct amdgpu_device *adev); +static void gfx_v8_0_ring_emit_ce_meta_init (struct amdgpu_ring *ring,uint64_t addr); +static void gfx_v8_0_ring_emit_de_meta_init (struct amdgpu_ring *ring,uint64_t addr);static void gfx_v8_0_init_golden_registers (struct amdgpu_device *adev) {
@@ -7211,3 +7213,62 @@ const struct amdgpu_ip_block_version gfx_v8_1_ip_block = .rev = 0, .funcs = &gfx_v8_0_ip_funcs, }; + +static void gfx_v8_0_ring_emit_ce_meta_init (struct amdgpu_ring *ring,uint64_t csa_addr) +{ +uint64_t ce_payload_addr; +int cnt_ce; +static union { +struct amdgpu_ce_ib_state regular; +struct amdgpu_ce_ib_state_chained_ib chained; + } ce_payload = {0 }; + +if (ring->adev->virt.chained_ib_support) { + ce_payload_addr = csa_addr + offsetof(struct amdgpu_gfx_meta_data_chained_ib , ce_payload); + cnt_ce = (sizeof (ce_payload.chained) >>2 ) +4 -2 ; + }else { + ce_payload_addr = csa_addr + offsetof(struct amdgpu_gfx_meta_data , ce_payload); + cnt_ce = (sizeof (ce_payload.regular) >>2 ) +4 -2 ; + } + +amdgpu_ring_write (ring,PACKET3 (PACKET3_WRITE_DATA , cnt_ce)); +amdgpu_ring_write (ring, (WRITE_DATA_ENGINE_SEL (2 ) | +WRITE_DATA_DST_SEL (8 ) | +WR_CONFIRM ) | +WRITE_DATA_CACHE_POLICY (0 )); +amdgpu_ring_write (ring,lower_32_bits (ce_payload_addr)); +amdgpu_ring_write (ring,upper_32_bits (ce_payload_addr)); +amdgpu_ring_write_multiple (ring, (void *)&ce_payload, cnt_ce -2 ); +} + +static void gfx_v8_0_ring_emit_de_meta_init (struct amdgpu_ring *ring,uint64_t csa_addr) +{ +uint64_t de_payload_addr, gds_addr; +int cnt_de; +static union { +struct amdgpu_de_ib_state regular; +struct amdgpu_de_ib_state_chained_ib chained; + } de_payload = {0 }; + + gds_addr = csa_addr +4096 ; +if (ring->adev->virt.chained_ib_support) { + de_payload.chained.gds_backup_addrlo =lower_32_bits (gds_addr); + de_payload.chained.gds_backup_addrhi =upper_32_bits (gds_addr); + de_payload_addr = csa_addr + offsetof(struct amdgpu_gfx_meta_data_chained_ib , de_payload); + cnt_de = (sizeof (de_payload.chained) >>2 ) +4 -2 ; + }else { + de_payload.regular.gds_backup_addrlo =lower_32_bits (gds_addr); + de_payload.regular.gds_backup_addrhi =upper_32_bits (gds_addr); + de_payload_addr = csa_addr + offsetof(struct amdgpu_gfx_meta_data , de_payload); + cnt_de = (sizeof (de_payload.regular) >>2 ) +4 -2 ; + } + +amdgpu_ring_write (ring,PACKET3 (PACKET3_WRITE_DATA , cnt_de)); +amdgpu_ring_write (ring, (WRITE_DATA_ENGINE_SEL (1 ) | +WRITE_DATA_DST_SEL (8 ) | +WR_CONFIRM ) | +WRITE_DATA_CACHE_POLICY (0 )); +amdgpu_ring_write (ring,lower_32_bits (de_payload_addr)); +amdgpu_ring_write (ring,upper_32_bits (de_payload_addr)); +amdgpu_ring_write_multiple (ring, (void *)&de_payload, cnt_de -2 ); +}
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/5 drm/amdgpu:introduce new flag to identify VM domain for cntx_ctrl
In reply to a message not in the archive--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 3 +++ 2 files changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -953,6 +953,7 @@ struct amdgpu_cs_parser {#define AMDGPU_PREAMBLE_IB_PRESENT (1 << 0)/* bit set means command submit involves a preamble IB */ #define AMDGPU_PREAMBLE_IB_PRESENT_FIRST (1 << 1)/* bit set means preamble IB is first presented in belonging context */ #define AMDGPU_HAVE_CTX_SWITCH (1 << 2)/* bit set means context switch occured */ +#define AMDGPU_VM_DOMAIN (1 << 3)/* bit set means in virtual memory context */ struct amdgpu_job {struct amd_sched_job base;
drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +3 -0
@@ -184,6 +184,9 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs,if (need_ctx_switch) status |=AMDGPU_HAVE_CTX_SWITCH ; status |= job->preamble_status; + +if (vm) + status |=AMDGPU_VM_DOMAIN ;amdgpu_ring_emit_cntxcntl (ring, status); }
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/5 drm/amdgpu:in cntx_ctrl we need insert meta-init for CE/DE
In reply to a message not in the archiveto support SRIOV preemption.
--- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +8 -0
@@ -6703,6 +6703,10 @@ static void gfx_v8_ring_emit_cntxcntl(struct amdgpu_ring *ring, uint32_t flags) {uint32_t dw2 =0 ; +if (amdgpu_sriov_vf (ring->adev)) +gfx_v8_0_ring_emit_ce_meta_init (ring, + (flags &AMDGPU_VM_DOMAIN ) ?AMDGPU_CSA_VADDR : ring->adev->virt.csa_vmid0_addr); + dw2 |=0x80000000 ;/* set load_enable otherwise this package is just NOPs */ if (flags &AMDGPU_HAVE_CTX_SWITCH ) {gfx_v8_0_ring_emit_vgt_flush (ring);
@@ -6727,6 +6731,10 @@ static void gfx_v8_ring_emit_cntxcntl(struct amdgpu_ring *ring, uint32_t flags)amdgpu_ring_write (ring,PACKET3 (PACKET3_CONTEXT_CONTROL ,1 ));amdgpu_ring_write (ring, dw2);amdgpu_ring_write (ring,0 ); + +if (amdgpu_sriov_vf (ring->adev)) +gfx_v8_0_ring_emit_de_meta_init (ring, + (flags &AMDGPU_VM_DOMAIN ) ?AMDGPU_CSA_VADDR : ring->adev->virt.csa_vmid0_addr); } static void gfx_v8_0_set_gfx_eop_interrupt_state(struct amdgpu_device *adev,
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Patch #1 is Acked-by: Christian König <[email protected]>.
Patch #2 - #4 are Reviewed-by: Christian König <[email protected]>.
Patch #5: As Alex noted you need to update the dw estimation for gfx_v8_ring_emit_cntxcntl() as well when you add this.
With that fixed the patch is Reviewed-by: Christian König <[email protected]> as well.
Regards,
Christian.
Am 17.01.2017 um 04:00 schrieb Monk Liu:
Quoted 9 lines
*** BLURB HERE ***
Monk Liu (5):
drm/amdgpu:addMETA_DATAstruct for CSA/SRIOV v2 drm/amdgpu:implementring_write_multipledrm/amdgpu:implement CE/DE meta-init routines drm/amdgpu:introduce new flag to identify VM domain forcntx_ctrldrm/amdgpu:incntx_ctrlwe need insert meta-init for CE/DE
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 32 +++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 3 + drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 1 + drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 76 +++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/vi.h | 112 +++++++++++++++++++++++++++++++ 5 files changed, 224 insertions(+)
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx