From: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
To: Ashutosh Dixit <ashutosh.dixit@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 04/17] drm/xe/oa/uapi: Add OA data formats
Date: Mon, 18 Dec 2023 17:11:37 -0800 [thread overview]
Message-ID: <ZYDtyQDmFh/FadOm@unerlige-ril> (raw)
In-Reply-To: <20231208064329.2387604-5-ashutosh.dixit@intel.com>
On Thu, Dec 07, 2023 at 10:43:16PM -0800, Ashutosh Dixit wrote:
>Add and initialize supported OA data formats for various platforms
>(including Xe2). User can request OA data in any supported format.
>
>Bspec: 52198, 60942, 61101
>
>Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
>---
> drivers/gpu/drm/xe/xe_device_types.h | 4 ++
> drivers/gpu/drm/xe/xe_oa.c | 94 ++++++++++++++++++++++++++++
> drivers/gpu/drm/xe/xe_oa.h | 2 +
> drivers/gpu/drm/xe/xe_oa_types.h | 78 +++++++++++++++++++++++
> include/uapi/drm/xe_drm.h | 10 +++
> 5 files changed, 188 insertions(+)
> create mode 100644 drivers/gpu/drm/xe/xe_oa_types.h
>
>diff --git a/drivers/gpu/drm/xe/xe_device_types.h b/drivers/gpu/drm/xe/xe_device_types.h
>index 9a212dbdb8a49..842ca8b1a7408 100644
>--- a/drivers/gpu/drm/xe/xe_device_types.h
>+++ b/drivers/gpu/drm/xe/xe_device_types.h
>@@ -15,6 +15,7 @@
> #include "xe_devcoredump_types.h"
> #include "xe_heci_gsc.h"
> #include "xe_gt_types.h"
>+#include "xe_oa.h"
> #include "xe_platform_types.h"
> #include "xe_pt_types.h"
> #include "xe_pmu.h"
>@@ -418,6 +419,9 @@ struct xe_device {
> /** @heci_gsc: graphics security controller */
> struct xe_heci_gsc heci_gsc;
>
>+ /** @oa: oa perf counter subsystem */
>+ struct xe_oa oa;
>+
> /** @needs_flr_on_fini: requests function-reset on fini */
> bool needs_flr_on_fini;
>
>diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c
>index f4cacb4af47c5..11662a81ef6d8 100644
>--- a/drivers/gpu/drm/xe/xe_oa.c
>+++ b/drivers/gpu/drm/xe/xe_oa.c
>@@ -13,15 +13,109 @@ static u32 xe_oa_max_sample_rate = 100000;
>
> static struct ctl_table_header *sysctl_header;
>
>+#define DRM_FMT(x) DRM_XE_OA_FMT_TYPE_##x
>+
>+static const struct xe_oa_format oa_formats[] = {
>+ [XE_OA_FORMAT_C4_B8] = { 7, 64 },
>+ [XE_OA_FORMAT_A12] = { 0, 64 },
>+ [XE_OA_FORMAT_A12_B8_C8] = { 2, 128 },
>+ [XE_OA_FORMAT_A32u40_A4u32_B8_C8] = { 5, 256 },
>+ [XE_OAR_FORMAT_A32u40_A4u32_B8_C8] = { 5, 256, DRM_FMT(OAR) },
>+ [XE_OA_FORMAT_A24u40_A14u32_B8_C8] = { 5, 256 },
>+ [XE_OAC_FORMAT_A24u64_B8_C8] = { 1, 320, DRM_FMT(OAC), HDR_64_BIT },
>+ [XE_OAC_FORMAT_A22u32_R2u32_B8_C8] = { 2, 192, DRM_FMT(OAC), HDR_64_BIT },
>+ [XE_OAM_FORMAT_MPEC8u64_B8_C8] = { 1, 192, DRM_FMT(OAM_MPEC), HDR_64_BIT },
>+ [XE_OAM_FORMAT_MPEC8u32_B8_C8] = { 2, 128, DRM_FMT(OAM_MPEC), HDR_64_BIT },
>+ [XE_OA_FORMAT_PEC64u64] = { 1, 576, DRM_FMT(PEC), HDR_64_BIT, 1, 0 },
>+ [XE_OA_FORMAT_PEC64u64_B8_C8] = { 1, 640, DRM_FMT(PEC), HDR_64_BIT, 1, 1 },
>+ [XE_OA_FORMAT_PEC64u32] = { 1, 320, DRM_FMT(PEC), HDR_64_BIT },
>+ [XE_OA_FORMAT_PEC32u64_G1] = { 5, 320, DRM_FMT(PEC), HDR_64_BIT, 1, 0 },
>+ [XE_OA_FORMAT_PEC32u32_G1] = { 5, 192, DRM_FMT(PEC), HDR_64_BIT },
>+ [XE_OA_FORMAT_PEC32u64_G2] = { 6, 320, DRM_FMT(PEC), HDR_64_BIT, 1, 0 },
>+ [XE_OA_FORMAT_PEC32u32_G2] = { 6, 192, DRM_FMT(PEC), HDR_64_BIT },
>+ [XE_OA_FORMAT_PEC36u64_G1_32_G2_4] = { 3, 320, DRM_FMT(PEC), HDR_64_BIT, 1, 0 },
>+ [XE_OA_FORMAT_PEC36u64_G1_4_G2_32] = { 4, 320, DRM_FMT(PEC), HDR_64_BIT, 1, 0 },
>+};
>+
>+static void oa_format_add(struct xe_oa *oa, enum xe_oa_format_name format)
>+{
>+ __set_bit(format, oa->format_mask);
>+}
>+
>+static void xe_oa_init_supported_formats(struct xe_oa *oa)
>+{
>+ switch (oa->xe->info.platform) {
>+ case XE_TIGERLAKE:
>+ case XE_ROCKETLAKE:
>+ case XE_ALDERLAKE_S:
>+ case XE_ALDERLAKE_P:
>+ case XE_ALDERLAKE_N:
>+ case XE_DG1:
>+ oa_format_add(oa, XE_OA_FORMAT_A12);
>+ oa_format_add(oa, XE_OA_FORMAT_A12_B8_C8);
>+ oa_format_add(oa, XE_OA_FORMAT_A32u40_A4u32_B8_C8);
>+ oa_format_add(oa, XE_OA_FORMAT_C4_B8);
>+ break;
>+
>+ case XE_DG2:
>+ case XE_PVC:
>+ oa_format_add(oa, XE_OAR_FORMAT_A32u40_A4u32_B8_C8);
>+ oa_format_add(oa, XE_OA_FORMAT_A24u40_A14u32_B8_C8);
>+ oa_format_add(oa, XE_OAC_FORMAT_A24u64_B8_C8);
>+ oa_format_add(oa, XE_OAC_FORMAT_A22u32_R2u32_B8_C8);
>+ break;
>+
>+ case XE_METEORLAKE:
>+ oa_format_add(oa, XE_OAR_FORMAT_A32u40_A4u32_B8_C8);
>+ oa_format_add(oa, XE_OA_FORMAT_A24u40_A14u32_B8_C8);
>+ oa_format_add(oa, XE_OAC_FORMAT_A24u64_B8_C8);
>+ oa_format_add(oa, XE_OAC_FORMAT_A22u32_R2u32_B8_C8);
>+ oa_format_add(oa, XE_OAM_FORMAT_MPEC8u64_B8_C8);
>+ oa_format_add(oa, XE_OAM_FORMAT_MPEC8u32_B8_C8);
>+ break;
>+
>+ case XE_LUNARLAKE:
>+ oa_format_add(oa, XE_OAM_FORMAT_MPEC8u64_B8_C8);
>+ oa_format_add(oa, XE_OAM_FORMAT_MPEC8u32_B8_C8);
>+ oa_format_add(oa, XE_OA_FORMAT_PEC64u64);
>+ oa_format_add(oa, XE_OA_FORMAT_PEC64u64_B8_C8);
>+ oa_format_add(oa, XE_OA_FORMAT_PEC64u32);
>+ oa_format_add(oa, XE_OA_FORMAT_PEC32u64_G1);
>+ oa_format_add(oa, XE_OA_FORMAT_PEC32u32_G1);
>+ oa_format_add(oa, XE_OA_FORMAT_PEC32u64_G2);
>+ oa_format_add(oa, XE_OA_FORMAT_PEC32u32_G2);
>+ oa_format_add(oa, XE_OA_FORMAT_PEC36u64_G1_32_G2_4);
>+ oa_format_add(oa, XE_OA_FORMAT_PEC36u64_G1_4_G2_32);
>+ break;
>+
>+ default:
>+ drm_err(&oa->xe->drm, "Unknown platform\n");
>+ }
>+}
>+
> int xe_oa_init(struct xe_device *xe)
> {
>+ struct xe_oa *oa = &xe->oa;
>+
>+ /* Support OA only with GuC submission and Gen12+ */
>+ if (XE_WARN_ON(!xe_device_uc_enabled(xe)) || XE_WARN_ON(GRAPHICS_VER(xe) < 12))
>+ return 0;
>+
>+ oa->xe = xe;
>+ oa->oa_formats = oa_formats;
>+
> /* Choose a representative limit */
> xe_oa_sample_rate_hard_limit = xe_root_mmio_gt(xe)->info.reference_clock / 2;
>+
>+ xe_oa_init_supported_formats(oa);
> return 0;
> }
>
> void xe_oa_fini(struct xe_device *xe)
> {
>+ struct xe_oa *oa = &xe->oa;
>+
>+ oa->xe = NULL;
> }
>
> static struct ctl_table oa_ctl_table[] = {
>diff --git a/drivers/gpu/drm/xe/xe_oa.h b/drivers/gpu/drm/xe/xe_oa.h
>index 1b81330c9708b..2145c73176953 100644
>--- a/drivers/gpu/drm/xe/xe_oa.h
>+++ b/drivers/gpu/drm/xe/xe_oa.h
>@@ -6,6 +6,8 @@
> #ifndef _XE_OA_H_
> #define _XE_OA_H_
>
>+#include "xe_oa_types.h"
>+
> struct xe_device;
>
> int xe_oa_init(struct xe_device *xe);
>diff --git a/drivers/gpu/drm/xe/xe_oa_types.h b/drivers/gpu/drm/xe/xe_oa_types.h
>new file mode 100644
>index 0000000000000..3758bd2879cbb
>--- /dev/null
>+++ b/drivers/gpu/drm/xe/xe_oa_types.h
>@@ -0,0 +1,78 @@
>+/* SPDX-License-Identifier: MIT */
>+/*
>+ * Copyright © 2023 Intel Corporation
>+ */
>+
>+#ifndef _XE_OA_TYPES_H_
>+#define _XE_OA_TYPES_H__
>+
>+#include <linux/math.h>
>+#include <linux/types.h>
>+
>+enum xe_oa_report_header {
>+ HDR_32_BIT = 0,
>+ HDR_64_BIT,
>+};
>+
>+enum xe_oa_format_name {
>+ XE_OA_FORMAT_C4_B8 = 7,
7? Leaving room for old formats? Not sure if it adds any value. Do you
anticipate this driver being supported on pre-gen12? If not, IMO, we
should just start with 0 OR 1 (if you want to use 0 for some special
case.
rest of it, lgtm,
Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Umesh
>+
>+ /* Gen8+ */
>+ XE_OA_FORMAT_A12,
>+ XE_OA_FORMAT_A12_B8_C8,
>+ XE_OA_FORMAT_A32u40_A4u32_B8_C8,
>+
>+ /* DG2 */
>+ XE_OAR_FORMAT_A32u40_A4u32_B8_C8,
>+ XE_OA_FORMAT_A24u40_A14u32_B8_C8,
>+
>+ /* DG2/MTL OAC */
>+ XE_OAC_FORMAT_A24u64_B8_C8,
>+ XE_OAC_FORMAT_A22u32_R2u32_B8_C8,
>+
>+ /* MTL OAM */
>+ XE_OAM_FORMAT_MPEC8u64_B8_C8,
>+ XE_OAM_FORMAT_MPEC8u32_B8_C8,
>+
>+ /* Xe2+ */
>+ XE_OA_FORMAT_PEC64u64,
>+ XE_OA_FORMAT_PEC64u64_B8_C8,
>+ XE_OA_FORMAT_PEC64u32,
>+ XE_OA_FORMAT_PEC32u64_G1,
>+ XE_OA_FORMAT_PEC32u32_G1,
>+ XE_OA_FORMAT_PEC32u64_G2,
>+ XE_OA_FORMAT_PEC32u32_G2,
>+ XE_OA_FORMAT_PEC36u64_G1_32_G2_4,
>+ XE_OA_FORMAT_PEC36u64_G1_4_G2_32,
>+
>+ XE_OA_FORMAT_MAX,
>+};
>+
>+/**
>+ * struct xe_oa_format - Format fields for supported OA formats
>+ */
>+struct xe_oa_format {
>+ u32 counter_select;
>+ int size;
>+ int type;
>+ enum xe_oa_report_header header;
>+ u16 counter_size;
>+ u16 bc_report;
>+};
>+
>+/**
>+ * struct xe_oa - OA device level information
>+ */
>+struct xe_oa {
>+ /** @xe: back pointer to xe device */
>+ struct xe_device *xe;
>+
>+ /** @oa_formats: tracks all OA formats across platforms */
>+ const struct xe_oa_format *oa_formats;
>+
>+#define FORMAT_MASK_SIZE DIV_ROUND_UP(XE_OA_FORMAT_MAX - 1, BITS_PER_LONG)
>+
>+ /** @format_mask: tracks valid OA formats for a platform */
>+ unsigned long format_mask[FORMAT_MASK_SIZE];
>+};
>+#endif
>diff --git a/include/uapi/drm/xe_drm.h b/include/uapi/drm/xe_drm.h
>index 3539e0781d700..5bfb2d5aba12a 100644
>--- a/include/uapi/drm/xe_drm.h
>+++ b/include/uapi/drm/xe_drm.h
>@@ -1175,6 +1175,16 @@ enum drm_xe_perf_ioctls {
> DRM_XE_PERF_IOCTL_CONFIG = _IO('i', 0x2),
> };
>
>+/** enum drm_xe_oa_format_type - OA format types */
>+enum drm_xe_oa_format_type {
>+ DRM_XE_OA_FMT_TYPE_OAG,
>+ DRM_XE_OA_FMT_TYPE_OAR,
>+ DRM_XE_OA_FMT_TYPE_OAM,
>+ DRM_XE_OA_FMT_TYPE_OAC,
>+ DRM_XE_OA_FMT_TYPE_OAM_MPEC,
>+ DRM_XE_OA_FMT_TYPE_PEC,
>+};
>+
> #if defined(__cplusplus)
> }
> #endif
>-- 2.41.0
>
next prev parent reply other threads:[~2023-12-19 1:11 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-08 6:43 [PATCH v7 00/17] Add OA functionality to Xe Ashutosh Dixit
2023-12-08 6:43 ` [PATCH 01/17] drm/xe/perf/uapi: "Perf" layer to support multiple perf counter stream types Ashutosh Dixit
2023-12-08 6:43 ` [PATCH 02/17] drm/xe/perf/uapi: Add perf_stream_paranoid sysctl Ashutosh Dixit
2023-12-14 0:57 ` Umesh Nerlige Ramappa
2023-12-19 20:28 ` Dixit, Ashutosh
2024-01-20 2:35 ` Dixit, Ashutosh
2024-01-24 14:10 ` Joel Granados
2023-12-08 6:43 ` [PATCH 03/17] drm/xe/oa/uapi: Add oa_max_sample_rate sysctl Ashutosh Dixit
2023-12-14 0:58 ` Umesh Nerlige Ramappa
2024-01-20 2:36 ` Dixit, Ashutosh
2024-01-24 14:11 ` Joel Granados
2023-12-08 6:43 ` [PATCH 04/17] drm/xe/oa/uapi: Add OA data formats Ashutosh Dixit
2023-12-19 1:11 ` Umesh Nerlige Ramappa [this message]
2023-12-19 1:17 ` Dixit, Ashutosh
2023-12-08 6:43 ` [PATCH 05/17] drm/xe/oa/uapi: Initialize OA units Ashutosh Dixit
2023-12-19 16:11 ` Umesh Nerlige Ramappa
2024-01-20 2:43 ` Dixit, Ashutosh
2023-12-08 6:43 ` [PATCH 06/17] drm/xe/oa/uapi: Add/remove OA config perf ops Ashutosh Dixit
2023-12-19 19:10 ` Umesh Nerlige Ramappa
2024-01-20 2:44 ` Dixit, Ashutosh
2023-12-08 6:43 ` [PATCH 07/17] drm/xe/oa/uapi: Define and parse OA stream properties Ashutosh Dixit
2023-12-09 22:53 ` Dixit, Ashutosh
2023-12-19 2:59 ` Dixit, Ashutosh
2023-12-19 16:26 ` Umesh Nerlige Ramappa
2023-12-19 16:29 ` Lionel Landwerlin
2023-12-19 16:40 ` Umesh Nerlige Ramappa
2023-12-19 17:48 ` Lionel Landwerlin
2023-12-19 23:23 ` Umesh Nerlige Ramappa
2024-01-20 2:48 ` Dixit, Ashutosh
2023-12-08 6:43 ` [PATCH 08/17] drm/xe/oa: OA stream initialization (OAG) Ashutosh Dixit
2023-12-20 2:31 ` Umesh Nerlige Ramappa
2024-01-20 2:49 ` Dixit, Ashutosh
2023-12-08 6:43 ` [PATCH 09/17] drm/xe/oa/uapi: Expose OA stream fd Ashutosh Dixit
2023-12-20 2:52 ` Umesh Nerlige Ramappa
2024-01-20 2:50 ` Dixit, Ashutosh
2023-12-08 6:43 ` [PATCH 10/17] drm/xe/oa/uapi: Read file_operation Ashutosh Dixit
2023-12-20 3:01 ` Umesh Nerlige Ramappa
2024-01-20 2:51 ` Dixit, Ashutosh
2023-12-08 6:43 ` [PATCH 11/17] drm/xe/oa: Disable overrun mode for Xe2+ OAG Ashutosh Dixit
2023-12-20 3:05 ` Umesh Nerlige Ramappa
2024-01-20 2:51 ` Dixit, Ashutosh
2023-12-08 6:43 ` [PATCH 12/17] drm/xe/oa: Add OAR support Ashutosh Dixit
2023-12-20 4:37 ` Umesh Nerlige Ramappa
2023-12-08 6:43 ` [PATCH 13/17] drm/xe/oa: Add OAC support Ashutosh Dixit
2023-12-20 4:59 ` Umesh Nerlige Ramappa
2024-01-20 2:52 ` FIXME " Dixit, Ashutosh
2023-12-08 6:43 ` [PATCH 14/17] drm/xe/oa/uapi: Query OA unit properties Ashutosh Dixit
2023-12-23 0:40 ` Umesh Nerlige Ramappa
2024-01-20 3:10 ` Dixit, Ashutosh
2023-12-08 6:43 ` [PATCH 15/17] drm/xe/oa/uapi: OA buffer mmap Ashutosh Dixit
2023-12-23 2:39 ` Umesh Nerlige Ramappa
2024-01-20 3:11 ` Dixit, Ashutosh
2024-02-06 23:51 ` Umesh Nerlige Ramappa
2024-01-02 11:16 ` Thomas Hellström
2024-01-08 19:50 ` Umesh Nerlige Ramappa
2024-01-09 5:14 ` Dixit, Ashutosh
2023-12-08 6:43 ` [PATCH 16/17] drm/xe/oa: Add MMIO trigger support Ashutosh Dixit
2023-12-20 4:35 ` Umesh Nerlige Ramappa
2023-12-08 6:43 ` [PATCH 17/17] drm/xe/oa: Override GuC RC with OA on PVC Ashutosh Dixit
2023-12-08 9:22 ` ✗ CI.Patch_applied: failure for Add OA functionality to Xe (rev7) Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZYDtyQDmFh/FadOm@unerlige-ril \
--to=umesh.nerlige.ramappa@intel.com \
--cc=ashutosh.dixit@intel.com \
--cc=intel-xe@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.