From patchwork Mon Jan 29 16:25:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kory Maincent X-Patchwork-Id: 13535954 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) (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 038EB155A5D; Mon, 29 Jan 2024 16:26:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.196 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706545570; cv=none; b=LkUkhrYn0sl6iOfCs2syUkove7ZBLCQutOOmmT7l/kcMZjSJXRg4GiBgk2kSB9sYpTWIfVW2rufmuaDDq4naB8Q1ZzM7f/7+kFH0Mvy8POQeE/nABT4qYuNt/WcA9TnOV8N5vqHV7PNQuMFZOrFFqP2lMrAmq/BHdObIM3y+Y8A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706545570; c=relaxed/simple; bh=C4sO6yQ/bq+76ak3Oo81L+OU1zOyCbXoSaUNduyzz0w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UujnTPFLlWYYoaQagXbymBN33+nU7O7QmEQRfm5qIR5lVh+L4AiydmM79qcmSjp4EwJi+bBNv5PbOpShI8V9CVgKZB3SR8L7Uy0hF0T/2+Lbq5OBUdSk2InNI8J9/N5g9KYg91lLqNEYZ8WiyPYlze/5VJRmah5d1egjx2VAqvA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=eaCrbU3p; arc=none smtp.client-ip=217.70.183.196 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="eaCrbU3p" Received: by mail.gandi.net (Postfix) with ESMTPSA id CE5D6E000B; Mon, 29 Jan 2024 16:26:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1706545566; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MG/EpR8bVcQceln2f1UmgAvAjO7ip8LLXAJEWchyMuQ=; b=eaCrbU3p0Ll8pLp5KtMk2BFOFJrF8vRmqnxFUveVuzaMIo98Vc8yFYPvXEP45wVKgDA5t0 GMJpqeW+mAXtNOjM0kB5EgoMyKt25qIgy/iEVcZOubQT+xYj+ncWFTea7HVNNLsODqe4fQ ucA8h6kEvzxQXb5VP7SqmxaTAWO5qJCl3PecS/FQknYgIN7PZ/0irfiWYjhkYOBWMj/JDW hX3CF8BSjYDoWPGjyYNH7DU3nlx4kQl3rJF0GUArrJs/yVRXz+NJtlwBP+eTLbPrIS5Rys rwhH72vGdvY09mhERXcs3Z3b3y6wZ5ZoFeY49QkP9SlEvw1EfXVNiacg0VbhHQ== From: Kory Maincent Date: Mon, 29 Jan 2024 17:25:57 +0100 Subject: [PATCH v7 1/6] dmaengine: dw-edma: Fix the ch_count hdma callback Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240129-b4-feature_hdma_mainline-v7-1-8e8c1acb7a46@bootlin.com> References: <20240129-b4-feature_hdma_mainline-v7-0-8e8c1acb7a46@bootlin.com> In-Reply-To: <20240129-b4-feature_hdma_mainline-v7-0-8e8c1acb7a46@bootlin.com> To: Manivannan Sadhasivam , Gustavo Pimentel , Serge Semin , Vinod Koul , Cai Huoqing Cc: Thomas Petazzoni , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, Herve Codina , Kory Maincent , Manivannan Sadhasivam X-Mailer: b4 0.12.4 X-GND-Sasl: kory.maincent@bootlin.com The current check of ch_en enabled to know the maximum number of available hardware channels is wrong as it check the number of ch_en register set but all of them are unset at probe. This register is set at the dw_hdma_v0_core_start function which is run lately before a DMA transfer. The HDMA IP have no way to know the number of hardware channels available like the eDMA IP, then let set it to maximum channels and let the platform set the right number of channels. Fixes: e74c39573d35 ("dmaengine: dw-edma: Add support for native HDMA") Acked-by: Manivannan Sadhasivam Reviewed-by: Serge Semin Signed-off-by: Kory Maincent --- See the following thread mail that talk about this issue: https://lore.kernel.org/lkml/20230607095832.6d6b1a73@kmaincent-XPS-13-7390/ Changes in v2: - Add comment Changes in v3: - Fix comment style. --- drivers/dma/dw-edma/dw-hdma-v0-core.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/dma/dw-edma/dw-hdma-v0-core.c b/drivers/dma/dw-edma/dw-hdma-v0-core.c index 00b735a0202a..1f4cb7db5475 100644 --- a/drivers/dma/dw-edma/dw-hdma-v0-core.c +++ b/drivers/dma/dw-edma/dw-hdma-v0-core.c @@ -65,18 +65,12 @@ static void dw_hdma_v0_core_off(struct dw_edma *dw) static u16 dw_hdma_v0_core_ch_count(struct dw_edma *dw, enum dw_edma_dir dir) { - u32 num_ch = 0; - int id; - - for (id = 0; id < HDMA_V0_MAX_NR_CH; id++) { - if (GET_CH_32(dw, id, dir, ch_en) & BIT(0)) - num_ch++; - } - - if (num_ch > HDMA_V0_MAX_NR_CH) - num_ch = HDMA_V0_MAX_NR_CH; - - return (u16)num_ch; + /* + * The HDMA IP have no way to know the number of hardware channels + * available, we set it to maximum channels and let the platform + * set the right number of channels. + */ + return HDMA_V0_MAX_NR_CH; } static enum dma_status dw_hdma_v0_core_ch_status(struct dw_edma_chan *chan) From patchwork Mon Jan 29 16:25:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kory Maincent X-Patchwork-Id: 13535956 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) (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 1C95764CFF; Mon, 29 Jan 2024 16:26:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.196 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706545571; cv=none; b=JXFcoRChMiafVGDn24rwis2zr/PNOQbNC+Pc7MKzE1zHl27Nryv3Yw+aI5EdvCCY+VCHWb4pszzN//33vJza16+YBpBb8Nier+Yhf+boSoVShax00qZdxVIfqBKtXX8wuOIKyQlyuf9U0suvFpc0LrWbSCcZlU7T9fmoggNr+Zs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706545571; c=relaxed/simple; bh=UaY75zw6o52pDBfyVQuKZPkthmJ59a0OijX3V5ynnkU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WG7HtJjw8Mzs77q1EzUOwiWup1c23kt2k1At14egVJL+lyD01cGgSIw+2sfZFRFXUOLRIEiqte6rj0QFhkhPwnsOApVR7EnLyiO7GjMZANMoYUvsbvjHArvtLojpTDigcKy85d8QuTfpLMWkaRY7XcI3Puwwa3hBL/1TKfAx3fU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=k16/AWa1; arc=none smtp.client-ip=217.70.183.196 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="k16/AWa1" Received: by mail.gandi.net (Postfix) with ESMTPSA id 78C89E000E; Mon, 29 Jan 2024 16:26:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1706545567; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FAldIdFOcM6TSQgoc+utZ58ITzn88qsDQysRSDWf7aE=; b=k16/AWa19fqJf1nRgkxYXzj2UPvusjUHMekficOF8ryuUewp6ia77yC+U0DOlLz5EMFxah 9+qHXCb5OHHGbsH6hSFhYygoTibLsXkj855fyPhuK5Eid4A3oUBKiWMu8xWLnDhjub5YgW W51fnK7AKblSdeXwGAoxeymcggvQ8MZNblSFra22UodjsNV+fwtB+FeGToHt/4RTja2HFd Lo3I/XAJtxafaEfn20e37rfLiRUAPA1IaA8/n26/N1Sjfa6zeQvISKVX3ZoZo846l6KcyL qJAY7qXGRGOxPPOsC7rW82PSEmRL05n+QbcNh81NSCxSG0rncch9YLlK4nO+BA== From: Kory Maincent Date: Mon, 29 Jan 2024 17:25:58 +0100 Subject: [PATCH v7 2/6] dmaengine: dw-edma: Fix wrong interrupt bit set for HDMA Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240129-b4-feature_hdma_mainline-v7-2-8e8c1acb7a46@bootlin.com> References: <20240129-b4-feature_hdma_mainline-v7-0-8e8c1acb7a46@bootlin.com> In-Reply-To: <20240129-b4-feature_hdma_mainline-v7-0-8e8c1acb7a46@bootlin.com> To: Manivannan Sadhasivam , Gustavo Pimentel , Serge Semin , Vinod Koul , Cai Huoqing Cc: Thomas Petazzoni , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, Herve Codina , Kory Maincent , Manivannan Sadhasivam X-Mailer: b4 0.12.4 X-GND-Sasl: kory.maincent@bootlin.com Instead of setting HDMA_V0_LOCAL_ABORT_INT_EN bit, HDMA_V0_LOCAL_STOP_INT_EN bit got set twice, due to which the abort interrupt is not getting generated for HDMA. Fix it by setting the correct interrupt enable bit. Fixes: e74c39573d35 ("dmaengine: dw-edma: Add support for native HDMA") Reviewed-by: Serge Semin Reviewed-by: Manivannan Sadhasivam Signed-off-by: Kory Maincent --- Changes in v3: - Split the patch in two to differ bug fix and simple harmless typo. Changes in v6: - Update commit message --- drivers/dma/dw-edma/dw-hdma-v0-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/dw-edma/dw-hdma-v0-core.c b/drivers/dma/dw-edma/dw-hdma-v0-core.c index 1f4cb7db5475..108f9127aaaa 100644 --- a/drivers/dma/dw-edma/dw-hdma-v0-core.c +++ b/drivers/dma/dw-edma/dw-hdma-v0-core.c @@ -236,7 +236,7 @@ static void dw_hdma_v0_core_start(struct dw_edma_chunk *chunk, bool first) /* Interrupt enable&unmask - done, abort */ tmp = GET_CH_32(dw, chan->dir, chan->id, int_setup) | HDMA_V0_STOP_INT_MASK | HDMA_V0_ABORT_INT_MASK | - HDMA_V0_LOCAL_STOP_INT_EN | HDMA_V0_LOCAL_STOP_INT_EN; + HDMA_V0_LOCAL_STOP_INT_EN | HDMA_V0_LOCAL_ABORT_INT_EN; SET_CH_32(dw, chan->dir, chan->id, int_setup, tmp); /* Channel control */ SET_CH_32(dw, chan->dir, chan->id, control1, HDMA_V0_LINKLIST_EN); From patchwork Mon Jan 29 16:25:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kory Maincent X-Patchwork-Id: 13535957 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) (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 57B5E156960; Mon, 29 Jan 2024 16:26:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.196 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706545571; cv=none; b=h7aECX0kOWG6dvsHMGxPLypHfbswFU3uOZvTyrJWknO1p5FvUFfs5JNrwVuJDym+uldO8Jv0bmNTyfM+ZR+Xobityl/7hWZRbxh0ic+Lt7PkTI+tbyiq+dSFc7qReOVj1xAuFYd2+nBmrdF930OuEpfKRJOyJJFmX9CF3ilRf2k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706545571; c=relaxed/simple; bh=QRCYGQMJR35x7Hogymwk07ORHyYx6BkNlkL42bEP7sI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=E8oFzBBOLqi3wZTHNd4i8Vi4uzE54YsTbBRiRYJGUNcZ2hhAa3W4634EgqhWem5xxuW4AuHs8uyGeK4D9E9HqKut48tNslifdqBrUNHuXmoeBfuSHxzPQzQe3qicBtzD8B0c599hzF31i7N2xl1CXZr2MXw7Cyy/3NJa6/3J0Hw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=k5GrHF+/; arc=none smtp.client-ip=217.70.183.196 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="k5GrHF+/" Received: by mail.gandi.net (Postfix) with ESMTPSA id 182D8E0010; Mon, 29 Jan 2024 16:26:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1706545567; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Cl2LjMo9y4kvfDVQJV3DM0tMK1TINYKcgigqy6Qohec=; b=k5GrHF+/cE2YcEU+sP/ZTqdhcWth22NgGjZKNYsBFnWS/VdP0SRYxEmA0wDLWXAVPK2Cve br/QlNjk3a09/RA2WAjt2vrxplIjdT51/24S1d0MfNKe6h1pcm/zI1xIDeccSAyOSihSht 7zycuWtRCJ+vGt9A4uUAVQKBQboajZRqgEi0ix1BCX+/uCAKMsOwJIdFE91izfxoG99Aow IoXb6QxhNjgQE+uWehybms87oNF9UbyaKRLc/ITeSY2M/beZCQGNFddZIYntp/y00rb/fH SyZ80LWWLklTzYLdA4brhu48wFtND9xw9WUhcpHVC8/ctblqHNzDCB/PELotiQ== From: Kory Maincent Date: Mon, 29 Jan 2024 17:25:59 +0100 Subject: [PATCH v7 3/6] dmaengine: dw-edma: HDMA_V0_REMOTEL_STOP_INT_EN typo fix Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240129-b4-feature_hdma_mainline-v7-3-8e8c1acb7a46@bootlin.com> References: <20240129-b4-feature_hdma_mainline-v7-0-8e8c1acb7a46@bootlin.com> In-Reply-To: <20240129-b4-feature_hdma_mainline-v7-0-8e8c1acb7a46@bootlin.com> To: Manivannan Sadhasivam , Gustavo Pimentel , Serge Semin , Vinod Koul , Cai Huoqing Cc: Thomas Petazzoni , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, Herve Codina , Kory Maincent , Manivannan Sadhasivam X-Mailer: b4 0.12.4 X-GND-Sasl: kory.maincent@bootlin.com Fix "HDMA_V0_REMOTEL_STOP_INT_EN" typo error Fixes: e74c39573d35 ("dmaengine: dw-edma: Add support for native HDMA") Reviewed-by: Serge Semin Reviewed-by: Manivannan Sadhasivam Signed-off-by: Kory Maincent --- Changes in v3: - Split the patch in two to differ bug fix and simple harmless typo. Changes in v6: - Mention the typo in the subject. --- drivers/dma/dw-edma/dw-hdma-v0-regs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/dw-edma/dw-hdma-v0-regs.h b/drivers/dma/dw-edma/dw-hdma-v0-regs.h index a974abdf8aaf..eab5fd7177e5 100644 --- a/drivers/dma/dw-edma/dw-hdma-v0-regs.h +++ b/drivers/dma/dw-edma/dw-hdma-v0-regs.h @@ -15,7 +15,7 @@ #define HDMA_V0_LOCAL_ABORT_INT_EN BIT(6) #define HDMA_V0_REMOTE_ABORT_INT_EN BIT(5) #define HDMA_V0_LOCAL_STOP_INT_EN BIT(4) -#define HDMA_V0_REMOTEL_STOP_INT_EN BIT(3) +#define HDMA_V0_REMOTE_STOP_INT_EN BIT(3) #define HDMA_V0_ABORT_INT_MASK BIT(2) #define HDMA_V0_STOP_INT_MASK BIT(0) #define HDMA_V0_LINKLIST_EN BIT(0) From patchwork Mon Jan 29 16:26:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kory Maincent X-Patchwork-Id: 13535958 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) (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 00273155A5F; Mon, 29 Jan 2024 16:26:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.196 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706545571; cv=none; b=FWa9TdkEA0fcWG+yiUiYwPmilUBszONfaidY/qCYiOQOdj2YP95GMkb4+6X0hhpHv2ZSYQuYoPsiPIgF/vuqdGQpdmEveuEc+aKUOaDNkQFLTS6WiM0J4wVr8UNA7t16p7RbTSd+DJjiZvYdODc/vRYChzEaY2McoHm+unycnng= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706545571; c=relaxed/simple; bh=fqv4o+qKl3gS1s7xHmfm0lxwsPu6RFBo7Lq+u+UUsxM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jtBVK3VHav3i5dZKK7hLJUDkfY2RgtTYZ3BTl4a4Okhu8B83pHeuA8MKaeI9vBkZqmdTzZq9L4RVQgpJzFP/ToYQtKw1CyZ3kn0aGyVDtMtAwUe36nQ57zoNxeaoOgUBVr4iDGCsS5BUmlA9iHciAvzFAw5GyXfXEIJXZuf9EKI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=Kq7zWzyG; arc=none smtp.client-ip=217.70.183.196 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="Kq7zWzyG" Received: by mail.gandi.net (Postfix) with ESMTPSA id A9A73E0012; Mon, 29 Jan 2024 16:26:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1706545568; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=svngh7gavoOsAoTd14KvI+aVm1JHod9n5Mvh72UXNZY=; b=Kq7zWzyGymSB4C0hKIBsi+TBs4qe86eZC9Mm5XNrRlLN3O7Azi8Tk8JpXUzAzkjHz7+8mG U3vlauIOB3BY+whBKNcymcmD5Webw9voUAqV6BnHjPOaREEVfHRnaykm2+T643SZsMyplK 7+QWojGybHLSpdK0HjTiyyom6WFN/MTQI9fDeu71b4WlPWzAGHM06FRG+IvR5+io+/gQb2 Bz/QuD17zOhtwuCt6t7W97cgMF6MAHEolr+xcxAUipXHJrCWjXz+0OCZN4P+ZxnTGGj4Q4 WpLN2p+Wz9ivU642RHXGUzy6hUn/MdIjtzU+Tus+mMpq3AAks5tGMGMqNDyvWg== From: Kory Maincent Date: Mon, 29 Jan 2024 17:26:00 +0100 Subject: [PATCH v7 4/6] dmaengine: dw-edma: Add HDMA remote interrupt configuration Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240129-b4-feature_hdma_mainline-v7-4-8e8c1acb7a46@bootlin.com> References: <20240129-b4-feature_hdma_mainline-v7-0-8e8c1acb7a46@bootlin.com> In-Reply-To: <20240129-b4-feature_hdma_mainline-v7-0-8e8c1acb7a46@bootlin.com> To: Manivannan Sadhasivam , Gustavo Pimentel , Serge Semin , Vinod Koul , Cai Huoqing Cc: Thomas Petazzoni , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, Herve Codina , Kory Maincent , Manivannan Sadhasivam X-Mailer: b4 0.12.4 X-GND-Sasl: kory.maincent@bootlin.com Only the local interruption was configured, remote interrupt was left behind. This patch fix it by setting stop and abort remote interrupts when the DW_EDMA_CHIP_LOCAL flag is not set. Fixes: e74c39573d35 ("dmaengine: dw-edma: Add support for native HDMA") Signed-off-by: Kory Maincent Reviewed-by: Serge Semin Acked-by: Manivannan Sadhasivam --- drivers/dma/dw-edma/dw-hdma-v0-core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/dma/dw-edma/dw-hdma-v0-core.c b/drivers/dma/dw-edma/dw-hdma-v0-core.c index 108f9127aaaa..04b0bcb6ded9 100644 --- a/drivers/dma/dw-edma/dw-hdma-v0-core.c +++ b/drivers/dma/dw-edma/dw-hdma-v0-core.c @@ -237,6 +237,8 @@ static void dw_hdma_v0_core_start(struct dw_edma_chunk *chunk, bool first) tmp = GET_CH_32(dw, chan->dir, chan->id, int_setup) | HDMA_V0_STOP_INT_MASK | HDMA_V0_ABORT_INT_MASK | HDMA_V0_LOCAL_STOP_INT_EN | HDMA_V0_LOCAL_ABORT_INT_EN; + if (!(dw->chip->flags & DW_EDMA_CHIP_LOCAL)) + tmp |= HDMA_V0_REMOTE_STOP_INT_EN | HDMA_V0_REMOTE_ABORT_INT_EN; SET_CH_32(dw, chan->dir, chan->id, int_setup, tmp); /* Channel control */ SET_CH_32(dw, chan->dir, chan->id, control1, HDMA_V0_LINKLIST_EN); From patchwork Mon Jan 29 16:26:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kory Maincent X-Patchwork-Id: 13535959 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) (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 A6A4115696E; Mon, 29 Jan 2024 16:26:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.196 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706545572; cv=none; b=JmprdtgxrHKNl+pN8eyCPADhrZQfjyaLC7Bkz4YAbLSZQ0br4jR2vGCgy2nTa8GgrwD9xM2oF8BssMsivdOEnrTIA8ph7KlE3FDTRYkd/1LGVHGJs9GhuvlEPQmVa3mIABmOEhWD7t3dmHZ6MEYjehCHG/wT2+QEbwvzyan8Upk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706545572; c=relaxed/simple; bh=x47cesg/6O6mFEGId7nMSQjKtzbnwyjiAJgM1rfNKwU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Vgupcv1aGY4EQEHJQIsYRfkUppTej8Mawib14bdRkixk9keeac10CDutaCMuePIqFgpXXcmS/JrqmYEwIEX5nxFsKqkNPaej98PvjnRBdeWkM6I6V3zk9frC9R1WFnlUBK3jjMN2SbpUSj3g3cXGlfb99jk8B2aytClKjleqGXg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=Z/PZCM9X; arc=none smtp.client-ip=217.70.183.196 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="Z/PZCM9X" Received: by mail.gandi.net (Postfix) with ESMTPSA id 48A5FE0013; Mon, 29 Jan 2024 16:26:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1706545568; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ppALPMc1pFTIFQzwRMW+tmzwmtQj10e6/dO7SG+F1wI=; b=Z/PZCM9XZQ+0pHNBkgC7DcZmmNkE0NvU9jCHkgzF3yWHCmxDNzwo50FZTQx3XS4TiPgOWe bpieuxk7/MuoiNSEuY17Fu0fn8Mlaw/BDC7HvL8nHPUM7oIym0S1XeqsIipMIi1KU/3Iz6 zLsS3/chykKR6FJ1GduyBpiw5NSnbp5TaQ8S4do5O50RYxfM0qD3aqmwg1DHWRZMXSEliq 4S/VF6Zsi3wiSkBiEMsq1FIb19qQtldI/PmKWxoXD70n4nXTUDCZO58nRuoYTZzIy3UvyL Ucl/pm4GiwBcewYVcDeCOQrfaxH9G5lhQJBkKqE8msGclGxL/61lRZaW69wciw== From: Kory Maincent Date: Mon, 29 Jan 2024 17:26:01 +0100 Subject: [PATCH v7 5/6] dmaengine: dw-edma: HDMA: Add sync read before starting the DMA transfer in remote setup Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240129-b4-feature_hdma_mainline-v7-5-8e8c1acb7a46@bootlin.com> References: <20240129-b4-feature_hdma_mainline-v7-0-8e8c1acb7a46@bootlin.com> In-Reply-To: <20240129-b4-feature_hdma_mainline-v7-0-8e8c1acb7a46@bootlin.com> To: Manivannan Sadhasivam , Gustavo Pimentel , Serge Semin , Vinod Koul , Cai Huoqing Cc: Thomas Petazzoni , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, Herve Codina , Kory Maincent , Manivannan Sadhasivam X-Mailer: b4 0.12.4 X-GND-Sasl: kory.maincent@bootlin.com The Linked list element and pointer are not stored in the same memory as the HDMA controller register. If the doorbell register is toggled before the full write of the linked list a race condition error will occur. In remote setup we can only use a readl to the memory to assure the full write has occurred. Fixes: e74c39573d35 ("dmaengine: dw-edma: Add support for native HDMA") Reviewed-by: Serge Semin Reviewed-by: Manivannan Sadhasivam Signed-off-by: Kory Maincent --- Changes in v2: - Move the sync read in a function. - Add commments Changes in v4: - Update git commit message. Changes in v6: - Fix comment typos. --- drivers/dma/dw-edma/dw-hdma-v0-core.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/dma/dw-edma/dw-hdma-v0-core.c b/drivers/dma/dw-edma/dw-hdma-v0-core.c index 04b0bcb6ded9..10e8f0715114 100644 --- a/drivers/dma/dw-edma/dw-hdma-v0-core.c +++ b/drivers/dma/dw-edma/dw-hdma-v0-core.c @@ -222,6 +222,20 @@ static void dw_hdma_v0_core_write_chunk(struct dw_edma_chunk *chunk) dw_hdma_v0_write_ll_link(chunk, i, control, chunk->ll_region.paddr); } +static void dw_hdma_v0_sync_ll_data(struct dw_edma_chunk *chunk) +{ + /* + * In case of remote HDMA engine setup, the DW PCIe RP/EP internal + * configuration registers and application memory are normally accessed + * over different buses. Ensure LL-data reaches the memory before the + * doorbell register is toggled by issuing the dummy-read from the remote + * LL memory in a hope that the MRd TLP will return only after the + * last MWr TLP is completed + */ + if (!(chunk->chan->dw->chip->flags & DW_EDMA_CHIP_LOCAL)) + readl(chunk->ll_region.vaddr.io); +} + static void dw_hdma_v0_core_start(struct dw_edma_chunk *chunk, bool first) { struct dw_edma_chan *chan = chunk->chan; @@ -252,6 +266,9 @@ static void dw_hdma_v0_core_start(struct dw_edma_chunk *chunk, bool first) /* Set consumer cycle */ SET_CH_32(dw, chan->dir, chan->id, cycle_sync, HDMA_V0_CONSUMER_CYCLE_STAT | HDMA_V0_CONSUMER_CYCLE_BIT); + + dw_hdma_v0_sync_ll_data(chunk); + /* Doorbell */ SET_CH_32(dw, chan->dir, chan->id, doorbell, HDMA_V0_DOORBELL_START); } From patchwork Mon Jan 29 16:26:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kory Maincent X-Patchwork-Id: 13535960 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) (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 53D1F15702C; Mon, 29 Jan 2024 16:26:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.196 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706545574; cv=none; b=jQToONlPCz273HwQ+395nqzQdbtvxp8uvpntNxy4AkbTRyMIaPpgQ6m7WvWZBMUYWB5V33eP5Zw1aMXKfMcmx3WwHw7Ll3Zyaj2yg8JktyLnDaCdWR04cVUrhFA78WQ3X5gn1zms0KiRvPaAVGBFDD12YvRvYdDuksKdRoYygm0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706545574; c=relaxed/simple; bh=uJflaUj/o6qIVrmoj3XRFhafmb5pPKWQ886Uc8xGT/g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=P0tiAsxMxQWAoF3il1+t4ptc0/PYi2RAewK/UzI18NAbn8ecBgYgfax5T5yP4Pg0DML1k1qKkQ8zGL1Totr15wwXMIDD6/R9UhCPtrWUJZXbjwAbXbixk4r2OWNrl7N8aXiGn8bF3iDKAcOr2HNQKtanC7krNcEWSBO8Id29Q9I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=d6v5f7h5; arc=none smtp.client-ip=217.70.183.196 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="d6v5f7h5" Received: by mail.gandi.net (Postfix) with ESMTPSA id E01A1E000F; Mon, 29 Jan 2024 16:26:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1706545569; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NmKeLzmrWDgqwybx3yFMvQV6TVy/TJmLs+gOb6jsjkI=; b=d6v5f7h5LqrKNI+2B+Idq2KxCE2DWyBdxziPUtJ+3XWOJi4Kkpm/yLPYvDmcwczfiSvADu 8fUj6ZXw0IpUYd1JMOtlZPj2F+B09QO7CQNGSg2wXPU24BIACn9/1RZPGxQT+NqPhbwxnH /8iqGXyICsE18lE322T2CJ62VRRbMWLQjs3GJc3SkI19dMjzYWLwrG5GTYMLowEUwWEZLc PaBC3m9P3XiElUN1uRdZsmWBoFlkEgSqJyJ8apk8DeW4KoqWfL6uJCJdqkZL7rAzZlQK4E ZCQzdn9zsf/sKluwVrNnFw1TeBniXZnrdY1Rr/YSXivv8KO5Hzyxq8z2KkdhHQ== From: Kory Maincent Date: Mon, 29 Jan 2024 17:26:02 +0100 Subject: [PATCH v7 6/6] dmaengine: dw-edma: eDMA: Add sync read before starting the DMA transfer in remote setup Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240129-b4-feature_hdma_mainline-v7-6-8e8c1acb7a46@bootlin.com> References: <20240129-b4-feature_hdma_mainline-v7-0-8e8c1acb7a46@bootlin.com> In-Reply-To: <20240129-b4-feature_hdma_mainline-v7-0-8e8c1acb7a46@bootlin.com> To: Manivannan Sadhasivam , Gustavo Pimentel , Serge Semin , Vinod Koul , Cai Huoqing Cc: Thomas Petazzoni , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, Herve Codina , Kory Maincent , Manivannan Sadhasivam X-Mailer: b4 0.12.4 X-GND-Sasl: kory.maincent@bootlin.com The Linked list element and pointer are not stored in the same memory as the eDMA controller register. If the doorbell register is toggled before the full write of the linked list a race condition error will occur. In remote setup we can only use a readl to the memory to assure the full write has occurred. Fixes: 7e4b8a4fbe2c ("dmaengine: Add Synopsys eDMA IP version 0 support") Reviewed-by: Serge Semin Reviewed-by: Manivannan Sadhasivam Signed-off-by: Kory Maincent --- Changes in v2: - New patch Changes in v4: - Update git commit message. Changes in v6: - Fix comment typos. --- drivers/dma/dw-edma/dw-edma-v0-core.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/dma/dw-edma/dw-edma-v0-core.c b/drivers/dma/dw-edma/dw-edma-v0-core.c index b38786f0ad79..b75fdaffad9a 100644 --- a/drivers/dma/dw-edma/dw-edma-v0-core.c +++ b/drivers/dma/dw-edma/dw-edma-v0-core.c @@ -346,6 +346,20 @@ static void dw_edma_v0_core_write_chunk(struct dw_edma_chunk *chunk) dw_edma_v0_write_ll_link(chunk, i, control, chunk->ll_region.paddr); } +static void dw_edma_v0_sync_ll_data(struct dw_edma_chunk *chunk) +{ + /* + * In case of remote eDMA engine setup, the DW PCIe RP/EP internal + * configuration registers and application memory are normally accessed + * over different buses. Ensure LL-data reaches the memory before the + * doorbell register is toggled by issuing the dummy-read from the remote + * LL memory in a hope that the MRd TLP will return only after the + * last MWr TLP is completed + */ + if (!(chunk->chan->dw->chip->flags & DW_EDMA_CHIP_LOCAL)) + readl(chunk->ll_region.vaddr.io); +} + static void dw_edma_v0_core_start(struct dw_edma_chunk *chunk, bool first) { struct dw_edma_chan *chan = chunk->chan; @@ -412,6 +426,9 @@ static void dw_edma_v0_core_start(struct dw_edma_chunk *chunk, bool first) SET_CH_32(dw, chan->dir, chan->id, llp.msb, upper_32_bits(chunk->ll_region.paddr)); } + + dw_edma_v0_sync_ll_data(chunk); + /* Doorbell */ SET_RW_32(dw, chan->dir, doorbell, FIELD_PREP(EDMA_V0_DOORBELL_CH_MASK, chan->id));