opal: Remove machine check interrupt patching in OPAL.

Now that we catch/handle machine check interrupt directly in Linux host
PowerNV kernel, we are not anymore dependent on OPAL firmware to do MCE
handling job for us. The MCE handling code in OPAL has exclusive stack
space (4k size) reserved and remains unused with Linux host not being
dependent on it anymore. Hence, this patch removes the code that allows
machine check interrupt patching in OPAL and reclaims back 4k of stack
space for use of normal stack. For older kernel the patching request
will result into an error.

The subsequent patch will remove the rest of MCE handling code from OPAL.

Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
This commit is contained in:
Mahesh Salgaonkar
2014-11-19 10:09:11 +05:30
committed by Benjamin Herrenschmidt
parent b5cbf94fae
commit 80eee19464
2 changed files with 2 additions and 32 deletions

View File

@@ -421,30 +421,9 @@ static int64_t patch_exception(uint64_t vector, uint64_t glue, bool hv)
/* Patch-in the vector number */
*(uint32_t *)(glue + exc_secondary_patch_type) |= vector;
/*
* If machine check, patch GET_STACK to get to the MC stack
* instead of the normal stack.
*
* To simplify the arithmetic involved I make assumptions
* on the fact that the base of all CPU stacks is 64k aligned
* and that our stack size is < 32k, which means that the
* "addi" instruction used in GET_STACK() is always using a
* small (<32k) positive offset, which we can then easily
* fixup with a simple addition
*/
BUILD_ASSERT(STACK_SIZE < 0x8000);
BUILD_ASSERT(!(CPU_STACKS_BASE & 0xffff));
if (vector == 0x200) {
/*
* The addi we try to patch is the 3rd instruction
* of GET_STACK(). If you change the macro, you must
* update this code
*/
iaddr = glue + exc_secondary_patch_stack + 8;
*(uint32_t *)iaddr += MC_STACK_SIZE;
}
/* Standard exception ? All done */
if (!hv)
goto flush;
@@ -469,13 +448,10 @@ static int64_t patch_exception(uint64_t vector, uint64_t glue, bool hv)
}
static int64_t opal_register_exc_handler(uint64_t opal_exception,
uint64_t handler_address,
uint64_t handler_address __unused,
uint64_t glue_cache_line)
{
switch(opal_exception) {
case OPAL_MACHINE_CHECK_HANDLER:
client_mc_address = handler_address;
return patch_exception(0x200, glue_cache_line, false);
case OPAL_HYPERVISOR_MAINTENANCE_HANDLER:
return patch_exception(0xe60, glue_cache_line, true);
#if 0 /* We let Linux handle softpatch */

View File

@@ -25,22 +25,16 @@
#define STACK_ENTRY_RESET 0x0100 /* System reset */
#define STACK_ENTRY_SOFTPATCH 0x1500 /* Soft patch (denorm emulation) */
/* Portion of the stack reserved for machine checks */
#define MC_STACK_SIZE 0x1000
/* Safety/ABI gap at top of stack */
#define STACK_TOP_GAP 0x100
/* Remaining stack space (gap included) */
#define NORMAL_STACK_SIZE (STACK_SIZE - MC_STACK_SIZE)
#define NORMAL_STACK_SIZE STACK_SIZE
/* Offset to get to normal CPU stacks */
#define CPU_STACKS_OFFSET (CPU_STACKS_BASE + \
NORMAL_STACK_SIZE - STACK_TOP_GAP)
/* Offset to get to machine check CPU stacks */
#define CPU_MC_STACKS_OFFSET (CPU_STACKS_BASE + STACK_SIZE - STACK_TOP_GAP)
/* Gap below the stack. If our stack checker sees the stack below that
* gap, it will flag a stack overflow
*/