summaryrefslogtreecommitdiff
path: root/lib/igt_kmod.c
AgeCommit message (Collapse)Author
2019-01-28lib/igt_kms: Aid static analyzer with the control flowPetri Latvala
If we first find n amount of ':' in a string, the amount is still n when we walk through it the second time. Signed-off-by: Petri Latvala <petri.latvala@intel.com> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
2018-10-26lib/kmod: Unload snd_hdmi_lpe_audioVille Syrjälä
Unload the snd_hdmi_lpe_audio module. Otherwise i915 can't be unloaded. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2018-07-13lib/gt: Make use of dummyload library to create recursive batchAntonio Argenziano
An hanging batch is nothing more than a spinning batch that never gets stopped, so re-use the routines implemented in dummyload.c. v2: Let caller decide spin loop size v3: Only use loose loops for hangs (Chris) v4: No requires v5: Free the spinner v6: Chamelium exists. Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com> #v3 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Antonio Argenziano <antonio.argenziano@intel.com>
2018-07-11lib/kmod: Fail if the module is already loadedChris Wilson
If we want to set new module options, we must load the module or die trying. We may want to always fail if the module if already loaded, but for now, take the small incremental step and insist that the options are set if requested. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2018-03-05lib/sysfs: s/kick_fbcon/bind_fbcon/Ville Syrjälä
Rename kick_fbcon() into bind_fbcon() so that it's not so confusing. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-11-16lib/kmod: Stop reloading i915 after every kselftestChris Wilson
Since CI runs each subtest individually, we do not get the batching of tests and execute every fixture around each subtest. The consequence of this for CI is that we quickly exhaust static allocations like lockdep's array of lockclasses, or causing hash conflicts with new locks being reallocation into existing addresses, the result is a warning from lockdep and ts disabling. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2017-09-13lib/igt_kmod: Allow specifying libkmod config via environment variablesJoonas Lahtinen
Allow specifying the kernel module configuration via environment variables. This allows enumerating the subtests of the kselftest wrappers from sysroot directory. IGT_KMOD_CONFIG_PATHS="" \ IGT_KMOD_DIRNAME="/path/to/sysroot/lib/modules/X.Y.Z" \ tests/drm_mm --list-subtests Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Petri Latvala <petri.latvala@intel.com> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-09-08lib: clean up header includesDaniel Vetter
Just a bit of OCD, I like it when connections within library modules are a bit more obvious. igt.h is ok for tests, but let's use individual include lines for libraries consistently. Also order standard includes before igt ones. v2: Rebase. Acked-by: Jani Nikula <jani.nikula@intel.com> Acked-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Acked-by: Petri Latvala <petri.latvala@intel.com> Acked-by: Daniel Stone <daniels@collabora.com> Acked-by: Radoslaw Szwichtenberg <radoslaw.szwichtenberg@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2017-08-30lib/kmod: Fix error reporting for kmod load/unloadChris Wilson
A "return -err ? err < 0 : err" managed to slip through. So if err was set, we returned 0 or 1 based on sign, or 0 if err was zero. If err is negative, we want treat it as an error, so report it back to the caller, all other values were a success, so convert those to 0. This should actually be no functional change, as all errors were reported as 1, and everything else as 0. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
2017-03-31lib/igt_kmod: Don't call igt_assert or igt_require without a fixturePetri Latvala
If kmod_module_new_from_name fails, igt_kselftest ends up calling igt_skip (through igt_require) when not in a fixture. Instead return normally from igt_kselftest, matching behaviour when the module loading is successful but it doesn't contain selftests. Also change one igt_assert to a return for the same reason. Signed-off-by: Petri Latvala <petri.latvala@intel.com> CC: Chris Wilson <chris@chris-wilson.co.uk>
2017-03-13Revert "Always expose IGT subtests for known kernel selftests"Chris Wilson
This reverts commit 7ab5c97924bf971a348ff4a1768da624ba2f564c.
2017-03-13Always expose IGT subtests for known kernel selftestsPetri Latvala
Even when the running kernel does not support selftests, make subtest enumeration list known kselftests. The list is generated using selftest listing headers copied from the kernel. If the running kernel gains new selftest subtests, they are listed even without copying the headers over and rebuilding IGT. v2: Use correct names for the testcases Signed-off-by: Petri Latvala <petri.latvala@intel.com>
2017-02-08lib/kselftests: Split up igt_kselftests()Chris Wilson
To make it easier to reuse, split up the the single function up into stages. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-02-03lib/igt_kmod: Compare module names with strcmpAnder Conselvan de Oliveira
The function igt_kmod_is_loaded() returns the wrong value when there is a module loaded whose name is a prefix of the name supplied as a parameter. For instance, if the "snd" module is loaded, igt_kmod_is_loaded("snd_hda_intel") will return true even if that module isn't loaded, thus causing drv_module_reload to fail in that scenario. Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-12-22lib/selftest: Query module parameter for error code.Chris Wilson
"Live" selftesting of i915.ko happens during device probing which eats the error code and does not propagate it back to module loading. Workaround this by writing the error code back to the module parameter and probing it after a "successful" install. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-12-17lib/igt_kmod: kmod already supplies a cooked error codeChris Wilson
kmod already does the err = -errno for us. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-12-13lib/kselftest: Apply the filter to the test nameChris Wilson
The filter needs to skip the embedded test number as well. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-12-13lib/kselftest: Parse embedded test number from parameterChris Wilson
Order the tests by an embedded test number from the parameter string. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-12-07Revert "lib/kselftests: Eliminate ENOTTY hack"Chris Wilson
This reverts commit 721866d83907c8ade5d20121418261d715b145ed. Still required for late tests as ->probe() is not allowed to return 1, but must return a negative error code.
2016-12-07lib/kselftests: Eliminate ENOTTY hackChris Wilson
Returning a positive value from module loading does not get interpretted as an error, so we can forgo passing a proxy value of -ENOTTY. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-12-07igt/drv_selftest: Adapt to mock/late splitChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-12-02lib/igt_kmod: Update the prefix match string lengthChris Wilson
Not only do you need to change the prefix string, but you also need to update its length. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-12-02lib/igt_kmod: s/subtest__/igt__/ for kernel parametersChris Wilson
Use igt__ to detect kernel parameters indicating subtests. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-12-02lib/igt_kmod: Squelch the igt assert for a module with no subtestsChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-12-01igt: Add kselftest runner for i915Chris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-12-01lib/igt_kmod: Adopt igt_kselftests()Chris Wilson
Extract the automagic kselftest runner from tests/drm_mm.c to the new lib/igt_kmod.c Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-12-01lib/igt_kmod: New library to support driver loading/unloading and additional ↵Marius Vlad
helpers. lib/igt_aux: Added igt_pkill and igt_lsof helper. lib/igt_kmod: Added load/unload kmod helpers. v7: - document the case where leaving stray fd from drm_open_driver() might fail reloading the driver. - list also current opened files from /dev/dri in case we could not unload the driver. - convert igt_info to igt_warn (Chris Wilson) - added KMOD_|PROCPS CFLAGS (Chris Wilson) v6: - include latest modifications from tests/drv_module_reload: display all loaded modules and list information about opened files by processes (Petri Latvala) v5: - added igt_i915_driver_{load/unload}. - added kick_snd_hda_intel() to match current tests/drv_module_reload_basic and integrated into igt_i915_driver_load/unload. - added gtk-doc section for lib/igt_kmod v4: - decided to split libkmod helpers into their own file as there's another user lib/igt_gvt or tests/gvt_basic. - fixed some gtk-doc documentation. v3: - return -errno (igt_pkill()) in case of failure (Cris Wilson) - return bool for igt_kmod_is_loaded(), replaced strncasecmp with strncmp (Chris Wilson) v2: - Renamed libkmod helpers (Chris Wilson) - Removed SIGTERM/SIGKILL case where we repeatedly tried to terminate the process: just call kill(2) once (Chris Wilson) - Removed redundant check in igt_kmod_unload(), igt_module_in_use() (Chris Wilson) - Pass flags to igt_kmod_unload() from the caller (Chris Wilson) - Removed useless function igt_kill() which acts just as kill(2) (Chris Wilson) Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>