Skip to content

Commit 52a8fd2

Browse files
shimodayjoergroedel
authored andcommitted
iommu/ipmmu-vmsa: Allow PCIe devices
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 <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent aedd11e commit 52a8fd2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/iommu/ipmmu-vmsa.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <linux/of.h>
2121
#include <linux/of_device.h>
2222
#include <linux/of_platform.h>
23+
#include <linux/pci.h>
2324
#include <linux/platform_device.h>
2425
#include <linux/sizes.h>
2526
#include <linux/slab.h>
@@ -720,6 +721,10 @@ static bool ipmmu_device_is_allowed(struct device *dev)
720721
if (soc_device_match(soc_denylist))
721722
return false;
722723

724+
/* Check whether this device is a PCI device */
725+
if (dev_is_pci(dev))
726+
return true;
727+
723728
/* Check whether this device can work with the IPMMU */
724729
for (i = 0; i < ARRAY_SIZE(devices_allowlist); i++) {
725730
if (!strcmp(dev_name(dev), devices_allowlist[i]))

0 commit comments

Comments
 (0)