From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Matt Roper <matthew.d.roper@intel.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>,
igt-dev@lists.freedesktop.org
Subject: Re: [PATCH i-g-t 6/6] tools/intel_reg: Add forcewake support to xe
Date: Fri, 20 Sep 2024 21:30:28 +0300 [thread overview]
Message-ID: <Zu2_REdBq8HzQrk0@intel.com> (raw)
In-Reply-To: <20240920180420.GS5774@mdroper-desk1.amr.corp.intel.com>
On Fri, Sep 20, 2024 at 11:04:20AM -0700, Matt Roper wrote:
> On Fri, Sep 20, 2024 at 11:01:37AM -0700, Matt Roper wrote:
> > On Wed, Sep 18, 2024 at 09:36:29AM -0700, Lucas De Marchi wrote:
> > > Now that the igt lib is prepared, start passing the open driver fd so
> > > the correct forcewake is taken.
> > >
> > > Before:
> > > $ sudo ./build/tools/intel_reg read 0x2358
> > > (0x00002358): 0xffffffff
> >
> > Hmm, this example makes me wonder if we actually should have called this
> > top-level "forcewake_all" debugfs node something else. This example
> > shows that we're not relying on this interface solely for forcewake
> > purposes, but as a wider "wake everything up and make sure it's
> > accessible" interface. At the hardware level, forcewake deals only with
> > the GT-specific ability to exit+suppress RC6; if we read GT registers
> > while in RC6, we'll get back 0x0 as a result (which isn't what we see
> > here).
> >
> > The failures we had here were because the device itself had gone into
> > runtime D3 (so register reads come back as ~0); using forcewake
> > indirectly suppresses runtime D3 as a side effect. But if you'd wanted
> > to read a non-GT register (sgunit, display, etc.), those register reads
> > also would have failed before this change due to D3, even though the
> > registers themselves don't need forcewake. So we're in a situation
> > where we also rely on the "forcewake" interface for reading/writing
> > non-GT registers that don't care about forcewake.
> >
> > If a future platform adds, for example, a new sleep + wakelock system to
> > part of the sgunit, do we want to make this debugfs automatically wake
> > the sgunit too in case we want to read its registers? For that matter,
> > should this device-level "wake up everything so we can read registers"
> > interface also be grabbing all of our display power wells by default?
> >
> > Anyway, I'm probably overthinking this; we don't need to worry about it
> > for this patch series.
> >
> > >
> > > After:
> > > $ sudo ./build/tools/intel_reg read 0x2358
> > > Opened device: /dev/dri/card0
> > > (0x00002358): 0x91e59eeb
> > >
> > > Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> > > ---
> > > tools/intel_reg.c | 13 ++++++++++++-
> > > 1 file changed, 12 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/tools/intel_reg.c b/tools/intel_reg.c
> > > index 906ae9b84..b650c3697 100644
> > > --- a/tools/intel_reg.c
> > > +++ b/tools/intel_reg.c
> > > @@ -802,7 +802,18 @@ static int parse_reg(struct config *config, struct reg *reg, const char *s)
> > >
> > > static int register_access_init(struct config *config)
> > > {
> > > - return intel_register_access_init(&config->mmio_data, config->pci_dev, 0, -1);
> > > + int drm_fd = __drm_open_driver(DRIVER_INTEL | DRIVER_XE);
> > > + int ret;
> > > +
> > > + if (drm_fd < 0) {
> > > + fprintf(stderr, "could not open i915 or xe device\n");
> > > + return EXIT_FAILURE;
> > > + }
> > > +
> > > + ret = intel_register_access_init(&config->mmio_data, config->pci_dev, 0, drm_fd);
> > > + close(drm_fd);
> > > +
> > > + return ret;
> >
> > As noted on the previous patch, if we get here, it's always a 'return 0'
> > since intel_register_access_init() can't fail (and should probably have
> > just been a void function). But not a blocker.
> >
> > Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
>
> Actually I just saw Ville's reply and it's a good point that this tool
> did used to be able to run before/without the driver loaded. So we
> should just skip the "wake stuff up" part and proceed without failing
> for that case.
I've also been mildly tempted to make IGT_NO_FORCEWAKE=1
the default because it's annoying when I sometimes forget
to set it and then I might no longer be doing just the
register access I though I was doing. But that might
be a bit surprising to folks wanting to read GT
registers/etc. I suppose a sensible middle ground would
be to disable the forcewake stuff by defaut only in
the display specific tools, leaving it on for the likes
of intel_reg and anything gt specific.
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2024-09-20 18:31 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-18 16:36 [PATCH i-g-t 0/6] Add forcewake support for xe Lucas De Marchi
2024-09-18 16:36 ` [PATCH i-g-t 1/6] lib/igt_gt: Fix forcewake open Lucas De Marchi
2024-09-20 16:58 ` Matt Roper
2024-09-18 16:36 ` [PATCH i-g-t 2/6] lib/igt_gt: Document fd argument in igt_open_forcewake_handle() Lucas De Marchi
2024-09-20 17:15 ` Matt Roper
2024-09-20 20:20 ` Lucas De Marchi
2024-09-18 16:36 ` [PATCH i-g-t 3/6] lib/igt_gt: Make igt_open_forcewake_handle() xe-compatible Lucas De Marchi
2024-09-20 17:17 ` Matt Roper
2024-09-18 16:36 ` [PATCH i-g-t 4/6] lib/igt_gt: Fallback on filenames in igt_open_forcewake_handle() Lucas De Marchi
2024-09-18 19:16 ` [PATCH i-g-t v1.1] " Lucas De Marchi
2024-09-20 17:27 ` Matt Roper
2024-09-18 16:36 ` [PATCH i-g-t 5/6] tools/intel_reg: Add wrapper for reg access init Lucas De Marchi
2024-09-20 17:35 ` Matt Roper
2024-09-18 16:36 ` [PATCH i-g-t 6/6] tools/intel_reg: Add forcewake support to xe Lucas De Marchi
2024-09-20 17:43 ` Ville Syrjälä
2024-09-20 18:01 ` Matt Roper
2024-09-20 18:04 ` Matt Roper
2024-09-20 18:30 ` Ville Syrjälä [this message]
2024-09-20 19:43 ` Lucas De Marchi
2024-09-18 17:47 ` ✓ CI.xeBAT: success for Add forcewake support for xe Patchwork
2024-09-18 17:48 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-09-18 19:42 ` ✓ CI.xeBAT: success for Add forcewake support for xe (rev2) Patchwork
2024-09-18 19:54 ` ✓ Fi.CI.BAT: " Patchwork
2024-09-19 3:57 ` ✗ CI.xeFULL: failure for Add forcewake support for xe Patchwork
2024-09-19 6:06 ` ✗ CI.xeFULL: failure for Add forcewake support for xe (rev2) Patchwork
2024-09-19 7:27 ` ✗ Fi.CI.IGT: " 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=Zu2_REdBq8HzQrk0@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=lucas.demarchi@intel.com \
--cc=matthew.d.roper@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.