From: Jani Nikula <jani.nikula@intel.com>
To: Luca Coelho <luca@coelho.fi>,
intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 3/6] drm/i915/display: add intel_display_run_as_guest()
Date: Thu, 30 Oct 2025 10:48:45 +0200 [thread overview]
Message-ID: <b16635eefb68dfe22ba9c8550cde3f8d4e2ec575@intel.com> (raw)
In-Reply-To: <309c3611169c5362c132ee8496150c74faf22497.camel@coelho.fi>
On Thu, 30 Oct 2025, Luca Coelho <luca@coelho.fi> wrote:
> On Wed, 2025-10-22 at 18:17 +0300, Jani Nikula wrote:
>> Add intel_display_utils.c for display utilities that need more than a
>> header.
>>
>> Start off with intel_display_run_as_guest(). The implementation is
>> intentional duplication of the i915_utils.h i915_run_as_guest(), with
>> the idea that it's small enough to not matter.
>>
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>> ---
>
>
>
>> drivers/gpu/drm/i915/Makefile | 1 +
>> .../gpu/drm/i915/display/intel_display_utils.c | 18 ++++++++++++++++++
>> .../gpu/drm/i915/display/intel_display_utils.h | 6 ++++++
>> drivers/gpu/drm/i915/display/intel_pch.c | 4 ++--
>> drivers/gpu/drm/xe/Makefile | 1 +
>> 5 files changed, 28 insertions(+), 2 deletions(-)
>> create mode 100644 drivers/gpu/drm/i915/display/intel_display_utils.c
>>
>> diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
>> index 47bac9b2c611..046f9282fb65 100644
>> --- a/drivers/gpu/drm/i915/Makefile
>> +++ b/drivers/gpu/drm/i915/Makefile
>> @@ -255,6 +255,7 @@ i915-y += \
>> display/intel_display_rpm.o \
>> display/intel_display_rps.o \
>> display/intel_display_snapshot.o \
>> + display/intel_display_utils.o \
>> display/intel_display_wa.o \
>> display/intel_dmc.o \
>> display/intel_dmc_wl.o \
>> diff --git a/drivers/gpu/drm/i915/display/intel_display_utils.c b/drivers/gpu/drm/i915/display/intel_display_utils.c
>> new file mode 100644
>> index 000000000000..13d3999dd580
>> --- /dev/null
>> +++ b/drivers/gpu/drm/i915/display/intel_display_utils.c
>> @@ -0,0 +1,18 @@
>> +// SPDX-License-Identifier: MIT
>> +/* Copyright © 2025 Intel Corporation */
>> +
>> +#ifdef CONFIG_X86
>> +#include <asm/hypervisor.h>
>> +#endif
>> +
>> +#include "intel_display_utils.h"
>> +
>> +bool intel_display_run_as_guest(struct intel_display *display)
>> +{
>> +#if IS_ENABLED(CONFIG_X86)
>> + return !hypervisor_is_type(X86_HYPER_NATIVE);
>> +#else
>> + /* Not supported yet */
>> + return false;
>> +#endif
>> +}
>
> Why can't this be an inline in the header file?
I'll turn it around. I think there needs to be a rationale for inlining,
not the other way around. A regular function should be the default.
I think the primary reason for inlining would be performance, but I'll
accept small "superfluous" static inlines that don't require pulling in
other headers.
I don't think either is true here.
Additionally the static inline exposes all of that ifdef mess and the
implementation details in the header too. A change in asm/hypervisor.h
leads to a rebuild of everything that includes intel_display_utils.h,
making the header dependencies worse. (Maybe a change in
asm/hypervisor.h leads to a rebuild of everything anyway, but you get
the general point.)
BR,
Jani.
--
Jani Nikula, Intel
next prev parent reply other threads:[~2025-10-30 8:48 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-22 15:17 [PATCH 0/6] drm/i915: i915_utils.h refactoring Jani Nikula
2025-10-22 15:17 ` [PATCH 1/6] drm/i915: split out separate files for jiffies timeout and wait helpers Jani Nikula
2025-10-30 7:53 ` Luca Coelho
2025-10-22 15:17 ` [PATCH 2/6] drm/i915/display: create intel_display_utils.h Jani Nikula
2025-10-30 7:51 ` Luca Coelho
2025-10-22 15:17 ` [PATCH 3/6] drm/i915/display: add intel_display_run_as_guest() Jani Nikula
2025-10-30 7:57 ` Luca Coelho
2025-10-30 8:48 ` Jani Nikula [this message]
2025-10-30 12:14 ` Luca Coelho
2025-10-31 11:26 ` Jani Nikula
2025-10-22 15:17 ` [PATCH 4/6] drm/i915/display: add intel_display_vtd_active() Jani Nikula
2025-10-30 8:00 ` Luca Coelho
2025-10-30 8:50 ` Jani Nikula
2025-10-30 12:16 ` Luca Coelho
2025-10-22 15:17 ` [PATCH 5/6] drm/i915/display: switch to intel_display_utils.h Jani Nikula
2025-10-30 8:03 ` Luca Coelho
2025-10-22 15:17 ` [PATCH 6/6] drm/xe/compat: reduce i915_utils.[ch] Jani Nikula
2025-10-30 8:04 ` Luca Coelho
2025-10-22 21:46 ` ✗ CI.checkpatch: warning for drm/i915: i915_utils.h refactoring Patchwork
2025-10-22 21:47 ` ✓ CI.KUnit: success " Patchwork
2025-10-22 22:03 ` ✗ CI.checksparse: warning " Patchwork
2025-10-22 22:28 ` ✓ Xe.CI.BAT: success " Patchwork
2025-10-23 3:07 ` ✗ Xe.CI.Full: failure " 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=b16635eefb68dfe22ba9c8550cde3f8d4e2ec575@intel.com \
--to=jani.nikula@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=luca@coelho.fi \
/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;
as well as URLs for NNTP newsgroup(s).