iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Suman Anna <s-anna-l0cyMroinI0@public.gmane.org>
To: Santosh Shilimkar
	<santosh.shilimkar-l0cyMroinI0@public.gmane.org>,
	Laurent Pinchart
	<laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
Cc: Russell King - ARM Linux
	<linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>,
	Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>,
	"iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org"
	<iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
	"sakari.ailus-X3B1VOXEql0@public.gmane.org"
	<sakari.ailus-X3B1VOXEql0@public.gmane.org>,
	"linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Florian Vaussard <florian.vaussard-p8DiymsW2f8@public.gmane.org>
Subject: Re: [PATCH 1/5] iommu/omap: Use the cache cleaning API
Date: Mon, 17 Mar 2014 14:16:51 -0500	[thread overview]
Message-ID: <53274A23.1040203@ti.com> (raw)
In-Reply-To: <532493DF.5010409-l0cyMroinI0@public.gmane.org>

Hi Santosh,

On 03/15/2014 12:54 PM, Santosh Shilimkar wrote:
> On Friday 14 March 2014 09:49 PM, Suman Anna wrote:
>> Hi Santosh, Laurent, Russell, Arnd,
>>
>> On 03/14/2014 12:51 PM, Santosh Shilimkar wrote:
>>> On Friday 14 March 2014 12:38 PM, Laurent Pinchart wrote:
>>>> Hi Santosh,
>>>>
>>>> On Friday 14 March 2014 12:15:11 Santosh Shilimkar wrote:
>>>>> + Russell, Arnd
>>>>>
>>>>> On Thursday 13 March 2014 10:47 PM, Anna, Suman wrote:
>>>>>> On 03/07/2014 06:46 PM, Laurent Pinchart wrote:
>>>>>>> The page table entries must be cleaned from the cache before being
>>>>>>> accessed by the IOMMU. Instead of implementing cache management manually
>>>>>>> (and ignoring L2 cache), use clean_dcache_area() to make sure the
>>>>>>> entries are visible to the device.
>>>>>>
>>>>>> Thanks for fixing this, this has been long pending. There have been some
>>>>>> previous attempts at this as well by Ramesh Gupta, with the last thread
>>>>>> (a long time now) being
>>>>>> http://marc.info/?t=134752035400001&r=1&w=2
>>>>>>
>>>>>> Santosh,
>>>>>> Can you please take a look at this patch and provide your comments?
>>>>>>
>>>>>> regards
>>>>>> Suman
>>>>>>
>>>>>>> Signed-off-by: Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
>>>>>>> ---
>>>>>>>
>>>>>>>     drivers/iommu/omap-iommu.c | 41 ++++++++++-----------------------------
>>>>>>>     1 file changed, 10 insertions(+), 31 deletions(-)
>>>>>>>
>>>>>>> diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
>>>>>>> index a893eca..bb605c9 100644
>>>>>>> --- a/drivers/iommu/omap-iommu.c
>>>>>>> +++ b/drivers/iommu/omap-iommu.c
>>>>>>> @@ -500,24 +500,9 @@ EXPORT_SYMBOL_GPL(omap_foreach_iommu_device);
>>>>>>>     /*
>>>>>>>      *    H/W pagetable operations
>>>>>>>      */
>>>>>>> -static void flush_iopgd_range(u32 *first, u32 *last)
>>>>>>> +static void flush_pgtable(void *addr, size_t size)
>>>>>>>     {
>>>>>>> -    /* FIXME: L2 cache should be taken care of if it exists */
>>>>>>> -    do {
>>>>>>> -        asm("mcr    p15, 0, %0, c7, c10, 1 @ flush_pgd"
>>>>>>> -            : : "r" (first));
>>>>>>> -        first += L1_CACHE_BYTES / sizeof(*first);
>>>>>>> -    } while (first <= last);
>>>>>>> -}
>>>>>>> -
>>>>>>> -static void flush_iopte_range(u32 *first, u32 *last)
>>>>>>> -{
>>>>>>> -    /* FIXME: L2 cache should be taken care of if it exists */
>>>>>>> -    do {
>>>>>>> -        asm("mcr    p15, 0, %0, c7, c10, 1 @ flush_pte"
>>>>>>> -            : : "r" (first));
>>>>>>> -        first += L1_CACHE_BYTES / sizeof(*first);
>>>>>>> -    } while (first <= last);
>>>>>>> +    clean_dcache_area(addr, size);
>>>>>
>>>>> I remember NAKing this approach in past and my stand remains same.
>>>>> The cache APIs which you are trying to use here are not suppose
>>>>> to be used outside.
>>
>> So this particular change has a long history (have to dig through to educate myself). I have not seen clean_dcache_area attempted before, and I wasn't sure myself it it can be used here. Ramesh and Fernando definitely did start out with dmac_flush_range and outer_flush_range which was definitely nacked [1].
>>
> OK. Please wrap the lines appropriately while replying.

Hmm, weird. I don't see this with my other responses. But sorry for
the trouble.

>
>>>>
>>>> Please note that the omap-iommu driver already uses clean_dcache_area().
>>>> That's where I got the idea :-)
>>>>
>>> So that fall through the cracks then ;-)
>>>
>>>>> I think the right way to fix this is to make use of streaming APIs.
>>>>> If needed, IOMMU can have its own dma_ops for special case
>>>>> handling if any.
>>>>
>>>> I can replace clean_dcache_area() with dma_map_page() as done by the arm-smmu
>>>> driver. If that's fine I'll modify this patch accordingly in v2.
>>>>
>>
>> Ramesh had also attempted to use dma_page_single() previously [2], and Russell has instead suggested to extend the cpu cache operations [3].
>> Ramesh had worked based on this suggestion and the series reached v6 [4] (same as link I mentioned above) and this is the last attempt on this, but the thread went silent.
>>
>> I am wondering if that is still valid and is the right way to go, as this seems to be a common problem. I do see dmac_flush_range being used for similar purposes in msm_iommu.c and exynos-iommu.c, so looks like they also fell through the cracks.
>>
> Thanks for the links. I think you should revive the v6 series unless and until
> RMK has some other suggestion. This can also help to remove the wrong usages
> from other IOMMU drivers as you pointed out.

