drm/xe: Stop ignoring errors from xe_ttm_stolen_mgr_init()
[ Upstream commit ff57025c358603555f1e0ae0d50282a460433594 ] Make sure to differentiate normal behavior, e.g. there's no stolen, from allocation errors or failure to initialize lower layers. Reviewed-by: Francois Dugast <francois.dugast@intel.com> Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20250213192909.996148-5-lucas.demarchi@intel.com Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
50c5bbb45c
commit
884d64e8e4
@@ -694,7 +694,9 @@ int xe_device_probe(struct xe_device *xe)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate and map stolen after potential VRAM resize */
|
/* Allocate and map stolen after potential VRAM resize */
|
||||||
xe_ttm_stolen_mgr_init(xe);
|
err = xe_ttm_stolen_mgr_init(xe);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now that GT is initialized (TTM in particular),
|
* Now that GT is initialized (TTM in particular),
|
||||||
|
|||||||
@@ -201,17 +201,16 @@ static u64 detect_stolen(struct xe_device *xe, struct xe_ttm_stolen_mgr *mgr)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void xe_ttm_stolen_mgr_init(struct xe_device *xe)
|
int xe_ttm_stolen_mgr_init(struct xe_device *xe)
|
||||||
{
|
{
|
||||||
struct xe_ttm_stolen_mgr *mgr = drmm_kzalloc(&xe->drm, sizeof(*mgr), GFP_KERNEL);
|
|
||||||
struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
|
struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
|
||||||
|
struct xe_ttm_stolen_mgr *mgr;
|
||||||
u64 stolen_size, io_size;
|
u64 stolen_size, io_size;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (!mgr) {
|
mgr = drmm_kzalloc(&xe->drm, sizeof(*mgr), GFP_KERNEL);
|
||||||
drm_dbg_kms(&xe->drm, "Stolen mgr init failed\n");
|
if (!mgr)
|
||||||
return;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
|
|
||||||
if (IS_SRIOV_VF(xe))
|
if (IS_SRIOV_VF(xe))
|
||||||
stolen_size = 0;
|
stolen_size = 0;
|
||||||
@@ -224,7 +223,7 @@ void xe_ttm_stolen_mgr_init(struct xe_device *xe)
|
|||||||
|
|
||||||
if (!stolen_size) {
|
if (!stolen_size) {
|
||||||
drm_dbg_kms(&xe->drm, "No stolen memory support\n");
|
drm_dbg_kms(&xe->drm, "No stolen memory support\n");
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -240,7 +239,7 @@ void xe_ttm_stolen_mgr_init(struct xe_device *xe)
|
|||||||
io_size, PAGE_SIZE);
|
io_size, PAGE_SIZE);
|
||||||
if (err) {
|
if (err) {
|
||||||
drm_dbg_kms(&xe->drm, "Stolen mgr init failed: %i\n", err);
|
drm_dbg_kms(&xe->drm, "Stolen mgr init failed: %i\n", err);
|
||||||
return;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
drm_dbg_kms(&xe->drm, "Initialized stolen memory support with %llu bytes\n",
|
drm_dbg_kms(&xe->drm, "Initialized stolen memory support with %llu bytes\n",
|
||||||
@@ -248,6 +247,8 @@ void xe_ttm_stolen_mgr_init(struct xe_device *xe)
|
|||||||
|
|
||||||
if (io_size)
|
if (io_size)
|
||||||
mgr->mapping = devm_ioremap_wc(&pdev->dev, mgr->io_base, io_size);
|
mgr->mapping = devm_ioremap_wc(&pdev->dev, mgr->io_base, io_size);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 xe_ttm_stolen_io_offset(struct xe_bo *bo, u32 offset)
|
u64 xe_ttm_stolen_io_offset(struct xe_bo *bo, u32 offset)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ struct ttm_resource;
|
|||||||
struct xe_bo;
|
struct xe_bo;
|
||||||
struct xe_device;
|
struct xe_device;
|
||||||
|
|
||||||
void xe_ttm_stolen_mgr_init(struct xe_device *xe);
|
int xe_ttm_stolen_mgr_init(struct xe_device *xe);
|
||||||
int xe_ttm_stolen_io_mem_reserve(struct xe_device *xe, struct ttm_resource *mem);
|
int xe_ttm_stolen_io_mem_reserve(struct xe_device *xe, struct ttm_resource *mem);
|
||||||
bool xe_ttm_stolen_cpu_access_needs_ggtt(struct xe_device *xe);
|
bool xe_ttm_stolen_cpu_access_needs_ggtt(struct xe_device *xe);
|
||||||
u64 xe_ttm_stolen_io_offset(struct xe_bo *bo, u32 offset);
|
u64 xe_ttm_stolen_io_offset(struct xe_bo *bo, u32 offset);
|
||||||
|
|||||||
Reference in New Issue
Block a user