Re: [PATCH] omap: iommu: disallow mapping NULL address

David Cohen
2011-03-08T09:55:29Z

Hi Fernando,

On Tue, Mar 8, 2011 at 11:13 AM, Sakari Ailus
<sakari.ailus@maxwell.research.nokia.com> wrote:
> Guzman Lugo, Fernando wrote:
>> On Mon, Mar 7, 2011 at 1:19 PM, David Cohen <dacohen@gmail.com> wrote:
>>> On Mon, Mar 7, 2011 at 9:17 PM, Guzman Lugo, Fernando
>>> <fernando.lugo@ti.com> wrote:
>>>> On Mon, Mar 7, 2011 at 7:10 AM, Michael Jones
>>>> <michael.jones@matrix-vision.de> wrote:
>>>>> From e7dbe4c4b64eb114f9b0804d6af3a3ca0e78acc8 Mon Sep 17 00:00:00 2001
>>>>> From: Michael Jones <michael.jones@matrix-vision.de>
>>>>> Date: Mon, 7 Mar 2011 13:36:15 +0100
>>>>> Subject: [PATCH] omap: iommu: disallow mapping NULL address
>>>>>
>>>>> commit c7f4ab26e3bcdaeb3e19ec658e3ad9092f1a6ceb allowed mapping
>>>>> the NULL address if da_start==0.  Force da_start to exclude the
>>>>> first page.
>>>>
>>>> what about devices that uses page 0? ipu after reset always starts
>>>> from 0x00000000 how could we map that address??
>>>
>>> from 0x0? The driver sees da == 0 as error. May I ask you why do you want it?
>>
>> unlike DSP that you can load a register with the addres the DSP will
>> boot, IPU core always starts from address 0x00000000, so if you take
>> IPU out of reset it will try to access address 0x0 if not map it,
>> there will be a mmu fault.
>
> I think the driver for IPU (what is it, btw.?) must map the NULL address
> explicitly. It cannot rely on automatic allocation of the NULL address
> by the iommu even if it was the first allocation.

That's an interesting question. My first thought was "it's not
automatic allocation", because it seems you know the specific 'da' IPU
needs. But then, looking into the driver's API, the automatic
allocation is defined whether the argument da == 0 (automatic
allocation) or da != 0 (fixed da). So, by default, the IOMMU driver
does not see da == 0 as valid address for fixed da. Then, why only
automatic allocation should use such address? My second point is: if
you're using automatic allocation, you *cannot* rely on specific da to
be used, as it would be up to IOMMU driver to choose. So, doesn't
matter the option, your driver seems to be wrong, unless I'm missing
something. If you were using fixed da passing da = 0, you were just
being lucky that it was the first request and automatic allocation
returned da == 0.
IMO either first page is not allowed at all or OMAP's IOMMU API should
change the way it checks if it's fixed da or not.

Kind regards,

David

>
> --
> Sakari Ailus
> sakari.ailus@maxwell.research.nokia.com
>
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html