From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hiroshi Doyu Subject: Re: Tegra-DRM: Tegra30: DMA mapping API (was: About dma mapping apis) Date: Tue, 10 Jul 2012 13:24:17 +0300 Message-ID: <20120710132417.b52fbc05847cabec7e16cebd@nvidia.com> References: <23B010BBA481A74B98487467C29BA57BF2366A1010@HKMAIL01.nvidia.com> <20120706.092417.916278591811517036.hdoyu@nvidia.com> <23B010BBA481A74B98487467C29BA57BF2366A1012@HKMAIL01.nvidia.com> <20120709.182828.1247752887335819184.hdoyu@nvidia.com> <1341908041.9360.6.camel@markz-desktop> Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1341908041.9360.6.camel@markz-desktop> Sender: linux-tegra-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Mark Zhang Cc: Peer Chen , Wei Ni , Emily Jiang , Alex Courbot , "thierry.reding-RM9K5IK7kjKj5M59NBduVrNAH6kLmebB@public.gmane.org" , Ken Adams , "linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" List-Id: linux-tegra@vger.kernel.org On Tue, 10 Jul 2012 10:14:01 +0200 markz wrote: > On Mon, 2012-07-09 at 23:28 +0800, Hiroshi Doyu wrote: > > Hi Mark, adding linux-tegra on Cc:.... > > > > Mark Zhang wrote @ Mon, 9 Jul 2012 14:13:13 +0200: > > > > > > Hi Mark, Cc: Thierry & Ken, > > > > > > > > Can GEM allow DRM to use contigious memory? That could be easier. > > > > > > > > Otherwise, I think that you need to make drv->dev iommu'able before > > > > calling DMA API if you want to use IOMMU. To make drv->dev iommu'able, > > > > you need to call arm_iommu_create_mapping() and arm_iommu_attach_device(). > > > > > > Thank you. Yes, we need to call these functions otherwise iommu will not be enabled at all. > > > So my question is: > > > 1. in arm_iommu_create_mapping, we need to specify the base address > > > of the iova. Is these an API which can get this base address? I > > > mean, SMMU serves a lot of clients and maybe every client will > > > specify a range of iova which it needs. So as the center point of > > > these clients, does SMMU module has a function which can be used by > > > client to get this base address? > > > > The SMMU patch was sent but it depends on the following framework. > > > > [PATCH 0/5] IOMMU: Make IOMMU-API ready for GART-like hardware > > https://lkml.org/lkml/2012/1/19/170 > > > > Got it. Seems this patch hasn't been integrated yet. Besides, SMMU > module should do some implementations for this set/get attribute > functions as well, right? Yes, that's below: http://lists.linuxfoundation.org/pipermail/iommu/2012-January/003531.html > > > 2. I took a quick glance of tegra-smmu.c, I noticed that there is a > > > dts property named dma-window, which it's value is: <0x0 > > > 0x40000000>. Does this means the iova which SMMU handles is from 0 - > > > 1G? IIRC, SMMU handles 4G address space... > > > > It tries to avoid overwrapping 1-1 iovirt-phys mapping, which is > > necessary for some drivers right now. > > > > Sorry I didn't get it. What is overwrapping 1-1 iovirt-phys mapping? To create the mapping, Physical Address 0x12345678 == IO virtual Address 0x12345678 Then, even if device drivers are not aware of IOMMU, it should work. > > > 3. Right now in my drm driver, arm_iommu_attach_device failed with > > > an error code: -22(Invalid Argument). I think this is caused by > > > these codes in function smmu_iommu_attach_dev: > > > > > > map = (unsigned long)dev->platform_data; > > > if (!map) > > > return -EINVAL; > > > > > > So, does this mean the drm_device should have a "platform_data"(right now it is NULL so -EINVAL returned)? > > > I skimmed the codes of tegra-smmu.c, seems this "platform_data" has specific usage and should be composed in some rules. > > > Could you explain a little bit about this? > > > > You can skip that check with the following patch. > > > Yes, it works. Right now the framebuffer works on my T30. Great!