From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, igt-dev@lists.freedesktop.org
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Subject: Re: [igt-dev] [PATCH i-g-t 1/2] i915: Add test to assert that the PCI-ID is known
Date: Tue, 19 May 2020 17:48:37 +0300 [thread overview]
Message-ID: <87lflot1yy.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20200519141252.2032914-1-chris@chris-wilson.co.uk>
Chris Wilson <chris@chris-wilson.co.uk> writes:
> We do want to ensure that the igt identification table is kept up to
> date, and so would like to be warned if being run on an unknown chipset.
> Instead of refusing to run any test, have a specific test for the
> unknown chipset.
>
> Suggested-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> ---
> tests/Makefile.sources | 3 ++
> tests/i915/i915_pciid.c | 62 +++++++++++++++++++++++++++++++++++++++++
> tests/meson.build | 1 +
> 3 files changed, 66 insertions(+)
> create mode 100644 tests/i915/i915_pciid.c
>
> diff --git a/tests/Makefile.sources b/tests/Makefile.sources
> index c450fa0ed..f1df13465 100644
> --- a/tests/Makefile.sources
> +++ b/tests/Makefile.sources
> @@ -475,6 +475,9 @@ i915_hangman_SOURCES = i915/i915_hangman.c
> TESTS_progs += i915_module_load
> i915_module_load_SOURCES = i915/i915_module_load.c
>
> +TESTS_progs += i915_pciid
> +i915_pciid_SOURCES = i915/i915_pciid.c
> +
> TESTS_progs += i915_pm_backlight
> i915_pm_backlight_SOURCES = i915/i915_pm_backlight.c
>
> diff --git a/tests/i915/i915_pciid.c b/tests/i915/i915_pciid.c
> new file mode 100644
> index 000000000..03d0409c3
> --- /dev/null
> +++ b/tests/i915/i915_pciid.c
> @@ -0,0 +1,62 @@
> +/*
> + * Copyright © 2020 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.
> + *
> + */
> +
> +#include <sys/ioctl.h>
> +
> +#include "drm.h"
> +#include "drmtest.h"
> +#include "i915_drm.h"
> +#include "intel_chipset.h"
> +
> +IGT_TEST_DESCRIPTION("Check that igt/i915 know about this PCI-ID");
> +
> +static bool has_known_intel_chipset(int fd)
> +{
> + int devid = 0;
> + struct drm_i915_getparam gp = {
> + .param = I915_PARAM_CHIPSET_ID,
> + .value = &devid,
> + };
> + const struct intel_device_info *info;
> +
> + if (ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp, sizeof(gp)))
> + return false;
> +
> + info = intel_get_device_info(devid);
> + if (!info) {
> + igt_warn("Unrecongised PCI-ID: %04x\n", devid);
> + return false;
> + }
> +
> + igt_info("PCI-ID: %#04x, gen %d, %s\n",
> + devid, ffs(info->gen), info->codename);
Going past intel_gen but we get the raw non tampered
values into log.
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> + return true;
> +}
> +
> +igt_simple_main
> +{
> + int intel = drm_open_driver(DRIVER_INTEL);
> +
> + igt_assert(has_known_intel_chipset(intel));
> +}
> diff --git a/tests/meson.build b/tests/meson.build
> index 88e4875b6..d021af682 100644
> --- a/tests/meson.build
> +++ b/tests/meson.build
> @@ -218,6 +218,7 @@ i915_progs = [
> 'i915_getparams_basic',
> 'i915_hangman',
> 'i915_module_load',
> + 'i915_pciid',
> 'i915_pm_backlight',
> 'i915_pm_lpsp',
> 'i915_pm_rpm',
> --
> 2.26.2
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2020-05-19 14:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-19 14:12 [igt-dev] [PATCH i-g-t 1/2] i915: Add test to assert that the PCI-ID is known Chris Wilson
2020-05-19 14:12 ` [igt-dev] [PATCH i-g-t 2/2] lib: Remove early has_known_intel_chipset() check Chris Wilson
2020-05-19 14:48 ` Mika Kuoppala [this message]
2020-05-19 17:00 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] i915: Add test to assert that the PCI-ID is known Patchwork
2020-05-20 1:30 ` [igt-dev] ✓ Fi.CI.IGT: " 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=87lflot1yy.fsf@gaia.fi.intel.com \
--to=mika.kuoppala@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=igt-dev@lists.freedesktop.org \
/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