All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-xe] [PATCH v3 0/9] Dump + OOB workarounds
@ 2023-05-16 22:19 Lucas De Marchi
  2023-05-16 22:19 ` [Intel-xe] [PATCH v3 1/9] drm/xe: Fix Wa_22011802037 annotation Lucas De Marchi
                   ` (12 more replies)
  0 siblings, 13 replies; 33+ messages in thread
From: Lucas De Marchi @ 2023-05-16 22:19 UTC (permalink / raw)
  To: intel-xe; +Cc: Lucas De Marchi, Rodrigo Vivi

Third version adding OOB workarounds, third different approach.
Gone is the special ELF section and now it's implemented by
creating a new RTP struct that holds tables containing only rules,
without the actions interacting with reg-save-restore.

Now a common approach between all types of workarounds is used for
marking the "active" workarounds. These are the ones in play for the
running system.  They can be queried over debugfs and for the OOB,
are checked throughout the code. Last patch converts xe_guc.c to the
new infra.

In order to be able to implement the simpler XE_WA() requested in
previous versions, and at the same time avoiding error-prone updates
in different places of the code, a simple program was written to
generate xe_wa_oob.c and xe_wa_oob.h. The syntax is kept very simple
on purpose, with the following goals:

	1) Be similar to the rest of the workarounds. The codegen
	   just paste together the info in the .rules file
	   and updated header/source with the appropriate values
	2) Doesn't increase the build dependencies of the kernel,
	   so it's implemented in C and built as a hostprog.

Tested on a single DG2 system.

Lucas De Marchi

Lucas De Marchi (9):
  drm/xe: Fix Wa_22011802037 annotation
  drm/xe/rtp: Split rtp process initialization
  drm/xe/rtp: Add "_sr" to entry/function names
  drm/xe/rtp: Allow to track active workarounds
  drm/xe/wa: Track gt/engine/lrc active workarounds
  drm/xe/debugfs: Dump active workarounds
  drm/xe/rtp: Add support for entries with no action
  drm/xe: Add support for OOB workarounds
  drm/xe/guc: Port workarounds to OOB infra

 drivers/gpu/drm/xe/Makefile            |  14 ++
 drivers/gpu/drm/xe/tests/xe_rtp_test.c |  23 ++--
 drivers/gpu/drm/xe/xe_debugfs.c        |  12 ++
 drivers/gpu/drm/xe/xe_device.c         |   7 +
 drivers/gpu/drm/xe/xe_device_types.h   |  12 ++
 drivers/gpu/drm/xe/xe_gen_wa_oob.c     | 165 +++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_guc.c            |  49 +++----
 drivers/gpu/drm/xe/xe_hw_engine.c      |  10 +-
 drivers/gpu/drm/xe/xe_reg_whitelist.c  |   6 +-
 drivers/gpu/drm/xe/xe_rtp.c            | 180 +++++++++++++++++++++----
 drivers/gpu/drm/xe/xe_rtp.h            |  31 +++--
 drivers/gpu/drm/xe/xe_rtp_types.h      |  28 +++-
 drivers/gpu/drm/xe/xe_tuning.c         |  12 +-
 drivers/gpu/drm/xe/xe_wa.c             | 106 +++++++++++++--
 drivers/gpu/drm/xe/xe_wa.h             |  13 ++
 drivers/gpu/drm/xe/xe_wa_oob.rules     |  16 +++
 16 files changed, 584 insertions(+), 100 deletions(-)
 create mode 100644 drivers/gpu/drm/xe/xe_gen_wa_oob.c
 create mode 100644 drivers/gpu/drm/xe/xe_wa_oob.rules

-- 
2.40.1


