Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: "Jayachandran C" <jchandra@broadcom.com>
To: linux-mips@linux-mips.org, ralf@linux-mips.org
Cc: "Jayachandran C" <jchandra@broadcom.com>
Subject: [PATCH 2/4] MIPS: Fixup check for invalid scratch register
Date: Mon, 10 Jun 2013 13:05:31 +0530	[thread overview]
Message-ID: <1370849733-5074-3-git-send-email-jchandra@broadcom.com> (raw)
In-Reply-To: <1370849733-5074-1-git-send-email-jchandra@broadcom.com>

The invalid value for scratch register is -1, so update the checks of
the form (scratch_reg > 0) to be (scratch_reg >= 0).  This will fix
the case in Netlogic XLP where the scratch_reg can be 0.

Signed-off-by: Jayachandran C <jchandra@broadcom.com>
---
 arch/mips/mm/tlbex.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
index b687c59..6bac544 100644
--- a/arch/mips/mm/tlbex.c
+++ b/arch/mips/mm/tlbex.c
@@ -350,7 +350,7 @@ static struct work_registers __cpuinit build_get_work_registers(u32 **p)
 	int smp_processor_id_sel;
 	int smp_processor_id_shift;
 
-	if (scratch_reg > 0) {
+	if (scratch_reg >= 0) {
 		/* Save in CPU local C0_KScratch? */
 		UASM_i_MTC0(p, 1, c0_kscratch, scratch_reg);
 		r.r1 = K0;
@@ -400,7 +400,7 @@ static struct work_registers __cpuinit build_get_work_registers(u32 **p)
 
 static void __cpuinit build_restore_work_registers(u32 **p)
 {
-	if (scratch_reg > 0) {
+	if (scratch_reg >= 0) {
 		UASM_i_MFC0(p, 1, c0_kscratch, scratch_reg);
 		return;
 	}
@@ -689,7 +689,7 @@ static __cpuinit void build_restore_pagemask(u32 **p,
 			uasm_i_mtc0(p, 0, C0_PAGEMASK);
 			uasm_il_b(p, r, lid);
 		}
-		if (scratch_reg > 0)
+		if (scratch_reg >= 0)
 			UASM_i_MFC0(p, 1, c0_kscratch, scratch_reg);
 		else
 			UASM_i_LW(p, 1, scratchpad_offset(0), 0);
@@ -945,7 +945,7 @@ build_get_pgd_vmalloc64(u32 **p, struct uasm_label **l, struct uasm_reloc **r,
 		uasm_i_jr(p, ptr);
 
 		if (mode == refill_scratch) {
-			if (scratch_reg > 0)
+			if (scratch_reg >= 0)
 				UASM_i_MFC0(p, 1, c0_kscratch, scratch_reg);
 			else
 				UASM_i_LW(p, 1, scratchpad_offset(0), 0);
@@ -1302,7 +1302,7 @@ static void __cpuinit build_r4000_tlb_refill_handler(void)
 	memset(relocs, 0, sizeof(relocs));
 	memset(final_handler, 0, sizeof(final_handler));
 
-	if ((scratch_reg > 0 || scratchpad_available()) && use_bbit_insns()) {
+	if ((scratch_reg >= 0 || scratchpad_available()) && use_bbit_insns()) {
 		htlb_info = build_fast_tlb_refill_handler(&p, &l, &r, K0, K1,
 							  scratch_reg);
 		vmalloc_mode = refill_scratch;
-- 
1.7.9.5

  parent reply	other threads:[~2013-06-10  7:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-10  7:35 [PATCH v3 0/4]Use scratch registers on XLR/XLS/XLP Jayachandran C
2013-06-10  7:35 ` [PATCH 1/4] MIPS: Allow platform specific scratch registers Jayachandran C
2013-06-10  7:35 ` Jayachandran C [this message]
2013-06-10  7:35 ` [PATCH 3/4] MIPS: mm: Use scratch for PGD when !CONFIG_MIPS_PGD_C0_CONTEXT Jayachandran C
2013-06-10  7:35 ` [PATCH 4/4] MIPS: Move definition of SMP processor id register to header file Jayachandran C
2013-06-11 11:44 ` [PATCH v3 0/4]Use scratch registers on XLR/XLS/XLP Jayachandran C.
  -- strict thread matches above, loose matches on Subject: below --
2013-06-11 15:41 [PATCH 0/4] Use " Jayachandran C
2013-06-11 15:41 ` [PATCH 2/4] MIPS: Fixup check for invalid scratch register Jayachandran C

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=1370849733-5074-3-git-send-email-jchandra@broadcom.com \
    --to=jchandra@broadcom.com \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.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