From: Sven Peter via iommu <iommu@lists.linux-foundation.org>
To: "Will Deacon" <will@kernel.org>
Cc: Arnd Bergmann <arnd@kernel.org>,
devicetree@vger.kernel.org, Marc Zyngier <maz@kernel.org>,
Hector Martin <marcan@marcan.st>,
linux-kernel@vger.kernel.org,
Petr Mladek via iommu <iommu@lists.linux-foundation.org>,
Rob Herring <robh+dt@kernel.org>,
Mohamed Mediouni <mohamed.mediouni@caramail.com>,
Mark Kettenis <mark.kettenis@xs4all.nl>,
Robin Murphy <robin.murphy@arm.com>,
linux-arm-kernel@lists.infradead.org,
Stan Skowronek <stan@corellium.com>
Subject: Re: [PATCH v2 3/3] iommu: dart: Add DART iommu driver
Date: Fri, 09 Apr 2021 18:50:12 +0200 [thread overview]
Message-ID: <10040e18-6e49-432b-b85c-bcc1345a5e18@www.fastmail.com> (raw)
In-Reply-To: <20210407104209.GA15173@willie-the-truck>
On Wed, Apr 7, 2021, at 12:42, Will Deacon wrote:
> On Sun, Mar 28, 2021 at 09:40:09AM +0200, Sven Peter wrote:
> > Apple's new SoCs use iommus for almost all peripherals. These Device
> > Address Resolution Tables must be setup before these peripherals can
> > act as DMA masters.
> >
> > Signed-off-by: Sven Peter <sven@svenpeter.dev>
> > ---
> > MAINTAINERS | 1 +
> > drivers/iommu/Kconfig | 14 +
> > drivers/iommu/Makefile | 1 +
> > drivers/iommu/apple-dart-iommu.c | 858 +++++++++++++++++++++++++++++++
> > 4 files changed, 874 insertions(+)
> > create mode 100644 drivers/iommu/apple-dart-iommu.c
>
> [...]
>
> > +/* must be called with held domain->lock */
> > +static int apple_dart_attach_stream(struct apple_dart_domain *domain,
> > + struct apple_dart *dart, u32 sid)
> > +{
> > + unsigned long flags;
> > + struct apple_dart_stream *stream;
> > + struct io_pgtable_cfg *pgtbl_cfg;
> > + int ret;
> > +
> > + list_for_each_entry(stream, &domain->streams, stream_head) {
> > + if (stream->dart == dart && stream->sid == sid) {
> > + stream->num_devices++;
> > + return 0;
> > + }
> > + }
> > +
> > + spin_lock_irqsave(&dart->lock, flags);
> > +
> > + if (WARN_ON(dart->used_sids & BIT(sid))) {
> > + ret = -EINVAL;
> > + goto error;
> > + }
> > +
> > + stream = kzalloc(sizeof(*stream), GFP_KERNEL);
> > + if (!stream) {
> > + ret = -ENOMEM;
> > + goto error;
> > + }
>
> Just in case you missed it, a cocci bot noticed that you're using GFP_KERNEL
> to allocate while holding a spinlock here:
>
> https://lore.kernel.org/r/alpine.DEB.2.22.394.2104041724340.2958@hadrien
>
Thanks for the reminder!
I haven't replied yet because that one was found later when the bot picked up
a (slightly earlier) version that Marc was using to bring up pcie I believe.
I'll fix it for the next version.
Sven
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
prev parent reply other threads:[~2021-04-09 16:50 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-28 7:40 [PATCH v2 0/3] Apple M1 DART IOMMU driver Sven Peter via iommu
2021-03-28 7:40 ` [PATCH v2 1/3] iommu: io-pgtable: add DART pagetable format Sven Peter via iommu
2021-04-07 10:44 ` Will Deacon
2021-04-09 16:55 ` Sven Peter via iommu
2021-04-09 19:38 ` Arnd Bergmann
2021-04-19 16:31 ` Will Deacon
2021-03-28 7:40 ` [PATCH v2 2/3] dt-bindings: iommu: add DART iommu bindings Sven Peter via iommu
2021-03-28 8:16 ` Arnd Bergmann
2021-03-28 9:22 ` Sven Peter via iommu
2021-03-28 7:40 ` [PATCH v2 3/3] iommu: dart: Add DART iommu driver Sven Peter via iommu
2021-04-07 10:42 ` Will Deacon
2021-04-09 16:50 ` Sven Peter via iommu [this message]
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=10040e18-6e49-432b-b85c-bcc1345a5e18@www.fastmail.com \
--to=iommu@lists.linux-foundation.org \
--cc=arnd@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcan@marcan.st \
--cc=mark.kettenis@xs4all.nl \
--cc=maz@kernel.org \
--cc=mohamed.mediouni@caramail.com \
--cc=robh+dt@kernel.org \
--cc=robin.murphy@arm.com \
--cc=stan@corellium.com \
--cc=sven@svenpeter.dev \
--cc=will@kernel.org \
--subject='Re: [PATCH v2 3/3] iommu: dart: Add DART iommu driver' \
/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
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).