From: Mauro Carvalho Chehab <mchehab@kernel.org>
To: unlisted-recipients:; (no To-header on input)
Cc: "Mauro Carvalho Chehab" <mchehab@kernel.org>,
"Jason A. Donenfeld" <Jason@zx2c4.com>,
"Toke Høiland-Jørgensen" <toke@toke.dk>,
"Andi Shyti" <andi.shyti@linux.intel.com>,
"Chuck Lever" <chuck.lever@oracle.com>,
"Daniel Vetter" <daniel@ffwll.ch>,
"David Airlie" <airlied@gmail.com>,
"Jani Nikula" <jani.nikula@linux.intel.com>,
"Joonas Lahtinen" <joonas.lahtinen@linux.intel.com>,
"Matt Roper" <matthew.d.roper@intel.com>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
"Tvrtko Ursulin" <tvrtko.ursulin@linux.intel.com>,
"Yury Norov" <yury.norov@gmail.com>,
dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/3] drm/i915: place selftest preparation on a separate function
Date: Thu, 1 Dec 2022 12:32:05 +0000 [thread overview]
Message-ID: <c0ebcad250fc68e4822a921d7ea7a63ae16d381f.1669897668.git.mchehab@kernel.org> (raw)
In-Reply-To: <cover.1669897668.git.mchehab@kernel.org>
The selftest preparation logic should also be used by KUnit. So,
place it on a separate function and export it.
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---
To avoid mailbombing on a large number of people, only mailing lists were C/C on the cover.
See [PATCH 0/3] at: https://lore.kernel.org/all/cover.1669897668.git.mchehab@kernel.org/
drivers/gpu/drm/i915/i915_selftest.h | 2 ++
.../gpu/drm/i915/selftests/i915_selftest.c | 22 ++++++++++++-------
2 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_selftest.h b/drivers/gpu/drm/i915/i915_selftest.h
index bdf3e22c0a34..cd0065033ed9 100644
--- a/drivers/gpu/drm/i915/i915_selftest.h
+++ b/drivers/gpu/drm/i915/i915_selftest.h
@@ -44,6 +44,7 @@ struct i915_selftest {
extern struct i915_selftest i915_selftest;
+void i915_prepare_selftests(const char *name);
int i915_mock_selftests(void);
int i915_live_selftests(struct pci_dev *pdev);
int i915_perf_selftests(struct pci_dev *pdev);
@@ -113,6 +114,7 @@ int __i915_subtests(const char *caller,
#else /* !IS_ENABLED(CONFIG_DRM_I915_SELFTEST) */
+static inline void i915_prepare_selftests(const char *) {};
static inline int i915_mock_selftests(void) { return 0; }
static inline int i915_live_selftests(struct pci_dev *pdev) { return 0; }
static inline int i915_perf_selftests(struct pci_dev *pdev) { return 0; }
diff --git a/drivers/gpu/drm/i915/selftests/i915_selftest.c b/drivers/gpu/drm/i915/selftests/i915_selftest.c
index 39da0fb0d6d2..bc85dac4eb15 100644
--- a/drivers/gpu/drm/i915/selftests/i915_selftest.c
+++ b/drivers/gpu/drm/i915/selftests/i915_selftest.c
@@ -127,13 +127,8 @@ static void set_default_test_all(struct selftest *st, unsigned int count)
st[i].enabled = true;
}
-static int __run_selftests(const char *name,
- struct selftest *st,
- unsigned int count,
- void *data)
+void i915_prepare_selftests(const char *name)
{
- int err = 0;
-
while (!i915_selftest.random_seed)
i915_selftest.random_seed = get_random_u32();
@@ -142,10 +137,21 @@ static int __run_selftests(const char *name,
msecs_to_jiffies_timeout(i915_selftest.timeout_ms) :
MAX_SCHEDULE_TIMEOUT;
- set_default_test_all(st, count);
-
pr_info(DRIVER_NAME ": Performing %s selftests with st_random_seed=0x%x st_timeout=%u\n",
name, i915_selftest.random_seed, i915_selftest.timeout_ms);
+}
+EXPORT_SYMBOL_NS_GPL(i915_prepare_selftests, I915_SELFTEST);
+
+static int __run_selftests(const char *name,
+ struct selftest *st,
+ unsigned int count,
+ void *data)
+{
+ int err = 0;
+
+ i915_prepare_selftests(name);
+
+ set_default_test_all(st, count);
/* Tests are listed in order in i915_*_selftests.h */
for (; count--; st++) {
--
2.38.1
next prev parent reply other threads:[~2022-12-01 12:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-01 12:32 [PATCH 0/3] Add KUnit support for i915 mock selftests Mauro Carvalho Chehab
2022-12-01 12:32 ` Mauro Carvalho Chehab [this message]
2022-12-02 18:16 ` [PATCH 1/3] drm/i915: place selftest preparation on a separate function kernel test robot
2022-12-01 12:32 ` [PATCH 2/3] drm/i915: export all mock selftest functions Mauro Carvalho Chehab
2022-12-01 12:32 ` [PATCH 3/3] drm/i915: allow running mock selftests via Kunit Mauro Carvalho Chehab
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=c0ebcad250fc68e4822a921d7ea7a63ae16d381f.1669897668.git.mchehab@kernel.org \
--to=mchehab@kernel.org \
--cc=Jason@zx2c4.com \
--cc=airlied@gmail.com \
--cc=andi.shyti@linux.intel.com \
--cc=chuck.lever@oracle.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew.d.roper@intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=toke@toke.dk \
--cc=tvrtko.ursulin@linux.intel.com \
--cc=yury.norov@gmail.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®