All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] couple of minor DAWR fixes
@ 2018-04-01  5:50 Nicholas Piggin
  2018-04-01  5:50 ` [PATCH 1/2] KVM: PPC: Book3S HV: Fix ppc_breakpoint_available compile error Nicholas Piggin
  2018-04-01  5:50 ` [PATCH 2/2] powerpc: Fix DABR write in the case of DAWR disabled Nicholas Piggin
  0 siblings, 2 replies; 5+ messages in thread
From: Nicholas Piggin @ 2018-04-01  5:50 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nicholas Piggin

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(-)

-- 
2.16.3

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] KVM: PPC: Book3S HV: Fix ppc_breakpoint_available compile error
  2018-04-01  5:50 [PATCH 0/2] couple of minor DAWR fixes Nicholas Piggin
@ 2018-04-01  5:50 ` Nicholas Piggin
  2018-04-03 16:03   ` [1/2] " Michael Ellerman
  2018-04-01  5:50 ` [PATCH 2/2] powerpc: Fix DABR write in the case of DAWR disabled Nicholas Piggin
  1 sibling, 1 reply; 5+ messages in thread
From: Nicholas Piggin @ 2018-04-01  5:50 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nicholas Piggin, Michael Neuling

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

Cc: Michael Neuling <mikey@neuling.org>
Fixes: 398e712c00 ("KVM: PPC: Book3S HV: Return error from h_set_mode(SET_DAWR) on POWER9")
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/kvm/book3s_hv.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 948642e16338..81e2ea882d97 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -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>
-- 
2.16.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] powerpc: Fix DABR write in the case of DAWR disabled
  2018-04-01  5:50 [PATCH 0/2] couple of minor DAWR fixes Nicholas Piggin
  2018-04-01  5:50 ` [PATCH 1/2] KVM: PPC: Book3S HV: Fix ppc_breakpoint_available compile error Nicholas Piggin
@ 2018-04-01  5:50 ` Nicholas Piggin
  2018-04-01  7:40   ` Nicholas Piggin
  1 sibling, 1 reply; 5+ messages in thread
From: Nicholas Piggin @ 2018-04-01  5:50 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nicholas Piggin, Michael Neuling

flush_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.

Cc: Michael Neuling <mikey@neuling.org>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/kernel/process.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 24a591b4dbe9..bfcf5437083c 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -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(&current_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)
-- 
2.16.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] powerpc: Fix DABR write in the case of DAWR disabled
  2018-04-01  5:50 ` [PATCH 2/2] powerpc: Fix DABR write in the case of DAWR disabled Nicholas Piggin
@ 2018-04-01  7:40   ` Nicholas Piggin
  0 siblings, 0 replies; 5+ messages in thread
From: Nicholas Piggin @ 2018-04-01  7:40 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Michael Neuling

On Sun,  1 Apr 2018 15:50:36 +1000
Nicholas Piggin <npiggin@gmail.com> wrote:

> flush_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.
              ^^^^
              DABR

> 
> Cc: Michael Neuling <mikey@neuling.org>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
>  arch/powerpc/kernel/process.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
> index 24a591b4dbe9..bfcf5437083c 100644
> --- a/arch/powerpc/kernel/process.c
> +++ b/arch/powerpc/kernel/process.c
> @@ -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(&current_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)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [1/2] KVM: PPC: Book3S HV: Fix ppc_breakpoint_available compile error
  2018-04-01  5:50 ` [PATCH 1/2] KVM: PPC: Book3S HV: Fix ppc_breakpoint_available compile error Nicholas Piggin
@ 2018-04-03 16:03   ` Michael Ellerman
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2018-04-03 16:03 UTC (permalink / raw)
  To: Nicholas Piggin, linuxppc-dev; +Cc: Michael Neuling, Nicholas Piggin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 731 bytes --]

On Sun, 2018-04-01 at 05:50:35 UTC, Nicholas Piggin wrote:
> 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
> 
> Cc: Michael Neuling <mikey@neuling.org>
> Fixes: 398e712c00 ("KVM: PPC: Book3S HV: Return error from h_set_mode(SET_DAWR) on POWER9")
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>

Series applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/e303c08787c4cbe1ca07912817dff2

cheers

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-04-03 16:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-01  5:50 [PATCH 0/2] couple of minor DAWR fixes Nicholas Piggin
2018-04-01  5:50 ` [PATCH 1/2] KVM: PPC: Book3S HV: Fix ppc_breakpoint_available compile error Nicholas Piggin
2018-04-03 16:03   ` [1/2] " Michael Ellerman
2018-04-01  5:50 ` [PATCH 2/2] powerpc: Fix DABR write in the case of DAWR disabled Nicholas Piggin
2018-04-01  7:40   ` Nicholas Piggin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.