All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Marius Vlad <marius.c.vlad@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH i-g-t 2/4 v4] lib/igt_gvt: Make use of libkmod helpers and fix reading gvt parameter.
Date: Fri, 28 Oct 2016 11:08:19 +0100	[thread overview]
Message-ID: <20161028100819.GD29769@nuc-i3427.alporthouse.com> (raw)
In-Reply-To: <20161028093129.13275-3-marius.c.vlad@intel.com>

On Fri, Oct 28, 2016 at 12:31:27PM +0300, Marius Vlad wrote:
> Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>
> ---
>  lib/igt_gvt.c     | 42 +++++++++++++++++++++++++++++++++++-------
>  tests/gvt_basic.c |  2 +-
>  2 files changed, 36 insertions(+), 8 deletions(-)
> 
> diff --git a/lib/igt_gvt.c b/lib/igt_gvt.c
> index 8bbf9bd..d868cb3 100644
> --- a/lib/igt_gvt.c
> +++ b/lib/igt_gvt.c
> @@ -24,23 +24,26 @@
>  #include "igt.h"
>  #include "igt_gvt.h"
>  #include "igt_sysfs.h"
> +#include "igt_kmod.h"
>  
> +#include <signal.h>
>  #include <dirent.h>
>  #include <unistd.h>
>  #include <fcntl.h>
> +#include <time.h>
>  
>  static bool is_gvt_enabled(void)
>  {
>  	FILE *file;
> -	int value;
> +	char value;
>  	bool enabled = false;
>  
>  	file = fopen("/sys/module/i915/parameters/enable_gvt", "r");
>  	if (!file)
>  		return false;
>  
> -	if (fscanf(file, "%d", &value) == 1)
> -		enabled = value;
> +	if (fscanf(file, "%c", &value) == 1)
> +		enabled = (value == 'Y' ? true : false);
	enabled = value == 'Y';
else if (fscanf(file, "%d", &value) == 1)
	enabled = value;

Do I see a igt_kmod_parameter_get_boolean() in the future, I think I do!

>  	fclose(file);
>  
>  	errno = 0;
> @@ -50,9 +53,20 @@ static bool is_gvt_enabled(void)
>  static void unload_i915(void)
>  {
>  	kick_fbcon(false);
> -	/* pkill alsact */
>  
> -	igt_ignore_warn(system("/sbin/modprobe -s -r i915"));
> +
> +	if (igt_kmod_is_loaded("i915")) {
> +
> +		if (igt_kmod_is_loaded("snd_hda_intel")) {
> +			igt_assert(!igt_pkill(SIGTERM, "alsactl"));
> +			igt_assert(!igt_kmod_unload("snd_hda_intel", 0));
> +		}
> +
> +		igt_assert(!igt_kmod_unload("i915", 0));
> +		igt_assert(!igt_kmod_unload("drm_kms_helper", 0));
> +		igt_assert(!igt_kmod_unload("drm", 0));

But don't we already have this routine...

For this test, we shouldn't fail if we can't setup the environment as we
need, but skip the test.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-10-28 10:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-28  9:31 [PATCH i-g-t 0/4 v4] Convert sh scripts to C variants Marius Vlad
2016-10-28  9:31 ` [PATCH i-g-t 1/4 v4] lib/{igt_sysfs, igt_aux}: Make available to other users kick_fbcon() (unbind_fbcon()), and added helpers to lib/igt_aux, lib/igt_kmod Marius Vlad
2016-11-26 15:31   ` Chris Wilson
2016-10-28  9:31 ` [PATCH i-g-t 2/4 v4] lib/igt_gvt: Make use of libkmod helpers and fix reading gvt parameter Marius Vlad
2016-10-28 10:08   ` Chris Wilson [this message]
2016-10-30 12:47     ` Marius Vlad
2016-10-30 12:59       ` Chris Wilson
2016-10-28  9:31 ` [PATCH i-g-t 3/4 v4] tests/drv_module_reload: Convert sh script to C version Marius Vlad
2016-10-28  9:48   ` Chris Wilson
2016-10-30 10:53     ` Marius Vlad
2016-10-28  9:31 ` [PATCH i-g-t 4/4 v4] tests/kms_sysfs_edid_timing: Convert sh " Marius Vlad
2016-10-28 10:03   ` Chris Wilson
2016-10-30 11:41     ` Marius Vlad

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=20161028100819.GD29769@nuc-i3427.alporthouse.com \
    --to=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=marius.c.vlad@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.