From: Yu Dai <yu.dai@intel.com>
To: Lukasz Fiedorowicz <lukasz.fiedorowicz@intel.com>,
intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH i-g-t] tests/gem_guc_loading: Adding simple GuC loading test
Date: Thu, 7 Jan 2016 15:09:56 -0800 [thread overview]
Message-ID: <568EF044.2050701@intel.com> (raw)
In-Reply-To: <1452010627-15643-1-git-send-email-lukasz.fiedorowicz@intel.com>
This has been reviewed internally. LGTM.
Reviewed-by: Alex Dai <yu.dai@intel.com>
On 01/05/2016 08:17 AM, Lukasz Fiedorowicz wrote:
> Test check GuC debugfs file for successful loading confirmation
>
> Signed-off-by: Lukasz Fiedorowicz <lukasz.fiedorowicz@intel.com>
> ---
> tests/Makefile.sources | 1 +
> tests/gem_guc_loading.c | 89 +++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 90 insertions(+)
> create mode 100644 tests/gem_guc_loading.c
>
> diff --git a/tests/Makefile.sources b/tests/Makefile.sources
> index d594038..331234f 100644
> --- a/tests/Makefile.sources
> +++ b/tests/Makefile.sources
> @@ -36,6 +36,7 @@ TESTS_progs_M = \
> gem_flink_basic \
> gem_flink_race \
> gem_linear_blits \
> + gem_guc_loading \
> gem_madvise \
> gem_mmap \
> gem_mmap_gtt \
> diff --git a/tests/gem_guc_loading.c b/tests/gem_guc_loading.c
> new file mode 100644
> index 0000000..fd53a46
> --- /dev/null
> +++ b/tests/gem_guc_loading.c
> @@ -0,0 +1,89 @@
> +/*
> + * Copyright © 2015 Intel Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> + * IN THE SOFTWARE.
> + *
> + * Authors:
> + * Lukasz Fiedorowicz <lukasz.fiedorowicz@intel.com>
> + *
> + */
> +
> +#include <stdio.h>
> +#include <string.h>
> +#include <sys/stat.h>
> +#include <fcntl.h>
> +
> +#include "igt.h"
> +
> +IGT_TEST_DESCRIPTION("GuC firmware loading test.");
> +
> +#define LOAD_STATUS_BUF_SIZE 96
> +
> +enum guc_status { GUC_ENABLED, GUC_DISABLED };
> +
> +int guc_status_fd;
> +
> +static void open_guc_status(void)
> +{
> + guc_status_fd = igt_debugfs_open("i915_guc_load_status", O_RDONLY);
> + igt_assert_f(guc_status_fd >= 0, "Can't open i915_guc_load_status\n");
> +}
> +
> +static enum guc_status get_guc_status(void)
> +{
> + char buf[LOAD_STATUS_BUF_SIZE];
> +
> + FILE *fp = fdopen(guc_status_fd, "r");
> + igt_assert_f(fp != NULL, "Can't open i915_guc_load_status file\n");
> +
> + while (fgets(buf, LOAD_STATUS_BUF_SIZE, fp))
> + if ((strstr(buf, "\tload: SUCCESS\n")))
> + return GUC_ENABLED;
> +
> + return GUC_DISABLED;
> +}
> +
> +static void close_guc_status(void)
> +{
> + close(guc_status_fd);
> +}
> +
> +static void test_guc_loaded()
> +{
> + igt_assert_f(get_guc_status() == GUC_ENABLED, "GuC is disabled\n");
> +}
> +
> +igt_main
> +{
> + int gfx_fd = 0;
> + int gen = 0;
> +
> + igt_fixture
> + {
> + gfx_fd = drm_open_driver(DRIVER_INTEL);
> + gen = intel_gen(intel_get_drm_devid(gfx_fd));
> + igt_require(gen >= 9);
> + open_guc_status();
> + }
> +
> + igt_subtest("guc_loaded") test_guc_loaded();
> +
> + igt_fixture close_guc_status();
> +}
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-01-07 23:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-05 16:17 [PATCH i-g-t] tests/gem_guc_loading: Adding simple GuC loading test Lukasz Fiedorowicz
2016-01-05 21:10 ` Chris Wilson
2016-01-07 23:09 ` Yu Dai [this message]
2016-01-08 7:55 ` Daniel Vetter
2016-01-14 10:10 ` Fiedorowicz, Lukasz
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=568EF044.2050701@intel.com \
--to=yu.dai@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=lukasz.fiedorowicz@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