Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: Casey Bowman <casey.g.bowman@intel.com>, intel-gfx@lists.freedesktop.org
Cc: lucas.demarchi@intel.com, daniel.vetter@intel.com,
	ville.syrjala@intel.com, michael.cheng@intel.com
Subject: Re: [Intel-gfx] [RFC PATCH 0/1] Splitting up platform-specific calls
Date: Mon, 07 Feb 2022 15:02:32 +0200	[thread overview]
Message-ID: <87mtj2rfrr.fsf@intel.com> (raw)
In-Reply-To: <20220120221652.207255-1-casey.g.bowman@intel.com>

On Thu, 20 Jan 2022, Casey Bowman <casey.g.bowman@intel.com> wrote:
> In this RFC I would like to ask the community their thoughts
> on how we can best handle splitting architecture-specific
> calls.
>
> I would like to address the following:
>
> 1. How do we want to split architecture calls? Different object files
> per platform? Separate function calls within the same object file?
>
> 2. How do we address dummy functions? If we have a function call that is
> used for one or more platforms, but is not used in another, what should
> we do for this case?
>
> I've given an example of splitting an architecture call
> in my patch with run_as_guest() being split into different
> implementations for x86 and arm64 in separate object files, sharing
> a single header.
>
> Another suggestion from Michael (michael.cheng@intel.com) involved
> using a single object file, a single header, and splitting various
> functions calls via ifdefs in the header file.
>
> I would appreciate any input on how we can avoid scaling issues when
> including multiple architectures and multiple functions (as the number
> of function calls will inevitably increase with more architectures).

Personally I think the functionality is best kept organized by, well,
functionality, not by platform. Otherwise the platform files will
contain all sorts of code with the only common denominator being the
platform.

You're also likely to have static platform specific functions, which
would needlessly have to be made non-static if the split was by files.

I'd just put the implementations for different platforms next to each
other:

#if IS_ENABLED(CONFIG_X86)
...
#elif IS_ENABLED(CONFIG_ARM64)
...
#endif

Usually the declarations would be identical and there'd only be one,
without #ifs in the header.


BR,
Jani.

>
> Casey Bowman (1):
>   i915/drm: Split out x86 and arm64 functionality
>
>  drivers/gpu/drm/i915/Makefile              |  4 +++
>  drivers/gpu/drm/i915/i915_drv.h            |  6 +---
>  drivers/gpu/drm/i915/i915_platform.h       | 16 +++++++++++
>  drivers/gpu/drm/i915/i915_platform_arm64.c | 33 ++++++++++++++++++++++
>  drivers/gpu/drm/i915/i915_platform_x86.c   | 33 ++++++++++++++++++++++
>  5 files changed, 87 insertions(+), 5 deletions(-)
>  create mode 100644 drivers/gpu/drm/i915/i915_platform.h
>  create mode 100644 drivers/gpu/drm/i915/i915_platform_arm64.c
>  create mode 100644 drivers/gpu/drm/i915/i915_platform_x86.c

-- 
Jani Nikula, Intel Open Source Graphics Center

  parent reply	other threads:[~2022-02-07 13:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-20 22:16 [Intel-gfx] [RFC PATCH 0/1] Splitting up platform-specific calls Casey Bowman
2022-01-20 22:16 ` [Intel-gfx] [RFC PATCH 1/1] i915/drm: Split out x86 and arm64 functionality Casey Bowman
2022-01-20 23:58 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Splitting up platform-specific calls Patchwork
2022-01-20 23:59 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-01-21  0:34 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-01-21  4:03 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2022-02-03 23:58 ` [Intel-gfx] [RFC PATCH 0/1] " Casey Bowman
2022-02-07 13:02 ` Jani Nikula [this message]
2022-02-09  5:07   ` Casey Bowman
2022-02-07 15:36 ` Tvrtko Ursulin
2022-02-09  5:25   ` Casey Bowman
2022-02-10 11:10     ` Tvrtko Ursulin
2022-02-10 20:12       ` Casey Bowman

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=87mtj2rfrr.fsf@intel.com \
    --to=jani.nikula@intel.com \
    --cc=casey.g.bowman@intel.com \
    --cc=daniel.vetter@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    --cc=michael.cheng@intel.com \
    --cc=ville.syrjala@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