OK, will do.

regards
Suman

>
>> Laurent,
>> Can you drop this patch out from v2 so that it is not clubbed with the small cleanup patches, and we can track this separately?
>>
> Agree
>
> Regards,
> Santosh
>
>>
>> [1] http://marc.info/?l=linux-omap&m=129907009019355&w=2
>> [2] http://marc.info/?t=130281804900005&r=1&w=2
>> [3] http://marc.info/?l=linux-omap&m=131310179423214&w=2
>> [4] http://marc.info/?t=134752035400001&r=1&w=2
>>
>>
>

  parent reply	other threads:[~2014-03-17 19:16 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-08  0:46 [PATCH 0/5] OMAP IOMMU fixes and IOMMU architecture questions Laurent Pinchart
2014-03-08  0:46 ` [PATCH 1/5] iommu/omap: Use the cache cleaning API Laurent Pinchart
     [not found]   ` <1394239574-2389-2-git-send-email-laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
2014-03-14  2:47     ` Suman Anna
2014-03-14 16:15       ` Santosh Shilimkar
2014-03-14 16:38         ` Laurent Pinchart
2014-03-14 17:51           ` Santosh Shilimkar
     [not found]             ` <5323418B.90805-l0cyMroinI0@public.gmane.org>
2014-03-15  1:49               ` Suman Anna
2014-03-15 17:54                 ` Santosh Shilimkar
     [not found]                   ` <532493DF.5010409-l0cyMroinI0@public.gmane.org>
2014-03-17 19:16                     ` Suman Anna [this message]
2014-03-17 22:56                 ` Laurent Pinchart
2014-03-14 16:57         ` Arnd Bergmann
2014-03-14 17:59           ` Santosh Shilimkar
     [not found]           ` <201403141757.48824.arnd-r2nGTMty4D4@public.gmane.org>
2014-03-17 23:12             ` Laurent Pinchart
2014-03-18  1:20               ` Suman Anna
     [not found] ` <1394239574-2389-1-git-send-email-laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
2014-03-08  0:46   ` [PATCH 2/5] iommu/omap: Fix 'no page for' debug message in flush_iotlb_page() Laurent Pinchart
     [not found]     ` <1394239574-2389-3-git-send-email-laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
2014-03-13 22:16       ` Suman Anna
2014-03-14  9:50         ` Laurent Pinchart
2014-03-08  0:46   ` [PATCH 3/5] iommu/omap: Flush the TLB only after updating translation table entries Laurent Pinchart
     [not found]     ` <1394239574-2389-4-git-send-email-laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
2014-03-13 22:27       ` Suman Anna
     [not found]         ` <532230DA.30302-l0cyMroinI0@public.gmane.org>
2014-03-14  9:58           ` Laurent Pinchart
2014-03-15  0:18             ` Suman Anna
2014-03-14  2:33   ` [PATCH 0/5] OMAP IOMMU fixes and IOMMU architecture questions Suman Anna
2014-03-14 11:00     ` Laurent Pinchart
2014-03-16 21:54       ` Sakari Ailus
     [not found]         ` <20140316215455.GA2108-S+BSfZ9RZZmRSg0ZkenSGLdO1Tsj/99ntUK59QYPAWc@public.gmane.org>
2014-03-17 19:58           ` Suman Anna
2014-03-17 22:44             ` Laurent Pinchart
2014-04-04 12:23               ` Marek Szyprowski
     [not found]                 ` <533EA45D.70002-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-04-08 13:09                   ` Laurent Pinchart
2014-04-04 10:18       ` Joerg Roedel
     [not found]         ` <20140404101811.GR13491-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2014-04-08 12:50           ` Laurent Pinchart
2014-04-08 13:43             ` Joerg Roedel
2014-04-08 15:02               ` Laurent Pinchart
2014-04-09 15:08                 ` Joerg Roedel
2014-04-10 23:30                   ` Laurent Pinchart
2014-03-08  0:46 ` [PATCH 4/5] iommu/omap: Remove comment about supporting single page mappings only Laurent Pinchart
2014-03-08  0:46 ` [PATCH 5/5] iommu/omap: Fix map protection value handling Laurent Pinchart
     [not found]   ` <1394239574-2389-6-git-send-email-laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
2014-03-14  0:07     ` Suman Anna
2014-03-14  9:46       ` Laurent Pinchart
2014-03-15  0:16         ` Suman Anna
2014-03-08 11:04 ` [PATCH 0/5] OMAP IOMMU fixes and IOMMU architecture questions Sakari Ailus
2014-03-12 15:26 ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53274A23.1040203@ti.com \
    --to=s-anna-l0cymroini0@public.gmane.org \
    --cc=arnd-r2nGTMty4D4@public.gmane.org \
    --cc=florian.vaussard-p8DiymsW2f8@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org \
    --cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
    --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sakari.ailus-X3B1VOXEql0@public.gmane.org \
    --cc=santosh.shilimkar-l0cyMroinI0@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).