Commit 1db9a9dc authored by Ashutosh Dixit's avatar Ashutosh Dixit

drm/xe/oa: OA stream initialization (OAG)

Implement majority of OA stream initialization (as part of OA stream open)
ioctl). OAG buffer is allocated for receiving perf counter samples from
HW. OAG unit is initialized and the selected OA metric configuration is
programmed into OAG unit HW using a command/batch buffer.
Acked-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: default avatarUmesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Signed-off-by: default avatarAshutosh Dixit <ashutosh.dixit@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240618014609.3233427-8-ashutosh.dixit@intel.com
parent b6fd51c6
......@@ -170,6 +170,8 @@
#define SQCNT1 XE_REG_MCR(0x8718)
#define XELPMP_SQCNT1 XE_REG(0x8718)
#define SQCNT1_PMON_ENABLE REG_BIT(30)
#define SQCNT1_OABPC REG_BIT(29)
#define ENFORCE_RAR REG_BIT(23)
#define XEHP_SQCM XE_REG_MCR(0x8724)
......@@ -429,6 +431,7 @@
#define ROW_CHICKEN XE_REG_MCR(0xe4f0, XE_REG_OPTION_MASKED)
#define UGM_BACKUP_MODE REG_BIT(13)
#define MDQ_ARBITRATION_MODE REG_BIT(12)
#define STALL_DOP_GATING_DISABLE REG_BIT(5)
#define EARLY_EOT_DIS REG_BIT(1)
#define ROW_CHICKEN2 XE_REG_MCR(0xe4f4, XE_REG_OPTION_MASKED)
......
This diff is collapsed.
......@@ -14,6 +14,8 @@
#include <drm/xe_drm.h>
#include "regs/xe_reg_defs.h"
#define XE_OA_BUFFER_SIZE SZ_16M
enum xe_oa_report_header {
HDR_32_BIT = 0,
HDR_64_BIT,
......@@ -144,4 +146,81 @@ struct xe_oa {
/** @oa_unit_ids: tracks oa unit ids assigned across gt's */
u16 oa_unit_ids;
};
/** @xe_oa_buffer: State of the stream OA buffer */
struct xe_oa_buffer {
/** @format: data format */
const struct xe_oa_format *format;
/** @format: xe_bo backing the OA buffer */
struct xe_bo *bo;
/** @vaddr: mapped vaddr of the OA buffer */
u8 *vaddr;
/** @ptr_lock: Lock protecting reads/writes to head/tail pointers */
spinlock_t ptr_lock;
/** @head: Cached head to read from */
u32 head;
/** @tail: The last verified cached tail where HW has completed writing */
u32 tail;
};
/**
* struct xe_oa_stream - state for a single open stream FD
*/
struct xe_oa_stream {
/** @oa: xe_oa backpointer */
struct xe_oa *oa;
/** @gt: gt associated with the oa stream */
struct xe_gt *gt;
/** @hwe: hardware engine associated with this oa stream */
struct xe_hw_engine *hwe;
/** @stream_lock: Lock serializing stream operations */
struct mutex stream_lock;
/** @sample: true if DRM_XE_OA_PROP_SAMPLE_OA is provided */
bool sample;
/** @exec_q: Exec queue corresponding to DRM_XE_OA_PROPERTY_EXEC_QUEUE_ID */
struct xe_exec_queue *exec_q;
/** @k_exec_q: kernel exec_q used for OA programming batch submissions */
struct xe_exec_queue *k_exec_q;
/** @enabled: Whether the stream is currently enabled */
bool enabled;
/** @oa_config: OA configuration used by the stream */
struct xe_oa_config *oa_config;
/** @oa_config_bos: List of struct @xe_oa_config_bo's */
struct llist_head oa_config_bos;
/** @poll_check_timer: Timer to periodically check for data in the OA buffer */
struct hrtimer poll_check_timer;
/** @poll_wq: Wait queue for waiting for OA data to be available */
wait_queue_head_t poll_wq;
/** @pollin: Whether there is data available to read */
bool pollin;
/** @periodic: Whether periodic sampling is currently enabled */
bool periodic;
/** @period_exponent: OA unit sampling frequency is derived from this */
int period_exponent;
/** @oa_buffer: OA buffer for the stream */
struct xe_oa_buffer oa_buffer;
/** @poll_period_ns: hrtimer period for checking OA buffer for available data */
u64 poll_period_ns;
};
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment