[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YNx2U4GPoKxV3PWd@maud>
Date: Wed, 30 Jun 2021 09:49:07 -0400
From: Alyssa Rosenzweig <alyssa@...labora.com>
To: Sven Peter <sven@...npeter.dev>
Cc: Will Deacon <will@...nel.org>, Robin Murphy <robin.murphy@....com>,
Joerg Roedel <joro@...tes.org>,
Arnd Bergmann <arnd@...nel.org>, devicetree@...r.kernel.org,
Hector Martin <marcan@...can.st>, linux-kernel@...r.kernel.org,
Marc Zyngier <maz@...nel.org>,
Mohamed Mediouni <mohamed.mediouni@...amail.com>,
Stan Skowronek <stan@...ellium.com>,
linux-arm-kernel@...ts.infradead.org,
Mark Kettenis <mark.kettenis@...all.nl>,
iommu@...ts.linux-foundation.org, Alexander Graf <graf@...zon.com>,
Alyssa Rosenzweig <alyssa.rosenzweig@...labora.com>,
Rob Herring <robh+dt@...nel.org>, r.czerwinski@...gutronix.de
Subject: Re: [PATCH v4 3/3] iommu: dart: Add DART iommu driver
Looks really good! Just a few minor comments. With them addressed,
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@...labora.com>
> + Say Y here if you are using an Apple SoC with a DART IOMMU.
Nit: Do we need to spell out "with a DART IOMMU"? Don't all the apple
socs need DART?
> +/*
> + * This structure is used to identify a single stream attached to a domain.
> + * It's used as a list inside that domain to be able to attach multiple
> + * streams to a single domain. Since multiple devices can use a single stream
> + * it additionally keeps track of how many devices are represented by this
> + * stream. Once that number reaches zero it is detached from the IOMMU domain
> + * and all translations from this stream are disabled.
> + *
> + * @dart: DART instance to which this stream belongs
> + * @sid: stream id within the DART instance
> + * @num_devices: count of devices attached to this stream
> + * @stream_head: list head for the next stream
> + */
> +struct apple_dart_stream {
> + struct apple_dart *dart;
> + u32 sid;
> +
> + u32 num_devices;
> +
> + struct list_head stream_head;
> +};
It wasn't obvious to me why we can get away without reference counting.
Looking ahead it looks like we assert locks in each case. Maybe add
that to the comment?
```
> +static void apple_dart_hw_set_ttbr(struct apple_dart *dart, u16 sid, u16 idx,
> + phys_addr_t paddr)
> +{
> + writel(DART_TTBR_VALID | (paddr >> DART_TTBR_SHIFT),
> + dart->regs + DART_TTBR(sid, idx));
> +}
```
Should we be checking alignment here? Something like
BUG_ON(paddr & ((1 << DART_TTBR_SHIFT) - 1));
Powered by blists - more mailing lists