From patchwork Thu Sep 21 17:27:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Zhi A" X-Patchwork-Id: 9964613 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 4097D600C5 for ; Thu, 21 Sep 2017 17:27:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 243FB29197 for ; Thu, 21 Sep 2017 17:27:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 18F2A293FA; Thu, 21 Sep 2017 17:27:28 +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=-4.2 required=2.0 tests=BAYES_00, 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 5B01C293BC for ; Thu, 21 Sep 2017 17:27:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AC89289F01; Thu, 21 Sep 2017 17:27:25 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0FB6689F01; Thu, 21 Sep 2017 17:27:25 +0000 (UTC) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Sep 2017 10:27:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.42,425,1500966000"; d="scan'208"; a="1197668264" Received: from skandkur-mobl.gar.corp.intel.com (HELO zhiwang1-MOBL.gar.corp.intel.com) ([10.252.149.83]) by fmsmga001.fm.intel.com with ESMTP; 21 Sep 2017 10:27:20 -0700 From: Zhi Wang To: intel-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org Date: Fri, 22 Sep 2017 01:27:09 +0800 Message-Id: <1506014831-1903-2-git-send-email-zhi.a.wang@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506014831-1903-1-git-send-email-zhi.a.wang@intel.com> References: <1506014831-1903-1-git-send-email-zhi.a.wang@intel.com> Cc: Rodrigo Vivi , Ben Widawsky Subject: [Intel-gfx] [PATCH 1/2] drm/i915/selftests: Refine the i915_ppat_get test case 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-Virus-Scanned: ClamAV using ClamSMTP Refine the i915_ppat_get test case to catch a bug recently intrduced by me. If the PPAT page table is filled first, then there will be PPAT entries which has the same attributes with another one. If we try to get our entry at this time. Tested on my SKL NUC box. Cc: Ben Widawsky Cc: Rodrigo Vivi Cc: Joonas Lahtinen Signed-off-by: Zhi Wang --- drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 28 +++++++++++---------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c index cd7eeb6..75cb2d6 100644 --- a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c @@ -1284,7 +1284,7 @@ static int perform_perfect_match_test(struct intel_ppat *ppat) { struct drm_i915_private *i915 = ppat->i915; const struct intel_ppat_entry *entry; - int ret, i; + int i; for_each_set_bit(i, ppat->used, ppat->max_entries) { entry = intel_ppat_get(i915, ppat->entries[i].value); @@ -1296,9 +1296,7 @@ static int perform_perfect_match_test(struct intel_ppat *ppat) intel_ppat_put(entry); return -EINVAL; } - ret = put_and_check_entry(entry); - if (ret) - return ret; + intel_ppat_put(entry); } return 0; } @@ -1328,7 +1326,6 @@ static int perform_partial_match_test(struct intel_ppat *ppat) struct drm_i915_private *i915 = ppat->i915; const struct intel_ppat_entry *entry; u8 value; - int ret; value = generate_new_value(ppat, value_for_partial_test); if (!value) { @@ -1350,10 +1347,7 @@ static int perform_partial_match_test(struct intel_ppat *ppat) return -EINVAL; } - ret = put_and_check_entry(entry); - if (ret) - return ret; - + intel_ppat_put(entry); return 0; } @@ -1373,14 +1367,7 @@ static int igt_ppat_get(void *arg) if (ret) return ret; - /* case 1: perfect match */ - ret = perform_perfect_match_test(ppat); - if (ret) { - pr_err("fail on perfect match test\n"); - return ret; - } - - /* case 2: alloc new entries */ + /* case 1: alloc new entries */ entries = NULL; ret = 0; @@ -1407,6 +1394,13 @@ static int igt_ppat_get(void *arg) *p = entry; } + /* case 2: perfect match */ + ret = perform_perfect_match_test(ppat); + if (ret) { + pr_err("fail on perfect match test\n"); + return ret; + } + /* case 3: negative test 1, suppose PPAT table is full now */ ret = perform_negative_test(ppat); if (ret) {