From nobody Tue Apr 7 01:27:49 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 096883793DF for ; Mon, 16 Mar 2026 22:44:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773701045; cv=none; b=WNvhae3Hr4K0791bDfiuFBIfXftlo+kbCgsWBXlV6R6QUBLcqo8L/Q8TB8giPLMQlrNWHrxL+OK+DdaovWAV9FZED1RdjXhxxypMisfB716n+IAGZTngVYU+/QQF0xTCpAHHLoFvuteprezH0x3W1LXSELMxS4NYXWYdfErd1Y4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773701045; c=relaxed/simple; bh=PemC648X76G2DJ8fhELK1LHng9M+AjeFzFwCebBzdn4=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=gDo2c6VttiXOLxpZzNUYKEDN8qI8jN4q7818vc8NWQHSoLdDophJomx31RbC+H2/vD6b/K7stPq01MCpPQmUGiUdqWP0NBZkdIsrZiflWsB1xe1ktbPDQtaC4gY3PooxuiunKuyODyj84TuxMlxB1OPG1qR8+arEsjKeiSfg7Gs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uTf5DBwZ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uTf5DBwZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E6BEC19421; Mon, 16 Mar 2026 22:44:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773701044; bh=PemC648X76G2DJ8fhELK1LHng9M+AjeFzFwCebBzdn4=; h=From:To:Cc:Subject:Date:From; b=uTf5DBwZNlu8OGYNKo3KEgY97VX0dVkt0MZs0ls0glFBDWbEmjRw7IHQ2bbUCgEfV sUlloYUiLzdV06rDP/W+cfK3/IvUYIAGyNaAmbK5wAZ5WjYiz4IRZXTXRNs1U6ibct bK5LcHQG6tclhMUZzzypfa6kPz/yvsEA9VrKxfys476NaKltB5m8mL90bu0NiAxb98 RBBVfJuutHLMgDUfO8uXMRCOUFQHockdNgT+L9rd2nn3tIfciKfm0JE/FCAa21yXBd RfLB2PhRUfG/T5i25f45jiwiL/ohclH55bq7PAD7iWiIpD6iE9zqw6xuwLEZv7RxIB ivZXFah+bhKkg== From: Arnd Bergmann To: Matthew Brost , =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , Rodrigo Vivi , David Airlie , Simona Vetter , Dnyaneshwar Bhadane , Matt Roper Cc: Arnd Bergmann , Lucas De Marchi , Tvrtko Ursulin , Umesh Nerlige Ramappa , Raag Jadav , Niranjana Vishwanathapura , intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm/xe: use %z format string for ptrdiff_t Date: Mon, 16 Mar 2026 23:43:46 +0100 Message-Id: <20260316224357.658520-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.5 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann ptrdiff_t, size_t and long are the same size on all supported architectures, but gcc requires the use of the %zx modifier instead of %lx. On 32-bit targets, the wrong one produces this warning: drivers/gpu/drm/xe/xe_lrc.c:1913:7: error: format specifies type 'unsigned = long' but the argument has type '__ptrdiff_t' (aka 'int') [-Werror,-Wformat] 1912 | drm_printf(p, "LRC[%#5lx] =3D [%#010x] MI_NOOP (%= d dwords)\n", | ~~~~~ | %#5tx 1913 | dw - num_noop - start, inst_header, num_= noop); | ^~~~~~~~~~~~~~~~~~~~~ Fixes: 65fcf19cb36b ("drm/xe: Include running dword offset in default_lrc d= umps") Signed-off-by: Arnd Bergmann --- drivers/gpu/drm/xe/xe_lrc.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_lrc.c b/drivers/gpu/drm/xe/xe_lrc.c index 5ab088e5e13d..c528818e8853 100644 --- a/drivers/gpu/drm/xe/xe_lrc.c +++ b/drivers/gpu/drm/xe/xe_lrc.c @@ -1909,17 +1909,17 @@ static int dump_mi_command(struct drm_printer *p, while (num_noop < remaining_dw && (*(++dw) & REG_GENMASK(31, 23)) =3D=3D MI_NOOP) num_noop++; - drm_printf(p, "LRC[%#5lx] =3D [%#010x] MI_NOOP (%d dwords)\n", + drm_printf(p, "LRC[%#5zx] =3D [%#010x] MI_NOOP (%d dwords)\n", dw - num_noop - start, inst_header, num_noop); return num_noop; =20 case MI_TOPOLOGY_FILTER: - drm_printf(p, "LRC[%#5lx] =3D [%#010x] MI_TOPOLOGY_FILTER\n", + drm_printf(p, "LRC[%#5zx] =3D [%#010x] MI_TOPOLOGY_FILTER\n", dw - start, inst_header); return 1; =20 case MI_BATCH_BUFFER_END: - drm_printf(p, "LRC[%#5lx] =3D [%#010x] MI_BATCH_BUFFER_END\n", + drm_printf(p, "LRC[%#5zx] =3D [%#010x] MI_BATCH_BUFFER_END\n", dw - start, inst_header); /* Return 'remaining_dw' to consume the rest of the LRC */ return remaining_dw; @@ -1934,35 +1934,35 @@ static int dump_mi_command(struct drm_printer *p, =20 switch (inst_header & MI_OPCODE) { case MI_LOAD_REGISTER_IMM: - drm_printf(p, "LRC[%#5lx] =3D [%#010x] MI_LOAD_REGISTER_IMM: %d regs\n= ", + drm_printf(p, "LRC[%#5zx] =3D [%#010x] MI_LOAD_REGISTER_IMM: %d regs\n= ", dw - start, inst_header, (numdw - 1) / 2); for (int i =3D 1; i < numdw; i +=3D 2) - drm_printf(p, "LRC[%#5lx] =3D - %#6x =3D %#010x\n", + drm_printf(p, "LRC[%#5zx] =3D - %#6x =3D %#010x\n", &dw[i] - start, dw[i], dw[i + 1]); return numdw; =20 case MI_LOAD_REGISTER_MEM & MI_OPCODE: - drm_printf(p, "LRC[%#5lx] =3D [%#010x] MI_LOAD_REGISTER_MEM: %s%s\n", + drm_printf(p, "LRC[%#5zx] =3D [%#010x] MI_LOAD_REGISTER_MEM: %s%s\n", dw - start, inst_header, dw[0] & MI_LRI_LRM_CS_MMIO ? "CS_MMIO " : "", dw[0] & MI_LRM_USE_GGTT ? "USE_GGTT " : ""); if (numdw =3D=3D 4) - drm_printf(p, "LRC[%#5lx] =3D - %#6x =3D %#010llx\n", + drm_printf(p, "LRC[%#5zx] =3D - %#6x =3D %#010llx\n", dw - start, dw[1], ((u64)(dw[3]) << 32 | (u64)(dw[2]))); else - drm_printf(p, "LRC[%#5lx] =3D - %*ph (%s)\n", + drm_printf(p, "LRC[%#5zx] =3D - %*ph (%s)\n", dw - start, (int)sizeof(u32) * (numdw - 1), dw + 1, numdw < 4 ? "truncated" : "malformed"); return numdw; =20 case MI_FORCE_WAKEUP: - drm_printf(p, "LRC[%#5lx] =3D [%#010x] MI_FORCE_WAKEUP\n", + drm_printf(p, "LRC[%#5zx] =3D [%#010x] MI_FORCE_WAKEUP\n", dw - start, inst_header); return numdw; =20 default: - drm_printf(p, "LRC[%#5lx] =3D [%#010x] unknown MI opcode %#x, likely %= d dwords\n", + drm_printf(p, "LRC[%#5zx] =3D [%#010x] unknown MI opcode %#x, likely %= d dwords\n", dw - start, inst_header, opcode, numdw); return numdw; } @@ -1989,12 +1989,12 @@ static int dump_gfxpipe_command(struct drm_printer = *p, switch (*dw & GFXPIPE_MATCH_MASK) { #define MATCH(cmd) \ case cmd: \ - drm_printf(p, "LRC[%#5lx] =3D [%#010x] " #cmd " (%d dwords)\n", \ + drm_printf(p, "LRC[%#5zx] =3D [%#010x] " #cmd " (%d dwords)\n", \ dw - start, *dw, numdw); \ return numdw #define MATCH3D(cmd) \ case CMD_##cmd: \ - drm_printf(p, "LRC[%#5lx] =3D [%#010x] " #cmd " (%d dwords)\n", \ + drm_printf(p, "LRC[%#5zx] =3D [%#010x] " #cmd " (%d dwords)\n", \ dw - start, *dw, numdw); \ return numdw =20 @@ -2127,7 +2127,7 @@ static int dump_gfxpipe_command(struct drm_printer *p, MATCH3D(3DSTATE_SLICE_TABLE_STATE_POINTER_2); =20 default: - drm_printf(p, "LRC[%#5lx] =3D [%#010x] unknown GFXPIPE command (pipeli= ne=3D%#x, opcode=3D%#x, subopcode=3D%#x), likely %d dwords\n", + drm_printf(p, "LRC[%#5zx] =3D [%#010x] unknown GFXPIPE command (pipeli= ne=3D%#x, opcode=3D%#x, subopcode=3D%#x), likely %d dwords\n", dw - start, *dw, pipeline, opcode, subopcode, numdw); return numdw; } @@ -2153,7 +2153,7 @@ static int dump_gfx_state_command(struct drm_printer = *p, MATCH(STATE_WRITE_INLINE); =20 default: - drm_printf(p, "LRC[%#5lx] =3D [%#010x] unknown GFX_STATE command (opco= de=3D%#x), likely %d dwords\n", + drm_printf(p, "LRC[%#5zx] =3D [%#010x] unknown GFX_STATE command (opco= de=3D%#x), likely %d dwords\n", dw - start, *dw, opcode, numdw); return numdw; } @@ -2188,7 +2188,7 @@ void xe_lrc_dump_default(struct drm_printer *p, num_dw =3D dump_gfx_state_command(p, gt, start, dw, remaining_dw); } else { num_dw =3D min(instr_dw(*dw), remaining_dw); - drm_printf(p, "LRC[%#5lx] =3D [%#10x] Unknown instruction of type %#x= , likely %d dwords\n", + drm_printf(p, "LRC[%#5zx] =3D [%#10x] Unknown instruction of type %#x= , likely %d dwords\n", dw - start, *dw, REG_FIELD_GET(XE_INSTR_CMD_TYPE, *dw), num_dw); --=20 2.39.5