Received: by 2002:a05:7412:a9a3:b0:f9:327e:43ab with SMTP id o35csp40699rdh; Mon, 18 Dec 2023 03:56:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IHx7MbiscjFsQJpJepLPtFYeTN1fwDy6Kunw4YAphv72+Xi1ZgAgthzZ5pVfnmS0FB1kURi X-Received: by 2002:a17:906:344f:b0:a23:5753:7ba5 with SMTP id d15-20020a170906344f00b00a2357537ba5mr731363ejb.47.1702900607308; Mon, 18 Dec 2023 03:56:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702900607; cv=none; d=google.com; s=arc-20160816; b=RlMzOhCsxqdeAx3GxZot9oX+SVaznSInKs9IzJY2LrXJ3AIo8Ldu+aSHPFVf45Wsjj 5Gx8JyzjIzSJPDC/PatHrTnC6LthR0yNt7veWP+s7/JWInfeKo7pFB+venXRNFQy8Jn/ jpXFP9wCaJJejOSno4WA5c/8pj+oaun1+7ItyK+wNvdUBoagu60bpwdcoW3bMIOzYCi0 Qr4ShFph53Z14/QG4fQIVJlLLQclT5SvM/YWtvA0e+tWvJJJHpom0OGmFx6IUWDnKs+E XpGDa45sWWDj2ZeQQt+mqvgSr91E4R34gN/2YetPoSsjRYtv9zpm3dGkKp3Ghf/Ojq84 psXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:dkim-filter; bh=kigQbZ6cbWkglz4+/r5I9p25DVWVAlGCZgXXB8MiuAQ=; fh=1pmAyp3xZ8sWUV98t98q7URUgX68KjDmTZriOyZWZ/U=; b=SZEVTQlL6keVvyNkLyNnGGv1hq4ynztYUnevXNpQY99JUtdhfKzhv9jBdoFh92cSQu CDfHzK59XcAMQADSM5iCZMlRNG8ChoTCiUxqsozVD6HhuCrxZv0L1QIEwRCiIg08TLFk I7e2wAUb6RXki+CDIaPuJgIBF+gHi8TFYvUsF07hSkKrszQQj5tAdJI5cb3ItAF7WK4j wyNXM7HNv9objuI8CGdC25iWKBbvqsqHIxkITnM9HuWkg5l/ai5NDjsN/pWCye9zi2W/ tCI1sV8zbFLrWDmkm7BfcFbvlKf9ia6vY1k8sn519MnKL9kf3IF9K0WrrudfFf+bnZae WqCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@alatek.krakow.pl header.s=99EE5E86-D06A-11EC-BE24-DBCCD0A148D3 header.b=MyOOARhx; spf=pass (google.com: domain of linux-kernel+bounces-3476-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3476-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alatek.krakow.pl Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id z14-20020a1709063a0e00b00a22fac6cdeasi4929420eje.542.2023.12.18.03.56.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 03:56:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-3476-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=fail header.i=@alatek.krakow.pl header.s=99EE5E86-D06A-11EC-BE24-DBCCD0A148D3 header.b=MyOOARhx; spf=pass (google.com: domain of linux-kernel+bounces-3476-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3476-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alatek.krakow.pl Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 2B7551F24816 for ; Mon, 18 Dec 2023 11:48:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 54B503D0B2; Mon, 18 Dec 2023 11:40:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=temperror (0-bit key) header.d=alatek.krakow.pl header.i=@alatek.krakow.pl header.b="MyOOARhx" X-Original-To: linux-kernel@vger.kernel.org Received: from helios.alatek.com.pl (helios.alatek.com.pl [85.14.123.227]) (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 1223B39FFB; Mon, 18 Dec 2023 11:40:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alatek.krakow.pl Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=alatek.krakow.pl Received: from localhost (localhost [127.0.0.1]) by helios.alatek.com.pl (Postfix) with ESMTP id CB0B62D0186C; Mon, 18 Dec 2023 12:40:16 +0100 (CET) Received: from helios.alatek.com.pl ([127.0.0.1]) by localhost (helios.alatek.com.pl [127.0.0.1]) (amavis, port 10032) with ESMTP id bDdscBx1haka; Mon, 18 Dec 2023 12:40:15 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by helios.alatek.com.pl (Postfix) with ESMTP id CB3CE2D0186B; Mon, 18 Dec 2023 12:40:15 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.10.3 helios.alatek.com.pl CB3CE2D0186B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alatek.krakow.pl; s=99EE5E86-D06A-11EC-BE24-DBCCD0A148D3; t=1702899615; bh=kigQbZ6cbWkglz4+/r5I9p25DVWVAlGCZgXXB8MiuAQ=; h=From:To:Date:Message-Id:MIME-Version; b=MyOOARhx2Yc9lzdHbbxlIeqh+8y3DqM/cAPrBvNuEbF+Db5WH45B/jZyLnum+k0P4 93MUfFZW49jgbw59ZfpZizEbmTxXOn1yWsUsXDE37D9fEipK8rclvZyLvISTiYN2jr 6AdXMRLBH0Kl/KCOj2XfCXZ9Guk4+Xq+kGsWv0nzi0oVIEfk5rvEicZOzFRsM+0cPv +InC1ZK9pP2bpMFHppXO1tgct68zEPTcdhTOUiX3idwrf591cWX/r8BgW6LYCmjVMO 0Wa3d+aIsZcBkCTuxW0lBvadisPbHykmkjaVJLfNLOW8dRswsH6AQyi4TspTUB3hiy Lbdjos4raJMFw== X-Virus-Scanned: amavis at alatek.com.pl Received: from helios.alatek.com.pl ([127.0.0.1]) by localhost (helios.alatek.com.pl [127.0.0.1]) (amavis, port 10026) with ESMTP id Z4XuabPfu1Xz; Mon, 18 Dec 2023 12:40:15 +0100 (CET) Received: from ideapad.. (unknown [10.0.2.2]) by helios.alatek.com.pl (Postfix) with ESMTPSA id 75E422D01868; Mon, 18 Dec 2023 12:40:15 +0100 (CET) From: Jan Kuliga To: lizhi.hou@amd.com, brian.xu@amd.com, raj.kumar.rampelli@amd.com, vkoul@kernel.org, michal.simek@amd.com, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, miquel.raynal@bootlin.com Cc: jankul@alatek.krakow.pl Subject: [PATCH v5 3/8] dmaengine: xilinx: xdma: Ease dma_pool alignment requirements Date: Mon, 18 Dec 2023 12:39:38 +0100 Message-Id: <20231218113943.9099-4-jankul@alatek.krakow.pl> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231218113904.9071-1-jankul@alatek.krakow.pl> References: <20231218113904.9071-1-jankul@alatek.krakow.pl> 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 According to the XDMA datasheet (PG195), the address of any descriptor must be 32 byte aligned. The datasheet also states that a contiguous block of descriptors must not cross a 4k address boundary. Therefore, it is possible to ease the pressure put on the dma_pool allocator just by requiring sufficient alignment and boundary values. Add proper macro definition and change the values passed into the dma_pool_create(). Signed-off-by: Jan Kuliga --- drivers/dma/xilinx/xdma-regs.h | 7 ++++--- drivers/dma/xilinx/xdma.c | 5 ++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/dma/xilinx/xdma-regs.h b/drivers/dma/xilinx/xdma-reg= s.h index 98117e8a466f..98f5f6fb9ff9 100644 --- a/drivers/dma/xilinx/xdma-regs.h +++ b/drivers/dma/xilinx/xdma-regs.h @@ -64,9 +64,10 @@ struct xdma_hw_desc { __le64 next_desc; }; =20 -#define XDMA_DESC_SIZE sizeof(struct xdma_hw_desc) -#define XDMA_DESC_BLOCK_SIZE (XDMA_DESC_SIZE * XDMA_DESC_ADJACENT) -#define XDMA_DESC_BLOCK_ALIGN 4096 +#define XDMA_DESC_SIZE sizeof(struct xdma_hw_desc) +#define XDMA_DESC_BLOCK_SIZE (XDMA_DESC_SIZE * XDMA_DESC_ADJACENT) +#define XDMA_DESC_BLOCK_ALIGN 32 +#define XDMA_DESC_BLOCK_BOUNDARY 4096 =20 /* * Channel registers diff --git a/drivers/dma/xilinx/xdma.c b/drivers/dma/xilinx/xdma.c index ddb9e7d07461..c22701e76b69 100644 --- a/drivers/dma/xilinx/xdma.c +++ b/drivers/dma/xilinx/xdma.c @@ -741,9 +741,8 @@ static int xdma_alloc_chan_resources(struct dma_chan = *chan) return -EINVAL; } =20 - xdma_chan->desc_pool =3D dma_pool_create(dma_chan_name(chan), - dev, XDMA_DESC_BLOCK_SIZE, - XDMA_DESC_BLOCK_ALIGN, 0); + xdma_chan->desc_pool =3D dma_pool_create(dma_chan_name(chan), dev, XDMA= _DESC_BLOCK_SIZE, + XDMA_DESC_BLOCK_ALIGN, XDMA_DESC_BLOCK_BOUNDARY); if (!xdma_chan->desc_pool) { xdma_err(xdev, "unable to allocate descriptor pool"); return -ENOMEM; --=20 2.34.1