diff options
author | Matthew Auld <matthew.auld@intel.com> | 2023-01-16 13:46:21 +0300 |
---|---|---|
committer | Rodrigo Vivi <rodrigo.vivi@intel.com> | 2023-12-20 02:27:45 +0300 |
commit | c5151fa80060a869c0308067e758a271c217ff61 (patch) | |
tree | ceecb345207877e48f8684be041ac5f7dcbdefca /drivers/gpu/drm/xe/xe_ggtt.c | |
parent | 5e53d1e806aeb2b05c85d24cd75f848631e8a121 (diff) | |
download | linux-c5151fa80060a869c0308067e758a271c217ff61.tar.xz |
drm/xe/ggtt: fix GGTT scratch usage for DG2
Scratch page is in VRAM, and therefore requires 64K GTT layout. In GGTT
world this just means having 16 consecutive entries, with 64K GTT
alignment for the GTT address of the first entry (also matching physical
alignment). However to keep things simple just dump it into system
memory, like we already do for ppGTT. While we are here, also give it
known default value.
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Diffstat (limited to 'drivers/gpu/drm/xe/xe_ggtt.c')
-rw-r--r-- | drivers/gpu/drm/xe/xe_ggtt.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/drivers/gpu/drm/xe/xe_ggtt.c b/drivers/gpu/drm/xe/xe_ggtt.c index e9273b5d2a9f..baa080cd1133 100644 --- a/drivers/gpu/drm/xe/xe_ggtt.c +++ b/drivers/gpu/drm/xe/xe_ggtt.c @@ -13,6 +13,7 @@ #include "xe_device.h" #include "xe_bo.h" #include "xe_gt.h" +#include "xe_map.h" #include "xe_mmio.h" #include "xe_wopcm.h" @@ -152,23 +153,30 @@ static void xe_ggtt_initial_clear(struct xe_ggtt *ggtt) int xe_ggtt_init(struct xe_gt *gt, struct xe_ggtt *ggtt) { struct xe_device *xe = gt_to_xe(gt); + unsigned int flags; int err; - ggtt->scratch = xe_bo_create_locked(xe, gt, NULL, GEN8_PAGE_SIZE, - ttm_bo_type_kernel, - XE_BO_CREATE_VRAM_IF_DGFX(gt) | - XE_BO_CREATE_PINNED_BIT); + /* + * So we don't need to worry about 64K GGTT layout when dealing with + * scratch entires, rather keep the scratch page in system memory on + * platforms where 64K pages are needed for VRAM. + */ + flags = XE_BO_CREATE_PINNED_BIT; + if (ggtt->flags & XE_GGTT_FLAGS_64K) + flags |= XE_BO_CREATE_SYSTEM_BIT; + else + flags |= XE_BO_CREATE_VRAM_IF_DGFX(gt); + + ggtt->scratch = xe_bo_create_pin_map(xe, gt, NULL, GEN8_PAGE_SIZE, + ttm_bo_type_kernel, + flags); + if (IS_ERR(ggtt->scratch)) { err = PTR_ERR(ggtt->scratch); goto err; } - err = xe_bo_pin(ggtt->scratch); - xe_bo_unlock_no_vm(ggtt->scratch); - if (err) { - xe_bo_put(ggtt->scratch); - goto err; - } + xe_map_memset(xe, &ggtt->scratch->vmap, 0, 0, ggtt->scratch->size); xe_ggtt_initial_clear(ggtt); return 0; |