linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Nicholas Piggin <npiggin@gmail.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: Nicholas Piggin <npiggin@gmail.com>, Michael Neuling <mikey@neuling.org>
Subject: [PATCH 2/2] powerpc: Fix DABR write in the case of DAWR disabled
Date: Sun,  1 Apr 2018 15:50:36 +1000	[thread overview]
Message-ID: <20180401055036.18078-3-npiggin@gmail.com> (raw)
In-Reply-To: <20180401055036.18078-1-npiggin@gmail.com>

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

  parent reply	other threads:[~2018-04-01  5:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Nicholas Piggin [this message]
2018-04-01  7:40   ` [PATCH 2/2] powerpc: Fix DABR write in the case of DAWR disabled Nicholas Piggin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180401055036.18078-3-npiggin@gmail.com \
    --to=npiggin@gmail.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mikey@neuling.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).