From: Ashutosh Dixit <ashutosh.dixit@intel.com>
To: intel-xe@lists.freedesktop.org
Subject: [PATCH 16/17] drm/xe/oa: Changes to OA_TAKEN
Date: Mon, 17 Jun 2024 15:36:50 -0700 [thread overview]
Message-ID: <20240617223651.3220399-17-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20240617223651.3220399-1-ashutosh.dixit@intel.com>
Rename OA_TAKEN to xe_oa_circ_diff, since xe_oa_circ_diff better describes
what the macro actually does. Also convert to function and add xe_oa_stream
arg. These will be used in the following patch.
Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
---
drivers/gpu/drm/xe/xe_oa.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c
index be6502066e53..2d398b7231c1 100644
--- a/drivers/gpu/drm/xe/xe_oa.c
+++ b/drivers/gpu/drm/xe/xe_oa.c
@@ -36,7 +36,6 @@
#include "xe_pm.h"
#include "xe_sched_job.h"
-#define OA_TAKEN(tail, head) (((tail) - (head)) & (XE_OA_BUFFER_SIZE - 1))
#define DEFAULT_POLL_FREQUENCY_HZ 200
#define DEFAULT_POLL_PERIOD_NS (NSEC_PER_SEC / DEFAULT_POLL_FREQUENCY_HZ)
#define XE_OA_UNIT_INVALID U32_MAX
@@ -113,6 +112,11 @@ static const struct xe_oa_format oa_formats[] = {
[XE_OA_FORMAT_PEC36u64_G1_4_G2_32] = { 4, 320, DRM_FMT(PEC), HDR_64_BIT, 1, 0 },
};
+static u32 xe_oa_circ_diff(struct xe_oa_stream *stream, u32 tail, u32 head)
+{
+ return (tail - head) & (XE_OA_BUFFER_SIZE - 1);
+}
+
static void xe_oa_config_release(struct kref *ref)
{
struct xe_oa_config *oa_config =
@@ -217,11 +221,11 @@ static bool xe_oa_buffer_check_unlocked(struct xe_oa_stream *stream)
* increments. Also report size may not be a power of 2. Compute potential
* partially landed report in OA buffer.
*/
- partial_report_size = OA_TAKEN(hw_tail, stream->oa_buffer.tail);
+ partial_report_size = xe_oa_circ_diff(stream, hw_tail, stream->oa_buffer.tail);
partial_report_size %= report_size;
/* Subtract partial amount off the tail */
- hw_tail = OA_TAKEN(hw_tail, partial_report_size);
+ hw_tail = xe_oa_circ_diff(stream, hw_tail, partial_report_size);
tail = hw_tail;
@@ -233,24 +237,24 @@ static bool xe_oa_buffer_check_unlocked(struct xe_oa_stream *stream)
* This is assuming that the writes of the OA unit land in memory in the order
* they were written. If not : (╯°□°)╯︵ ┻━┻
*/
- while (OA_TAKEN(tail, stream->oa_buffer.tail) >= report_size) {
+ while (xe_oa_circ_diff(stream, tail, stream->oa_buffer.tail) >= report_size) {
void *report = stream->oa_buffer.vaddr + tail;
if (oa_report_id(stream, report) || oa_timestamp(stream, report))
break;
- tail = OA_TAKEN(tail, report_size);
+ tail = xe_oa_circ_diff(stream, tail, report_size);
}
- if (OA_TAKEN(hw_tail, tail) > report_size)
+ if (xe_oa_circ_diff(stream, hw_tail, tail) > report_size)
drm_dbg(&stream->oa->xe->drm,
"unlanded report(s) head=0x%x tail=0x%x hw_tail=0x%x\n",
stream->oa_buffer.head, tail, hw_tail);
stream->oa_buffer.tail = tail;
- pollin = OA_TAKEN(stream->oa_buffer.tail,
- stream->oa_buffer.head) >= report_size;
+ pollin = xe_oa_circ_diff(stream, stream->oa_buffer.tail,
+ stream->oa_buffer.head) >= report_size;
spin_unlock_irqrestore(&stream->oa_buffer.ptr_lock, flags);
@@ -323,7 +327,7 @@ static int xe_oa_append_reports(struct xe_oa_stream *stream, char __user *buf,
xe_assert(stream->oa->xe, head < XE_OA_BUFFER_SIZE && tail < XE_OA_BUFFER_SIZE);
- for (; OA_TAKEN(tail, head); head = (head + report_size) & mask) {
+ for (; xe_oa_circ_diff(stream, tail, head); head = (head + report_size) & mask) {
u8 *report = oa_buf_base + head;
ret = xe_oa_append_report(stream, buf, count, offset, report);
--
2.41.0
next prev parent reply other threads:[~2024-06-17 22:37 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-17 22:36 [PATCH v18 00/17] Add OA functionality to Xe Ashutosh Dixit
2024-06-17 22:36 ` [PATCH 01/17] drm/xe/perf/uapi: "Perf" layer to support multiple perf counter stream types Ashutosh Dixit
2024-06-17 22:36 ` [PATCH 02/17] drm/xe/perf/uapi: Add perf_stream_paranoid sysctl Ashutosh Dixit
2024-06-17 22:36 ` [PATCH 03/17] drm/xe/oa/uapi: Add OA data formats Ashutosh Dixit
2024-06-17 22:36 ` [PATCH 04/17] drm/xe/oa/uapi: Initialize OA units Ashutosh Dixit
2024-06-17 22:36 ` [PATCH 05/17] drm/xe/oa/uapi: Add/remove OA config perf ops Ashutosh Dixit
2024-06-17 22:36 ` [PATCH 06/17] drm/xe/oa/uapi: Define and parse OA stream properties Ashutosh Dixit
2024-06-17 22:36 ` [PATCH 07/17] drm/xe/oa: OA stream initialization (OAG) Ashutosh Dixit
2024-06-17 22:36 ` [PATCH 08/17] drm/xe/oa/uapi: Expose OA stream fd Ashutosh Dixit
2024-06-17 22:36 ` [PATCH 09/17] drm/xe/oa/uapi: Read file_operation Ashutosh Dixit
2024-06-17 22:36 ` [PATCH 10/17] drm/xe/oa: Add OAR support Ashutosh Dixit
2024-06-17 22:36 ` [PATCH 11/17] drm/xe/oa: Add OAC support Ashutosh Dixit
2024-06-17 22:36 ` [PATCH 12/17] drm/xe/oa/uapi: Query OA unit properties Ashutosh Dixit
2024-06-17 22:36 ` [PATCH 13/17] drm/xe/oa/uapi: OA buffer mmap Ashutosh Dixit
2024-06-17 22:36 ` [PATCH 14/17] drm/xe/oa: Add MMIO trigger support Ashutosh Dixit
2024-06-17 22:36 ` [PATCH 15/17] drm/xe/oa: Override GuC RC with OA on PVC Ashutosh Dixit
2024-06-17 22:36 ` Ashutosh Dixit [this message]
2024-06-17 22:36 ` [PATCH 17/17] drm/xe/oa: Enable Xe2+ overrun mode Ashutosh Dixit
2024-06-17 22:42 ` ✓ CI.Patch_applied: success for Add OA functionality to Xe (rev18) Patchwork
2024-06-17 22:42 ` ✗ CI.checkpatch: warning " Patchwork
2024-06-17 22:44 ` ✓ CI.KUnit: success " Patchwork
2024-06-17 22:55 ` ✓ CI.Build: " Patchwork
2024-06-17 22:57 ` ✗ CI.Hooks: failure " Patchwork
2024-06-17 22:59 ` ✓ CI.checksparse: success " Patchwork
2024-06-17 23:21 ` ✓ CI.BAT: " Patchwork
2024-06-18 16:01 ` ✗ CI.FULL: failure " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2024-06-18 1:45 [PATCH v19 00/17] Add OA functionality to Xe Ashutosh Dixit
2024-06-18 1:46 ` [PATCH 16/17] drm/xe/oa: Changes to OA_TAKEN Ashutosh Dixit
2024-06-12 2:05 [PATCH v17 00/17] Add OA functionality to Xe Ashutosh Dixit
2024-06-12 2:05 ` [PATCH 16/17] drm/xe/oa: Changes to OA_TAKEN Ashutosh Dixit
2024-06-07 20:43 [PATCH v16 00/17] Add OA functionality to Xe Ashutosh Dixit
2024-06-07 20:43 ` [PATCH 16/17] drm/xe/oa: Changes to OA_TAKEN Ashutosh Dixit
2024-05-27 1:43 [PATCH v15 00/17] Add OA functionality to Xe Ashutosh Dixit
2024-05-27 1:43 ` [PATCH 16/17] drm/xe/oa: Changes to OA_TAKEN Ashutosh Dixit
2024-05-24 19:01 [PATCH v14 00/17] Add OA functionality to Xe Ashutosh Dixit
2024-05-24 19:01 ` [PATCH 16/17] drm/xe/oa: Changes to OA_TAKEN Ashutosh Dixit
2024-03-15 1:35 [PATCH 00/17] Add OA functionality to Xe Ashutosh Dixit
2024-03-15 1:35 ` [PATCH 16/17] drm/xe/oa: Changes to OA_TAKEN Ashutosh Dixit
2024-03-12 3:40 Ashutosh Dixit
2024-03-12 19:08 ` Umesh Nerlige Ramappa
2024-03-12 3:38 [PATCH v12 00/17] Add OA functionality to Xe Ashutosh Dixit
2024-03-12 3:59 ` [PATCH 16/17] drm/xe/oa: Changes to OA_TAKEN Ashutosh Dixit
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=20240617223651.3220399-17-ashutosh.dixit@intel.com \
--to=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox