linux-stable/arch/openrisc/mm/ioremap.c
Linus Torvalds 3dceb8a9a9 OpenRISC updates for 6.6
Updates:
 
  - Fixes from me to cleanup all compiler warnings reported under
    arch/openrisc.
  - One cleanup from Linus Walleij to convert pfn macros to static
    inlines.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE2cRzVK74bBA6Je/xw7McLV5mJ+QFAmT2LXMACgkQw7McLV5m
 J+QAlhAAwNrKSrwKBhO06R2MlJz7ls4CSRD1pceefRzLzCyCJJuGAr1eIXvHPspr
 eY8hgEva5hvhDE6Ey3GDTLUT5r8HHNGpdpYlolX0PIzmGpX/lEhD+kL12mcY3cym
 PsUA++GPJpldxY9wG99T2MZqvBbL6Wnd++heVeCytzfQJHRT2EeqH9eljryh1aoD
 sf9PAq59xjHPFsoZysKaTccmM8hM/PYAN06vSdFgk4HIAYvGOTyQ/4AP0HmJ4XkE
 TE/gdSqPOFq8avegwg6AlmegQvl3DVglVFeP7M8BosXDw8emaGyv7hB95gCchud2
 EnFb8WE/BGOQQr05GpaPQGGjWxxMEFEwEMTPeFUbhybEzUKCy7ujpEiQ8zwdq/dp
 i3NSI2o07HaTDSYGzfCFVmP/R1ihraRVE8rzdfIK9a7rh1JSLE7tWv8rpSB5FWSA
 0gIRI9VV4XPHfrudw7j4Dsun41X4AsvolaRaxCW83wHzT9sREKl1Xfo8WEtEeY2Z
 MXek4wLU81qU+PfgrVtPk2+uqp2tK3lMtElXTOqktKUs5hyN+52nTdOShiP8yQB5
 jTPi/E5CVDlsMYUfueppJZE/nEHW93LmwW5Ktebmh92b2GeStZ33PVa9ItaVPDeT
 pqWUO5EiM/h9iTkZs+3RhbOWvcbRf7+H7c5xiGupaqvoS2YVfC4=
 =VGnr
 -----END PGP SIGNATURE-----

Merge tag 'for-linus' of https://github.com/openrisc/linux

Pull OpenRISC updates from Stafford Horne:

 - Fixes from me to cleanup all compiler warnings reported under
   arch/openrisc

 - One cleanup from Linus Walleij to convert pfn macros to static
   inlines

* tag 'for-linus' of https://github.com/openrisc/linux:
  openrisc: Remove kernel-doc marker from ioremap comment
  openrisc: Remove unused tlb_init function
  openriac: Remove unused nommu_dump_state function
  openrisc: Include cpu.h and switch_to.h for prototypes
  openrisc: Add prototype for die to bug.h
  openrisc: Add prototype for show_registers to processor.h
  openrisc: Declare do_signal function as static
  openrisc: Add missing prototypes for assembly called fnctions
  openrisc: Make pfn accessors statics inlines
2023-09-05 10:09:31 -07:00

48 lines
1.3 KiB
C

// SPDX-License-Identifier: GPL-2.0-or-later
/*
* OpenRISC ioremap.c
*
* Linux architectural port borrowing liberally from similar works of
* others. All original copyrights apply as per the original source
* declaration.
*
* Modifications for the OpenRISC architecture:
* Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
* Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
*/
#include <linux/vmalloc.h>
#include <linux/io.h>
#include <linux/pgtable.h>
#include <asm/pgalloc.h>
#include <asm/fixmap.h>
#include <asm/bug.h>
#include <linux/sched.h>
#include <asm/tlbflush.h>
extern int mem_init_done;
/*
* OK, this one's a bit tricky... ioremap can get called before memory is
* initialized (early serial console does this) and will want to alloc a page
* for its mapping. No userspace pages will ever get allocated before memory
* is initialized so this applies only to kernel pages. In the event that
* this is called before memory is initialized we allocate the page using
* the memblock infrastructure.
*/
pte_t __ref *pte_alloc_one_kernel(struct mm_struct *mm)
{
pte_t *pte;
if (likely(mem_init_done)) {
pte = (pte_t *)get_zeroed_page(GFP_KERNEL);
} else {
pte = memblock_alloc(PAGE_SIZE, PAGE_SIZE);
if (!pte)
panic("%s: Failed to allocate %lu bytes align=0x%lx\n",
__func__, PAGE_SIZE, PAGE_SIZE);
}
return pte;
}