Move TLB invalidation code for its own file and document it
Subsystems (2)
cover Move TLB invalidation code for its own file and document it
There are more things to be added to TLB invalidation. Before doing that, move the code to its own file, and add the relevant documentation.
Chris Wilson (1):
drm/i915/gt: Move TLB invalidation to its own file
Mauro Carvalho Chehab (1):
drm/i915/gt: document TLB cache invalidation functions
drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/gem/i915_gem_pages.c | 4 +- drivers/gpu/drm/i915/gt/intel_gt.c | 168 +---------------- drivers/gpu/drm/i915/gt/intel_gt.h | 12 -- drivers/gpu/drm/i915/gt/intel_tlb.c | 208 ++++++++++++++++++++++ drivers/gpu/drm/i915/gt/intel_tlb.h | 112 ++++++++++++ drivers/gpu/drm/i915/i915_vma.c | 1 + 7 files changed, 327 insertions(+), 179 deletions(-) create mode 100644 drivers/gpu/drm/i915/gt/intel_tlb.c create mode 100644 drivers/gpu/drm/i915/gt/intel_tlb.h
Signature · 1 line
2.36.1
PATCH 1/2 drm/i915/gt: Move TLB invalidation to its own file
From: Chris Wilson <[email protected]>
Prepare for supporting more TLB invalidation scenarios by moving the current MMIO invalidation to its own file.
---
To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover. See [PATCH 0/2] at: https://lore.kernel.org/all/[email protected]/
drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/gem/i915_gem_pages.c | 4 +- drivers/gpu/drm/i915/gt/intel_gt.c | 168 +------------------- drivers/gpu/drm/i915/gt/intel_gt.h | 12 -- drivers/gpu/drm/i915/gt/intel_tlb.c | 183 ++++++++++++++++++++++ drivers/gpu/drm/i915/gt/intel_tlb.h | 29 ++++ drivers/gpu/drm/i915/i915_vma.c | 1 + 7 files changed, 219 insertions(+), 179 deletions(-) create mode 100644 drivers/gpu/drm/i915/gt/intel_tlb.c create mode 100644 drivers/gpu/drm/i915/gt/intel_tlb.h
drivers/gpu/drm/i915/Makefile +1 -0
@@ -126,6 +126,7 @@ gt-y += \ gt/intel_sseu.o \ gt/intel_sseu_debugfs.o \ gt/intel_timeline.o \ + gt/intel_tlb.o \ gt/intel_workarounds.o \ gt/shmem_utils.o \ gt/sysfs_engines.o
drivers/gpu/drm/i915/gem/i915_gem_pages.c +2 -2
@@ -7,7 +7,7 @@#include <drm/drm_cache.h> #include "gt/intel_gt.h" -#include "gt/intel_gt_pm.h" +#include "gt/intel_tlb.h" #include "i915_drv.h" #include "i915_gem_object.h"
@@ -199,7 +199,7 @@ static void flush_tlb_invalidate(struct drm_i915_gem_object *obj)if (!obj->mm.tlb)return ; -intel_gt_invalidate_tlb (gt, obj->mm.tlb); +intel_gt_invalidate_tlb_full (gt, obj->mm.tlb); obj->mm.tlb =0 ; }
drivers/gpu/drm/i915/gt/intel_gt.c +3 -165
196 lines not on this page · raw message
drivers/gpu/drm/i915/gt/intel_gt.h +0 -12
@@ -101,16 +101,4 @@ void intel_gt_info_print(const struct intel_gt_info *info,void intel_gt_watchdog_work (struct work_struct *work); -static inline u32 intel_gt_tlb_seqno (const struct intel_gt *gt) -{ -return seqprop_sequence (>->tlb.seqno); -} - -static inline u32 intel_gt_next_invalidate_tlb_full (const struct intel_gt *gt) -{ -return intel_gt_tlb_seqno (gt) |1 ; -} - -void intel_gt_invalidate_tlb (struct intel_gt *gt,u32 seqno); -#endif /* __INTEL_GT_H__ */
drivers/gpu/drm/i915/gt/intel_tlb.c new file +183 -0
183 lines not on this page · raw message
drivers/gpu/drm/i915/gt/intel_tlb.h new file +29 -0
@@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright © 2022 Intel Corporation +*/ + +#ifndef INTEL_TLB_H +#define INTEL_TLB_H + +#include <linux/seqlock.h> +#include <linux/types.h> + +#include "intel_gt_types.h" + +void intel_gt_invalidate_tlb_full (struct intel_gt *gt,u32 seqno); + +void intel_gt_init_tlb (struct intel_gt *gt); +void intel_gt_fini_tlb (struct intel_gt *gt); + +static inline u32 intel_gt_tlb_seqno (const struct intel_gt *gt) +{ +return seqprop_sequence (>->tlb.seqno); +} + +static inline u32 intel_gt_next_invalidate_tlb_full (const struct intel_gt *gt) +{ +return intel_gt_tlb_seqno (gt) |1 ; +} + +#endif /* INTEL_TLB_H */
drivers/gpu/drm/i915/i915_vma.c +1 -0
@@ -33,6 +33,7 @@#include "gt/intel_engine_heartbeat.h" #include "gt/intel_gt.h" #include "gt/intel_gt_requests.h" +#include "gt/intel_tlb.h" #include "i915_drv.h" #include "i915_gem_evict.h"
Signature · 1 line
2.36.1
PATCH 2/2 drm/i915/gt: document TLB cache invalidation functions
In reply to Mauro Carvalho ChehabAdd a description for the TLB cache invalidation algorithm and for the related kAPI functions.
---
To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover. See [PATCH 0/2] at: https://lore.kernel.org/all/[email protected]/
drivers/gpu/drm/i915/gt/intel_tlb.c | 25 +++++++++ drivers/gpu/drm/i915/gt/intel_tlb.h | 83 +++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+)
drivers/gpu/drm/i915/gt/intel_tlb.c +25 -0
@@ -145,6 +145,18 @@ static void mmio_invalidate_full(struct intel_gt *gt)intel_uncore_forcewake_put_delayed (uncore,FORCEWAKE_ALL ); } +/** +* intel_gt_invalidate_tlb_full - do full TLB cache invalidation +* @gt: GT structure +* @seqno: sequence number +* +* Do a full TLB cache invalidation if the @seqno is bigger than the last +* full TLB cache invalidation. +* +* Note: +* The TLB cache invalidation logic depends on GEN-specific registers. +* It currently supports GEN8 to GEN12 and GuC-based TLB cache invalidation. +*/ void intel_gt_invalidate_tlb_full (struct intel_gt *gt,u32 seqno) {intel_wakeref_t wakeref;
@@ -171,12 +183,25 @@ void intel_gt_invalidate_tlb_full(struct intel_gt *gt, u32 seqno) } } +/** +* intel_gt_init_tlb - initialize TLB-specific vars +* @gt: GT structure +* +* TLB cache invalidation logic internally uses some resources that require +* initialization. Should be called before doing any TLB cache invalidation. +*/ void intel_gt_init_tlb (struct intel_gt *gt) {mutex_init (>->tlb.invalidate_lock);seqcount_mutex_init (>->tlb.seqno, >->tlb.invalidate_lock); } +/** +* intel_gt_fini_tlb - initialize TLB-specific vars +* @gt: GT structure +* +* Frees any resources needed by TLB cache invalidation logic. +*/ void intel_gt_fini_tlb (struct intel_gt *gt) {mutex_destroy (>->tlb.invalidate_lock);
drivers/gpu/drm/i915/gt/intel_tlb.h +83 -0
99 lines not on this page · raw message
Signature · 1 line
2.36.1
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BUILD: failure for Move TLB invalidation code for its own file and document it
In reply to Mauro Carvalho Chehab== Series Details ==
== Series Details ==
Series: Move TLB invalidation code for its own file and document it
URL : https://patchwork.freedesktop.org/series/106805/
State : failure
== Summary ==
Error: patch https://patchwork.freedesktop.org/api/1.0/series/106805/revisions/1/mbox/ not applied
Applying: drm/i915/gt: Move TLB invalidation to its own file
Using index info to reconstruct a base tree...
M drivers/gpu/drm/i915/gem/i915_gem_pages.c
M drivers/gpu/drm/i915/gt/intel_gt.c
M drivers/gpu/drm/i915/gt/intel_gt.h
M drivers/gpu/drm/i915/i915_vma.c
Falling back to patching base and 3-way merge...
Auto-merging drivers/gpu/drm/i915/i915_vma.c
Auto-merging drivers/gpu/drm/i915/gt/intel_gt.h
CONFLICT (content): Merge conflict in drivers/gpu/drm/i915/gt/intel_gt.h Auto-merging drivers/gpu/drm/i915/gt/intel_gt.c
CONFLICT (content): Merge conflict in drivers/gpu/drm/i915/gt/intel_gt.c Auto-merging drivers/gpu/drm/i915/gem/i915_gem_pages.c
CONFLICT (content): Merge conflict in drivers/gpu/drm/i915/gem/i915_gem_pages.c
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 drm/i915/gt: Move TLB invalidation to its own file
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".