All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Ohad Ben-Cohen <ohad@wizery.com>
Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	Tony Lindgren <tony@atomide.com>,
	Hiroshi DOYU <Hiroshi.DOYU@nokia.com>,
	Joerg Roedel <Joerg.Roedel@amd.com>,
	Arnd Bergmann <arnd@arndb.de>,
	iommu@lists.linux-foundation.org
Subject: Re: [PATCH 1/7] omap: iommu: migrate to the generic IOMMU API
Date: Thu, 18 Aug 2011 11:01:57 +0200	[thread overview]
Message-ID: <201108181101.57882.laurent.pinchart@ideasonboard.com> (raw)
In-Reply-To: <1313622608-30397-2-git-send-email-ohad@wizery.com>

Hi Ohad,

Thanks for the patch.

Just one small comment in case you resubmit the whole series for another 
reason.

On Thursday 18 August 2011 01:10:02 Ohad Ben-Cohen wrote:
> Migrate OMAP's iommu driver to the generic IOMMU API, so users can stay
> generic, and any generic IOMMU functionality can be developed once
> in the generic framework.
> 
> Migrate omap's iovmm (virtual memory manager) to the generic IOMMU API,
> and adapt omap3isp as needed, so the latter won't break.
> 
> The plan is to eventually remove iovmm completely by replacing it
> with the (upcoming) IOMMU-based DMA-API.
> 
> Tested on OMAP3 (with omap3isp) and OMAP4 (with rpmsg/remoteproc).
> 
> Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>

[snip]

> +static void omap_iommu_detach_dev(struct iommu_domain *domain,
> +				 struct device *dev)
> +{
> +	struct omap_iommu_domain *omap_domain = domain->priv;
> +	struct iommu *oiommu = to_iommu(dev);
> +
> +	mutex_lock(&omap_domain->lock);
> +
> +	/* only a single device is supported per domain for now */
> +	if (omap_domain->iommu_dev != oiommu) {
> +		dev_err(dev, "invalid iommu device\n");
> +		goto out;
> +	}
> +
> +	iopgtable_clear_entry_all(oiommu);
> +
> +	omap_iommu_detach(oiommu);
> +
> +	omap_domain->iommu_dev = NULL;
> +
> +out:
> +	mutex_unlock(&omap_domain->lock);
> +}
> +
> +static int omap_iommu_domain_init(struct iommu_domain *domain)
> +{
> +	struct omap_iommu_domain *omap_domain;
> +
> +	omap_domain = kzalloc(sizeof(*omap_domain), GFP_KERNEL);
> +	if (!omap_domain) {
> +		pr_err("kzalloc failed\n");
> +		goto out;

You can directly return -ENOMEM here, and remove the "out:" label.

> +	}
> +
> +	omap_domain->pgtable = kzalloc(IOPGD_TABLE_SIZE, GFP_KERNEL);
> +	if (!omap_domain->pgtable) {
> +		pr_err("kzalloc failed\n");
> +		goto fail_nomem;
> +	}
> +
> +	/*
> +	 * should never fail, but please keep this around to ensure
> +	 * we keep the hardware happy
> +	 */
> +	BUG_ON(!IS_ALIGNED((long)omap_domain->pgtable, IOPGD_TABLE_SIZE));
> +
> +	clean_dcache_area(omap_domain->pgtable, IOPGD_TABLE_SIZE);
> +	mutex_init(&omap_domain->lock);
> +
> +	domain->priv = omap_domain;
> +
> +	return 0;
> +
> +fail_nomem:
> +	kfree(omap_domain);
> +out:
> +	return -ENOMEM;
> +}

-- 
Regards,

Laurent Pinchart

WARNING: multiple messages have this Message-ID (diff)
From: laurent.pinchart@ideasonboard.com (Laurent Pinchart)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/7] omap: iommu: migrate to the generic IOMMU API
Date: Thu, 18 Aug 2011 11:01:57 +0200	[thread overview]
Message-ID: <201108181101.57882.laurent.pinchart@ideasonboard.com> (raw)
In-Reply-To: <1313622608-30397-2-git-send-email-ohad@wizery.com>

