All of lore.kernel.org
 help / color / mirror / Atom feed
From: thunder.leizhen@huawei.com (leizhen)
To: linux-arm-kernel@lists.infradead.org
Subject: Question:  Does dma_alloc_coherent  have problem?
Date: Tue, 25 Nov 2014 17:03:52 +0800	[thread overview]
Message-ID: <547445F8.4070500@huawei.com> (raw)

Hi, Catalin and Will:

On arm64, invoke dma_alloc_coherent will indirect call swiotlb_alloc_coherent.
The latter function allocates memory by __get_free_pages or from swiotlb buffer,
then use function phys_to_dma to get iova.

static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr)
{
	return (dma_addr_t)paddr;
}

But dma_alloc_coherent have not use iommu_map or other functions to create mapping
between iova and pa. I known that SMMUv2 support bypass mode, so there is no problem
in this case. But, some device drivers need use SMMU page table to create exact mapping,
to enhance security.

And I saw that: on X86, intel_alloc_coherent manages iova address space of each iommu_group,
and create mapping between iova and pa when needed.

So, I think create mapping should be done in dma_alloc_coherent.

             reply	other threads:[~2014-11-25  9:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-25  9:03 leizhen [this message]
2014-11-25 10:28 ` Question: Does dma_alloc_coherent have problem? Catalin Marinas
2014-11-26  1:40   ` leizhen
2014-11-27 12:16     ` Catalin Marinas

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=547445F8.4070500@huawei.com \
    --to=thunder.leizhen@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.