[PATCH v2 5/8] drm/xe: move the kernel lrc from hwe to execlist port
Ilia Levi
illevi at habana.ai
Wed Jul 17 08:05:13 UTC 2024
On 10/07/2024 9:29, Niranjana Vishwanathapura wrote:
> On Thu, Jun 27, 2024 at 03:40:40PM +0300, Dani Liberman wrote:
>> From: Ilia Levi <illevi at habana.ai>
>>
>> The kernel lrc is used solely by the execlist infra.
>> We move it to the execlist port struct and initialize it only when
>> execlists are used.
>>
>
> Why is this patch part of this series?
> This patch perhaps should go ahead as a standalone patch?
>
> Niranjana
>
Ideally yes, it could be submitted as a standalone patch.
I've added this here to avoid dependency on this patch, as a later patch in
this series adds msix vector argument to xe_lrc_create. The patch allowed
the allocated msix vector to be stored in xe_execlist_port rather than in
xe_hw_engine. It is less relevant in v3, because we now use default msix
instead of a dynamically allocated one, but I left it as part of the series
for simplicity's sake.
Ilia
>> Signed-off-by: Ilia Levi <illevi at habana.ai>
>> ---
>> drivers/gpu/drm/xe/xe_execlist.c | 10 ++++++++--
>> drivers/gpu/drm/xe/xe_execlist_types.h | 2 ++
>> drivers/gpu/drm/xe/xe_hw_engine.c | 15 ++-------------
>> drivers/gpu/drm/xe/xe_hw_engine_types.h | 2 --
>> 4 files changed, 12 insertions(+), 17 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_execlist.c
>> b/drivers/gpu/drm/xe/xe_execlist.c
>> index db906117db6d..354f85b591b1 100644
>> --- a/drivers/gpu/drm/xe/xe_execlist.c
>> +++ b/drivers/gpu/drm/xe/xe_execlist.c
>> @@ -123,8 +123,8 @@ static void __xe_execlist_port_idle(struct
>> xe_execlist_port *port)
>> if (!port->running_exl)
>> return;
>>
>> - xe_lrc_write_ring(port->hwe->kernel_lrc, noop, sizeof(noop));
>> - __start_lrc(port->hwe, port->hwe->kernel_lrc, 0);
>> + xe_lrc_write_ring(port->lrc, noop, sizeof(noop));
>> + __start_lrc(port->hwe, port->lrc, 0);
>> port->running_exl = NULL;
>> }
>>
>> @@ -262,6 +262,10 @@ struct xe_execlist_port
>> *xe_execlist_port_create(struct xe_device *xe,
>>
>> port->hwe = hwe;
>>
>> + port->lrc = xe_lrc_create(hwe, NULL, SZ_16K);
>> + if (IS_ERR(port->lrc))
>> + return ERR_PTR(PTR_ERR(port->lrc));
>> +
>> spin_lock_init(&port->lock);
>> for (i = 0; i < ARRAY_SIZE(port->active); i++)
>> INIT_LIST_HEAD(&port->active[i]);
>> @@ -287,6 +291,8 @@ void xe_execlist_port_destroy(struct
>> xe_execlist_port *port)
>> spin_lock_irq(>_to_xe(port->hwe->gt)->irq.lock);
>> port->hwe->irq_handler = NULL;
>> spin_unlock_irq(>_to_xe(port->hwe->gt)->irq.lock);
>> +
>> + xe_lrc_put(port->lrc);
>> }
>>
>> static struct dma_fence *
>> diff --git a/drivers/gpu/drm/xe/xe_execlist_types.h
>> b/drivers/gpu/drm/xe/xe_execlist_types.h
>> index f94bbf4c53e4..415140936f11 100644
>> --- a/drivers/gpu/drm/xe/xe_execlist_types.h
>> +++ b/drivers/gpu/drm/xe/xe_execlist_types.h
>> @@ -27,6 +27,8 @@ struct xe_execlist_port {
>> struct xe_execlist_exec_queue *running_exl;
>>
>> struct timer_list irq_fail;
>> +
>> + struct xe_lrc *lrc;
>> };
>>
>> struct xe_execlist_exec_queue {
>> diff --git a/drivers/gpu/drm/xe/xe_hw_engine.c
>> b/drivers/gpu/drm/xe/xe_hw_engine.c
>> index 78b50d3a6501..90660d9382a0 100644
>> --- a/drivers/gpu/drm/xe/xe_hw_engine.c
>> +++ b/drivers/gpu/drm/xe/xe_hw_engine.c
>> @@ -269,7 +269,6 @@ static void hw_engine_fini(struct drm_device
>> *drm, void *arg)
>>
>> if (hwe->exl_port)
>> xe_execlist_port_destroy(hwe->exl_port);
>> - xe_lrc_put(hwe->kernel_lrc);
>>
>> hwe->gt = NULL;
>> }
>> @@ -528,21 +527,13 @@ static int hw_engine_init(struct xe_gt *gt,
>> struct xe_hw_engine *hwe,
>> goto err_name;
>> }
>>
>> - hwe->kernel_lrc = xe_lrc_create(hwe, NULL, SZ_16K);
>> - if (IS_ERR(hwe->kernel_lrc)) {
>> - err = PTR_ERR(hwe->kernel_lrc);
>> - goto err_hwsp;
>> - }
>> -
>> if (!xe_device_uc_enabled(xe)) {
>> hwe->exl_port = xe_execlist_port_create(xe, hwe);
>> if (IS_ERR(hwe->exl_port)) {
>> err = PTR_ERR(hwe->exl_port);
>> - goto err_kernel_lrc;
>> + goto err_hwsp;
>> }
>> - }
>> -
>> - if (xe_device_uc_enabled(xe)) {
>> + } else {
>> /* GSCCS has a special interrupt for reset */
>> if (hwe->class == XE_ENGINE_CLASS_OTHER)
>> hwe->irq_handler = xe_gsc_hwe_irq_handler;
>> @@ -557,8 +548,6 @@ static int hw_engine_init(struct xe_gt *gt,
>> struct xe_hw_engine *hwe,
>>
>> return drmm_add_action_or_reset(&xe->drm, hw_engine_fini, hwe);
>>
>> -err_kernel_lrc:
>> - xe_lrc_put(hwe->kernel_lrc);
>> err_hwsp:
>> xe_bo_unpin_map_no_vm(hwe->hwsp);
>> err_name:
>> diff --git a/drivers/gpu/drm/xe/xe_hw_engine_types.h
>> b/drivers/gpu/drm/xe/xe_hw_engine_types.h
>> index 70e6434f150d..2b74dd1098a7 100644
>> --- a/drivers/gpu/drm/xe/xe_hw_engine_types.h
>> +++ b/drivers/gpu/drm/xe/xe_hw_engine_types.h
>> @@ -136,8 +136,6 @@ struct xe_hw_engine {
>> enum xe_force_wake_domains domain;
>> /** @hwsp: hardware status page buffer object */
>> struct xe_bo *hwsp;
>> - /** @kernel_lrc: Kernel LRC (should be replaced /w an xe_engine) */
>> - struct xe_lrc *kernel_lrc;
>> /** @exl_port: execlists port */
>> struct xe_execlist_port *exl_port;
>> /** @fence_irq: fence IRQ to run when a hw engine IRQ is received */
>> --
>> 2.34.1
>>
More information about the Intel-xe
mailing list