All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Rob Clark <robdclark@gmail.com>
Cc: linux-arm-msm@vger.kernel.org, iommu@lists.linux-foundation.org
Subject: Re: [RFC] iommu: qcom-iommu-v0 IOMMU
Date: Thu, 10 Jul 2014 14:53:48 -0700	[thread overview]
Message-ID: <20140710215348.GQ20486@codeaurora.org> (raw)
In-Reply-To: <1405020077-16148-1-git-send-email-robdclark@gmail.com>

On 07/10, Rob Clark wrote:
> So, in it's current form, this is superficially a copy of msm_iommu
> plus DT conversion.  But the pre-DT IOMMU driver had fairly different
> structure.. ie. psuedo root device, with IOMMU devices hanging off
> that, and context devices hanging off that.  The context devices were
> what the client device would attach (which was also somewhat non-
> standard.. see msm_iommu_get_ctx()).
> 
> I couldn't really think of some sane way to refactor this and add DT
> while at the same time keeping compatibility with the old pre-DT msm
> stuff.  So I copied to a new driver.
> 
> It was pointed out that nothing upstream actually *used* the msm_iommu
> driver.  So if no one objects to dropping pre-DT support, then I could
> do some patch rejuggling + sed to make this replace the old driver
> instead.

+1

> +
> +// TODO any good reason for global lock vs per-iommu lock?
> +DEFINE_SPINLOCK(qcom_iommu_lock);

static?

> +static LIST_HEAD(qcom_iommu_devices);
> +
> +/* Note that a single iommu_domain can, for devices sitting behind
> + * more than one IOMMU (ie. one per AXI interface) will have more
> + * than one iommu in the iommu_list.  But all are programmed to
> + * point at the same pagetables so from client device perspective
> + * they act as a single IOMMU.
> + */
> +struct qcom_domain_priv {
> +	unsigned long *pgtable;
> +	struct list_head iommu_list;  /* list of attached 'struct qcom_iommu' */
> +};
> +
> +static int __enable_clocks(struct qcom_iommu *iommu)
> +{
> +	int ret;
> +
> +	ret = clk_prepare_enable(iommu->pclk);

Looks like __enable_clocks() is called from within a spinlock
sometimes. Please move the prepare call outside of any atomic
sections and also enable CONFIG_PROVE_LOCKING and/or
CONFIG_DEBUG_ATOMIC_SLEEP to find such problems.

> +	if (ret)
> +		goto fail;
> +
> +	if (iommu->clk) {
> +		ret = clk_prepare_enable(iommu->clk);
> +		if (ret)
> +			clk_disable_unprepare(iommu->pclk);
> +	}
> +fail:
> +	return ret;
> +}
> +

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

  reply	other threads:[~2014-07-10 21:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-10 19:21 [RFC] iommu: qcom-iommu-v0 IOMMU Rob Clark
2014-07-10 21:53 ` Stephen Boyd [this message]
     [not found]   ` <20140710215348.GQ20486-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2014-07-10 23:47     ` Rob Clark

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=20140710215348.GQ20486@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=robdclark@gmail.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.