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=-3.7 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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 31B04C3A5A3 for ; Tue, 27 Aug 2019 09:04:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0134B217F5 for ; Tue, 27 Aug 2019 09:04:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nifty.com header.i=@nifty.com header.b="FEJO9C78" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728891AbfH0JEL (ORCPT ); Tue, 27 Aug 2019 05:04:11 -0400 Received: from conssluserg-04.nifty.com ([210.131.2.83]:63086 "EHLO conssluserg-04.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725805AbfH0JEK (ORCPT ); Tue, 27 Aug 2019 05:04:10 -0400 Received: from mail-vs1-f42.google.com (mail-vs1-f42.google.com [209.85.217.42]) (authenticated) by conssluserg-04.nifty.com with ESMTP id x7R93pZ7014817; Tue, 27 Aug 2019 18:03:52 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-04.nifty.com x7R93pZ7014817 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1566896632; bh=9QFLgDLrDq6oYc9M2pjMIY7wPViunYCOH8ybzE+CYKY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=FEJO9C78f6r58lBL+oGJOTJPxQoEb2F5p+8zzLKT0aTGj9HnOH4wJZVO7i4XZ0lrD JRaPKKWvcXsmkwHjPM/DC2pmwp6QBq7gDAmbILjLCjSDfTAmzpxI18l4qqL/9MM1QI OiW+casOVnjgaTJgg1MrMs/Zcc2ogoWZAiwnNaodtf06YkWFxWxTc4qTTqDJa1Xvat Rj4ih6nduKisiJwSs13yNxmV7fiRExk2+Nmcqx0BGve6cl7RqKiflQILfKi43Q6Cyn nCnpIRLy2Jlp05lHYh8OR+eckJYKfIMmJbAHTZeExVX6xDHePofUOhPK2vaX5e22WV IvohYpkXZw8zw== X-Nifty-SrcIP: [209.85.217.42] Received: by mail-vs1-f42.google.com with SMTP id 62so12936983vsl.5; Tue, 27 Aug 2019 02:03:52 -0700 (PDT) X-Gm-Message-State: APjAAAW/Rwe792cSkCLetbjB5wNfFtpFXg88jCfIn7NG+XlBfaCR5/2y h8EYU/nbVjxCSEdivMZzFIYxsPNy4ElOql0htGk= X-Google-Smtp-Source: APXvYqwricK86V/H4mlXnBje+CLjj05rUISZsABUzE/wYSQ2E+9R0KKypcnkK7mnt6KPt7U5OLwH2hsMH6JJJTu7VOI= X-Received: by 2002:a67:fe12:: with SMTP id l18mr12998082vsr.54.1566896631370; Tue, 27 Aug 2019 02:03:51 -0700 (PDT) MIME-Version: 1.0 References: <20190506223334.1834-1-nicoleotsuka@gmail.com> <20190506223334.1834-3-nicoleotsuka@gmail.com> <20190825011025.GA23410@lst.de> <20190826073320.GA11712@lst.de> <20190827075021.GA953@lst.de> In-Reply-To: <20190827075021.GA953@lst.de> From: Masahiro Yamada Date: Tue, 27 Aug 2019 18:03:14 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 2/2] dma-contiguous: Use fallback alloc_pages for single pages To: Christoph Hellwig Cc: Nicolin Chen , linux-mmc , Ulf Hansson , Adrian Hunter , Robin Murphy , Marek Szyprowski , vdumpa@nvidia.com, Russell King , Catalin Marinas , Will Deacon , Chris Zankel , Max Filippov , Joerg Roedel , David Woodhouse , Tony Lindgren , Andrew Morton , Stephen Rothwell , Thierry Reding , Kees Cook , iamjoonsoo.kim@lge.com, Wolfram Sang , linux-arm-kernel , Linux Kernel Mailing List , linux-xtensa@linux-xtensa.org, iommu@lists.linux-foundation.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 27, 2019 at 4:50 PM Christoph Hellwig wrote: > > On Tue, Aug 27, 2019 at 04:45:20PM +0900, Masahiro Yamada wrote: > > On Mon, Aug 26, 2019 at 4:33 PM Christoph Hellwig wrote: > > > > > > On Mon, Aug 26, 2019 at 11:05:00AM +0900, Masahiro Yamada wrote: > > > > This is included in v5.3-rc6 > > > > so I tested it. > > > > > > So there is no allocation failure, but you get I/O errors later? > > > > Right. > > > > > > > > Does the device use a device-private CMA area? > > > > Not sure. > > My driver is drivers/mmc/host/sdhci-cadence.c > > It reuses routines in drivers/mmc/host/sdhci.c > > > > > > > > > Does it work with Linux > > > 5.2 if CONFIG_DMA_CMA is disabled? > > > > No. > > 5.2 + disable CONFIG_DMA_CMA > > failed in the same way. > > So it seems like the device wants CMA memory. I guess the patch > below will fix it, but that isn't the solution. Can you try it > to confirm? In the end it probably assumes a dma mask it doesn't > set that the CMA memory satisfies or something similar. Thanks for the pointer. > diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c > index 69cfb4345388..bd2f24aa7f19 100644 > --- a/kernel/dma/contiguous.c > +++ b/kernel/dma/contiguous.c > @@ -236,7 +236,7 @@ struct page *dma_alloc_contiguous(struct device *dev, size_t size, gfp_t gfp) > > if (dev && dev->cma_area) > cma = dev->cma_area; > - else if (count > 1) > + else > cma = dma_contiguous_default_area; > > /* CMA can be used only in the context which permits sleeping */ Yes, this makes my driver working again when CONFIG_DMA_CMA=y. If I apply the following, my driver gets back working irrespective of CONFIG_DMA_CMA. diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c index 163d1cf4367e..504459395c39 100644 --- a/drivers/mmc/host/sdhci-cadence.c +++ b/drivers/mmc/host/sdhci-cadence.c @@ -237,6 +237,7 @@ static const struct sdhci_ops sdhci_cdns_ops = { static const struct sdhci_pltfm_data sdhci_cdns_pltfm_data = { .ops = &sdhci_cdns_ops, + .quirks2 = SDHCI_QUIRK2_BROKEN_64_BIT_DMA, }; static int sdhci_cdns_set_tune_val(struct sdhci_host *host, unsigned int val) -- Best Regards Masahiro Yamada From mboxrd@z Thu Jan 1 00:00:00 1970 From: Masahiro Yamada Subject: Re: [PATCH v2 2/2] dma-contiguous: Use fallback alloc_pages for single pages Date: Tue, 27 Aug 2019 18:03:14 +0900 Message-ID: References: <20190506223334.1834-1-nicoleotsuka@gmail.com> <20190506223334.1834-3-nicoleotsuka@gmail.com> <20190825011025.GA23410@lst.de> <20190826073320.GA11712@lst.de> <20190827075021.GA953@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20190827075021.GA953-jcswGhMUV9g@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Christoph Hellwig Cc: Ulf Hansson , Tony Lindgren , Catalin Marinas , Will Deacon , Linux Kernel Mailing List , Max Filippov , Stephen Rothwell , Russell King , Thierry Reding , linux-xtensa-PjhNF2WwrV/0Sa2dR60CXw@public.gmane.org, Kees Cook , Nicolin Chen , Andrew Morton , linux-arm-kernel , Chris Zankel , Wolfram Sang , David Woodhouse , linux-mmc , Adrian Hunter , iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, iamjoonsoo.kim-Hm3cg6mZ9cc@public.gmane.org, Robin Murphy List-Id: linux-mmc@vger.kernel.org On Tue, Aug 27, 2019 at 4:50 PM Christoph Hellwig wrote: > > On Tue, Aug 27, 2019 at 04:45:20PM +0900, Masahiro Yamada wrote: > > On Mon, Aug 26, 2019 at 4:33 PM Christoph Hellwig wrote: > > > > > > On Mon, Aug 26, 2019 at 11:05:00AM +0900, Masahiro Yamada wrote: > > > > This is included in v5.3-rc6 > > > > so I tested it. > > > > > > So there is no allocation failure, but you get I/O errors later? > > > > Right. > > > > > > > > Does the device use a device-private CMA area? > > > > Not sure. > > My driver is drivers/mmc/host/sdhci-cadence.c > > It reuses routines in drivers/mmc/host/sdhci.c > > > > > > > > > Does it work with Linux > > > 5.2 if CONFIG_DMA_CMA is disabled? > > > > No. > > 5.2 + disable CONFIG_DMA_CMA > > failed in the same way. > > So it seems like the device wants CMA memory. I guess the patch > below will fix it, but that isn't the solution. Can you try it > to confirm? In the end it probably assumes a dma mask it doesn't > set that the CMA memory satisfies or something similar. Thanks for the pointer. > diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c > index 69cfb4345388..bd2f24aa7f19 100644 > --- a/kernel/dma/contiguous.c > +++ b/kernel/dma/contiguous.c > @@ -236,7 +236,7 @@ struct page *dma_alloc_contiguous(struct device *dev, size_t size, gfp_t gfp) > > if (dev && dev->cma_area) > cma = dev->cma_area; > - else if (count > 1) > + else > cma = dma_contiguous_default_area; > > /* CMA can be used only in the context which permits sleeping */ Yes, this makes my driver working again when CONFIG_DMA_CMA=y. If I apply the following, my driver gets back working irrespective of CONFIG_DMA_CMA. diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c index 163d1cf4367e..504459395c39 100644 --- a/drivers/mmc/host/sdhci-cadence.c +++ b/drivers/mmc/host/sdhci-cadence.c @@ -237,6 +237,7 @@ static const struct sdhci_ops sdhci_cdns_ops = { static const struct sdhci_pltfm_data sdhci_cdns_pltfm_data = { .ops = &sdhci_cdns_ops, + .quirks2 = SDHCI_QUIRK2_BROKEN_64_BIT_DMA, }; static int sdhci_cdns_set_tune_val(struct sdhci_host *host, unsigned int val) -- Best Regards Masahiro Yamada 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=-3.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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 A2BC8C3A5A6 for ; Tue, 27 Aug 2019 09:04:09 +0000 (UTC) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 112202173E for ; Tue, 27 Aug 2019 09:04:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=nifty.com header.i=@nifty.com header.b="HSu1hjAb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 112202173E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=socionext.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id AF11E1259; Tue, 27 Aug 2019 09:04:08 +0000 (UTC) Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 607D21225 for ; Tue, 27 Aug 2019 09:04:07 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from conssluserg-06.nifty.com (conssluserg-06.nifty.com [210.131.2.91]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 885288A9 for ; Tue, 27 Aug 2019 09:04:06 +0000 (UTC) Received: from mail-vs1-f51.google.com (mail-vs1-f51.google.com [209.85.217.51]) (authenticated) by conssluserg-06.nifty.com with ESMTP id x7R93rTK023581 for ; Tue, 27 Aug 2019 18:03:54 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-06.nifty.com x7R93rTK023581 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1566896634; bh=9QFLgDLrDq6oYc9M2pjMIY7wPViunYCOH8ybzE+CYKY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=HSu1hjAbOHY7OxZVCGnKn6WOKUDa1+OQNj8CpTIBQXpwRexsrpcByAJ0Hke93xF2j 54/fWwjfQv/Udt1zdzb1OGxcDwzapAiUqJDFvvIhXyn123gTbqQ2J+ZCwQcqY6g5rq klP7bI6NJx444TwTaoLIGR6lOCrMbUAA0jmd5g8o1V3ZLTtZ0BlWfM0tgSFejtgt+M fK1ETpvRwPIoZnx/rkOZy0IeUrpyKMKDM3CXp+HMj344fQg5wN42a+tu78TLMu19IR XRsFC89dZBLV3cuYVQF5GSVRjNsadYcQNkyIqv8tKNxYVOeEfHN2T0jQ3uHXKK56LO x3il+Myr/RDuA== X-Nifty-SrcIP: [209.85.217.51] Received: by mail-vs1-f51.google.com with SMTP id y16so12960276vsc.3 for ; Tue, 27 Aug 2019 02:03:53 -0700 (PDT) X-Gm-Message-State: APjAAAU0Eu/ydo7aC9FB9ayb6zA8Q6gUlLy+aGoB4RqG19uYxsOby63Q IPuK77PyQTAuWS3oZ0EnHXSZ4R3d9JI37tSsv/c= X-Google-Smtp-Source: APXvYqwricK86V/H4mlXnBje+CLjj05rUISZsABUzE/wYSQ2E+9R0KKypcnkK7mnt6KPt7U5OLwH2hsMH6JJJTu7VOI= X-Received: by 2002:a67:fe12:: with SMTP id l18mr12998082vsr.54.1566896631370; Tue, 27 Aug 2019 02:03:51 -0700 (PDT) MIME-Version: 1.0 References: <20190506223334.1834-1-nicoleotsuka@gmail.com> <20190506223334.1834-3-nicoleotsuka@gmail.com> <20190825011025.GA23410@lst.de> <20190826073320.GA11712@lst.de> <20190827075021.GA953@lst.de> In-Reply-To: <20190827075021.GA953@lst.de> From: Masahiro Yamada Date: Tue, 27 Aug 2019 18:03:14 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 2/2] dma-contiguous: Use fallback alloc_pages for single pages To: Christoph Hellwig Cc: Ulf Hansson , Tony Lindgren , Catalin Marinas , Will Deacon , Linux Kernel Mailing List , Max Filippov , Stephen Rothwell , Russell King , Thierry Reding , linux-xtensa@linux-xtensa.org, Kees Cook , Nicolin Chen , Andrew Morton , linux-arm-kernel , Chris Zankel , Wolfram Sang , David Woodhouse , linux-mmc , Adrian Hunter , iommu@lists.linux-foundation.org, iamjoonsoo.kim@lge.com, Robin Murphy X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: iommu-bounces@lists.linux-foundation.org Errors-To: iommu-bounces@lists.linux-foundation.org On Tue, Aug 27, 2019 at 4:50 PM Christoph Hellwig wrote: > > On Tue, Aug 27, 2019 at 04:45:20PM +0900, Masahiro Yamada wrote: > > On Mon, Aug 26, 2019 at 4:33 PM Christoph Hellwig wrote: > > > > > > On Mon, Aug 26, 2019 at 11:05:00AM +0900, Masahiro Yamada wrote: > > > > This is included in v5.3-rc6 > > > > so I tested it. > > > > > > So there is no allocation failure, but you get I/O errors later? > > > > Right. > > > > > > > > Does the device use a device-private CMA area? > > > > Not sure. > > My driver is drivers/mmc/host/sdhci-cadence.c > > It reuses routines in drivers/mmc/host/sdhci.c > > > > > > > > > Does it work with Linux > > > 5.2 if CONFIG_DMA_CMA is disabled? > > > > No. > > 5.2 + disable CONFIG_DMA_CMA > > failed in the same way. > > So it seems like the device wants CMA memory. I guess the patch > below will fix it, but that isn't the solution. Can you try it > to confirm? In the end it probably assumes a dma mask it doesn't > set that the CMA memory satisfies or something similar. Thanks for the pointer. > diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c > index 69cfb4345388..bd2f24aa7f19 100644 > --- a/kernel/dma/contiguous.c > +++ b/kernel/dma/contiguous.c > @@ -236,7 +236,7 @@ struct page *dma_alloc_contiguous(struct device *dev, size_t size, gfp_t gfp) > > if (dev && dev->cma_area) > cma = dev->cma_area; > - else if (count > 1) > + else > cma = dma_contiguous_default_area; > > /* CMA can be used only in the context which permits sleeping */ Yes, this makes my driver working again when CONFIG_DMA_CMA=y. If I apply the following, my driver gets back working irrespective of CONFIG_DMA_CMA. diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c index 163d1cf4367e..504459395c39 100644 --- a/drivers/mmc/host/sdhci-cadence.c +++ b/drivers/mmc/host/sdhci-cadence.c @@ -237,6 +237,7 @@ static const struct sdhci_ops sdhci_cdns_ops = { static const struct sdhci_pltfm_data sdhci_cdns_pltfm_data = { .ops = &sdhci_cdns_ops, + .quirks2 = SDHCI_QUIRK2_BROKEN_64_BIT_DMA, }; static int sdhci_cdns_set_tune_val(struct sdhci_host *host, unsigned int val) -- Best Regards Masahiro Yamada _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu 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=-3.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 A0145C3A5A3 for ; Tue, 27 Aug 2019 09:04:38 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 714392184D for ; Tue, 27 Aug 2019 09:04:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ORXj5s9D"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=nifty.com header.i=@nifty.com header.b="FEJO9C78" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 714392184D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=socionext.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZOp4nHWbBh3tOdO4/RgylE9VkD8q482h+n8BcIY62VU=; b=ORXj5s9D4fTXth 7+YncgwwcbO2u/nJvmqgBlnXcFbubLjVkECsy5/cf6qmPZomCpeLmtumhYeJsBjod8FXYdF0YtBmo GEIq1Aa14ADAZpVKvRRQALmPbSWOJoyRUWugwKsMfTlSSAr8VBoiFpv6BnB3Zha656DVmBlvKbwfM Cu3ZljTVZ199kTY2Jg8XPYL7REPjEacxfU6yrG3FEfkil/8c0gY3aa2NSwimygPxyyMjF209sTxRX 507k8ebn1DmfZztUlC9OeYDEMCoLCnBJhSIdThIlybjJPHpuQ6JspEHSec11OwPVLi9PgqtEE/zpu vu213TqNEvg9pB7fNvSA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i2XOr-0000ii-NU; Tue, 27 Aug 2019 09:04:26 +0000 Received: from conssluserg-04.nifty.com ([210.131.2.83]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i2XOm-0000iH-LH for linux-arm-kernel@lists.infradead.org; Tue, 27 Aug 2019 09:04:22 +0000 Received: from mail-vs1-f47.google.com (mail-vs1-f47.google.com [209.85.217.47]) (authenticated) by conssluserg-04.nifty.com with ESMTP id x7R93pt6014818 for ; Tue, 27 Aug 2019 18:03:52 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-04.nifty.com x7R93pt6014818 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1566896632; bh=9QFLgDLrDq6oYc9M2pjMIY7wPViunYCOH8ybzE+CYKY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=FEJO9C78f6r58lBL+oGJOTJPxQoEb2F5p+8zzLKT0aTGj9HnOH4wJZVO7i4XZ0lrD JRaPKKWvcXsmkwHjPM/DC2pmwp6QBq7gDAmbILjLCjSDfTAmzpxI18l4qqL/9MM1QI OiW+casOVnjgaTJgg1MrMs/Zcc2ogoWZAiwnNaodtf06YkWFxWxTc4qTTqDJa1Xvat Rj4ih6nduKisiJwSs13yNxmV7fiRExk2+Nmcqx0BGve6cl7RqKiflQILfKi43Q6Cyn nCnpIRLy2Jlp05lHYh8OR+eckJYKfIMmJbAHTZeExVX6xDHePofUOhPK2vaX5e22WV IvohYpkXZw8zw== X-Nifty-SrcIP: [209.85.217.47] Received: by mail-vs1-f47.google.com with SMTP id c7so12924443vse.11 for ; Tue, 27 Aug 2019 02:03:52 -0700 (PDT) X-Gm-Message-State: APjAAAXsszut+OiwUDLVM7TWGFS+ax4HH3Or0KaK/HF9YXZysyVFpZrZ 170gJaMKOsGB0jfPN8/xe4B5i0zR3bac6pz/BNM= X-Google-Smtp-Source: APXvYqwricK86V/H4mlXnBje+CLjj05rUISZsABUzE/wYSQ2E+9R0KKypcnkK7mnt6KPt7U5OLwH2hsMH6JJJTu7VOI= X-Received: by 2002:a67:fe12:: with SMTP id l18mr12998082vsr.54.1566896631370; Tue, 27 Aug 2019 02:03:51 -0700 (PDT) MIME-Version: 1.0 References: <20190506223334.1834-1-nicoleotsuka@gmail.com> <20190506223334.1834-3-nicoleotsuka@gmail.com> <20190825011025.GA23410@lst.de> <20190826073320.GA11712@lst.de> <20190827075021.GA953@lst.de> In-Reply-To: <20190827075021.GA953@lst.de> From: Masahiro Yamada Date: Tue, 27 Aug 2019 18:03:14 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 2/2] dma-contiguous: Use fallback alloc_pages for single pages To: Christoph Hellwig X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190827_020420_913641_225194C4 X-CRM114-Status: GOOD ( 25.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , Tony Lindgren , Catalin Marinas , Will Deacon , Linux Kernel Mailing List , Max Filippov , Marek Szyprowski , Stephen Rothwell , Joerg Roedel , Russell King , Thierry Reding , linux-xtensa@linux-xtensa.org, Kees Cook , Nicolin Chen , Andrew Morton , linux-arm-kernel , Chris Zankel , Wolfram Sang , David Woodhouse , linux-mmc , Adrian Hunter , iommu@lists.linux-foundation.org, iamjoonsoo.kim@lge.com, Robin Murphy Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Aug 27, 2019 at 4:50 PM Christoph Hellwig wrote: > > On Tue, Aug 27, 2019 at 04:45:20PM +0900, Masahiro Yamada wrote: > > On Mon, Aug 26, 2019 at 4:33 PM Christoph Hellwig wrote: > > > > > > On Mon, Aug 26, 2019 at 11:05:00AM +0900, Masahiro Yamada wrote: > > > > This is included in v5.3-rc6 > > > > so I tested it. > > > > > > So there is no allocation failure, but you get I/O errors later? > > > > Right. > > > > > > > > Does the device use a device-private CMA area? > > > > Not sure. > > My driver is drivers/mmc/host/sdhci-cadence.c > > It reuses routines in drivers/mmc/host/sdhci.c > > > > > > > > > Does it work with Linux > > > 5.2 if CONFIG_DMA_CMA is disabled? > > > > No. > > 5.2 + disable CONFIG_DMA_CMA > > failed in the same way. > > So it seems like the device wants CMA memory. I guess the patch > below will fix it, but that isn't the solution. Can you try it > to confirm? In the end it probably assumes a dma mask it doesn't > set that the CMA memory satisfies or something similar. Thanks for the pointer. > diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c > index 69cfb4345388..bd2f24aa7f19 100644 > --- a/kernel/dma/contiguous.c > +++ b/kernel/dma/contiguous.c > @@ -236,7 +236,7 @@ struct page *dma_alloc_contiguous(struct device *dev, size_t size, gfp_t gfp) > > if (dev && dev->cma_area) > cma = dev->cma_area; > - else if (count > 1) > + else > cma = dma_contiguous_default_area; > > /* CMA can be used only in the context which permits sleeping */ Yes, this makes my driver working again when CONFIG_DMA_CMA=y. If I apply the following, my driver gets back working irrespective of CONFIG_DMA_CMA. diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c index 163d1cf4367e..504459395c39 100644 --- a/drivers/mmc/host/sdhci-cadence.c +++ b/drivers/mmc/host/sdhci-cadence.c @@ -237,6 +237,7 @@ static const struct sdhci_ops sdhci_cdns_ops = { static const struct sdhci_pltfm_data sdhci_cdns_pltfm_data = { .ops = &sdhci_cdns_ops, + .quirks2 = SDHCI_QUIRK2_BROKEN_64_BIT_DMA, }; static int sdhci_cdns_set_tune_val(struct sdhci_host *host, unsigned int val) -- Best Regards Masahiro Yamada _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel