Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

accel/amdxdna: Enable temporal sharing only mode

Newer firmware versions prefer temporal sharing only mode. In this mode,
the driver no longer needs to manage AIE array column allocation. Instead,
a new field, num_unused_col, is added to the hardware context creation
request to specify how many columns will not be used by this hardware
context.

Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
Link: https://patch.msgid.link/20251217191150.2145937-1-lizhi.hou@amd.com

Lizhi Hou 7818618a 3ef93841

+21 -4
+15 -3
drivers/accel/amdxdna/aie2_ctx.c
··· 468 468 struct alloc_requests *xrs_req; 469 469 int ret; 470 470 471 + if (AIE2_FEATURE_ON(xdna->dev_handle, AIE2_TEMPORAL_ONLY)) { 472 + hwctx->num_unused_col = xdna->dev_handle->total_col - hwctx->num_col; 473 + hwctx->num_col = xdna->dev_handle->total_col; 474 + return aie2_create_context(xdna->dev_handle, hwctx); 475 + } 476 + 471 477 xrs_req = kzalloc(sizeof(*xrs_req), GFP_KERNEL); 472 478 if (!xrs_req) 473 479 return -ENOMEM; ··· 505 499 struct amdxdna_dev *xdna = hwctx->client->xdna; 506 500 int ret; 507 501 508 - ret = xrs_release_resource(xdna->xrs_hdl, (uintptr_t)hwctx); 509 - if (ret) 510 - XDNA_ERR(xdna, "Release AIE resource failed, ret %d", ret); 502 + if (AIE2_FEATURE_ON(xdna->dev_handle, AIE2_TEMPORAL_ONLY)) { 503 + ret = aie2_destroy_context(xdna->dev_handle, hwctx); 504 + if (ret) 505 + XDNA_ERR(xdna, "Destroy temporal only context failed, ret %d", ret); 506 + } else { 507 + ret = xrs_release_resource(xdna->xrs_hdl, (uintptr_t)hwctx); 508 + if (ret) 509 + XDNA_ERR(xdna, "Release AIE resource failed, ret %d", ret); 510 + } 511 511 } 512 512 513 513 static int aie2_ctx_syncobj_create(struct amdxdna_hwctx *hwctx)
+1
drivers/accel/amdxdna/aie2_message.c
··· 218 218 req.aie_type = 1; 219 219 req.start_col = hwctx->start_col; 220 220 req.num_col = hwctx->num_col; 221 + req.num_unused_col = hwctx->num_unused_col; 221 222 req.num_cq_pairs_requested = 1; 222 223 req.pasid = hwctx->client->pasid; 223 224 req.context_priority = 2;
+2 -1
drivers/accel/amdxdna/aie2_msg_priv.h
··· 112 112 __u32 aie_type; 113 113 __u8 start_col; 114 114 __u8 num_col; 115 - __u16 reserved; 115 + __u8 num_unused_col; 116 + __u8 reserved; 116 117 __u8 num_cq_pairs_requested; 117 118 __u8 reserved1; 118 119 __u16 pasid;
+1
drivers/accel/amdxdna/aie2_pci.h
··· 232 232 enum aie2_fw_feature { 233 233 AIE2_NPU_COMMAND, 234 234 AIE2_PREEMPT, 235 + AIE2_TEMPORAL_ONLY, 235 236 AIE2_FEATURE_MAX 236 237 }; 237 238
+1
drivers/accel/amdxdna/amdxdna_ctx.h
··· 98 98 u32 *col_list; 99 99 u32 start_col; 100 100 u32 num_col; 101 + u32 num_unused_col; 101 102 #define HWCTX_STAT_INIT 0 102 103 #define HWCTX_STAT_READY 1 103 104 #define HWCTX_STAT_STOP 2
+1
drivers/accel/amdxdna/npu4_regs.c
··· 90 90 const struct aie2_fw_feature_tbl npu4_fw_feature_table[] = { 91 91 { .feature = AIE2_NPU_COMMAND, .min_minor = 15 }, 92 92 { .feature = AIE2_PREEMPT, .min_minor = 12 }, 93 + { .feature = AIE2_TEMPORAL_ONLY, .min_minor = 12 }, 93 94 { 0 } 94 95 }; 95 96