From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [Intel-xe] [PATCH v2 1/2] drm/xe: add skip_pcode flag
Date: Mon, 13 Nov 2023 08:53:55 -0500 [thread overview]
Message-ID: <ZVIqc4GvduTprsh+@intel.com> (raw)
In-Reply-To: <oqzjxeuxexv64tadqbghdjz36l3ke2spmqnhp23bc3h5c54dn2@i5jrnpcksp5g>
On Tue, Oct 24, 2023 at 12:15:44PM -0500, Lucas De Marchi wrote:
> On Tue, Oct 24, 2023 at 01:40:11PM +0300, Jani Nikula wrote:
> > On Sun, 22 Oct 2023, Koby Elbaz <kelbaz@habana.ai> wrote:
> > > Per device, set this flag to enable access to the PCODE uC or to skip it.
> > >
> > > Signed-off-by: Koby Elbaz <kelbaz@habana.ai>
> > > ---
> > > Changes in v2:
> > > - Added the flag 'skip_pcode' instead of 'has_pcode'
> >
> > I don't know why change was made from positive to negative flag.
> >
> > Generally it's better to use positive flags, because they just read
> > better. Negative flags often lead to double negatives in source, such as
> > !disable.
> >
> > Please consider using a positive flag, even if it's not "has_something".
>
> https://lore.kernel.org/all/qvuhtciy6gasz4s5f5opebdepse7x2ubfttnb4alhjq4e5zz4b@fjs6d67fcmex/
>
> The positive here is harder to work with IMO when thing "stop to exist"
> or when they are added to cope to certain environment limitations.
> That's because a) you have to go over all the past platform info to add
> the opposite, you can't rely on it being zero-initialized anymore.
> b) it's very easy to forget that for platforms that are wip as there are
> no git conflicts to serve as a warning.
>
> So, I think adding it as "skip" or another better verb could be
> appropriate. At least while there is no single user of that flag and
> platforms being worked on @habana and @intel, IMO this should help us
> not shoot on each others' foot.
When I first read this thread I was also with the impression that the
positive has_pcode would be better. But then after chatting offline
with Lucas, Matt Roper and others, I changed my mind.
For the cases where it is rare to have to skip, the negative is better
to maintain, and then, if down the road, that becomes the most common
behavior we can flip from negative to positive.
I also liked a suggestion from Matt about using 'lacks_' instead of 'skip_',
however I don't have a strong preference and on the second patch in this
series, the 'skip' is better.
So, let's just unblock the progress here and move forward with what we
have here and we can always improve or flip things later as needed.
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
>
> Lucas De Marchi
>
> >
> > BR,
> > Jani.
> >
> >
> > >
> > > drivers/gpu/drm/xe/xe_device_types.h | 2 ++
> > > drivers/gpu/drm/xe/xe_pci.c | 2 ++
> > > drivers/gpu/drm/xe/xe_pcode.c | 9 +++++++++
> > > 3 files changed, 13 insertions(+)
> > >
> > > diff --git a/drivers/gpu/drm/xe/xe_device_types.h b/drivers/gpu/drm/xe/xe_device_types.h
> > > index 44d622d4cc3a..29199671d9e8 100644
> > > --- a/drivers/gpu/drm/xe/xe_device_types.h
> > > +++ b/drivers/gpu/drm/xe/xe_device_types.h
> > > @@ -257,6 +257,8 @@ struct xe_device {
> > > u8 enable_display:1;
> > > /** @bypass_mtcfg: Bypass Multi-Tile configuration from MTCFG register */
> > > u8 bypass_mtcfg:1;
> > > + /** @skip_pcode: skip access to PCODE uC */
> > > + u8 skip_pcode:1;
> > > /** @supports_mmio_ext: supports MMIO extension/s */
> > > u8 supports_mmio_ext:1;
> > > /** @has_heci_gscfi: device has heci gscfi */
> > > diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
> > > index 2fae45b9d88e..05b0aa9f2ab7 100644
> > > --- a/drivers/gpu/drm/xe/xe_pci.c
> > > +++ b/drivers/gpu/drm/xe/xe_pci.c
> > > @@ -61,6 +61,7 @@ struct xe_device_desc {
> > >
> > > u8 has_llc:1;
> > > u8 bypass_mtcfg:1;
> > > + u8 skip_pcode:1;
> > > u8 supports_mmio_ext:1;
> > > };
> > >
> > > @@ -578,6 +579,7 @@ static int xe_info_init(struct xe_device *xe,
> > > xe->info.media_name = media_desc ? media_desc->name : "none";
> > > xe->info.has_llc = desc->has_llc;
> > > xe->info.bypass_mtcfg = desc->bypass_mtcfg;
> > > + xe->info.skip_pcode = desc->skip_pcode;
> > > xe->info.supports_mmio_ext = desc->supports_mmio_ext;
> > > xe->info.tile_mmio_ext_size = graphics_desc->tile_mmio_ext_size;
> > >
> > > diff --git a/drivers/gpu/drm/xe/xe_pcode.c b/drivers/gpu/drm/xe/xe_pcode.c
> > > index 4a240acf7625..b324dc2a5deb 100644
> > > --- a/drivers/gpu/drm/xe/xe_pcode.c
> > > +++ b/drivers/gpu/drm/xe/xe_pcode.c
> > > @@ -61,6 +61,9 @@ static int pcode_mailbox_rw(struct xe_gt *gt, u32 mbox, u32 *data0, u32 *data1,
> > > {
> > > int err;
> > >
> > > + if (gt_to_xe(gt)->info.skip_pcode)
> > > + return 0;
> > > +
> > > lockdep_assert_held(>->pcode.lock);
> > >
> > > if ((xe_mmio_read32(gt, PCODE_MAILBOX) & PCODE_READY) != 0)
> > > @@ -249,6 +252,9 @@ int xe_pcode_init(struct xe_gt *gt)
> > > int timeout_us = 180000000; /* 3 min */
> > > int ret;
> > >
> > > + if (gt_to_xe(gt)->info.skip_pcode)
> > > + return 0;
> > > +
> > > if (!IS_DGFX(gt_to_xe(gt)))
> > > return 0;
> > >
> > > @@ -280,6 +286,9 @@ int xe_pcode_probe(struct xe_gt *gt)
> > > {
> > > drmm_mutex_init(>_to_xe(gt)->drm, >->pcode.lock);
> > >
> > > + if (gt_to_xe(gt)->info.skip_pcode)
> > > + return 0;
> > > +
> > > if (!IS_DGFX(gt_to_xe(gt)))
> > > return 0;
> >
> > --
> > Jani Nikula, Intel
next prev parent reply other threads:[~2023-11-13 13:54 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-22 15:57 [Intel-xe] [PATCH v2 1/2] drm/xe: add skip_pcode flag Koby Elbaz
2023-10-22 15:57 ` [Intel-xe] [PATCH v2 2/2] drm/xe: rename bypass_mtcfg to skip_mtcfg Koby Elbaz
2023-11-13 13:54 ` Rodrigo Vivi
2023-10-24 7:00 ` [Intel-xe] ✗ CI.Patch_applied: failure for series starting with [v2,1/2] drm/xe: add skip_pcode flag Patchwork
2023-10-24 10:40 ` [Intel-xe] [PATCH v2 1/2] " Jani Nikula
2023-10-24 16:55 ` Koby Elbaz
2023-10-24 17:15 ` Lucas De Marchi
2023-11-13 13:53 ` Rodrigo Vivi [this message]
2023-11-14 18:58 ` [Intel-xe] ✓ CI.Patch_applied: success for series starting with [v2,1/2] drm/xe: add skip_pcode flag (rev2) Patchwork
2023-11-14 18:58 ` [Intel-xe] ✓ CI.checkpatch: " Patchwork
2023-11-14 18:59 ` [Intel-xe] ✓ CI.KUnit: " Patchwork
2023-11-14 19:07 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-11-14 19:07 ` [Intel-xe] ✓ CI.Hooks: " Patchwork
2023-11-14 19:08 ` [Intel-xe] ✓ CI.checksparse: " Patchwork
2023-11-14 19:44 ` [Intel-xe] ✗ CI.BAT: failure " Patchwork
2023-11-20 16:08 ` [Intel-xe] ✗ CI.Patch_applied: failure for series starting with [v2,1/2] drm/xe: add skip_pcode flag (rev3) Patchwork
2023-11-21 22:06 ` [Intel-xe] ✓ CI.Patch_applied: success for series starting with [v2,1/2] drm/xe: add skip_pcode flag (rev4) Patchwork
2023-11-21 22:06 ` [Intel-xe] ✓ CI.checkpatch: " Patchwork
2023-11-21 22:08 ` [Intel-xe] ✓ CI.KUnit: " Patchwork
2023-11-21 22:15 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-11-21 22:15 ` [Intel-xe] ✓ CI.Hooks: " Patchwork
2023-11-21 22:17 ` [Intel-xe] ✓ CI.checksparse: " Patchwork
2023-11-21 22:46 ` [Intel-xe] ✗ CI.BAT: failure " Patchwork
2023-11-27 17:43 ` [Intel-xe] ✗ CI.Patch_applied: failure for series starting with [v2,1/2] drm/xe: add skip_pcode flag (rev5) 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=ZVIqc4GvduTprsh+@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=lucas.demarchi@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.