All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kamil Konieczny <kamil.konieczny@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t v3 2/3] lib/igt_kmod: add support for Xe driver
Date: Wed, 22 Mar 2023 19:00:31 +0100	[thread overview]
Message-ID: <20230322180031.7v2d4publhs6swhx@kamilkon-desk1> (raw)
In-Reply-To: <20230322140030.1800192-3-mauro.chehab@linux.intel.com>

On 2023-03-22 at 15:00:29 +0100, Mauro Carvalho Chehab wrote:
> From: Mauro Carvalho Chehab <mchehab@kernel.org>
> 
> Change the kmod logic to also work with the Xe driver.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>

LGTM,
Reviewed-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>

--
Kamil

> ---
>  lib/igt_kmod.c | 34 +++++++++++++++++-----------------
>  lib/igt_kmod.h | 32 +++++++++++++++++++++++++++++---
>  2 files changed, 46 insertions(+), 20 deletions(-)
> 
> diff --git a/lib/igt_kmod.c b/lib/igt_kmod.c
> index 6d6ecf0187ed..ccf0063ca1b1 100644
> --- a/lib/igt_kmod.c
> +++ b/lib/igt_kmod.c
> @@ -404,23 +404,23 @@ static void *strdup_realloc(char *origptr, const char *strdata)
>  }
>  
>  /**
> - * igt_i915_driver_load:
> - * @opts: options to pass to i915 driver
> + * igt_intel_driver_load:
> + * @opts: options to pass to Intel driver
>   *
> - * Loads the i915 driver and its dependencies.
> + * Loads an Intel driver and its dependencies.
>   *
>   */
>  int
> -igt_i915_driver_load(const char *opts)
> +igt_intel_driver_load(const char *opts, const char *driver)
>  {
>  	int ret;
>  
>  	if (opts)
> -		igt_info("Reloading i915 with %s\n\n", opts);
> +		igt_info("Reloading %s with %s\n\n", driver, opts);
>  
> -	ret = igt_kmod_load("i915", opts);
> +	ret = igt_kmod_load(driver, opts);
>  	if (ret) {
> -		igt_debug("Could not load i915\n");
> +		igt_debug("Could not load %s\n", driver);
>  		return ret;
>  	}
>  
> @@ -496,7 +496,7 @@ int igt_audio_driver_unload(char **who)
>  	return igt_always_unload_audio_driver(who);
>  }
>  
> -int __igt_i915_driver_unload(char **who)
> +int __igt_intel_driver_unload(char **who, const char *driver)
>  {
>  	int ret;
>  
> @@ -530,11 +530,11 @@ int __igt_i915_driver_unload(char **who)
>  		}
>  	}
>  
> -	if (igt_kmod_is_loaded("i915")) {
> -		ret = igt_kmod_unload("i915", 0);
> +	if (igt_kmod_is_loaded(driver)) {
> +		ret = igt_kmod_unload(driver, 0);
>  		if (ret) {
>  			if (who)
> -				*who = strdup_realloc(*who, "i915");
> +				*who = strdup_realloc(*who, driver);
>  
>  			return ret;
>  		}
> @@ -544,18 +544,18 @@ int __igt_i915_driver_unload(char **who)
>  }
>  
>  /**
> - * igt_i915_driver_unload:
> + * igt_intel_driver_unload:
>   *
> - * Unloads the i915 driver and its dependencies.
> + * Unloads an Intel driver and its dependencies.
>   *
>   */
>  int
> -igt_i915_driver_unload(void)
> +igt_intel_driver_unload(const char *driver)
>  {
>  	char *who = NULL;
>  	int ret;
>  
> -	ret = __igt_i915_driver_unload(&who);
> +	ret = __igt_intel_driver_unload(&who, driver);
>  	if (ret) {
>  		igt_warn("Could not unload %s\n", who);
>  		igt_kmod_list_loaded();
> @@ -572,8 +572,8 @@ igt_i915_driver_unload(void)
>  	igt_kmod_unload("drm_kms_helper", 0);
>  	igt_kmod_unload("drm", 0);
>  
> -	if (igt_kmod_is_loaded("i915")) {
> -		igt_warn("i915.ko still loaded!\n");
> +	if (igt_kmod_is_loaded("driver")) {
> +		igt_warn("%s.ko still loaded!\n", driver);
>  		return -EBUSY;
>  	}
>  
> diff --git a/lib/igt_kmod.h b/lib/igt_kmod.h
> index f98dd29fb175..d05af4a69410 100644
> --- a/lib/igt_kmod.h
> +++ b/lib/igt_kmod.h
> @@ -38,9 +38,35 @@ int igt_kmod_unload(const char *mod_name, unsigned int flags);
>  
>  int igt_audio_driver_unload(char **whom);
>  
> -int igt_i915_driver_load(const char *opts);
> -int igt_i915_driver_unload(void);
> -int __igt_i915_driver_unload(char **whom);
> +int igt_intel_driver_load(const char *opts, const char *driver);
> +int igt_intel_driver_unload(const char *driver);
> +int __igt_intel_driver_unload(char **who, const char *driver);
> +
> +static inline int igt_i915_driver_load(const char *opts)
> +{
> +	return igt_intel_driver_load(opts, "i915");
> +}
> +
> +static inline int igt_i915_driver_unload(void)
> +{
> +	return igt_intel_driver_unload("i915");
> +}
> +
> +static inline int __igt_i915_driver_unload(char **whom)
> +{
> +	return __igt_intel_driver_unload(whom, "i915");
> +};
> +
> +static inline int igt_xe_driver_load(const char *opts)
> +{
> +	return igt_intel_driver_load(opts, "xe");
> +}
> +
> +
> +static inline int igt_xe_driver_unload(void)
> +{
> +	return igt_intel_driver_unload("xe");
> +}
>  
>  int igt_amdgpu_driver_load(const char *opts);
>  int igt_amdgpu_driver_unload(void);
> -- 
> 2.39.2
> 


  reply	other threads:[~2023-03-22 18:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-22 14:00 [igt-dev] [PATCH i-g-t v3 0/3] xe/xe_module_load: add a test to load/unload Xe driver Mauro Carvalho Chehab
2023-03-22 14:00 ` [igt-dev] [PATCH i-g-t v3 1/3] intel-ci: update blacklists to work with the " Mauro Carvalho Chehab
2023-03-22 17:44   ` Kamil Konieczny
2023-03-23  7:50     ` Mauro Carvalho Chehab
2023-03-23  7:55       ` Mauro Carvalho Chehab
2023-03-22 14:00 ` [igt-dev] [PATCH i-g-t v3 2/3] lib/igt_kmod: add support for " Mauro Carvalho Chehab
2023-03-22 18:00   ` Kamil Konieczny [this message]
2023-03-22 14:00 ` [igt-dev] [PATCH i-g-t v3 3/3] xe/xe_module_load: add a test to load/unload " Mauro Carvalho Chehab
2023-03-22 18:13   ` Kamil Konieczny
2023-03-22 15:02 ` [igt-dev] ✓ Fi.CI.BAT: success for xe/xe_module_load: add a test to load/unload Xe driver (rev2) Patchwork
2023-03-22 19:25 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2023-03-23  8:27 ` [igt-dev] ✗ Fi.CI.BUILD: failure for xe/xe_module_load: add a test to load/unload Xe driver (rev3) 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=20230322180031.7v2d4publhs6swhx@kamilkon-desk1 \
    --to=kamil.konieczny@linux.intel.com \
    --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 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.