^ permalink raw reply	[flat|nested] 33+ messages in thread
* [Intel-xe] [PATCH v5 00/21] Dump + OOB workarounds
@ 2023-05-26 16:43 Lucas De Marchi
  2023-05-26 16:58 ` [Intel-xe] ✓ CI.Patch_applied: success for " Patchwork
  0 siblings, 1 reply; 33+ messages in thread
From: Lucas De Marchi @ 2023-05-26 16:43 UTC (permalink / raw)
  To: intel-xe; +Cc: Lucas De Marchi, Matt Roper

Previous version can be seen here:
https://lore.kernel.org/intel-xe/20230525213407.3907094-1-lucas.demarchi@intel.com/

Changes in v5:
  - Fix some conditions in the WAs to match current WA database
  - Fix xe_gen_wa_oob to allow 3 or more OR'ed conditions
  - Collect r-b
  - Fix kunit build, the dumb way: sources including xe_wa_oob.h need a
    build dep on that header - all my attempts to fix it in a better way
    were not successful and there was always a race between the code
    generation and building the compilation unit. This can be improved
    later.

Lucas De Marchi (21):
  drm/xe: Fix Wa_22011802037 annotation
  drm/xe/rtp: Split rtp process initialization
  drm/xe/rtp: Replace XE_WARN_ON
  drm/xe/rtp: Add "_sr" to entry/function names
  drm/xe/rtp: Allow to track active workarounds
  drm/xe/wa: Track gt/engine/lrc active workarounds
  drm/xe/debugfs: Dump active workarounds
  drm/xe/rtp: Rename STEP to GRAPHICS_STEP
  drm/xe/rtp: Add check for media stepping
  drm/xe/rtp: Add support for entries with no action
  drm/xe: Include build directory
  drm/xe: Add support for OOB workarounds
  drm/xe/guc: Port Wa_22012773006 to xe_wa
  drm/xe/guc: Port Wa_16011759253 to xe_wa
  drm/xe/guc: Port Wa_14012197797/Wa_22011391025 to xe_wa
  drm/xe/guc: Port Wa_16011777198 to xe_wa
  drm/xe/guc: Port Wa_22012727170/Wa_22012727685 to xe_wa
  drm/xe/guc: Port Wa_16015675438/Wa_18020744125 to xe_wa
  drm/xe/guc: Port Wa_1509372804 to xe_wa
  drm/xe/rtp: Also check gt type
  drm/xe/guc: Port Wa_14014475959 to xe_wa and fix it

 drivers/gpu/drm/xe/Makefile            |  15 +-
 drivers/gpu/drm/xe/tests/xe_rtp_test.c |  23 +--
 drivers/gpu/drm/xe/xe_gen_wa_oob.c     | 165 ++++++++++++++++++++
 drivers/gpu/drm/xe/xe_gt.c             |   6 +
 drivers/gpu/drm/xe/xe_gt_debugfs.c     |  12 ++
 drivers/gpu/drm/xe/xe_gt_types.h       |  12 ++
 drivers/gpu/drm/xe/xe_guc.c            |  49 ++----
 drivers/gpu/drm/xe/xe_hw_engine.c      |  10 +-
 drivers/gpu/drm/xe/xe_reg_whitelist.c  |   6 +-
 drivers/gpu/drm/xe/xe_rtp.c            | 207 ++++++++++++++++++++-----
 drivers/gpu/drm/xe/xe_rtp.h            |  63 ++++++--
 drivers/gpu/drm/xe/xe_rtp_types.h      |  29 +++-
 drivers/gpu/drm/xe/xe_tuning.c         |  12 +-
 drivers/gpu/drm/xe/xe_wa.c             | 172 +++++++++++++++-----
 drivers/gpu/drm/xe/xe_wa.h             |  12 ++
 drivers/gpu/drm/xe/xe_wa_oob.rules     |  16 ++
 16 files changed, 662 insertions(+), 147 deletions(-)
 create mode 100644 drivers/gpu/drm/xe/xe_gen_wa_oob.c
 create mode 100644 drivers/gpu/drm/xe/xe_wa_oob.rules

-- 
2.40.1


^ permalink raw reply	[flat|nested] 33+ messages in thread
* [Intel-xe] [PATCH v4 00/21] Dump + OOB workarounds
@ 2023-05-25 21:33 Lucas De Marchi
  2023-05-25 21:38 ` [Intel-xe] ✓ CI.Patch_applied: success for " Patchwork
  0 siblings, 1 reply; 33+ messages in thread
