Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
	jouni.hogander@intel.com
Subject: Re: [RFC] drm/{i915,xe}/display: pass hooks to display probe
Date: Mon, 6 Oct 2025 19:15:23 +0300	[thread overview]
Message-ID: <aOPrG54HmCDbJK5B@intel.com> (raw)
In-Reply-To: <4010feb576de4f20b7f2323acf12693411344468@intel.com>

On Mon, Oct 06, 2025 at 06:11:41PM +0300, Jani Nikula wrote:
> On Mon, 06 Oct 2025, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> > On Fri, Oct 03, 2025 at 12:21:07PM +0300, Jani Nikula wrote:
> >> Let's gradually start calling i915 and xe core drivers from display via
> >> function pointers passed at display probe. For starters, just add a
> >> small feature test hook ->has_flat_ccs.
> >> 
> >> FIXME: "hooks" is a terrible name, both as a parameter and a struct
> >> intel_display member name. It should reflect that we're calling the core
> >> or parent driver. This is a placeholder name for now.
> >> 
> >> FIXME: Initially, one struct is fine... but once it accumulates a lot of
> >> functions, should it have more indirection? Maybe everything should be
> >> in sub-structs, or the top struct should just be a collection of
> >> pointers to hook structs?
> >> 
> >> 	struct intel_core_hooks {
> >> 		const struct intel_rpm_hooks *rpm;
> >> 	};
> >> 
> >> The above would allow having the struct initialization inside the
> >> implementation file, and the functions themselves static. In any case,
> >> it seems best to have just one initialization of the hooks, instead of
> >> one init/register call for each functional area.
> >> 
> >> The downside is of course having to call the functions like:
> >> 
> >> 	display->hooks->rpm->get(display->drm);
> >> 
> >> FIXME: It would really be convenient if we could stop using a display
> >> device with mock_gem_device() in mock_gem_device.c. The purpose of the
> >> mock gem device is to run mock *gem* tests. Could we make it happen
> >> without display?
> >
> > Haven't really thought too much about the display->xe/i915 direction
> > yet, but I was pondering the opposite direction. Should we even use
> > vfuncs there or perhaps just export the symbols from the display side?
> >
> > But symbol name collisions do worry me. There does seem to be a
> > EXPORT_SYMBOL_FOR_MODULES() now, but I have a nagging feeling that it
> > doesn't actually implement symbol namespaces (as in the same symbol
> > name could be defined in multiple namespaces) but rather just prevents
> > modules from loading when they don't have the permission to use a
> > "namespaced" symbol.
> >
> > So with exports we'd probably have to carefully prefix each exported
> > symbol with "intel_display_" (or whatever). We could of course still
> > use EXPORT_SYMBOL_FOR_MODULES() to make sure other stuff can't access
> > those symbols.
> 
> There's EXPORT_SYMBOL_NS() and MODULE_IMPORT_NS() nowadays that should
> help. We should probably still have the prefixes, but it the namespace
> should tackle the collisions.

I just did a quick test and the build already fails at modpost
if two modules try to export the same symbol name with different
"namespaces". So the "namespace" in the name of this feature is
basically a complete lie. All the symbols still live in the same
global namespace and some modules are just forbidden from calling
some of them. Any actual namespace will still have to be baked
into the symbol name at the exporter.

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2025-10-06 16:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-03  9:21 [RFC] drm/{i915,xe}/display: pass hooks to display probe Jani Nikula
2025-10-03  9:26 ` ✗ CI.checkpatch: warning for " Patchwork
2025-10-03  9:28 ` ✓ CI.KUnit: success " Patchwork
2025-10-03 10:03 ` ✓ Xe.CI.BAT: " Patchwork
2025-10-03 11:55 ` ✗ Xe.CI.Full: failure " Patchwork
2025-10-03 20:44 ` [RFC] " Rodrigo Vivi
2025-10-06 12:52 ` Ville Syrjälä
2025-10-06 15:11   ` Jani Nikula
2025-10-06 16:15     ` Ville Syrjälä [this message]
2025-10-06 16:42       ` Jani Nikula

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=aOPrG54HmCDbJK5B@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=jouni.hogander@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