mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: James Hogan <james.hogan@imgtec.com>
To: Paul Burton <paul.burton@imgtec.com>
Cc: <linux-mips@linux-mips.org>, Ralf Baechle <ralf@linux-mips.org>,
	"Markos Chandras" <markos.chandras@imgtec.com>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 03/15] MIPS: pm-cps: Avoid offset overflow on MIPSr6
Date: Wed, 3 Feb 2016 14:48:39 +0000	[thread overview]
Message-ID: <20160203144838.GG5464@jhogan-linux.le.imgtec.org> (raw)
In-Reply-To: <1454469335-14778-4-git-send-email-paul.burton@imgtec.com>

[-- Attachment #1: Type: text/plain, Size: 2535 bytes --]

On Wed, Feb 03, 2016 at 03:15:23AM +0000, Paul Burton wrote:
> From: Markos Chandras <markos.chandras@imgtec.com>
> 
> This is similar to commit 934c79231c1b ("MIPS: asm: r4kcache: Add MIPS
> R6 cache unroll functions"). The CACHE instruction has been redefined
> for MIPSr6 and it reduced its offset field to 8 bits. This leads to
> micro-assembler field overflow warnings when booting SMP MIPSr6 cores
> like the following one:
> 
> Call Trace:
> [<ffffffff8010af88>] show_stack+0x68/0x88
> [<ffffffff8056ddf0>] dump_stack+0x68/0x88
> [<ffffffff801305bc>] warn_slowpath_common+0x8c/0xc8
> [<ffffffff80130630>] warn_slowpath_fmt+0x38/0x48
> [<ffffffff80125814>] build_insn+0x514/0x5c0
> [<ffffffff806ee134>] cps_gen_cache_routine.isra.3+0xe0/0x1b8
> [<ffffffff806ee570>] cps_pm_init+0x364/0x9ec
> [<ffffffff80100538>] do_one_initcall+0x90/0x1a8
> [<ffffffff806e8c14>] kernel_init_freeable+0x160/0x21c
> [<ffffffff8056b6a0>] kernel_init+0x10/0xf8
> [<ffffffff801059f8>] ret_from_kernel_thread+0x14/0x1c
> 
> We fix this by incrementing the base register on every loop.
> 
> Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
> Signed-off-by: Paul Burton <paul.burton@imgtec.com>
> ---
> 
>  arch/mips/kernel/pm-cps.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/mips/kernel/pm-cps.c b/arch/mips/kernel/pm-cps.c
> index f63a289..524ba11 100644
> --- a/arch/mips/kernel/pm-cps.c
> +++ b/arch/mips/kernel/pm-cps.c
> @@ -224,11 +224,18 @@ static void __init cps_gen_cache_routine(u32 **pp, struct uasm_label **pl,
>  	uasm_build_label(pl, *pp, lbl);
>  
>  	/* Generate the cache ops */
> -	for (i = 0; i < unroll_lines; i++)
> -		uasm_i_cache(pp, op, i * cache->linesz, t0);
> +	for (i = 0; i < unroll_lines; i++) {

Maybe worth adding a comment here to mention different immediate field
size in r6 encodings, otherwise it could look a bit mysterious to the
reader.

Cheers
James

> +		if (cpu_has_mips_r6) {
> +			uasm_i_cache(pp, op, 0, t0);
> +			uasm_i_addiu(pp, t0, t0, cache->linesz);
> +		} else {
> +			uasm_i_cache(pp, op, i * cache->linesz, t0);
> +		}
> +	}
>  
> -	/* Update the base address */
> -	uasm_i_addiu(pp, t0, t0, unroll_lines * cache->linesz);
> +	if (!cpu_has_mips_r6)
> +		/* Update the base address */
> +		uasm_i_addiu(pp, t0, t0, unroll_lines * cache->linesz);
>  
>  	/* Loop if we haven't reached the end address yet */
>  	uasm_il_bne(pp, pr, t0, t1, lbl);
> -- 
> 2.7.0
> 
> 

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2016-02-03 14:48 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-03  3:15 [PATCH 00/15] Support for MIPSr6 Virtual Processors (multi-threading) Paul Burton
2016-02-03  3:15 ` [PATCH 01/15] MIPS: Detect MIPSr6 Virtual Processor support Paul Burton
2016-02-03  3:15 ` [PATCH 02/15] MIPS: traps: Make sure secondary cores have a sane ebase register Paul Burton
2016-02-03  3:15 ` [PATCH 03/15] MIPS: pm-cps: Avoid offset overflow on MIPSr6 Paul Burton
2016-02-03 14:48   ` James Hogan [this message]
2016-02-03  3:15 ` [PATCH 04/15] MIPS: CPC: Add start, stop and running CM3 CPC registers Paul Burton
2016-02-03  3:15 ` [PATCH 05/15] MIPS: CM: Add CM GCR_BEV_BASE accessors Paul Burton
2016-02-03  3:15 ` [PATCH 06/15] MIPS: CM: Fix mips_cm_max_vp_width for UP kernels Paul Burton
2016-02-03 14:58   ` James Hogan
2016-02-03 15:46     ` Paul Burton
2016-02-03 16:15       ` James Hogan
2016-02-03  3:15 ` [PATCH 07/15] irqchip: mips-gic: Use HW IDs for VPE_OTHER_ADDR Paul Burton
2016-02-18  1:47   ` Jason Cooper
2016-02-03  3:15 ` [PATCH 08/15] irqchip: mips-gic: Provide VP ID accessor Paul Burton
2016-02-18  1:48   ` Jason Cooper
2016-02-03  3:15 ` [PATCH 09/15] MIPS: smp-cps: Ensure our VP ident calculation is correct Paul Burton
2016-02-03  3:15 ` [PATCH 10/15] MIPS: smp-cps: Pull cache init into a function Paul Burton
2016-02-03  3:15 ` [PATCH 11/15] MIPS: smp-cps: Pull boot config retrieval out of mips_cps_boot_vpes Paul Burton
2016-02-03  3:15 ` [PATCH 12/15] MIPS: smp-cps: Skip core setup if coherent Paul Burton
2016-02-03  3:15 ` [PATCH 13/15] MIPS: smp-cps: Support MIPSr6 Virtual Processors Paul Burton
2016-02-03  3:15 ` [PATCH 14/15] MIPS: smp-cps: Add nothreads kernel parameter Paul Burton
2016-02-18  2:40   ` Florian Fainelli
2016-02-03  3:15 ` [PATCH 15/15] MIPS: smp-cps: Stop printing EJTAG exceptions to UART Paul Burton

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=20160203144838.GG5464@jhogan-linux.le.imgtec.org \
    --to=james.hogan@imgtec.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=markos.chandras@imgtec.com \
    --cc=paul.burton@imgtec.com \
    --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

all inboxes | Powered by JetHome®