On 06/17/2016 01:02 PM, Thomas Huth wrote: > On 17.06.2016 12:41, Cédric Le Goater wrote: >> On 06/17/2016 09:10 AM, Thomas Huth wrote: >>> On 17.06.2016 08:03, Cédric Le Goater wrote: >>>> On 06/17/2016 07:54 AM, Cédric Le Goater wrote: >>>>> On 06/17/2016 04:27 AM, David Gibson wrote: >>>>>> On Thu, Jun 16, 2016 at 11:07:02AM +1000, David Gibson wrote: >>>>>>> On Mon, Jun 13, 2016 at 07:24:47AM +0200, Cédric Le Goater wrote: >>>>>>>> From: Benjamin Herrenschmidt <b...@kernel.crashing.org> >>>>>>>> >>>>>>>> This reworks emulation of the various "rfi" variants. I removed >>>>>>>> some masking bits that I couldn't make sense of, the only bit that >>>>>>>> I am aware we should mask here is POW, the CPU's MSR mask should >>>>>>>> take care of the rest. >>>>>>>> >>>>>>>> This also fixes some problems when running 32-bit userspace under >>>>>>>> a 64-bit kernel. >> >> he. >> >>>>>>>> Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org> >>>>>>>> Reviewed-by: David Gibson <da...@gibson.dropbear.id.au> >>>>>>> >>>>>>> I've merged this patch to ppc-for-2.7. >>>>>> >>>>>> ..and now I've removed it again. It seems that this breaks Thomas' >>>>>> new test that OpenBIOS runs on the mac machine types. Not sure why, >>>>>> but we need to figure that out before I apply. >>>>> >>>>> Just this patch ? I booted a macosx image with it. but maybe just a mac99. >>>>> I will check today. >>>> >>>> With your branch ppc-for-2.7 (at commit aba2e6258d86) + the >>>> "ppc: Fix rfi/rfid/hrfi/... emulation" patch, these guests : >>>> >>>> qemu-system-ppc -cdrom ./darwinppc-602.cdr -boot d >>>> qemu-system-ppc -M mac99 -cdrom ./darwinppc-602.cdr -boot d >>> ^ >>> | >>> You're missing the "64" here ;-) >>> >>>> reach the installer macosx installer. >>> >>> It seems to be only failing for the 64-bit builds - and there only for >>> the PPC970 CPU (which is the default for the mac99 machine in 64-bit >>> builds): >>> >>> qemu-system-ppc64 -nographic -cpu 750 -M mac99 ==> works fine >>> >>> qemu-system-ppc64 -nographic -cpu 970 -M mac99 ==> hangs >> >> >> This is too brutal : >> >> + /* This instruction doesn't exist anymore on 64-bit server >> + * processors compliant with arch 2.x >> + */ >> + if (ctx->insns_flags & PPC_SEGMENT_64B) { >> + gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL); >> + return; >> + } >> >> There are a couple of instructions which have been deleted from >> ISA 2.x. rfi is one of them. Could we use a insn_flag to filter >> them ? > > According to the PPC970FX user manual that I have: > > "The 970FX does not provide support for the following optional or > obsolete instructions (or instruction forms). > Attempted use of these will result in an illegal instruction type > program interrupt. > [...] > · rfi - Return from interrupt (obsolete) " > > So if OpenBIOS is using this instruction in 970 mode, it's maybe > OpenBIOS that should be fixed instead?
Both, then :) rfi is considered implemented for all cpu. But it should not. The instruction set PPC_POWER_BR contains nearly all the deleted instructions from isa2. rfi is not part of it and should. Also, only the cpus "PowerPC 601*" make a use of it in their insns_flags. So, we would want this set to be in all the "PowerPC {6,7}*" cpus. Are there more ? Thanks, C. dc->desc = "PowerPC 401"; dc->desc = "PowerPC 401x2"; dc->desc = "PowerPC 401x3"; dc->desc = "IOP480"; dc->desc = "PowerPC 403"; dc->desc = "PowerPC 403 GCX"; dc->desc = "PowerPC 405"; dc->desc = "PowerPC 440 EP"; dc->desc = "PowerPC 440 GP"; dc->desc = "PowerPC 440x4"; dc->desc = "PowerPC 440x5"; dc->desc = "PowerPC 440x5 with double precision FPU"; dc->desc = "PowerPC 460 (guessed)"; dc->desc = "PowerPC 460F (guessed)"; dc->desc = "Freescale 5xx cores (aka RCPU)"; dc->desc = "Freescale 8xx cores (aka PowerQUICC)"; dc->desc = "PowerPC G2"; dc->desc = "PowerPC G2LE"; dc->desc = "e200 core"; dc->desc = "e300 core"; dc->desc = "e500v1 core"; dc->desc = "e500v2 core"; dc->desc = "e500mc core"; dc->desc = "e5500 core"; dc->desc = "POWER"; dc->desc = "PowerPC 601"; pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_POWER_BR | dc->desc = "PowerPC 601v"; pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING | PPC_POWER_BR | dc->desc = "PowerPC 602"; dc->desc = "PowerPC 603"; dc->desc = "PowerPC 603e"; dc->desc = "PowerPC 604"; dc->desc = "PowerPC 604E"; dc->desc = "PowerPC 740"; dc->desc = "PowerPC 750"; dc->desc = "PowerPC 750 CL"; dc->desc = "PowerPC 750CX"; dc->desc = "PowerPC 750FX"; dc->desc = "PowerPC 750GX"; dc->desc = "PowerPC 745"; dc->desc = "PowerPC 755"; dc->desc = "PowerPC 7400 (aka G4)"; dc->desc = "PowerPC 7410 (aka G4)"; dc->desc = "PowerPC 7440 (aka G4)"; dc->desc = "PowerPC 7450 (aka G4)"; dc->desc = "PowerPC 7445 (aka G4)"; dc->desc = "PowerPC 7455 (aka G4)"; dc->desc = "PowerPC 7457 (aka G4)"; dc->desc = "PowerPC e600"; dc->desc = "PowerPC 970"; dc->desc = "POWER5+"; dc->desc = "POWER7"; dc->desc = "POWER8";