On Mon, Apr 11, 2016 at 01:04:14PM +0200, Alexander Gordeev wrote: > Make ioremap() remap just one page for now Why restrict it to just one page? Should be able to round size up to next page multiple, right? And then actually use the size argument. > > Cc: Thomas Huth <thuth@xxxxxxxxxx> > Cc: Andrew Jones <drjones@xxxxxxxxxx> > Signed-off-by: Alexander Gordeev <agordeev@xxxxxxxxxx> > --- > lib/x86/io.c | 12 ++++++++++++ > lib/x86/io.h | 5 +++++ > 2 files changed, 17 insertions(+) > > diff --git a/lib/x86/io.c b/lib/x86/io.c > index d3b971ef67b0..628813926725 100644 > --- a/lib/x86/io.c > +++ b/lib/x86/io.c > @@ -1,6 +1,7 @@ > #include "libcflat.h" > #include "smp.h" > #include "io.h" > +#include "vm.h" > #ifndef USE_SERIAL > #define USE_SERIAL > #endif > @@ -81,3 +82,14 @@ void exit(int code) > asm volatile("out %0, %1" : : "a"(code), "d"((short)0xf4)); > #endif > } > + > +void __iomem *ioremap(phys_addr_t phys_addr, size_t size __unused) > +{ > + phys_addr_t base = ALIGN(phys_addr, PAGE_SIZE); > + phys_addr_t offset = phys_addr - base; > + void *page = alloc_vpages(1); > + > + install_page((void*)read_cr3(), base, page); > + > + return page + offset; > +} > diff --git a/lib/x86/io.h b/lib/x86/io.h > index bd6341c6c103..730786411fb3 100644 > --- a/lib/x86/io.h > +++ b/lib/x86/io.h > @@ -1,6 +1,8 @@ > #ifndef IO_H > #define IO_H > > +#define __iomem > + > static inline unsigned char inb(unsigned short port) > { > unsigned char value; > @@ -37,4 +39,7 @@ static inline void outl(unsigned int value, unsigned short port) > asm volatile("outl %0, %w1" : : "a"(value), "Nd"(port)); > } > > +#define ioremap ioremap > +void __iomem *ioremap(phys_addr_t phys_addr, size_t size __unused); > + > #endif > -- > 1.8.3.1 > Thanks, drew -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html