From patchwork Thu Mar 17 06:22:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ankitprasad.r.sharma@intel.com X-Patchwork-Id: 8607431 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E1BE59F6E1 for ; Thu, 17 Mar 2016 06:47:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0F4E02026C for ; Thu, 17 Mar 2016 06:47:14 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2FCFC20160 for ; Thu, 17 Mar 2016 06:47:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5FA056EA58; Thu, 17 Mar 2016 06:47:10 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 2A4B26EA58 for ; Thu, 17 Mar 2016 06:46:52 +0000 (UTC) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP; 16 Mar 2016 23:46:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,348,1455004800"; d="scan'208";a="939093273" Received: from ankitprasad-desktop.iind.intel.com ([10.223.82.74]) by fmsmga002.fm.intel.com with ESMTP; 16 Mar 2016 23:46:50 -0700 From: ankitprasad.r.sharma@intel.com To: intel-gfx@lists.freedesktop.org Date: Thu, 17 Mar 2016 11:52:50 +0530 Message-Id: <1458195770-5012-2-git-send-email-ankitprasad.r.sharma@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1458195770-5012-1-git-send-email-ankitprasad.r.sharma@intel.com> References: <1458195770-5012-1-git-send-email-ankitprasad.r.sharma@intel.com> Cc: Ankitprasad Sharma , akash.goel@intel.com Subject: [Intel-gfx] [PATCH 2/2] igt/gem_stolen: No support for stolen backed objects if Intel RST present X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ankitprasad Sharma Skip gem_stolen and pread/pwrite on stolen backed objects if Intel RST device is present. Signed-off-by: Ankitprasad Sharma --- lib/ioctl_wrappers.c | 14 +++++++++++++- tests/gem_pread.c | 3 +++ tests/gem_pwrite.c | 2 ++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c index 4071260..e5ee7ea 100644 --- a/lib/ioctl_wrappers.c +++ b/lib/ioctl_wrappers.c @@ -415,6 +415,18 @@ void gem_sync(int fd, uint32_t handle) errno = 0; } +/* Is the Intel RST device present */ +#define RST_PATH "/sys/bus/acpi/devices/INT3392:00" + +static bool is_rst_present(void) +{ + struct stat st; + + if (stat(RST_PATH, &st) == 0) + return true; + + return false; +} bool gem_create__has_stolen_support(int fd) { @@ -429,7 +441,7 @@ bool gem_create__has_stolen_support(int fd) /* Do we have the extended gem_create_ioctl? */ ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp); - has_stolen_support = val >= 2; + has_stolen_support = val >= 2 && !is_rst_present(); } return has_stolen_support; diff --git a/tests/gem_pread.c b/tests/gem_pread.c index afa072d..f4cf472 100644 --- a/tests/gem_pread.c +++ b/tests/gem_pread.c @@ -152,6 +152,7 @@ int main(int argc, char **argv) } igt_subtest("stolen-normal") { + gem_require_stolen_support(fd); for (count = 1; count <= 1<<17; count <<= 1) { struct timeval start, end; @@ -167,6 +168,7 @@ int main(int argc, char **argv) } for (c = cache; c->level != -1; c++) { igt_subtest_f("stolen-%s", c->name) { + gem_require_stolen_support(fd); gem_set_caching(fd, src_stolen, c->level); for (count = 1; count <= 1<<17; count <<= 1) { @@ -190,6 +192,7 @@ int main(int argc, char **argv) * user space buffer */ igt_subtest("pagefault-pread") { + gem_require_stolen_support(fd); large_stolen = gem_create_stolen(fd, LARGE_OBJECT_SIZE); stolen_nopf_user = (uint32_t *) mmap(NULL, LARGE_OBJECT_SIZE, PROT_WRITE, diff --git a/tests/gem_pwrite.c b/tests/gem_pwrite.c index 42206d7..5d99b29 100644 --- a/tests/gem_pwrite.c +++ b/tests/gem_pwrite.c @@ -206,6 +206,7 @@ int main(int argc, char **argv) } igt_subtest("stolen-normal") { + gem_require_stolen_support(fd); for (count = 1; count <= 1<<17; count <<= 1) { struct timeval start, end; @@ -222,6 +223,7 @@ int main(int argc, char **argv) } for (c = cache; c->level != -1; c++) { + gem_require_stolen_support(fd); igt_subtest_f("stolen-%s", c->name) { gem_set_caching(fd, dst, c->level); for (count = 1; count <= 1<<17; count <<= 1) {