All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joerg Roedel <joro@8bytes.org>
To: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Cc: iommu@lists.linux-foundation.org, linux-sh@vger.kernel.org
Subject: Re: [PATCH v3] iommu: Add driver for Renesas VMSA-compatible IPMMU
Date: Tue, 13 May 2014 19:55:29 +0200	[thread overview]
Message-ID: <20140513175529.GD23770@8bytes.org> (raw)
In-Reply-To: <1396435657-3922-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com>

Hi Laurent,

Sorry for taking so long with this. The code looks good and clean
overall, besides my second comment.

On Wed, Apr 02, 2014 at 12:47:37PM +0200, Laurent Pinchart wrote:
> +static void ipmmu_domain_destroy_context(struct ipmmu_vmsa_domain *domain)
> +{
> +	/*
> +	 * Disable the context. Flush the TLB as required when modifying the
> +	 * context registers.
> +	 *
> +	 * TODO: Is TLB flush really needed ?
> +	 */
> +	ipmmu_ctx_write(domain, IMCTR, IMCTR_FLUSH);
> +	ipmmu_tlb_sync(domain);

Isn't this the same as ipmmu_tlb_invalidate()?

> +static int ipmmu_attach_device(struct iommu_domain *io_domain,
> +			       struct device *dev)
> +{
> +	struct ipmmu_vmsa_device *mmu = dev->archdata.iommu;
> +	struct ipmmu_vmsa_domain *domain = io_domain->priv;
> +	const struct ipmmu_vmsa_master *master;
> +	unsigned long flags;
> +	int ret = 0;
> +
> +	if (!mmu) {
> +		dev_err(dev, "Cannot attach to IPMMU\n");
> +		return -ENXIO;
> +	}
> +
> +	spin_lock_irqsave(&domain->lock, flags);
> +
> +	if (!domain->mmu) {
> +		/* The domain hasn't been used yet, initialize it. */
> +		domain->mmu = mmu;
> +		ret = ipmmu_domain_init_context(domain);
> +	} else if (domain->mmu != mmu) {
> +		/*
> +		 * Something is wrong, we can't attach two devices using
> +		 * different IOMMUs to the same domain.
> +		 */

Why not? This is something the IOMMU-API basically supports (multiple
devices behind different IOMMUs in the same domain). Can't you just use
the same page-table for different IOMMUs?


	Joerg



WARNING: multiple messages have this Message-ID (diff)
From: Joerg Roedel <joro@8bytes.org>
To: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Cc: iommu@lists.linux-foundation.org, linux-sh@vger.kernel.org
Subject: Re: [PATCH v3] iommu: Add driver for Renesas VMSA-compatible IPMMU
Date: Tue, 13 May 2014 17:55:29 +0000	[thread overview]
Message-ID: <20140513175529.GD23770@8bytes.org> (raw)
In-Reply-To: <1396435657-3922-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com>

Hi Laurent,

Sorry for taking so long with this. The code looks good and clean
overall, besides my second comment.

On Wed, Apr 02, 2014 at 12:47:37PM +0200, Laurent Pinchart wrote:
> +static void ipmmu_domain_destroy_context(struct ipmmu_vmsa_domain *domain)
> +{
> +	/*
> +	 * Disable the context. Flush the TLB as required when modifying the
> +	 * context registers.
> +	 *
> +	 * TODO: Is TLB flush really needed ?
> +	 */
> +	ipmmu_ctx_write(domain, IMCTR, IMCTR_FLUSH);
> +	ipmmu_tlb_sync(domain);

Isn't this the same as ipmmu_tlb_invalidate()?

> +static int ipmmu_attach_device(struct iommu_domain *io_domain,
> +			       struct device *dev)
> +{
> +	struct ipmmu_vmsa_device *mmu = dev->archdata.iommu;
> +	struct ipmmu_vmsa_domain *domain = io_domain->priv;
> +	const struct ipmmu_vmsa_master *master;
> +	unsigned long flags;
> +	int ret = 0;
> +
> +	if (!mmu) {
> +		dev_err(dev, "Cannot attach to IPMMU\n");
> +		return -ENXIO;
> +	}
> +
> +	spin_lock_irqsave(&domain->lock, flags);
> +
> +	if (!domain->mmu) {
> +		/* The domain hasn't been used yet, initialize it. */
> +		domain->mmu = mmu;
> +		ret = ipmmu_domain_init_context(domain);
> +	} else if (domain->mmu != mmu) {
> +		/*
> +		 * Something is wrong, we can't attach two devices using
> +		 * different IOMMUs to the same domain.
> +		 */

Why not? This is something the IOMMU-API basically supports (multiple
devices behind different IOMMUs in the same domain). Can't you just use
the same page-table for different IOMMUs?


	Joerg



  parent reply	other threads:[~2014-05-13 17:55 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-02 10:47 [PATCH v3] iommu: Add driver for Renesas VMSA-compatible IPMMU Laurent Pinchart
2014-04-02 10:47 ` Laurent Pinchart
2014-04-09 10:43 ` Laurent Pinchart
2014-04-09 10:43   ` Laurent Pinchart
2014-04-09 10:57   ` Joerg Roedel
2014-04-09 10:57     ` Joerg Roedel
2014-04-09 10:58     ` Laurent Pinchart
2014-04-09 11:00       ` Laurent Pinchart
     [not found]     ` <20140409105703.GV13491-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2014-04-17 10:14       ` Laurent Pinchart
2014-04-17 10:14         ` Laurent Pinchart
2014-05-02 19:46         ` Laurent Pinchart
2014-05-02 19:46           ` Laurent Pinchart
2014-05-13 17:55 ` Joerg Roedel [this message]
2014-05-13 17:55   ` Joerg Roedel
2014-05-13 21:04   ` Laurent Pinchart
2014-05-13 21:04     ` Laurent Pinchart
2014-05-13 22:00     ` Joerg Roedel
2014-05-13 22:00       ` Joerg Roedel
2014-05-15 10:16       ` Laurent Pinchart
2014-05-15 10:16         ` Laurent Pinchart
2014-06-03  4:57 ` Khiem Nguyen
2014-06-03  4:57   ` Khiem Nguyen
     [not found]   ` <538D55C2.3090209-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2014-06-03 17:39     ` Laurent Pinchart
2014-06-03 17:39       ` Laurent Pinchart
2014-07-09 23:20       ` Khiem Nguyen
2014-07-09 23:20         ` Khiem Nguyen

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=20140513175529.GD23770@8bytes.org \
    --to=joro@8bytes.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --cc=linux-sh@vger.kernel.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.