summaryrefslogtreecommitdiff
path: root/drivers/accel/amdxdna/aie2_pci.c
diff options
context:
space:
mode:
authorLizhi Hou <lizhi.hou@amd.com>2024-12-13 15:29:30 -0800
committerMario Limonciello <mario.limonciello@amd.com>2024-12-16 15:50:22 -0600
commita37d78470bcc8258a34237ec26c0abf0eb2ca4af (patch)
tree76bb6a80c91d65d223153a124c5cf026c4b8eb67 /drivers/accel/amdxdna/aie2_pci.c
parent273b5176ac178d0d890cc1785d3688dc6f8adf37 (diff)
accel/amdxdna: Replace idr api with xarray
Switch mailbox message id and hardware context id management over from the idr api to the xarray api. Signed-off-by: Lizhi Hou <lizhi.hou@amd.com> Reviewed-by: Mario Limonciello <mario.limonciello@amd.com> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20241213232933.1545388-3-lizhi.hou@amd.com
Diffstat (limited to 'drivers/accel/amdxdna/aie2_pci.c')
-rw-r--r--drivers/accel/amdxdna/aie2_pci.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/accel/amdxdna/aie2_pci.c b/drivers/accel/amdxdna/aie2_pci.c
index ebf68e3f8341..25c4215cc456 100644
--- a/drivers/accel/amdxdna/aie2_pci.c
+++ b/drivers/accel/amdxdna/aie2_pci.c
@@ -15,6 +15,7 @@
#include <linux/iommu.h>
#include <linux/iopoll.h>
#include <linux/pci.h>
+#include <linux/xarray.h>
#include "aie2_msg_priv.h"
#include "aie2_pci.h"
@@ -691,11 +692,11 @@ static int aie2_get_hwctx_status(struct amdxdna_client *client,
struct amdxdna_drm_query_hwctx *tmp;
struct amdxdna_client *tmp_client;
struct amdxdna_hwctx *hwctx;
+ unsigned long hwctx_id;
bool overflow = false;
u32 req_bytes = 0;
u32 hw_i = 0;
int ret = 0;
- int next;
int idx;
drm_WARN_ON(&xdna->ddev, !mutex_is_locked(&xdna->dev_lock));
@@ -707,8 +708,7 @@ static int aie2_get_hwctx_status(struct amdxdna_client *client,
buf = u64_to_user_ptr(args->buffer);
list_for_each_entry(tmp_client, &xdna->client_list, node) {
idx = srcu_read_lock(&tmp_client->hwctx_srcu);
- next = 0;
- idr_for_each_entry_continue(&tmp_client->hwctx_idr, hwctx, next) {
+ amdxdna_for_each_hwctx(tmp_client, hwctx_id, hwctx) {
req_bytes += sizeof(*tmp);
if (args->buffer_size < req_bytes) {
/* Continue iterating to get the required size */