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=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 97ECEC433E6 for ; Fri, 28 Aug 2020 15:10:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 76C8B2075B for ; Fri, 28 Aug 2020 15:10:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728251AbgH1PJ7 (ORCPT ); Fri, 28 Aug 2020 11:09:59 -0400 Received: from brightrain.aerifal.cx ([216.12.86.13]:47644 "EHLO brightrain.aerifal.cx" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728202AbgH1PJq (ORCPT ); Fri, 28 Aug 2020 11:09:46 -0400 Date: Fri, 28 Aug 2020 11:09:43 -0400 From: Rich Felker To: Ulf Hansson Cc: Christoph Hellwig , Yoshinori Sato , Linux-sh list , Linux Kernel Mailing List , "linux-mmc@vger.kernel.org" , linux-spi@vger.kernel.org Subject: Re: [PATCH 09/10] sh: don't allow non-coherent DMA for NOMMU Message-ID: <20200828150942.GV3265@brightrain.aerifal.cx> References: <20200714121856.955680-1-hch@lst.de> <20200714121856.955680-10-hch@lst.de> <20200828020045.GT3265@brightrain.aerifal.cx> <20200828021152.GU3265@brightrain.aerifal.cx> <20200828042422.GA29734@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 28, 2020 at 11:26:57AM +0200, Ulf Hansson wrote: > On Fri, 28 Aug 2020 at 06:24, Christoph Hellwig wrote: > > > > On Thu, Aug 27, 2020 at 10:11:53PM -0400, Rich Felker wrote: > > > > This change broke SD card support on J2 because MMC_SPI spuriously > > > > depends on HAS_DMA. It looks like it can be fixed just by removing > > > > that dependency from drivers/mmc/host/Kconfig. > > > > > > It can't. mmp_spi_probe fails with ENOMEM, probably due to trying to > > > do some DMA setup thing that's not going to be needed if the > > > underlying SPI device doesn't support/use DMA. > > > > Adding the linux-mmc and linux-spi lists, as that seems pretty odd. > > The mmc_spi driver needs modernizations, so I am not surprised to see > odd things. > > My guess is that in ->probe() we check "if > (spi->master->dev.parent->dma_mask)" - > and runs dma_map*() > operations, which fails and leads to bailing out of ->probe() to > return an error code. > > However, by looking at the code, one get the feeling that the DMA > support is somewhat prepared to be made optional. I guess it has never > been really tested, as the Kconfig option has "depends on HAS_DMA" - > and it's been like that as long as I can remember. It always worked on our "byte-banged" SPI controller, with no DMA controller present, before Christoph's changes in this patch series, and seems to be working now (although I have some other, hopefully unrelated regressions to debug) with #ifdef CONFIG_HAS_DMA around the if (spi->master->dev.parent->dma_mask) block in mmc_spi_probe. That's probably not the right fix though -- why isn't it checking host->dma_dev instead and only attempting DMA setup if dma_dev is non-null? Rich