summaryrefslogtreecommitdiff
path: root/tests/pm_rpm.c
AgeCommit message (Collapse)Author
2018-10-02igt/pm_rpm: Handle no-KMS gracefullyChris Wilson
If KMS is not supported, drmGetResources() will return NULL so be careful not to dereference it. However, we still insist that runtime pm works, so keep on testing. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2018-09-27lib/igt_fb: Pass around igt_fb internallyVille Syrjälä
Instead of passing around a boatload of integers everywhere let's just pass around the igt_fb struct. That obviously means we have to populate it first sufficiently, to which end we'll add a small helper. Later on the stride/size calculations will consult the already pre-populated igt_fb and fill in the rest as needed. This makes the whole thing a lot less error prone as it's impossible to accidentally pass the arguments in the wrong order when there's just the one of them, and it's a pointer. v2: Rebase due to uint64_t size Cc: Paulo Zanoni <paulo.r.zanoni@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2018-09-04igt/pm_rpm: Reload the module with full mmio debuggingChris Wilson
Our unclaimed mmio access debugging is lazy, doing cheap checks periodically and only if they fail do a full check around every mmio access. When testing for runtime pm, enable the full mmio debugging from the initial load. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Imre Deak <imre.deak@intel.com> Reviewed-by: Imre Deak <imre.deak@intel.com>
2018-08-20pm_rpm: Require DMC loaded before testing runtime_pm for gen9+Rodrigo Vivi
Since we block runtime PM if DMC is not loaded, let's skip the test. v2: Use i915_dmc_info presence to detect dmc requirement instead of gen check as Chris suggested. v3: Add missing \0 before using buf. (Chris) v4: read only 14 bytes [0:13] so buf[len] is the 15th position. Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Imre Deak <imre.deak@intel.com> Cc: Anusha Srivatsa <anusha.srivatsa@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2018-08-16igt/pm_rpm: Skip counting modes if modprobed with disable_displayChris Wilson
If we've explicitly disabled the display, we will never find any connected outputs or modes. Checking for them will fail and report the missing requirement instead. v2: Sigh, avoid more comparisons against enabled displays v3: Try occasionally compiling patches Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Imre Deak <imre.deak@intel.com> Reviewed-by: Imre Deak <imre.deak@intel.com>
2018-08-16igt/pm_rpm: Include igt_device.hChris Wilson
../tests/pm_rpm.c: In function ‘setup_environment’: ../tests/pm_rpm.c:702:2: warning: implicit declaration of function ‘igt_device_set_master’; did you mean ‘pci_device_cfg_write’? [-Wimplicit-function-declaration] igt_device_set_master(drm_fd); Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Acked-by: Imre Deak <imre.deak@intel.com>
2018-08-16igt/pm_rpm: Avoid at_exit_drm_fdChris Wilson
Keep the drm_fd owned by pm_rpm as we need to relinquish all ownership of the device in order to unload the module. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Imre Deak <imre.deak@intel.com>
2018-08-16igt/pm_rpm: Close local fd before trying to unload moduleChris Wilson
Make sure everything we open in setup_environment() is paired to teardown_environment(). Fixes: d8e78990aa2b ("igt/pm_rpm: Test reaquisition of runtime-pm after module reload") Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Imre Deak <imre.deak@intel.com>
2018-08-14igt/pm_rpm: Test reaquisition of runtime-pm after module reloadChris Wilson
It doesn't work right now and desperately needs to be fixed... Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Imre Deak <imre.deak@intel.com>
2018-08-14igt/pm_rpm: Test incomplete(debug) suspends vs rpmChris Wilson
Check that we restore runtime pm around debug suspends and hibernates. v2: Differentiate between external test setup failure and one of interest v3: Keep basic-rte failing instead of skipping. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Imre Deak <imre.deak@intel.com> Reviewed-by: Imre Deak <imre.deak@intel.com>
2018-07-19lib: Move trash_bos to their only userChris Wilson
Only pm_rpm still uses the igt_trash_aperture() and so we can remove it from the lib and in the process convert it over from the legacy libdrm_intel. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Michał Winiarski <michal.winiarski@intel.com> Reviewed-by: Michał Winiarski <michal.winiarski@intel.com>
2018-07-12igt/pm_rpm: Pass NULL to require no extra module optionsChris Wilson
We use options!=NULL to determine if we should require the module to be reloaded and fail if we find it already loaded. In pm_rpm, we are only ensuring the MSR module is loaded, and only want default options. Fixes: 4dc2ce0e ("lib/kmod: Fail if the module is already loaded") Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Michał Winiarski <michal.winiarski@intel.com>
2018-05-14pm_rpm: Lower the timeout for PC8 entry to 30sArkadiusz Hiler
The timeout for PC8+ residency change is lowered to 30s. During testing the entry always happened in ~10s, so thrice that should be a safe bet. (active USB keyboard, network and screen, no powertop --auto-tune) Cc: Paulo Zanoni <paulo.r.zanoni@intel.com> Cc: Martin Peres <martin.peres@intel.com> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Acked-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2018-05-14pm_rpm: Skip PC8 tests when set limit doesn't allow entryArkadiusz Hiler
On some devices BIOS limits possible Package C-states via setting one of the MSRs. The test now skips if the limit is set to a shallower PC-state than PC8. Cc: Paulo Zanoni <paulo.r.zanoni@intel.com> Cc: Martin Peres <martin.peres@intel.com> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Acked-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2018-03-12tests/pm_rpm: Don't try to create an X-tiled ARGB8888 framebufferVille Syrjälä
On most platforms ARGB8888 is only supported by the cursor plane, which doesn't support tiled buffers. Hence the kernel is under no obligation to accept the request to create a tiled ARGB888 framebuffer. Apparently we've been letting this slip through so far, but that is about to change. Fortunately the resulting fb was neer actually used (in fact the kernel would have rejected the setplane/atomic ioctl with such a framebuffer). All we're really interested here is the gem BO which we feed to the kernel via the setcursor ioctl after changing the tiling to linear. To avoid changing the test drastically we can simply change the fb to XRGB8888, which combined with X-tiling is supported on all platforms. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2018-02-23igt: Use lib gem_execbuf where possibleAntonio Argenziano
Replace custom execbuf ioctl wrapper with the ones in lib. v2: - Lib execbuf wrapper is not signal handling friendly. (Chris) v3: - EXECBUFFER2_WR != EXECBUFFER2. (Chris) v4: Drop gem_exec_fence.c changes Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-12-15lib: Provide a library function to test nop executionChris Wilson
Sometimes a test wants to verify that an engine, or all of them, are functional by executing a nop batch. Provide a common routine to submit an empty batch then test whether the driver is wedged. Reported-by: Antonio Argenziano <antonio.argenziano@intel.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Antonio Argenziano <antonio.argenziano@intel.com> Reviewed-by: Antonio Argenziano <antonio.argenziano@intel.com>
2017-09-06igt/pm_rpm: Use libc 'ftw' rather than opencoding our own filetree walkChris Wilson
By using ftw, we avoid the issue of having to handle directory recursion ourselves and can focus on the test of checking the reading a sysfs/debugfs does not break runtime suspend. In the process, disregard errors when opening the individual files as they may fail for other reasons. v2: Bracket the file open/close with the wait_for_suspended() tests. Whilst the fd is open, it may be keeping the device awake, e.g. i915_forcewake_user. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Tested-by: Jari Tahvanainen <jari.tahvanainen@intel.com>
2017-09-05Use PATH_MAX to fix some sprintf-into-short-buffers warnings.Eric Anholt
Signed-off-by: Eric Anholt <eric@anholt.net> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2017-08-03tests/pm_rpm: Use the quick mode by defaultDaniel Vetter
pm_rpm is one of the main offenders for long runtime in our full igt run. And hey, there's a quick option already, so make it the default. This means there's yet another way to enable stress tests, we really need to standardize this somehow. Or shred the stress-tests we really don't want/need anymore. v2: Fixup the entire help text (David). v3: Switch shortopt from 'q' to 'l', only used internal, so just for clarity (Arkadiusz). Cc: David Weinehall <david.weinehall@linux.intel.com> Cc: Paulo Zanoni <paulo.r.zanoni@intel.com> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2017-04-08igt/pm_rpm: Use directory fd to track and read entire directoriesChris Wilson
Rather than compute the temporary full path name, remember it via the dir fd we already have. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-03-25Replace more system("modprobe")Chris Wilson
As we have libkmod available, it is faster and safer than calling system(). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-03-21Restore "lib: Open debugfs files for the given DRM device"Chris Wilson
This reverts commit 25fbae15262cf570e207e62f50e7c5233e06bc67, restoring commit 301ad44cdf1b868b1ab89096721da91fa8541fdc Author: Tomeu Vizoso <tomeu.vizoso@collabora.com> Date: Thu Mar 2 10:37:11 2017 +0100 lib: Open debugfs files for the given DRM device with fixes. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2017-03-21Revert "lib: Open debugfs files for the given DRM device"Tomeu Vizoso
This reverts commit 301ad44cdf1b868b1ab89096721da91fa8541fdc. When a render-only device is opened and gem_quiescent_gpu is called, we need to use the debugfs dir for the master device instead. Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
2017-03-21lib: Open debugfs files for the given DRM deviceTomeu Vizoso
When opening a DRM debugfs file, locate the right path based on the given DRM device FD. This is needed so, in setups with more than one DRM device, any operations on debugfs files affect the expected DRM device. v2: - rebased and fixed new API additions v3: - updated chamelium test, which was missed previously - use the minor of the device for the debugfs path, not the major - have a proper exit handler for calling igt_hpd_storm_reset with the right device fd. Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Reviewed-by: Robert Foss <robert.foss@collabora.com> Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-10-13lib/igt_aux: Add support for various system suspend/resume optionsImre Deak
To have a more accurate idea about any suspend/resume issues we can perform the s/r until various phases in the s/r sequence. This way we can isolate the given problem as being a device driver, kernel core or BIOS related issue. Actual subtests using these new s/r phases will be added as follow-up. While at it also add the freeze suspend target, it's something we also would need to test. Signed-off-by: Imre Deak <imre.deak@intel.com>
2016-07-09igt/pm_rpm: Fix requirement for external modulesChris Wilson
Don't just fail, skip gracefully if an external module is unavailable. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-07igt/pm_rpm: Wait for PCI D3Chris Wilson
The transition to PCI device state D3 is not instantaneous and only started when runtime suspended. Allow the driver/hardware a little bit of time to complete the transition before declaring a test failure. References: https://bugs.freedesktop.org/show_bug.cgi?id=93123 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2016-03-03tests: fix CRTC assignment for a few testsPaulo Zanoni
All the tests I wrote always assumed that every connector supported CRTC 0. This is not the case for BSW and possibly others, so fix the tests before the CI reports more failures. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2016-03-03lib/igt_kms: add kmstest_get_crtc_idxPaulo Zanoni
Move it from pm_rpm.c to lib/igt_kms and remove the hardcoded version from kms_frontbuffer_tracking. I'm also planning to add other callers. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2016-03-03tests/pm_rpm: Fix CRASH on machines that lack LLCDavid Weinehall
On machines that lack an LLC the pm-caching subtest will terminate with sigbus and thus CRASH during the I915_CACHING_CACHED iteration. To work around this we reset the caching to I915_CACHING_NONE before doing memory access. v2: Various improvements based on feedback from Chris Wilson v3: Fix incorrect Signed-off-by: line v4: Further improvements based on feedback from Chris Wilson Signed-off-by: David Weinehall <david.weinehall@linux.intel.com> Reviewed-by: Imre Deak <imre.deak@intel.com> Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>
2016-02-19lib/igt_pm: Lib for power managementDavid Weinehall
Move power management related code to a separate library. Initially this is done only for workarounds that apply to external components. Modify the users of such workarounds accordingly. This currently involves HD audio and SATA link power management. For SATA link PM there's also code to save the previous settings, to allow for resetting the values after we've finished testing. Signed-off-by: David Weinehall <david.weinehall@intel.com> Reviewed-by: Marius Vlad <marius.c.vlad@intel.com> Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>
2016-01-29tests/pm_rpm: find an appropriate CRTC instead of hardcoding CRTC 0Paulo Zanoni
BSW does not allow CRTC 0 to be used on every connector, so we need to write code to actually find a suitable CRTC. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93124 Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2016-01-29tests/pm_rpm: remove POWER_DIR definitionPaulo Zanoni
Unused ever since we moved some code from pm_rpm.c to lib/. This is currently defined inside igt_aux.c. Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2016-01-08lib: Extract some common fb create+fill methods into helpersVille Syrjälä
Several tests do one or more of the following: * igt_create_fb() + igt_paint_test_pattern() * igt_create_color_fb() + igt_paint_test_pattern() * igt_create_fb() + igt_paint_image() Extract them into new helpers: igt_create_pattern_fb(), igt_create_color_pattern_fb(), igt_create_image_fb(). v2: Fix typos, and improve API docs (Thomas) Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2015-12-04lib/kms+tests: Use cached connector stateDaniel Vetter
Speeds up testcases except for those where we want to exercise the probing itself. The only exceptions left where we do a full probe are - pm_rpm: We use it to make sure the kernel doesn't get things wrong with power domains, so we really want to exercise the full probe paths. And there the only place really is the specific validation done with the data gathered by get_drm_info. - kmstest_force_ functions: Newer kernels should be better at re-probing state when the force sysfs fields change, but better safe than sorry. v2: I also consolidated the start_n_modes and start_connectors while at it - move one of the fixup hunks to this patch that accidentally got misplaced (Thomas). Cc: Thomas Wood <thomas.wood@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2015-12-01tests/pm_rpm: Don't compare edid blob IDsDaniel Vetter
The kernel is free to allocate blob ids however it wants to. And also to reallocate them whenever it sees fit. The only thing we are allowed to compare is the length and the actual date. Removing this bogus check makes drm-resources-equal on my snb. Cc: Paulo Zanoni <paulo.r.zanoni@intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90546 Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
2015-11-27tests/pm_rpm tests for set_caching and set_tiling ioctl(s)Marius Vlad
v4: re-bind the gem objects each time before calling disable_all_screens_and_wait(). v3: Use smaller sizes when allocating gem objects for caching tests. v2: use mmap to gtt instead off cpu and various style-changes. Signed-off-by: Marius Vlad <marius.c.vlad@intel.com> Reviewed-by: Imre Deak <imre.deak@intel.com> Signed-off-by: Imre Deak <imre.deak@intel.com>
2015-11-11Add missing noreturn attribute to various functionsThomas Wood
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-10-12Replace __gem_mmap__{cpu,gtt,wc}() + igt_assert() with gem_mmap__{cpu,gtt,wc}()Ville Syrjälä
gem_mmap__{cpu,gtt,wc}() already has the assert built in, so replace __gem_mmap__{cpu,gtt,wc}() + igt_assert() with it. Mostly done with coccinelle, with some manual help: @@ identifier I; expression E1, E2, E3, E4, E5, E6; @@ ( - I = __gem_mmap__gtt(E1, E2, E3, E4); + I = gem_mmap__gtt(E1, E2, E3, E4); ... - igt_assert(I); | - I = __gem_mmap__cpu(E1, E2, E3, E4, E5); + I = gem_mmap__cpu(E1, E2, E3, E4, E5); ... - igt_assert(I); | - I = __gem_mmap__wc(E1, E2, E3, E4, E5); + I = gem_mmap__wc(E1, E2, E3, E4, E5); ... - igt_assert(I); ) Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Stochastically-reviwewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-10-09Make gem_mmap__{cpu,gtt,wc}() assert on failureVille Syrjälä
Rename the current gem_mmap__{cpu,gtt,wc}() functions into __gem_mmap__{cpu,gtt,wc}(), and add back wrappers with the original name that assert that the pointer is valid. Most callers will expect a valid pointer and shouldn't have to bother with failures. To avoid changing anything (yet), sed 's/gem_mmap__/__gem_mmap__/g' over the entire codebase. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Stochastically-reviwewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-10-09Sprinkle igt_assert(ptr) after gem_mmap__{cpu,gtt,wc}Ville Syrjälä
Do the following ptr = gem_mmap__{cpu,gtt,wc}() +igt_assert(ptr); whenever the code doesn't handle the NULL ptr in any kind of specific way. Makes it easier to move the assert into gem_mmap__{cpu,gtt,wc}() itself. Mostly done with coccinelle, with some manual cleanups: @@ identifier I; @@ <... when != igt_assert(I) when != igt_require(I) when != igt_require_f(I, ...) when != I != NULL when != I == NULL ( I = gem_mmap__gtt(...); + igt_assert(I); | I = gem_mmap__cpu(...); + igt_assert(I); | I = gem_mmap__wc(...); + igt_assert(I); ) ...> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Stochastically-reviwewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-09-11convert drm_open_any*() calls to drm_open_driver*(DRIVER_INTEL) calls with cocciMicah Fedke
Apply the new API to all call sites within the test suite using the following semantic patch: // Semantic patch for replacing drm_open_any* with arch-specific drm_open_driver* calls @@ identifier i =~ "\bdrm_open_any\b"; @@ - i() + drm_open_driver(DRIVER_INTEL) @@ identifier i =~ "\bdrm_open_any_master\b"; @@ - i() + drm_open_driver_master(DRIVER_INTEL) @@ identifier i =~ "\bdrm_open_any_render\b"; @@ - i() + drm_open_driver_render(DRIVER_INTEL) @@ identifier i =~ "\b__drm_open_any\b"; @@ - i() + __drm_open_driver(DRIVER_INTEL) Signed-off-by: Micah Fedke <micah.fedke@collabora.co.uk> Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-08-21lib: add a single include headerThomas Wood
Add a header that includes all the headers for the library. This allows reorganisation of the library without affecting programs using it and also simplifies the headers that need to be included to use the library. Signed-off-by: Thomas Wood <thomas.wood@intel.com>
2015-08-14tests/pm_rpm: mark RTE and D3 tests as basicJesse Barnes
These always need to pass for basic PM functionality. Reviewed-by: Daniel Vetter <daniel@ffwll.ch> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2015-07-14configure: require libdrm >= 2.4.55Paulo Zanoni
And drop the now unnecessary universal plane definitions. The 2.4.55 version is already quite old, so we should be fine. Thanks to Thomas Wood for quickly spotting this. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@>
2015-07-14pm_rpm: remove pm_status_fd declarationPaulo Zanoni
This was forgotten since we moved some code to igt_aux.c a long time ago. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
2015-06-13pm_rpm: Update the debugfs filenameDamien Lespiau
v2: Try to open i915_pc8_status first to make the transition (or just running on older kernels) better. (Paulo) Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-05-15lib: Add a user data pointer to the argument parsing functionsDamien Lespiau
It can be useful to have one of those to carry state between the handler parsing the options and the rest of the test. Right now the only thing we can do is to use global variables for that. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
2015-05-05lib: add igt_wait()Paulo Zanoni
Just a little helper for code that needs to wait for a certain condition to happen. It has the nice advantage that it can survive the signal helper. Despite the callers added in this patch, there is another that will go in a separate patch, and another in a new IGT test file that I plan to push later. v2: Check COND again before returning in case we hit the timeout. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>