From patchwork Fri Jul 30 08:53:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Auld X-Patchwork-Id: 12410737 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CAB93C432BE for ; Fri, 30 Jul 2021 08:53:59 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 98EEF60FED for ; Fri, 30 Jul 2021 08:53:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 98EEF60FED Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1B0F16F405; Fri, 30 Jul 2021 08:53:59 +0000 (UTC) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 30D2E6F405; Fri, 30 Jul 2021 08:53:58 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10060"; a="298644832" X-IronPort-AV: E=Sophos;i="5.84,281,1620716400"; d="scan'208";a="298644832" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2021 01:53:56 -0700 X-IronPort-AV: E=Sophos;i="5.84,281,1620716400"; d="scan'208";a="664763791" Received: from asleatox-mobl.ger.corp.intel.com (HELO mwauld-desk1.intel.com) ([10.213.201.173]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2021 01:53:54 -0700 From: Matthew Auld To: igt-dev@lists.freedesktop.org Date: Fri, 30 Jul 2021 09:53:38 +0100 Message-Id: <20210730085348.2326899-1-matthew.auld@intel.com> X-Mailer: git-send-email 2.26.3 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t v3 01/11] lib/i915/gem_mman: add FIXED mmap mode 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: , Cc: Daniel Vetter , intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" We need this for discrete. v2(Ashutosh): - use the new i915_drm_local.h infrastructure, and drop the LOCAL prefix Signed-off-by: Matthew Auld Cc: Maarten Lankhorst Cc: Ashutosh Dixit Cc: Daniel Vetter Cc: Ramalingam C --- lib/i915/gem_mman.c | 36 ++++++++++++++++++++++++++++++++++++ lib/i915/gem_mman.h | 4 ++++ lib/i915/i915_drm_local.h | 2 ++ 3 files changed, 42 insertions(+) diff --git a/lib/i915/gem_mman.c b/lib/i915/gem_mman.c index 4b4f2114..11df0d76 100644 --- a/lib/i915/gem_mman.c +++ b/lib/i915/gem_mman.c @@ -27,6 +27,7 @@ #include #include "igt_core.h" +#include "igt_gt.h" #include "igt_device.h" #include "ioctl_wrappers.h" #include "intel_chipset.h" @@ -497,6 +498,41 @@ void *gem_mmap_offset__cpu(int fd, uint32_t handle, uint64_t offset, return ptr; } +void *__gem_mmap_offset__fixed(int fd, uint32_t handle, uint64_t offset, + uint64_t size, unsigned prot) +{ + return __gem_mmap_offset(fd, handle, offset, size, prot, + I915_MMAP_OFFSET_FIXED); +} + +/** + * gem_mmap_offset__fixed: Used to mmap objects on discrete platforms + * @fd: open i915 drm file descriptor + * @handle: gem buffer object handle + * @offset: offset in the gem buffer of the mmap arena + * @size: size of the mmap arena + * @prot: memory protection bits as used by mmap() + * + * Like __gem_mmap_offset__fixed() except we assert on failure. + * + * For discrete the caching attributes for the pages are fixed at allocation + * time, and can't be changed. The FIXED mode will simply use the same caching * + * mode of the allocated pages. This mode will always be coherent with GPU + * access. + * + * On non-discrete platforms this mode is not supported. + * + * Returns: A pointer to the created memory mapping + */ +void *gem_mmap_offset__fixed(int fd, uint32_t handle, uint64_t offset, + uint64_t size, unsigned prot) +{ + void *ptr = __gem_mmap_offset__fixed(fd, handle, offset, size, prot); + + igt_assert(ptr); + return ptr; +} + /** * __gem_mmap__cpu_coherent: * @fd: open i915 drm file descriptor diff --git a/lib/i915/gem_mman.h b/lib/i915/gem_mman.h index 5695d2ad..290c997d 100644 --- a/lib/i915/gem_mman.h +++ b/lib/i915/gem_mman.h @@ -37,6 +37,8 @@ bool gem_mmap_offset__has_wc(int fd); void *gem_mmap__wc(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsigned prot); void *gem_mmap_offset__wc(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsigned prot); +void *gem_mmap_offset__fixed(int fd, uint32_t handle, uint64_t offset, + uint64_t size, unsigned prot); void *gem_mmap__device_coherent(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsigned prot); void *gem_mmap__cpu_coherent(int fd, uint32_t handle, uint64_t offset, @@ -54,6 +56,8 @@ void *__gem_mmap_offset__cpu(int fd, uint32_t handle, uint64_t offset, void *__gem_mmap__wc(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsigned prot); void *__gem_mmap_offset__wc(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsigned prot); +void *__gem_mmap_offset__fixed(int fd, uint32_t handle, uint64_t offset, + uint64_t size, unsigned prot); void *__gem_mmap__device_coherent(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsigned prot); void *__gem_mmap_offset(int fd, uint32_t handle, uint64_t offset, uint64_t size, diff --git a/lib/i915/i915_drm_local.h b/lib/i915/i915_drm_local.h index dd646aed..0e3cef81 100644 --- a/lib/i915/i915_drm_local.h +++ b/lib/i915/i915_drm_local.h @@ -20,6 +20,8 @@ extern "C" { * clean these up when kernel uapi headers are sync'd. */ +#define I915_MMAP_OFFSET_FIXED 4 + #if defined(__cplusplus) } #endif From patchwork Fri Jul 30 08:53:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Auld X-Patchwork-Id: 12410741 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1B6EC4320A for ; Fri, 30 Jul 2021 08:54:04 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id A218960F6B for ; Fri, 30 Jul 2021 08:54:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A218960F6B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1E1816F40E; Fri, 30 Jul 2021 08:54:02 +0000 (UTC) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 775276F405; Fri, 30 Jul 2021 08:53:58 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10060"; a="298644835" X-IronPort-AV: E=Sophos;i="5.84,281,1620716400"; d="scan'208";a="298644835" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2021 01:53:58 -0700 X-IronPort-AV: E=Sophos;i="5.84,281,1620716400"; d="scan'208";a="664763805" Received: from asleatox-mobl.ger.corp.intel.com (HELO mwauld-desk1.intel.com) ([10.213.201.173]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2021 01:53:56 -0700 From: Matthew Auld To: igt-dev@lists.freedesktop.org Date: Fri, 30 Jul 2021 09:53:39 +0100 Message-Id: <20210730085348.2326899-2-matthew.auld@intel.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210730085348.2326899-1-matthew.auld@intel.com> References: <20210730085348.2326899-1-matthew.auld@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t v3 02/11] lib/i915/gem_mman: add fixed mode to mmap__device_coherent 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: , Cc: Daniel Vetter , intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On discrete we need to fallback to this mode. v2(Ashutosh): - Move it up the pecking order Signed-off-by: Matthew Auld Cc: Maarten Lankhorst Cc: Ashutosh Dixit Cc: Daniel Vetter Cc: Ramalingam C --- lib/i915/gem_mman.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/i915/gem_mman.c b/lib/i915/gem_mman.c index 11df0d76..c432bb16 100644 --- a/lib/i915/gem_mman.c +++ b/lib/i915/gem_mman.c @@ -382,9 +382,11 @@ void *__gem_mmap__device_coherent(int fd, uint32_t handle, uint64_t offset, { void *ptr = __gem_mmap_offset(fd, handle, offset, size, prot, I915_MMAP_OFFSET_WC); + + if (!ptr) + ptr = __gem_mmap_offset__fixed(fd, handle, offset, size, prot); if (!ptr) ptr = __gem_mmap__wc(fd, handle, offset, size, prot); - if (!ptr) ptr = __gem_mmap__gtt(fd, handle, size, prot); From patchwork Fri Jul 30 08:53:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Auld X-Patchwork-Id: 12410739 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62337C4338F for ; Fri, 30 Jul 2021 08:54:03 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 328DD60F6B for ; Fri, 30 Jul 2021 08:54:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 328DD60F6B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8B6FE6F409; Fri, 30 Jul 2021 08:54:01 +0000 (UTC) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4383B6F409; Fri, 30 Jul 2021 08:54:00 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10060"; a="298644837" X-IronPort-AV: E=Sophos;i="5.84,281,1620716400"; d="scan'208";a="298644837" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2021 01:54:00 -0700 X-IronPort-AV: E=Sophos;i="5.84,281,1620716400"; d="scan'208";a="664763820" Received: from asleatox-mobl.ger.corp.intel.com (HELO mwauld-desk1.intel.com) ([10.213.201.173]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2021 01:53:58 -0700 From: Matthew Auld To: igt-dev@lists.freedesktop.org Date: Fri, 30 Jul 2021 09:53:40 +0100 Message-Id: <20210730085348.2326899-3-matthew.auld@intel.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210730085348.2326899-1-matthew.auld@intel.com> References: <20210730085348.2326899-1-matthew.auld@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t v3 03/11] lib/i915/gem_mman: add fixed mode to gem_mmap_offset__cpu 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: , Cc: Daniel Vetter , intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On discrete we only support the new fixed mode. Signed-off-by: Matthew Auld Cc: Maarten Lankhorst Cc: Ashutosh Dixit Cc: Daniel Vetter Cc: Ramalingam C --- lib/i915/gem_mman.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/i915/gem_mman.c b/lib/i915/gem_mman.c index c432bb16..563a7ccf 100644 --- a/lib/i915/gem_mman.c +++ b/lib/i915/gem_mman.c @@ -474,8 +474,14 @@ void *gem_mmap__cpu(int fd, uint32_t handle, uint64_t offset, uint64_t size, uns void *__gem_mmap_offset__cpu(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsigned prot) { - return __gem_mmap_offset(fd, handle, offset, size, prot, + void *ptr; + + ptr = __gem_mmap_offset(fd, handle, offset, size, prot, I915_MMAP_OFFSET_WB); + if (!ptr) + ptr = __gem_mmap_offset__fixed(fd, handle, offset, size, prot); + + return ptr; } /** From patchwork Fri Jul 30 08:53:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Auld X-Patchwork-Id: 12410743 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 091A9C4338F for ; Fri, 30 Jul 2021 08:54:06 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id C963560F6B for ; Fri, 30 Jul 2021 08:54:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C963560F6B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D29EF6F411; Fri, 30 Jul 2021 08:54:03 +0000 (UTC) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4C8756F411; Fri, 30 Jul 2021 08:54:02 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10060"; a="298644845" X-IronPort-AV: E=Sophos;i="5.84,281,1620716400"; d="scan'208";a="298644845" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2021 01:54:02 -0700 X-IronPort-AV: E=Sophos;i="5.84,281,1620716400"; d="scan'208";a="664763833" Received: from asleatox-mobl.ger.corp.intel.com (HELO mwauld-desk1.intel.com) ([10.213.201.173]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2021 01:54:00 -0700 From: Matthew Auld To: igt-dev@lists.freedesktop.org Date: Fri, 30 Jul 2021 09:53:41 +0100 Message-Id: <20210730085348.2326899-4-matthew.auld@intel.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210730085348.2326899-1-matthew.auld@intel.com> References: <20210730085348.2326899-1-matthew.auld@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t v3 04/11] lib/i915/gem_mman: add fixed mode to gem_mmap__cpu 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: , Cc: Daniel Vetter , intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On discrete we only support the new fixed mode. Signed-off-by: Matthew Auld Cc: Maarten Lankhorst Cc: Ashutosh Dixit Cc: Daniel Vetter Cc: Ramalingam C --- lib/i915/gem_mman.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/i915/gem_mman.c b/lib/i915/gem_mman.c index 563a7ccf..c134e973 100644 --- a/lib/i915/gem_mman.c +++ b/lib/i915/gem_mman.c @@ -436,7 +436,13 @@ void *gem_mmap__device_coherent(int fd, uint32_t handle, uint64_t offset, */ void *__gem_mmap__cpu(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsigned prot) { - return __gem_mmap(fd, handle, offset, size, prot, 0); + void *ptr; + + ptr = __gem_mmap(fd, handle, offset, size, prot, 0); + if (!ptr) + ptr = __gem_mmap_offset__fixed(fd, handle, offset, size, prot); + + return ptr; } /** From patchwork Fri Jul 30 08:53:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Auld X-Patchwork-Id: 12410749 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2F5FC4338F for ; Fri, 30 Jul 2021 08:54:14 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 8060160F6B for ; Fri, 30 Jul 2021 08:54:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8060160F6B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 789906F419; Fri, 30 Jul 2021 08:54:12 +0000 (UTC) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id E41CD6F413; Fri, 30 Jul 2021 08:54:03 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10060"; a="298644849" X-IronPort-AV: E=Sophos;i="5.84,281,1620716400"; d="scan'208";a="298644849" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2021 01:54:03 -0700 X-IronPort-AV: E=Sophos;i="5.84,281,1620716400"; d="scan'208";a="664763853" Received: from asleatox-mobl.ger.corp.intel.com (HELO mwauld-desk1.intel.com) ([10.213.201.173]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2021 01:54:02 -0700 From: Matthew Auld To: igt-dev@lists.freedesktop.org Date: Fri, 30 Jul 2021 09:53:42 +0100 Message-Id: <20210730085348.2326899-5-matthew.auld@intel.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210730085348.2326899-1-matthew.auld@intel.com> References: <20210730085348.2326899-1-matthew.auld@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t v3 05/11] lib/i915/gem_mman: update mmap_offset_types with FIXED 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: , Cc: Daniel Vetter , intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" We need to also iterate the fixed mode in the tests which rely on this. Signed-off-by: Matthew Auld Cc: Maarten Lankhorst Cc: Ashutosh Dixit Cc: Daniel Vetter Cc: Ramalingam C --- lib/i915/gem_mman.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/i915/gem_mman.c b/lib/i915/gem_mman.c index c134e973..c69dc6f5 100644 --- a/lib/i915/gem_mman.c +++ b/lib/i915/gem_mman.c @@ -621,6 +621,7 @@ const struct mmap_offset mmap_offset_types[] = { { "wb", I915_MMAP_OFFSET_WB, I915_GEM_DOMAIN_CPU }, { "wc", I915_MMAP_OFFSET_WC, I915_GEM_DOMAIN_WC }, { "uc", I915_MMAP_OFFSET_UC, I915_GEM_DOMAIN_WC }, + { "fixed", I915_MMAP_OFFSET_FIXED, 0}, {}, }; From patchwork Fri Jul 30 08:53:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Auld X-Patchwork-Id: 12410753 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67D31C4320E for ; Fri, 30 Jul 2021 08:54:16 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 3B56260F6B for ; Fri, 30 Jul 2021 08:54:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3B56260F6B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A811C6F41A; Fri, 30 Jul 2021 08:54:12 +0000 (UTC) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id B18B46F415; Fri, 30 Jul 2021 08:54:05 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10060"; a="298644854" X-IronPort-AV: E=Sophos;i="5.84,281,1620716400"; d="scan'208";a="298644854" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2021 01:54:05 -0700 X-IronPort-AV: E=Sophos;i="5.84,281,1620716400"; d="scan'208";a="664763867" Received: from asleatox-mobl.ger.corp.intel.com (HELO mwauld-desk1.intel.com) ([10.213.201.173]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2021 01:54:03 -0700 From: Matthew Auld To: igt-dev@lists.freedesktop.org Date: Fri, 30 Jul 2021 09:53:43 +0100 Message-Id: <20210730085348.2326899-6-matthew.auld@intel.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210730085348.2326899-1-matthew.auld@intel.com> References: <20210730085348.2326899-1-matthew.auld@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t v3 06/11] lib/ioctl_wrappers: update mmap_{read, write} for discrete 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: , Cc: Daniel Vetter , intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" We can no longer just call get_caching or set_domain, and the mmap mode must be FIXED. This should bring back gem_exec_basic and a few others in CI on DG1. Signed-off-by: Matthew Auld Cc: Maarten Lankhorst Cc: Ashutosh Dixit Cc: Daniel Vetter Cc: Ramalingam C --- lib/ioctl_wrappers.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c index 25c5e495..7e27a1b3 100644 --- a/lib/ioctl_wrappers.c +++ b/lib/ioctl_wrappers.c @@ -339,7 +339,18 @@ static void mmap_write(int fd, uint32_t handle, uint64_t offset, if (!length) return; - if (is_cache_coherent(fd, handle)) { + if (gem_has_lmem(fd)) { + /* + * set/get_caching and set_domain are no longer supported on + * discrete, also the only mmap mode supportd is FIXED. + */ + map = gem_mmap_offset__fixed(fd, handle, 0, + offset + length, + PROT_READ | PROT_WRITE); + igt_assert_eq(gem_wait(fd, handle, 0), 0); + } + + if (!map && is_cache_coherent(fd, handle)) { /* offset arg for mmap functions must be 0 */ map = __gem_mmap__cpu_coherent(fd, handle, 0, offset + length, PROT_READ | PROT_WRITE); @@ -369,7 +380,17 @@ static void mmap_read(int fd, uint32_t handle, uint64_t offset, void *buf, uint6 if (!length) return; - if (gem_has_llc(fd) || is_cache_coherent(fd, handle)) { + if (gem_has_lmem(fd)) { + /* + * set/get_caching and set_domain are no longer supported on + * discrete, also the only supported mmap mode is FIXED. + */ + map = gem_mmap_offset__fixed(fd, handle, 0, + offset + length, PROT_READ); + igt_assert_eq(gem_wait(fd, handle, 0), 0); + } + + if (!map && (gem_has_llc(fd) || is_cache_coherent(fd, handle))) { /* offset arg for mmap functions must be 0 */ map = __gem_mmap__cpu_coherent(fd, handle, 0, offset + length, PROT_READ); From patchwork Fri Jul 30 08:53:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Auld X-Patchwork-Id: 12410747 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFA9EC4320A for ; Fri, 30 Jul 2021 08:54:13 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id ADA4A60FED for ; Fri, 30 Jul 2021 08:54:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org ADA4A60FED Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 730656F416; Fri, 30 Jul 2021 08:54:12 +0000 (UTC) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id AF5FF6F415; Fri, 30 Jul 2021 08:54:07 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10060"; a="298644859" X-IronPort-AV: E=Sophos;i="5.84,281,1620716400"; d="scan'208";a="298644859" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2021 01:54:07 -0700 X-IronPort-AV: E=Sophos;i="5.84,281,1620716400"; d="scan'208";a="664763879" Received: from asleatox-mobl.ger.corp.intel.com (HELO mwauld-desk1.intel.com) ([10.213.201.173]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2021 01:54:05 -0700 From: Matthew Auld To: igt-dev@lists.freedesktop.org Date: Fri, 30 Jul 2021 09:53:44 +0100 Message-Id: <20210730085348.2326899-7-matthew.auld@intel.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210730085348.2326899-1-matthew.auld@intel.com> References: <20210730085348.2326899-1-matthew.auld@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t v3 07/11] lib/intel_bufops: update mmap_{read, write} for discrete 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: , Cc: Daniel Vetter , intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On discrete we can no longer call get_caching or set_domain, and the mmap mode must be FIXED. Signed-off-by: Matthew Auld Cc: Maarten Lankhorst Cc: Ashutosh Dixit Cc: Daniel Vetter Cc: Ramalingam C --- lib/intel_bufops.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/lib/intel_bufops.c b/lib/intel_bufops.c index 3ce68663..faca4406 100644 --- a/lib/intel_bufops.c +++ b/lib/intel_bufops.c @@ -424,7 +424,18 @@ static void *mmap_write(int fd, struct intel_buf *buf) { void *map = NULL; - if (is_cache_coherent(fd, buf->handle)) { + if (gem_has_lmem(fd)) { + /* + * set/get_caching and set_domain are no longer supported on + * discrete, also the only mmap mode supportd is FIXED. + */ + map = gem_mmap_offset__fixed(fd, buf->handle, 0, + buf->surface[0].size, + PROT_READ | PROT_WRITE); + igt_assert_eq(gem_wait(fd, buf->handle, 0), 0); + } + + if (!map && is_cache_coherent(fd, buf->handle)) { map = __gem_mmap_offset__cpu(fd, buf->handle, 0, buf->surface[0].size, PROT_READ | PROT_WRITE); if (!map) @@ -455,7 +466,17 @@ static void *mmap_read(int fd, struct intel_buf *buf) { void *map = NULL; - if (gem_has_llc(fd) || is_cache_coherent(fd, buf->handle)) { + if (gem_has_lmem(fd)) { + /* + * set/get_caching and set_domain are no longer supported on + * discrete, also the only supported mmap mode is FIXED. + */ + map = gem_mmap_offset__fixed(fd, buf->handle, 0, + buf->surface[0].size, PROT_READ); + igt_assert_eq(gem_wait(fd, buf->handle, 0), 0); + } + + if (!map && (gem_has_llc(fd) || is_cache_coherent(fd, buf->handle))) { map = __gem_mmap_offset__cpu(fd, buf->handle, 0, buf->surface[0].size, PROT_READ); if (!map) From patchwork Fri Jul 30 08:53:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Auld X-Patchwork-Id: 12410751 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F038C432BE for ; Fri, 30 Jul 2021 08:54:15 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 5D61E60F6B for ; Fri, 30 Jul 2021 08:54:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5D61E60F6B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 05F7E6F41D; Fri, 30 Jul 2021 08:54:13 +0000 (UTC) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id D2AB26F415; Fri, 30 Jul 2021 08:54:09 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10060"; a="298644864" X-IronPort-AV: E=Sophos;i="5.84,281,1620716400"; d="scan'208";a="298644864" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2021 01:54:09 -0700 X-IronPort-AV: E=Sophos;i="5.84,281,1620716400"; d="scan'208";a="664763884" Received: from asleatox-mobl.ger.corp.intel.com (HELO mwauld-desk1.intel.com) ([10.213.201.173]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2021 01:54:07 -0700 From: Matthew Auld To: igt-dev@lists.freedesktop.org Date: Fri, 30 Jul 2021 09:53:45 +0100 Message-Id: <20210730085348.2326899-8-matthew.auld@intel.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210730085348.2326899-1-matthew.auld@intel.com> References: <20210730085348.2326899-1-matthew.auld@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t v3 08/11] lib/ioctl_wrappers: update set_domain for discrete 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: , Cc: Daniel Vetter , intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On discrete set_domain is now gone, instead we just need to add the wait. Signed-off-by: Matthew Auld Cc: Maarten Lankhorst Cc: Ashutosh Dixit Cc: Daniel Vetter Cc: Ramalingam C Reviewed-by: Ashutosh Dixit --- lib/ioctl_wrappers.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c index 7e27a1b3..09eb3ce7 100644 --- a/lib/ioctl_wrappers.c +++ b/lib/ioctl_wrappers.c @@ -565,7 +565,12 @@ int __gem_set_domain(int fd, uint32_t handle, uint32_t read, uint32_t write) */ void gem_set_domain(int fd, uint32_t handle, uint32_t read, uint32_t write) { - igt_assert_eq(__gem_set_domain(fd, handle, read, write), 0); + int ret = __gem_set_domain(fd, handle, read, write); + + if (ret == -ENODEV && gem_has_lmem(fd)) + igt_assert_eq(gem_wait(fd, handle, 0), 0); + else + igt_assert_eq(ret, 0); } /** From patchwork Fri Jul 30 08:53:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Auld X-Patchwork-Id: 12410745 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60F06C432BE for ; Fri, 30 Jul 2021 08:54:13 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 2998E60F6B for ; Fri, 30 Jul 2021 08:54:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2998E60F6B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B5E126F41B; Fri, 30 Jul 2021 08:54:12 +0000 (UTC) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7325B6F416; Fri, 30 Jul 2021 08:54:11 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10060"; a="298644866" X-IronPort-AV: E=Sophos;i="5.84,281,1620716400"; d="scan'208";a="298644866" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2021 01:54:11 -0700 X-IronPort-AV: E=Sophos;i="5.84,281,1620716400"; d="scan'208";a="664763897" Received: from asleatox-mobl.ger.corp.intel.com (HELO mwauld-desk1.intel.com) ([10.213.201.173]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2021 01:54:09 -0700 From: Matthew Auld To: igt-dev@lists.freedesktop.org Date: Fri, 30 Jul 2021 09:53:46 +0100 Message-Id: <20210730085348.2326899-9-matthew.auld@intel.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210730085348.2326899-1-matthew.auld@intel.com> References: <20210730085348.2326899-1-matthew.auld@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t v3 09/11] tests/i915/module_load: update for discrete 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: , Cc: Daniel Vetter , intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" The set_caching ioctl is gone for discrete, and now just returns -ENODEV. Update the gem_sanitycheck to account for that. After this we should be back to just having the breakage caused by missing reloc support for the reload testcase. Signed-off-by: Matthew Auld Cc: Maarten Lankhorst Cc: Ashutosh Dixit Cc: Daniel Vetter Cc: Ramalingam C Reviewed-by: Ashutosh Dixit --- tests/i915/i915_module_load.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/i915/i915_module_load.c b/tests/i915/i915_module_load.c index 98ceb5d8..4b42fe3e 100644 --- a/tests/i915/i915_module_load.c +++ b/tests/i915/i915_module_load.c @@ -172,17 +172,22 @@ static void gem_sanitycheck(void) { struct drm_i915_gem_caching args = {}; int i915 = __drm_open_driver(DRIVER_INTEL); + int expected; int err; + expected = -ENOENT; + if (gem_has_lmem(i915)) + expected = -ENODEV; + err = 0; if (ioctl(i915, DRM_IOCTL_I915_GEM_SET_CACHING, &args)) err = -errno; - if (err == -ENOENT) + if (err == expected) store_all(i915); errno = 0; close(i915); - igt_assert_eq(err, -ENOENT); + igt_assert_eq(err, expected); } static void From patchwork Fri Jul 30 08:53:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Auld X-Patchwork-Id: 12410755 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36439C4338F for ; Fri, 30 Jul 2021 08:54:17 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id F2ACB60F6B for ; Fri, 30 Jul 2021 08:54:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org F2ACB60F6B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 33FAD6F413; Fri, 30 Jul 2021 08:54:15 +0000 (UTC) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 49BE56F41F; Fri, 30 Jul 2021 08:54:13 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10060"; a="298644873" X-IronPort-AV: E=Sophos;i="5.84,281,1620716400"; d="scan'208";a="298644873" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2021 01:54:13 -0700 X-IronPort-AV: E=Sophos;i="5.84,281,1620716400"; d="scan'208";a="664763904" Received: from asleatox-mobl.ger.corp.intel.com (HELO mwauld-desk1.intel.com) ([10.213.201.173]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2021 01:54:11 -0700 From: Matthew Auld To: igt-dev@lists.freedesktop.org Date: Fri, 30 Jul 2021 09:53:47 +0100 Message-Id: <20210730085348.2326899-10-matthew.auld@intel.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210730085348.2326899-1-matthew.auld@intel.com> References: <20210730085348.2326899-1-matthew.auld@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t v3 10/11] lib/i915/gem_mman: add helper query for has_device_coherent 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: , Cc: Daniel Vetter , intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Might be useful in some tests, where we are not explicitly testing WC maps, but rather just require something that is "device coherent", which should also play nice on discrete platforms. Signed-off-by: Matthew Auld Cc: Maarten Lankhorst Cc: Ashutosh Dixit Cc: Daniel Vetter Cc: Ramalingam C --- lib/i915/gem_mman.c | 39 +++++++++++++++++++++++++++++++++++++++ lib/i915/gem_mman.h | 11 +++++++++++ 2 files changed, 50 insertions(+) diff --git a/lib/i915/gem_mman.c b/lib/i915/gem_mman.c index c69dc6f5..0406a0b9 100644 --- a/lib/i915/gem_mman.c +++ b/lib/i915/gem_mman.c @@ -197,6 +197,45 @@ bool gem_mmap_offset__has_wc(int fd) return has_wc > 0; } +bool gem_mmap__has_device_coherent(int fd) +{ + struct drm_i915_gem_mmap_offset arg; + bool supported; + + if (gem_mmap__has_wc(fd)) + return true; + + /* Maybe we still have GTT mmaps? */ + memset(&arg, 0, sizeof(arg)); + arg.handle = gem_create(fd, 4096); + arg.offset = 0; + arg.flags = I915_MMAP_OFFSET_GTT; + supported = igt_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP_OFFSET, + &arg) == 0; + gem_close(fd, arg.handle); + + errno = 0; + + if (supported) + return true; + + /* + * Maybe this is a discrete device, which only supports fixed mmaps? + * Such mappings should also be considered device coherent. + */ + memset(&arg, 0, sizeof(arg)); + arg.handle = gem_create(fd, 4096); + arg.offset = 0; + arg.flags = I915_MMAP_OFFSET_FIXED; + supported = igt_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP_OFFSET, + &arg) == 0; + gem_close(fd, arg.handle); + + errno = 0; + + return supported; +} + /** * __gem_mmap: * @fd: open i915 drm file descriptor diff --git a/lib/i915/gem_mman.h b/lib/i915/gem_mman.h index 290c997d..5966ddb5 100644 --- a/lib/i915/gem_mman.h +++ b/lib/i915/gem_mman.h @@ -41,6 +41,7 @@ void *gem_mmap_offset__fixed(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsigned prot); void *gem_mmap__device_coherent(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsigned prot); +bool gem_mmap__has_device_coherent(int fd); void *gem_mmap__cpu_coherent(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsigned prot); @@ -96,6 +97,16 @@ int gem_munmap(void *ptr, uint64_t size); */ #define gem_require_mmap_offset_wc(fd) igt_require(gem_mmap_offset__has_wc(fd)) +/** + * gem_require_mmap_offset_device_coherent: + * @fd: open i915 drm file descriptor + * + * Feature test macro to query whether direct (i.e. cpu access path, bypassing + * the gtt) write-combine memory mappings are available, or fixed mapping for + * discrete. Automatically skips through igt_require() if not. + */ +#define gem_require_mmap_device_coherent(fd) igt_require(gem_mmap__has_device_coherent(fd)) + extern const struct mmap_offset { const char *name; unsigned int type; From patchwork Fri Jul 30 08:53:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Auld X-Patchwork-Id: 12410757 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10BEFC432BE for ; Fri, 30 Jul 2021 08:54:31 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id D3F9F60FED for ; Fri, 30 Jul 2021 08:54:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D3F9F60FED Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 909B16F406; Fri, 30 Jul 2021 08:54:30 +0000 (UTC) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 31B186F40D; Fri, 30 Jul 2021 08:54:15 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10060"; a="298644881" X-IronPort-AV: E=Sophos;i="5.84,281,1620716400"; d="scan'208";a="298644881" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2021 01:54:15 -0700 X-IronPort-AV: E=Sophos;i="5.84,281,1620716400"; d="scan'208";a="664763909" Received: from asleatox-mobl.ger.corp.intel.com (HELO mwauld-desk1.intel.com) ([10.213.201.173]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2021 01:54:13 -0700 From: Matthew Auld To: igt-dev@lists.freedesktop.org Date: Fri, 30 Jul 2021 09:53:48 +0100 Message-Id: <20210730085348.2326899-11-matthew.auld@intel.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210730085348.2326899-1-matthew.auld@intel.com> References: <20210730085348.2326899-1-matthew.auld@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t v3 11/11] tests/i915/gem_exec_fence: use device_coherent mmap 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: , Cc: Daniel Vetter , intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" We lost explicit WC mmaps on discrete, where we now only support FIXED, however such mappings should be device coherent. In gem_exec_fence it looks like we can just use mmap__device_coherent, which should also work on discrete platforms, while still using an explicit WC mmap on integrated platforms. Signed-off-by: Matthew Auld Cc: Maarten Lankhorst Cc: Ashutosh Dixit Cc: Daniel Vetter Cc: Ramalingam C --- tests/i915/gem_exec_fence.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/i915/gem_exec_fence.c b/tests/i915/gem_exec_fence.c index ef1bb0ca..620e7ac2 100644 --- a/tests/i915/gem_exec_fence.c +++ b/tests/i915/gem_exec_fence.c @@ -152,7 +152,7 @@ static void test_fence_busy(int fd, const intel_ctx_t *ctx, obj.relocation_count = 1; memset(&reloc, 0, sizeof(reloc)); - batch = gem_mmap__wc(fd, obj.handle, 0, 4096, PROT_WRITE); + batch = gem_mmap__device_coherent(fd, obj.handle, 0, 4096, PROT_WRITE); gem_set_domain(fd, obj.handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); @@ -244,7 +244,7 @@ static void test_fence_busy_all(int fd, const intel_ctx_t *ctx, unsigned flags) obj.relocation_count = 1; memset(&reloc, 0, sizeof(reloc)); - batch = gem_mmap__wc(fd, obj.handle, 0, 4096, PROT_WRITE); + batch = gem_mmap__device_coherent(fd, obj.handle, 0, 4096, PROT_WRITE); gem_set_domain(fd, obj.handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); @@ -353,7 +353,7 @@ static void test_fence_await(int fd, const intel_ctx_t *ctx, uint32_t *out; int i; - out = gem_mmap__wc(fd, scratch, 0, 4096, PROT_WRITE); + out = gem_mmap__device_coherent(fd, scratch, 0, 4096, PROT_WRITE); gem_set_domain(fd, scratch, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT); @@ -617,7 +617,7 @@ static void test_parallel(int i915, const intel_ctx_t *ctx, const struct intel_execution_engine2 *e2; const unsigned int gen = intel_gen(intel_get_drm_devid(i915)); uint32_t scratch = gem_create(i915, 4096); - uint32_t *out = gem_mmap__wc(i915, scratch, 0, 4096, PROT_READ); + uint32_t *out = gem_mmap__device_coherent(i915, scratch, 0, 4096, PROT_READ); uint32_t handle[I915_EXEC_RING_MASK]; IGT_CORK_FENCE(cork); igt_spin_t *spin; @@ -2813,7 +2813,7 @@ static void test_syncobj_timeline_chain_engines(int fd, const intel_ctx_cfg_t *c gem_sync(fd, ctx.engine_counter_object.handle); - counter_output = gem_mmap__wc(fd, ctx.engine_counter_object.handle, 0, 4096, PROT_READ); + counter_output = gem_mmap__device_coherent(fd, ctx.engine_counter_object.handle, 0, 4096, PROT_READ); for (uint32_t i = 0; i < ctx.engines.nengines; i++) igt_debug("engine %i (%s)\t= %016"PRIx64"\n", i, @@ -2879,7 +2879,7 @@ static void test_syncobj_stationary_timeline_chain_engines(int fd, const intel_c gem_sync(fd, ctx.engine_counter_object.handle); - counter_output = gem_mmap__wc(fd, ctx.engine_counter_object.handle, 0, 4096, PROT_READ); + counter_output = gem_mmap__device_coherent(fd, ctx.engine_counter_object.handle, 0, 4096, PROT_READ); for (uint32_t i = 0; i < ctx.engines.nengines; i++) igt_debug("engine %i (%s)\t= %016"PRIx64"\n", i, @@ -2940,7 +2940,7 @@ static void test_syncobj_backward_timeline_chain_engines(int fd, const intel_ctx gem_sync(fd, ctx.engine_counter_object.handle); - counter_output = gem_mmap__wc(fd, ctx.engine_counter_object.handle, 0, 4096, PROT_READ); + counter_output = gem_mmap__device_coherent(fd, ctx.engine_counter_object.handle, 0, 4096, PROT_READ); for (uint32_t i = 0; i < ctx.engines.nengines; i++) igt_debug("engine %i (%s)\t= %016"PRIx64"\n", i, @@ -2963,7 +2963,7 @@ igt_main i915 = drm_open_driver(DRIVER_INTEL); igt_require_gem(i915); igt_require(gem_has_exec_fence(i915)); - gem_require_mmap_wc(i915); + gem_require_mmap_device_coherent(i915); ctx = intel_ctx_create_all_physical(i915); gem_submission_print_method(i915);