Commit c4463b37 authored by Jeremy Kerr's avatar Jeremy Kerr Committed by Benjamin Herrenschmidt

powerpc/powernv: Defer OPAL exception handler registration

Currently, the OPAL exception vectors are registered before the feature
fixups are processed. This means that the now-firmware-owned vectors
will likely be overwritten by the kernel.

This change moves the exception registration code to an early initcall,
rather than at machine_init time.
Signed-off-by: default avatarJeremy Kerr <jk@ozlabs.org>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 73d2fb75
...@@ -34,7 +34,6 @@ int __init early_init_dt_scan_opal(unsigned long node, ...@@ -34,7 +34,6 @@ int __init early_init_dt_scan_opal(unsigned long node,
{ {
const void *basep, *entryp; const void *basep, *entryp;
unsigned long basesz, entrysz; unsigned long basesz, entrysz;
u64 glue;
if (depth != 1 || strcmp(uname, "ibm,opal") != 0) if (depth != 1 || strcmp(uname, "ibm,opal") != 0)
return 0; return 0;
...@@ -61,6 +60,16 @@ int __init early_init_dt_scan_opal(unsigned long node, ...@@ -61,6 +60,16 @@ int __init early_init_dt_scan_opal(unsigned long node,
printk("OPAL V1 detected !\n"); printk("OPAL V1 detected !\n");
} }
return 1;
}
static int __init opal_register_exception_handlers(void)
{
u64 glue;
if (!(powerpc_firmware_features & FW_FEATURE_OPAL))
return -ENODEV;
/* Hookup some exception handlers. We use the fwnmi area at 0x7000 /* Hookup some exception handlers. We use the fwnmi area at 0x7000
* to provide the glue space to OPAL * to provide the glue space to OPAL
*/ */
...@@ -74,9 +83,11 @@ int __init early_init_dt_scan_opal(unsigned long node, ...@@ -74,9 +83,11 @@ int __init early_init_dt_scan_opal(unsigned long node,
glue += 128; glue += 128;
opal_register_exception_handler(OPAL_SOFTPATCH_HANDLER, 0, glue); opal_register_exception_handler(OPAL_SOFTPATCH_HANDLER, 0, glue);
return 1; return 0;
} }
early_initcall(opal_register_exception_handlers);
int opal_get_chars(uint32_t vtermno, char *buf, int count) int opal_get_chars(uint32_t vtermno, char *buf, int count)
{ {
s64 len, rc; s64 len, rc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment