History

accel/amdxdna: Add query functions

Add GET_INFO ioctl to retrieve hardware information, including AIE, clock, hardware context etc.

Lizhi Hou committed 1 year ago

Commit 850d71f1 parent 4fd4ca96 files · +476 −0Browse files

Unified · Split

6 files
  1. drivers/accel/amdxdna/aie2_message.c +65 −0
  2. drivers/accel/amdxdna/aie2_pci.c +222 −0
  3. drivers/accel/amdxdna/aie2_pci.h +1 −0
  4. drivers/accel/amdxdna/amdxdna_pci_drv.c +19 −0
  5. drivers/accel/amdxdna/amdxdna_pci_drv.h +3 −0
  6. include/uapi/drm/amdxdna_accel.h +166 −0
drivers/accel/amdxdna/aie2_message.c+65−0
@@ -308,6 +308,71 @@ int aie2_map_host_buf(struct amdxdna_dev_hdl *ndev, u32 context_id, u64 addr, u6 · 307 unmodified lines
308 return 0;308 return 0;
309}309}
310 310
311int aie2_query_status(struct amdxdna_dev_hdl *ndev, char __user *buf,
312 u32 size, u32 *cols_filled)
313{
314 DECLARE_AIE2_MSG(aie_column_info, MSG_OP_QUERY_COL_STATUS);
315 struct amdxdna_dev *xdna = ndev->xdna;
316 struct amdxdna_client *client;
317 struct amdxdna_hwctx *hwctx;
318 dma_addr_t dma_addr;
319 u32 aie_bitmap = 0;
320 u8 *buff_addr;
321 int next = 0;
322 int ret, idx;
323
324 buff_addr = dma_alloc_noncoherent(xdna->ddev.dev, size, &dma_addr,
325 DMA_FROM_DEVICE, GFP_KERNEL);
326 if (!buff_addr)
327 return -ENOMEM;
328
329 /* Go through each hardware context and mark the AIE columns that are active */
330 list_for_each_entry(client, &xdna->client_list, node) {
331 idx = srcu_read_lock(&client->hwctx_srcu);
332 idr_for_each_entry_continue(&client->hwctx_idr, hwctx, next)
333 aie_bitmap |= amdxdna_hwctx_col_map(hwctx);
334 srcu_read_unlock(&client->hwctx_srcu, idx);
335 }
336
337 *cols_filled = 0;
338 req.dump_buff_addr = dma_addr;
339 req.dump_buff_size = size;
340 req.num_cols = hweight32(aie_bitmap);
341 req.aie_bitmap = aie_bitmap;
342
343 drm_clflush_virt_range(buff_addr, size); /* device can access */
344 ret = aie2_send_mgmt_msg_wait(ndev, &msg);
345 if (ret) {
346 XDNA_ERR(xdna, "Error during NPU query, status %d", ret);
347 goto fail;
348 }
349
350 if (resp.status != AIE2_STATUS_SUCCESS) {
351 XDNA_ERR(xdna, "Query NPU status failed, status 0x%x", resp.status);
352 ret = -EINVAL;
353 goto fail;
354 }
355 XDNA_DBG(xdna, "Query NPU status completed");
356
357 if (size < resp.size) {
358 ret = -EINVAL;
359 XDNA_ERR(xdna, "Bad buffer size. Available: %u. Needs: %u", size, resp.size);
360 goto fail;
361 }
362
363 if (copy_to_user(buf, buff_addr, resp.size)) {
364 ret = -EFAULT;
365 XDNA_ERR(xdna, "Failed to copy NPU status to user space");
366 goto fail;
367 }
368
369 *cols_filled = aie_bitmap;
370
371fail:
372 dma_free_noncoherent(xdna->ddev.dev, size, buff_addr, dma_addr, DMA_FROM_DEVICE);
373 return ret;
374}
375
311int aie2_register_asyn_event_msg(struct amdxdna_dev_hdl *ndev, dma_addr_t addr, u32 size,376int aie2_register_asyn_event_msg(struct amdxdna_dev_hdl *ndev, dma_addr_t addr, u32 size,
312 void *handle, int (*cb)(void*, const u32 *, size_t))377 void *handle, int (*cb)(void*, const u32 *, size_t))
313{378{
drivers/accel/amdxdna/aie2_pci.c+222−0
@@ -5,6 +5,7 @@ · 4 unmodified lines
5 5
6#include <drm/amdxdna_accel.h>6#include <drm/amdxdna_accel.h>
7#include <drm/drm_device.h>7#include <drm/drm_device.h>
8#include <drm/drm_drv.h>
8#include <drm/drm_gem_shmem_helper.h>9#include <drm/drm_gem_shmem_helper.h>
9#include <drm/drm_managed.h>10#include <drm/drm_managed.h>
10#include <drm/drm_print.h>11#include <drm/drm_print.h>
@@ -525,11 +526,232 @@ static void aie2_fini(struct amdxdna_dev *xdna) · 514 unmodified lines
525 pci_free_irq_vectors(pdev);526 pci_free_irq_vectors(pdev);
526}527}
527 528
529static int aie2_get_aie_status(struct amdxdna_client *client,
530 struct amdxdna_drm_get_info *args)
531{
532 struct amdxdna_drm_query_aie_status status;
533 struct amdxdna_dev *xdna = client->xdna;
534 struct amdxdna_dev_hdl *ndev;
535 int ret;
536
537 ndev = xdna->dev_handle;
538 if (copy_from_user(&status, u64_to_user_ptr(args->buffer), sizeof(status))) {
539 XDNA_ERR(xdna, "Failed to copy AIE request into kernel");
540 return -EFAULT;
541 }
542
543 if (ndev->metadata.cols * ndev->metadata.size < status.buffer_size) {
544 XDNA_ERR(xdna, "Invalid buffer size. Given Size: %u. Need Size: %u.",
545 status.buffer_size, ndev->metadata.cols * ndev->metadata.size);
546 return -EINVAL;
547 }
548
549 ret = aie2_query_status(ndev, u64_to_user_ptr(status.buffer),
550 status.buffer_size, &status.cols_filled);
551 if (ret) {
552 XDNA_ERR(xdna, "Failed to get AIE status info. Ret: %d", ret);
553 return ret;
554 }
555
556 if (copy_to_user(u64_to_user_ptr(args->buffer), &status, sizeof(status))) {
557 XDNA_ERR(xdna, "Failed to copy AIE request info to user space");
558 return -EFAULT;
559 }
560
561 return 0;
562}
563
564static int aie2_get_aie_metadata(struct amdxdna_client *client,
565 struct amdxdna_drm_get_info *args)
566{
567 struct amdxdna_drm_query_aie_metadata *meta;
568 struct amdxdna_dev *xdna = client->xdna;
569 struct amdxdna_dev_hdl *ndev;
570 int ret = 0;
571
572 ndev = xdna->dev_handle;
573 meta = kzalloc(sizeof(*meta), GFP_KERNEL);
574 if (!meta)
575 return -ENOMEM;
576
577 meta->col_size = ndev->metadata.size;
578 meta->cols = ndev->metadata.cols;
579 meta->rows = ndev->metadata.rows;
580
581 meta->version.major = ndev->metadata.version.major;
582 meta->version.minor = ndev->metadata.version.minor;
583
584 meta->core.row_count = ndev->metadata.core.row_count;
585 meta->core.row_start = ndev->metadata.core.row_start;
586 meta->core.dma_channel_count = ndev->metadata.core.dma_channel_count;
587 meta->core.lock_count = ndev->metadata.core.lock_count;
588 meta->core.event_reg_count = ndev->metadata.core.event_reg_count;
589
590 meta->mem.row_count = ndev->metadata.mem.row_count;
591 meta->mem.row_start = ndev->metadata.mem.row_start;
592 meta->mem.dma_channel_count = ndev->metadata.mem.dma_channel_count;
593 meta->mem.lock_count = ndev->metadata.mem.lock_count;
594 meta->mem.event_reg_count = ndev->metadata.mem.event_reg_count;
595
596 meta->shim.row_count = ndev->metadata.shim.row_count;
597 meta->shim.row_start = ndev->metadata.shim.row_start;
598 meta->shim.dma_channel_count = ndev->metadata.shim.dma_channel_count;
599 meta->shim.lock_count = ndev->metadata.shim.lock_count;
600 meta->shim.event_reg_count = ndev->metadata.shim.event_reg_count;
601
602 if (copy_to_user(u64_to_user_ptr(args->buffer), meta, sizeof(*meta)))
603 ret = -EFAULT;
604
605 kfree(meta);
606 return ret;
607}
608
609static int aie2_get_aie_version(struct amdxdna_client *client,
610 struct amdxdna_drm_get_info *args)
611{
612 struct amdxdna_drm_query_aie_version version;
613 struct amdxdna_dev *xdna = client->xdna;
614 struct amdxdna_dev_hdl *ndev;
615
616 ndev = xdna->dev_handle;
617 version.major = ndev->version.major;
618 version.minor = ndev->version.minor;
619
620 if (copy_to_user(u64_to_user_ptr(args->buffer), &version, sizeof(version)))
621 return -EFAULT;
622
623 return 0;
624}
625
626static int aie2_get_clock_metadata(struct amdxdna_client *client,
627 struct amdxdna_drm_get_info *args)
628{
629 struct amdxdna_drm_query_clock_metadata *clock;
630 struct amdxdna_dev *xdna = client->xdna;
631 struct amdxdna_dev_hdl *ndev;
632 int ret = 0;
633
634 ndev = xdna->dev_handle;
635 clock = kzalloc(sizeof(*clock), GFP_KERNEL);
636 if (!clock)
637 return -ENOMEM;
638
639 memcpy(clock->mp_npu_clock.name, ndev->mp_npu_clock.name,
640 sizeof(clock->mp_npu_clock.name));
641 clock->mp_npu_clock.freq_mhz = ndev->mp_npu_clock.freq_mhz;
642 memcpy(clock->h_clock.name, ndev->h_clock.name, sizeof(clock->h_clock.name));
643 clock->h_clock.freq_mhz = ndev->h_clock.freq_mhz;
644
645 if (copy_to_user(u64_to_user_ptr(args->buffer), clock, sizeof(*clock)))
646 ret = -EFAULT;
647
648 kfree(clock);
649 return ret;
650}
651
652static int aie2_get_hwctx_status(struct amdxdna_client *client,
653 struct amdxdna_drm_get_info *args)
654{
655 struct amdxdna_drm_query_hwctx __user *buf;
656 struct amdxdna_dev *xdna = client->xdna;
657 struct amdxdna_drm_query_hwctx *tmp;
658 struct amdxdna_client *tmp_client;
659 struct amdxdna_hwctx *hwctx;
660 bool overflow = false;
661 u32 req_bytes = 0;
662 u32 hw_i = 0;
663 int ret = 0;
664 int next;
665 int idx;
666
667 drm_WARN_ON(&xdna->ddev, !mutex_is_locked(&xdna->dev_lock));
668
669 tmp = kzalloc(sizeof(*tmp), GFP_KERNEL);
670 if (!tmp)
671 return -ENOMEM;
672
673 buf = u64_to_user_ptr(args->buffer);
674 list_for_each_entry(tmp_client, &xdna->client_list, node) {
675 idx = srcu_read_lock(&tmp_client->hwctx_srcu);
676 next = 0;
677 idr_for_each_entry_continue(&tmp_client->hwctx_idr, hwctx, next) {
678 req_bytes += sizeof(*tmp);
679 if (args->buffer_size < req_bytes) {
680 /* Continue iterating to get the required size */
681 overflow = true;
682 continue;
683 }
684
685 memset(tmp, 0, sizeof(*tmp));
686 tmp->pid = tmp_client->pid;
687 tmp->context_id = hwctx->id;
688 tmp->start_col = hwctx->start_col;
689 tmp->num_col = hwctx->num_col;
690 tmp->command_submissions = hwctx->priv->seq;
691 tmp->command_completions = hwctx->priv->completed;
692
693 if (copy_to_user(&buf[hw_i], tmp, sizeof(*tmp))) {
694 ret = -EFAULT;
695 srcu_read_unlock(&tmp_client->hwctx_srcu, idx);
696 goto out;
697 }
698 hw_i++;
699 }
700 srcu_read_unlock(&tmp_client->hwctx_srcu, idx);
701 }
702
703 if (overflow) {
704 XDNA_ERR(xdna, "Invalid buffer size. Given: %u Need: %u.",
705 args->buffer_size, req_bytes);
706 ret = -EINVAL;
707 }
708
709out:
710 kfree(tmp);
711 args->buffer_size = req_bytes;
712 return ret;
713}
714
715static int aie2_get_info(struct amdxdna_client *client, struct amdxdna_drm_get_info *args)
716{
717 struct amdxdna_dev *xdna = client->xdna;
718 int ret, idx;
719
720 if (!drm_dev_enter(&xdna->ddev, &idx))
721 return -ENODEV;
722
723 switch (args->param) {
724 case DRM_AMDXDNA_QUERY_AIE_STATUS:
725 ret = aie2_get_aie_status(client, args);
726 break;
727 case DRM_AMDXDNA_QUERY_AIE_METADATA:
728 ret = aie2_get_aie_metadata(client, args);
729 break;
730 case DRM_AMDXDNA_QUERY_AIE_VERSION:
731 ret = aie2_get_aie_version(client, args);
732 break;
733 case DRM_AMDXDNA_QUERY_CLOCK_METADATA:
734 ret = aie2_get_clock_metadata(client, args);
735 break;
736 case DRM_AMDXDNA_QUERY_HW_CONTEXTS:
737 ret = aie2_get_hwctx_status(client, args);
738 break;
739 default:
740 XDNA_ERR(xdna, "Not supported request parameter %u", args->param);
741 ret = -EOPNOTSUPP;
742 }
743 XDNA_DBG(xdna, "Got param %d", args->param);
744
745 drm_dev_exit(idx);
746 return ret;
747}
748
528const struct amdxdna_dev_ops aie2_ops = {749const struct amdxdna_dev_ops aie2_ops = {
529 .init = aie2_init,750 .init = aie2_init,
530 .fini = aie2_fini,751 .fini = aie2_fini,
531 .resume = aie2_hw_start,752 .resume = aie2_hw_start,
532 .suspend = aie2_hw_stop,753 .suspend = aie2_hw_stop,
754 .get_aie_info = aie2_get_info,
533 .hwctx_init = aie2_hwctx_init,755 .hwctx_init = aie2_hwctx_init,
534 .hwctx_fini = aie2_hwctx_fini,756 .hwctx_fini = aie2_hwctx_fini,
535 .hwctx_config = aie2_hwctx_config,757 .hwctx_config = aie2_hwctx_config,
drivers/accel/amdxdna/aie2_pci.h+1−0
@@ -231,6 +231,7 @@ int aie2_query_firmware_version(struct amdxdna_dev_hdl *ndev, · 230 unmodified lines
231int aie2_create_context(struct amdxdna_dev_hdl *ndev, struct amdxdna_hwctx *hwctx);231int aie2_create_context(struct amdxdna_dev_hdl *ndev, struct amdxdna_hwctx *hwctx);
232int aie2_destroy_context(struct amdxdna_dev_hdl *ndev, struct amdxdna_hwctx *hwctx);232int aie2_destroy_context(struct amdxdna_dev_hdl *ndev, struct amdxdna_hwctx *hwctx);
233int aie2_map_host_buf(struct amdxdna_dev_hdl *ndev, u32 context_id, u64 addr, u64 size);233int aie2_map_host_buf(struct amdxdna_dev_hdl *ndev, u32 context_id, u64 addr, u64 size);
234int aie2_query_status(struct amdxdna_dev_hdl *ndev, char *buf, u32 size, u32 *cols_filled);
234int aie2_register_asyn_event_msg(struct amdxdna_dev_hdl *ndev, dma_addr_t addr, u32 size,235int aie2_register_asyn_event_msg(struct amdxdna_dev_hdl *ndev, dma_addr_t addr, u32 size,
235 void *handle, int (*cb)(void*, const u32 *, size_t));236 void *handle, int (*cb)(void*, const u32 *, size_t));
236int aie2_config_cu(struct amdxdna_hwctx *hwctx);237int aie2_config_cu(struct amdxdna_hwctx *hwctx);
drivers/accel/amdxdna/amdxdna_pci_drv.c+19−0
@@ -143,6 +143,23 @@ static int amdxdna_flush(struct file *f, fl_owner_t id) · 142 unmodified lines
143 return 0;143 return 0;
144}144}
145 145
146static int amdxdna_drm_get_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
147{
148 struct amdxdna_client *client = filp->driver_priv;
149 struct amdxdna_dev *xdna = to_xdna_dev(dev);
150 struct amdxdna_drm_get_info *args = data;
151 int ret;
152
153 if (!xdna->dev_info->ops->get_aie_info)
154 return -EOPNOTSUPP;
155
156 XDNA_DBG(xdna, "Request parameter %u", args->param);
157 mutex_lock(&xdna->dev_lock);
158 ret = xdna->dev_info->ops->get_aie_info(client, args);
159 mutex_unlock(&xdna->dev_lock);
160 return ret;
161}
162
146static const struct drm_ioctl_desc amdxdna_drm_ioctls[] = {163static const struct drm_ioctl_desc amdxdna_drm_ioctls[] = {
147 /* Context */164 /* Context */
148 DRM_IOCTL_DEF_DRV(AMDXDNA_CREATE_HWCTX, amdxdna_drm_create_hwctx_ioctl, 0),165 DRM_IOCTL_DEF_DRV(AMDXDNA_CREATE_HWCTX, amdxdna_drm_create_hwctx_ioctl, 0),
@@ -154,6 +171,8 @@ static const struct drm_ioctl_desc amdxdna_drm_ioctls[] = { · 5 unmodified lines
154 DRM_IOCTL_DEF_DRV(AMDXDNA_SYNC_BO, amdxdna_drm_sync_bo_ioctl, 0),171 DRM_IOCTL_DEF_DRV(AMDXDNA_SYNC_BO, amdxdna_drm_sync_bo_ioctl, 0),
155 /* Execution */172 /* Execution */
156 DRM_IOCTL_DEF_DRV(AMDXDNA_EXEC_CMD, amdxdna_drm_submit_cmd_ioctl, 0),173 DRM_IOCTL_DEF_DRV(AMDXDNA_EXEC_CMD, amdxdna_drm_submit_cmd_ioctl, 0),
174 /* AIE hardware */
175 DRM_IOCTL_DEF_DRV(AMDXDNA_GET_INFO, amdxdna_drm_get_info_ioctl, 0),
157};176};
158 177
159static const struct file_operations amdxdna_fops = {178static const struct file_operations amdxdna_fops = {
drivers/accel/amdxdna/amdxdna_pci_drv.h+3−0
@@ -17,7 +17,9 @@ · 16 unmodified lines
17 17
18extern const struct drm_driver amdxdna_drm_drv;18extern const struct drm_driver amdxdna_drm_drv;
19 19
20struct amdxdna_client;
20struct amdxdna_dev;21struct amdxdna_dev;
22struct amdxdna_drm_get_info;
21struct amdxdna_gem_obj;23struct amdxdna_gem_obj;
22struct amdxdna_hwctx;24struct amdxdna_hwctx;
23struct amdxdna_sched_job;25struct amdxdna_sched_job;
@@ -37,6 +39,7 @@ struct amdxdna_dev_ops { · 13 unmodified lines
37 void (*hwctx_suspend)(struct amdxdna_hwctx *hwctx);39 void (*hwctx_suspend)(struct amdxdna_hwctx *hwctx);
38 void (*hwctx_resume)(struct amdxdna_hwctx *hwctx);40 void (*hwctx_resume)(struct amdxdna_hwctx *hwctx);
39 int (*cmd_submit)(struct amdxdna_hwctx *hwctx, struct amdxdna_sched_job *job, u64 *seq);41 int (*cmd_submit)(struct amdxdna_hwctx *hwctx, struct amdxdna_sched_job *job, u64 *seq);
42 int (*get_aie_info)(struct amdxdna_client *client, struct amdxdna_drm_get_info *args);
40};43};
41 44
42/*45/*
include/uapi/drm/amdxdna_accel.h+166−0
@@ -32,6 +32,7 @@ enum amdxdna_drm_ioctl_id { · 31 unmodified lines
32 DRM_AMDXDNA_GET_BO_INFO,32 DRM_AMDXDNA_GET_BO_INFO,
33 DRM_AMDXDNA_SYNC_BO,33 DRM_AMDXDNA_SYNC_BO,
34 DRM_AMDXDNA_EXEC_CMD,34 DRM_AMDXDNA_EXEC_CMD,
35 DRM_AMDXDNA_GET_INFO,
35};36};
36 37
37/**38/**
@@ -235,6 +236,167 @@ struct amdxdna_drm_exec_cmd { · 197 unmodified lines
235 __u64 seq;236 __u64 seq;
236};237};
237 238
239/**
240 * struct amdxdna_drm_query_aie_status - Query the status of the AIE hardware
241 * @buffer: The user space buffer that will return the AIE status.
242 * @buffer_size: The size of the user space buffer.
243 * @cols_filled: A bitmap of AIE columns whose data has been returned in the buffer.
244 */
245struct amdxdna_drm_query_aie_status {
246 __u64 buffer; /* out */
247 __u32 buffer_size; /* in */
248 __u32 cols_filled; /* out */
249};
250
251/**
252 * struct amdxdna_drm_query_aie_version - Query the version of the AIE hardware
253 * @major: The major version number.
254 * @minor: The minor version number.
255 */
256struct amdxdna_drm_query_aie_version {
257 __u32 major; /* out */
258 __u32 minor; /* out */
259};
260
261/**
262 * struct amdxdna_drm_query_aie_tile_metadata - Query the metadata of AIE tile (core, mem, shim)
263 * @row_count: The number of rows.
264 * @row_start: The starting row number.
265 * @dma_channel_count: The number of dma channels.
266 * @lock_count: The number of locks.
267 * @event_reg_count: The number of events.
268 * @pad: Structure padding.
269 */
270struct amdxdna_drm_query_aie_tile_metadata {
271 __u16 row_count;
272 __u16 row_start;
273 __u16 dma_channel_count;
274 __u16 lock_count;
275 __u16 event_reg_count;
276 __u16 pad[3];
277};
278
279/**
280 * struct amdxdna_drm_query_aie_metadata - Query the metadata of the AIE hardware
281 * @col_size: The size of a column in bytes.
282 * @cols: The total number of columns.
283 * @rows: The total number of rows.
284 * @version: The version of the AIE hardware.
285 * @core: The metadata for all core tiles.
286 * @mem: The metadata for all mem tiles.
287 * @shim: The metadata for all shim tiles.
288 */
289struct amdxdna_drm_query_aie_metadata {
290 __u32 col_size;
291 __u16 cols;
292 __u16 rows;
293 struct amdxdna_drm_query_aie_version version;
294 struct amdxdna_drm_query_aie_tile_metadata core;
295 struct amdxdna_drm_query_aie_tile_metadata mem;
296 struct amdxdna_drm_query_aie_tile_metadata shim;
297};
298
299/**
300 * struct amdxdna_drm_query_clock - Metadata for a clock
301 * @name: The clock name.
302 * @freq_mhz: The clock frequency.
303 * @pad: Structure padding.
304 */
305struct amdxdna_drm_query_clock {
306 __u8 name[16];
307 __u32 freq_mhz;
308 __u32 pad;
309};
310
311/**
312 * struct amdxdna_drm_query_clock_metadata - Query metadata for clocks
313 * @mp_npu_clock: The metadata for MP-NPU clock.
314 * @h_clock: The metadata for H clock.
315 */
316struct amdxdna_drm_query_clock_metadata {
317 struct amdxdna_drm_query_clock mp_npu_clock;
318 struct amdxdna_drm_query_clock h_clock;
319};
320
321enum amdxdna_sensor_type {
322 AMDXDNA_SENSOR_TYPE_POWER
323};
324
325/**
326 * struct amdxdna_drm_query_sensor - The data for single sensor.
327 * @label: The name for a sensor.
328 * @input: The current value of the sensor.
329 * @max: The maximum value possible for the sensor.
330 * @average: The average value of the sensor.
331 * @highest: The highest recorded sensor value for this driver load for the sensor.
332 * @status: The sensor status.
333 * @units: The sensor units.
334 * @unitm: Translates value member variables into the correct unit via (pow(10, unitm) * value).
335 * @type: The sensor type from enum amdxdna_sensor_type.
336 * @pad: Structure padding.
337 */
338struct amdxdna_drm_query_sensor {
339 __u8 label[64];
340 __u32 input;
341 __u32 max;
342 __u32 average;
343 __u32 highest;
344 __u8 status[64];
345 __u8 units[16];
346 __s8 unitm;
347 __u8 type;
348 __u8 pad[6];
349};
350
351/**
352 * struct amdxdna_drm_query_hwctx - The data for single context.
353 * @context_id: The ID for this context.
354 * @start_col: The starting column for the partition assigned to this context.
355 * @num_col: The number of columns in the partition assigned to this context.
356 * @pad: Structure padding.
357 * @pid: The Process ID of the process that created this context.
358 * @command_submissions: The number of commands submitted to this context.
359 * @command_completions: The number of commands completed by this context.
360 * @migrations: The number of times this context has been moved to a different partition.
361 * @preemptions: The number of times this context has been preempted by another context in the
362 * same partition.
363 * @errors: The errors for this context.
364 */
365struct amdxdna_drm_query_hwctx {
366 __u32 context_id;
367 __u32 start_col;
368 __u32 num_col;
369 __u32 pad;
370 __s64 pid;
371 __u64 command_submissions;
372 __u64 command_completions;
373 __u64 migrations;
374 __u64 preemptions;
375 __u64 errors;
376};
377
378enum amdxdna_drm_get_param {
379 DRM_AMDXDNA_QUERY_AIE_STATUS,
380 DRM_AMDXDNA_QUERY_AIE_METADATA,
381 DRM_AMDXDNA_QUERY_AIE_VERSION,
382 DRM_AMDXDNA_QUERY_CLOCK_METADATA,
383 DRM_AMDXDNA_QUERY_SENSORS,
384 DRM_AMDXDNA_QUERY_HW_CONTEXTS,
385 DRM_AMDXDNA_NUM_GET_PARAM,
386};
387
388/**
389 * struct amdxdna_drm_get_info - Get some information from the AIE hardware.
390 * @param: Value in enum amdxdna_drm_get_param. Specifies the structure passed in the buffer.
391 * @buffer_size: Size of the input buffer. Size needed/written by the kernel.
392 * @buffer: A structure specified by the param struct member.
393 */
394struct amdxdna_drm_get_info {
395 __u32 param; /* in */
396 __u32 buffer_size; /* in/out */
397 __u64 buffer; /* in/out */
398};
399
238#define DRM_IOCTL_AMDXDNA_CREATE_HWCTX \400#define DRM_IOCTL_AMDXDNA_CREATE_HWCTX \
239 DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDXDNA_CREATE_HWCTX, \401 DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDXDNA_CREATE_HWCTX, \
240 struct amdxdna_drm_create_hwctx)402 struct amdxdna_drm_create_hwctx)
@@ -263,6 +425,10 @@ struct amdxdna_drm_exec_cmd { · 22 unmodified lines
263 DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDXDNA_EXEC_CMD, \425 DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDXDNA_EXEC_CMD, \
264 struct amdxdna_drm_exec_cmd)426 struct amdxdna_drm_exec_cmd)
265 427
428#define DRM_IOCTL_AMDXDNA_GET_INFO \
429 DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDXDNA_GET_INFO, \
430 struct amdxdna_drm_get_info)
431
266#if defined(__cplusplus)432#if defined(__cplusplus)
267} /* extern c end */433} /* extern c end */
268#endif434#endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t