diff options
author | Mark Kettenis <kettenis@openbsd.org> | 2021-10-23 16:58:01 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-10-31 08:46:44 -0400 |
commit | 40dbf03d7d2dd2b5516f797069e3ea830db6fecc (patch) | |
tree | 130f479f79def7c72f81cf6ffd834a0c9c2bf82e /drivers/core/device.c | |
parent | d73db3042734f8077a5866d9d60d2eeda685b2ec (diff) | |
download | u-boot-40dbf03d7d2dd2b5516f797069e3ea830db6fecc.zip u-boot-40dbf03d7d2dd2b5516f797069e3ea830db6fecc.tar.gz u-boot-40dbf03d7d2dd2b5516f797069e3ea830db6fecc.tar.bz2 |
iommu: Add IOMMU uclass
This uclass is intended to manage IOMMUs on systems where the
IOMMUs are not in bypass mode by default. In that case U-Boot
cannot ignore the IOMMUs if it wants to use devices that need
to do DMA and sit behind such an IOMMU.
This initial IOMMU uclass implementation does not implement and
device ops and is intended for IOMMUs that have a bypass mode
that does not require address translation. Support for IOMMUs
that do require address translation is planned and device ops
will be defined when support for such IOMMUs will be added.
Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/core/device.c')
-rw-r--r-- | drivers/core/device.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/core/device.c b/drivers/core/device.c index d7a778a..efd0717 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -28,6 +28,7 @@ #include <dm/uclass.h> #include <dm/uclass-internal.h> #include <dm/util.h> +#include <iommu.h> #include <linux/err.h> #include <linux/list.h> #include <power-domain.h> @@ -543,6 +544,13 @@ int device_probe(struct udevice *dev) goto fail; } + if (CONFIG_IS_ENABLED(IOMMU) && dev->parent && + (device_get_uclass_id(dev) != UCLASS_IOMMU)) { + ret = dev_iommu_enable(dev); + if (ret) + goto fail; + } + ret = device_get_dma_constraints(dev); if (ret) goto fail; |