drm/amdgpu/gfx8: add support kernel interface queue(KIQ)
Subsystems (2)
PATCH 1/1 drm/amdgpu/gfx8: add support kernel interface queue(KIQ)
KIQ is queue-memory based initialization method: setup KIQ queue firstly, then send command to KIQ to setup other queues, without accessing registers.
For virtualization, need KIQ to access virtual function registers when running on guest mode.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 13 + drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 643 +++++++++++++++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/vid.h | 2 + 3 files changed, 656 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +13 -0
@@ -186,6 +186,11 @@ enum amdgpu_thermal_irq { AMDGPU_THERMAL_IRQ_LAST }; +enum amdgpu_kiq_irq { +AMDGPU_CP_KIQ_IRQ_DRIVER0 =0 , +AMDGPU_CP_KIQ_IRQ_LAST +}; +int amdgpu_set_clockgating_state (struct amdgpu_device *adev,enum amd_ip_block_type block_type,enum amd_clockgating_state state);
@@ -778,6 +783,13 @@ struct amdgpu_mec {u32 num_queue; }; +struct amdgpu_kiq { +u64 eop_gpu_addr; +struct amdgpu_bo *eop_obj; +struct amdgpu_ring ring; +struct amdgpu_irq_src irq; +}; +/* * GPU scratch registers structures, functions & helpers */
@@ -853,6 +865,7 @@ struct amdgpu_gfx {struct amdgpu_gca_config config;struct amdgpu_rlc rlc;struct amdgpu_mec mec; +struct amdgpu_kiq kiq;struct amdgpu_scratch scratch;const struct firmware *me_fw;/* ME firmware */ uint32_t me_fw_version;
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +641 -2
728 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/vid.h +2 -0
@@ -360,6 +360,8 @@#define PACKET3_WAIT_ON_CE_COUNTER 0x86#define PACKET3_WAIT_ON_DE_COUNTER_DIFF 0x88#define PACKET3_SWITCH_BUFFER 0x8B +#define PACKET3_SET_RESOURCES 0xA0 +#define PACKET3_MAP_QUEUES 0xA2#define VCE_CMD_NO_OP 0x00000000#define VCE_CMD_END 0x00000001
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): 1482227322-2556-1-git-send-email-Xiangliang.Yu-5C7GfCeVMHo@public.gmane.org
Quoted 17 lines · Xiangliang Yu
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +17
-0+if (kiq->eop_obj ==NULL ) { + r =amdgpu_bo_create (adev, +MEC_HPD_SIZE , +PAGE_SIZE , true, +AMDGPU_GEM_DOMAIN_GTT ,0 ,NULL ,NULL , + &kiq->eop_obj); +if (r) { +dev_warn (adev->dev,"(%d) create HDP EOP bo failed\n" , r); +return r; + } + } + + r =amdgpu_bo_reserve (kiq->eop_obj, false); +if (unlikely (r !=0 )) { +gfx_v8_0_kiq_fini (adev); +return r; + }
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_mec_init(struct amdgpu_device *adev) · line 1508
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +10
-0+ + r =amdgpu_bo_pin (kiq->eop_obj,AMDGPU_GEM_DOMAIN_GTT , + &kiq->eop_gpu_addr); +if (r) { +dev_warn (adev->dev,"(%d) pin HDP EOP bo failed\n" , r); +gfx_v8_0_kiq_fini (adev); +return r; + } + + r =amdgpu_bo_kmap (kiq->eop_obj, (void **)&hpd);
you can use amdgpu_bo_create/free_kernel helper to do these.
Regards,
David Zhou
_______________________________________________
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): [email protected]
Quoted 34 lines
-----Original Message-----
From: Zhou, David(ChunMing)
Sent: Tuesday, December 20, 2016 5:49 PM
To: Yu, Xiangliang <[email protected]>; amd- [email protected]
Cc: Liu, Monk <[email protected]>
Subject: Re: [PATCH 1/1] drm/amdgpu/gfx8: add support kernel interface queue(KIQ)drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_mec_init(struct amdgpu_device *adev)
Quoted 5 lines · Xiangliang Yu
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +5
-0+if (kiq->eop_obj ==NULL ) { + r = amdgpu_bo_create(adev, + MEC_HPD_SIZE, + PAGE_SIZE, true, + AMDGPU_GEM_DOMAIN_GTT, 0, NULL,NULL,
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_mec_init(struct amdgpu_device *adev)
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +3
-0+ &kiq->eop_obj); +if (r) { + dev_warn(adev->dev, "(%d) create HDP EOP bofailed\n", r);
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +12
-0+return r; + } + } + + r =amdgpu_bo_reserve (kiq->eop_obj, false); +if (unlikely (r !=0 )) { +gfx_v8_0_kiq_fini (adev); +return r; + } + + r =amdgpu_bo_pin (kiq->eop_obj,AMDGPU_GEM_DOMAIN_GTT , + &kiq->eop_gpu_addr);
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_mec_init(struct amdgpu_device *adev) · line 1508
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +7
-0+if (r) { +dev_warn (adev->dev,"(%d) pin HDP EOP bo failed\n" , r); +gfx_v8_0_kiq_fini (adev); +return r; + } + + r =amdgpu_bo_kmap (kiq->eop_obj, (void **)&hpd);you can use amdgpu_bo_create/free_kernel helper to do these.
First I have same idea, but I find rlc_init & mec_init hasn't use this helper, I don’t know why. So just following rlc_init& mec_init behavior.
Could you tell me why not use don’t use amdpgu_bo_create/free_kerenl helper in rlc_init & mec_init?
_______________________________________________
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): CY4PR12MB17017A2AE849141C7D61EBF4EB920-rpdhrqHFk05QaJCA3gGb3wdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
Quoted 42 lines · Xiangliang
Quoted 34 lines
-----Original Message-----
From: Zhou, David(ChunMing)
Sent: Tuesday, December 20, 2016 5:49 PM
To: Yu, Xiangliang <[email protected]>; amd- [email protected]
Cc: Liu, Monk <[email protected]>
Subject: Re: [PATCH 1/1] drm/amdgpu/gfx8: add support kernel interface queue(KIQ)drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_mec_init(struct amdgpu_device *adev)
Quoted 5 lines · Xiangliang Yu
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +5
-0+if (kiq->eop_obj ==NULL ) { + r = amdgpu_bo_create(adev, + MEC_HPD_SIZE, + PAGE_SIZE, true, + AMDGPU_GEM_DOMAIN_GTT, 0, NULL,NULL,
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_mec_init(struct amdgpu_device *adev)
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +3
-0+ &kiq->eop_obj); +if (r) { + dev_warn(adev->dev, "(%d) create HDP EOP bofailed\n", r);
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +12
-0+return r; + } + } + + r =amdgpu_bo_reserve (kiq->eop_obj, false); +if (unlikely (r !=0 )) { +gfx_v8_0_kiq_fini (adev); +return r; + } + + r =amdgpu_bo_pin (kiq->eop_obj,AMDGPU_GEM_DOMAIN_GTT , + &kiq->eop_gpu_addr);Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_mec_init(struct amdgpu_device *adev) · line 1508
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +7
-0+if (r) { +dev_warn (adev->dev,"(%d) pin HDP EOP bo failed\n" , r); +gfx_v8_0_kiq_fini (adev); +return r; + } + + r =amdgpu_bo_kmap (kiq->eop_obj, (void **)&hpd);you can use amdgpu_bo_create/free_kernel helper to do these.
Quoted 3 lines
First I have same idea, but I find
rlc_init&mec_inithasn't use this helper, I don’t know why. So just following rlc_init&mec_initbehavior.Could you tell me why not use don’t use amdpgu_bo_create/free_kerenl helper in
rlc_init&mec_init?
Yeah, I realized them as well, they certainly need to use helper, which could be forgot by code creator. You can do that with a separate patch for it, that would be fine.
Regards,
David Zhou
Quoted 1 line
_______________________________________________
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): [email protected]
Quoted 56 lines
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of zhoucm1
Sent: Thursday, December 22, 2016 5:01 PM
To: Yu, Xiangliang <[email protected]>; amd- [email protected]
Cc: Liu, Monk <[email protected]>
Subject: Re: [PATCH 1/1] drm/amdgpu/gfx8: add support kernel interface queue(KIQ)Quoted 43 lines · Xiangliang
Quoted 43 lines
-----Original Message-----
From: Zhou, David(ChunMing)
Sent: Tuesday, December 20, 2016 5:49 PM
To: Yu, Xiangliang <[email protected]>; amd- [email protected]
Cc: Liu, Monk <[email protected]>
Subject: Re: [PATCH 1/1] drm/amdgpu/gfx8: add support kernel interface
queue(KIQ)Review
Quoted 5 lines · Xiangliang Yu
(quoted diff) +5
-0+ if (kiq->eop_obj == NULL) { + r = amdgpu_bo_create(adev, + MEC_HPD_SIZE, + PAGE_SIZE, true, + AMDGPU_GEM_DOMAIN_GTT, 0, NULL,NULL,
Review
Quoted 3 lines
(quoted diff) +3
-0+ &kiq->eop_obj); + if (r) { + dev_warn(adev->dev, "(%d) create HDP EOP bofailed\n", r);
Quoted 9 lines
(quoted diff) +9
-0+ return r; + } + } + + r = amdgpu_bo_reserve(kiq->eop_obj, false); + if (unlikely(r != 0)) { + gfx_v8_0_kiq_fini(adev); + return r; + }Review
Quoted 10 lines
(quoted diff) +10
-0+ + r = amdgpu_bo_pin(kiq->eop_obj, AMDGPU_GEM_DOMAIN_GTT, + &kiq->eop_gpu_addr); + if (r) { + dev_warn(adev->dev, "(%d) pin HDP EOP bo failed\n", r); + gfx_v8_0_kiq_fini(adev); + return r; + } + + r = amdgpu_bo_kmap(kiq->eop_obj, (void **)&hpd);you can use amdgpu_bo_create/free_kernel helper to do these.
Quoted 8 lines
Quoted 1 line
First I have same idea, but I find
rlc_init&mec_inithasn't use this helper, Idon’t know why. So just following rlc_init&
mec_initbehavior.Quoted 2 lines
Could you tell me why not use don’t use amdpgu_bo_create/free_kerenl
helper in
rlc_init&mec_init?
Yeah, I realized them as well, they certainly need to use helper, which could be forgot by code creator. You can do that with a separate patch for it, that would be fine.
Ok, thanks!
Quoted 5 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx