mirror of
https://github.com/torvalds/linux.git
synced 2026-05-21 05:18:45 +02:00
drm/xe: Reorder GGTT init to earlier point in probe
GuC will need to be loaded earlier during probe. Having functional GGTT is one of the prerequisites. Also rename xe_ggtt_init_noalloc to xe_ggtt_init_early to match the new call site. Signed-off-by: Michał Winiarski <michal.winiarski@intel.com> Reviewed-by: Matt Roper <matthew.d.roper@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
This commit is contained in:
parent
b62f828a83
commit
791d0362a9
|
|
@ -24,6 +24,7 @@
|
|||
#include "xe_drv.h"
|
||||
#include "xe_exec_queue.h"
|
||||
#include "xe_exec.h"
|
||||
#include "xe_ggtt.h"
|
||||
#include "xe_gt.h"
|
||||
#include "xe_irq.h"
|
||||
#include "xe_mmio.h"
|
||||
|
|
@ -418,6 +419,12 @@ int xe_device_probe(struct xe_device *xe)
|
|||
for_each_gt(gt, xe, id)
|
||||
xe_force_wake_init_gt(gt, gt_to_fw(gt));
|
||||
|
||||
for_each_tile(tile, xe, id) {
|
||||
err = xe_ggtt_init_early(tile->mem.ggtt);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
err = drmm_add_action_or_reset(&xe->drm, xe_driver_flr_fini, xe);
|
||||
if (err)
|
||||
return err;
|
||||
|
|
|
|||
|
|
@ -96,14 +96,20 @@ static void xe_ggtt_clear(struct xe_ggtt *ggtt, u64 start, u64 size)
|
|||
}
|
||||
}
|
||||
|
||||
static void ggtt_fini_noalloc(struct drm_device *drm, void *arg)
|
||||
static void ggtt_fini_early(struct drm_device *drm, void *arg)
|
||||
{
|
||||
struct xe_ggtt *ggtt = arg;
|
||||
|
||||
mutex_destroy(&ggtt->lock);
|
||||
drm_mm_takedown(&ggtt->mm);
|
||||
}
|
||||
|
||||
static void ggtt_fini(struct drm_device *drm, void *arg)
|
||||
{
|
||||
struct xe_ggtt *ggtt = arg;
|
||||
|
||||
xe_bo_unpin_map_no_vm(ggtt->scratch);
|
||||
ggtt->scratch = NULL;
|
||||
}
|
||||
|
||||
static void primelockdep(struct xe_ggtt *ggtt)
|
||||
|
|
@ -124,7 +130,14 @@ static const struct xe_ggtt_pt_ops xelpg_pt_ops = {
|
|||
.pte_encode_bo = xelpg_ggtt_pte_encode_bo,
|
||||
};
|
||||
|
||||
int xe_ggtt_init_noalloc(struct xe_ggtt *ggtt)
|
||||
/*
|
||||
* Early GGTT initialization, which allows to create new mappings usable by the
|
||||
* GuC.
|
||||
* Mappings are not usable by the HW engines, as it doesn't have scratch /
|
||||
* initial clear done to it yet. That will happen in the regular, non-early
|
||||
* GGTT init.
|
||||
*/
|
||||
int xe_ggtt_init_early(struct xe_ggtt *ggtt)
|
||||
{
|
||||
struct xe_device *xe = tile_to_xe(ggtt->tile);
|
||||
struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
|
||||
|
|
@ -178,7 +191,7 @@ int xe_ggtt_init_noalloc(struct xe_ggtt *ggtt)
|
|||
mutex_init(&ggtt->lock);
|
||||
primelockdep(ggtt);
|
||||
|
||||
return drmm_add_action_or_reset(&xe->drm, ggtt_fini_noalloc, ggtt);
|
||||
return drmm_add_action_or_reset(&xe->drm, ggtt_fini_early, ggtt);
|
||||
}
|
||||
|
||||
static void xe_ggtt_initial_clear(struct xe_ggtt *ggtt)
|
||||
|
|
@ -226,7 +239,8 @@ int xe_ggtt_init(struct xe_ggtt *ggtt)
|
|||
xe_map_memset(xe, &ggtt->scratch->vmap, 0, 0, ggtt->scratch->size);
|
||||
|
||||
xe_ggtt_initial_clear(ggtt);
|
||||
return 0;
|
||||
|
||||
return drmm_add_action_or_reset(&xe->drm, ggtt_fini, ggtt);
|
||||
err:
|
||||
ggtt->scratch = NULL;
|
||||
return err;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ struct drm_printer;
|
|||
|
||||
void xe_ggtt_set_pte(struct xe_ggtt *ggtt, u64 addr, u64 pte);
|
||||
void xe_ggtt_invalidate(struct xe_ggtt *ggtt);
|
||||
int xe_ggtt_init_noalloc(struct xe_ggtt *ggtt);
|
||||
int xe_ggtt_init_early(struct xe_ggtt *ggtt);
|
||||
int xe_ggtt_init(struct xe_ggtt *ggtt);
|
||||
void xe_ggtt_printk(struct xe_ggtt *ggtt, const char *prefix);
|
||||
|
||||
|
|
|
|||
|
|
@ -166,10 +166,6 @@ int xe_tile_init_noalloc(struct xe_tile *tile)
|
|||
if (err)
|
||||
goto err_mem_access;
|
||||
|
||||
err = xe_ggtt_init_noalloc(tile->mem.ggtt);
|
||||
if (err)
|
||||
goto err_mem_access;
|
||||
|
||||
tile->mem.kernel_bb_pool = xe_sa_bo_manager_init(tile, SZ_1M, 16);
|
||||
if (IS_ERR(tile->mem.kernel_bb_pool))
|
||||
err = PTR_ERR(tile->mem.kernel_bb_pool);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user