Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5277039ybl; Tue, 27 Aug 2019 02:05:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqyJ3putbLO9nDNcX5D/xDwKIBQV7WmIl1Pty0KY6wrC/SkoIgGlYvfLGCR+lTHn926TLQ81 X-Received: by 2002:a62:6c1:: with SMTP id 184mr24383544pfg.230.1566896722675; Tue, 27 Aug 2019 02:05:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566896722; cv=none; d=google.com; s=arc-20160816; b=MZLbPR20yM3/6Qvr9tBdX4Bwa9XE1oVoy4Wo/UhCVFY/V5LbaCNLnOzsksFhoIvVpE lafDSlINf5DSj7ABt0a9XUBEZrlHUnzFb768iHxe560O+8jphKy30QtWlQp4Xa2QxvMu /lg5zc4uq+urBfswqBiTqPKAzMdRwCdcPvSYBnd5DQzbCm4ZyNDNbO4zCwsNEAcHLxp4 ozZOSRlR/jCuihJpntY/36M/t+5zW2zMAE/ZaMEY4JCEAdAStlvsnbmlBXqDhau3Yjng 2LIY79TbPDnhCuSOE55jh3PYzfQlrKKafYFgti2fNrHXxvQDlzBuXU7YzpXXyZEqdjgr 7zGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature:dkim-filter; bh=9QFLgDLrDq6oYc9M2pjMIY7wPViunYCOH8ybzE+CYKY=; b=NU7p90AcycEpV67QTuJ6H1LfDoRoOB2yIKdEQtn1Q205/1u+RHktYsKLr4Spgx9XoW MuVO0xFs8KJ6B23E1bDArxQeB3uspDPoSwgvirFRh5luDItmo2Q+Lf7SD03hp210jPFJ Pky9pEp6U3RiV+ieFJhPpnGZbdTXLew4esq8E/wRbOghnOzLOWHdQr2sa8f6ZVbIHn6i bWbcD0DmnUozwy9EWx/1ACiLpZa6WTqRMnUdoOUN0of8mVXq0KQWXixrm9ZxceqhDbdN cONnUkqJWFuP+10qzdOoxBcZmjEwer8RU/KzU05QLvOTTPsxghvsYnsANBFymJtgL1T4 1Y4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=FEJO9C78; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c9si1949534pjo.109.2019.08.27.02.05.07; Tue, 27 Aug 2019 02:05:22 -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=@nifty.com header.s=dec2015msa header.b=FEJO9C78; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728772AbfH0JEL (ORCPT + 99 others); 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-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