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=1795047970; b=x9V/ITO5kuK3oY7F6wnsWjqM0gdSP8sga8v6jeVL/EDaBSHKcG6EHQ9Vj4NVu87Avgra 3mvuf988jjLJd3JjY2cV6Z4Px9Drd3x3PobmQAxOLtoagE/IqmlZPYv37r76yzRPfruRw VhXgvxYxWkRCVu1aN92YDM/YZ/a8Q1dVpUME9hbYZE0NRj7HfPtr/GqSGCfOGUGpMicjd Hyi7Yo71pP3VwoaBWSnhWsgzBsrP5rllWTwAcMygDgkvZ1PxPXHwPPLGkhs3N6KkRm89r 9SjKWaYZdJ3lVBKexnMcwTa0kwhwNtbaqtpRjytI92SC8Cq760XNuKK8zeoom8YJ4yg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795047970; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=UaB0jVA5X9OnFqv/IXy3MyNnhAQOjy0DaoiU1CpqTf4=; b=DMdDCyAQ1Q2HoqkzvsL1H468G0bn2YK50hkobVSpXUymC2gLho/1Gk9xPPRt2eXP4f39 +FhBSW9cv2wMHaLlrpbD1MTEAaM8zf8EMLLLTS8cSdBloQluqy88UGUP0fBs9REGcJ5bu gPLAHlW6zDZfCqFPDTiY340cq5r5OW4KcQQidvGZOVdEr6ifhYCY4jXP2fDUZCiNsypFt sPzNkhXRxHbltCnkbqkTVpgDb/UHGKNLIci/ULcECjskFKdiFuzQ3/XQ/rr0uT2ftfZIm T+2bJHN9XZV6J3PiZiOPQzB8np64Qysy+DLadMvkAh6Wv+oCtsIrbQ7X7DJJ626J3jQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=uz6gbQlC; 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 3E93A606A32A; Thu, 19 Nov 2026 00:26:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=uz6gbQlC Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91F311F000C4; Thu, 19 Nov 2026 00:26:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795047970; bh=UaB0jVA5X9OnFqv/IXy3MyNnhAQOjy0DaoiU1CpqTf4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=uz6gbQlCOPBnl5kGq1LEY9vzuFJi8t3k+2hFbvlbqxYBnzlYULzyS0YSwXTS4qZAz 13eU4UrACs8bbsa3exLgdOz3wwFV5erGhCFBKr7RkFtDOvyAhhyJdZwDv1I6jqua8t xAlnNJ6K6a0AhyQn1+WBnjuvWCaIRjqGr/urDGxA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Radhey Shyam Pandey , Srinivas Neeli , Frank Li , Vinod Koul , Sasha Levin Subject: [PATCH 6.1 1829/2857] dmaengine: xilinx_dma: Fix MCDMA descriptor fields based on DMA direction Date: Wed, 18 Nov 2026 15:47:43 +0100 Message-ID: <20261118150307.109140442@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150201.293410965@linuxfoundation.org> References: <20261118150201.293410965@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Srinivas Neeli [ Upstream commit b70ab341088b2114dcbc7be868588f3e97893e6a ] The MCDMA BD format differs between memory-to-device (MM2S) and device-to-memory (S2MM) directions, but the driver was using generic 'status' and 'sideband_status' fields for both. This led to incorrect residue calculations when the hardware updates direction-specific fields. Refactor the descriptor structure to use unions with direction-specific field mappings, and update the residue calculation logic to select the correct status field based on DMA direction. This matches the hardware descriptor layout and fixes incorrect residue reporting. Fixes: 6ccd692bfb7f ("dmaengine: xilinx_dma: Add Xilinx AXI MCDMA Engine driver support") Reviewed-by: Radhey Shyam Pandey Signed-off-by: Srinivas Neeli Reviewed-by: Frank Li Link: https://patch.msgid.link/20260818174151.1608971-2-srinivas.neeli@amd.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/xilinx/xilinx_dma.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c index d1f83e315be7d..a2f4f94ee8144 100644 --- a/drivers/dma/xilinx/xilinx_dma.c +++ b/drivers/dma/xilinx/xilinx_dma.c @@ -219,6 +219,7 @@ #define XILINX_MCDMA_IRQ_ERR_MASK BIT(7) #define XILINX_MCDMA_BD_EOP BIT(30) #define XILINX_MCDMA_BD_SOP BIT(31) +#define XILINX_MCDMA_BD_HW_SIZE 64 /** * struct xilinx_vdma_desc_hw - Hardware Descriptor @@ -273,8 +274,10 @@ struct xilinx_axidma_desc_hw { * @buf_addr_msb: MSB of Buffer address @0x0C * @rsvd: Reserved field @0x10 * @control: Control Information field @0x14 - * @status: Status field @0x18 - * @sideband_status: Status of sideband signals @0x1C + * @mm2s_ctrl_sideband: Sideband control info for mm2s @0x18 + * @s2mm_status: Status field for s2mm @0x18 + * @mm2s_status: Status field for mm2s @0x1C + * @s2mm_sideband_status: Sideband status for s2mm @0x1C * @app: APP Fields @0x20 - 0x30 */ struct xilinx_aximcdma_desc_hw { @@ -284,10 +287,17 @@ struct xilinx_aximcdma_desc_hw { u32 buf_addr_msb; u32 rsvd; u32 control; - u32 status; - u32 sideband_status; + union { + u32 mm2s_ctrl_sideband; + u32 s2mm_status; + }; + union { + u32 mm2s_status; + u32 s2mm_sideband_status; + }; u32 app[XILINX_DMA_NUM_APP_WORDS]; } __aligned(64); +static_assert(sizeof(struct xilinx_aximcdma_desc_hw) == XILINX_MCDMA_BD_HW_SIZE); /** * struct xilinx_cdma_desc_hw - Hardware Descriptor @@ -996,9 +1006,11 @@ static u32 xilinx_dma_get_residue(struct xilinx_dma_chan *chan, struct xilinx_aximcdma_tx_segment, node); aximcdma_hw = &aximcdma_seg->hw; - residue += - (aximcdma_hw->control & chan->xdev->max_buffer_len) - - (aximcdma_hw->status & chan->xdev->max_buffer_len); + residue += aximcdma_hw->control & chan->xdev->max_buffer_len; + if (chan->direction == DMA_DEV_TO_MEM) + residue -= aximcdma_hw->s2mm_status & chan->xdev->max_buffer_len; + else + residue -= aximcdma_hw->mm2s_status & chan->xdev->max_buffer_len; } } -- 2.53.0