[PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-20 Thread Sven Peter via iommu
Hi, After Hector's initial work [1] to bring up Linux on Apple's M1 it's time to bring up more devices. Most peripherals connected to the SoC are behind a iommu which Apple calls "Device Address Resolution Table", or DART for short [2]. Unfortunately, it only shares the name with PowerPC's DART. C

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-21 Thread Sven Peter via iommu
Hi Mark, Sorry for the spam if you get this message twice. This is pretty embarrassing but I've just switched mail providers after ProtonMail messed up yesterday and it looks like my new one defaulted to sending HTML messages even though I only typed plaintext. This shouldn't have happened in t

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-21 Thread Sven Peter via iommu
Hi Mark, > On 21. Mar 2021, at 17:00, Mark Kettenis wrote: > > I don't think the first option is going to work for PCIe. PCIe > devices will have to use "iommu-map" properties to map PCI devices to > the right iommu, and the currently implementation seems to assume that > #iommu-cells = <1>.

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-21 Thread Mark Kettenis
> Date: Sat, 20 Mar 2021 15:19:33 + > From: Sven Peter > > Hi, > > After Hector's initial work [1] to bring up Linux on Apple's M1 it's time to > bring up more devices. Most peripherals connected to the SoC are behind a > iommu > which Apple calls "Device Address Resolution Table", or DART

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-21 Thread Mark Kettenis
> Date: Sun, 21 Mar 2021 18:22:15 +0100 > From: "Sven Peter" > > Hi Mark, > > On 21. Mar 2021, at 17:00, Mark Kettenis > wrote: > > I don't think the first option is going to work for PCIe. PCIe > devices will have to use "iommu-map" properties to map PCI devices to > the right iommu, an

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-22 Thread Sven Peter via iommu
Hi Mark, On Sun, Mar 21, 2021, at 19:35, Mark Kettenis wrote: > > Guess we do need to understand a little bit better how the USB DART > actually works. My hypothesis (based on our discussion on #asahi) is > that the XHCI host controller and the peripheral controller of the > DWC3 block use diff

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-23 Thread Mark Kettenis
> Date: Mon, 22 Mar 2021 23:17:31 +0100 > From: "Sven Peter" > > Hi Mark, > > On Sun, Mar 21, 2021, at 19:35, Mark Kettenis wrote: > > > > Guess we do need to understand a little bit better how the USB DART > > actually works. My hypothesis (based on our discussion on #asahi) is > > that the XH

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-23 Thread Rob Herring
On Sun, Mar 21, 2021 at 05:00:50PM +0100, Mark Kettenis wrote: > > Date: Sat, 20 Mar 2021 15:19:33 + > > From: Sven Peter > > > > Hi, > > > > After Hector's initial work [1] to bring up Linux on Apple's M1 it's time to > > bring up more devices. Most peripherals connected to the SoC are behi

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-23 Thread Sven Peter via iommu
Hi Mark, On Tue, Mar 23, 2021, at 21:00, Mark Kettenis wrote: > The problem with both #1 and #2 is that you end up with two references > to (effectively) different iommu's in the dwc3 device node. I don't > see how that is compatible with the idea of using a single translation > table for both su

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-23 Thread Mark Kettenis
> Date: Tue, 23 Mar 2021 14:53:46 -0600 > From: Rob Herring > > On Sun, Mar 21, 2021 at 05:00:50PM +0100, Mark Kettenis wrote: > > > Date: Sat, 20 Mar 2021 15:19:33 + > > > From: Sven Peter > > > > > > Hi, > > > > > > After Hector's initial work [1] to bring up Linux on Apple's M1 it's tim

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-24 Thread Robin Murphy
On 2021-03-20 15:19, Sven Peter wrote: Hi, After Hector's initial work [1] to bring up Linux on Apple's M1 it's time to bring up more devices. Most peripherals connected to the SoC are behind a iommu which Apple calls "Device Address Resolution Table", or DART for short [2]. Unfortunately, it on

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-25 Thread Sven Peter via iommu
On Tue, Mar 23, 2021, at 21:53, Rob Herring wrote: > On Sun, Mar 21, 2021 at 05:00:50PM +0100, Mark Kettenis wrote: > > > Date: Sat, 20 Mar 2021 15:19:33 + > > > From: Sven Peter > > > I have just noticed today though that at least the USB DWC3 controller in > > > host > > > mode uses *two

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-25 Thread Sven Peter via iommu
Hi Robin, On Wed, Mar 24, 2021, at 16:29, Robin Murphy wrote: > On 2021-03-20 15:19, Sven Peter wrote: > > > > I have just noticed today though that at least the USB DWC3 controller in > > host > > mode uses *two* darts at the same time. I'm not sure yet which parts seem to > > require which DA

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-25 Thread Robin Murphy
On 2021-03-25 07:53, Sven Peter wrote: On Tue, Mar 23, 2021, at 21:53, Rob Herring wrote: On Sun, Mar 21, 2021 at 05:00:50PM +0100, Mark Kettenis wrote: Date: Sat, 20 Mar 2021 15:19:33 + From: Sven Peter I have just noticed today though that at least the USB DWC3 controller in host mode

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-25 Thread Sven Peter via iommu
On Thu, Mar 25, 2021, at 12:50, Robin Murphy wrote: > On 2021-03-25 07:53, Sven Peter wrote: > > > > > > On Tue, Mar 23, 2021, at 21:53, Rob Herring wrote: > >> On Sun, Mar 21, 2021 at 05:00:50PM +0100, Mark Kettenis wrote: > >>> > >>> As I mentioned before, not all DARTs support the full 32-b

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-25 Thread Arnd Bergmann
On Thu, Mar 25, 2021 at 8:53 AM Sven Peter wrote: > On Tue, Mar 23, 2021, at 21:53, Rob Herring wrote: > > I'm probably just confused or maybe the documentation is outdated but I don't > see how I could specify "this device can only use DMA addresses from > 0x0010...0x3ff0 but can map thes

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-26 Thread Mark Kettenis
> From: Arnd Bergmann > Date: Thu, 25 Mar 2021 22:41:09 +0100 > > On Thu, Mar 25, 2021 at 8:53 AM Sven Peter wrote: > > On Tue, Mar 23, 2021, at 21:53, Rob Herring wrote: > > > > I'm probably just confused or maybe the documentation is outdated but I > > don't > > see how I could specify "this

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-26 Thread Arnd Bergmann
On Fri, Mar 26, 2021 at 4:59 PM Mark Kettenis wrote: > > > From: Arnd Bergmann > > Date: Thu, 25 Mar 2021 22:41:09 +0100 > > > > On Thu, Mar 25, 2021 at 8:53 AM Sven Peter wrote: > > > On Tue, Mar 23, 2021, at 21:53, Rob Herring wrote: > > > > > > I'm probably just confused or maybe the document

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-26 Thread Sven Peter via iommu
On Fri, Mar 26, 2021, at 16:59, Mark Kettenis wrote: > Some of the DARTs provide a bypass facility. That code make using the > standard "dma-ranges" property tricky. That property would need to > contain the bypass address range. But that would mean that if the > DART driver needs to look at

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-26 Thread Arnd Bergmann
On Fri, Mar 26, 2021 at 5:10 PM Sven Peter wrote: > On Fri, Mar 26, 2021, at 16:59, Mark Kettenis wrote: > > Some of the DARTs provide a bypass facility. That code make using the > > standard "dma-ranges" property tricky. That property would need to > > contain the bypass address range. But tha

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-26 Thread Sven Peter via iommu
On Fri, Mar 26, 2021, at 17:38, Arnd Bergmann wrote: > On Fri, Mar 26, 2021 at 5:10 PM Sven Peter wrote: > > On Fri, Mar 26, 2021, at 16:59, Mark Kettenis wrote: > > > Some of the DARTs provide a bypass facility. That code make using the > > > standard "dma-ranges" property tricky. That prope

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-26 Thread Mark Kettenis
> From: Arnd Bergmann > Date: Fri, 26 Mar 2021 17:38:24 +0100 > > On Fri, Mar 26, 2021 at 5:10 PM Sven Peter wrote: > > On Fri, Mar 26, 2021, at 16:59, Mark Kettenis wrote: > > > Some of the DARTs provide a bypass facility. That code make using the > > > standard "dma-ranges" property tricky.

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-26 Thread Robin Murphy
On 2021-03-26 17:26, Mark Kettenis wrote: From: Arnd Bergmann Date: Fri, 26 Mar 2021 17:38:24 +0100 On Fri, Mar 26, 2021 at 5:10 PM Sven Peter wrote: On Fri, Mar 26, 2021, at 16:59, Mark Kettenis wrote: Some of the DARTs provide a bypass facility. That code make using the standard "dma-rang

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-26 Thread Sven Peter via iommu
On Fri, Mar 26, 2021, at 18:34, Robin Murphy wrote: > On 2021-03-26 17:26, Mark Kettenis wrote: > > > > Anyway, from my viewpoint having the information about the IOVA > > address space sit on the devices makes little sense. This information > > is needed by the DART driver, and there is no di

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-26 Thread Arnd Bergmann
On Fri, Mar 26, 2021 at 6:51 PM Sven Peter wrote: > On Fri, Mar 26, 2021, at 18:34, Robin Murphy wrote: > > On 2021-03-26 17:26, Mark Kettenis wrote: > > > > > > Anyway, from my viewpoint having the information about the IOVA > > > address space sit on the devices makes little sense. This informa

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-26 Thread Arnd Bergmann
On Fri, Mar 26, 2021 at 6:28 PM Mark Kettenis wrote: > I haven't figured out how the bypass stuff really works. Corellium > added support for it in their codebase when they added support for > Thunderbolt, and some of the DARTs that seem to be related to > Thunderbolt do indeed have a "bypass" p

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-26 Thread Mark Kettenis
> From: Arnd Bergmann > Date: Fri, 26 Mar 2021 21:03:32 +0100 > > On Fri, Mar 26, 2021 at 6:28 PM Mark Kettenis wrote: > > > I haven't figured out how the bypass stuff really works. Corellium > > added support for it in their codebase when they added support for > > Thunderbolt, and some of th

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-26 Thread Mark Kettenis
> From: Arnd Bergmann > Date: Fri, 26 Mar 2021 20:59:58 +0100 > > On Fri, Mar 26, 2021 at 6:51 PM Sven Peter wrote: > > On Fri, Mar 26, 2021, at 18:34, Robin Murphy wrote: > > > On 2021-03-26 17:26, Mark Kettenis wrote: > > > > > > > > Anyway, from my viewpoint having the information about the I

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-27 Thread Sven Peter via iommu
On Fri, Mar 26, 2021, at 20:59, Arnd Bergmann wrote: > On Fri, Mar 26, 2021 at 6:51 PM Sven Peter wrote: > > dart-sio: 0021c000 fbde4000 (at least their Secure Enclave/TPM > > co-processor) > > Same here: > dart-sio { >vm-base = <0x0>; >vm-size = <0xfc00>; >p

Re: [PATCH 0/3] Apple M1 DART IOMMU driver

2021-03-27 Thread Sven Peter via iommu
Hi Robin, On Thu, Mar 25, 2021, at 12:50, Robin Murphy wrote: > On 2021-03-25 07:53, Sven Peter wrote: > > The iommu binding documentation [1] mentions that > > > > The device tree node of the IOMMU device's parent bus must contain a > > valid > > "dma-ranges" property that describes