Hi Ohad,

Thanks for the patch.

Just one small comment in case you resubmit the whole series for another 
reason.

On Thursday 18 August 2011 01:10:02 Ohad Ben-Cohen wrote:
> Migrate OMAP's iommu driver to the generic IOMMU API, so users can stay
> generic, and any generic IOMMU functionality can be developed once
> in the generic framework.
> 
> Migrate omap's iovmm (virtual memory manager) to the generic IOMMU API,
> and adapt omap3isp as needed, so the latter won't break.
> 
> The plan is to eventually remove iovmm completely by replacing it
> with the (upcoming) IOMMU-based DMA-API.
> 
> Tested on OMAP3 (with omap3isp) and OMAP4 (with rpmsg/remoteproc).
> 
> Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>

[snip]

> +static void omap_iommu_detach_dev(struct iommu_domain *domain,
> +				 struct device *dev)
> +{
> +	struct omap_iommu_domain *omap_domain = domain->priv;
> +	struct iommu *oiommu = to_iommu(dev);
> +
> +	mutex_lock(&omap_domain->lock);
> +
> +	/* only a single device is supported per domain for now */
> +	if (omap_domain->iommu_dev != oiommu) {
> +		dev_err(dev, "invalid iommu device\n");
> +		goto out;
> +	}
> +
> +	iopgtable_clear_entry_all(oiommu);
> +
> +	omap_iommu_detach(oiommu);
> +
> +	omap_domain->iommu_dev = NULL;
> +
> +out:
> +	mutex_unlock(&omap_domain->lock);
> +}
> +
> +static int omap_iommu_domain_init(struct iommu_domain *domain)
> +{
> +	struct omap_iommu_domain *omap_domain;
> +
> +	omap_domain = kzalloc(sizeof(*omap_domain), GFP_KERNEL);
> +	if (!omap_domain) {
> +		pr_err("kzalloc failed\n");
> +		goto out;

You can directly return -ENOMEM here, and remove the "out:" label.

> +	}
> +
> +	omap_domain->pgtable = kzalloc(IOPGD_TABLE_SIZE, GFP_KERNEL);
> +	if (!omap_domain->pgtable) {
> +		pr_err("kzalloc failed\n");
> +		goto fail_nomem;
> +	}
> +
> +	/*
> +	 * should never fail, but please keep this around to ensure
> +	 * we keep the hardware happy
> +	 */
> +	BUG_ON(!IS_ALIGNED((long)omap_domain->pgtable, IOPGD_TABLE_SIZE));
> +
> +	clean_dcache_area(omap_domain->pgtable, IOPGD_TABLE_SIZE);
> +	mutex_init(&omap_domain->lock);
> +
> +	domain->priv = omap_domain;
> +
> +	return 0;
> +
> +fail_nomem:
> +	kfree(omap_domain);
> +out:
> +	return -ENOMEM;
> +}

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2011-08-18  9:01 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-17 23:10 [PATCH 0/7] omap: iommu migration, relocation and cleanups Ohad Ben-Cohen
2011-08-17 23:10 ` Ohad Ben-Cohen
2011-08-17 23:10 ` [PATCH 1/7] omap: iommu: migrate to the generic IOMMU API Ohad Ben-Cohen
2011-08-17 23:10   ` Ohad Ben-Cohen
2011-08-18  9:01   ` Laurent Pinchart [this message]
2011-08-18  9:01     ` Laurent Pinchart
2011-08-18  9:05     ` Ohad Ben-Cohen
2011-08-18  9:05       ` Ohad Ben-Cohen
2011-08-18 13:35     ` Arnd Bergmann
2011-08-18 13:35       ` Arnd Bergmann
2011-08-23 14:07   ` Roedel, Joerg
2011-08-23 14:07     ` Roedel, Joerg
2011-08-23 14:59     ` Ohad Ben-Cohen
2011-08-23 14:59       ` Ohad Ben-Cohen
2011-08-24 12:46       ` Ohad Ben-Cohen
2011-08-24 12:46         ` Ohad Ben-Cohen
2011-08-24 13:15         ` Roedel, Joerg
2011-08-24 13:15           ` Roedel, Joerg
2011-08-24 14:46           ` Ohad Ben-Cohen
2011-08-24 14:46             ` Ohad Ben-Cohen
2011-08-17 23:10 ` [PATCH 2/7] omap: iommu/iovmm: move to dedicated iommu folder Ohad Ben-Cohen
2011-08-17 23:10   ` Ohad Ben-Cohen
2011-08-18 13:38   ` Arnd Bergmann
2011-08-18 13:38     ` Arnd Bergmann
2011-08-18 13:53     ` Ohad Ben-Cohen
2011-08-18 13:53       ` Ohad Ben-Cohen
2011-08-17 23:10 ` [PATCH 3/7] omap: iommu: stop exporting local functions Ohad Ben-Cohen
2011-08-17 23:10   ` Ohad Ben-Cohen
2011-08-17 23:10 ` [PATCH 4/7] omap: iommu: PREFETCH_IOTLB cleanup Ohad Ben-Cohen
2011-08-17 23:10   ` Ohad Ben-Cohen
2011-08-18  5:27   ` Hiroshi DOYU
2011-08-18  5:27     ` Hiroshi DOYU
2011-08-18  6:33     ` Ohad Ben-Cohen
2011-08-18  6:33       ` Ohad Ben-Cohen
2011-08-17 23:10 ` [PATCH 5/7] omap: iovmm: remove unused functionality Ohad Ben-Cohen
2011-08-17 23:10   ` Ohad Ben-Cohen
2011-08-18 10:19   ` Hiroshi DOYU
2011-08-18 10:19     ` Hiroshi DOYU
2011-08-18 10:23     ` Ohad Ben-Cohen
2011-08-18 10:23       ` Ohad Ben-Cohen
2011-08-18 12:45       ` Hiroshi DOYU
2011-08-18 12:45         ` Hiroshi DOYU
2011-08-17 23:10 ` [PATCH 6/7] omap: iommu: remove unused exported API Ohad Ben-Cohen
2011-08-17 23:10   ` Ohad Ben-Cohen
2011-08-18 10:49   ` Hiroshi DOYU
2011-08-18 10:49     ` Hiroshi DOYU
2011-08-18 11:01     ` Ohad Ben-Cohen
2011-08-18 11:01       ` Ohad Ben-Cohen
2011-08-18 13:40       ` David Cohen
2011-08-18 13:40         ` David Cohen
2011-08-18 13:45         ` Ohad Ben-Cohen
2011-08-18 13:45           ` Ohad Ben-Cohen
2011-08-17 23:10 ` [PATCH 7/7] omap: iommu: omapify 'struct iommu' and exposed API Ohad Ben-Cohen
2011-08-17 23:10   ` Ohad Ben-Cohen
2011-08-18  9:12 ` [PATCH 0/7] omap: iommu migration, relocation and cleanups Laurent Pinchart
2011-08-18  9:12   ` Laurent Pinchart
2011-08-18 10:50   ` Hiroshi DOYU
2011-08-18 10:50     ` Hiroshi DOYU
2011-08-23 14:26 ` Roedel, Joerg
2011-08-23 14:26   ` Roedel, Joerg
2011-08-23 15:15   ` Ohad Ben-Cohen
2011-08-23 15:15     ` Ohad Ben-Cohen

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=201108181101.57882.laurent.pinchart@ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=Hiroshi.DOYU@nokia.com \
    --cc=Joerg.Roedel@amd.com \
    --cc=arnd@arndb.de \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=ohad@wizery.com \
    --cc=tony@atomide.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 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.