linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Laura Abbott <labbott@redhat.com>
To: Josh Cartwright <joshc@ni.com>,
	punnaiah choudary kalluri <punnaia@xilinx.com>
Cc: linux-mm@kvack.org,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	Sergey Dyasly <dserrg@gmail.com>,
	Russell King <rmk+kernel@arm.linux.org.uk>,
	Arnd Bergmann <arnd.bergmann@linaro.org>
Subject: Re: Issue with ioremap
Date: Thu, 31 Mar 2016 15:53:26 -0700	[thread overview]
Message-ID: <56FDAA66.2000505@redhat.com> (raw)
In-Reply-To: <20160331200147.GA20530@jcartwri.amer.corp.natinst.com>

(cc linux-arm)

On 03/31/2016 01:01 PM, Josh Cartwright wrote:
> On Fri, Apr 01, 2016 at 01:13:06AM +0530, punnaiah choudary kalluri wrote:
>> Hi,
>>
>> We are using the pl353 smc controller for interfacing the nand in our zynq SOC.
>> The driver for this controller is currently under mainline review.
>> Recently we are moved to 4.4 kernel and observing issues with the driver.
>> while debug, found that the issue is with the virtual address returned from
>> the ioremap is not aligned to the physical address and causing nand
>> access failures.
>> the nand controller physical address starts at 0xE1000000 and the size is 16MB.
>> the ioremap function in 4.3 kernel returns the virtual address that is
>> aligned to the size
>> but not the case in 4.4 kernel.
>
> :(.  I had actually ran into this, too, as I was evaluating the use of
> the upstream-targetted pl353 stuff; sorry I didn't say anything.
>
>> this controller uses the bits [31:24] as base address and use rest all
>> bits for configuring adders cycles, chip select information. so it
>> expects the virtual address also aligned to 0xFF000000 otherwise the
>> nand commands issued will fail.
>
> The driver _currently_ expects the virtual address to be 16M aligned,
> but is that a hard requirement?  It seems possible that the driver could
> be written without this assumption, correct?
>
> This would mean that the driver would need to maintain the cs/cycles
> configuration state outside of the mapped virtual address, and then
> calculate + add the calculated offset to the base.  Would that work?
> I had been meaning to give it a try, but haven't gotten around to it.
>
>    Josh
>

I was curious so I took a look and this seems to be caused by

commit 803e3dbcb4cf80c898faccf01875f6ff6e5e76fd
Author: Sergey Dyasly <dserrg@gmail.com>
Date:   Wed Sep 9 16:27:18 2015 +0100

     ARM: 8430/1: use default ioremap alignment for SMP or LPAE
     
     16MB alignment for ioremap mappings was added by commit a069c896d0d6 ("[ARM]
     3705/1: add supersection support to ioremap()") in order to support supersection
     mappings. But __arm_ioremap_pfn_caller uses section and supersection mappings
     only in !SMP && !LPAE case. There is no need for such big alignment if either
     SMP or LPAE is enabled.
     
     After this change, ioremap will use default maximum alignment of 128 pages.
     
     Link: https://lkml.kernel.org/g/1419328813-2211-1-git-send-email-d.safonov@partner.samsung.com
     
     Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
     Cc: Nicolas Pitre <nicolas.pitre@linaro.org>
     Cc: James Bottomley <JBottomley@parallels.com>
     Cc: Will Deacon <will.deacon@arm.com>
     Cc: Arnd Bergmann <arnd.bergmann@linaro.org>
     Cc: Catalin Marinas <catalin.marinas@arm.com>
     Cc: Andrew Morton <akpm@linux-foundation.org>
     Cc: Dmitry Safonov <d.safonov@partner.samsung.com>
     Signed-off-by: Sergey Dyasly <s.dyasly@samsung.com>
     Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

The thread assumed the higher alignment behavior was only needed for super
section mappings. Apparently not.

Thanks,
Laura

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2016-03-31 22:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-31 19:43 Issue with ioremap punnaiah choudary kalluri
2016-03-31 20:01 ` Josh Cartwright
2016-03-31 22:53   ` Laura Abbott [this message]
2016-03-31 23:08     ` Russell King - ARM Linux

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=56FDAA66.2000505@redhat.com \
    --to=labbott@redhat.com \
    --cc=arnd.bergmann@linaro.org \
    --cc=dserrg@gmail.com \
    --cc=joshc@ni.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=punnaia@xilinx.com \
    --cc=rmk+kernel@arm.linux.org.uk \
    /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).