Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: Matt Roper <matthew.d.roper@intel.com>
Cc: lucas.demarchi@intel.com, intel-xe@lists.freedesktop.org,
	rodrigo.vivi@intel.com
Subject: Re: [Intel-xe] [PATCH 11/18] fixup! drm/xe: Introduce a new DRM driver for Intel GPUs
Date: Tue, 09 May 2023 11:11:22 +0300	[thread overview]
Message-ID: <878rdxorf9.fsf@intel.com> (raw)
In-Reply-To: <20230508203215.GV10045@mdroper-desk1.amr.corp.intel.com>

On Mon, 08 May 2023, Matt Roper <matthew.d.roper@intel.com> wrote:
> On Mon, May 08, 2023 at 05:46:11PM +0300, Jani Nikula wrote:
>> Add the read8 accessor to support intel_de_read8.
>> 
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>> ---
>>  drivers/gpu/drm/xe/xe_mmio.h | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>> 
>> diff --git a/drivers/gpu/drm/xe/xe_mmio.h b/drivers/gpu/drm/xe/xe_mmio.h
>> index 1a32e0f52261..b72a0a75259f 100644
>> --- a/drivers/gpu/drm/xe/xe_mmio.h
>> +++ b/drivers/gpu/drm/xe/xe_mmio.h
>> @@ -17,6 +17,14 @@ struct xe_device;
>>  
>>  int xe_mmio_init(struct xe_device *xe);
>>  
>> +static inline u8 xe_mmio_read8(struct xe_gt *gt, u32 reg)
>> +{
>> +	if (reg < gt->mmio.adj_limit)
>> +		reg += gt->mmio.adj_offset;
>
> This could probably be a warn_on; as far as I know, there are no 8-bit
> registers in the GT, so if we wind up trying to read sgunit or display
> registers through a media GT's pointer it's a clue that something has
> probably gone wrong.

Looks like Rodrigo already pushed this, so this would need to be added
separately.

> Of course this MMIO stuff is a confusing mess due to the fact that xe_gt
> is being used all over the driver for things that are completely
> unrelated to any GT.

This. The abstractions don't match reality.


BR,
Jani.


> After cleaning up the GT vs tile mess, I plan to
> work on coming up with something more sane for MMIO windows too.  I'm
> thinking something like a "struct xe_mmio_view" that will replace xe_gt
> as the first parameter to the xe_mmio_* functions and can provide them
> with additional information to also do range validation on debug builds
> to ensure you're accessing the subset of registers you think you are,
> and functions to hand you an appropriate xe_mmio_view:
>  - xe_mmio_for_display(xe): warns if read/write outside display range
>  - xe_mmio_for_gt(gt): warns if read/write outside a GT range; if media
>    GT is the parameter, also warns if outside the GSI range or one of
>    the media engines
>  - xe_mmio_for_tile(tile):  unrestricted MMIO access for a tile, mostly
>    intended for use with sgunit, soc, etc. registers that are outside
>    the GT
>
>
> Matt
>
>> +
>> +	return readb(gt->mmio.regs + reg);
>> +}
>> +
>>  static inline void xe_mmio_write32(struct xe_gt *gt,
>>  				   u32 reg, u32 val)
>>  {
>> -- 
>> 2.39.2
>> 

-- 
Jani Nikula, Intel Open Source Graphics Center

  reply	other threads:[~2023-05-09  8:11 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-08 14:46 [Intel-xe] [PATCH 00/18] xe&i915 display integration: add uncore and pcode compat layers Jani Nikula
2023-05-08 14:46 ` [Intel-xe] [PATCH 01/18] fixup! drm/xe/display: Implement display support Jani Nikula
2023-05-08 14:46 ` [Intel-xe] [PATCH 02/18] " Jani Nikula
2023-05-08 14:46 ` [Intel-xe] [PATCH 03/18] " Jani Nikula
2023-05-08 14:46 ` [Intel-xe] [PATCH 04/18] fixup! drm/xe/display: Rename intel_de.h to xe_de.h Jani Nikula
2023-05-08 14:46 ` [Intel-xe] [PATCH 05/18] fixup! drm/xe/display: Implement display support Jani Nikula
2023-05-08 14:46 ` [Intel-xe] [PATCH 06/18] fixup! drm/i915/display: Remaining changes to make xe compile Jani Nikula
2023-05-08 14:46 ` [Intel-xe] [PATCH 07/18] fixup! drm/xe/display: Implement display support Jani Nikula
2023-05-08 14:46 ` [Intel-xe] [PATCH 08/18] fixup! drm/i915/display: Add more macros to remove all direct calls to uncore Jani Nikula
2023-05-08 14:46 ` [Intel-xe] [PATCH 09/18] fixup! drm/i915/display: Remove all uncore mmio accesses in favor of intel_de Jani Nikula
2023-05-08 14:46 ` [Intel-xe] [PATCH 10/18] fixup! drm/i915/display: Remaining changes to make xe compile Jani Nikula
2023-05-08 14:46 ` [Intel-xe] [PATCH 11/18] fixup! drm/xe: Introduce a new DRM driver for Intel GPUs Jani Nikula
2023-05-08 20:32   ` Matt Roper
2023-05-09  8:11     ` Jani Nikula [this message]
2023-05-08 14:46 ` [Intel-xe] [PATCH 12/18] fixup! drm/xe/display: Implement display support Jani Nikula
2023-05-08 14:46 ` [Intel-xe] [PATCH 13/18] fixup! drm/i915/display: Remaining changes to make xe compile Jani Nikula
2023-05-08 14:46 ` [Intel-xe] [PATCH 14/18] " Jani Nikula
2023-05-08 14:46 ` [Intel-xe] [PATCH 15/18] fixup! drm/xe/display: Implement display support Jani Nikula
2023-05-08 14:46 ` [Intel-xe] [PATCH 16/18] " Jani Nikula
2023-05-08 14:46 ` [Intel-xe] [PATCH 17/18] " Jani Nikula
2023-05-08 14:46 ` [Intel-xe] [PATCH 18/18] " Jani Nikula
2023-05-08 15:20 ` [Intel-xe] ✓ CI.Patch_applied: success for xe&i915 display integration: add uncore and pcode compat layers (rev2) Patchwork
2023-05-08 17:47 ` [Intel-xe] [PATCH 00/18] xe&i915 display integration: add uncore and pcode compat layers Rodrigo Vivi
  -- strict thread matches above, loose matches on Subject: below --
2023-05-03 13:09 Jani Nikula
2023-05-03 13:09 ` [Intel-xe] [PATCH 11/18] fixup! drm/xe: Introduce a new DRM driver for Intel GPUs Jani Nikula
2023-05-03 13:59   ` Rodrigo Vivi
2023-05-04  6:12     ` Oded Gabbay

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=878rdxorf9.fsf@intel.com \
    --to=jani.nikula@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    --cc=matthew.d.roper@intel.com \
    --cc=rodrigo.vivi@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