Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2348979rdb; Fri, 8 Dec 2023 05:50:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IGPE9kW6YFNopKsR+qrzs7wWpUWVwZ3x0qu2zu3WNUaGoUX1EPxbERRd0Rs6BqznrYVpLav X-Received: by 2002:a05:6a20:da85:b0:18f:e27f:dd44 with SMTP id iy5-20020a056a20da8500b0018fe27fdd44mr1403461pzb.13.1702043430349; Fri, 08 Dec 2023 05:50:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702043430; cv=none; d=google.com; s=arc-20160816; b=Y5UD+ItGZp6NpQVUgwQI2ZZI2ZefZdQL+xbkMOzyu2AFym2I7qxy4JQ57snkjyhrnS 41cbf2sNQ6apcyIY4uuqxOmI5M2q8L8cQuTg2pbEvQMgYEcpgLV9JhHY6DDuUHmbkL8z J6vU9yT/zJgiZU5psY7UF05w0wiChCDhzzMf/LOWz7qidzMAD8Xb6DgAZIlUnQ8dTfDD 634GrtJ+2CoS/cPTOSw8Nnn6ERtCPs1mEkvW/olsvczGMuZ7CsyZF2sRfZq+WVTF3fYs izIFGKKmN7hlBDVJPguKdVQSNLXADEEvBCtZzgna8IVCPWxe6HWUOlM1i/MMhGLBV9jP dlyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=mcPb4bswnj/lXIxkXo1POfN4/aAJkVGhbaTTroE83nI=; fh=1pmAyp3xZ8sWUV98t98q7URUgX68KjDmTZriOyZWZ/U=; b=W4yzSXpbenj1Zoag7UYkqIrQ/7YxEj/0NtOpN031RAFy/zZd4boq/HLM56lpom3U6V fyyewruOkOsfrBBTjxyGO+YTbTZb1J+YWxIgsn+a3O75SWCrO8C0H92arNAKnLodMRDy GArDImqaPQFXKQLly9XvsnjJrmVp0f6kCfrvot5xK8TEOPbFXdKV276RavF38GNiS7Te YgRM65ClRVuMsGP0NfYvl5dnrYpfOyOFLdgVYDyWciPH2ocHC6cyWD4Z0+Lmp1SFCFNf VPpYPeEC7YisMYa5d4jaDHh7d1WJTrHf6dr8ycazmZKZ5XgtEqbGM2B+XniqDMzpVW79 No0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@alatek.krakow.pl header.s=99EE5E86-D06A-11EC-BE24-DBCCD0A148D3 header.b=e+rz5+fJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alatek.krakow.pl Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id e22-20020a63e016000000b005c278210f82si1583214pgh.544.2023.12.08.05.50.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 05:50:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=fail header.i=@alatek.krakow.pl header.s=99EE5E86-D06A-11EC-BE24-DBCCD0A148D3 header.b=e+rz5+fJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alatek.krakow.pl Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id D5C6F82516F4; Fri, 8 Dec 2023 05:50:27 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573852AbjLHNuO (ORCPT + 99 others); Fri, 8 Dec 2023 08:50:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573848AbjLHNuM (ORCPT ); Fri, 8 Dec 2023 08:50:12 -0500 Received: from helios.alatek.com.pl (helios.alatek.com.pl [85.14.123.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34CF31732; Fri, 8 Dec 2023 05:50:18 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by helios.alatek.com.pl (Postfix) with ESMTP id F3B862D00F54; Fri, 8 Dec 2023 14:50: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 DLBFkRLwkpfS; Fri, 8 Dec 2023 14:50:15 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by helios.alatek.com.pl (Postfix) with ESMTP id DC8352D00F53; Fri, 8 Dec 2023 14:50:15 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.10.3 helios.alatek.com.pl DC8352D00F53 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alatek.krakow.pl; s=99EE5E86-D06A-11EC-BE24-DBCCD0A148D3; t=1702043415; bh=mcPb4bswnj/lXIxkXo1POfN4/aAJkVGhbaTTroE83nI=; h=From:To:Date:Message-Id:MIME-Version; b=e+rz5+fJm44bC6IIucyl2Jc1VHz3ORzQW/Qlzlx+yNKm3fPoKGFwj7c/0+921syCG 0jP15pzOSMwQZqIlAS2i+up80FpTEwgKjDpBEnZMEJLRgsvmxTjklB2BkoxtH8VDpx qRLKkGpFWx+LM8tEIb4E5ze61IeoH8N/bmNRz81gQz8MbVZ+LryjXpmOTpbToZ6Zqu ym/r6GAON7TXnzV/Usd66a06eMr2IQ86ZBYMEJgSB75N3QPTGyqf7bWqlOVpANgloB DYSmUzyYEPUbjSNTozYZxuur6NHXtASh5yv66A+LdJOor48cIrOiAbb1aFUg019o0P XtknNVaiiHKkw== 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 pcZGCCya3Src; Fri, 8 Dec 2023 14:50:15 +0100 (CET) Received: from localhost.localdomain (unknown [10.125.125.6]) by helios.alatek.com.pl (Postfix) with ESMTPSA id 3CCF92D00F4D; Fri, 8 Dec 2023 14:50: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 v4 3/8] dmaengine: xilinx: xdma: Ease dma_pool alignment requirements Date: Fri, 8 Dec 2023 14:49:24 +0100 Message-Id: <20231208134929.49523-4-jankul@alatek.krakow.pl> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231208134838.49500-1-jankul@alatek.krakow.pl> References: <20231208134838.49500-1-jankul@alatek.krakow.pl> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 08 Dec 2023 05:50:28 -0800 (PST) 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 | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/dma/xilinx/xdma-regs.h b/drivers/dma/xilinx/xdma-reg= s.h index b12dd60629f6..2a224e3da672 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; }; -#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 /* * Channel registers diff --git a/drivers/dma/xilinx/xdma.c b/drivers/dma/xilinx/xdma.c index ddb9e7d07461..1bce48e5d86c 100644 --- a/drivers/dma/xilinx/xdma.c +++ b/drivers/dma/xilinx/xdma.c @@ -741,9 +741,9 @@ static int xdma_alloc_chan_resources(struct dma_chan = *chan) return -EINVAL; } - 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; -- 2.34.1