From patchwork Thu Apr 13 22:44:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinay Belgaumkar X-Patchwork-Id: 13210712 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CDDBCC77B6E for ; Thu, 13 Apr 2023 22:41:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8997110E20E; Thu, 13 Apr 2023 22:41:37 +0000 (UTC) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id 34C6810E18B; Thu, 13 Apr 2023 22:41:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681425695; x=1712961695; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=githB5zBJCX/xHnLRmuyn/yGSw4HIadZsweFS/3RV1Y=; b=EvEewUlA0+LWvA7Yd54IlHTLGs9F4EGAYjunRvYLgh8oI/FevxO7fiK+ yXIdPRv/FcVwS9bnVREJ3e2yCJU4YpSqA2oFzp76FRUxkifRmsj63aGfg 2SYVFSkbTq2vup3M2sJOO5UtnKcfIKSlmXJmNvdaeY3lBqHgBi800g9Py 6F2bfCdVy70OJ3fYhrNaQn/dgWV7aZcZOsHy1xJLuo5Mi90LhFcfHERkV xuqXtAs+xAVXjiDjGIsQ+mkgGp9tFJl8UklZhjuwOxBcwTKDs2oQW+qg4 C+8ulI7WQH9LI4iKAmQF/CZowBVVQySbeMw7vLRAAzR6MPmIDb2r78kH+ g==; X-IronPort-AV: E=McAfee;i="6600,9927,10679"; a="344322264" X-IronPort-AV: E=Sophos;i="5.99,195,1677571200"; d="scan'208";a="344322264" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2023 15:41:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10679"; a="863960696" X-IronPort-AV: E=Sophos;i="5.99,195,1677571200"; d="scan'208";a="863960696" Received: from vbelgaum-ubuntu.fm.intel.com ([10.1.27.27]) by orsmga005.jf.intel.com with ESMTP; 13 Apr 2023 15:41:34 -0700 From: Vinay Belgaumkar To: intel-gfx@lists.freedesktop.org, igt-dev@lists.freedesktop.org Date: Thu, 13 Apr 2023 15:44:11 -0700 Message-Id: <20230413224414.2313507-2-vinay.belgaumkar@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230413224414.2313507-1-vinay.belgaumkar@intel.com> References: <20230413224414.2313507-1-vinay.belgaumkar@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t 1/4] lib/debugfs: Add per GT debugfs helpers X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" These can be used to open per-gt debugfs files. Reviewed-by: Ashutosh Dixit Signed-off-by: Tvrtko Ursulin Signed-off-by: Vinay Belgaumkar --- lib/igt_debugfs.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++ lib/igt_debugfs.h | 4 ++++ 2 files changed, 64 insertions(+) diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c index 05889bbe..afde2da6 100644 --- a/lib/igt_debugfs.c +++ b/lib/igt_debugfs.c @@ -217,6 +217,37 @@ int igt_debugfs_dir(int device) return open(path, O_RDONLY); } +/** + * igt_debugfs_gt_dir: + * @device: fd of the device + * @gt: GT instance number + * + * This opens the debugfs directory corresponding to device for use + * with igt_sysfs_get() and related functions. + * + * Returns: + * The directory fd, or -1 on failure. + */ +int igt_debugfs_gt_dir(int device, unsigned int gt) +{ + int debugfs_gt_dir_fd; + char path[PATH_MAX]; + char gtpath[16]; + int ret; + + if (!igt_debugfs_path(device, path, sizeof(path))) + return -1; + + ret = snprintf(gtpath, sizeof(gtpath), "/gt%u", gt); + igt_assert(ret < sizeof(gtpath)); + strncat(path, gtpath, sizeof(path) - 1); + + debugfs_gt_dir_fd = open(path, O_RDONLY); + igt_debug_on_f(debugfs_gt_dir_fd < 0, "path: %s\n", path); + + return debugfs_gt_dir_fd; +} + /** * igt_debugfs_connector_dir: * @device: fd of the device @@ -313,6 +344,35 @@ bool igt_debugfs_exists(int device, const char *filename, int mode) return false; } +/** + * igt_debugfs_gt_open: + * @device: open i915 drm fd + * @gt: gt instance number + * @filename: name of the debugfs node to open + * @mode: mode bits as used by open() + * + * This opens a debugfs file as a Unix file descriptor. The filename should be + * relative to the drm device's root, i.e. without "drm/$minor". + * + * Returns: + * The Unix file descriptor for the debugfs file or -1 if that didn't work out. + */ +int +igt_debugfs_gt_open(int device, unsigned int gt, const char *filename, int mode) +{ + int dir, ret; + + dir = igt_debugfs_gt_dir(device, gt); + if (dir < 0) + return dir; + + ret = openat(dir, filename, mode); + + close(dir); + + return ret; +} + /** * igt_debugfs_simple_read: * @dir: fd of the debugfs directory diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h index 4824344a..3e6194ad 100644 --- a/lib/igt_debugfs.h +++ b/lib/igt_debugfs.h @@ -45,6 +45,10 @@ void __igt_debugfs_write(int fd, const char *filename, const char *buf, int size int igt_debugfs_simple_read(int dir, const char *filename, char *buf, int size); bool igt_debugfs_search(int fd, const char *filename, const char *substring); +int igt_debugfs_gt_dir(int device, unsigned int gt); +int igt_debugfs_gt_open(int device, unsigned int gt, const char *filename, + int mode); + /** * igt_debugfs_read: * @filename: name of the debugfs file From patchwork Thu Apr 13 22:44:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinay Belgaumkar X-Patchwork-Id: 13210713 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6B899C77B61 for ; Thu, 13 Apr 2023 22:41:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D303F10E357; Thu, 13 Apr 2023 22:41:45 +0000 (UTC) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id 24C2910E357; Thu, 13 Apr 2023 22:41:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681425703; x=1712961703; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=w5pxOuRGSTsaNSFiK7P8JuGRt3ZGpoJL7RP3T+HlY+w=; b=kF+Rs2qQtJMIBs253uo4wEAtXX1QFGEN18VkQMgse3QlnWftWLJS3iNT pstRpHZvN8ZH7O15qxyAsRqX/ZUDfZD+viljxuUsEMbMu5qxYzcZUz7p+ 3ypMKoEov8tTxKpF+8VgXeHJjSLeNkwke9tRILEKBn2POyWSoKz4uZOki 8YjWHRuHOCbSmrBCUJxj+sYbxqBKZ0mnZM+Utv86dGClGReDevEQIV9q0 PmwepuylkgLHJAUPufg+XFczy5h0Eg3sR4EsQMwFBP+oXBj0Pi3VgefXm d4S+daTr7U6POGGK6OL/vONLRGA0n3Dlg4jp8I3HaH5FO/RO1s3c2p/ne w==; X-IronPort-AV: E=McAfee;i="6600,9927,10679"; a="344322280" X-IronPort-AV: E=Sophos;i="5.99,195,1677571200"; d="scan'208";a="344322280" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2023 15:41:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10679"; a="863960795" X-IronPort-AV: E=Sophos;i="5.99,195,1677571200"; d="scan'208";a="863960795" Received: from vbelgaum-ubuntu.fm.intel.com ([10.1.27.27]) by orsmga005.jf.intel.com with ESMTP; 13 Apr 2023 15:41:42 -0700 From: Vinay Belgaumkar To: intel-gfx@lists.freedesktop.org, igt-dev@lists.freedesktop.org Date: Thu, 13 Apr 2023 15:44:12 -0700 Message-Id: <20230413224414.2313507-3-vinay.belgaumkar@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230413224414.2313507-1-vinay.belgaumkar@intel.com> References: <20230413224414.2313507-1-vinay.belgaumkar@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t 2/4] lib: Make SLPC helper function per GT X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Use default of 0 where GT id is not being used. Signed-off-by: Vinay Belgaumkar --- lib/igt_pm.c | 20 ++++++++++---------- lib/igt_pm.h | 2 +- tests/i915/i915_pm_rps.c | 6 +++--- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/igt_pm.c b/lib/igt_pm.c index 704acf7d..8ca7c181 100644 --- a/lib/igt_pm.c +++ b/lib/igt_pm.c @@ -1329,21 +1329,21 @@ void igt_pm_print_pci_card_runtime_status(void) } } -bool i915_is_slpc_enabled(int fd) +bool i915_is_slpc_enabled(int drm_fd, int gt) { - int debugfs_fd = igt_debugfs_dir(fd); - char buf[4096] = {}; - int len; + int debugfs_fd; + char buf[256] = {}; + + debugfs_fd = igt_debugfs_gt_open(drm_fd, gt, "uc/guc_slpc_info", O_RDONLY); - igt_require(debugfs_fd != -1); + /* if guc_slpc_info not present then return false */ + if (debugfs_fd < 0) + return false; + read(debugfs_fd, buf, sizeof(buf)-1); - len = igt_debugfs_simple_read(debugfs_fd, "gt/uc/guc_slpc_info", buf, sizeof(buf)); close(debugfs_fd); - if (len < 0) - return false; - else - return strstr(buf, "SLPC state: running"); + return strstr(buf, "SLPC state: running"); } int igt_pm_get_runtime_suspended_time(struct pci_device *pci_dev) diff --git a/lib/igt_pm.h b/lib/igt_pm.h index d0d6d673..1b054dce 100644 --- a/lib/igt_pm.h +++ b/lib/igt_pm.h @@ -84,7 +84,7 @@ void igt_pm_set_d3cold_allowed(struct igt_device_card *card, const char *val); void igt_pm_setup_pci_card_runtime_pm(struct pci_device *pci_dev); void igt_pm_restore_pci_card_runtime_pm(void); void igt_pm_print_pci_card_runtime_status(void); -bool i915_is_slpc_enabled(int fd); +bool i915_is_slpc_enabled(int fd, int gt); int igt_pm_get_runtime_suspended_time(struct pci_device *pci_dev); int igt_pm_get_runtime_usage(struct pci_device *pci_dev); diff --git a/tests/i915/i915_pm_rps.c b/tests/i915/i915_pm_rps.c index d4ee2d58..85dae449 100644 --- a/tests/i915/i915_pm_rps.c +++ b/tests/i915/i915_pm_rps.c @@ -916,21 +916,21 @@ igt_main } igt_subtest("basic-api") { - igt_skip_on_f(i915_is_slpc_enabled(drm_fd), + igt_skip_on_f(i915_is_slpc_enabled(drm_fd, 0), "This subtest is not supported when SLPC is enabled\n"); min_max_config(basic_check, false); } /* Verify the constraints, check if we can reach idle */ igt_subtest("min-max-config-idle") { - igt_skip_on_f(i915_is_slpc_enabled(drm_fd), + igt_skip_on_f(i915_is_slpc_enabled(drm_fd, 0), "This subtest is not supported when SLPC is enabled\n"); min_max_config(idle_check, true); } /* Verify the constraints with high load, check if we can reach max */ igt_subtest("min-max-config-loaded") { - igt_skip_on_f(i915_is_slpc_enabled(drm_fd), + igt_skip_on_f(i915_is_slpc_enabled(drm_fd, 0), "This subtest is not supported when SLPC is enabled\n"); load_helper_run(HIGH); min_max_config(loaded_check, false); From patchwork Thu Apr 13 22:44:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vinay Belgaumkar X-Patchwork-Id: 13210714 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 47043C77B6F for ; Thu, 13 Apr 2023 22:41:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BB6D010E35E; Thu, 13 Apr 2023 22:41:48 +0000 (UTC) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0F8BD10E2BE; Thu, 13 Apr 2023 22:41:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681425707; x=1712961707; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=F+gZPpsMGs+k63spVOCad1n6NS248HSUPO1PeKQYNeI=; b=Bdvo5RADXN5MPBaUlKz770PbtAkzqE84ezBtM8aYsvQNj8jBHWGVP2do s24h2NXOyK2lRqIbLLeIC1Ghtuwri0d6VLKrPEBwtiydf3TPxQRqSYdZV IWI6pM60E2swaEpvNZ+Wtnc27bixEkpa6c9AuLDQVMy+QEHRNknBoeUfV Vn2A+5Z2wHxluhXE/WqGhFSsxzXC6F5Tx8pK4LKCDB2JGlghhpaxeXvqF TZ2T8i3rT73GUfSuNct3a3Mt1VbtsIyLac5ZDXtsD38xGCIrqxGfXppJY gQxCfTaBKTOAjo8qiWIuXjFWpze6DlXOGaFgnbgGAO/aWGGU0/RHL+mFO A==; X-IronPort-AV: E=McAfee;i="6600,9927,10679"; a="344322292" X-IronPort-AV: E=Sophos;i="5.99,195,1677571200"; d="scan'208";a="344322292" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2023 15:41:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10679"; a="863960844" X-IronPort-AV: E=Sophos;i="5.99,195,1677571200"; d="scan'208";a="863960844" Received: from vbelgaum-ubuntu.fm.intel.com ([10.1.27.27]) by orsmga005.jf.intel.com with ESMTP; 13 Apr 2023 15:41:46 -0700 From: Vinay Belgaumkar To: intel-gfx@lists.freedesktop.org, igt-dev@lists.freedesktop.org Date: Thu, 13 Apr 2023 15:44:13 -0700 Message-Id: <20230413224414.2313507-4-vinay.belgaumkar@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230413224414.2313507-1-vinay.belgaumkar@intel.com> References: <20230413224414.2313507-1-vinay.belgaumkar@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t 3/4] i915_pm_freq_api: Add some basic SLPC igt tests X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Validate basic api for GT freq control. Also test interaction with GT reset. We skip rps tests with SLPC enabled, this will re-introduce some coverage. SLPC selftests are already covering some other workload related scenarios. v2: Rename test (Rodrigo) v3: Review comments (Ashutosh) v4: Skip when SLPC is disabled. Check for enable_guc is not sufficient as kernel config may have it but the platform doesn't actually support it. v5: Use the updated SLPC helper Reviewed-by: Ashutosh Dixit Cc: Rodrigo Vivi Signed-off-by: Vinay Belgaumkar --- tests/i915/i915_pm_freq_api.c | 152 ++++++++++++++++++++++++++++++++++ tests/meson.build | 1 + 2 files changed, 153 insertions(+) create mode 100644 tests/i915/i915_pm_freq_api.c diff --git a/tests/i915/i915_pm_freq_api.c b/tests/i915/i915_pm_freq_api.c new file mode 100644 index 00000000..d42b3a2b --- /dev/null +++ b/tests/i915/i915_pm_freq_api.c @@ -0,0 +1,152 @@ +// SPDX-License-Identifier: MIT +/* + * Copyright © 2023 Intel Corporation + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "drmtest.h" +#include "i915/gem.h" +#include "igt_sysfs.h" +#include "igt.h" + +IGT_TEST_DESCRIPTION("Test SLPC freq API"); +/* + * Too many intermediate components and steps before freq is adjusted + * Specially if workload is under execution, so let's wait 100 ms. + */ +#define ACT_FREQ_LATENCY_US 100000 + +static uint32_t get_freq(int dirfd, uint8_t id) +{ + uint32_t val; + + igt_assert(igt_sysfs_rps_scanf(dirfd, id, "%u", &val) == 1); + + return val; +} + +static int set_freq(int dirfd, uint8_t id, uint32_t val) +{ + return igt_sysfs_rps_printf(dirfd, id, "%u", val); +} + +static void test_freq_basic_api(int dirfd, int gt) +{ + uint32_t rpn, rp0, rpe; + + /* Save frequencies */ + rpn = get_freq(dirfd, RPS_RPn_FREQ_MHZ); + rp0 = get_freq(dirfd, RPS_RP0_FREQ_MHZ); + rpe = get_freq(dirfd, RPS_RP1_FREQ_MHZ); + igt_info("System min freq: %dMHz; max freq: %dMHz\n", rpn, rp0); + + /* + * Negative bound tests + * RPn is the floor + * RP0 is the ceiling + */ + igt_assert(set_freq(dirfd, RPS_MIN_FREQ_MHZ, rpn - 1) < 0); + igt_assert(set_freq(dirfd, RPS_MIN_FREQ_MHZ, rp0 + 1) < 0); + igt_assert(set_freq(dirfd, RPS_MAX_FREQ_MHZ, rpn - 1) < 0); + igt_assert(set_freq(dirfd, RPS_MAX_FREQ_MHZ, rp0 + 1) < 0); + + /* Assert min requests are respected from rp0 to rpn */ + igt_assert(set_freq(dirfd, RPS_MIN_FREQ_MHZ, rp0) > 0); + igt_assert(get_freq(dirfd, RPS_MIN_FREQ_MHZ) == rp0); + igt_assert(set_freq(dirfd, RPS_MIN_FREQ_MHZ, rpe) > 0); + igt_assert(get_freq(dirfd, RPS_MIN_FREQ_MHZ) == rpe); + igt_assert(set_freq(dirfd, RPS_MIN_FREQ_MHZ, rpn) > 0); + igt_assert(get_freq(dirfd, RPS_MIN_FREQ_MHZ) == rpn); + + /* Assert max requests are respected from rpn to rp0 */ + igt_assert(set_freq(dirfd, RPS_MAX_FREQ_MHZ, rpn) > 0); + igt_assert(get_freq(dirfd, RPS_MAX_FREQ_MHZ) == rpn); + igt_assert(set_freq(dirfd, RPS_MAX_FREQ_MHZ, rpe) > 0); + igt_assert(get_freq(dirfd, RPS_MAX_FREQ_MHZ) == rpe); + igt_assert(set_freq(dirfd, RPS_MAX_FREQ_MHZ, rp0) > 0); + igt_assert(get_freq(dirfd, RPS_MAX_FREQ_MHZ) == rp0); + +} + +static void test_reset(int i915, int dirfd, int gt) +{ + uint32_t rpn = get_freq(dirfd, RPS_RPn_FREQ_MHZ); + int fd; + + igt_assert(set_freq(dirfd, RPS_MIN_FREQ_MHZ, rpn) > 0); + igt_assert(set_freq(dirfd, RPS_MAX_FREQ_MHZ, rpn) > 0); + usleep(ACT_FREQ_LATENCY_US); + igt_assert(get_freq(dirfd, RPS_MIN_FREQ_MHZ) == rpn); + + /* Manually trigger a GT reset */ + fd = igt_debugfs_gt_open(i915, gt, "reset", O_WRONLY); + igt_require(fd >= 0); + igt_ignore_warn(write(fd, "1\n", 2)); + close(fd); + + igt_assert(get_freq(dirfd, RPS_MIN_FREQ_MHZ) == rpn); + igt_assert(get_freq(dirfd, RPS_MAX_FREQ_MHZ) == rpn); +} + +igt_main +{ + int i915 = -1; + uint32_t *stash_min, *stash_max; + + igt_fixture { + int num_gts, dirfd, gt; + + i915 = drm_open_driver(DRIVER_INTEL); + igt_require_gem(i915); + /* i915_pm_rps already covers execlist path */ + igt_skip_on_f(!i915_is_slpc_enabled(i915, 0), + "This test is supported only with SLPC enabled\n"); + + num_gts = igt_sysfs_get_num_gt(i915); + stash_min = (uint32_t*)malloc(sizeof(uint32_t) * num_gts); + stash_max = (uint32_t*)malloc(sizeof(uint32_t) * num_gts); + + /* Save curr min and max across GTs */ + for_each_sysfs_gt_dirfd(i915, dirfd, gt) { + stash_min[gt] = get_freq(dirfd, RPS_MIN_FREQ_MHZ); + stash_max[gt] = get_freq(dirfd, RPS_MAX_FREQ_MHZ); + } + } + + igt_describe("Test basic API for controlling min/max GT frequency"); + igt_subtest_with_dynamic_f("freq-basic-api") { + int dirfd, gt; + + for_each_sysfs_gt_dirfd(i915, dirfd, gt) + igt_dynamic_f("gt%u", gt) + test_freq_basic_api(dirfd, gt); + } + + igt_describe("Test basic freq API works after a reset"); + igt_subtest_with_dynamic_f("freq-reset") { + int dirfd, gt; + + for_each_sysfs_gt_dirfd(i915, dirfd, gt) + igt_dynamic_f("gt%u", gt) + test_reset(i915, dirfd, gt); + } + + igt_fixture { + int dirfd, gt; + /* Restore frequencies */ + for_each_sysfs_gt_dirfd(i915, dirfd, gt) { + igt_assert(set_freq(dirfd, RPS_MAX_FREQ_MHZ, stash_max[gt]) > 0); + igt_assert(set_freq(dirfd, RPS_MIN_FREQ_MHZ, stash_min[gt]) > 0); + } + close(i915); + } +} diff --git a/tests/meson.build b/tests/meson.build index da31e782..46109f10 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -202,6 +202,7 @@ i915_progs = [ 'gem_workarounds', 'i915_fb_tiling', 'i915_getparams_basic', + 'i915_pm_freq_api', 'i915_hangman', 'i915_hwmon', 'i915_module_load', From patchwork Thu Apr 13 22:44:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinay Belgaumkar X-Patchwork-Id: 13210715 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EC730C77B61 for ; Thu, 13 Apr 2023 22:41:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 48C6D10E384; Thu, 13 Apr 2023 22:41:55 +0000 (UTC) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1E55610E409; Thu, 13 Apr 2023 22:41:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681425713; x=1712961713; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=aaD12jApJdjOdFKvWMiBIy/OKR/4Mufy/Wi2SaZkQ9U=; b=KfeMz+ZCVB1pDaeJsKaLIDzU6a6dxw3sDYsJhpjyidK2TlybOE3EAmvi Cytg+23eZLXZ4BWBxcWcTYUc6OWf4l8wDdm6AJaUtG7EnpSBwJIaODRPl xaFlMj9xLUkyHrxs/BWCvXrDzFWU4sOkvYoyw+IuMxDwILEVhYVwB2NLt IDv8Fgn2EHZXnZlYZPc4ivnNVcqB6Va9SZwnRa60yHAduX+QaYXewP7sC tJ/s3QxesORi2lv2UjMfOQgl4qFutb5h0Al9Fg/mbZBQtw3RdXEaWuYKa 2I2j2csH1EY0ZY5hlh3K8mjHTj+KngUk9fhn9OdppQU29LXqrd6hYOoIV A==; X-IronPort-AV: E=McAfee;i="6600,9927,10679"; a="344322303" X-IronPort-AV: E=Sophos;i="5.99,195,1677571200"; d="scan'208";a="344322303" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2023 15:41:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10679"; a="863960943" X-IronPort-AV: E=Sophos;i="5.99,195,1677571200"; d="scan'208";a="863960943" Received: from vbelgaum-ubuntu.fm.intel.com ([10.1.27.27]) by orsmga005.jf.intel.com with ESMTP; 13 Apr 2023 15:41:52 -0700 From: Vinay Belgaumkar To: intel-gfx@lists.freedesktop.org, igt-dev@lists.freedesktop.org Date: Thu, 13 Apr 2023 15:44:14 -0700 Message-Id: <20230413224414.2313507-5-vinay.belgaumkar@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230413224414.2313507-1-vinay.belgaumkar@intel.com> References: <20230413224414.2313507-1-vinay.belgaumkar@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t 4/4] HAX: tests/i915: Try out the SLPC IGT tests X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Trying out for CI. Do not review. Signed-off-by: Vinay Belgaumkar --- tests/intel-ci/fast-feedback.testlist | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/intel-ci/fast-feedback.testlist b/tests/intel-ci/fast-feedback.testlist index d9fcb62d..653668dd 100644 --- a/tests/intel-ci/fast-feedback.testlist +++ b/tests/intel-ci/fast-feedback.testlist @@ -139,6 +139,8 @@ igt@prime_self_import@basic-with_fd_dup igt@prime_self_import@basic-with_one_bo igt@prime_self_import@basic-with_one_bo_two_files igt@prime_self_import@basic-with_two_bos +igt@i915_pm_freq_api@freq-basic-api +igt@i915_pm_freq_api@freq-reset igt@prime_vgem@basic-fence-flip igt@prime_vgem@basic-fence-mmap igt@prime_vgem@basic-fence-read