From ced2ae827abc29837b919f09248cd1e9fabbb8b0 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Wed, 11 Sep 2019 05:57:56 -0400 Subject: [PATCH] Replace backport of powerpc-tm-fix-restoring-fp-vmx-facility-incorrectly-on-interrupts.patch Avoid taking a modified backport by pulling in a dependency instead. Signed-off-by: Sasha Levin --- ...storing-fp-vmx-facility-incorrectly.patch} | 34 ++--- .../powerpc-tm-remove-msr_tm_active.patch | 120 ++++++++++++++++++ queue-4.19/series | 3 +- 3 files changed, 139 insertions(+), 18 deletions(-) rename queue-4.19/{powerpc-tm-fix-restoring-fp-vmx-facility-incorrectly-on-interrupts.patch => powerpc-tm-fix-restoring-fp-vmx-facility-incorrectly.patch} (85%) create mode 100644 queue-4.19/powerpc-tm-remove-msr_tm_active.patch diff --git a/queue-4.19/powerpc-tm-fix-restoring-fp-vmx-facility-incorrectly-on-interrupts.patch b/queue-4.19/powerpc-tm-fix-restoring-fp-vmx-facility-incorrectly.patch similarity index 85% rename from queue-4.19/powerpc-tm-fix-restoring-fp-vmx-facility-incorrectly-on-interrupts.patch rename to queue-4.19/powerpc-tm-fix-restoring-fp-vmx-facility-incorrectly.patch index 233584c5c97..7e4d80afc38 100644 --- a/queue-4.19/powerpc-tm-fix-restoring-fp-vmx-facility-incorrectly-on-interrupts.patch +++ b/queue-4.19/powerpc-tm-fix-restoring-fp-vmx-facility-incorrectly.patch @@ -1,11 +1,9 @@ -From a8318c13e79badb92bc6640704a64cc022a6eb97 Mon Sep 17 00:00:00 2001 +From 2cb9297f4e4785a8464e68455a3014389126a7de Mon Sep 17 00:00:00 2001 From: Gustavo Romero Date: Wed, 4 Sep 2019 00:55:28 -0400 Subject: powerpc/tm: Fix restoring FP/VMX facility incorrectly on interrupts -From: Gustavo Romero - -commit a8318c13e79badb92bc6640704a64cc022a6eb97 upstream. +[ Upstream commit a8318c13e79badb92bc6640704a64cc022a6eb97 ] When in userspace and MSR FP=0 the hardware FP state is unrelated to the current process. This is extended for transactions where if tbegin @@ -82,39 +80,38 @@ Signed-off-by: Gustavo Romero Signed-off-by: Michael Neuling Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20190904045529.23002-2-gromero@linux.vnet.ibm.com -Signed-off-by: Greg Kroah-Hartman - +Signed-off-by: Sasha Levin --- - arch/powerpc/kernel/process.c | 19 ++----------------- - 1 file changed, 2 insertions(+), 17 deletions(-) + arch/powerpc/kernel/process.c | 18 ++---------------- + 1 file changed, 2 insertions(+), 16 deletions(-) +diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c +index 49c6d474eb5ac..909c9407e392a 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c -@@ -106,23 +106,9 @@ static inline bool msr_tm_active(unsigne - { - return MSR_TM_ACTIVE(msr); +@@ -102,21 +102,8 @@ static void check_if_tm_restore_required(struct task_struct *tsk) + } } -- + -static bool tm_active_with_fp(struct task_struct *tsk) -{ -- return msr_tm_active(tsk->thread.regs->msr) && +- return MSR_TM_ACTIVE(tsk->thread.regs->msr) && - (tsk->thread.ckpt_regs.msr & MSR_FP); -} - -static bool tm_active_with_altivec(struct task_struct *tsk) -{ -- return msr_tm_active(tsk->thread.regs->msr) && +- return MSR_TM_ACTIVE(tsk->thread.regs->msr) && - (tsk->thread.ckpt_regs.msr & MSR_VEC); -} #else - static inline bool msr_tm_active(unsigned long msr) { return false; } static inline void check_if_tm_restore_required(struct task_struct *tsk) { } -static inline bool tm_active_with_fp(struct task_struct *tsk) { return false; } -static inline bool tm_active_with_altivec(struct task_struct *tsk) { return false; } #endif /* CONFIG_PPC_TRANSACTIONAL_MEM */ bool strict_msr_control; -@@ -256,7 +242,7 @@ EXPORT_SYMBOL(enable_kernel_fp); +@@ -251,7 +238,7 @@ EXPORT_SYMBOL(enable_kernel_fp); static int restore_fp(struct task_struct *tsk) { @@ -123,7 +120,7 @@ Signed-off-by: Greg Kroah-Hartman load_fp_state(¤t->thread.fp_state); current->thread.load_fp++; return 1; -@@ -337,8 +323,7 @@ EXPORT_SYMBOL_GPL(flush_altivec_to_threa +@@ -333,8 +320,7 @@ EXPORT_SYMBOL_GPL(flush_altivec_to_thread); static int restore_altivec(struct task_struct *tsk) { @@ -133,3 +130,6 @@ Signed-off-by: Greg Kroah-Hartman load_vr_state(&tsk->thread.vr_state); tsk->thread.used_vr = 1; tsk->thread.load_vec++; +-- +2.20.1 + diff --git a/queue-4.19/powerpc-tm-remove-msr_tm_active.patch b/queue-4.19/powerpc-tm-remove-msr_tm_active.patch new file mode 100644 index 00000000000..97420b51770 --- /dev/null +++ b/queue-4.19/powerpc-tm-remove-msr_tm_active.patch @@ -0,0 +1,120 @@ +From b40bf7727ca06797e6175bc12fd5198ed699d707 Mon Sep 17 00:00:00 2001 +From: Breno Leitao +Date: Thu, 16 Aug 2018 14:21:07 -0300 +Subject: powerpc/tm: Remove msr_tm_active() + +[ Upstream commit 5c784c8414fba11b62e12439f11e109fb5751f38 ] + +Currently msr_tm_active() is a wrapper around MSR_TM_ACTIVE() if +CONFIG_PPC_TRANSACTIONAL_MEM is set, or it is just a function that +returns false if CONFIG_PPC_TRANSACTIONAL_MEM is not set. + +This function is not necessary, since MSR_TM_ACTIVE() just do the same and +could be used, removing the dualism and simplifying the code. + +This patchset remove every instance of msr_tm_active() and replaced it +by MSR_TM_ACTIVE(). + +Signed-off-by: Breno Leitao +Signed-off-by: Michael Ellerman +Signed-off-by: Sasha Levin +--- + arch/powerpc/include/asm/reg.h | 7 ++++++- + arch/powerpc/kernel/process.c | 21 +++++++++------------ + 2 files changed, 15 insertions(+), 13 deletions(-) + +diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h +index e5b314ed054e0..640a4d818772a 100644 +--- a/arch/powerpc/include/asm/reg.h ++++ b/arch/powerpc/include/asm/reg.h +@@ -118,11 +118,16 @@ + #define MSR_TS_S __MASK(MSR_TS_S_LG) /* Transaction Suspended */ + #define MSR_TS_T __MASK(MSR_TS_T_LG) /* Transaction Transactional */ + #define MSR_TS_MASK (MSR_TS_T | MSR_TS_S) /* Transaction State bits */ +-#define MSR_TM_ACTIVE(x) (((x) & MSR_TS_MASK) != 0) /* Transaction active? */ + #define MSR_TM_RESV(x) (((x) & MSR_TS_MASK) == MSR_TS_MASK) /* Reserved */ + #define MSR_TM_TRANSACTIONAL(x) (((x) & MSR_TS_MASK) == MSR_TS_T) + #define MSR_TM_SUSPENDED(x) (((x) & MSR_TS_MASK) == MSR_TS_S) + ++#ifdef CONFIG_PPC_TRANSACTIONAL_MEM ++#define MSR_TM_ACTIVE(x) (((x) & MSR_TS_MASK) != 0) /* Transaction active? */ ++#else ++#define MSR_TM_ACTIVE(x) 0 ++#endif ++ + #if defined(CONFIG_PPC_BOOK3S_64) + #define MSR_64BIT MSR_SF + +diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c +index 967c044036718..49c6d474eb5ac 100644 +--- a/arch/powerpc/kernel/process.c ++++ b/arch/powerpc/kernel/process.c +@@ -102,24 +102,18 @@ static void check_if_tm_restore_required(struct task_struct *tsk) + } + } + +-static inline bool msr_tm_active(unsigned long msr) +-{ +- return MSR_TM_ACTIVE(msr); +-} +- + static bool tm_active_with_fp(struct task_struct *tsk) + { +- return msr_tm_active(tsk->thread.regs->msr) && ++ return MSR_TM_ACTIVE(tsk->thread.regs->msr) && + (tsk->thread.ckpt_regs.msr & MSR_FP); + } + + static bool tm_active_with_altivec(struct task_struct *tsk) + { +- return msr_tm_active(tsk->thread.regs->msr) && ++ return MSR_TM_ACTIVE(tsk->thread.regs->msr) && + (tsk->thread.ckpt_regs.msr & MSR_VEC); + } + #else +-static inline bool msr_tm_active(unsigned long msr) { return false; } + static inline void check_if_tm_restore_required(struct task_struct *tsk) { } + static inline bool tm_active_with_fp(struct task_struct *tsk) { return false; } + static inline bool tm_active_with_altivec(struct task_struct *tsk) { return false; } +@@ -247,7 +241,8 @@ void enable_kernel_fp(void) + * giveup as this would save to the 'live' structure not the + * checkpointed structure. + */ +- if(!msr_tm_active(cpumsr) && msr_tm_active(current->thread.regs->msr)) ++ if (!MSR_TM_ACTIVE(cpumsr) && ++ MSR_TM_ACTIVE(current->thread.regs->msr)) + return; + __giveup_fpu(current); + } +@@ -311,7 +306,8 @@ void enable_kernel_altivec(void) + * giveup as this would save to the 'live' structure not the + * checkpointed structure. + */ +- if(!msr_tm_active(cpumsr) && msr_tm_active(current->thread.regs->msr)) ++ if (!MSR_TM_ACTIVE(cpumsr) && ++ MSR_TM_ACTIVE(current->thread.regs->msr)) + return; + __giveup_altivec(current); + } +@@ -397,7 +393,8 @@ void enable_kernel_vsx(void) + * giveup as this would save to the 'live' structure not the + * checkpointed structure. + */ +- if(!msr_tm_active(cpumsr) && msr_tm_active(current->thread.regs->msr)) ++ if (!MSR_TM_ACTIVE(cpumsr) && ++ MSR_TM_ACTIVE(current->thread.regs->msr)) + return; + __giveup_vsx(current); + } +@@ -531,7 +528,7 @@ void restore_math(struct pt_regs *regs) + { + unsigned long msr; + +- if (!msr_tm_active(regs->msr) && ++ if (!MSR_TM_ACTIVE(regs->msr) && + !current->thread.load_fp && !loadvec(current->thread)) + return; + +-- +2.20.1 + diff --git a/queue-4.19/series b/queue-4.19/series index b4dc49bdbd2..05905c99ab9 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -8,7 +8,6 @@ drm-vmwgfx-fix-double-free-in-vmw_recv_msg.patch vhost-test-fix-build-for-vhost-test.patch vhost-test-fix-build-for-vhost-test-again.patch powerpc-tm-fix-fp-vmx-unavailable-exceptions-inside-a-transaction.patch -powerpc-tm-fix-restoring-fp-vmx-facility-incorrectly-on-interrupts.patch batman-adv-fix-uninit-value-in-batadv_netlink_get_ifindex.patch batman-adv-only-read-ogm-tvlv_len-after-buffer-len-check.patch hv_sock-fix-hang-when-a-connection-is-closed.patch @@ -190,3 +189,5 @@ ext4-don-t-perform-block-validity-checks-on-the-jour.patch ext4-fix-block-validity-checks-for-journal-inodes-us.patch ext4-unsigned-int-compared-against-zero.patch pci-reset-both-nvidia-gpu-and-hda-in-thinkpad-p50-wo.patch +powerpc-tm-remove-msr_tm_active.patch +powerpc-tm-fix-restoring-fp-vmx-facility-incorrectly.patch -- 2.47.3