mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Albert Esteve <aesteve@redhat.com>
To: "Harry Wentland" <harry.wentland@amd.com>,
	"Leo Li" <sunpeng.li@amd.com>,
	"Rodrigo Siqueira" <siqueira@igalia.com>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Shuah Khan" <skhan@linuxfoundation.org>,
	"Randy Dunlap" <rdunlap@infradead.org>
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	 linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
	 Maxime Ripard <mripard@kernel.org>,
	Albert Esteve <aesteve@redhat.com>
Subject: [PATCH v2 0/3] drm/amd/display: use kunit/visibility.h for test helpers
Date: Tue, 13 Oct 2026 13:58:12 +0200	[thread overview]
Message-ID: <20261013-visibility-unification-v2-0-3ce8d458bddf@redhat.com> (raw)

amdgpu_dm grew its own STATIC_IFN_KUNIT / EXPORT_IF_KUNIT /
INLINE_IFN_KUNIT macros instead of using kunit/visibility.h. This
series switches the KUnit helpers over to the common API.

VISIBLE_IF_KUNIT is gated on CONFIG_KUNIT rather than
CONFIG_DRM_AMD_DC_KUNIT_TEST, so the helpers are non-static whenever
KUnit is enabled. EXPORT_SYMBOL_IF_KUNIT places the symbols in the
EXPORTED_FOR_KUNIT_TESTING namespace; the AMD DC test files import
that namespace with MODULE_IMPORT_NS().

INLINE_IFN_KUNIT is dropped rather than generalized. It was only used
on amdgpu_dm_fixpt_from_s3132(), inverted the original static inline,
and is unnecessary for tests in another translation unit.

Previous version failed with specific configuration combination
(KUNIT=y, DRM_AMD_DC_KUNIT_TEST=n). Fixed by changing header
declaration guards from CONFIG_DRM_AMD_DC_KUNIT_TEST to
CONFIG_KUNIT to match VISIBLE_IF_KUNIT.

Tested with:
    # Full test run (KUNIT=y, DRM_AMD_DC_KUNIT_TEST=y):
    ./tools/testing/kunit/kunit.py run --arch=x86_64 \
      --kunitconfig=drivers/gpu/drm/amd/display/amdgpu_dm/tests \
      --kconfig_add CONFIG_GCOV=n

    # Build-only, tests disabled (KUNIT=y, DRM_AMD_DC_KUNIT_TEST=n):
    ./tools/testing/kunit/kunit.py build --arch=x86_64 \
      --kconfig_add CONFIG_KUNIT=y \
      --kconfig_add CONFIG_PCI=y \
      --kconfig_add CONFIG_DRM=y \
      --kconfig_add CONFIG_DRM_AMDGPU=y \
      --kconfig_add CONFIG_DRM_AMD_DC=y \
      --kconfig_add CONFIG_WERROR=y

(CONFIG_GCOV omitted; it is not available on x86_64.)

Suggested-by: Maxime Ripard <mripard@kernel.org>

Signed-off-by: Albert Esteve <aesteve@redhat.com>
---
Changes in v2:
- Fix build when CONFIG_KUNIT=y and CONFIG_DRM_AMD_DC_KUNIT_TEST=n
- Fix two missed EXPORT_IF_KUNIT in amdgpu_dm_irq.c
- Rebased to v7.3-rc7
- Link to v1: https://lore.kernel.org/r/20260907-visibility-unification-v1-0-6a962e5b3351@redhat.com

