tpmdd-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: <Alexander.Steffen@infineon.com>
To: jgunthorpe@obsidianresearch.com
Cc: tpmdd-devel@lists.sourceforge.net, stable@vger.kernel.org
Subject: RE: [tpmdd-devel] [PATCH] tpm_tis_spi: Use DMA-safe memory for SPI transfers
Date: Thu, 27 Jul 2017 13:38:00 +0000	[thread overview]
Message-ID: <13d6ed4b95194cdb99be98edc35b5a9f@MUCSE603.infineon.com> (raw)
In-Reply-To: <20170709211150.GA19327@obsidianresearch.com>

> >  struct tpm_tis_spi_phy {
> >  	struct tpm_tis_data priv;
> >  	struct spi_device *spi_device;
> > -
> > -	u8 tx_buf[4];
> > -	u8 rx_buf[4];
> > +	u8 *iobuf;
> 
> tpm_tis_spi_phy is already devm_kzalloc'd, why embed another kalloc
> pointer inside it?

I was mostly going by the documentation in https://www.kernel.org/doc/Documentation/DMA-API-HOWTO.txt. Allocating a new buffer ensures that it is cacheline-aligned and not shared with other data, as advised:
"Even if those classes of memory could physically work with DMA, you'd need to ensure the I/O buffers were cacheline-aligned."
"Also, systems with caches that aren't DMA-coherent will work better when the underlying buffers don't share cache lines with other data."

Is that sufficient to justify this implementation? Then I will add some more explanations along those lines to the commit message and resubmit the patch.

Alexander

  reply	other threads:[~2017-07-27 13:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-04 13:56 [PATCH] tpm_tis_spi: Use DMA-safe memory for SPI transfers Alexander Steffen
     [not found] ` <20170704135609.5064-1-Alexander.Steffen-d0qZbvYSIPpWk0Htik3J/w@public.gmane.org>
2017-07-09 21:11   ` Jason Gunthorpe
2017-07-27 13:38     ` Alexander.Steffen [this message]
2017-07-16 11:41 ` [tpmdd-devel] " Jarkko Sakkinen

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=13d6ed4b95194cdb99be98edc35b5a9f@MUCSE603.infineon.com \
    --to=alexander.steffen@infineon.com \
    --cc=jgunthorpe@obsidianresearch.com \
    --cc=stable@vger.kernel.org \
    --cc=tpmdd-devel@lists.sourceforge.net \
    /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;
as well as URLs for NNTP newsgroup(s).