drivers: power: report battery voltage in AOSP compatible format
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / arch / powerpc / kernel / signal_64.c
index 345947367ec00a4fa440e162005864d9708eae6a..2419c17538e2010c908fc182c990a5874ebf473f 100644 (file)
@@ -121,6 +121,12 @@ static long setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
        flush_fp_to_thread(current);
        /* copy fpr regs and fpscr */
        err |= copy_fpr_to_user(&sc->fp_regs, current);
+
+       /*
+        * Clear the MSR VSX bit to indicate there is no valid state attached
+        * to this context, except in the specific case below where we set it.
+        */
+       msr &= ~MSR_VSX;
 #ifdef CONFIG_VSX
        /*
         * Copy VSX low doubleword to local buffer for formatting,
@@ -410,6 +416,14 @@ static long restore_tm_sigcontexts(struct pt_regs *regs,
 
        /* get MSR separately, transfer the LE bit if doing signal return */
        err |= __get_user(msr, &sc->gp_regs[PT_MSR]);
+       /* Don't allow reserved mode. */
+       if (MSR_TM_RESV(msr))
+               return -EINVAL;
+
+       /* pull in MSR TM from user context */
+       regs->msr = (regs->msr & ~MSR_TS_MASK) | (msr & MSR_TS_MASK);
+
+       /* pull in MSR LE from user context */
        regs->msr = (regs->msr & ~MSR_LE) | (msr & MSR_LE);
 
        /* The following non-GPR non-FPR non-VR state is also checkpointed: */
@@ -503,10 +517,10 @@ static long restore_tm_sigcontexts(struct pt_regs *regs,
        }
 #endif
        tm_enable();
+       /* Make sure the transaction is marked as failed */
+       current->thread.tm_texasr |= TEXASR_FS;
        /* This loads the checkpointed FP/VEC state, if used */
        tm_recheckpoint(&current->thread, msr);
-       /* The task has moved into TM state S, so ensure MSR reflects this: */
-       regs->msr = (regs->msr & ~MSR_TS_MASK) | __MASK(33);
 
        /* This loads the speculative FP/VEC state, if used */
        if (msr & MSR_FP) {
@@ -654,7 +668,7 @@ int sys_rt_sigreturn(unsigned long r3, unsigned long r4, unsigned long r5,
 #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
        if (__get_user(msr, &uc->uc_mcontext.gp_regs[PT_MSR]))
                goto badframe;
-       if (MSR_TM_SUSPENDED(msr)) {
+       if (MSR_TM_ACTIVE(msr)) {
                /* We recheckpoint on return. */
                struct ucontext __user *uc_transact;
                if (__get_user(uc_transact, &uc->uc_link))