From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F8D6C4321D for ; Mon, 20 Aug 2018 22:34:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2DAB8208CA for ; Mon, 20 Aug 2018 22:34:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="ZCBm7EzP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2DAB8208CA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=synopsys.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726801AbeHUBwK (ORCPT ); Mon, 20 Aug 2018 21:52:10 -0400 Received: from smtprelay.synopsys.com ([198.182.60.111]:37144 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726498AbeHUBwK (ORCPT ); Mon, 20 Aug 2018 21:52:10 -0400 Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id A2B7E10C06C0; Mon, 20 Aug 2018 15:34:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1534804482; bh=6nXsl+J+r/RXRq1mGK4l5UvNLDaxcLofBbHOVl6nHIQ=; h=Subject:To:CC:References:From:Date:In-Reply-To:From; b=ZCBm7EzPOmL0tCE7c0r5iz8gecoeqJvd6+/GFlQMm5yE71Wu07poW91D+z+mOVHE4 8bpakoPWfiazxOeI+w0Cy7Kur6kz3YFYWgbg4j95PkBGsGR7+zqtvV5NT4izyQeW3x gD5TegSSF3BqEPO1Awkwp2lBgkgSteTupRbS8B7MvcgEaWyj4/13UbTQNjFPIsPVmx Q7iafDHShvENUSGKPfD43QUPfcks92DKyF1LM68l3B7QECWviBBEuu0k821KpvVqOj vNmhma3nL9ProZGcXLhAxtBbGM+deCfR/K47d6KoQAI8PL1RUPIEASxlVjwwoHsncJ 1m+Robw+bK/fQ== Received: from US01WEHTC2.internal.synopsys.com (us01wehtc2-vip.internal.synopsys.com [10.12.239.238]) by mailhost.synopsys.com (Postfix) with ESMTP id 56FE93705; Mon, 20 Aug 2018 15:34:41 -0700 (PDT) Received: from IN01WEHTCB.internal.synopsys.com (10.144.199.106) by US01WEHTC2.internal.synopsys.com (10.12.239.237) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 20 Aug 2018 15:34:40 -0700 Received: from IN01WEHTCA.internal.synopsys.com (10.144.199.103) by IN01WEHTCB.internal.synopsys.com (10.144.199.105) with Microsoft SMTP Server (TLS) id 14.3.361.1; Tue, 21 Aug 2018 04:04:38 +0530 Received: from [10.10.161.98] (10.10.161.98) by IN01WEHTCA.internal.synopsys.com (10.144.199.243) with Microsoft SMTP Server (TLS) id 14.3.361.1; Tue, 21 Aug 2018 04:04:37 +0530 Subject: Re: [PATCH v2 2/4] ARC: allow to use IOC and non-IOC DMA devices simultaneously To: Eugeniy Paltsev , "linux-snps-arc@lists.infradead.org" CC: "hch@lst.de" , "linux-kernel@vger.kernel.org" , "linux-arch@vger.kernel.org" , Alexey Brodkin Newsgroups: gmane.linux.kernel,gmane.linux.kernel.arc,gmane.linux.kernel.cross-arch References: <20180730162636.3556-1-Eugeniy.Paltsev@synopsys.com> <20180730162636.3556-3-Eugeniy.Paltsev@synopsys.com> <1534180089.3962.68.camel@synopsys.com> From: Vineet Gupta Openpgp: preference=signencrypt Autocrypt: addr=vgupta@synopsys.com; keydata= xsFNBFEffBMBEADIXSn0fEQcM8GPYFZyvBrY8456hGplRnLLFimPi/BBGFA24IR+B/Vh/EFk B5LAyKuPEEbR3WSVB1x7TovwEErPWKmhHFbyugdCKDv7qWVj7pOB+vqycTG3i16eixB69row lDkZ2RQyy1i/wOtHt8Kr69V9aMOIVIlBNjx5vNOjxfOLux3C0SRl1veA8sdkoSACY3McOqJ8 zR8q1mZDRHCfz+aNxgmVIVFN2JY29zBNOeCzNL1b6ndjU73whH/1hd9YMx2Sp149T8MBpkuQ cFYUPYm8Mn0dQ5PHAide+D3iKCHMupX0ux1Y6g7Ym9jhVtxq3OdUI5I5vsED7NgV9c8++baM 7j7ext5v0l8UeulHfj4LglTaJIvwbUrCGgtyS9haKlUHbmey/af1j0sTrGxZs1ky1cTX7yeF nSYs12GRiVZkh/Pf3nRLkjV+kH++ZtR1GZLqwamiYZhAHjo1Vzyl50JT9EuX07/XTyq/Bx6E dcJWr79ZphJ+mR2HrMdvZo3VSpXEgjROpYlD4GKUApFxW6RrZkvMzuR2bqi48FThXKhFXJBd JiTfiO8tpXaHg/yh/V9vNQqdu7KmZIuZ0EdeZHoXe+8lxoNyQPcPSj7LcmE6gONJR8ZqAzyk F5voeRIy005ZmJJ3VOH3Gw6Gz49LVy7Kz72yo1IPHZJNpSV5xwARAQABzS1WaW5lZXQgR3Vw dGEgKHBlcnNvbmFsKSA8dmluZWV0Zzc2QGdtYWlsLmNvbT7CwX4EEwECACgCGwMGCwkIBwMC BhUIAgkKCwQWAgMBAh4BAheABQJbBYpwBQkLx0HcAAoJEGnX8d3iisJe9TAP/3ljkSlRwToH O0E9QimJJqF52uZ0phSg1ZoavgHhGtz1mRykgeOzOITpFmYGBnf3v2Z33fDltIxTaN5TkRwl DjYvz1NTBlTLyPRbYwdCn6YyVSWj75hiGw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2bR8hjBny83ONRf2O9nJuEYw9vZAPFViPwWG8tZ 7J+ReuXKai4DDr+8oFOi/40mIDe/Bat3ftyd+94Z1RxDCngd3Q85bw13t2ttNLw5eHufLIpo EyAhTCLNQ58eT91YGVGvFs39IuH0b8ovVvdkKGInCT59Vr0MtfgcsqpDxWQXJXYZYTFHd3/R swARAQABwsFlBBgBAgAPAhsMBQJbBYpwBQkLx0HdAAoJEGnX8d3iisJewe8P/36pkZrVTfO+ U+Gl1OQh4m6weozuI8Y98/DHLMxEujKAmRzy+zMHYlIl3WgSih1UMOZ7U84yVZQwXQkLItcw XoihChKD5D2BKnZYEOLM+7f9DuJuWhXpee80aNPzEaubBYQ7dYt8rcmB7SdRz/yZq3lALOrF /zb6SRleBh0DiBLP/jKUV74UAYV3OYEDHN9blvhWUEFFE0Z+j96M4/kuRdxvbDmp04Nfx79A mJEnfv1Vvc9CFiWVbBrNPKomIN+JV7a7m2lhbfhlLpUk0zGFDTWcWejl4qz/pCYSoIUU4r/V BsCVZrOun4vd4cSi/yYJRY4kaAJGCL5k7qhflL2tgldUs+wERH8ZCzimWVDBzHTBojz0Ff3w 2+gY6FUbAJBrBZANkymPpdAB/lTsl8D2ZRWyy90f4VVc8LB/QIWY/GiS2towRXQBjHOfkUB1 JiEXYH/i93k71mCaKfzKGXTVxObU2I441w7r4vtNlu0sADRHCMUqHmkpkjV1YbnYPvBPFrDB S1V9OfD9SutXeDjJYe3N+WaLRp3T3x7fYVnkfjQIjDSOdyPWlTzqQv0I3YlUk7KjFrh1rxtr poYSIQKf5HuMowUNtjyiK2VhA5V2XDqd+ZUT3RqfAPf3Y5HjkhKJRqoIDggUKMUKmXaxCkPG i91ThhqBJlyU6MVUa6vZNv8E Message-ID: <81ddd506-1f7e-db82-4c77-ff08b1c15dd3@synopsys.com> Date: Mon, 20 Aug 2018 15:34:31 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1534180089.3962.68.camel@synopsys.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.10.161.98] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/13/2018 10:08 AM, Eugeniy Paltsev wrote: > On Mon, 2018-08-13 at 16:24 +0000, Vineet Gupta wrote: >> On 07/30/2018 09:26 AM, Eugeniy Paltsev wrote: >>> @@ -1263,11 +1254,7 @@ void __init arc_cache_init_master(void) >>> if (is_isa_arcv2() && ioc_enable) >>> arc_ioc_setup(); >>> >>> - if (is_isa_arcv2() && ioc_enable) { >>> - __dma_cache_wback_inv = __dma_cache_wback_inv_ioc; >>> - __dma_cache_inv = __dma_cache_inv_ioc; >>> - __dma_cache_wback = __dma_cache_wback_ioc; >>> - } else if (is_isa_arcv2() && l2_line_sz && slc_enable) { For the casual reader I'd add a comment why this was deleted. >>> + if (is_isa_arcv2() && l2_line_sz && slc_enable) { >>> __dma_cache_wback_inv = __dma_cache_wback_inv_slc; >>> __dma_cache_inv = __dma_cache_inv_slc; >>> __dma_cache_wback = __dma_cache_wback_slc; [snip] >>> >>> - /* >>> - * IOC relies on all data (even coherent DMA data) being in cache >>> - * Thus allocate normal cached memory >>> - * >>> - * The gains with IOC are two pronged: >>> - * -For streaming data, elides need for cache maintenance, saving >>> - * cycles in flush code, and bus bandwidth as all the lines of a >>> - * buffer need to be flushed out to memory >>> - * -For coherent data, Read/Write to buffers terminate early in cache >>> - * (vs. always going to memory - thus are faster) >>> - */ >>> - if ((is_isa_arcv2() && ioc_enable) || >>> - (attrs & DMA_ATTR_NON_CONSISTENT)) >>> + if (attrs & DMA_ATTR_NON_CONSISTENT) >>> need_coh = 0; >>> [snip] > Yep, I tested that. > And it works fine with both @ioc_enable == 0 and @ioc_enable == 1 > Note that we check this variable in arch_setup_dma_ops() function now. > > So this arch_dma_{alloc,free} are used ONLY in case of software assisted cache maintenance. > That's why we had to do MMU mapping to enforce non-cachability regardless of @ioc_enable. Reading kernel/dma/* I see what you mean. We check @ioc_enable at the time of registering the dma op for coherent vs. non coherent case, so there's common vs. ARC versions of alloc/free for coherent vs. noncoherent. But then I'm curious why do we bother to check the following in new arch_dma_(alloc|free) at all. if (attrs & DMA_ATTR_NON_CONSISTENT) Isn't it supposed to be NON_CONSISTENT always given the way new code works ? From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vineet Gupta Subject: Re: [PATCH v2 2/4] ARC: allow to use IOC and non-IOC DMA devices simultaneously Date: Mon, 20 Aug 2018 15:34:31 -0700 Message-ID: <81ddd506-1f7e-db82-4c77-ff08b1c15dd3@synopsys.com> References: <20180730162636.3556-1-Eugeniy.Paltsev@synopsys.com> <20180730162636.3556-3-Eugeniy.Paltsev@synopsys.com> <1534180089.3962.68.camel@synopsys.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1534180089.3962.68.camel@synopsys.com> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org To: Eugeniy Paltsev , "linux-snps-arc@lists.infradead.org" Cc: "hch@lst.de" , "linux-kernel@vger.kernel.org" , "linux-arch@vger.kernel.org" , Alexey Brodkin List-Id: linux-arch.vger.kernel.org On 08/13/2018 10:08 AM, Eugeniy Paltsev wrote: > On Mon, 2018-08-13 at 16:24 +0000, Vineet Gupta wrote: >> On 07/30/2018 09:26 AM, Eugeniy Paltsev wrote: >>> @@ -1263,11 +1254,7 @@ void __init arc_cache_init_master(void) >>> if (is_isa_arcv2() && ioc_enable) >>> arc_ioc_setup(); >>> >>> - if (is_isa_arcv2() && ioc_enable) { >>> - __dma_cache_wback_inv = __dma_cache_wback_inv_ioc; >>> - __dma_cache_inv = __dma_cache_inv_ioc; >>> - __dma_cache_wback = __dma_cache_wback_ioc; >>> - } else if (is_isa_arcv2() && l2_line_sz && slc_enable) { For the casual reader I'd add a comment why this was deleted. >>> + if (is_isa_arcv2() && l2_line_sz && slc_enable) { >>> __dma_cache_wback_inv = __dma_cache_wback_inv_slc; >>> __dma_cache_inv = __dma_cache_inv_slc; >>> __dma_cache_wback = __dma_cache_wback_slc; [snip] >>> >>> - /* >>> - * IOC relies on all data (even coherent DMA data) being in cache >>> - * Thus allocate normal cached memory >>> - * >>> - * The gains with IOC are two pronged: >>> - * -For streaming data, elides need for cache maintenance, saving >>> - * cycles in flush code, and bus bandwidth as all the lines of a >>> - * buffer need to be flushed out to memory >>> - * -For coherent data, Read/Write to buffers terminate early in cache >>> - * (vs. always going to memory - thus are faster) >>> - */ >>> - if ((is_isa_arcv2() && ioc_enable) || >>> - (attrs & DMA_ATTR_NON_CONSISTENT)) >>> + if (attrs & DMA_ATTR_NON_CONSISTENT) >>> need_coh = 0; >>> [snip] > Yep, I tested that. > And it works fine with both @ioc_enable == 0 and @ioc_enable == 1 > Note that we check this variable in arch_setup_dma_ops() function now. > > So this arch_dma_{alloc,free} are used ONLY in case of software assisted cache maintenance. > That's why we had to do MMU mapping to enforce non-cachability regardless of @ioc_enable. Reading kernel/dma/* I see what you mean. We check @ioc_enable at the time of registering the dma op for coherent vs. non coherent case, so there's common vs. ARC versions of alloc/free for coherent vs. noncoherent. But then I'm curious why do we bother to check the following in new arch_dma_(alloc|free) at all. if (attrs & DMA_ATTR_NON_CONSISTENT) Isn't it supposed to be NON_CONSISTENT always given the way new code works ? From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vineet.Gupta1@synopsys.com (Vineet Gupta) Date: Mon, 20 Aug 2018 15:34:31 -0700 Subject: [PATCH v2 2/4] ARC: allow to use IOC and non-IOC DMA devices simultaneously In-Reply-To: <1534180089.3962.68.camel@synopsys.com> References: <20180730162636.3556-1-Eugeniy.Paltsev@synopsys.com> <20180730162636.3556-3-Eugeniy.Paltsev@synopsys.com> <1534180089.3962.68.camel@synopsys.com> List-ID: Message-ID: <81ddd506-1f7e-db82-4c77-ff08b1c15dd3@synopsys.com> To: linux-snps-arc@lists.infradead.org On 08/13/2018 10:08 AM, Eugeniy Paltsev wrote: > On Mon, 2018-08-13@16:24 +0000, Vineet Gupta wrote: >> On 07/30/2018 09:26 AM, Eugeniy Paltsev wrote: >>> @@ -1263,11 +1254,7 @@ void __init arc_cache_init_master(void) >>> if (is_isa_arcv2() && ioc_enable) >>> arc_ioc_setup(); >>> >>> - if (is_isa_arcv2() && ioc_enable) { >>> - __dma_cache_wback_inv = __dma_cache_wback_inv_ioc; >>> - __dma_cache_inv = __dma_cache_inv_ioc; >>> - __dma_cache_wback = __dma_cache_wback_ioc; >>> - } else if (is_isa_arcv2() && l2_line_sz && slc_enable) { For the casual reader I'd add a comment why this was deleted. >>> + if (is_isa_arcv2() && l2_line_sz && slc_enable) { >>> __dma_cache_wback_inv = __dma_cache_wback_inv_slc; >>> __dma_cache_inv = __dma_cache_inv_slc; >>> __dma_cache_wback = __dma_cache_wback_slc; [snip] >>> >>> - /* >>> - * IOC relies on all data (even coherent DMA data) being in cache >>> - * Thus allocate normal cached memory >>> - * >>> - * The gains with IOC are two pronged: >>> - * -For streaming data, elides need for cache maintenance, saving >>> - * cycles in flush code, and bus bandwidth as all the lines of a >>> - * buffer need to be flushed out to memory >>> - * -For coherent data, Read/Write to buffers terminate early in cache >>> - * (vs. always going to memory - thus are faster) >>> - */ >>> - if ((is_isa_arcv2() && ioc_enable) || >>> - (attrs & DMA_ATTR_NON_CONSISTENT)) >>> + if (attrs & DMA_ATTR_NON_CONSISTENT) >>> need_coh = 0; >>> [snip] > Yep, I tested that. > And it works fine with both @ioc_enable == 0 and @ioc_enable == 1 > Note that we check this variable in arch_setup_dma_ops() function now. > > So this arch_dma_{alloc,free} are used ONLY in case of software assisted cache maintenance. > That's why we had to do MMU mapping to enforce non-cachability regardless of @ioc_enable. Reading kernel/dma/* I see what you mean. We check @ioc_enable at the time of registering the dma op for coherent vs. non coherent case, so there's common vs. ARC versions of alloc/free for coherent vs. noncoherent. But then I'm curious why do we bother to check the following in new arch_dma_(alloc|free) at all. if (attrs & DMA_ATTR_NON_CONSISTENT) Isn't it supposed to be NON_CONSISTENT always given the way new code works ?