From: joro@8bytes.org (Joerg Roedel)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC] iommu: arm-smmu: stall support
Date: Tue, 19 Sep 2017 14:30:38 +0200 [thread overview]
Message-ID: <20170919123038.GF8398@8bytes.org> (raw)
In-Reply-To: <20170914194444.32551-1-robdclark@gmail.com>
Hi Rob,
thanks for the RFC patch. I have some comments about the interface to
the IOMMU-API below.
On Thu, Sep 14, 2017 at 03:44:33PM -0400, Rob Clark wrote:
> +/**
> + * iommu_domain_resume - Resume translations for a domain after a fault.
> + *
> + * This can be called at some point after the fault handler is called,
> + * allowing the user of the IOMMU to (for example) handle the fault
> + * from a task context. It is illegal to call this if
> + * iommu_domain_set_attr(STALL) failed.
> + *
> + * @domain: the domain to resume
> + * @terminate: if true, the translation that triggered the fault should
> + * be terminated, else it should be retried.
> + */
> +void iommu_domain_resume(struct iommu_domain *domain, bool terminate)
> +{
> + /* invalid to call if iommu_domain_set_attr(STALL) failed: */
> + if (WARN_ON(!domain->ops->domain_resume))
> + return;
> + domain->ops->domain_resume(domain, terminate);
> +}
> +EXPORT_SYMBOL_GPL(iommu_domain_resume);
So this function is being called by the device driver owning the domain,
right?
I don't think that the resume call-back you added needs to be exposed
like this. It is better to do the page-fault handling completly in the
iommu-code, including calling the resume call-back and just let the
device-driver provide a per-domain call-back to let it handle the fault
and map in the required pages.
The interface could look like this:
* New function iommu_domain_enable_stalls(domain) - When
this function returns the domain is in stall-handling mode. A
iommu_domain_disable_stalls() might make sense too, not sure
about that.
* When stalls are enabled for a domain, report_iommu_fault()
queues the fault to a workqueue (so that its handler can
block) and in the workqueue you call ->resume() based on the
return value of the handler.
As a side-note, as there has been discussion on this: For now it doesn't
make sense to merge this with the SVM page-fault handling efforts, as
this path is different enough (SVM will call handle_mm_fault() as the
handler, for example).
Regards,
Joerg
next prev parent reply other threads:[~2017-09-19 12:30 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-14 19:44 [RFC] iommu: arm-smmu: stall support Rob Clark
2017-09-18 11:13 ` Jean-Philippe Brucker
2017-09-18 12:11 ` Rob Clark
2017-09-18 17:33 ` Will Deacon
2017-09-19 12:30 ` Joerg Roedel [this message]
2017-09-19 14:23 ` Rob Clark
2017-09-22 9:02 ` Joerg Roedel
2017-09-22 10:02 ` Jean-Philippe Brucker
2017-09-22 18:42 ` Rob Clark
2017-09-27 12:15 ` Joerg Roedel
2017-09-27 13:49 ` Jean-Philippe Brucker
2017-09-27 14:35 ` Joerg Roedel
2017-09-27 16:14 ` Rob Clark
2019-05-10 18:23 ` Rob Clark
2019-05-13 18:37 ` Jean-Philippe Brucker
2019-05-14 1:54 ` Rob Clark
2019-05-14 10:24 ` Robin Murphy
2019-05-14 17:17 ` 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=20170919123038.GF8398@8bytes.org \
--to=joro@8bytes.org \
--cc=linux-arm-kernel@lists.infradead.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 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).