couple of minor DAWR fixes
Subsystems (2)
Nicholas Piggin
reviewercover couple of minor DAWR fixes
Nicholas Piggin (2):
KVM: PPC: Book3S HV: Fix ppc_breakpoint_available compile error
powerpc: Fix DABR write in the case of DAWR disabled
arch/powerpc/kernel/process.c | 13 +++++++++---- arch/powerpc/kvm/book3s_hv.c | 1 + 2 files changed, 10 insertions(+), 4 deletions(-)
Signature · 1 line
2.16.3
Nicholas Piggin
reviewerPATCH 1/2 KVM: PPC: Book3S HV: Fix ppc_breakpoint_available compile error
arch/powerpc/kvm/book3s_hv.c: In function ‘kvmppc_h_set_mode’:arch/powerpc/kvm/book3s_hv.c:745:8: error: implicit declaration of function ‘ppc_breakpoint_available’; did you mean ‘hw_breakpoint_disable’? [-Werror=implicit-function-declaration]
if (!ppc_breakpoint_available())
^~~~~~~~~~~~~~~~~~~~~~~~
hw_breakpoint_disable--- arch/powerpc/kvm/book3s_hv.c | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/kvm/book3s_hv.c +1 -0
@@ -49,6 +49,7 @@#include <asm/reg.h> #include <asm/ppc-opcode.h> #include <asm/asm-prototypes.h> +#include <asm/debug.h> #include <asm/disassemble.h> #include <asm/cputable.h> #include <asm/cacheflush.h>
Signature · 1 line
2.16.3
Re: [1/2] KVM: PPC: Book3S HV: Fix ppc_breakpoint_available compile error
Quoted 9 lines · Nicholas Piggin
arch/powerpc/kvm/book3s_hv.c: In function ‘kvmppc_h_set_mode’:arch/powerpc/kvm/book3s_hv.c:745:8: error: implicit declaration of function ‘ppc_breakpoint_available’; did you mean ‘hw_breakpoint_disable’? [-Werror=implicit-function-declaration]
if (!ppc_breakpoint_available())^~~~~~~~~~~~~~~~~~~~~~~~ hw_breakpoint_disableCc Michael Neuling <[email protected]>Fixes 398e712c00 ("KVM: PPC: Book3S HV: Return error from h_set_mode(SET_DAWR) on POWER9")Signed-off-by Nicholas Piggin <[email protected]>
Series applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/e303c08787c4cbe1ca07912817dff2
cheers
Nicholas Piggin
reviewerPATCH 2/2 powerpc: Fix DABR write in the case of DAWR disabled
In reply to Nicholas Pigginflush_thread will call set_breakpoint via set_debug_reg_defaults, and cause POWER8 and above CPUs without the DAWR feature to try to write to DAWR.
--- arch/powerpc/kernel/process.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
arch/powerpc/kernel/process.c +9 -4
@@ -718,7 +718,8 @@ static void set_debug_reg_defaults(struct thread_struct *thread) { thread->hw_brk.address =0 ; thread->hw_brk.type =0 ; -set_breakpoint (&thread->hw_brk); +if (ppc_breakpoint_available ()) +set_breakpoint (&thread->hw_brk); }#endif /* !CONFIG_HAVE_HW_BREAKPOINT */ #endif /* CONFIG_PPC_ADV_DEBUG_REGS */
@@ -814,10 +815,14 @@ void __set_breakpoint(struct arch_hw_breakpoint *brk) {memcpy (this_cpu_ptr (¤t_brk), brk,sizeof (*brk)); -if (cpu_has_feature (CPU_FTR_DAWR )) -set_dawr (brk); -else +if (cpu_has_feature (CPU_FTR_ARCH_207S )) { +if (cpu_has_feature (CPU_FTR_DAWR )) +set_dawr (brk); +else +WARN_ON_ONCE (1 ); + }else {set_dabr (brk); + } }void set_breakpoint (struct arch_hw_breakpoint *brk)
Signature · 1 line
2.16.3
Nicholas Piggin
reviewerRe: [PATCH 2/2] powerpc: Fix DABR write in the case of DAWR disabled
Quoted 3 lines · On Sun, 1 Apr 2018 15:50:36 +1000 Nicholas Piggin <[email protected]> wrote:
flush_threadwill callset_breakpointviaset_debug_reg_defaults, and cause POWER8 and above CPUs without the DAWR feature to try to write to DAWR.
^^^^
DABRQuoted 39 lines
Cc Michael Neuling <[email protected]>Signed-off-by Nicholas Piggin <[email protected]>--- arch/powerpc/kernel/process.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)arch/powerpc/kernel/process.c +9
-4@@ -718,7 +718,8 @@ static void set_debug_reg_defaults(struct thread_struct *thread) { thread->hw_brk.address =0 ; thread->hw_brk.type =0 ; -set_breakpoint (&thread->hw_brk); +if (ppc_breakpoint_available ()) +set_breakpoint (&thread->hw_brk); }#endif /* !CONFIG_HAVE_HW_BREAKPOINT */ #endif /* CONFIG_PPC_ADV_DEBUG_REGS */ @@ -814,10 +815,14 @@ void __set_breakpoint(struct arch_hw_breakpoint *brk) {memcpy (this_cpu_ptr (¤t_brk), brk,sizeof (*brk)); -if (cpu_has_feature (CPU_FTR_DAWR )) -set_dawr (brk); -else +if (cpu_has_feature (CPU_FTR_ARCH_207S )) { +if (cpu_has_feature (CPU_FTR_DAWR )) +set_dawr (brk); +else +WARN_ON_ONCE (1 ); + }else {set_dabr (brk); + } }void set_breakpoint (struct arch_hw_breakpoint *brk)