Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp351124ybg; Fri, 12 Jun 2020 03:17:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqqR7ckzamON6lDIIT47Dutrz0AgR5zMaA+QJ9nMaMkLqellFZ9eIxKvq2Q0QymD+KTO8h X-Received: by 2002:a17:906:5595:: with SMTP id y21mr13010560ejp.61.1591957041012; Fri, 12 Jun 2020 03:17:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591957041; cv=none; d=google.com; s=arc-20160816; b=YqXaFJT9e9WPGinSyVmIOoBeWKZYOsucLuKhAQ0+XC0sI+qlpIIoo+NevT+OP/7+GL hjMmqxNN/auMgPhK3BVlMC4tc6sj7oLM+YZms90lFWw+7/1TpA7S+DeZuwH/W0P/quVG grtK8bu+bhR8gLw9IyIb6IRpEUJx23a96xgq41XB9p3HYznX9FIyAm9BtP1ULcJHjPFN REHYZhF5Km1UUKEs7piOAIsIdspO7FaTkjgqQJUAoDq9d/XfpEgSJ3AdNE+iAfJSHAB5 4duwEdeZZnULHdPbtcrmI4M/XyeQ15IdAdHbl6g/hFoEa6enPgSv734Oz/xdqD8g1fUK DCwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=J9fwUWHnUyyJq/a9v93XBGna3fa2eU5jH2fcaPDoMno=; b=bEQ01sAnPkUCzG7cm4SNthGkI7yGwvf9YmFDTjqgjutKb7Z1EhLV4Bp9lmMuahvLGr 777U19gYjaf54bHdYuEwODk3Xk4uAw6Oqnqm2gFsPjJz9+XDLvvFdknD106mRAoM0Nx/ mImNhypMDtWC81TL/RARWzi4UJm1W78tHEIGft+Vsgosna92rk8l0WB1vp4HKjEzoatU uTebHXgWwILuk9BHeEqHb0lrHA2Pk8Vo7UgVDBZtLNovPZBGt+pPZV1CMVUS0iDkraNr uR7Iykfva7H8VvKpBsEEyMGUJ+bWBkCp6eLC0FCa9/3zoLfDmAXGKYFTbC6VqAM8A393 E8CA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MlWUnQDM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cx18si3224509edb.323.2020.06.12.03.16.58; Fri, 12 Jun 2020 03:17:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MlWUnQDM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726343AbgFLKOF (ORCPT + 99 others); Fri, 12 Jun 2020 06:14:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:40024 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725927AbgFLKOB (ORCPT ); Fri, 12 Jun 2020 06:14:01 -0400 Received: from localhost (fw-tnat.cambridge.arm.com [217.140.96.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4D2322081A; Fri, 12 Jun 2020 10:14:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591956841; bh=expc4CDnEYnki3mJuBqA6Oh/0tPydmqgZtKMrV+jKBk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MlWUnQDM+u/RIUYixIip7C8RrA/dgIItdp97UwUfbUfXG0D+AFnA3GqyMex8dunyS SSPJxRyBr1KPHpnROeSumSMbIX5s2KP/X4HKr/DcNByipe0OMwcLE901IaXMGQ+FRm 3DI8LIOvmteSGJa/CaOcnr8ReTxNOOAhzakq3Gak= Date: Fri, 12 Jun 2020 11:13:57 +0100 From: Mark Brown To: Robin Gong Cc: "shawnguo@kernel.org" , "s.hauer@pengutronix.de" , "festevam@gmail.com" , "robin.murphy@arm.com" , "matthias.schiffer@ew.tq-group.com" , "kernel@pengutronix.de" , dl-linux-imx , "linux-spi@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v1 RFC 1/2] spi: introduce fallback to pio Message-ID: <20200612101357.GA5396@sirena.org.uk> References: <1591880310-1813-1-git-send-email-yibin.gong@nxp.com> <1591880310-1813-2-git-send-email-yibin.gong@nxp.com> <20200611134042.GG4671@sirena.org.uk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="mYCpIKhGyMATD0i+" Content-Disposition: inline In-Reply-To: X-Cookie: As seen on TV. User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --mYCpIKhGyMATD0i+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jun 12, 2020 at 02:18:32AM +0000, Robin Gong wrote: > On 2020/06/11 21: 41 Mark Brown wrote: Please look at the formatting of your e-mails - they're really hard to read. The line length is over 80 columns and there's no breaks between paragraphs. > > If we were going to do this I don't see why we'd have a flag for this r= ather than > > just doing it unconditionally but... > What do you mean flag here, 'master->flags' or SPI_MASTER_FALLBACK? 'mast= er->flags' > could let client fallback to PIO finally and spi core clear this flag onc= e this transfer done, > so that DMA could be tried again in the next transfer. Client could enabl= e this feature by choosing SPI_MASTER_FALLBACK freely without any impact on= others. SPI_MASTER_FALLBACK. If this works why would any driver not enable the flag? > > ...I don't think this can work sensibly - this is going to try PIO if t= here's *any* > > error. We might have had some sort of issue during the transfer for ex= ample > > so have some noise on the bus. Like I said on a prior version of this = I really > Any error happen in DMA could fallback to PIO , seems a nice to have, bec= ause it could > give chance to run in PIO which is more reliable. But if there is also er= ror in PIO, thus may loop here, it's better adding limit try times here? = =20 An error doesn't mean nothing happened on the bus, an error could for example also be something like a FIFO overrun which corrupts data. > > think that we need to be figuring out if the DMA controller can support= the > > transaction before we even map the buffer for it, having the controller= just > > randomly fail underneath the consumer just does not sound robust. > But dmaengine_prep_slave_sg still may return failure even if anything abo= ut > DMA is ok before spi transfer start, such as dma description malloc failu= re. This > patch seems could make spi a bit robust... It *could* but only in extreme situations, and again this isn't just handling errors from failure to prepare the hardware but also anything that happens after it. --mYCpIKhGyMATD0i+ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAl7jVWIACgkQJNaLcl1U h9Bozgf/UcNkCEZeiELBwx8bUG0lENlWEPOtNj5hIgl5N82SihwmCxoFw94tIgDg 4TQJsn1axD1mvHMA8Lp17W5ez2e+zEfzaAKluwvg7rfk64VIWBb1Am9kX9hq2BIV N/lzF4sBC5KTJRa5k/tRDagDjAq0bd718Kj4rbXKazcDcHyKhq3JNH+JwPoo3QfH +5HE3kQ70uqqsHmufQR/kHG/0tXp50ZqvEnSMUzKYZErDwdQ1Fl2RHi/M6sQV6DV j5SkMSsgFE54nLeKU1HELK1RWz16w5TS+HaYjtHmRdIsaD+CM3buINDkVAfjkHsf imE/+07m4y/n6nyM28LDJhdDjoM8zQ== =SHv2 -----END PGP SIGNATURE----- --mYCpIKhGyMATD0i+--