---
Albert Esteve (3):
      drm/amd/display: replace STATIC_IFN_KUNIT with VISIBLE_IF_KUNIT
      drm/amd/display: replace EXPORT_IF_KUNIT with EXPORT_SYMBOL_IF_KUNIT
      drm/amd/display: drop INLINE_IFN_KUNIT

 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c  |  79 ++++-----
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h  |   2 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_audio.c    |  26 +--
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_audio.h    |   2 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_backlight.c    |  74 ++++----
 .../amd/display/amdgpu_dm/amdgpu_dm_backlight.h    |   2 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_color.c    | 133 +++++++--------
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_color.h    |   2 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c  |  12 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.h  |   2 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_connector.c    | 190 ++++++++++-----------
 .../amd/display/amdgpu_dm/amdgpu_dm_connector.h    |   2 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c  |  38 ++---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.h  |   2 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c |  52 +++---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.h |   2 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_cursor.c   |  10 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_cursor.h   |   4 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_dmub.c |  30 ++--
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_dmub.h |   2 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_freesync.c |  10 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c | 105 ++++++------
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.h |   2 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c  | 140 +++++++--------
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.h  |   4 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c  | 150 ++++++++--------
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.h  |   2 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_ism.c  |  40 ++---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_ism.h  |   2 +-
 .../amd/display/amdgpu_dm/amdgpu_dm_mst_types.c    |  60 +++----
 .../amd/display/amdgpu_dm/amdgpu_dm_mst_types.h    |   2 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c    | 104 +++++------
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_plane.h    |   2 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c   | 116 ++++++-------
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.h   |   2 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c  |  22 +--
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.h  |   2 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_quirks.c   |   4 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_replay.c   |   9 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_services.c |  10 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_wb.c   |  18 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_wb.h   |   2 +-
 .../display/amdgpu_dm/tests/amdgpu_dm_audio_test.c |   1 +
 .../amdgpu_dm/tests/amdgpu_dm_backlight_test.c     |   1 +
 .../display/amdgpu_dm/tests/amdgpu_dm_color_test.c |   1 +
 .../amdgpu_dm/tests/amdgpu_dm_colorop_test.c       |   1 +
 .../amdgpu_dm/tests/amdgpu_dm_connector_test.c     |   1 +
 .../display/amdgpu_dm/tests/amdgpu_dm_crc_test.c   |   1 +
 .../display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c  |   1 +
 .../amdgpu_dm/tests/amdgpu_dm_cursor_test.c        |   1 +
 .../display/amdgpu_dm/tests/amdgpu_dm_dmub_test.c  |   1 +
 .../amdgpu_dm/tests/amdgpu_dm_freesync_test.c      |   1 +
 .../display/amdgpu_dm/tests/amdgpu_dm_hdcp_test.c  |   1 +
 .../amdgpu_dm/tests/amdgpu_dm_helpers_test.c       |   1 +
 .../display/amdgpu_dm/tests/amdgpu_dm_irq_test.c   |   1 +
 .../display/amdgpu_dm/tests/amdgpu_dm_ism_test.c   |   1 +
 .../amdgpu_dm/tests/amdgpu_dm_kunit_helpers.c      |   1 +
 .../amdgpu_dm/tests/amdgpu_dm_mst_types_test.c     |   1 +
 .../display/amdgpu_dm/tests/amdgpu_dm_plane_test.c |   1 +
 .../amdgpu_dm/tests/amdgpu_dm_pp_smu_test.c        |   1 +
 .../display/amdgpu_dm/tests/amdgpu_dm_psr_test.c   |   1 +
 .../amdgpu_dm/tests/amdgpu_dm_quirks_test.c        |   1 +
 .../amdgpu_dm/tests/amdgpu_dm_replay_test.c        |   1 +
 .../amdgpu_dm/tests/amdgpu_dm_services_test.c      |   1 +
 .../amd/display/amdgpu_dm/tests/amdgpu_dm_test.c   |   1 +
 .../display/amdgpu_dm/tests/amdgpu_dm_wb_test.c    |   1 +
 drivers/gpu/drm/amd/display/dc/core/dc_sink.c      |   6 +-
 drivers/gpu/drm/amd/display/dc/core/dc_stream.c    |   2 +-
 drivers/gpu/drm/amd/display/dc/dm_helpers.h        |  13 +-
 tools/lib/python/kdoc/xforms_lists.py              |   3 +-
 70 files changed, 771 insertions(+), 751 deletions(-)
---
base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907
change-id: 20260907-visibility-unification-fd358c580447

Best regards,
-- 
Albert Esteve <aesteve@redhat.com>


             reply	other threads:[~2026-10-13 11:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13 11:58 Albert Esteve [this message]
2026-10-13 11:58 ` [PATCH v2 1/3] drm/amd/display: replace STATIC_IFN_KUNIT with VISIBLE_IF_KUNIT Albert Esteve
2026-10-13 11:58 ` [PATCH v2 2/3] drm/amd/display: replace EXPORT_IF_KUNIT with EXPORT_SYMBOL_IF_KUNIT Albert Esteve
2026-10-13 11:58 ` [PATCH v2 3/3] drm/amd/display: drop INLINE_IFN_KUNIT Albert Esteve
2026-10-13 12:00 ` [PATCH v2 0/3] drm/amd/display: use kunit/visibility.h for test helpers Albert Esteve

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=20261013-visibility-unification-v2-0-3ce8d458bddf@redhat.com \
    --to=aesteve@redhat.com \
    --cc=airlied@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=corbet@lwn.net \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=harry.wentland@amd.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mripard@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=simona@ffwll.ch \
    --cc=siqueira@igalia.com \
    --cc=skhan@linuxfoundation.org \
    --cc=sunpeng.li@amd.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

all inboxes | Powered by JetHome®