OpenRISC updates for 6.13

A single fixup from me:
 
  - Fix bug with earlycon being broken due to removal of early_ioremap.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE2cRzVK74bBA6Je/xw7McLV5mJ+QFAmc8xS4ACgkQw7McLV5m
 J+T9IA/5ASXLsoterJXCo9ds34n9oIoEiur8UcOY0LELCm5M9HP0z62at0IZccX9
 Tc+DFl6rCJBwZWn7JmYo8qnkO+hTkAoRDFx+I1WMlzjczOLHdwZ3E26u4/cWrhVd
 j4eISjk5KIFO2DExIdEXgKWetagcfjgyo44/SU+7PLApNPnAeE6bBu5VYypfy+sd
 BWPZs+FoFBjszdRHjo1mowxbS1Wa6znhWbELyFAY/5hFWIt+91YHS1rpxDoDPnE+
 GUYMIFTJLdXlc0eyGfsjcvcHX08NankY8Betg/6e2jENqO+fQHb7KuYL+cxoTDAv
 HlIfzJQ6YRnfxB8XSLJvAT/bmqoYQAuVydvoFN/45ogzu1OwizM6e6mGw5ErgYkO
 kRPXa5IgCbORc3v8Dxd+IZNJ4FzBXQ7BDz0V92FYjtJ3OsQKsVHX/t2dGhd4wmGS
 ItzmxRp55ufqYkb2Waszvq+dBvuW6gJHHB9k9h0mZKhVEm1V2TisIIpdnE3FF/QA
 p81cPdvHxsp4mf5w30kIaFMHgKM+6jRUEl6IDTEmOtim02Zu75y1JQE8mFZ1yFZ0
 l4KPnhU2hYzXG/eqinzRuyRap2wgIGPAXC+mL4LekL74TqmaEGrTeBOq1z+DnMwz
 u7dQwLJsbomjJUc17MJcKH3zZ1l7xFZxIEbaFrGaimlRMHHQS7Q=
 =3/S+
 -----END PGP SIGNATURE-----

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

Pull OpenRISC update from Stafford Horne:
 "A single fixup from me: Fix bug with earlycon being broken due to
  removal of early_ioremap"

* tag 'for-linus' of https://github.com/openrisc/linux:
  openrisc: Implement fixmap to fix earlycon
This commit is contained in:
Linus Torvalds 2024-11-20 14:56:02 -08:00
commit c66fbc6c3d
3 changed files with 45 additions and 16 deletions

View File

@ -65,6 +65,9 @@ config STACKTRACE_SUPPORT
config LOCKDEP_SUPPORT config LOCKDEP_SUPPORT
def_bool y def_bool y
config FIX_EARLYCON_MEM
def_bool y
menu "Processor type and features" menu "Processor type and features"
choice choice

View File

@ -26,29 +26,18 @@
#include <linux/bug.h> #include <linux/bug.h>
#include <asm/page.h> #include <asm/page.h>
/*
* On OpenRISC we use these special fixed_addresses for doing ioremap
* early in the boot process before memory initialization is complete.
* This is used, in particular, by the early serial console code.
*
* It's not really 'fixmap', per se, but fits loosely into the same
* paradigm.
*/
enum fixed_addresses { enum fixed_addresses {
/* FIX_EARLYCON_MEM_BASE,
* FIX_IOREMAP entries are useful for mapping physical address
* space before ioremap() is useable, e.g. really early in boot
* before kmalloc() is working.
*/
#define FIX_N_IOREMAPS 32
FIX_IOREMAP_BEGIN,
FIX_IOREMAP_END = FIX_IOREMAP_BEGIN + FIX_N_IOREMAPS - 1,
__end_of_fixed_addresses __end_of_fixed_addresses
}; };
#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) #define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
/* FIXADDR_BOTTOM might be a better name here... */ /* FIXADDR_BOTTOM might be a better name here... */
#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
#define FIXMAP_PAGE_IO PAGE_KERNEL_NOCACHE
extern void __set_fixmap(enum fixed_addresses idx,
phys_addr_t phys, pgprot_t flags);
#include <asm-generic/fixmap.h> #include <asm-generic/fixmap.h>

View File

@ -207,6 +207,43 @@ void __init mem_init(void)
return; return;
} }
static int __init map_page(unsigned long va, phys_addr_t pa, pgprot_t prot)
{
p4d_t *p4d;
pud_t *pud;
pmd_t *pmd;
pte_t *pte;
p4d = p4d_offset(pgd_offset_k(va), va);
pud = pud_offset(p4d, va);
pmd = pmd_offset(pud, va);
pte = pte_alloc_kernel(pmd, va);
if (pte == NULL)
return -ENOMEM;
if (pgprot_val(prot))
set_pte_at(&init_mm, va, pte, pfn_pte(pa >> PAGE_SHIFT, prot));
else
pte_clear(&init_mm, va, pte);
local_flush_tlb_page(NULL, va);
return 0;
}
void __init __set_fixmap(enum fixed_addresses idx,
phys_addr_t phys, pgprot_t prot)
{
unsigned long address = __fix_to_virt(idx);
if (idx >= __end_of_fixed_addresses) {
BUG();
return;
}
map_page(address, phys, prot);
}
static const pgprot_t protection_map[16] = { static const pgprot_t protection_map[16] = {
[VM_NONE] = PAGE_NONE, [VM_NONE] = PAGE_NONE,
[VM_READ] = PAGE_READONLY_X, [VM_READ] = PAGE_READONLY_X,