From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: "Gupta, Anshuman" <anshuman.gupta@intel.com>
Cc: "Tauro, Riana" <riana.tauro@intel.com>,
"intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>,
"Wysocki, Rafael J" <rafael.j.wysocki@intel.com>,
"Iddamsetty, Aravind" <aravind.iddamsetty@intel.com>
Subject: Re: [PATCH v4 2/3] drm/xe: Enable Boot Survivability mode
Date: Thu, 23 Jan 2025 05:45:34 -0500 [thread overview]
Message-ID: <Z5IdzsqbgEL-Zl9H@intel.com> (raw)
In-Reply-To: <CY5PR11MB62113B65DF983BA3AFBBF8C595E02@CY5PR11MB6211.namprd11.prod.outlook.com>
On Thu, Jan 23, 2025 at 02:45:00AM -0500, Gupta, Anshuman wrote:
>
>
> > -----Original Message-----
> > From: Tauro, Riana <riana.tauro@intel.com>
> > Sent: Thursday, January 23, 2025 12:54 PM
> > To: intel-xe@lists.freedesktop.org
> > Cc: Tauro, Riana <riana.tauro@intel.com>; Gupta, Anshuman
> > <anshuman.gupta@intel.com>; Vivi, Rodrigo <rodrigo.vivi@intel.com>;
> > Iddamsetty, Aravind <aravind.iddamsetty@intel.com>
> > Subject: [PATCH v4 2/3] 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>
> > ---
> > drivers/gpu/drm/xe/xe_device.c | 7 ++++++-
> > drivers/gpu/drm/xe/xe_pci.c | 23 ++++++++++++++++++++--
> > drivers/gpu/drm/xe/xe_survivability_mode.c | 16 +++++++++++++++
> > drivers/gpu/drm/xe/xe_survivability_mode.h | 1 +
> > 4 files changed, 44 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
> > index bd6191e1ed3e..0a938bd0e34d 100644
> > --- a/drivers/gpu/drm/xe/xe_device.c
> > +++ b/drivers/gpu/drm/xe/xe_device.c
> > @@ -51,6 +51,7 @@
> > #include "xe_pm.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"
> > @@ -692,8 +693,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)
> > diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c index
> > e6ad189294c1..b483c5c90132 100644
> > --- a/drivers/gpu/drm/xe/xe_pci.c
> > +++ b/drivers/gpu/drm/xe/xe_pci.c
> > @@ -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 {
> > @@ -766,6 +767,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);
> > @@ -838,8 +842,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)
> > @@ -926,9 +941,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;
> @Vivi, Rodrigo how about using pm_stay_awake() to avoid the suspend instead of returning -EBUSY from driver, Let PM Core abort the suspend ?
> and pm_relax() in module unload path.
By the doc it looks like the pm_stay_awake is more for short event handling,
rather than blocking from probe to unload while the driver is only holding
this mode so the IFWI can be flashed.
However, it does seem a more effective way to be honest. I mean, it could
block all the prep work for suspend specially for S4, instead getting to
the driver.
> CC: Rafael to provide if above can be used here.
But yet, I'd like to hear to Rafael.
And also, I don't believe this block this patch. We could merge this
as is and change to pm_stay_awake as a follow up if we decide that
it is a better path.
> Thanks,
> Anshuman
> > +
> > + err = xe_pm_suspend(xe);
> > if (err)
> > return err;
> >
> > diff --git a/drivers/gpu/drm/xe/xe_survivability_mode.c
> > b/drivers/gpu/drm/xe/xe_survivability_mode.c
> > index 8b7bd6e79eca..14d0ab7b75e5 100644
> > --- a/drivers/gpu/drm/xe/xe_survivability_mode.c
> > +++ b/drivers/gpu/drm/xe/xe_survivability_mode.c
> > @@ -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);
> >
> > diff --git a/drivers/gpu/drm/xe/xe_survivability_mode.h
> > b/drivers/gpu/drm/xe/xe_survivability_mode.h
> > index 410e3ee5f5d1..f530507a22c6 100644
> > --- a/drivers/gpu/drm/xe/xe_survivability_mode.h
> > +++ b/drivers/gpu/drm/xe/xe_survivability_mode.h
> > @@ -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_ */
> > --
> > 2.47.1
>
next prev parent reply other threads:[~2025-01-23 10:45 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-23 7:23 [PATCH v4 0/3] Enable Survivability mode Riana Tauro
2025-01-23 7:23 ` [PATCH v4 1/3] drm/xe: Add functions and sysfs for boot survivability Riana Tauro
2025-01-23 7:23 ` [PATCH v4 2/3] drm/xe: Enable Boot Survivability mode Riana Tauro
2025-01-23 7:45 ` Gupta, Anshuman
2025-01-23 10:45 ` Rodrigo Vivi [this message]
2025-01-23 7:23 ` [PATCH v4 3/3] drm/xe: Initialize mei-gsc and vsec in survivability mode Riana Tauro
2025-01-23 9:31 ` ✓ CI.Patch_applied: success for Enable Survivability mode (rev4) Patchwork
2025-01-23 9:31 ` ✗ CI.checkpatch: warning " Patchwork
2025-01-24 3:18 ` Rodrigo Vivi
2025-01-23 9:32 ` ✓ CI.KUnit: success " Patchwork
2025-01-23 9:49 ` ✓ CI.Build: " Patchwork
2025-01-23 9:51 ` ✓ CI.Hooks: " Patchwork
2025-01-23 9:53 ` ✓ CI.checksparse: " Patchwork
2025-01-23 10:27 ` ✓ Xe.CI.BAT: " Patchwork
2025-01-23 21:43 ` ✗ Xe.CI.Full: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z5IdzsqbgEL-Zl9H@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=anshuman.gupta@intel.com \
--cc=aravind.iddamsetty@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=rafael.j.wysocki@intel.com \
--cc=riana.tauro@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.