qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
	Richard Henderson <richard.henderson@linaro.org>,
	qemu-devel@nongnu.org, kwolf@redhat.com, famz@redhat.com,
	qemu-block@nongnu.org, jasowang@redhat.com, dgilbert@redhat.com,
	mreitz@redhat.com, hpoussin@reactos.org, kraxel@redhat.com,
	pbonzini@redhat.com, aurelien@aurel32.net,
	Thomas Huth <huth@tuxfamily.org>
Subject: Re: [Qemu-devel] [PATCH v5 00/11] hw/m68k: add Apple Machintosh Quadra 800 machine
Date: Tue, 30 Oct 2018 14:39:14 +0100	[thread overview]
Message-ID: <ad444bbf-0606-2b80-7f7d-389a6df29cfe@vivier.eu> (raw)
In-Reply-To: <3b1f8942-d8c7-04db-45bc-a7c30de9d769@ilande.co.uk>

Le 30/10/2018 à 14:12, Mark Cave-Ayland a écrit :
> On 30/10/2018 12:49, Laurent Vivier wrote:
> 
>> Le 30/10/2018 à 12:48, Mark Cave-Ayland a écrit :
>>> On 30/10/2018 08:15, Richard Henderson wrote:
>>>
>>>> On 10/29/18 1:39 PM, Mark Cave-Ayland wrote:
>>>>> You can install your own disk using debian-installer, with:
>>>>>
>>>>>     ...
>>>>>     -M q800 \
>>>>>     -serial none -serial mon:stdio \
>>>>>     -m 1000M -drive file=m68k.qcow2,format=qcow2 \
>>>>>     -net nic,model=dp83932,addr=09:00:07:12:34:57 \
>>>>>     -append "console=ttyS0 vga=off" \
>>>>>     -kernel vmlinux-4.15.0-2-m68k \
>>>>>     -initrd initrd.gz \
>>>>>     -drive file=debian-9.0-m68k-NETINST-1.iso \
>>>>>     -drive file=m68k.qcow2,format=qcow2 \
>>>>>     -nographic
>>>>
>>>> I tried this and got
>>>>
>>>> Trace 0: 0x7f2e886c7140 [00000000/0000d404/0xe000]
>>>> INT      1: Unassigned(0xf4) pc=0000d404 sp=00393e60 sr=2700
>>>> INT      2: Access Fault(0x8) pc=00000000 sp=00393e58 sr=2700
>>>>             ssw:  00000506 ea:   00000000 sfc:  5    dfc: 5
>>>>
>>>> which lead straight to buserr and panic.  This happens way early in boot --
>>>> only 1926 TranslationBlocks generated.
>>>>
>>>> Is there some device missing from the command-line that the kernel is expecting?
>>>
>>> Heh that's annoying. The original branch I forked that Laurent was working on had
>>> some extra patches at the start of the series: some were required for q800 whilst
>>> others were for new development. I thought that all of the patches required for q800
>>> had been applied over the past few months, but sadly that isn't the case :(
>>>
>>> I've pushed an updated branch to https://github.com/mcayland/qemu/tree/q800-test
>>> which contains the patchset plus two extra patches that are still needed to boot to
>>> the debian installer here:
>>>
>>> 9281a5371f "tmp"
>>> 629754d847 "target/m68k: manage FPU exceptions"
>>>
>>> Laurent, are these patches ready for upstream or do they need work in which case we
>>> should leave q800 until the 3.2 cycle?
>>
>> The only needed part is from 9281a5371f.
> 
> Yeah I think you're right, sorry about that. I'm sure I tried without 629754d847 and
> I got a premature exit from QEMU but only in graphic mode, but I've just tried again
> and can't seem to recreate it now.
> 
>> --- a/target/m68k/translate.c
>> +++ b/target/m68k/translate.c
>> @@ -1552,7 +1552,7 @@ DISAS_INSN(undef)
>>         but actually illegal for CPU32 or pre-68020.  */
>>      qemu_log_mask(LOG_UNIMP, "Illegal instruction: %04x @ %08x\n",
>>                    insn, s->base.pc_next);
>> -    gen_exception(s, s->base.pc_next, EXCP_UNSUPPORTED);
>> +    gen_exception(s, s->base.pc_next, EXCP_ILLEGAL);
>>  }
>>
>>  DISAS_INSN(mulw)
>> @@ -2799,7 +2799,7 @@ DISAS_INSN(mull)
>>
>>      if (ext & 0x400) {
>>          if (!m68k_feature(s->env, M68K_FEATURE_QUAD_MULDIV)) {
>> -            gen_exception(s, s->base.pc_next, EXCP_UNSUPPORTED);
>> +            gen_exception(s, s->base.pc_next, EXCP_ILLEGAL);
>>              return;
>>          }
>>
>> @@ -4509,7 +4509,7 @@ DISAS_INSN(strldsr)
>>      addr = s->pc - 2;
>>      ext = read_im16(env, s);
>>      if (ext != 0x46FC) {
>> -        gen_exception(s, addr, EXCP_UNSUPPORTED);
>> +        gen_exception(s, addr, EXCP_ILLEGAL);
>>          return;
>>      }
>>      ext = read_im16(env, s);
>>
>> Because kernel only manages illegal instruction exception not unsupported.
>>
>> Without the patch, we have:
>>
>> IN:
>> 0x0000d454:  071400
>>
>> INT      1: Unassigned(0xf4) pc=0000d454 sp=00331e60 sr=2700
>>
>> with the patch:
>>
>> IN:
>> 0x0000d454:  071400
>>
>> INT      1: Illegal Instruction(0x10) pc=0000d454 sp=00331e60 sr=2700
>>
>> We have in linux/arch/m68k/kernel/vectors.c:
>>
>> /*
>>  * this must be called very early as the kernel might
>>  * use some instruction that are emulated on the 060
>>  * and so we're prepared for early probe attempts (e.g. nf_init).
>>  */
>> void __init base_trap_init(void)
>> {
>> ...
>>
>>         vectors[VEC_BUSERR] = buserr;
>>         vectors[VEC_ILLEGAL] = trap;
>>         vectors[VEC_SYS] = system_call;
>> }
>>
>> So I think the unsupported vector jumps to an invalid address.
>>
>> This seems triggered by the aranym native feature:
>>
>>     d454:       7300            mvsb %d0,%d1
>>
>> from linux/arch/m68k/emu/natfeat.c
> 
> Interesting. So is this an actual bug in QEMU in terms of implementing the processor
> specification, or is it relying on undefined behaviour on real hardware?

It's a bug in QEMU.

EXCP_UNSUPPORTED is defined to a QEMU specific value (61) that is in the
Unassigned/Reserved range of the vector table.

It is used by QEMU user-mode to trigger illegal instruction, whereas
illegal is also used to do simcalls (some thing like a syscall with an
illegal instruction trap). I think this should be deprecated as no one
is maintaining that and knows how to use that.

Perhaps Thomas as an idea as it comes with the coldfire implementation?
(e6e5906b6e ColdFire target)

Thanks,
Laurent

  reply	other threads:[~2018-10-30 13:39 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-29 13:39 [Qemu-devel] [PATCH v5 00/11] hw/m68k: add Apple Machintosh Quadra 800 machine Mark Cave-Ayland
2018-10-29 13:39 ` [Qemu-devel] [PATCH v5 01/11] hw/m68k: add via support Mark Cave-Ayland
2018-10-30  6:46   ` Hervé Poussineau
2018-10-29 13:39 ` [Qemu-devel] [PATCH v5 02/11] hw/m68k: implement ADB bus support for via Mark Cave-Ayland
2018-10-30  6:46   ` Hervé Poussineau
2018-10-29 13:39 ` [Qemu-devel] [PATCH v5 03/11] escc: introduce a selector for the register bit Mark Cave-Ayland
2018-10-29 23:36   ` Philippe Mathieu-Daudé
2018-10-30  9:38     ` Mark Cave-Ayland
2018-10-30  6:46   ` Hervé Poussineau
2018-10-29 13:39 ` [Qemu-devel] [PATCH v5 04/11] hw/m68k: add macfb video card Mark Cave-Ayland
2018-10-30  6:46   ` Hervé Poussineau
2018-10-29 13:39 ` [Qemu-devel] [PATCH v5 05/11] hw/m68k: Apple Sound Chip (ASC) emulation Mark Cave-Ayland
2018-10-30  6:46   ` Hervé Poussineau
2018-10-30 10:46     ` Mark Cave-Ayland
2018-10-30 12:05       ` Laurent Vivier
2018-10-29 13:39 ` [Qemu-devel] [PATCH v5 06/11] esp: add pseudo-DMA as used by Macintosh Mark Cave-Ayland
2018-10-30  6:47   ` Hervé Poussineau
2018-10-30 10:09     ` Mark Cave-Ayland
2018-10-30 20:08       ` Laurent Vivier
2018-10-30 18:02     ` Laurent Vivier
2018-10-29 13:39 ` [Qemu-devel] [PATCH v5 07/11] hw/m68k: add Nubus support Mark Cave-Ayland
2018-10-30  6:47   ` Hervé Poussineau
2018-10-30 10:23     ` Mark Cave-Ayland
2018-10-29 13:39 ` [Qemu-devel] [PATCH v5 08/11] hw/m68k: add Nubus support for macfb video card Mark Cave-Ayland
2018-10-30  6:47   ` Hervé Poussineau
2018-10-29 13:39 ` [Qemu-devel] [PATCH v5 09/11] hw/m68k: add a dummy SWIM floppy controller Mark Cave-Ayland
2018-10-30  6:48   ` Hervé Poussineau
2018-10-30 10:25     ` Mark Cave-Ayland
2018-10-29 13:39 ` [Qemu-devel] [PATCH v5 10/11] dp8393x: manage big endian bus Mark Cave-Ayland
2018-10-30  6:48   ` Hervé Poussineau
2018-10-29 13:40 ` [Qemu-devel] [PATCH v5 11/11] hw/m68k: define Macintosh Quadra 800 Mark Cave-Ayland
2018-10-30  8:15 ` [Qemu-devel] [PATCH v5 00/11] hw/m68k: add Apple Machintosh Quadra 800 machine Richard Henderson
2018-10-30 11:48   ` Mark Cave-Ayland
2018-10-30 12:49     ` Laurent Vivier
2018-10-30 13:12       ` Mark Cave-Ayland
2018-10-30 13:39         ` Laurent Vivier [this message]
2018-11-02  0:32           ` Thomas Huth
2018-11-02 11:25             ` Laurent Vivier
2018-11-19  2:30               ` Rob Landley

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=ad444bbf-0606-2b80-7f7d-389a6df29cfe@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=aurelien@aurel32.net \
    --cc=dgilbert@redhat.com \
    --cc=famz@redhat.com \
    --cc=hpoussin@reactos.org \
    --cc=huth@tuxfamily.org \
    --cc=jasowang@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.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;
as well as URLs for NNTP newsgroup(s).