Message ID | 20190430225216.7164-2-paul.burton@mips.com (mailing list archive) |
---|---|
State | Mainlined |
Commit | f995adb0ac5bcfa0d396ba7706aab420c7a6fec2 |
Headers | show |
Series | MIPS: Exception vector improvements | expand |
On 5/1/19 12:53 AM, Paul Burton wrote: > Allocate the exception vector using memblock_phys_alloc() which gives us > a physical address, rather than the previous convoluted setup which > obtained a virtual address using memblock_alloc(), converted it to a > physical address & then back to a virtual address. > > Signed-off-by: Paul Burton <paul.burton@mips.com> > --- > arch/mips/kernel/traps.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c > index 98ca55d62201..00f44b16385e 100644 > --- a/arch/mips/kernel/traps.c > +++ b/arch/mips/kernel/traps.c > @@ -2292,9 +2292,8 @@ void __init trap_init(void) > unsigned long size = 0x200 + VECTORSPACING*64; > phys_addr_t ebase_pa; > > - ebase = (unsigned long) > - memblock_alloc(size, 1 << fls(size)); > - if (!ebase) > + ebase_pa = memblock_phys_alloc(size, 1 << fls(size)); > + if (!ebase_pa) > panic("%s: Failed to allocate %lu bytes align=0x%x\n", > __func__, size, 1 << fls(size)); > > @@ -2309,9 +2308,10 @@ void __init trap_init(void) > * EVA is special though as it allows segments to be rearranged > * and to become uncached during cache error handling. > */ > - ebase_pa = __pa(ebase); > if (!IS_ENABLED(CONFIG_EVA) && !WARN_ON(ebase_pa >= 0x20000000)) > ebase = CKSEG0ADDR(ebase_pa); > + else > + ebase = (unsigned long)phys_to_virt(ebase_pa); > } else { > ebase = CAC_BASE; > > Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index 98ca55d62201..00f44b16385e 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c @@ -2292,9 +2292,8 @@ void __init trap_init(void) unsigned long size = 0x200 + VECTORSPACING*64; phys_addr_t ebase_pa; - ebase = (unsigned long) - memblock_alloc(size, 1 << fls(size)); - if (!ebase) + ebase_pa = memblock_phys_alloc(size, 1 << fls(size)); + if (!ebase_pa) panic("%s: Failed to allocate %lu bytes align=0x%x\n", __func__, size, 1 << fls(size)); @@ -2309,9 +2308,10 @@ void __init trap_init(void) * EVA is special though as it allows segments to be rearranged * and to become uncached during cache error handling. */ - ebase_pa = __pa(ebase); if (!IS_ENABLED(CONFIG_EVA) && !WARN_ON(ebase_pa >= 0x20000000)) ebase = CKSEG0ADDR(ebase_pa); + else + ebase = (unsigned long)phys_to_virt(ebase_pa); } else { ebase = CAC_BASE;
Allocate the exception vector using memblock_phys_alloc() which gives us a physical address, rather than the previous convoluted setup which obtained a virtual address using memblock_alloc(), converted it to a physical address & then back to a virtual address. Signed-off-by: Paul Burton <paul.burton@mips.com> --- arch/mips/kernel/traps.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)