drm/xe/mmio: update gt_count when probing multi-tile
Subsystems (2)
PATCH 1/1 drm/xe/mmio: update gt_count when probing multi-tile
It looks like the single-tile PVC in CI dies during module load when doing the pcode init. From the logs we try to access the address 0000000000138124 which doesn't map to anything, however 0x138124 also looks to be the PCODE_MAILBOX register. So looks like the per-tile mmio register mapping is NULL.
During probe the tile count is potentially trimmed, since we don't know the real count until we actually probe the device. This seems to be the case for single-tile PVC or similar devices. However it looks like the gt_count is never adjusted to respect this updated tile count. As a result when later doing some for_each_gt() loop, like we do for the pcode, we can get back some GT that maps to some non-existent tile which hasn't been properly set up, leading to crashes.
Try to fix this by adjusting the gt_count after probing the tiles for real.
--- drivers/gpu/drm/xe/xe_mmio.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/xe/xe_mmio.c +6 -0
@@ -334,6 +334,12 @@ static void xe_mmio_probe_tiles(struct xe_device *xe) adj_tile_count = xe->info.tile_count =REG_FIELD_GET (TILE_COUNT , mtcfg) +1 ; +/* +* FIXME: Needs some work for standalone media, but should be impossible +* with multi-tile for now. +*/ + xe->info.gt_count = xe_info.tile_count; +drm_info (&xe->drm,"tile_count: %d, adj_tile_count %d\n" , xe->info.tile_count, adj_tile_count);
Signature · 1 line
2.41.0
Patchwork
CI[Intel-xe] ✓ CI.Patch_applied: success for drm/xe/mmio: update gt_count when probing multi-tile
== Series Details ==
== Series Details ==
Series: drm/xe/mmio: update gt_count when probing multi-tile
URL : https://patchwork.freedesktop.org/series/119878/
State : success
== Summary ==
=== Applying kernel patches on branch 'drm-xe-next' with base: === Base commit: d3fc5af59 drm/xe/bo: consider bo->flags in xe_bo_migrate() === git am output follows ===
Applying: drm/xe/mmio: update gt_count when probing multi-tile
Patchwork
CI[Intel-xe] ✗ CI.checkpatch: warning for drm/xe/mmio: update gt_count when probing multi-tile
In reply to Matthew Auld== Series Details ==
== Series Details ==
Series: drm/xe/mmio: update gt_count when probing multi-tile
URL : https://patchwork.freedesktop.org/series/119878/
State : warning
== Summary ==
+ KERNEL=/kernel
+ git clone https://gitlab.freedesktop.org/drm/maintainer-tools mt Cloning into 'mt'...
warning: redirecting to https://gitlab.freedesktop.org/drm/maintainer-tools.git/
+ git -C mt rev-list -n1 origin/master c7d32770e3cd31d9fc134ce41f329b10aa33ee15
+ cd /kernel
+ git config --global --add safe.directory /kernel
+ git log -n1
commit a7e9bab973eddbd6971432b9073ecf6b9a972556
Author: Matthew Auld <[email protected]> Date: Mon Jun 26 18:09:06 2023 +0100
drm/xe/mmio: update gt_count when probing multi-tile
It looks like the single-tile PVC in CI dies during module load when doing the pcode init. From the logs we try to access the address 0000000000138124 which doesn't map to anything, however 0x138124 also looks to be the PCODE_MAILBOX register. So looks like the per-tile mmio register mapping is NULL.
During probe the tile count is potentially trimmed, since we don't know the real count until we actually probe the device. This seems to be the case for single-tile PVC or similar devices. However it looks like the gt_count is never adjusted to respect this updated tile count. As a result when later doing some for_each_gt() loop, like we do for the pcode, we can get back some GT that maps to some non-existent tile which hasn't been properly set up, leading to crashes.
Try to fix this by adjusting the gt_count after probing the tiles for real.
+ /mt/dim checkpatch d3fc5af59c7c17ad1a0272c49dbff84534d9d606 drm-intel a7e9bab97 drm/xe/mmio: update gt_count when probing multi-tile
-:23: WARNING:COMMIT_LOG_USE_LINK: Unknown link reference 'Closes:', use 'Link:' instead #23:
total: 0 errors, 1 warnings, 0 checks, 12 lines checked
Patchwork
CI[Intel-xe] ✗ CI.KUnit: failure for drm/xe/mmio: update gt_count when probing multi-tile
In reply to Matthew Auld== Series Details ==
== Series Details ==
Series: drm/xe/mmio: update gt_count when probing multi-tile
URL : https://patchwork.freedesktop.org/series/119878/
State : failure
== Summary ==
+ trap cleanup EXIT
+ /kernel/tools/testing/kunit/kunit.py run --kunitconfig /kernel/drivers/gpu/drm/xe/.kunitconfig ERROR:root:../drivers/gpu/drm/xe/xe_mmio.c: In function ‘xe_mmio_probe_tiles’:../drivers/gpu/drm/xe/xe_mmio.c:341:22: error: ‘xe_info’ undeclared (first use in this function); did you mean ‘qc_info’?
341 | xe->info.gt_count = xe_info.tile_count;
| ^~~~~~~
| qc_info../drivers/gpu/drm/xe/xe_mmio.c:341:22: note: each undeclared identifier is reported only once for each function it appears in make[6]: *** [../scripts/Makefile.build:252: drivers/gpu/drm/xe/xe_mmio.o] Error 1
make[6]: *** Waiting for unfinished jobs....
make[5]: *** [../scripts/Makefile.build:494: drivers/gpu/drm/xe] Error 2
make[5]: *** Waiting for unfinished jobs....
make[4]: *** [../scripts/Makefile.build:494: drivers/gpu/drm] Error 2
make[3]: *** [../scripts/Makefile.build:494: drivers/gpu] Error 2
make[2]: *** [../scripts/Makefile.build:494: drivers] Error 2
make[1]: *** [/kernel/Makefile:2025: .] Error 2
make: *** [Makefile:226: __sub-make] Error 2
[17:17:48] Configuring KUnit Kernel ...
Generating .config ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig [17:17:52] Building KUnit Kernel ... Populating config with: $ make ARCH=um O=.kunit olddefconfig Building with: $ make ARCH=um O=.kunit --jobs=48 + cleanup ++ stat -c %u:%g /kernel + chown -R 1003:1003 /kernel