162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
262306a36Sopenharmony_ci *
362306a36Sopenharmony_ci * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
462306a36Sopenharmony_ci * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
562306a36Sopenharmony_ci */
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci#ifndef QAIC_ACCEL_H_
862306a36Sopenharmony_ci#define QAIC_ACCEL_H_
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci#include "drm.h"
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci#if defined(__cplusplus)
1362306a36Sopenharmony_ciextern "C" {
1462306a36Sopenharmony_ci#endif
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci/* The length(4K) includes len and count fields of qaic_manage_msg */
1762306a36Sopenharmony_ci#define QAIC_MANAGE_MAX_MSG_LENGTH SZ_4K
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci/* semaphore flags */
2062306a36Sopenharmony_ci#define QAIC_SEM_INSYNCFENCE	2
2162306a36Sopenharmony_ci#define QAIC_SEM_OUTSYNCFENCE	1
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci/* Semaphore commands */
2462306a36Sopenharmony_ci#define QAIC_SEM_NOP		0
2562306a36Sopenharmony_ci#define QAIC_SEM_INIT		1
2662306a36Sopenharmony_ci#define QAIC_SEM_INC		2
2762306a36Sopenharmony_ci#define QAIC_SEM_DEC		3
2862306a36Sopenharmony_ci#define QAIC_SEM_WAIT_EQUAL	4
2962306a36Sopenharmony_ci#define QAIC_SEM_WAIT_GT_EQ	5 /* Greater than or equal */
3062306a36Sopenharmony_ci#define QAIC_SEM_WAIT_GT_0	6 /* Greater than 0 */
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci#define QAIC_TRANS_UNDEFINED			0
3362306a36Sopenharmony_ci#define QAIC_TRANS_PASSTHROUGH_FROM_USR		1
3462306a36Sopenharmony_ci#define QAIC_TRANS_PASSTHROUGH_TO_USR		2
3562306a36Sopenharmony_ci#define QAIC_TRANS_PASSTHROUGH_FROM_DEV		3
3662306a36Sopenharmony_ci#define QAIC_TRANS_PASSTHROUGH_TO_DEV		4
3762306a36Sopenharmony_ci#define QAIC_TRANS_DMA_XFER_FROM_USR		5
3862306a36Sopenharmony_ci#define QAIC_TRANS_DMA_XFER_TO_DEV		6
3962306a36Sopenharmony_ci#define QAIC_TRANS_ACTIVATE_FROM_USR		7
4062306a36Sopenharmony_ci#define QAIC_TRANS_ACTIVATE_FROM_DEV		8
4162306a36Sopenharmony_ci#define QAIC_TRANS_ACTIVATE_TO_DEV		9
4262306a36Sopenharmony_ci#define QAIC_TRANS_DEACTIVATE_FROM_USR		10
4362306a36Sopenharmony_ci#define QAIC_TRANS_DEACTIVATE_FROM_DEV		11
4462306a36Sopenharmony_ci#define QAIC_TRANS_STATUS_FROM_USR		12
4562306a36Sopenharmony_ci#define QAIC_TRANS_STATUS_TO_USR		13
4662306a36Sopenharmony_ci#define QAIC_TRANS_STATUS_FROM_DEV		14
4762306a36Sopenharmony_ci#define QAIC_TRANS_STATUS_TO_DEV		15
4862306a36Sopenharmony_ci#define QAIC_TRANS_TERMINATE_FROM_DEV		16
4962306a36Sopenharmony_ci#define QAIC_TRANS_TERMINATE_TO_DEV		17
5062306a36Sopenharmony_ci#define QAIC_TRANS_DMA_XFER_CONT		18
5162306a36Sopenharmony_ci#define QAIC_TRANS_VALIDATE_PARTITION_FROM_DEV	19
5262306a36Sopenharmony_ci#define QAIC_TRANS_VALIDATE_PARTITION_TO_DEV	20
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci/**
5562306a36Sopenharmony_ci * struct qaic_manage_trans_hdr - Header for a transaction in a manage message.
5662306a36Sopenharmony_ci * @type: In. Identifies this transaction. See QAIC_TRANS_* defines.
5762306a36Sopenharmony_ci * @len: In. Length of this transaction, including this header.
5862306a36Sopenharmony_ci */
5962306a36Sopenharmony_cistruct qaic_manage_trans_hdr {
6062306a36Sopenharmony_ci	__u32 type;
6162306a36Sopenharmony_ci	__u32 len;
6262306a36Sopenharmony_ci};
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ci/**
6562306a36Sopenharmony_ci * struct qaic_manage_trans_passthrough - Defines a passthrough transaction.
6662306a36Sopenharmony_ci * @hdr: In. Header to identify this transaction.
6762306a36Sopenharmony_ci * @data: In. Payload of this ransaction. Opaque to the driver. Userspace must
6862306a36Sopenharmony_ci *	  encode in little endian and align/pad to 64-bit.
6962306a36Sopenharmony_ci */
7062306a36Sopenharmony_cistruct qaic_manage_trans_passthrough {
7162306a36Sopenharmony_ci	struct qaic_manage_trans_hdr hdr;
7262306a36Sopenharmony_ci	__u8 data[];
7362306a36Sopenharmony_ci};
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ci/**
7662306a36Sopenharmony_ci * struct qaic_manage_trans_dma_xfer - Defines a DMA transfer transaction.
7762306a36Sopenharmony_ci * @hdr: In. Header to identify this transaction.
7862306a36Sopenharmony_ci * @tag: In. Identified this transfer in other transactions. Opaque to the
7962306a36Sopenharmony_ci *	 driver.
8062306a36Sopenharmony_ci * @pad: Structure padding.
8162306a36Sopenharmony_ci * @addr: In. Address of the data to DMA to the device.
8262306a36Sopenharmony_ci * @size: In. Length of the data to DMA to the device.
8362306a36Sopenharmony_ci */
8462306a36Sopenharmony_cistruct qaic_manage_trans_dma_xfer {
8562306a36Sopenharmony_ci	struct qaic_manage_trans_hdr hdr;
8662306a36Sopenharmony_ci	__u32 tag;
8762306a36Sopenharmony_ci	__u32 pad;
8862306a36Sopenharmony_ci	__u64 addr;
8962306a36Sopenharmony_ci	__u64 size;
9062306a36Sopenharmony_ci};
9162306a36Sopenharmony_ci
9262306a36Sopenharmony_ci/**
9362306a36Sopenharmony_ci * struct qaic_manage_trans_activate_to_dev - Defines an activate request.
9462306a36Sopenharmony_ci * @hdr: In. Header to identify this transaction.
9562306a36Sopenharmony_ci * @queue_size: In. Number of elements for DBC request and response queues.
9662306a36Sopenharmony_ci * @eventfd: Unused.
9762306a36Sopenharmony_ci * @options: In. Device specific options for this activate.
9862306a36Sopenharmony_ci * @pad: Structure padding.  Must be 0.
9962306a36Sopenharmony_ci */
10062306a36Sopenharmony_cistruct qaic_manage_trans_activate_to_dev {
10162306a36Sopenharmony_ci	struct qaic_manage_trans_hdr hdr;
10262306a36Sopenharmony_ci	__u32 queue_size;
10362306a36Sopenharmony_ci	__u32 eventfd;
10462306a36Sopenharmony_ci	__u32 options;
10562306a36Sopenharmony_ci	__u32 pad;
10662306a36Sopenharmony_ci};
10762306a36Sopenharmony_ci
10862306a36Sopenharmony_ci/**
10962306a36Sopenharmony_ci * struct qaic_manage_trans_activate_from_dev - Defines an activate response.
11062306a36Sopenharmony_ci * @hdr: Out. Header to identify this transaction.
11162306a36Sopenharmony_ci * @status: Out. Return code of the request from the device.
11262306a36Sopenharmony_ci * @dbc_id: Out. Id of the assigned DBC for successful request.
11362306a36Sopenharmony_ci * @options: Out. Device specific options for this activate.
11462306a36Sopenharmony_ci */
11562306a36Sopenharmony_cistruct qaic_manage_trans_activate_from_dev {
11662306a36Sopenharmony_ci	struct qaic_manage_trans_hdr hdr;
11762306a36Sopenharmony_ci	__u32 status;
11862306a36Sopenharmony_ci	__u32 dbc_id;
11962306a36Sopenharmony_ci	__u64 options;
12062306a36Sopenharmony_ci};
12162306a36Sopenharmony_ci
12262306a36Sopenharmony_ci/**
12362306a36Sopenharmony_ci * struct qaic_manage_trans_deactivate - Defines a deactivate request.
12462306a36Sopenharmony_ci * @hdr: In. Header to identify this transaction.
12562306a36Sopenharmony_ci * @dbc_id: In. Id of assigned DBC.
12662306a36Sopenharmony_ci * @pad: Structure padding.  Must be 0.
12762306a36Sopenharmony_ci */
12862306a36Sopenharmony_cistruct qaic_manage_trans_deactivate {
12962306a36Sopenharmony_ci	struct qaic_manage_trans_hdr hdr;
13062306a36Sopenharmony_ci	__u32 dbc_id;
13162306a36Sopenharmony_ci	__u32 pad;
13262306a36Sopenharmony_ci};
13362306a36Sopenharmony_ci
13462306a36Sopenharmony_ci/**
13562306a36Sopenharmony_ci * struct qaic_manage_trans_status_to_dev - Defines a status request.
13662306a36Sopenharmony_ci * @hdr: In. Header to identify this transaction.
13762306a36Sopenharmony_ci */
13862306a36Sopenharmony_cistruct qaic_manage_trans_status_to_dev {
13962306a36Sopenharmony_ci	struct qaic_manage_trans_hdr hdr;
14062306a36Sopenharmony_ci};
14162306a36Sopenharmony_ci
14262306a36Sopenharmony_ci/**
14362306a36Sopenharmony_ci * struct qaic_manage_trans_status_from_dev - Defines a status response.
14462306a36Sopenharmony_ci * @hdr: Out. Header to identify this transaction.
14562306a36Sopenharmony_ci * @major: Out. NNC protocol version major number.
14662306a36Sopenharmony_ci * @minor: Out. NNC protocol version minor number.
14762306a36Sopenharmony_ci * @status: Out. Return code from device.
14862306a36Sopenharmony_ci * @status_flags: Out. Flags from device.  Bit 0 indicates if CRCs are required.
14962306a36Sopenharmony_ci */
15062306a36Sopenharmony_cistruct qaic_manage_trans_status_from_dev {
15162306a36Sopenharmony_ci	struct qaic_manage_trans_hdr hdr;
15262306a36Sopenharmony_ci	__u16 major;
15362306a36Sopenharmony_ci	__u16 minor;
15462306a36Sopenharmony_ci	__u32 status;
15562306a36Sopenharmony_ci	__u64 status_flags;
15662306a36Sopenharmony_ci};
15762306a36Sopenharmony_ci
15862306a36Sopenharmony_ci/**
15962306a36Sopenharmony_ci * struct qaic_manage_msg - Defines a message to the device.
16062306a36Sopenharmony_ci * @len: In. Length of all the transactions contained within this message.
16162306a36Sopenharmony_ci * @count: In. Number of transactions in this message.
16262306a36Sopenharmony_ci * @data: In. Address to an array where the transactions can be found.
16362306a36Sopenharmony_ci */
16462306a36Sopenharmony_cistruct qaic_manage_msg {
16562306a36Sopenharmony_ci	__u32 len;
16662306a36Sopenharmony_ci	__u32 count;
16762306a36Sopenharmony_ci	__u64 data;
16862306a36Sopenharmony_ci};
16962306a36Sopenharmony_ci
17062306a36Sopenharmony_ci/**
17162306a36Sopenharmony_ci * struct qaic_create_bo - Defines a request to create a buffer object.
17262306a36Sopenharmony_ci * @size: In.  Size of the buffer in bytes.
17362306a36Sopenharmony_ci * @handle: Out. GEM handle for the BO.
17462306a36Sopenharmony_ci * @pad: Structure padding. Must be 0.
17562306a36Sopenharmony_ci */
17662306a36Sopenharmony_cistruct qaic_create_bo {
17762306a36Sopenharmony_ci	__u64 size;
17862306a36Sopenharmony_ci	__u32 handle;
17962306a36Sopenharmony_ci	__u32 pad;
18062306a36Sopenharmony_ci};
18162306a36Sopenharmony_ci
18262306a36Sopenharmony_ci/**
18362306a36Sopenharmony_ci * struct qaic_mmap_bo - Defines a request to prepare a BO for mmap().
18462306a36Sopenharmony_ci * @handle: In.  Handle of the GEM BO to prepare for mmap().
18562306a36Sopenharmony_ci * @pad: Structure padding. Must be 0.
18662306a36Sopenharmony_ci * @offset: Out. Offset value to provide to mmap().
18762306a36Sopenharmony_ci */
18862306a36Sopenharmony_cistruct qaic_mmap_bo {
18962306a36Sopenharmony_ci	__u32 handle;
19062306a36Sopenharmony_ci	__u32 pad;
19162306a36Sopenharmony_ci	__u64 offset;
19262306a36Sopenharmony_ci};
19362306a36Sopenharmony_ci
19462306a36Sopenharmony_ci/**
19562306a36Sopenharmony_ci * struct qaic_sem - Defines a semaphore command for a BO slice.
19662306a36Sopenharmony_ci * @val: In. Only lower 12 bits are valid.
19762306a36Sopenharmony_ci * @index: In. Only lower 5 bits are valid.
19862306a36Sopenharmony_ci * @presync: In. 1 if presync operation, 0 if postsync.
19962306a36Sopenharmony_ci * @cmd: In. One of QAIC_SEM_*.
20062306a36Sopenharmony_ci * @flags: In. Bitfield. See QAIC_SEM_INSYNCFENCE and QAIC_SEM_OUTSYNCFENCE
20162306a36Sopenharmony_ci * @pad: Structure padding.  Must be 0.
20262306a36Sopenharmony_ci */
20362306a36Sopenharmony_cistruct qaic_sem {
20462306a36Sopenharmony_ci	__u16 val;
20562306a36Sopenharmony_ci	__u8  index;
20662306a36Sopenharmony_ci	__u8  presync;
20762306a36Sopenharmony_ci	__u8  cmd;
20862306a36Sopenharmony_ci	__u8  flags;
20962306a36Sopenharmony_ci	__u16 pad;
21062306a36Sopenharmony_ci};
21162306a36Sopenharmony_ci
21262306a36Sopenharmony_ci/**
21362306a36Sopenharmony_ci * struct qaic_attach_slice_entry - Defines a single BO slice.
21462306a36Sopenharmony_ci * @size: In. Size of this slice in bytes.
21562306a36Sopenharmony_ci * @sem0: In. Semaphore command 0. Must be 0 is not valid.
21662306a36Sopenharmony_ci * @sem1: In. Semaphore command 1. Must be 0 is not valid.
21762306a36Sopenharmony_ci * @sem2: In. Semaphore command 2. Must be 0 is not valid.
21862306a36Sopenharmony_ci * @sem3: In. Semaphore command 3. Must be 0 is not valid.
21962306a36Sopenharmony_ci * @dev_addr: In. Device address this slice pushes to or pulls from.
22062306a36Sopenharmony_ci * @db_addr: In. Address of the doorbell to ring.
22162306a36Sopenharmony_ci * @db_data: In. Data to write to the doorbell.
22262306a36Sopenharmony_ci * @db_len: In. Size of the doorbell data in bits - 32, 16, or 8.  0 is for
22362306a36Sopenharmony_ci *	    inactive doorbells.
22462306a36Sopenharmony_ci * @offset: In. Start of this slice as an offset from the start of the BO.
22562306a36Sopenharmony_ci */
22662306a36Sopenharmony_cistruct qaic_attach_slice_entry {
22762306a36Sopenharmony_ci	__u64 size;
22862306a36Sopenharmony_ci	struct qaic_sem	sem0;
22962306a36Sopenharmony_ci	struct qaic_sem	sem1;
23062306a36Sopenharmony_ci	struct qaic_sem	sem2;
23162306a36Sopenharmony_ci	struct qaic_sem	sem3;
23262306a36Sopenharmony_ci	__u64 dev_addr;
23362306a36Sopenharmony_ci	__u64 db_addr;
23462306a36Sopenharmony_ci	__u32 db_data;
23562306a36Sopenharmony_ci	__u32 db_len;
23662306a36Sopenharmony_ci	__u64 offset;
23762306a36Sopenharmony_ci};
23862306a36Sopenharmony_ci
23962306a36Sopenharmony_ci/**
24062306a36Sopenharmony_ci * struct qaic_attach_slice_hdr - Defines metadata for a set of BO slices.
24162306a36Sopenharmony_ci * @count: In. Number of slices for this BO.
24262306a36Sopenharmony_ci * @dbc_id: In. Associate the sliced BO with this DBC.
24362306a36Sopenharmony_ci * @handle: In. GEM handle of the BO to slice.
24462306a36Sopenharmony_ci * @dir: In. Direction of data flow. 1 = DMA_TO_DEVICE, 2 = DMA_FROM_DEVICE
24562306a36Sopenharmony_ci * @size: In. Total length of the BO.
24662306a36Sopenharmony_ci *	  If BO is imported (DMABUF/PRIME) then this size
24762306a36Sopenharmony_ci *	  should not exceed the size of DMABUF provided.
24862306a36Sopenharmony_ci *	  If BO is allocated using DRM_IOCTL_QAIC_CREATE_BO
24962306a36Sopenharmony_ci *	  then this size should be exactly same as the size
25062306a36Sopenharmony_ci *	  provided during DRM_IOCTL_QAIC_CREATE_BO.
25162306a36Sopenharmony_ci * @dev_addr: In. Device address this slice pushes to or pulls from.
25262306a36Sopenharmony_ci * @db_addr: In. Address of the doorbell to ring.
25362306a36Sopenharmony_ci * @db_data: In. Data to write to the doorbell.
25462306a36Sopenharmony_ci * @db_len: In. Size of the doorbell data in bits - 32, 16, or 8.  0 is for
25562306a36Sopenharmony_ci *	    inactive doorbells.
25662306a36Sopenharmony_ci * @offset: In. Start of this slice as an offset from the start of the BO.
25762306a36Sopenharmony_ci */
25862306a36Sopenharmony_cistruct qaic_attach_slice_hdr {
25962306a36Sopenharmony_ci	__u32 count;
26062306a36Sopenharmony_ci	__u32 dbc_id;
26162306a36Sopenharmony_ci	__u32 handle;
26262306a36Sopenharmony_ci	__u32 dir;
26362306a36Sopenharmony_ci	__u64 size;
26462306a36Sopenharmony_ci};
26562306a36Sopenharmony_ci
26662306a36Sopenharmony_ci/**
26762306a36Sopenharmony_ci * struct qaic_attach_slice - Defines a set of BO slices.
26862306a36Sopenharmony_ci * @hdr: In. Metadata of the set of slices.
26962306a36Sopenharmony_ci * @data: In. Pointer to an array containing the slice definitions.
27062306a36Sopenharmony_ci */
27162306a36Sopenharmony_cistruct qaic_attach_slice {
27262306a36Sopenharmony_ci	struct qaic_attach_slice_hdr hdr;
27362306a36Sopenharmony_ci	__u64 data;
27462306a36Sopenharmony_ci};
27562306a36Sopenharmony_ci
27662306a36Sopenharmony_ci/**
27762306a36Sopenharmony_ci * struct qaic_execute_entry - Defines a BO to submit to the device.
27862306a36Sopenharmony_ci * @handle: In. GEM handle of the BO to commit to the device.
27962306a36Sopenharmony_ci * @dir: In. Direction of data. 1 = to device, 2 = from device.
28062306a36Sopenharmony_ci */
28162306a36Sopenharmony_cistruct qaic_execute_entry {
28262306a36Sopenharmony_ci	__u32 handle;
28362306a36Sopenharmony_ci	__u32 dir;
28462306a36Sopenharmony_ci};
28562306a36Sopenharmony_ci
28662306a36Sopenharmony_ci/**
28762306a36Sopenharmony_ci * struct qaic_partial_execute_entry - Defines a BO to resize and submit.
28862306a36Sopenharmony_ci * @handle: In. GEM handle of the BO to commit to the device.
28962306a36Sopenharmony_ci * @dir: In. Direction of data. 1 = to device, 2 = from device.
29062306a36Sopenharmony_ci * @resize: In. New size of the BO.  Must be <= the original BO size.  0 is
29162306a36Sopenharmony_ci *	    short for no resize.
29262306a36Sopenharmony_ci */
29362306a36Sopenharmony_cistruct qaic_partial_execute_entry {
29462306a36Sopenharmony_ci	__u32 handle;
29562306a36Sopenharmony_ci	__u32 dir;
29662306a36Sopenharmony_ci	__u64 resize;
29762306a36Sopenharmony_ci};
29862306a36Sopenharmony_ci
29962306a36Sopenharmony_ci/**
30062306a36Sopenharmony_ci * struct qaic_execute_hdr - Defines metadata for BO submission.
30162306a36Sopenharmony_ci * @count: In. Number of BOs to submit.
30262306a36Sopenharmony_ci * @dbc_id: In. DBC to submit the BOs on.
30362306a36Sopenharmony_ci */
30462306a36Sopenharmony_cistruct qaic_execute_hdr {
30562306a36Sopenharmony_ci	__u32 count;
30662306a36Sopenharmony_ci	__u32 dbc_id;
30762306a36Sopenharmony_ci};
30862306a36Sopenharmony_ci
30962306a36Sopenharmony_ci/**
31062306a36Sopenharmony_ci * struct qaic_execute - Defines a list of BOs to submit to the device.
31162306a36Sopenharmony_ci * @hdr: In. BO list metadata.
31262306a36Sopenharmony_ci * @data: In. Pointer to an array of BOs to submit.
31362306a36Sopenharmony_ci */
31462306a36Sopenharmony_cistruct qaic_execute {
31562306a36Sopenharmony_ci	struct qaic_execute_hdr hdr;
31662306a36Sopenharmony_ci	__u64 data;
31762306a36Sopenharmony_ci};
31862306a36Sopenharmony_ci
31962306a36Sopenharmony_ci/**
32062306a36Sopenharmony_ci * struct qaic_wait - Defines a blocking wait for BO execution.
32162306a36Sopenharmony_ci * @handle: In. GEM handle of the BO to wait on.
32262306a36Sopenharmony_ci * @timeout: In. Maximum time in ms to wait for the BO.
32362306a36Sopenharmony_ci * @dbc_id: In. DBC the BO is submitted to.
32462306a36Sopenharmony_ci * @pad: Structure padding. Must be 0.
32562306a36Sopenharmony_ci */
32662306a36Sopenharmony_cistruct qaic_wait {
32762306a36Sopenharmony_ci	__u32 handle;
32862306a36Sopenharmony_ci	__u32 timeout;
32962306a36Sopenharmony_ci	__u32 dbc_id;
33062306a36Sopenharmony_ci	__u32 pad;
33162306a36Sopenharmony_ci};
33262306a36Sopenharmony_ci
33362306a36Sopenharmony_ci/**
33462306a36Sopenharmony_ci * struct qaic_perf_stats_hdr - Defines metadata for getting BO perf info.
33562306a36Sopenharmony_ci * @count: In. Number of BOs requested.
33662306a36Sopenharmony_ci * @pad: Structure padding. Must be 0.
33762306a36Sopenharmony_ci * @dbc_id: In. DBC the BO are associated with.
33862306a36Sopenharmony_ci */
33962306a36Sopenharmony_cistruct qaic_perf_stats_hdr {
34062306a36Sopenharmony_ci	__u16 count;
34162306a36Sopenharmony_ci	__u16 pad;
34262306a36Sopenharmony_ci	__u32 dbc_id;
34362306a36Sopenharmony_ci};
34462306a36Sopenharmony_ci
34562306a36Sopenharmony_ci/**
34662306a36Sopenharmony_ci * struct qaic_perf_stats - Defines a request for getting BO perf info.
34762306a36Sopenharmony_ci * @hdr: In. Request metadata
34862306a36Sopenharmony_ci * @data: In. Pointer to array of stats structures that will receive the data.
34962306a36Sopenharmony_ci */
35062306a36Sopenharmony_cistruct qaic_perf_stats {
35162306a36Sopenharmony_ci	struct qaic_perf_stats_hdr hdr;
35262306a36Sopenharmony_ci	__u64 data;
35362306a36Sopenharmony_ci};
35462306a36Sopenharmony_ci
35562306a36Sopenharmony_ci/**
35662306a36Sopenharmony_ci * struct qaic_perf_stats_entry - Defines a BO perf info.
35762306a36Sopenharmony_ci * @handle: In. GEM handle of the BO to get perf stats for.
35862306a36Sopenharmony_ci * @queue_level_before: Out. Number of elements in the queue before this BO
35962306a36Sopenharmony_ci *			was submitted.
36062306a36Sopenharmony_ci * @num_queue_element: Out. Number of elements added to the queue to submit
36162306a36Sopenharmony_ci *		       this BO.
36262306a36Sopenharmony_ci * @submit_latency_us: Out. Time taken by the driver to submit this BO.
36362306a36Sopenharmony_ci * @device_latency_us: Out. Time taken by the device to execute this BO.
36462306a36Sopenharmony_ci * @pad: Structure padding. Must be 0.
36562306a36Sopenharmony_ci */
36662306a36Sopenharmony_cistruct qaic_perf_stats_entry {
36762306a36Sopenharmony_ci	__u32 handle;
36862306a36Sopenharmony_ci	__u32 queue_level_before;
36962306a36Sopenharmony_ci	__u32 num_queue_element;
37062306a36Sopenharmony_ci	__u32 submit_latency_us;
37162306a36Sopenharmony_ci	__u32 device_latency_us;
37262306a36Sopenharmony_ci	__u32 pad;
37362306a36Sopenharmony_ci};
37462306a36Sopenharmony_ci
37562306a36Sopenharmony_ci#define DRM_QAIC_MANAGE				0x00
37662306a36Sopenharmony_ci#define DRM_QAIC_CREATE_BO			0x01
37762306a36Sopenharmony_ci#define DRM_QAIC_MMAP_BO			0x02
37862306a36Sopenharmony_ci#define DRM_QAIC_ATTACH_SLICE_BO		0x03
37962306a36Sopenharmony_ci#define DRM_QAIC_EXECUTE_BO			0x04
38062306a36Sopenharmony_ci#define DRM_QAIC_PARTIAL_EXECUTE_BO		0x05
38162306a36Sopenharmony_ci#define DRM_QAIC_WAIT_BO			0x06
38262306a36Sopenharmony_ci#define DRM_QAIC_PERF_STATS_BO			0x07
38362306a36Sopenharmony_ci
38462306a36Sopenharmony_ci#define DRM_IOCTL_QAIC_MANAGE			DRM_IOWR(DRM_COMMAND_BASE + DRM_QAIC_MANAGE, struct qaic_manage_msg)
38562306a36Sopenharmony_ci#define DRM_IOCTL_QAIC_CREATE_BO		DRM_IOWR(DRM_COMMAND_BASE + DRM_QAIC_CREATE_BO,	struct qaic_create_bo)
38662306a36Sopenharmony_ci#define DRM_IOCTL_QAIC_MMAP_BO			DRM_IOWR(DRM_COMMAND_BASE + DRM_QAIC_MMAP_BO, struct qaic_mmap_bo)
38762306a36Sopenharmony_ci#define DRM_IOCTL_QAIC_ATTACH_SLICE_BO		DRM_IOW(DRM_COMMAND_BASE + DRM_QAIC_ATTACH_SLICE_BO, struct qaic_attach_slice)
38862306a36Sopenharmony_ci#define DRM_IOCTL_QAIC_EXECUTE_BO		DRM_IOW(DRM_COMMAND_BASE + DRM_QAIC_EXECUTE_BO,	struct qaic_execute)
38962306a36Sopenharmony_ci#define DRM_IOCTL_QAIC_PARTIAL_EXECUTE_BO	DRM_IOW(DRM_COMMAND_BASE + DRM_QAIC_PARTIAL_EXECUTE_BO,	struct qaic_execute)
39062306a36Sopenharmony_ci#define DRM_IOCTL_QAIC_WAIT_BO			DRM_IOW(DRM_COMMAND_BASE + DRM_QAIC_WAIT_BO, struct qaic_wait)
39162306a36Sopenharmony_ci#define DRM_IOCTL_QAIC_PERF_STATS_BO		DRM_IOWR(DRM_COMMAND_BASE + DRM_QAIC_PERF_STATS_BO, struct qaic_perf_stats)
39262306a36Sopenharmony_ci
39362306a36Sopenharmony_ci#if defined(__cplusplus)
39462306a36Sopenharmony_ci}
39562306a36Sopenharmony_ci#endif
39662306a36Sopenharmony_ci
39762306a36Sopenharmony_ci#endif /* QAIC_ACCEL_H_ */
398