From nobody Sat Jul 25 21:59:21 2026 Received: from smtpbgbr2.qq.com (smtpbgbr2.qq.com [54.207.22.56]) (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 057D33E024F; Mon, 13 Jul 2026 09:33:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=54.207.22.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783935193; cv=none; b=IUOSO1sANM5E9Fe0lgdzxDxEXWuYN/amfx9cTmSWlVhapgposuAyTB0IMEYKnNjVOqvNnywH/G06pc9eV7GP4f+Mv+KWBBaMMD5XRGg2QCfC5snQK+Vn+kG0Un0HWHE1RWZfupJd74Brb2djCrqhrDVzRbTeOqt1s0I+6HuNqdY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783935193; c=relaxed/simple; bh=iF8R7oBHHe4h8c/wcMeQ/WmPi8XOA4vfShtynnbZflE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=rcR71SrK6xSAUL+q09DbyunSUV4De8znVTHkRzkM+npWlCaxJP3R/Qs0hvD21HkqG9MDsQd83XPJJVFGrceDtmNfcTTcAt4DoVXxSE36MuUGWR0oOoGu1/eN4JWlBw7JkwqosjMNmIR0WCoWKeY2oP0L5L0bBsNaCwpMh3HgesQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uniontech.com; spf=pass smtp.mailfrom=uniontech.com; dkim=pass (1024-bit key) header.d=uniontech.com header.i=@uniontech.com header.b=mKmVrnWX; arc=none smtp.client-ip=54.207.22.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uniontech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=uniontech.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=uniontech.com header.i=@uniontech.com header.b="mKmVrnWX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uniontech.com; s=onoh2408; t=1783935166; bh=UiIh4OOhAvzzVkPtdgMJxtSPcXyqzkLManFtvdn0m6g=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=mKmVrnWXaBRJtLPz9XtSzZN7AM6Qv+y7HNMP9RECL36+7wr76rtmMelyczrSNGLKp MjEwPh02vq45tu3U+Z4x6BnstkK1B/eKS0iHVPkIArWiCXz5BZ9GeQKDE+6ertniqS 982FAF7X9IobmrLyH024xLzFhimuSEQ8JxRKp9Eo= X-QQ-mid: esmtpsz21t1783935161t12b464a2 X-QQ-Originating-IP: Zo6aPw+xIR/Z8JGu2D3imdDpMwvCIDKIlqGdsRUZxM8= Received: from PEN202512010004 ( [113.57.152.160]) by bizesmtp.qq.com (ESMTP) with id ; Mon, 13 Jul 2026 17:32:39 +0800 (CST) X-QQ-SSF: 0000000000000000000000000000000 X-QQ-GoodBg: 1 X-BIZMAIL-ID: 36213218852409400 EX-QQ-RecipientCnt: 7 From: raoxu To: andreas.noever@gmail.com Cc: westeri@kernel.org, YehezkelShB@gmail.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, raoxu@uniontech.com, stable@vger.kernel.org Subject: [PATCH] thunderbolt: icm: preserve USB4 proxy data-valid bit Date: Mon, 13 Jul 2026 17:32:37 +0800 Message-ID: X-Mailer: git-send-email 2.50.1 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 X-QQ-SENDSIZE: 520 Feedback-ID: esmtpsz:uniontech.com:qybglogicsvrgz:qybglogicsvrgz6b-0 X-QQ-XMAILINFO: MLbAtvpy5B1PBUEzIsVyP2A5eq6UHQzJMT4Yi0JyLy3yDX/LQ8mTHqoI DKOc0Xa89FqmCD37PTEqnPm4ANj9gywHT1lD8BFALb98LHhI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g== X-QQ-RECHKSPAM: 0 Content-Type: text/plain; charset="utf-8" From: Xu Rao The ICM USB4 switch operation request encodes two values in request.data_len_valid: bit 4 marks the data payload valid, while bits 3:0 hold the payload length in dwords. A zero length with the valid bit set represents the full 16-dword data array. icm_usb4_switch_op() sets the valid bit when a transmit payload is present. For payloads shorter than the full 16 dwords, it then assigns the length to the whole field and clears the valid bit that was just set. The payload is still copied into the request, but the descriptor sent to firmware marks that data as invalid. This affects USB4 router operations that send short payloads through the firmware connection manager. In particular, USB4 NVM writes can send a short final block when the image size is not aligned to the 64-byte proxy payload size. Firmware may then ignore or reject that final block, while full 16-dword blocks are unaffected because they are encoded as length 0 with the valid bit set. OR the short payload length into data_len_valid so the valid bit is preserved. Fixes: 9039387e166e ("thunderbolt: Add USB4 router operation proxy for firm= ware connection manager") Cc: stable@vger.kernel.org Signed-off-by: Xu Rao --- drivers/thunderbolt/icm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/thunderbolt/icm.c b/drivers/thunderbolt/icm.c index 10fefac3b1d9..669807f0eaf8 100644 --- a/drivers/thunderbolt/icm.c +++ b/drivers/thunderbolt/icm.c @@ -2341,7 +2341,7 @@ static int icm_usb4_switch_op(struct tb_switch *sw, u= 16 opcode, u32 *metadata, if (tx_data_len) { request.data_len_valid |=3D ICM_USB4_SWITCH_DATA_VALID; if (tx_data_len < ARRAY_SIZE(request.data)) - request.data_len_valid =3D + request.data_len_valid |=3D tx_data_len & ICM_USB4_SWITCH_DATA_LEN_MASK; memcpy(request.data, tx_data, tx_data_len * sizeof(u32)); } -- 2.50.1