On Fri, Jul 28, 2023 at 4:40 AM Yoshihiro Shimoda <yoshihiro.shimoda.uh@xxxxxxxxxxx> wrote: > IPMMU hardware on R-Car Gen3 and RZ/G2 is simple. Each bus-master > device like eMMC host and PCIe controllers has a micro-TLB of > The IPMMU, and after enabled it, all transactions of the device are > under the IPMMU. > > eMMC host ---(micro-TLB of eMMC)--- IPMMU cache --- IPMMU main > PCIe --------(micro-TLB of PCIe)--- IPMMU cache --- IPMMU main > > Now this IPMMU driver allows eMMC host, and it is safe to use > the IPMMU. So, we can assume that it is safe to use the IPMMU > from PCIe devices too, because all PCIe devices transactions will > go to the micro-TLB of PCIe. So, add a new condition whether > the device is a PCIe device or not in the ipmmu_device_is_allowed() > which will be called if the PCIe host controller has iommu-map > property. > > This can improve CPU load because the PCIe controllers only have > a capability for lower 32-bit memory area so that this can avoid > using swiotlb. > > Note that IPMMU on R-Car Gen4 is different than R-Car Gen3 and > RZ/G2's one, especially OS-ID. But, for now, the IPMMU driver > takes care of OS-ID 0 only. In other words, all PCIe devices will > go to the micro-TLB of PCIe. > > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@xxxxxxxxxxx> > --- > Changes from v3: > https://lore.kernel.org/all/20230529063928.1030014-1-yoshihiro.shimoda.uh@xxxxxxxxxxx/ > - Rebase the latest iommu/next branch. Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx> Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds