On Fri, Jun 03, 2016 at 12:40:45AM +0100, Ben Hutchings wrote: > On Thu, 2016-06-02 at 01:30 +0200, Stefan Alfredsson wrote: > > Package: linux-image-4.5.0-0.bpo.2-amd64 > > Version: 4.5.4-1~bpo8+1 > > > > > > I'm booting a small iso image (~50 MB) via memdisk via iPXE, and want to > > use the phram module to access the iso filesystem in ram. This results > > in the following kernel call trace. > > I don't think this is a bug. The Kconfig text for this driver says: > > Use this driver to access physical memory that the kernel proper > doesn't have access to, memory beyond the mem=xxx limit, nvram, > memory on the video card, etc... > > The kernel is warning here because it *does* have access to that > physical address already. Still, if you really want to do this, the attached patch might help. Instructions for building a patched Debian kernel are at: https://kernel-handbook.alioth.debian.org/ch-common-tasks.html#s-common-official Ben. -- Ben Hutchings DNRC Motto: I can please only one person per day. Today is not your day. Tomorrow isn't looking good either.
From bb7e7aeb3d832059e33b1e76eb85d4680f77abf2 Mon Sep 17 00:00:00 2001 From: Ben Hutchings <ben@decadent.org.uk> Date: Fri, 3 Jun 2016 01:08:36 +0100 Subject: [PATCH] phram: Use memremap() to allow mapping of system RAM Using memremap() instead of ioremap() allows mapping a disk image in system RAM that has somehow been reserved. It should fall back to ioremap() where necessary. Entirely untested, and I'm not convinced this is a good idea at all. --- drivers/mtd/devices/phram.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c index 8b66e52ca3cc..0ea254e2ba51 100644 --- a/drivers/mtd/devices/phram.c +++ b/drivers/mtd/devices/phram.c @@ -88,7 +88,7 @@ static void unregister_devices(void) list_for_each_entry_safe(this, safe, &phram_list, list) { mtd_device_unregister(&this->mtd); - iounmap(this->mtd.priv); + memunmap(this->mtd.priv); kfree(this->mtd.name); kfree(this); } @@ -104,7 +104,8 @@ static int register_device(char *name, phys_addr_t start, size_t len) goto out0; ret = -EIO; - new->mtd.priv = ioremap(start, len); + new->mtd.priv = memremap(start, len, + MEMREMAP_WB | MEMREMAP_WT | MEMREMAP_WC); if (!new->mtd.priv) { pr_err("ioremap failed\n"); goto out1; @@ -134,7 +135,7 @@ static int register_device(char *name, phys_addr_t start, size_t len) return 0; out2: - iounmap(new->mtd.priv); + memunmap(new->mtd.priv); out1: kfree(new); out0:
Attachment:
signature.asc
Description: Digital signature