From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796343945; b=4IDaySST0iE2vyt5mbQHLw+J0LxAOS6oenCSVLy1ITMcH/hsF23+pv3xSyDbQpIIBqXu 9eRYqvpqSBBWYt4KkIxX1CpMZPh77b8kscif4tHwdXMlNhsaliEaBwDQ7omc8/kmW6aMS u3eT1MEJMQi2O+9F9dKWTgtR9vHoXkr/DaBdVbBX087OZl713lCbq4IzkvsgLAo2go7cW Bz0pFeEWDbG0G2AD9/dbWuqo4lfW/Y8h77Ssu+WmqUzg6fnLfxaEtL6hWYP4fVqmQRB54 HEjjKdVtzxjFU99jn7wgwQ+tfPVoJDQZnapiBD4vXgFhc73gNhE0dtVyDU7TnuDvUng== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796343945; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Type: Content-Transfer-Encoding; bh=vl1whD1U7vPUB1yNPzzRxIKK4GiiSyoqL4xdupvXjco=; b=xBZKk38Tm5gvgScTZ6Bq8f0ezqKrp4M+HeNGWZkxiGQOxrftiWsgPFKNWXX1JLPsqrsP vo7WBec2cHGlxHGGFx0CKGtJuirWG5Ki+iymU9EY+nJigYMtlkfxKAyx2fG8ZMlAJKQVK aAvHbWG221zFPmus2a1doVSPrOvl/KCOUWzBSqRo2aNXeB5sl3NcB9tS9LzCKc2ta3Xm6 2QZuHOmXAp3inQ1i5ll3tOG5Us72R9cf+CpPu0wIM9HoyF6Ja2Ks887B6g7SYWaTtapMI cMmoqwl8DEQsuxXrS716dq44Prk1k1IckFTj3WLO547x9G8fkcZbcTYvSUHcFGGwiHw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=g0IVKmQg; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 37122606A322 for ; Fri, 4 Dec 2026 00:25:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=g0IVKmQg Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5421B1F000C2; Fri, 4 Dec 2026 00:25:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796343945; bh=vl1whD1U7vPUB1yNPzzRxIKK4GiiSyoqL4xdupvXjco=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=g0IVKmQgBBgJcHnFy4g2GFW3iaeyJVof8JAgWD+vyvNC78PKhrrps2ukNn8yDMwSo lNfc0B9vaLEIh7mY5BGMy381z2mfgXBa9Q3GKVdXHSnj25Msb1IaIS8B78d3L44n8E hU5pw6MMoG+s5Fv1AIM4439PFLRf+wsWz8NogLgYJFl5+LWsiQPHhryGq7TX9E7SBW 4N1JW8kVNyBaaNAb3IbKJFxYLyT3IocoN7gxzX5nneZq0E8Eouhqa4vtMimQFgHOAK CfK4xpR1g1RfSya62HEXau8VcH4JZ+yCVP0Mg2/HMlZcYNahwQYSitQMXYYgYv3yW7 GtNFrDcSigzUw== From: Sasha Levin To: stable@vger.kernel.org Cc: Hanson Wang , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Joonas Lahtinen , Sasha Levin Subject: [PATCH 6.18.y] drm/i915/dsb: Realign GOSUB only for QW slots 6 and 7 Date: Thu, 3 Dec 2026 19:25:43 -0500 Message-ID: <20261204002501.1451776-1-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <2026120243-retract-chokehold-cd1a@gregkh> References: <2026120243-retract-chokehold-cd1a@gregkh> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Hanson Wang [ Upstream commit 715f145f6204363a50853eb15719dc860db0bc01 ] intel_dsb_gosub_align() moves free_pos to the next cacheline unconditionally, but only clears the skipped bytes when at most two QW slots remain. Wa_16024917128 forbids GOSUB in slots 6 and 7 only. A larger gap is still executed. A Panther Lake DSB dump showed nonzero data in that gap, with the tail at 0x58 and GOSUB at 0x80. Advance free_pos only when the instruction would land in slot 6 or 7, and fill that gap with NOPs. Emit GOSUB in place for every other slot. intel_dsb_align_tail() still clears the rest of the cacheline. Update free_pos inside the existing gap check in intel_dsb_align_tail() as well, so the two helpers keep the same shape. Fixes: 2c41d62f6fb1 ("drm/i915/dsb: Implement intel_dsb_gosub()") Cc: stable@vger.kernel.org # v6.17+ Signed-off-by: Hanson Wang Signed-off-by: Ville Syrjälä Link: https://patch.msgid.link/20261106102315.1361645-1-hanson.wang@ugreen.com (cherry picked from commit a2f5df6c5468b4f65e58c4125bba3f0e3cdc6aa1) Signed-off-by: Joonas Lahtinen [ sashal: Replaced the upstream dsb_buffer_fill(dsb, ...) calls with intel_dsb_buffer_memset(&dsb->dsb_buf, ...) in both align functions, since this tree has a different DSB buffer helper API. ] Signed-off-by: Sasha Levin --- drivers/gpu/drm/i915/display/intel_dsb.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dsb.c b/drivers/gpu/drm/i915/display/intel_dsb.c index dee44d45b6687..2df682c9594cb 100644 --- a/drivers/gpu/drm/i915/display/intel_dsb.c +++ b/drivers/gpu/drm/i915/display/intel_dsb.c @@ -538,11 +538,11 @@ static void intel_dsb_align_tail(struct intel_dsb *dsb) tail = dsb->free_pos * 4; aligned_tail = ALIGN(tail, CACHELINE_BYTES); - if (aligned_tail > tail) + if (aligned_tail > tail) { intel_dsb_buffer_memset(&dsb->dsb_buf, dsb->free_pos, 0, aligned_tail - tail); - - dsb->free_pos = aligned_tail / 4; + dsb->free_pos = aligned_tail / 4; + } } static void intel_dsb_gosub_align(struct intel_dsb *dsb) @@ -557,12 +557,16 @@ static void intel_dsb_gosub_align(struct intel_dsb *dsb) /* * Wa_16024917128 * "Ensure GOSUB is not placed in cacheline QW slot 6 or 7 (numbered 0-7)" + * + * Move to the next cacheline only for those two slots. The skipped + * bytes stay in the programmed range, so fill them with NOPs. Any + * other slot can take the GOSUB directly. */ - if (aligned_tail - tail <= 2 * 8) + if (aligned_tail - tail <= 2 * 8) { intel_dsb_buffer_memset(&dsb->dsb_buf, dsb->free_pos, 0, aligned_tail - tail); - - dsb->free_pos = aligned_tail / 4; + dsb->free_pos = aligned_tail / 4; + } } void intel_dsb_gosub(struct intel_dsb *dsb, -- 2.53.0