Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: Matt Roper <matthew.d.roper@intel.com>
Cc: <intel-xe@lists.freedesktop.org>,
	Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Subject: Re: [PATCH v2 1/4] drm/xe/oa: Rename last argument of WHITELIST_OA_MMIO_TRG
Date: Mon, 29 Jun 2026 09:25:37 -0700	[thread overview]
Message-ID: <87h5mljou6.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20260626163937.GR6214@mdroper-desk1.amr.corp.intel.com>

On Fri, 26 Jun 2026 09:39:37 -0700, Matt Roper wrote:
>

Hi Matt,

> On Tue, Jun 16, 2026 at 06:54:19PM -0700, Ashutosh Dixit wrote:
> > OA head pointer registers are not used by UMD's and do not need to be
> > whitelisted, the last argument of WHITELIST_OA_MMIO_TRG is actually used
> > for whitelisting tail pointer and OA buffer registers. Rename the argument
> > to tail_buf to reflect this. OA head pointer is sometimes provided to the
> > WHITELIST_OA_MMIO_TRG to have the correct register offset alignment (16)
> > for RING_FORCE_TO_NONPRIV_RANGE_4.
>
> We should only be using that in cases where we definitely have four
> consecutive registers that _all_ need the be accessed by userspace and
> that are documented as okay to whitelist in the specs.  If userspace only
> has a need for two consecutive registers, there's no reason to be using
> RANGE_4.  Granting userspace access to two extra unnecessary registers is
> a DRM uapi violation (and also a potential security risk depending on
> what the extra two registers wind up being).

We recently merged

https://patchwork.freedesktop.org/series/166809/

So OA registers are basically only whitelisted now with "explicit
permission from root" (they are not whitelisted by default and also we are
preparing series to fix this up in previous stable kernel versions
too). Our position is that if root has given explicit permission, "all bets
are off" (I will write a patch documenting the sort of things which can
happen).

So imo we should treat OA register whitelisting differently from other
non-OA register whitelisting. Further, we asked our security guys
specifically about the use of RANGE_4 for OA and they have okay'd it.

> I think the proper fix here is to get rid of RANGE_4.

There are few things in flight here (explained below), but the reason for
retaining RANGE_4 was discussed here:

https://lore.kernel.org/intel-xe/87ecin7259.wl-ashutosh.dixit@intel.com/

So if we drop RANGE_4, we will currently use up 12 nonpriv slots for each
media engine (leaving no free slots for other workarounds etc.). Of course,
we can fix and merge the patch to increase the available nonpriv slots from
12 to 20. In patches 3 and 4 of this series, we are also trying to stop
whitelisting OASTATUS, so it that goes through (there's some discussion on
Patch 3 currently), that will also free up 1 nonpriv slot (3 in total for
each media engine). So if we do any of this, maybe we will still be able to
drop RANGE_4.

But the question would still be should we still save 3 nonpriv slots or not
(for media engines and 1 nonpriv slot for rcs/ccs). But anyway I think
we'll have to do one of the things mentioned above before we can drop
RANGE_4.

Thanks.
--
Ashutosh

> > Fixes: ed455775c5a6 ("drm/xe/rtp: Refactor OAG MMIO trigger register whitelisting")
> > Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
> > ---
> >  drivers/gpu/drm/xe/xe_reg_whitelist.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/xe/xe_reg_whitelist.c b/drivers/gpu/drm/xe/xe_reg_whitelist.c
> > index 2e84b1c49f374..a17ebacc1455b 100644
> > --- a/drivers/gpu/drm/xe/xe_reg_whitelist.c
> > +++ b/drivers/gpu/drm/xe/xe_reg_whitelist.c
> > @@ -104,10 +104,10 @@ static const struct xe_rtp_table_sr register_whitelist = XE_RTP_TABLE_SR(
> >				   RING_FORCE_TO_NONPRIV_ACCESS_RW))
> >	},
> >
> > -#define WHITELIST_OA_MMIO_TRG(trg, status, head) \
> > +#define WHITELIST_OA_MMIO_TRG(trg, status, tail_buf) \
> >	WHITELIST(trg, RING_FORCE_TO_NONPRIV_ACCESS_RW), \
> >	WHITELIST(status, RING_FORCE_TO_NONPRIV_ACCESS_RD), \
> > -	WHITELIST(head, RING_FORCE_TO_NONPRIV_ACCESS_RD | RING_FORCE_TO_NONPRIV_RANGE_4)
> > +	WHITELIST(tail_buf, RING_FORCE_TO_NONPRIV_ACCESS_RD | RING_FORCE_TO_NONPRIV_RANGE_4)
> >
> >  #define WHITELIST_OAG_MMIO_TRG \
> >	WHITELIST_OA_MMIO_TRG(OAG_MMIOTRIGGER, OAG_OASTATUS, OAG_OAHEADPTR)
> > --
> > 2.54.0
> >

  reply	other threads:[~2026-06-29 16:25 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-17  1:54 [PATCH v2 0/4] drm/xe/oa: A MERTOA bug-fix Ashutosh Dixit
2026-06-17  1:54 ` [PATCH v2 1/4] drm/xe/oa: Rename last argument of WHITELIST_OA_MMIO_TRG Ashutosh Dixit
2026-06-25 23:06   ` Umesh Nerlige Ramappa
2026-06-29 16:33     ` Dixit, Ashutosh
2026-06-26 16:39   ` Matt Roper
2026-06-29 16:25     ` Dixit, Ashutosh [this message]
2026-06-30 23:18       ` Matt Roper
2026-06-17  1:54 ` [PATCH v2 2/4] drm/xe/oa: Fix offset alignment for MERT WHITELIST_OA_MERT_MMIO_TRG Ashutosh Dixit
2026-06-25 23:10   ` Umesh Nerlige Ramappa
2026-06-29 16:27     ` Dixit, Ashutosh
2026-06-29 17:30       ` Dixit, Ashutosh
2026-06-17  1:54 ` [PATCH v2 3/4] drm/xe/oa: Provide OA status through status ioctl for mmap interface Ashutosh Dixit
2026-06-25 23:16   ` Umesh Nerlige Ramappa
2026-06-26 22:39     ` Dixit, Ashutosh
2026-06-17  1:54 ` [PATCH v2 4/4] drm/xe/oa: Stop whitelisting OA status register Ashutosh Dixit
2026-06-25 23:12   ` Umesh Nerlige Ramappa
2026-06-17  1:59 ` ✗ CI.checkpatch: warning for drm/xe/oa: A MERTOA bug-fix (rev2) Patchwork
2026-06-17  2:01 ` ✓ CI.KUnit: success " Patchwork
2026-06-17  2:38 ` ✓ Xe.CI.BAT: " Patchwork
2026-06-17  8:23 ` ✓ Xe.CI.FULL: " 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=87h5mljou6.wl-ashutosh.dixit@intel.com \
    --to=ashutosh.dixit@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.d.roper@intel.com \
    --cc=umesh.nerlige.ramappa@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox