Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1996364ybb; Thu, 2 Apr 2020 11:07:18 -0700 (PDT) X-Google-Smtp-Source: APiQypI7KI8PHoikOjbXwWiZW1PDpOx1X08QmZXN68GguySERXZzf2x/zFXauRHWmC2TxBdg6oui X-Received: by 2002:a9d:8f3:: with SMTP id 106mr3389491otf.328.1585850838255; Thu, 02 Apr 2020 11:07:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585850838; cv=none; d=google.com; s=arc-20160816; b=CZlvm2DtXjZ2muOfqdaXJmEOM+YFd4d7FTiQ9TNJaee1g16oxmbY1dzrxnUoro6++V 6ZglBA5sBbh3mG0VysL8m2xJLdbgwy3EiL8T0L524RGhBn0gzSU96nzlIzHdn+a4+d6q kJBrKiPc7YNH9qRwd5feyfUE2hpM/aRUQv0J2NaqfwD805UuyBxjUM0Ig7CW6bcLNUgj jRd6VPXfymeMf3zQmrGK4akw6b1msDTvJhRnnZqmUYQHQfIWooQtHh0ffsVKtQADGtBj deE0lx00lYiHctQOzcPvnVwFrP3WIrjz51HFhG/qH38B0uMzQn7Oql1NeLTUp/G+C33n 6Uqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:ironport-sdr:ironport-sdr; bh=F6YHF78Sua5qS1p+SgtYpbBW3QO6WiHUN+NYBwUTA3E=; b=Lvotzx/vzIQer7IwUOh72Xvf++CoVwonjm6a3ObmYRpeuTGm42TO+r2+o2F1ySa5Ls 2+q2jWpFGs4EU90nDbz0yTZ86uOs92bmQ5etWx8XW/Y1/5UaW0mXj0Kl+Eik5u/4kLQX TLLxfs146gHaXipYcF1CuOK1z6y33aqkGKPnjlXXmTM9ANd2t3dFXsRjgOmjaS7dGbYJ s5qFmPI7rTEhE0apwx+dSCfwTNFA/MlSkSPuHm9soqGrFR1mIZbweWwH1CAozz3key4U bFUEuScab76QVaQ1A3UFzEXckZ0BtqGSzhRW82cBZ0FIcZ8yejw2zPNr3b2w8PE5XYAM XkpQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w79si2636486oif.21.2020.04.02.11.07.05; Thu, 02 Apr 2020 11:07:18 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389471AbgDBQtW (ORCPT + 99 others); Thu, 2 Apr 2020 12:49:22 -0400 Received: from mga01.intel.com ([192.55.52.88]:28778 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727412AbgDBQtW (ORCPT ); Thu, 2 Apr 2020 12:49:22 -0400 IronPort-SDR: eIVr02pNlmMzNSQ6in7g0BMWEXHV61UMjus8zwZxzAYnrnuj+YadakHeMqzpnWxv3+V0onMW0l fv/ZVAeNNYRg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Apr 2020 09:49:21 -0700 IronPort-SDR: PObNNV+joiE4Hjh+BJV7W7tWW6WiyLxup8D33nqlwf8vo1IUHkxPMzfc9Kv21jRJQBh+ptXRWa s6GXdk098uOA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,336,1580803200"; d="scan'208";a="284841870" Received: from djiang5-mobl1.amr.corp.intel.com (HELO [10.134.85.228]) ([10.134.85.228]) by fmsmga002.fm.intel.com with ESMTP; 02 Apr 2020 09:49:19 -0700 Subject: Re: [PATCH v2 1/2] dmaengine: ioat: fixing chunk sizing macros dependency To: "Ravich, Leonid" , "dmaengine@vger.kernel.org" Cc: "lravich@gmail.com" , Vinod Koul , "Williams, Dan J" , Greg Kroah-Hartman , "Zavras, Alexios" , "Barabash, Alexander" , Thomas Gleixner , Kate Stewart , Jilayne Lovejoy , Logan Gunthorpe , "linux-kernel@vger.kernel.org" References: <20200402092725.15121-2-leonid.ravich@dell.com> <20200402163356.9029-1-leonid.ravich@dell.com> From: Dave Jiang Message-ID: Date: Thu, 2 Apr 2020 09:49:19 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/2/2020 9:46 AM, Ravich, Leonid wrote: > Sorry Dave , > sure was tested on Intel Sky Lake-E CBDMA Thanks Leonid. Acked. > > -----Original Message----- > From: Dave Jiang > Sent: Thursday, April 2, 2020 7:43 PM > To: Ravich, Leonid; dmaengine@vger.kernel.org > Cc: lravich@gmail.com; Vinod Koul; Williams, Dan J; Greg Kroah-Hartman; Zavras, Alexios; Barabash, Alexander; Thomas Gleixner; Kate Stewart; Jilayne Lovejoy; Logan Gunthorpe; linux-kernel@vger.kernel.org > Subject: Re: [PATCH v2 1/2] dmaengine: ioat: fixing chunk sizing macros dependency > > > [EXTERNAL EMAIL] > > > > On 4/2/2020 9:33 AM, leonid.ravich@dell.com wrote: >> From: Leonid Ravich >> >> prepare for changing alloc size. >> >> Acked-by: Dave Jiang >> Signed-off-by: Leonid Ravich > > Hi Leonid, I haven't actually acked this patch yet, pending your answer on if this has been tested on hardware. Thanks. > >> --- >> 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; >>