From: Lucas De Marchi @ 2023-05-25 21:33 UTC (permalink / raw)
  To: intel-xe; +Cc: Lucas De Marchi, Matt Roper

May the fourth be with the workarounds.
Fourth version of the OOB workarounds.

Previous version can be seen here:
https://lore.kernel.org/intel-xe/20230516221950.3512818-1-lucas.demarchi@intel.com/

Changes in v4:

  - All workarounds are now tracked per gt instead of per device. This
    helps supporting new platforms with different types of GTs

  - Split the last commit to be per (group of) workaround. Original
    intention was to just port the workarounds over to the new infra
    using the same conditions as was originally in the code. As
    demonstrated by v3 and the commits here, the conditions currently
    there can't be trusted much.

  - Add commit to fix build with M=drivers/gpu/drm/xe/ since it has a
    side-effect of not including the $(obj) in the include search path.

  - Properly convert Wa_14014475959 using IP versions. This is currently
    working for DG2, but I couldn't really test on MTL. We may want to
    postpone the last 2 commits to when xe is properly loading in MTL.

Using a DG2 platform for test:
	XE_DG2 G12 56b2:0001 dgfx:1 gfx:Xe_HPG (12.55) media:Xe_HPM (12.55) ...
	Stepping = (G:A1, M:A1, D:C0, B:**)

Output:
	# cat gt0/workarounds
	GT Workarounds
		14014830051
		14015795083
		18018781329
		1509235366
		14010648519

	Engine Workarounds
		14010826681, 1606700617, 22010271021, 18019627453
		22013037850
		22014226127
		18017747507
		14015227452
		16015675438
		16011620976, 22015475538
		1509727124
		22012856258
		22010960976, 14013347512
		1608949956, 14010198302

	LRC Workarounds
		16013271637
		14014947963
		18018764978
		15010599737
		18019271663

	OOB Workarounds
		14014475959
		22011391025
		14012197797
		16015675438
		18020744125

Eventually we may want to add a node in debugfs to consolidate the WAs
for all GTs, but that is not currently needed.

Lucas De Marchi (21):
  drm/xe: Fix Wa_22011802037 annotation
  drm/xe/rtp: Split rtp process initialization
  drm/xe/rtp: Replace XE_WARN_ON
  drm/xe/rtp: Add "_sr" to entry/function names
  drm/xe/rtp: Allow to track active workarounds
  drm/xe/wa: Track gt/engine/lrc active workarounds
  drm/xe/debugfs: Dump active workarounds
  drm/xe/rtp: Rename STEP to GRAPHICS_STEP
  drm/xe/rtp: Add check for media stepping
  drm/xe/rtp: Add support for entries with no action
  drm/xe: Include build directory
  drm/xe: Add support for OOB workarounds
  drm/xe/guc: Port Wa_22012773006 to xe_wa
  drm/xe/guc: Port Wa_16011759253 to xe_wa
  drm/xe/guc: Port Wa_14012197797/Wa_22011391025 to xe_wa
  drm/xe/guc: Port Wa_16011777198 to xe_wa
  drm/xe/guc: Port Wa_22012727170/Wa_22012727685 to xe_wa
  drm/xe/guc: Port Wa_16015675438/Wa_18020744125 to xe_wa
  drm/xe/guc: Port Wa_1509372804 to xe_wa
  drm/xe/rtp: Also check gt type
  drm/xe/guc: Port Wa_14014475959 to xe_wa and fix it

 drivers/gpu/drm/xe/Makefile            |  16 +-
 drivers/gpu/drm/xe/tests/xe_rtp_test.c |  23 +--
 drivers/gpu/drm/xe/xe_gen_wa_oob.c     | 164 ++++++++++++++++++++
 drivers/gpu/drm/xe/xe_gt.c             |   6 +
 drivers/gpu/drm/xe/xe_gt_debugfs.c     |  12 ++
 drivers/gpu/drm/xe/xe_gt_types.h       |  12 ++
 drivers/gpu/drm/xe/xe_guc.c            |  49 ++----
 drivers/gpu/drm/xe/xe_hw_engine.c      |  10 +-
 drivers/gpu/drm/xe/xe_reg_whitelist.c  |   6 +-
 drivers/gpu/drm/xe/xe_rtp.c            | 207 ++++++++++++++++++++-----
 drivers/gpu/drm/xe/xe_rtp.h            |  63 ++++++--
 drivers/gpu/drm/xe/xe_rtp_types.h      |  29 +++-
 drivers/gpu/drm/xe/xe_tuning.c         |  12 +-
 drivers/gpu/drm/xe/xe_wa.c             | 172 +++++++++++++++-----
 drivers/gpu/drm/xe/xe_wa.h             |  12 ++
 drivers/gpu/drm/xe/xe_wa_oob.rules     |  16 ++
 16 files changed, 662 insertions(+), 147 deletions(-)
 create mode 100644 drivers/gpu/drm/xe/xe_gen_wa_oob.c
 create mode 100644 drivers/gpu/drm/xe/xe_wa_oob.rules

