hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/arch/openrisc/mm/ioremap.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * OpenRISC ioremap.c
34 *
....@@ -8,20 +9,15 @@
89 * Modifications for the OpenRISC architecture:
910 * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
1011 * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
11
- *
12
- * This program is free software; you can redistribute it and/or
13
- * modify it under the terms of the GNU General Public License
14
- * as published by the Free Software Foundation; either version
15
- * 2 of the License, or (at your option) any later version.
1612 */
1713
1814 #include <linux/vmalloc.h>
1915 #include <linux/io.h>
16
+#include <linux/pgtable.h>
2017 #include <asm/pgalloc.h>
2118 #include <asm/kmap_types.h>
2219 #include <asm/fixmap.h>
2320 #include <asm/bug.h>
24
-#include <asm/pgtable.h>
2521 #include <linux/sched.h>
2622 #include <asm/tlbflush.h>
2723
....@@ -38,8 +34,7 @@
3834 * have to convert them into an offset in a page-aligned mapping, but the
3935 * caller shouldn't need to know that small detail.
4036 */
41
-void __iomem *__ref
42
-__ioremap(phys_addr_t addr, unsigned long size, pgprot_t prot)
37
+void __iomem *__ref ioremap(phys_addr_t addr, unsigned long size)
4338 {
4439 phys_addr_t p;
4540 unsigned long v;
....@@ -70,7 +65,8 @@
7065 fixmaps_used += (size >> PAGE_SHIFT);
7166 }
7267
73
- if (ioremap_page_range(v, v + size, p, prot)) {
68
+ if (ioremap_page_range(v, v + size, p,
69
+ __pgprot(pgprot_val(PAGE_KERNEL) | _PAGE_CI))) {
7470 if (likely(mem_init_done))
7571 vfree(area->addr);
7672 else
....@@ -80,7 +76,7 @@
8076
8177 return (void __iomem *)(offset + (char *)v);
8278 }
83
-EXPORT_SYMBOL(__ioremap);
79
+EXPORT_SYMBOL(ioremap);
8480
8581 void iounmap(void *addr)
8682 {
....@@ -118,18 +114,18 @@
118114 * the memblock infrastructure.
119115 */
120116
121
-pte_t __ref *pte_alloc_one_kernel(struct mm_struct *mm,
122
- unsigned long address)
117
+pte_t __ref *pte_alloc_one_kernel(struct mm_struct *mm)
123118 {
124119 pte_t *pte;
125120
126121 if (likely(mem_init_done)) {
127
- pte = (pte_t *) __get_free_page(GFP_KERNEL);
122
+ pte = (pte_t *)get_zeroed_page(GFP_KERNEL);
128123 } else {
129
- pte = (pte_t *) __va(memblock_alloc(PAGE_SIZE, PAGE_SIZE));
124
+ pte = memblock_alloc(PAGE_SIZE, PAGE_SIZE);
125
+ if (!pte)
126
+ panic("%s: Failed to allocate %lu bytes align=0x%lx\n",
127
+ __func__, PAGE_SIZE, PAGE_SIZE);
130128 }
131129
132
- if (pte)
133
- clear_page(pte);
134130 return pte;
135131 }