From patchwork Mon Apr 9 11:28:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abdiel Janulgue X-Patchwork-Id: 10331127 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2BD5D60236 for ; Mon, 9 Apr 2018 11:28:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E36F289B3 for ; Mon, 9 Apr 2018 11:28:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 133A6289B7; Mon, 9 Apr 2018 11:28:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 41AFE289B3 for ; Mon, 9 Apr 2018 11:28:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1A59F6E0BA; Mon, 9 Apr 2018 11:28:27 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0C1006E0BA for ; Mon, 9 Apr 2018 11:28:25 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Apr 2018 04:28:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,427,1517904000"; d="scan'208";a="31268607" Received: from abdiel-macbookpro.fi.intel.com ([10.237.66.48]) by fmsmga008.fm.intel.com with ESMTP; 09 Apr 2018 04:28:23 -0700 From: Abdiel Janulgue To: intel-gfx@lists.freedesktop.org Date: Mon, 9 Apr 2018 14:28:04 +0300 Message-Id: <20180409112804.7166-2-abdiel.janulgue@linux.intel.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180409112804.7166-1-abdiel.janulgue@linux.intel.com> References: <20180409112804.7166-1-abdiel.janulgue@linux.intel.com> Subject: [Intel-gfx] [PATCH 2/2] drm/i915/selftests: Compare mappable vma against instance in unmappable region X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 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-Virus-Scanned: ClamAV using ClamSMTP Add an additional comparison to check the entire vma created in the mappable region of the global GTT against the one in the unmappable range. Further test with an assert_partial as well to ensure the VMA corresponds to the original object's backing store. Signed-off-by: Abdiel Janulgue Cc: Joonas Lahtinen Cc: Chris Wilson --- drivers/gpu/drm/i915/selftests/i915_vma.c | 44 ++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/selftests/i915_vma.c b/drivers/gpu/drm/i915/selftests/i915_vma.c index ea48bac..10cf4df 100644 --- a/drivers/gpu/drm/i915/selftests/i915_vma.c +++ b/drivers/gpu/drm/i915/selftests/i915_vma.c @@ -554,6 +554,30 @@ static bool assert_partial(struct drm_i915_gem_object *obj, return true; } +static bool assert_vma_compare(struct i915_vma *vma1, struct i915_vma *vma2) +{ + struct sgt_iter sgt; + dma_addr_t dma; + unsigned long offset = 0; + + for_each_sgt_dma(dma, sgt, vma1->pages) { + dma_addr_t src; + + src = sg_dma_address(vma2->pages->sgl) + + (offset << PAGE_SHIFT); + + if (src != dma) { + pr_err("VMA comparison failed. DMA mismatch for partial " + "page offset %lu\n", offset); + return false; + } + + offset++; + } + + return true; +} + static bool assert_pin(struct i915_vma *vma, struct i915_ggtt_view *view, u64 size, @@ -621,7 +645,7 @@ static int igt_vma_partial(void *arg) { }, }, *p; unsigned int sz, offset; - struct i915_vma *vma; + struct i915_vma *vma, *vma_unmapped = NULL; int err = -ENOMEM; /* @@ -660,6 +684,8 @@ static int igt_vma_partial(void *arg) err = i915_vma_pin(vma, 0, 0, PIN_GLOBAL | PIN_HIGH); if (err) goto out_object; + + vma_unmapped = vma; } nvma = 0; @@ -748,6 +774,22 @@ static int igt_vma_partial(void *arg) goto out_object; } + if (!assert_partial(obj, vma, 0, npages)) { + pr_err("(%s) Inconsistent partial pages for (offset=%d, size=%d)\n", + p->name, offset, sz); + err = -EINVAL; + goto out_object; + } + + if (vma_unmapped) { + if (!assert_vma_compare(vma, vma_unmapped)) { + pr_err("(%s) Inconsistent vma from unmapped region\n", + p->name); + err = -EINVAL; + goto out_object; + } + } + i915_vma_unpin(vma); } }