-- 
2.40.1


^ permalink raw reply	[flat|nested] 33+ messages in thread
* [Intel-xe] [RFC 0/2] Dump + OOB workarounds
@ 2023-04-12  8:20 Lucas De Marchi
  2023-04-12  8:24 ` [Intel-xe] ✓ CI.Patch_applied: success for " Patchwork
  2023-04-12 10:32 ` Patchwork
  0 siblings, 2 replies; 33+ messages in thread
From: Lucas De Marchi @ 2023-04-12  8:20 UTC (permalink / raw)
  To: intel-xe; +Cc: Matt Roper, Lucas De Marchi, Rodrigo Vivi

This is 2 RFCs in one, since they are more or less related.

PATCH #1) Dump the "driver workaround database" to check what are the
workarounds implemented. This is useful when checking against the spec
what workarounds are implemented in the driver.  This can later be
extended to mark what are the "active" workarounds on the current
platform.  I think this second scenario is more useful for the debugfs
usage.

Other alternatives I have considered:
a) Reuse the kunit infra; with this it's possible to easily fake a
platform and get what are the WAs considered "active" for a platform.
This is nice because it doesn't need to run on real hardware. However
this may be abusing what the kunit is for

b) Just write a tool in C or python that parses the section from
the .ko and output the info need. Drawback is keeping in sync the
declarations from xe_rtp with this additional tool. And probably also
that it'd need to process the rules by itself.

PATCH #2) "out-of-band" workarounds, i.e. those that are sprinkled
around the driver. In the implementation here I tried to keep the caller
similar to what it was before. With the addition of XE_WA() the caller
"registers" the workaround so later we can access it. As example I
converted 1 place in xe_guc.c to use that.

Note: The "condition" is checked each time it goes through that code
path.  I was debating the ability to just re-use XE_RTP_RULE() instead
since it appears all the conditions can be translated to rules.
Consider this the alternative (a).

After writing the commit message for that patch I thought: but if we can
transform those conditions in rules, we could very well keep them in an
additional table in xe_wa.c, which is the alternative below:

b) keep an additional table in xe_wa.c whose action is to set a
bit/byte(?)  in  xe->active_oob_workarounds[]. During probe
the rules are processed and the ones active are marked in that array.
The extra section created by XE_WA() is then used to just map
the WA to the index value. Then the callers would only need something
like `if (XE_WA(xe, "XXXXXX") { ... } ` since the condition would be
executed once on init.  However I'm thinking that this may not scale to
all workarounds we may have.

Thoughts?

thanks
Lucas De Marchi

