From patchwork Tue Oct 10 23:05:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jordan Justen X-Patchwork-Id: 9998129 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 B1818601AE for ; Tue, 10 Oct 2017 23:06:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A23B1287F0 for ; Tue, 10 Oct 2017 23:06:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 959AA28809; Tue, 10 Oct 2017 23:06:45 +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 1C898287F0 for ; Tue, 10 Oct 2017 23:06:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F193F6E282; Tue, 10 Oct 2017 23:06:43 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id 171A36E282 for ; Tue, 10 Oct 2017 23:06:42 +0000 (UTC) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Oct 2017 16:06:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,359,1503385200"; d="scan'208";a="908693232" Received: from dpturley-mobl1.amr.corp.intel.com (HELO jljusten-skl.amr.corp.intel.com) ([10.255.229.103]) by FMSMGA003.fm.intel.com with ESMTP; 10 Oct 2017 16:06:41 -0700 From: Jordan Justen To: Intel GFX discussion Date: Tue, 10 Oct 2017 16:05:17 -0700 Message-Id: <20171010230517.20037-1-jordan.l.justen@intel.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <3329245.usB7SrW3Ws@kirito> References: <3329245.usB7SrW3Ws@kirito> Cc: Kenneth Graunke Subject: [Intel-gfx] [PATCH i-g-t v2] intel_aubdump: Default to 48-bit AUBs when the gen is unknown 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 v2: * Use 48-bit rather than 64-bit (Ken) * Use 'addr_bits' rather than 'use_64bit' Cc: Kenneth Graunke Signed-off-by: Jordan Justen Reviewed-by: Kenneth Graunke --- tools/aubdump.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/tools/aubdump.c b/tools/aubdump.c index f3efb451..ee378a76 100644 --- a/tools/aubdump.c +++ b/tools/aubdump.c @@ -59,6 +59,7 @@ static int gen = 0; static int verbose = 0; static bool device_override; static uint32_t device; +static int addr_bits = 0; static const struct { const char *name; @@ -190,7 +191,7 @@ data_out(const void *data, size_t size) static uint32_t gtt_entry_size(void) { - return gen >= 8 ? 8 : 4; + return addr_bits > 32 ? 8 : 4; } static uint32_t @@ -229,17 +230,17 @@ write_header(void) data_out(comment, comment_dwords * 4); /* Set up the GTT. The max we can handle is 64M */ - dword_out(CMD_AUB_TRACE_HEADER_BLOCK | ((gen >= 8 ? 6 : 5) - 2)); + dword_out(CMD_AUB_TRACE_HEADER_BLOCK | ((addr_bits > 32 ? 6 : 5) - 2)); dword_out(AUB_TRACE_MEMTYPE_GTT_ENTRY | AUB_TRACE_TYPE_NOTYPE | AUB_TRACE_OP_DATA_WRITE); dword_out(0); /* subtype */ dword_out(0); /* offset */ dword_out(gtt_size()); /* size */ - if (gen >= 8) + if (addr_bits > 32) dword_out(0); for (uint32_t i = 0; i * gtt_entry_size() < gtt_size(); i++) { dword_out(entry + 0x1000 * i); - if (gen >= 8) + if (addr_bits > 32) dword_out(0); } } @@ -263,13 +264,13 @@ aub_write_trace_block(uint32_t type, void *virtual, uint32_t size, uint64_t gtt_ block_size = 8 * 4096; dword_out(CMD_AUB_TRACE_HEADER_BLOCK | - ((gen >= 8 ? 6 : 5) - 2)); + ((addr_bits > 32 ? 6 : 5) - 2)); dword_out(AUB_TRACE_MEMTYPE_GTT | type | AUB_TRACE_OP_DATA_WRITE); dword_out(subtype); dword_out(gtt_offset + offset); dword_out(align_u32(block_size, 4)); - if (gen >= 8) + if (addr_bits > 32) dword_out((gtt_offset + offset) >> 32); if (virtual) @@ -285,7 +286,7 @@ aub_write_trace_block(uint32_t type, void *virtual, uint32_t size, uint64_t gtt_ static void write_reloc(void *p, uint64_t v) { - if (gen >= 8) { + if (addr_bits > 32) { /* From the Broadwell PRM Vol. 2a, * MI_LOAD_REGISTER_MEM::MemoryAddress: * @@ -324,7 +325,7 @@ aub_dump_ringbuffer(uint64_t batch_offset, uint64_t offset, int ring_flag) /* Make a ring buffer to execute our batchbuffer. */ memset(ringbuffer, 0, sizeof(ringbuffer)); - aub_mi_bbs_len = gen >= 8 ? 3 : 2; + aub_mi_bbs_len = addr_bits > 32 ? 3 : 2; ringbuffer[ring_count] = AUB_MI_BATCH_BUFFER_START | (aub_mi_bbs_len - 2); write_reloc(&ringbuffer[ring_count + 1], batch_offset); ring_count += aub_mi_bbs_len; @@ -333,12 +334,12 @@ aub_dump_ringbuffer(uint64_t batch_offset, uint64_t offset, int ring_flag) * the ring in the simulator. */ dword_out(CMD_AUB_TRACE_HEADER_BLOCK | - ((gen >= 8 ? 6 : 5) - 2)); + ((addr_bits > 32 ? 6 : 5) - 2)); dword_out(AUB_TRACE_MEMTYPE_GTT | ring | AUB_TRACE_OP_COMMAND_WRITE); dword_out(0); /* general/surface subtype */ dword_out(offset); dword_out(ring_count * 4); - if (gen >= 8) + if (addr_bits > 32) dword_out(offset >> 32); data_out(ringbuffer, ring_count * 4); @@ -441,6 +442,11 @@ dump_execbuffer2(int fd, struct drm_i915_gem_execbuffer2 *execbuffer2) filename, device, gen); } + /* If we don't know the device gen, then it probably is a + * newer device which uses 48-bit addresses. + */ + addr_bits = (gen >= 8 || gen == 0) ? 48 : 32; + if (verbose) printf("Dumping execbuffer2:\n");