diff options
author | Giacomo Travaglini <giacomo.travaglini@arm.com> | 2019-08-14 11:35:51 +0100 |
---|---|---|
committer | Giacomo Travaglini <giacomo.travaglini@arm.com> | 2019-09-13 08:14:24 +0000 |
commit | 3d494d763d1be011a30333f8036d718c4070ef25 (patch) | |
tree | b17e853afdb96bba4f7dea9f0e8383a51ca086c5 /src | |
parent | b87670f17242f7e171df12c22e9f3e769a241836 (diff) | |
download | gem5-3d494d763d1be011a30333f8036d718c4070ef25.tar.xz |
dev: Enable DTB IOMMU binding with a DMA object
This happens by storing a iommu reference in the dma device, and by
calling the addIommuProperty method once doing dtb autogeneration for
the device
Change-Id: Ibd585addac686a9eeaba6959f459d81901087549
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Ciro Santilli <ciro.santilli@arm.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/20839
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/dev/Device.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/dev/Device.py b/src/dev/Device.py index 0023f97a2..493089524 100644 --- a/src/dev/Device.py +++ b/src/dev/Device.py @@ -1,4 +1,4 @@ -# Copyright (c) 2012-2016 ARM Limited +# Copyright (c) 2012-2016,2019 ARM Limited # All rights reserved. # # The license below extends only to copyright in the software and shall @@ -84,6 +84,8 @@ class DmaDevice(PioDevice): abstract = True dma = MasterPort("DMA port") + _iommu = None + sid = Param.Unsigned(0, "Stream identifier used by an IOMMU to distinguish amongst " "several devices attached to it") @@ -91,6 +93,17 @@ class DmaDevice(PioDevice): "Substream identifier used by an IOMMU to distinguish amongst " "several devices attached to it") + def addIommuProperty(self, state, node): + """ + This method takes an FdtState and a FdtNode as parameters, and + it is appending a "iommus = <>" property in case the DmaDevice + is attached to an IOMMU. + This method is necessary for autogenerating a binding between + a dma device and the iommu. + """ + if self._iommu is not None: + node.append(FdtPropertyWords("iommus", + [ state.phandle(self._iommu), self.sid ])) class IsaFake(BasicPioDevice): type = 'IsaFake' |