summaryrefslogtreecommitdiff
path: root/lib/xe/xe_util.h
AgeCommit message (Collapse)AuthorFilesLines
2026-03-10lib/xe_util.h: add canonical helper for 48/57 bit vasZbigniew Kempczyński1-0/+5
Add helper which returns valid from hw perspective offset ready to be inserted to gpu pipeline. Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Signed-off-by: Priyanka Dandamudi <priyanka.dandamudi@intel.com> Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
2025-10-01lib/xe_util: Add xe fast-copy helperZbigniew Kempczyński1-0/+5
In Xe2 and beyond fast-copy between objects with different pat indices is quite common operation. Add fast-copy helper which requires only src/dst bo handle, region, pat index and size of operation. It is however limited to size being multiple of 4KiB and lesser or equal 16MiB but this limitation may removed if there will be user of this. Cc: Matthew Auld <matthew.auld@intel.com> Cc: Nakshtra Goyal <nakshtra.goyal@intel.com> Tested-by: Nakshtra Goyal <nakshtra.goyal@intel.com> Reviewed-by: Nakshtra Goyal <nakshtra.goyal@intel.com> Reviewed-by: Matthew Auld <matthew.auld@intel.com> Link: https://lore.kernel.org/r/20250930143130.186193-5-zbigniew.kempczynski@intel.com Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
2025-01-10lib/xe: Split nsec to ticks abstractionLucas De Marchi1-0/+2
There are 2 things happening here: one is converting time in nanoseconds to ticks by using the refclock, and another asserting a spin duration is not so close to the maximum duration since there needs to be room for context switch. Move the time conversion to xe_util.c and adjust it to maintain namespace and have better names. Places that do the time conversion to pass to xe_spin then use the xe_spin_nsec_to_ticks() wrapper to calculate the ticks. Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com> Link: https://lore.kernel.org/r/20250107202615.1306306-4-lucas.demarchi@intel.com Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
2025-01-10lib/xe: Move functions from xe_util to xe_gtLucas De Marchi1-7/+0
Some functions are clearly gt-related, so move them to xe_gt. Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com> Link: https://lore.kernel.org/r/20250107202615.1306306-2-lucas.demarchi@intel.com Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
2024-08-16lib/xe: Abstract virtual/parallel setupLucas De Marchi1-0/+7
Add 2 new functions, xe_gt_count_engines_by_class and xe_gt_fill_engines_by_class, that can be used as helpers to setup parallel/virtual exec queue. All the tests were basically looping and filtering engines that match gt and class. Place these new functions in xe_util.c as currently we lack a better placement. xe_query.c and xe_gt.c could probably be other candidates, but they all mix all kind of namespaces too. Reviewed-by: Matthew Brost <matthew.brost@intel.com> Link: https://lore.kernel.org/r/20240814175013.3679997-2-lucas.demarchi@intel.com Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
2023-11-29lib/allocator: add get_offset_pat_index() helperMatthew Auld1-0/+1
For some cases we are going to need to pass the pat_index for the vm_bind op. Add a helper for this, such that we can allocate an address and give the mapping some pat_index. v2 (Zbigniew) - Plumb pat_index down into intel_allocator_record and protect against potential changes. - Add pat_index to bind_debug(). v3 (Zbigniew) - A few more improvements Signed-off-by: Matthew Auld <matthew.auld@intel.com> Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Cc: José Roberto de Souza <jose.souza@intel.com> Cc: Pallavi Mishra <pallavi.mishra@intel.com> Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
2023-11-17drm-uapi/xe: Add missing DRM_ prefix in uAPI constantsFrancois Dugast1-2/+2
Align with commit ("drm/xe/uapi: Add missing DRM_ prefix in uAPI constants") Signed-off-by: Francois Dugast <francois.dugast@intel.com> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
2023-07-21tests/xe: Verify actual frequency on the basis of GT stateBadal Nilawar1-0/+2
When GT is in RC6 actual frequency reported will be 0. So verify actual on the basic of GT state. v2: - Rebased - Move function xe_is_gt_in_c6, to check rc6 state, to igt_pm library - Assert if freq reported is not 0 when idle (Ashutosh) v3: - Fix review comments (Ashutosh) v4: - Move igt_require to igt_main under idle test cases (Ashutosh) - For idle case wait for C6 instead of usleep (Ashutosh) v5: - Remove igt_require from test_freq_range v6: - Move xe_is_gt_in_c6 to xe/xe_util.c (Anshuman) Fixes: acaaca0bf317 ("tests/xe: Add Xe IGT tests") Signed-off-by: Badal Nilawar <badal.nilawar@intel.com> Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com> Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
2023-07-13lib/xe_util: Add vm bind/unbind helper for XeZbigniew Kempczyński1-0/+17
Before calling exec we need to prepare vm to contain valid entries. Bind/unbind in xe expects single bind_op or vector of bind_ops what makes preparation of it a little bit inconvinient. Add function which iterates over list of xe_object (auxiliary structure which describes bind information for object) and performs the bind/unbind in one step. It also supports passing syncobj in/out to work in pipelined executions. Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Reviewed-by: Karolina Stolarek <karolina.stolarek@intel.com>
2023-07-13lib/xe_util: Return dynamic subtest name for XeZbigniew Kempczyński1-0/+30
For tests which are working on more than one region using name suffix like "vram01-system" etc. is common thing. Instead handcrafting this naming add xe_memregion_dynamic_subtest_name() function which is similar to memregion_dynamic_subtest_name() for i915. Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Reviewed-by: Karolina Stolarek <karolina.stolarek@intel.com>