From patchwork Sat May 25 07:05:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 10960657 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2245D112C for ; Sat, 25 May 2019 07:05:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F21A287F9 for ; Sat, 25 May 2019 07:05:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F37C52898C; Sat, 25 May 2019 07:05:36 +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 6F266287F9 for ; Sat, 25 May 2019 07:05:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EEC426E149; Sat, 25 May 2019 07:05:34 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (mail.fireflyinternet.com [109.228.58.192]) by gabe.freedesktop.org (Postfix) with ESMTPS id 520296E149; Sat, 25 May 2019 07:05:33 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from haswell.alporthouse.com (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 16676225-1500050 for multiple; Sat, 25 May 2019 08:05:27 +0100 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Sat, 25 May 2019 08:05:25 +0100 Message-Id: <20190525070525.22770-1-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t] i915/gem_workarounds: Verify regs directly 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: , Cc: igt-dev@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP --- tests/i915/gem_workarounds.c | 45 +++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 8 deletions(-) Reviewed-by: Matthew Auld diff --git a/tests/i915/gem_workarounds.c b/tests/i915/gem_workarounds.c index 44e3dce8a..bf8b4f630 100644 --- a/tests/i915/gem_workarounds.c +++ b/tests/i915/gem_workarounds.c @@ -82,6 +82,7 @@ static bool write_only(const uint32_t addr) #define MI_STORE_REGISTER_MEM (0x24 << 23) +#if 0 static int workaround_fail_count(int fd, uint32_t ctx) { struct drm_i915_gem_exec_object2 obj[2]; @@ -162,17 +163,45 @@ static int workaround_fail_count(int fd, uint32_t ctx) return fail_count; } - -static int reopen(int fd) +#else +static int workaround_fail_count(int i915, uint32_t ctx) { - char path[256]; + igt_spin_t *spin; + int fail = 0; + + intel_mmio_use_pci_bar(intel_get_pci_device()); + + spin = igt_spin_new(i915, .ctx = ctx, .flags = IGT_SPIN_POLL_RUN); + igt_spin_busywait_until_started(spin); + + for (int i = 0; i < num_wa_regs; i++) { + uint32_t value = + *(uint32_t *)(igt_global_mmio + wa_regs[i].addr); + const bool ok = + (wa_regs[i].value & wa_regs[i].mask) == + (value & wa_regs[i].mask); + char buf[80]; + + snprintf(buf, sizeof(buf), + "0x%05X\t0x%08X\t0x%08X\t0x%08X", + wa_regs[i].addr, wa_regs[i].value, wa_regs[i].mask, + value); + + if (ok) { + igt_debug("%s\tOK\n", buf); + } else if (write_only(wa_regs[i].addr)) { + igt_debug("%s\tIGNORED (w/o)\n", buf); + } else { + igt_warn("%s\tFAIL\n", buf); + fail++; + } + } - snprintf(path, sizeof(path), "/proc/self/fd/%d", fd); - fd = open(path, O_RDWR); - igt_assert_lte(0, fd); + igt_spin_free(i915, spin); - return fd; + return fail; } +#endif #define CONTEXT 0x1 #define FD 0x2 @@ -181,7 +210,7 @@ static void check_workarounds(int fd, enum operation op, unsigned int flags) uint32_t ctx = 0; if (flags & FD) - fd = reopen(fd); + fd = gem_reopen_driver(fd); if (flags & CONTEXT) { gem_require_contexts(fd);