From: Wolfram Sang <wsa@the-dreams.de>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>,
Linux I2C <linux-i2c@vger.kernel.org>,
Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH 2/4] i2c: add docs to clarify DMA handling
Date: Tue, 6 Jun 2017 12:24:47 +0200 [thread overview]
Message-ID: <20170606102447.cftuyhtx7zo2fe2g@ninjato> (raw)
In-Reply-To: <CAMuHMdVLV91TdpWz=AeCbLM0Occ4byGMZ37wDtBGStR+j9OL2Q@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1265 bytes --]
> > +Therefore, it is *not* mandatory that the buffer of an i2c message is DMA safe.
> > +It does not seem reasonable to apply additional burdens when the feature is so
> > +rarely used. However, it is recommended to use a DMA-safe buffer, if your
> > +message size is likely applicable for DMA (FIXME: > 8 byte?).
>
> So you expect drivers to fall back to PIO automatically if the buffer is
> not DMA safe. Sounds good to me.
Yes, I strongly recommend that. Otherwise, drivers can always deal with
bounce buffers on their own.
> However, your check for a DMA-capable buffer is invoked only if
> CONFIG_DMA_API_DEBUG is enabled:
is *NOT* enabled!
>
> #if !defined(CONFIG_DMA_API_DEBUG)
> if (!virt_addr_valid(msg->buf) || object_is_on_stack(msg->buf)) {
> pr_debug("msg buffer to 0x%04x might not be DMA capable\n",
> msg->addr);
> return -EFAULT;
> }
> #endif
>
The #if block is there because DMA_API_DEBUG does a lot more, but if the
check in the helper is enabled, the core will fall back to PIO and you
won't get the additional info from DMA_API_DEBUG.
I think this needs a comment :)
Now OK?
Regards,
Wolfram
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2017-06-06 10:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-06 9:20 [RFC PATCH 0/4] i2c: document DMA handling and add helper Wolfram Sang
2017-06-06 9:20 ` [RFC PATCH 1/4] i2c: add helper to determine if DMA is favoured Wolfram Sang
2017-06-06 9:20 ` [RFC PATCH 2/4] i2c: add docs to clarify DMA handling Wolfram Sang
2017-06-06 10:03 ` Geert Uytterhoeven
2017-06-06 10:24 ` Wolfram Sang [this message]
2017-06-06 10:37 ` Geert Uytterhoeven
2017-06-06 10:54 ` Wolfram Sang
2017-06-06 11:12 ` Geert Uytterhoeven
2017-06-06 11:23 ` Wolfram Sang
2017-06-06 15:29 ` Geert Uytterhoeven
2017-06-06 9:20 ` [RFC PATCH 3/4] i2c: sh_mobile: use helper to decide if DMA is used Wolfram Sang
2017-06-06 9:20 ` [RFC PATCH 4/4] i2c: rcar: check for DMA-capable buffers Wolfram Sang
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=20170606102447.cftuyhtx7zo2fe2g@ninjato \
--to=wsa@the-dreams.de \
--cc=geert@linux-m68k.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=wsa+renesas@sang-engineering.com \
/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