mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-04 01:20:01 -04:00
drm/xe: Enable Boot Survivability mode
Enable boot survivability mode if pcode initialization fails and
if boot status indicates a failure. In this mode, drm card is not
exposed and driver probe returns success after loading the bare minimum
to allow firmware to be flashed via mei.
v2: abstract survivability mode variable
add BMG check inside function (Jani, Rodrigo)
v3: return -EBUSY during system suspend (Anshuman)
check survivability mode in pci probe only
on error
Signed-off-by: Riana Tauro <riana.tauro@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250128095632.1294722-3-riana.tauro@intel.com
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
This commit is contained in:
committed by
Rodrigo Vivi
parent
5e940312a2
commit
256daa32c9
@@ -52,6 +52,7 @@
|
||||
#include "xe_pmu.h"
|
||||
#include "xe_query.h"
|
||||
#include "xe_sriov.h"
|
||||
#include "xe_survivability_mode.h"
|
||||
#include "xe_tile.h"
|
||||
#include "xe_ttm_stolen_mgr.h"
|
||||
#include "xe_ttm_sys_mgr.h"
|
||||
@@ -694,8 +695,12 @@ int xe_device_probe_early(struct xe_device *xe)
|
||||
update_device_info(xe);
|
||||
|
||||
err = xe_pcode_probe_early(xe);
|
||||
if (err)
|
||||
if (err) {
|
||||
if (xe_survivability_mode_required(xe))
|
||||
xe_survivability_mode_init(xe);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
err = wait_for_lmem_ready(xe);
|
||||
if (err)
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "xe_pm.h"
|
||||
#include "xe_sriov.h"
|
||||
#include "xe_step.h"
|
||||
#include "xe_survivability_mode.h"
|
||||
#include "xe_tile.h"
|
||||
|
||||
enum toggle_d3cold {
|
||||
@@ -761,6 +762,9 @@ static void xe_pci_remove(struct pci_dev *pdev)
|
||||
if (IS_SRIOV_PF(xe))
|
||||
xe_pci_sriov_configure(pdev, 0);
|
||||
|
||||
if (xe_survivability_mode_enabled(xe))
|
||||
return xe_survivability_mode_remove(xe);
|
||||
|
||||
xe_device_remove(xe);
|
||||
xe_pm_runtime_fini(xe);
|
||||
pci_set_drvdata(pdev, NULL);
|
||||
@@ -833,8 +837,19 @@ static int xe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
return err;
|
||||
|
||||
err = xe_device_probe_early(xe);
|
||||
if (err)
|
||||
|
||||
/*
|
||||
* In Boot Survivability mode, no drm card is exposed
|
||||
* and driver is loaded with bare minimum to allow
|
||||
* for firmware to be flashed through mei. Return
|
||||
* success if survivability mode is enabled.
|
||||
*/
|
||||
if (err) {
|
||||
if (xe_survivability_mode_enabled(xe))
|
||||
return 0;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
err = xe_info_init(xe, desc->graphics, desc->media);
|
||||
if (err)
|
||||
@@ -921,9 +936,13 @@ static void d3cold_toggle(struct pci_dev *pdev, enum toggle_d3cold toggle)
|
||||
static int xe_pci_suspend(struct device *dev)
|
||||
{
|
||||
struct pci_dev *pdev = to_pci_dev(dev);
|
||||
struct xe_device *xe = pdev_to_xe_device(pdev);
|
||||
int err;
|
||||
|
||||
err = xe_pm_suspend(pdev_to_xe_device(pdev));
|
||||
if (xe_survivability_mode_enabled(xe))
|
||||
return -EBUSY;
|
||||
|
||||
err = xe_pm_suspend(xe);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
||||
@@ -144,6 +144,19 @@ static void enable_survivability_mode(struct pci_dev *pdev)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* xe_survivability_mode_enabled - check if survivability mode is enabled
|
||||
* @xe: xe device instance
|
||||
*
|
||||
* Returns true if in survivability mode, false otherwise
|
||||
*/
|
||||
bool xe_survivability_mode_enabled(struct xe_device *xe)
|
||||
{
|
||||
struct xe_survivability *survivability = &xe->survivability;
|
||||
|
||||
return survivability->mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* xe_survivability_mode_required - checks if survivability mode is required
|
||||
* @xe: xe device instance
|
||||
@@ -158,6 +171,9 @@ bool xe_survivability_mode_required(struct xe_device *xe)
|
||||
struct xe_mmio *mmio = xe_root_tile_mmio(xe);
|
||||
u32 data;
|
||||
|
||||
if (!IS_DGFX(xe) || xe->info.platform < XE_BATTLEMAGE)
|
||||
return false;
|
||||
|
||||
data = xe_mmio_read32(mmio, PCODE_SCRATCH(0));
|
||||
survivability->boot_status = REG_FIELD_GET(BOOT_STATUS, data);
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ struct xe_device;
|
||||
|
||||
void xe_survivability_mode_init(struct xe_device *xe);
|
||||
void xe_survivability_mode_remove(struct xe_device *xe);
|
||||
bool xe_survivability_mode_enabled(struct xe_device *xe);
|
||||
bool xe_survivability_mode_required(struct xe_device *xe);
|
||||
|
||||
#endif /* _XE_SURVIVABILITY_MODE_H_ */
|
||||
|
||||
Reference in New Issue
Block a user