linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joerg Roedel <joro@8bytes.org>
To: Magnus Damm <magnus.damm@gmail.com>
Cc: iommu@lists.linux-foundation.org,
	laurent.pinchart+renesas@ideasonboard.com,
	geert+renesas@glider.be, linux-kernel@vger.kernel.org,
	linux-renesas-soc@vger.kernel.org, horms+renesas@verge.net.au,
	robin.murphy@arm.com, m.szyprowski@samsung.com
Subject: Re: [PATCH v5 05/07] iommu/ipmmu-vmsa: Add new IOMMU_DOMAIN_DMA ops
Date: Thu, 22 Sep 2016 16:45:06 +0200	[thread overview]
Message-ID: <20160922144506.GK3541@8bytes.org> (raw)
In-Reply-To: <20160920134446.25470.22322.sendpatchset@little-apple>

On Tue, Sep 20, 2016 at 10:44:46PM +0900, Magnus Damm wrote:
> +#ifdef CONFIG_IOMMU_DMA
> +
> +static struct iommu_domain *ipmmu_domain_alloc_dma(unsigned type)
> +{
> +	struct iommu_domain *io_domain;
> +
> +	if (type != IOMMU_DOMAIN_DMA)
> +		return NULL;
> +
> +	io_domain = __ipmmu_domain_alloc(type);
> +	if (io_domain)
> +		iommu_get_dma_cookie(io_domain);
> +
> +	return io_domain;
> +}
> +
> +static void ipmmu_domain_free_dma(struct iommu_domain *io_domain)
> +{
> +	iommu_put_dma_cookie(io_domain);
> +	ipmmu_domain_free(io_domain);
> +}

> [...]

> +static const struct iommu_ops ipmmu_ops = {
> +	.domain_alloc = ipmmu_domain_alloc_dma,
> +	.domain_free = ipmmu_domain_free_dma,

Okay, so when CONFIG_IOMMU_DMA is enabled, you only support allocation
of DMA domains, not UNMANAGED domains anymore. Is there a reason for
that?

You can reduce the #ifdef'ed coded by supporting both types of domains
and call into allocation-subfunctions for DMA and UNMANAGED domains. The
#ifdef could then only let the dma-allocation function return NULL.

This would be much more compatible to what other IOMMU drivers do and
will allow VFIO usage in the future.



	Joerg

  reply	other threads:[~2016-09-22 14:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-20 13:43 [PATCH v5 00/07] iommu/ipmmu-vmsa: IPMMU multi-arch update V5 Magnus Damm
2016-09-20 13:44 ` [PATCH v5 01/07] iommu/ipmmu-vmsa: Remove platform data handling Magnus Damm
2016-09-20 13:44 ` [PATCH v5 02/07] iommu/ipmmu-vmsa: Rework interrupt code and use bitmap for context Magnus Damm
2016-09-20 13:44 ` [PATCH v5 03/07] iommu/ipmmu-vmsa: Break out utlb parsing code Magnus Damm
2016-09-20 13:44 ` [PATCH v5 04/07] iommu/ipmmu-vmsa: Break out domain allocation code Magnus Damm
2016-09-20 13:44 ` [PATCH v5 05/07] iommu/ipmmu-vmsa: Add new IOMMU_DOMAIN_DMA ops Magnus Damm
2016-09-22 14:45   ` Joerg Roedel [this message]
2016-10-19 23:45     ` Magnus Damm
2016-09-20 13:44 ` [PATCH v5 06/07] iommu/ipmmu-vmsa: ARM and ARM64 archdata access Magnus Damm
2016-09-20 13:45 ` [PATCH v5 07/07] iommu/ipmmu-vmsa: Drop LPAE Kconfig dependency Magnus Damm
2016-09-22 14:47 ` [PATCH v5 00/07] iommu/ipmmu-vmsa: IPMMU multi-arch update V5 Joerg Roedel

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=20160922144506.GK3541@8bytes.org \
    --to=joro@8bytes.org \
    --cc=geert+renesas@glider.be \
    --cc=horms+renesas@verge.net.au \
    --cc=iommu@lists.linux-foundation.org \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=magnus.damm@gmail.com \
    --cc=robin.murphy@arm.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;
as well as URLs for NNTP newsgroup(s).