From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932550AbcBCOsm (ORCPT ); Wed, 3 Feb 2016 09:48:42 -0500 Received: from mailapp01.imgtec.com ([195.59.15.196]:23549 "EHLO imgpgp01.kl.imgtec.org" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932242AbcBCOsl (ORCPT ); Wed, 3 Feb 2016 09:48:41 -0500 X-PGP-Universal: processed; by imgpgp01.kl.imgtec.org on Wed, 03 Feb 2016 14:48:39 +0000 Date: Wed, 3 Feb 2016 14:48:39 +0000 From: James Hogan To: Paul Burton CC: , Ralf Baechle , "Markos Chandras" , Subject: Re: [PATCH 03/15] MIPS: pm-cps: Avoid offset overflow on MIPSr6 Message-ID: <20160203144838.GG5464@jhogan-linux.le.imgtec.org> References: <1454469335-14778-1-git-send-email-paul.burton@imgtec.com> <1454469335-14778-4-git-send-email-paul.burton@imgtec.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="m972NQjnE83KvVa/" Content-Disposition: inline In-Reply-To: <1454469335-14778-4-git-send-email-paul.burton@imgtec.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Originating-IP: [192.168.154.110] X-ESG-ENCRYPT-TAG: 56f439c Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --m972NQjnE83KvVa/ Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Feb 03, 2016 at 03:15:23AM +0000, Paul Burton wrote: > From: Markos Chandras >=20 > 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: >=20 > Call Trace: > [] show_stack+0x68/0x88 > [] dump_stack+0x68/0x88 > [] warn_slowpath_common+0x8c/0xc8 > [] warn_slowpath_fmt+0x38/0x48 > [] build_insn+0x514/0x5c0 > [] cps_gen_cache_routine.isra.3+0xe0/0x1b8 > [] cps_pm_init+0x364/0x9ec > [] do_one_initcall+0x90/0x1a8 > [] kernel_init_freeable+0x160/0x21c > [] kernel_init+0x10/0xf8 > [] ret_from_kernel_thread+0x14/0x1c >=20 > We fix this by incrementing the base register on every loop. >=20 > Signed-off-by: Markos Chandras > Signed-off-by: Paul Burton > --- >=20 > arch/mips/kernel/pm-cps.c | 15 +++++++++++---- > 1 file changed, 11 insertions(+), 4 deletions(-) >=20 > 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); > =20 > /* Generate the cache ops */ > - for (i =3D 0; i < unroll_lines; i++) > - uasm_i_cache(pp, op, i * cache->linesz, t0); > + for (i =3D 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); > + } > + } > =20 > - /* 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); > =20 > /* Loop if we haven't reached the end address yet */ > uasm_il_bne(pp, pr, t0, t1, lbl); > --=20 > 2.7.0 >=20 >=20 --m972NQjnE83KvVa/ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJWshNGAAoJEGwLaZPeOHZ6E2oP/0k2Jqgng4sEXpZi5kCXX+0+ E8QLoGqCg9BytB0wHOtkOkSotAcmVrfYB7+rLtjzdn0DGYGoLrVTxCBhDZ/viLQQ jZuR9UZXXveTqM6Ws+H5ZXL+Hi/uhYv0XmZolM69OUBTBh6EmNFM8aa3j1irnPzZ rN2RCD6fh9Glu7yXju2f1R/qRyMp66gbZSOD48OSnc4DlOt3J50krRF6sFckQEdy W0cywaE8vYKTpiHJZ3MMbFZlg6bqJ2b5Q4scD4ff+cmeqsedJsInPw6cYLBzvjCT bWDJg5MEBHGCzMYZdVd8cq8K0ucRiB4w0fyxqs44pdEaNIQbm20191c3rb/8rHRG IofppYgaj47HiKXnufMTl7uDtswVpH1r0ov/ntiDFMoOoD8S4I4rfsPlFPigXmj8 mnIUX5PqCvVN0Psphmi+QCgNONC+4Y+K+t9eygOyMKw3zBWkHpV+/K2ieuD0nDBr iOPCMamJiqwV06zDVVvl5A9QmvmIecj/S4R0xYzgP/UBi3Cbmnz2s6c58N2YGE+L PxNxZgWygTo++yrbS1uW3+nuzEI9ymJULWh1s3sZYH7dUnUQjObroY0ghvtICSXH LGpgTaJg9kSXZmO4DftN4oxKjUy2pdEFywdAKjyponBmHOBjf+OW2dS4Jq6/2vST n/B6A4RAyr2dkjUovVjo =Q0sr -----END PGP SIGNATURE----- --m972NQjnE83KvVa/--