Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1488943

Re: [PATCH v5 05/07] iommu/ipmmu-vmsa: Add new IOMMU_DOMAIN_DMA ops

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Joerg Roedel <joro@8bytes.org>
Newsgroups linux.kernel
Subject Re: [PATCH v5 05/07] iommu/ipmmu-vmsa: Add new IOMMU_DOMAIN_DMA ops
Date Thu, 22 Sep 2016 16:50:01 +0200
Message-ID <skdu1-7CL-1@gated-at.bofh.it> (permalink)
References <sjtKy-3DJ-13@gated-at.bofh.it> <sjtKy-3DJ-17@gated-at.bofh.it>
X-Original-To Magnus Damm <magnus.damm@gmail.com>
Dkim-Signature v=1; a=rsa-sha256; c=simple/simple; d=8bytes.org; s=mail-1; t=1474555506; bh=i79P6B5zSNjHrPQcSSkq5YIkPqdG/sU7sHqu+7x7FQ8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BpCW2778+n+qerHZ3XqgUfnwjLwMGAHjnQeBKFF6WAKU523rULeCuXAJECTdhKJe0 DacbjvfKGL1px0QnoR6GlWHpAjM6EkbtvEt5ZjVoH3vGwVN4FAABPhZfTnm3iORmjY Ub97MHNPCuv+4dD4XPCMumASEIVHXvoyGIIGpE3qm5K0X2dw9HFRpjCXXu4zXCGzVx wCiWhcipCeYc749L+qPBx3IB4XWByObGsgcSYbqq+6cmd5lm8MtWX6PMaolSQ0qX0R ViahospNGu3Ku5ug1XRtuDUm2LhNH7/fO2dv+RnYqk60lPBXEztEG5Hd1/edEsM4rP HHtzNHUvmcESA==
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.5.21 (2010-09-15)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 43
Organization linux.* mail to news gateway
X-Original-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
X-Original-Date Thu, 22 Sep 2016 16:45:06 +0200
X-Original-Message-ID <20160922144506.GK3541@8bytes.org>
X-Original-References <20160920134355.25470.93701.sendpatchset@little-apple> <20160920134446.25470.22322.sendpatchset@little-apple>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1488943

Show key headers only | View raw


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

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH v5 05/07] iommu/ipmmu-vmsa: Add new IOMMU_DOMAIN_DMA ops Magnus Damm <magnus.damm@gmail.com> - 2016-09-20 16:00 +0200
  Re: [PATCH v5 05/07] iommu/ipmmu-vmsa: Add new IOMMU_DOMAIN_DMA ops Joerg Roedel <joro@8bytes.org> - 2016-09-22 16:50 +0200

csiph-web