Lucas De Marchi (2):
  drm/xe: Add debugfs to dump all known workarounds
  drm/xe: Register OOB workarounds

 drivers/gpu/drm/xe/Makefile       |  2 ++
 drivers/gpu/drm/xe/xe.lds         |  8 +++++++
 drivers/gpu/drm/xe/xe_debugfs.c   | 12 ++++++++++
 drivers/gpu/drm/xe/xe_guc.c       |  6 ++---
 drivers/gpu/drm/xe/xe_rtp_types.h |  8 +++++++
 drivers/gpu/drm/xe/xe_wa.c        | 38 +++++++++++++++++++++++++++++--
 drivers/gpu/drm/xe/xe_wa.h        | 14 ++++++++++++
 7 files changed, 83 insertions(+), 5 deletions(-)
 create mode 100644 drivers/gpu/drm/xe/xe.lds

-- 
2.39.0


^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2023-05-26 16:58 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-16 22:19 [Intel-xe] [PATCH v3 0/9] Dump + OOB workarounds Lucas De Marchi
2023-05-16 22:19 ` [Intel-xe] [PATCH v3 1/9] drm/xe: Fix Wa_22011802037 annotation Lucas De Marchi
2023-05-17 16:20   ` Matt Roper
2023-05-16 22:19 ` [Intel-xe] [PATCH v3 2/9] drm/xe/rtp: Split rtp process initialization Lucas De Marchi
2023-05-17 17:11   ` Matt Roper
2023-05-17 20:09     ` Lucas De Marchi
2023-05-16 22:19 ` [Intel-xe] [PATCH v3 3/9] drm/xe/rtp: Add "_sr" to entry/function names Lucas De Marchi
2023-05-17 17:13   ` Matt Roper
2023-05-16 22:19 ` [Intel-xe] [PATCH v3 4/9] drm/xe/rtp: Allow to track active workarounds Lucas De Marchi
2023-05-17 17:27   ` Matt Roper
2023-05-16 22:19 ` [Intel-xe] [PATCH v3 5/9] drm/xe/wa: Track gt/engine/lrc " Lucas De Marchi
2023-05-17 17:50   ` Matt Roper
2023-05-17 20:23     ` Lucas De Marchi
2023-05-25  5:11       ` Lucas De Marchi
2023-05-16 22:19 ` [Intel-xe] [PATCH v3 6/9] drm/xe/debugfs: Dump " Lucas De Marchi
2023-05-17 17:55   ` Matt Roper
2023-05-16 22:19 ` [Intel-xe] [PATCH v3 7/9] drm/xe/rtp: Add support for entries with no action Lucas De Marchi
2023-05-17 18:46   ` Matt Roper
2023-05-16 22:19 ` [Intel-xe] [PATCH v3 8/9] drm/xe: Add support for OOB workarounds Lucas De Marchi
2023-05-17 20:49   ` Matt Roper
2023-05-17 21:12     ` Lucas De Marchi
2023-05-16 22:19 ` [Intel-xe] [PATCH v3 9/9] drm/xe/guc: Port workarounds to OOB infra Lucas De Marchi
2023-05-17 21:25   ` Matt Roper
2023-05-17 22:25     ` Lucas De Marchi
2023-05-17 22:43       ` Matt Roper
2023-05-16 22:23 ` [Intel-xe] ✓ CI.Patch_applied: success for Dump + OOB workarounds Patchwork
2023-05-16 22:24 ` [Intel-xe] ✓ CI.KUnit: " Patchwork
2023-05-16 22:28 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-05-17  4:39 ` [Intel-xe] [PATCH v3 0/9] " Lucas De Marchi
  -- strict thread matches above, loose matches on Subject: below --
2023-05-26 16:43 [Intel-xe] [PATCH v5 00/21] " Lucas De Marchi
2023-05-26 16:58 ` [Intel-xe] ✓ CI.Patch_applied: success for " Patchwork
2023-05-25 21:33 [Intel-xe] [PATCH v4 00/21] " Lucas De Marchi
2023-05-25 21:38 ` [Intel-xe] ✓ CI.Patch_applied: success for " Patchwork
2023-04-12  8:20 [Intel-xe] [RFC 0/2] " Lucas De Marchi
2023-04-12  8:24 ` [Intel-xe] ✓ CI.Patch_applied: success for " Patchwork
2023-04-12 10:32 ` Patchwork

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.