From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ralf Baechle Subject: Re: [PATCH 8/9] MIPS: KVM: Decode RDHWR more strictly Date: Tue, 5 Jul 2016 14:51:12 +0200 Message-ID: <20160705125112.GJ7075@linux-mips.org> References: <1467657315-19975-1-git-send-email-james.hogan@imgtec.com> <1467657315-19975-9-git-send-email-james.hogan@imgtec.com> <24b4b1b6-2a58-63f8-f2c2-78ecc6eceb4e@cogentembedded.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: James Hogan , Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , Paul Burton , linux-mips@linux-mips.org, kvm@vger.kernel.org To: Sergei Shtylyov Return-path: Content-Disposition: inline In-Reply-To: <24b4b1b6-2a58-63f8-f2c2-78ecc6eceb4e@cogentembedded.com> Sender: linux-mips-bounce@linux-mips.org Errors-to: linux-mips-bounce@linux-mips.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-subscribe: List-owner: List-post: List-archive: List-Id: kvm.vger.kernel.org On Tue, Jul 05, 2016 at 02:16:48PM +0300, Sergei Shtylyov wrote: > > When KVM emulates the RDHWR instruction, decode the instruction mor= e > > strictly. The rs field (bits 25:21) should be zero, as should bits = 10:9. > > Bits 8:6 is the register select field in MIPSr6, so we aren't stric= t > > about those bits (no other operations should use that encoding spac= e). > >=20 > > Signed-off-by: James Hogan > > Cc: Paolo Bonzini > > Cc: Radim Kr=C4=8Dm=C3=A1=C5=99 > > Cc: Ralf Baechle > > Cc: linux-mips@linux-mips.org > > Cc: kvm@vger.kernel.org > > --- > > arch/mips/kvm/emulate.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > >=20 > > diff --git a/arch/mips/kvm/emulate.c b/arch/mips/kvm/emulate.c > > index 62e6a7b313ae..be18dfe9ecaa 100644 > > --- a/arch/mips/kvm/emulate.c > > +++ b/arch/mips/kvm/emulate.c > > @@ -2357,7 +2357,9 @@ enum emulation_result kvm_mips_handle_ri(u32 = cause, u32 *opc, > > } > >=20 > > if (inst.r_format.opcode =3D=3D spec3_op && > > - inst.r_format.func =3D=3D rdhwr_op) { > > + inst.r_format.func =3D=3D rdhwr_op && > > + inst.r_format.rs =3D=3D 0 && > > + (inst.r_format.re >> 3) =3D=3D 0) { >=20 > Inner parens not necessary here. While I often strip unnecessary parens from patches I apply my guidelin= e for leaving them in is that nobody should need to know all C operator prior= ities by heart. Ralf