From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: "Noralf Trønnes" <noralf@tronnes.org>
Cc: sam@ravnborg.org, david@lechnology.com, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 05/11] drm/tinydrm: Remove tinydrm_spi_max_transfer_size()
Date: Tue, 15 Oct 2019 18:02:57 +0300 [thread overview]
Message-ID: <20191015150257.GK32742@smile.fi.intel.com> (raw)
In-Reply-To: <20191015143236.GA5363@smile.fi.intel.com>
On Tue, Oct 15, 2019 at 05:32:36PM +0300, Andy Shevchenko wrote:
> On Fri, Jul 19, 2019 at 05:59:10PM +0200, Noralf Trønnes wrote:
> > spi-bcm2835 can handle >64kB buffers now so there is no need to check
> > ->max_dma_len. The tinydrm_spi_max_transfer_size() max_len argument is
> > not used by any callers, so not needed.
> >
> > Then we have the spi_max module parameter. It was added because
> > staging/fbtft has support for it and there was a report that someone used
> > it to set a small buffer size to avoid popping on a USB soundcard on a
> > Raspberry Pi. In hindsight it shouldn't have been added, I should have
> > waited for it to become a problem first. I don't know it anyone is
> > actually using it, but since tinydrm_spi_transfer() is being moved to
> > mipi-dbi, I'm taking the opportunity to remove it. I'll add it back to
> > mipi-dbi if someone complains.
> >
> > With that out of the way, spi_max_transfer_size() can be used instead.
> >
> > The chosen 16kB buffer size for Type C Option 1 (9-bit) interface is
> > somewhat arbitrary, but a bigger buffer will have a miniscule impact on
> > transfer speed, so it's probably fine.
>
> This breaks the SPI PXA2xx case I'm using. The world is not a Pi:e.
>
> [ 388.445752] mi0283qt spi-PRP0001:01: DMA disabled for transfer length 153600 greater than 65536
> [ 388.634437] mi0283qt spi-PRP0001:01: DMA disabled for transfer length 153600 greater than 65536
> [ 388.822933] mi0283qt spi-PRP0001:01: DMA disabled for transfer length 153600 greater than 65536
>
> The crucial thing is to check the transfer size against maximum DMA length
> of the master.
>
> Please, fix.
Partial revert fixes the issue, though I'm not sure it's the best approach.
--- a/drivers/gpu/drm/drm_mipi_dbi.c
+++ b/drivers/gpu/drm/drm_mipi_dbi.c
@@ -1147,7 +1147,7 @@ EXPORT_SYMBOL(mipi_dbi_spi_init);
int mipi_dbi_spi_transfer(struct spi_device *spi, u32 speed_hz,
u8 bpw, const void *buf, size_t len)
{
- size_t max_chunk = spi_max_transfer_size(spi);
+ size_t max_chunk = min(spi_max_transfer_size(spi), spi->master->max_dma_len);
struct spi_transfer tr = {
.bits_per_word = bpw,
.speed_hz = speed_hz,
--
With Best Regards,
Andy Shevchenko
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2019-10-15 15:03 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-19 15:59 [PATCH v2 00/11] drm/tinydrm: Remove tinydrm.ko Noralf Trønnes
2019-07-19 15:59 ` [PATCH v2 01/11] drm: Add SPI connector type Noralf Trønnes
2019-07-19 15:59 ` [PATCH v2 02/11] drm/tinydrm: Use DRM_MODE_CONNECTOR_SPI Noralf Trønnes
2019-07-19 15:59 ` [PATCH v2 03/11] drm/tinydrm: Use spi_is_bpw_supported() Noralf Trønnes
2019-07-19 15:59 ` [PATCH v2 04/11] drm/tinydrm: Remove spi debug buffer dumping Noralf Trønnes
2019-07-19 15:59 ` [PATCH v2 05/11] drm/tinydrm: Remove tinydrm_spi_max_transfer_size() Noralf Trønnes
2019-10-15 14:32 ` Andy Shevchenko
2019-10-15 15:02 ` Andy Shevchenko [this message]
2019-10-15 15:41 ` Noralf Trønnes
2019-10-15 15:57 ` Daniel Vetter
2019-10-16 16:13 ` Andy Shevchenko
2019-10-16 17:44 ` Daniel Vetter
2019-10-16 18:00 ` Mark Brown
2019-10-17 6:58 ` Andy Shevchenko
2019-10-15 15:59 ` Andy Shevchenko
2019-10-15 16:05 ` Daniel Vetter
2019-10-16 8:07 ` Andy Shevchenko
2019-10-15 16:55 ` Noralf Trønnes
2019-07-19 15:59 ` [PATCH v2 06/11] drm/tinydrm: Clean up tinydrm_spi_transfer() Noralf Trønnes
2019-07-19 15:59 ` [PATCH v2 07/11] drm/tinydrm: Move tinydrm_spi_transfer() Noralf Trønnes
2019-07-19 15:59 ` [PATCH v2 08/11] drm/tinydrm: Move tinydrm_machine_little_endian() Noralf Trønnes
2019-07-19 15:59 ` [PATCH v2 09/11] drm/tinydrm/repaper: Don't use tinydrm_display_pipe_init() Noralf Trønnes
2019-07-19 15:59 ` [PATCH v2 10/11] drm/tinydrm/mipi-dbi: Add mipi_dbi_init_with_formats() Noralf Trønnes
2019-07-22 19:48 ` David Lechner
2019-07-19 15:59 ` [PATCH v2 11/11] drm/tinydrm: Move tinydrm_display_pipe_init() to mipi-dbi Noralf Trønnes
2019-07-23 14:11 ` [PATCH v2 00/11] drm/tinydrm: Remove tinydrm.ko Noralf Trønnes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191015150257.GK32742@smile.fi.intel.com \
--to=andriy.shevchenko@intel.com \
--cc=david@lechnology.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=noralf@tronnes.org \
--cc=sam@ravnborg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox