Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1939170ybb; Thu, 2 Apr 2020 10:04:15 -0700 (PDT) X-Google-Smtp-Source: APiQypLyMQNr1+shAFpPEJi3pmMbH83X256wvSJ2JI/do9YeM8QdQbCCbr78XgZtJDHlXInispyP X-Received: by 2002:a9d:7452:: with SMTP id p18mr3045630otk.122.1585847055139; Thu, 02 Apr 2020 10:04:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585847055; cv=none; d=google.com; s=arc-20160816; b=dK2j9no1VLpxhkTwXl+3MDyPKVxLrXHDAT9tOzAMbsqUFOkA0nVQiz3U1Lcw5QSXQA FMNyevJkHiBSnLVVrI5+wG9HAEJDLof6uWAJrqqImwygk+6G+bcFK5F9e5qtcMWFKH5k LUZsdC6QvBM8I7RUd4k1FI7W/LUiV59KJTtubdGh/u+/BJU8iD5KymXyhDyooOizs5vk 41Qp3iR2Q75rh1rcDSzhU9+kP09TFRke8/9g2pkQbv89xbzTwf0TyRCZk9krtQivasyl iUJdMO5LVkXjoYwbTpVJnROWXV77V0fpUaqPTtKh7bNUuUkbKej2BrDl1CCH+3uTOc4q M1TA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=nkri6AUC+cBObLD6lQuVbUkVwceemOCxjXIA5O1O0Ek=; b=P4dwMxWQOudAFL+Xm7gsNFOMQ99tlknw/3yGu1v2c1/md6xHvjwlwlHbqxryZZq69G DXBvlZBaGSI9DxTyl3gYMhdqEBAMYcHa4ok3sbmfgFfvBMzv/M5GQ3qajJG3mqLXMsDl 9eEXumDby3JZlX5Pg7Emg6mAZwRo74ryOFr/XDT5j15HxR1vUDR0GaoP1meeSvY02y5Y Fdp9giNITXZ8AowQckkPOvN6Ha4QtaFuUFyy1HX9dXhpB1BdFLSdqK4wy8p9PZaDjgu/ B81LJXm+tiCkm73hKsDD9o3rLBF/d1jBHaTVFDqx9s/uwsctfXjzV85yuMId/QRweeEX 7PGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dell.com header.s=smtpout1 header.b=uXNycPUD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=dell.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z25si2496046otp.310.2020.04.02.10.03.55; Thu, 02 Apr 2020 10:04:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@dell.com header.s=smtpout1 header.b=uXNycPUD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=dell.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388721AbgDBQfI (ORCPT + 99 others); Thu, 2 Apr 2020 12:35:08 -0400 Received: from mx0b-00154904.pphosted.com ([148.163.137.20]:39358 "EHLO mx0b-00154904.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732404AbgDBQfH (ORCPT ); Thu, 2 Apr 2020 12:35:07 -0400 Received: from pps.filterd (m0170397.ppops.net [127.0.0.1]) by mx0b-00154904.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 032GADoT029884; Thu, 2 Apr 2020 12:34:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=smtpout1; bh=nkri6AUC+cBObLD6lQuVbUkVwceemOCxjXIA5O1O0Ek=; b=uXNycPUDfhZjPHOL5abDizq7190of0u/afTzfYJZqU7whCFpBgcNjQY/s6jquhCa7n+X +GsShpwa7MB6scC/JwerlwhGLcq9cSD5cAwp0XF7Ki8pjpamce9Ul0qUDuwkr9bc4w+j rKFIFJ3uHWjMOmpYVXathZzdMFWDs7DauQLldI5MZtsJ8soHUl6fXb/OkwGSqVN5FhzA A/Fnic5jeOhvpk+WoLIz822NGT45fevNwQJgSaZIEIUBTOR2QmDRTF6yTUWpGHfVV9PK iQLNgkA8V0BAMwNgxi83EPZMhEZ2SoAINbj9+H8q1GD886+Q7ptZ2pVNv/vwELQ1LVw+ cQ== Received: from mx0b-00154901.pphosted.com (mx0b-00154901.pphosted.com [67.231.157.37]) by mx0b-00154904.pphosted.com with ESMTP id 301ynv5f70-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 02 Apr 2020 12:34:50 -0400 Received: from pps.filterd (m0134318.ppops.net [127.0.0.1]) by mx0a-00154901.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 032GLgh5106141; Thu, 2 Apr 2020 12:34:49 -0400 Received: from mailuogwhop.emc.com (mailuogwhop-nat.lss.emc.com [168.159.213.141] (may be forged)) by mx0a-00154901.pphosted.com with ESMTP id 30217h58fr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 02 Apr 2020 12:34:49 -0400 Received: from emc.com (localhost [127.0.0.1]) by mailuogwprd04.lss.emc.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.0) with ESMTP id 032GYnOU008886; Thu, 2 Apr 2020 12:34:49 -0400 Received: from mailsyshubprd06.lss.emc.com ([mailsyshubprd06.lss.emc.com [10.253.24.24]]) by mailuogwprd04.lss.emc.com with ESMTP id 032GYVwC008725 ; Thu, 2 Apr 2020 12:34:31 -0400 Received: from arwen2.xiolab.lab.emc.com. (arwen2.xiolab.lab.emc.com [10.76.211.113]) by mailsyshubprd06.lss.emc.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.0) with ESMTP id 032GYR3f030730; Thu, 2 Apr 2020 12:34:27 -0400 From: leonid.ravich@dell.com To: dmaengine@vger.kernel.org Cc: lravich@gmail.com, Leonid Ravich , Vinod Koul , Dan Williams , Dave Jiang , Greg Kroah-Hartman , Alexios Zavras , "Alexander.Barabash@dell.com" , Thomas Gleixner , Kate Stewart , Jilayne Lovejoy , Logan Gunthorpe , linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] dmaengine: ioat: fixing chunk sizing macros dependency Date: Thu, 2 Apr 2020 19:33:42 +0300 Message-Id: <20200402163356.9029-1-leonid.ravich@dell.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20200402092725.15121-2-leonid.ravich@dell.com> References: <20200402092725.15121-2-leonid.ravich@dell.com> X-Sentrion-Hostname: mailuogwprd04.lss.emc.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.676 definitions=2020-04-02_06:2020-04-02,2020-04-02 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=38 adultscore=0 lowpriorityscore=0 impostorscore=0 clxscore=1015 phishscore=0 spamscore=0 mlxlogscore=683 bulkscore=0 mlxscore=0 priorityscore=1501 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004020131 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 suspectscore=38 clxscore=1015 bulkscore=0 spamscore=0 phishscore=0 adultscore=0 mlxlogscore=758 lowpriorityscore=0 mlxscore=0 priorityscore=1501 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004020131 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Leonid Ravich prepare for changing alloc size. Acked-by: Dave Jiang Signed-off-by: Leonid Ravich --- drivers/dma/ioat/dma.c | 14 ++++++++------ drivers/dma/ioat/dma.h | 10 ++++++---- drivers/dma/ioat/init.c | 2 +- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c index 18c011e..1e0e6c1 100644 --- a/drivers/dma/ioat/dma.c +++ b/drivers/dma/ioat/dma.c @@ -332,8 +332,8 @@ static dma_cookie_t ioat_tx_submit_unlock(struct dma_async_tx_descriptor *tx) u8 *pos; off_t offs; - chunk = idx / IOAT_DESCS_PER_2M; - idx &= (IOAT_DESCS_PER_2M - 1); + chunk = idx / IOAT_DESCS_PER_CHUNK; + idx &= (IOAT_DESCS_PER_CHUNK - 1); offs = idx * IOAT_DESC_SZ; pos = (u8 *)ioat_chan->descs[chunk].virt + offs; phys = ioat_chan->descs[chunk].hw + offs; @@ -370,7 +370,8 @@ struct ioat_ring_ent ** if (!ring) return NULL; - ioat_chan->desc_chunks = chunks = (total_descs * IOAT_DESC_SZ) / SZ_2M; + chunks = (total_descs * IOAT_DESC_SZ) / IOAT_CHUNK_SIZE; + ioat_chan->desc_chunks = chunks; for (i = 0; i < chunks; i++) { struct ioat_descs *descs = &ioat_chan->descs[i]; @@ -382,8 +383,9 @@ struct ioat_ring_ent ** for (idx = 0; idx < i; idx++) { descs = &ioat_chan->descs[idx]; - dma_free_coherent(to_dev(ioat_chan), SZ_2M, - descs->virt, descs->hw); + dma_free_coherent(to_dev(ioat_chan), + IOAT_CHUNK_SIZE, + descs->virt, descs->hw); descs->virt = NULL; descs->hw = 0; } @@ -404,7 +406,7 @@ struct ioat_ring_ent ** for (idx = 0; idx < ioat_chan->desc_chunks; idx++) { dma_free_coherent(to_dev(ioat_chan), - SZ_2M, + IOAT_CHUNK_SIZE, ioat_chan->descs[idx].virt, ioat_chan->descs[idx].hw); ioat_chan->descs[idx].virt = NULL; diff --git a/drivers/dma/ioat/dma.h b/drivers/dma/ioat/dma.h index b8e8e0b..5216c6b 100644 --- a/drivers/dma/ioat/dma.h +++ b/drivers/dma/ioat/dma.h @@ -81,6 +81,11 @@ struct ioatdma_device { u32 msixpba; }; +#define IOAT_MAX_ORDER 16 +#define IOAT_MAX_DESCS (1 << IOAT_MAX_ORDER) +#define IOAT_CHUNK_SIZE (SZ_2M) +#define IOAT_DESCS_PER_CHUNK (IOAT_CHUNK_SIZE / IOAT_DESC_SZ) + struct ioat_descs { void *virt; dma_addr_t hw; @@ -128,7 +133,7 @@ struct ioatdma_chan { u16 produce; struct ioat_ring_ent **ring; spinlock_t prep_lock; - struct ioat_descs descs[2]; + struct ioat_descs descs[IOAT_MAX_DESCS / IOAT_DESCS_PER_CHUNK]; int desc_chunks; int intr_coalesce; int prev_intr_coalesce; @@ -301,9 +306,6 @@ static inline bool is_ioat_bug(unsigned long err) return !!err; } -#define IOAT_MAX_ORDER 16 -#define IOAT_MAX_DESCS 65536 -#define IOAT_DESCS_PER_2M 32768 static inline u32 ioat_ring_size(struct ioatdma_chan *ioat_chan) { diff --git a/drivers/dma/ioat/init.c b/drivers/dma/ioat/init.c index 60e9afb..58d1356 100644 --- a/drivers/dma/ioat/init.c +++ b/drivers/dma/ioat/init.c @@ -651,7 +651,7 @@ static void ioat_free_chan_resources(struct dma_chan *c) } for (i = 0; i < ioat_chan->desc_chunks; i++) { - dma_free_coherent(to_dev(ioat_chan), SZ_2M, + dma_free_coherent(to_dev(ioat_chan), IOAT_CHUNK_SIZE, ioat_chan->descs[i].virt, ioat_chan->descs[i].hw); ioat_chan->descs[i].virt = NULL; -- 1.9.3