Skip to content

Commit 53c98e3

Browse files
Baoquan Heakpm00
authored andcommitted
openrisc: mm: remove unneeded early ioremap code
Under arch/openrisc, there isn't any place where ioremap() is called. It means that there isn't early ioremap handling needed in openrisc, So the early ioremap handling code in ioremap() of arch/openrisc/mm/ioremap.c is unnecessary and can be removed. And also remove the special handling in iounmap() since no page is got from fixmap pool along with early ioremap code removing in ioremap(). Link: https://lore.kernel.org/linux-mm/YwxfxKrTUtAuejKQ@oscomms1/ Link: https://lkml.kernel.org/r/20230706154520.11257-4-bhe@redhat.com Signed-off-by: Baoquan He <bhe@redhat.com> Acked-by: Stafford Horne <shorne@gmail.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org> Cc: Jonas Bonn <jonas@southpole.se> Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi> Cc: Stafford Horne <shorne@gmail.com> Cc: Alexander Gordeev <agordeev@linux.ibm.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Brian Cain <bcain@quicinc.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Christian Borntraeger <borntraeger@linux.ibm.com> Cc: Christophe Leroy <christophe.leroy@csgroup.eu> Cc: Chris Zankel <chris@zankel.net> Cc: David Laight <David.Laight@ACULAB.COM> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Gerald Schaefer <gerald.schaefer@linux.ibm.com> Cc: Heiko Carstens <hca@linux.ibm.com> Cc: Helge Deller <deller@gmx.de> Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com> Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> Cc: Kefeng Wang <wangkefeng.wang@huawei.com> Cc: Matthew Wilcox <willy@infradead.org> Cc: Max Filippov <jcmvbkbc@gmail.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Nathan Chancellor <nathan@kernel.org> Cc: Nicholas Piggin <npiggin@gmail.com> Cc: Niklas Schnelle <schnelle@linux.ibm.com> Cc: Rich Felker <dalias@libc.org> Cc: Sven Schnelle <svens@linux.ibm.com> Cc: Vasily Gorbik <gor@linux.ibm.com> Cc: Vineet Gupta <vgupta@kernel.org> Cc: Will Deacon <will@kernel.org> Cc: Yoshinori Sato <ysato@users.sourceforge.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 5bd2cc5 commit 53c98e3

File tree

1 file changed

+5
-38
lines changed

1 file changed

+5
-38
lines changed

arch/openrisc/mm/ioremap.c

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222

2323
extern int mem_init_done;
2424

25-
static unsigned int fixmaps_used __initdata;
26-
2725
/*
2826
* Remap an arbitrary physical address space into the kernel virtual
2927
* address space. Needed when the kernel wants to access high addresses
@@ -52,24 +50,14 @@ void __iomem *__ref ioremap(phys_addr_t addr, unsigned long size)
5250
p = addr & PAGE_MASK;
5351
size = PAGE_ALIGN(last_addr + 1) - p;
5452

55-
if (likely(mem_init_done)) {
56-
area = get_vm_area(size, VM_IOREMAP);
57-
if (!area)
58-
return NULL;
59-
v = (unsigned long)area->addr;
60-
} else {
61-
if ((fixmaps_used + (size >> PAGE_SHIFT)) > FIX_N_IOREMAPS)
62-
return NULL;
63-
v = fix_to_virt(FIX_IOREMAP_BEGIN + fixmaps_used);
64-
fixmaps_used += (size >> PAGE_SHIFT);
65-
}
53+
area = get_vm_area(size, VM_IOREMAP);
54+
if (!area)
55+
return NULL;
56+
v = (unsigned long)area->addr;
6657

6758
if (ioremap_page_range(v, v + size, p,
6859
__pgprot(pgprot_val(PAGE_KERNEL) | _PAGE_CI))) {
69-
if (likely(mem_init_done))
70-
vfree(area->addr);
71-
else
72-
fixmaps_used -= (size >> PAGE_SHIFT);
60+
vfree(area->addr);
7361
return NULL;
7462
}
7563

@@ -79,27 +67,6 @@ EXPORT_SYMBOL(ioremap);
7967

8068
void iounmap(volatile void __iomem *addr)
8169
{
82-
/* If the page is from the fixmap pool then we just clear out
83-
* the fixmap mapping.
84-
*/
85-
if (unlikely((unsigned long)addr > FIXADDR_START)) {
86-
/* This is a bit broken... we don't really know
87-
* how big the area is so it's difficult to know
88-
* how many fixed pages to invalidate...
89-
* just flush tlb and hope for the best...
90-
* consider this a FIXME
91-
*
92-
* Really we should be clearing out one or more page
93-
* table entries for these virtual addresses so that
94-
* future references cause a page fault... for now, we
95-
* rely on two things:
96-
* i) this code never gets called on known boards
97-
* ii) invalid accesses to the freed areas aren't made
98-
*/
99-
flush_tlb_all();
100-
return;
101-
}
102-
10370
return vfree((void *)(PAGE_MASK & (unsigned long)addr));
10471
}
10572
EXPORT_SYMBOL(iounmap);

0 commit comments

Comments
 (0)