From: David Daney <ddaney@caviumnetworks.com>
To: Roy Franz <rfranz@cavium.com>,
dwmw2@infradead.org, computersforpeace@gmail.com,
boris.brezillon@free-electrons.com, marek.vasut@gmail.com,
richard@nod.at, cyrille.pitchen@wedev4u.fr
Cc: roy.franz@cavium.com, linux-mtd@lists.infradead.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, ddaney@cavium.com
Subject: Re: [PATCH] mdt: slram: use memremap() instead of ioremap()
Date: Tue, 17 Oct 2017 15:02:18 -0700 [thread overview]
Message-ID: <befe7e20-da85-1ea5-d3ad-4698af0b7d05@caviumnetworks.com> (raw)
In-Reply-To: <20171017205642.1791-1-roy.franz@cavium.com>
On 10/17/2017 01:56 PM, Roy Franz wrote:
> Convert slram to use memremap() to map the memory it uses to back an MTD
> device, as this is the proper interface for mapping memory. This change
> enables normal memory to be used to back an MTD device on arm64, as arm64
> prevents ioremap() being used on normal memory.
>
> Signed-off-by: Roy Franz <roy.franz@cavium.com>
Thanks Roy. I just tested on MIPS64 with no regressions, so:
Tested-by: David Daney <david.daney@cavium.com>
> ---
> Tested on arm64 simulation, using simulator to preload filesystem image into RAM,
> and also tested on x86_64 using video card memory. This is useful for speeding
> up booting on (very slow) emulation environments by avoiding any processing of
> an initramfs.
>
> drivers/mtd/devices/slram.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mtd/devices/slram.c b/drivers/mtd/devices/slram.c
> index 8087c36dc693..0ec85f316d24 100644
> --- a/drivers/mtd/devices/slram.c
> +++ b/drivers/mtd/devices/slram.c
> @@ -163,8 +163,9 @@ static int register_device(char *name, unsigned long start, unsigned long length
> }
>
> if (!(((slram_priv_t *)(*curmtd)->mtdinfo->priv)->start =
> - ioremap(start, length))) {
> - E("slram: ioremap failed\n");
> + memremap(start, length,
> + MEMREMAP_WB | MEMREMAP_WT | MEMREMAP_WC))) {
> + E("slram: memremap failed\n");
> return -EIO;
> }
> ((slram_priv_t *)(*curmtd)->mtdinfo->priv)->end =
> @@ -186,7 +187,7 @@ static int register_device(char *name, unsigned long start, unsigned long length
>
> if (mtd_device_register((*curmtd)->mtdinfo, NULL, 0)) {
> E("slram: Failed to register new device\n");
> - iounmap(((slram_priv_t *)(*curmtd)->mtdinfo->priv)->start);
> + memunmap(((slram_priv_t *)(*curmtd)->mtdinfo->priv)->start);
> kfree((*curmtd)->mtdinfo->priv);
> kfree((*curmtd)->mtdinfo);
> return(-EAGAIN);
> @@ -206,7 +207,7 @@ static void unregister_devices(void)
> while (slram_mtdlist) {
> nextitem = slram_mtdlist->next;
> mtd_device_unregister(slram_mtdlist->mtdinfo);
> - iounmap(((slram_priv_t *)slram_mtdlist->mtdinfo->priv)->start);
> + memunmap(((slram_priv_t *)slram_mtdlist->mtdinfo->priv)->start);
> kfree(slram_mtdlist->mtdinfo->priv);
> kfree(slram_mtdlist->mtdinfo);
> kfree(slram_mtdlist);
>
next prev parent reply other threads:[~2017-10-17 22:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-17 20:56 Roy Franz
2017-10-17 21:14 ` Ard Biesheuvel
2017-10-17 22:02 ` David Daney [this message]
2017-10-19 15:37 ` Christoph Hellwig
2017-10-19 20:08 ` Roy Franz
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=befe7e20-da85-1ea5-d3ad-4698af0b7d05@caviumnetworks.com \
--to=ddaney@caviumnetworks.com \
--cc=boris.brezillon@free-electrons.com \
--cc=computersforpeace@gmail.com \
--cc=cyrille.pitchen@wedev4u.fr \
--cc=ddaney@cavium.com \
--cc=dwmw2@infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=marek.vasut@gmail.com \
--cc=rfranz@cavium.com \
--cc=richard@nod.at \
--cc=roy.franz@cavium.com \
/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
all inboxes | Powered by JetHome®