NetBSD Problem Report #60204
From www@netbsd.org Wed Apr 22 16:16:04 2026
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
client-signature RSA-PSS (2048 bits) client-digest SHA256)
(Client CN "mail.netbsd.org", Issuer "R12" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 34CF51A923C
for <gnats-bugs@gnats.NetBSD.org>; Wed, 22 Apr 2026 16:16:04 +0000 (UTC)
Message-Id: <20260422161602.F00BC1A923F@mollari.NetBSD.org>
Date: Wed, 22 Apr 2026 16:16:02 +0000 (UTC)
From: adrian@freebsd.org
Reply-To: adrian@freebsd.org
To: gnats-bugs@NetBSD.org
Subject: sgimips: arcbios calls require FPU to be enabled
X-Send-Pr-Version: www-1.0
X-From4GNATS: "adrian@freebsd.org via gnats" <gnats-admin@NetBSD.org>
>Number: 60204
>Category: port-sgimips
>Synopsis: sgimips: arcbios calls require FPU to be enabled
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: port-sgimips-maintainer
>State: needs-pullups
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Apr 22 16:20:00 +0000 2026
>Closed-Date:
>Last-Modified: Mon May 04 16:30:42 +0000 2026
>Originator: Adrian Chadd
>Release: 11.99
>Organization:
FreeBSD
>Environment:
>Description:
The SGI O2 graphics console hangs during boot. It hangs in the PROM - the moment the console has to scroll, it hangs.
If I boot an SGI O2 with no keyboard, the PROM and kernel will use the serial console as the system console, and the CRIME graphics driver initialises and runs fine.
If I disable enough print output during boot to prevent scrolling (ie, #if 0'ing a whole lot of prints in the MIPS enumeration, memory enumeration, crm graphics/EDID setup stuff) then the kernel boots just fine.
I found the commit that introduced the regression - it's v1.213 -> v1.214 of sys/arch/mips/mips/locore.S :
```
Author: maya <maya@NetBSD.org>
Date: Wed Mar 7 15:56:33 2018 +0000
Add duplicate code to read the FPU ID.
enable & disable the FPU around it.
```
The ARCS specification PDF floating around talks about an FPU being required for an ARCS compatible machine. My guess is that the SGI O2 PROM code uses the FPU registers in some graphics routines but it doesn't explicitly re-enable / re-disable the FPU when being called from the host OS during bootstrap/setup.
Graphical console boot works fine on the Indy R4xxx and Indy R5000 without needing this change.
>How-To-Repeat:
* Boot a NetBSD-8.3 kernel - SGI O2 graphics console inits fine
* Boot a NetBSD-9.0 kernel - SGI O2 boot hangs when the PROM console output requires scrolling
>Fix:
This is a terrible solution to the problem but it demonstrates it working.
The real solution likely involves enable/disable FPU routines around the arcbios entry points in sys/dev/arcbios/ .
```
diff --git a/sys/arch/mips/mips/locore.S b/sys/arch/mips/mips/locore.S
index 6481e9be752cb..22d2869407ac1 100644
--- a/sys/arch/mips/mips/locore.S
+++ b/sys/arch/mips/mips/locore.S
@@ -165,8 +165,10 @@ EXPORT_OBJECT(kernel_text) # libkvm refers this
cfc1 t1, MIPS_FIR
/* Disable again, we don't want it on in the kernel */
+#if 0
and k0, ~MIPS_SR_COP_1_BIT
mtc0 k0, MIPS_COP_0_STATUS
+#endif
#endif
INT_S t0, _C_LABEL(mips_options)+MO_CPU_ID # save PRID register
```
>Release-Note:
>Audit-Trail:
From: Nick Hudson <nick.hudson@gmx.co.uk>
To: gnats-bugs@netbsd.org,
port-sgimips-maintainer@netbsd.org,
gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org
Cc:
Subject: Re: port-sgimips/60204: sgimips: arcbios calls require FPU to be
enabled
Date: Wed, 22 Apr 2026 18:15:01 +0100
On 22/04/2026 17:20, adrian@freebsd.org via gnats wrote:
[snip]
>> Fix:
> This is a terrible solution to the problem but it demonstrates it =
working.
> The real solution likely involves enable/disable FPU routines around =
the arcbios entry points in sys/dev/arcbios/ .
> ```
> diff --git a/sys/arch/mips/mips/locore.S b/sys/arch/mips/mips/locore.S
> index 6481e9be752cb..22d2869407ac1 100644
> --- a/sys/arch/mips/mips/locore.S
> +++ b/sys/arch/mips/mips/locore.S
> @@ -165,8 +165,10 @@ EXPORT_OBJECT(kernel_text) =
# libkvm refers this
> cfc1 t1, MIPS_FIR
> /* Disable again, we don't want it on in the kernel */
> +#if 0
> and k0, ~MIPS_SR_COP_1_BIT
> mtc0 k0, MIPS_COP_0_STATUS
> +#endif
> #endif
> INT_S t0, _C_LABEL(mips_options)+MO_CPU_ID # save PRID =
register
> ```
How about this diff?
From: Adrian Chadd <adrian@freebsd.org>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: port-sgimips/60204: sgimips: arcbios calls require FPU to be enabled
Date: Wed, 22 Apr 2026 10:55:38 -0700
On Wed, 22 Apr 2026 at 10:20, Nick Hudson via gnats
<gnats-admin@netbsd.org> wrote:
> How about this diff?
>
My diff works - the FPU stays on long enough for the graphics console
driver to take over, and then it'll be disabled upon first userland ->
kernel transition.
-a
From: Tobias Nygren <tnn@NetBSD.org>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: port-sgimips/60204: sgimips: arcbios calls require FPU to be
enabled
Date: Wed, 22 Apr 2026 19:58:36 +0200
Hey,
Thank you so much for bisecting this issue!
It has bothered me for years but I never got around to file a PR.
https://mail-index.netbsd.org/port-mips/2020/01/26/msg000913.html
Almost lost hope. Time to boot up the O2 again I guess.
Cheers,
-T
From: Adrian Chadd <adrian@freebsd.org>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: port-sgimips/60204: sgimips: arcbios calls require FPU to be enabled
Date: Wed, 22 Apr 2026 11:03:28 -0700
On Wed, 22 Apr 2026 at 11:00, Tobias Nygren via gnats
<gnats-admin@netbsd.org> wrote:
>
> The following reply was made to PR port-sgimips/60204; it has been noted by GNATS.
>
> From: Tobias Nygren <tnn@NetBSD.org>
> To: gnats-bugs@netbsd.org
> Cc:
> Subject: Re: port-sgimips/60204: sgimips: arcbios calls require FPU to be
> enabled
> Date: Wed, 22 Apr 2026 19:58:36 +0200
>
> Hey,
>
> Thank you so much for bisecting this issue!
> It has bothered me for years but I never got around to file a PR.
> https://mail-index.netbsd.org/port-mips/2020/01/26/msg000913.html
> Almost lost hope. Time to boot up the O2 again I guess.
Thanks! The R5000 is fine, I don't have any RM7000 or RM5200 O2s.
The R10000/R12000 is still buggy due to the superscalar bugs that need to be
worked around but I'll try to tackle those once everything on the R5000 side
is A-OK.
From: Nick Hudson <nick.hudson@gmx.co.uk>
To: gnats-bugs@netbsd.org, port-sgimips-maintainer@netbsd.org,
gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, adrian@freebsd.org
Cc:
Subject: Re: port-sgimips/60204: sgimips: arcbios calls require FPU to be
enabled
Date: Wed, 22 Apr 2026 19:17:31 +0100
On 22/04/2026 19:00, Adrian Chadd via gnats wrote:
> The following reply was made to PR port-sgimips/60204; it has been noted=
by GNATS.
>=20
> From: Adrian Chadd <adrian@freebsd.org>
> To: gnats-bugs@netbsd.org
> Cc:
> Subject: Re: port-sgimips/60204: sgimips: arcbios calls require FPU to b=
e enabled
> Date: Wed, 22 Apr 2026 10:55:38 -0700
>=20
> On Wed, 22 Apr 2026 at 10:20, Nick Hudson via gnats
> <gnats-admin@netbsd.org> wrote:
> =20
> > How about this diff?
> >
> =20
> My diff works - the FPU stays on long enough for the graphics console
> driver to take over, and then it'll be disabled upon first userland ->
> kernel transition.
You said
"This is a terrible solution to the problem but it demonstrates it workin=
g."
My diff isn't a terrible solution.
From: Adrian Chadd <adrian@freebsd.org>
To: Nick Hudson <nick.hudson@gmx.co.uk>
Cc: gnats-bugs@netbsd.org, port-sgimips-maintainer@netbsd.org,
gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: port-sgimips/60204: sgimips: arcbios calls require FPU to be enabled
Date: Wed, 22 Apr 2026 11:18:29 -0700
--000000000000b779950650108fd9
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
I didn't see a diff attached, can you email it to me separately?
A
On Wed, Apr 22, 2026, 11:17=E2=80=AFAM Nick Hudson <nick.hudson@gmx.co.uk> =
wrote:
> On 22/04/2026 19:00, Adrian Chadd via gnats wrote:
> > The following reply was made to PR port-sgimips/60204; it has been note=
d
> by GNATS.
> >
> > From: Adrian Chadd <adrian@freebsd.org>
> > To: gnats-bugs@netbsd.org
> > Cc:
> > Subject: Re: port-sgimips/60204: sgimips: arcbios calls require FPU to
> be enabled
> > Date: Wed, 22 Apr 2026 10:55:38 -0700
> >
> > On Wed, 22 Apr 2026 at 10:20, Nick Hudson via gnats
> > <gnats-admin@netbsd.org> wrote:
> >
> > > How about this diff?
> > >
> >
> > My diff works - the FPU stays on long enough for the graphics console
> > driver to take over, and then it'll be disabled upon first userland -=
>
> > kernel transition.
>
> You said
>
> "This is a terrible solution to the problem but it demonstrates i=
t
> working."
>
> My diff isn't a terrible solution.
>
>
>
--000000000000b779950650108fd9
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"auto">I didn't see a diff attached, can you email it to me =
separately?<div dir=3D"auto"><br></div><div dir=3D"auto"><br></div><div dir=
=3D"auto">A</div></div><br><div class=3D"gmail_quote gmail_quote_container"=
><div dir=3D"ltr" class=3D"gmail_attr">On Wed, Apr 22, 2026, 11:17=E2=80=AF=
AM Nick Hudson <<a href=3D"mailto:nick.hudson@gmx.co.uk">nick.hudson@gmx=
.co.uk</a>> wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"m=
argin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left=
:1ex">On 22/04/2026 19:00, Adrian Chadd via gnats wrote:<br>
> The following reply was made to PR port-sgimips/60204; it has been not=
ed by GNATS.<br>
> <br>
> From: Adrian Chadd <<a href=3D"mailto:adrian@freebsd.org" target=3D=
"_blank" rel=3D"noreferrer">adrian@freebsd.org</a>><br>
> To: <a href=3D"mailto:gnats-bugs@netbsd.org" target=3D"_blank" rel=3D"=
noreferrer">gnats-bugs@netbsd.org</a><br>
> Cc:<br>
> Subject: Re: port-sgimips/60204: sgimips: arcbios calls require FPU to=
be enabled<br>
> Date: Wed, 22 Apr 2026 10:55:38 -0700<br>
> <br>
>=C2=A0 =C2=A0On Wed, 22 Apr 2026 at 10:20, Nick Hudson via gnats<br>
>=C2=A0 =C2=A0<<a href=3D"mailto:gnats-admin@netbsd.org" target=3D"_b=
lank" rel=3D"noreferrer">gnats-admin@netbsd.org</a>> wrote:<br>
>=C2=A0 =C2=A0<br>
>=C2=A0 =C2=A0>=C2=A0 How about this diff?<br>
>=C2=A0 =C2=A0><br>
>=C2=A0 =C2=A0<br>
>=C2=A0 =C2=A0My diff works - the FPU stays on long enough for the graph=
ics console<br>
>=C2=A0 =C2=A0driver to take over, and then it'll be disabled upon f=
irst userland -><br>
>=C2=A0 =C2=A0kernel transition.<br>
<br>
You said<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 "This is a terrible solution to the proble=
m but it demonstrates it working."<br>
<br>
My diff isn't a terrible solution.<br>
<br>
<br>
</blockquote></div>
--000000000000b779950650108fd9--
From: Jason Thorpe <thorpej@me.com>
To: gnats-bugs@netbsd.org
Cc: port-sgimips-maintainer@netbsd.org,
gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org,
adrian@freebsd.org
Subject: Re: port-sgimips/60204: sgimips: arcbios calls require FPU to be
enabled
Date: Wed, 22 Apr 2026 11:38:49 -0700
--Apple-Mail=_96219DAD-89D2-45C2-B9EB-A4FE297CB8F1
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=utf-8
> On Apr 22, 2026, at 11:20=E2=80=AFAM, Adrian Chadd via gnats =
<gnats-admin@netbsd.org> wrote:
>=20
> I didn't see a diff attached, can you email it to me separately?
Yah, same, I didn=E2=80=99t see a diff, either.
-- thorpej
--Apple-Mail=_96219DAD-89D2-45C2-B9EB-A4FE297CB8F1
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
charset=utf-8
<html aria-label=3D"message body"><head><meta http-equiv=3D"content-type" =
content=3D"text/html; charset=3Dutf-8"></head><body =
style=3D"overflow-wrap: break-word; -webkit-nbsp-mode: space; =
line-break: after-white-space;"><br><div><blockquote type=3D"cite"><div>On=
Apr 22, 2026, at 11:20=E2=80=AFAM, Adrian Chadd via gnats =
<gnats-admin@netbsd.org> wrote:</div><br =
class=3D"Apple-interchange-newline"><div><span style=3D"caret-color: =
rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: =
normal; font-variant-caps: normal; font-weight: 400; letter-spacing: =
normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: =
none; white-space: normal; widows: 2; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; text-decoration: none; float: none; =
display: inline !important;">I didn't see a diff attached, can you email =
it to me separately?</span><br style=3D"caret-color: rgb(0, 0, 0); =
font-family: Helvetica; font-size: 12px; font-style: normal; =
font-variant-caps: normal; font-weight: 400; letter-spacing: normal; =
orphans: 2; text-align: start; text-indent: 0px; text-transform: none; =
white-space: normal; widows: 2; word-spacing: 0px; =
-webkit-text-stroke-width: 0px; text-decoration-line: none; =
text-decoration-thickness: auto; text-decoration-style: =
solid;"></div></blockquote></div><div><br></div><div>Yah, same, I =
didn=E2=80=99t see a diff, either.</div><br><div>
<span class=3D"Apple-style-span" style=3D"border-collapse: separate; =
color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; =
font-style: normal; font-variant: normal; font-weight: normal; =
letter-spacing: normal; line-height: normal; orphans: 2; text-align: =
auto; text-indent: 0px; text-transform: none; white-space: normal; =
widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; =
-webkit-border-vertical-spacing: 0px; =
-webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
auto; -webkit-text-stroke-width: 0px; "><div style=3D"word-wrap: =
break-word; -webkit-nbsp-mode: space; -webkit-line-break: =
after-white-space; ">-- thorpej</div></span>
</div>
<br></body></html>=
--Apple-Mail=_96219DAD-89D2-45C2-B9EB-A4FE297CB8F1--
From: Adrian Chadd <adrian@freebsd.org>
To: Nick Hudson <nick.hudson@gmx.co.uk>
Cc: gnats-bugs@netbsd.org, port-sgimips-maintainer@netbsd.org,
gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: port-sgimips/60204: sgimips: arcbios calls require FPU to be enabled
Date: Wed, 22 Apr 2026 11:46:34 -0700
On Wed, 22 Apr 2026 at 11:17, Nick Hudson <nick.hudson@gmx.co.uk> wrote:
> My diff isn't a terrible solution.
Sorry! Ok, I saw the diff you subsequently emailed.
I'm testing something else right now - enabling the FPU before the
arcbios call, and disabling it afterwards.
That works on the O2 but I want to test it on the Indy and Indigo 2
before I upload it here.
(Does anyone know of any emulator environments for ARCS machines? I'd
like to try and test this
on something that isn't an SGI machine.)
-adrian
From: Adrian Chadd <adrian@freebsd.org>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: port-sgimips/60204: sgimips: arcbios calls require FPU to be enabled
Date: Wed, 22 Apr 2026 11:53:34 -0700
Ok, let's try this one.
```
diff --git a/sys/dev/arcbios/arcbios_calls.S b/sys/dev/arcbios/arcbios_calls.S
index c184d9786daaf..0bf715212ec36 100644
--- a/sys/dev/arcbios/arcbios_calls.S
+++ b/sys/dev/arcbios/arcbios_calls.S
@@ -32,6 +32,9 @@
#include <sys/cdefs.h>
#include <machine/asm.h>
+#include <mips/asm.h>
+#include <mips/cpuregs.h>
+
#include "assym.h"
RCSID("$NetBSD: arcbios_calls.S,v 1.6 2026/01/11 06:41:42 tsutsui Exp $")
@@ -56,6 +59,13 @@ NESTED(arcbios_4orless_args, CALLFRAME_SIZ, ra)
REG_S ra, CALLFRAME_RA(sp)
REG_S s0, CALLFRAME_SP(sp)
+ /* Enable FPU - see PR port-sgimips/60204 */
+ mfc0 k0, MIPS_COP_0_STATUS
+ MFC0_HAZARD
+ or k0, MIPS_SR_COP_1_BIT
+ mtc0 k0, MIPS_COP_0_STATUS
+ COP0_HAZARD_FPUENABLE
+
PTR_L t9, _C_LABEL(ARCBIOS)
nop
PTR_ADDU t9, t0
@@ -67,6 +77,12 @@ NESTED(arcbios_4orless_args, CALLFRAME_SIZ, ra)
FIX_V0
+ /* Disable FPU */
+ mfc0 k0, MIPS_COP_0_STATUS
+ MFC0_HAZARD
+ and k0, ~MIPS_SR_COP_1_BIT
+ mtc0 k0, MIPS_COP_0_STATUS
+
move MIPS_CURLWP, s0
REG_L ra, CALLFRAME_RA(sp)
@@ -98,6 +114,13 @@ NESTED(arcbios_5to8_args, CALLFRAME2_SIZ, ra)
INT_S a7, 28(sp) # save 8th arg on stack (o32)
#endif
+ /* Enable FPU - see PR port-sgimips/60204 */
+ mfc0 k0, MIPS_COP_0_STATUS
+ MFC0_HAZARD
+ or k0, MIPS_SR_COP_1_BIT
+ mtc0 k0, MIPS_COP_0_STATUS
+ COP0_HAZARD_FPUENABLE
+
PTR_L t9, _C_LABEL(ARCBIOS)
nop
PTR_ADDU t9, t0
@@ -109,6 +132,12 @@ NESTED(arcbios_5to8_args, CALLFRAME2_SIZ, ra)
FIX_V0
+ /* Disable FPU */
+ mfc0 k0, MIPS_COP_0_STATUS
+ MFC0_HAZARD
+ and k0, ~MIPS_SR_COP_1_BIT
+ mtc0 k0, MIPS_COP_0_STATUS
+
move MIPS_CURLWP, s0
REG_L ra, CALLFRAME2_RA(sp)
```
From: Nick Hudson <nick.hudson@gmx.co.uk>
To: Jason Thorpe <thorpej@me.com>,
gnats-bugs@netbsd.org
Cc: port-sgimips-maintainer@netbsd.org,
gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org,
adrian@freebsd.org
Subject: Re: port-sgimips/60204: sgimips: arcbios calls require FPU to be
enabled
Date: Thu, 23 Apr 2026 11:28:40 +0100
On 22/04/2026 19:38, Jason Thorpe wrote:
>> On Apr 22, 2026, at 11:20=E2=80=AFAM, Adrian Chadd via gnats =
<gnats-admin@netbsd.org> wrote:
>>=20
>> I didn't see a diff attached, can you email it to me separately?
> Yah, same, I didn=E2=80=99t see a diff, either.
I hate email...
The patch is here
https://www.netbsd.org/~skrll/mips.locore.diff
From: Nick Hudson <nick.hudson@gmx.co.uk>
To: gnats-bugs@netbsd.org,
port-sgimips-maintainer@netbsd.org,
gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org,
adrian@freebsd.org
Cc:
Subject: Re: port-sgimips/60204: sgimips: arcbios calls require FPU to be
enabled
Date: Thu, 30 Apr 2026 06:59:57 +0100
On 22/04/2026 19:55, Adrian Chadd via gnats wrote:
> The following reply was made to PR port-sgimips/60204; it has been =
noted by GNATS.
> From: Adrian Chadd <adrian@freebsd.org>
> To: gnats-bugs@netbsd.org
> Cc:
> Subject: Re: port-sgimips/60204: sgimips: arcbios calls require FPU to =
be enabled
> Date: Wed, 22 Apr 2026 11:53:34 -0700
> Ok, let's try this one.
Still think my patch is relevant.
Also, why doesn't your patch restore FP enable state rather than always =
disabling it? That is, can it be enabled on entry to an arcbios call?
Actually, wouldn't restoring it be less instructions too... no need for =
second mfc0 k0, MIPS_COP_0_STATUS and hazard
> ```
> diff --git a/sys/dev/arcbios/arcbios_calls.S =
b/sys/dev/arcbios/arcbios_calls.S
> index c184d9786daaf..0bf715212ec36 100644
> --- a/sys/dev/arcbios/arcbios_calls.S
> +++ b/sys/dev/arcbios/arcbios_calls.S
> @@ -32,6 +32,9 @@
> #include <sys/cdefs.h>
> #include <machine/asm.h>
> +#include <mips/asm.h>
> +#include <mips/cpuregs.h>
> +
> #include "assym.h"
> RCSID("$NetBSD: arcbios_calls.S,v 1.6 2026/01/11 06:41:42 tsutsui =
Exp $")
> @@ -56,6 +59,13 @@ NESTED(arcbios_4orless_args, CALLFRAME_SIZ, ra)
> REG_S ra, CALLFRAME_RA(sp)
> REG_S s0, CALLFRAME_SP(sp)
> + /* Enable FPU - see PR port-sgimips/60204 */
> + mfc0 k0, MIPS_COP_0_STATUS
> + MFC0_HAZARD
> + or k0, MIPS_SR_COP_1_BIT
> + mtc0 k0, MIPS_COP_0_STATUS
> + COP0_HAZARD_FPUENABLE
> +
> PTR_L t9, _C_LABEL(ARCBIOS)
> nop
> PTR_ADDU t9, t0
> @@ -67,6 +77,12 @@ NESTED(arcbios_4orless_args, CALLFRAME_SIZ, ra)
> FIX_V0
> + /* Disable FPU */
> + mfc0 k0, MIPS_COP_0_STATUS
> + MFC0_HAZARD
> + and k0, ~MIPS_SR_COP_1_BIT
> + mtc0 k0, MIPS_COP_0_STATUS
> +
> move MIPS_CURLWP, s0
> REG_L ra, CALLFRAME_RA(sp)
> @@ -98,6 +114,13 @@ NESTED(arcbios_5to8_args, CALLFRAME2_SIZ, ra)
> INT_S a7, 28(sp) # save 8th arg on stack (o32)
> #endif
> + /* Enable FPU - see PR port-sgimips/60204 */
> + mfc0 k0, MIPS_COP_0_STATUS
> + MFC0_HAZARD
> + or k0, MIPS_SR_COP_1_BIT
> + mtc0 k0, MIPS_COP_0_STATUS
> + COP0_HAZARD_FPUENABLE
> +
> PTR_L t9, _C_LABEL(ARCBIOS)
> nop
> PTR_ADDU t9, t0
> @@ -109,6 +132,12 @@ NESTED(arcbios_5to8_args, CALLFRAME2_SIZ, ra)
> FIX_V0
> + /* Disable FPU */
> + mfc0 k0, MIPS_COP_0_STATUS
> + MFC0_HAZARD
> + and k0, ~MIPS_SR_COP_1_BIT
> + mtc0 k0, MIPS_COP_0_STATUS
> +
> move MIPS_CURLWP, s0
> REG_L ra, CALLFRAME2_RA(sp)
> ```
> =20
From: Adrian Chadd <adrian@freebsd.org>
To: gnats-bugs@netbsd.org
Cc: port-sgimips-maintainer@netbsd.org, gnats-admin@netbsd.org,
netbsd-bugs@netbsd.org
Subject: Re: port-sgimips/60204: sgimips: arcbios calls require FPU to be enabled
Date: Thu, 30 Apr 2026 08:20:37 -0700
The reason why I enable/disable the FPU the way I did it is because my
/guess/ is the original FPU change from maya@ was to leave the FPU
disabled in the kernel during early boot regardless of what
configuration it was in from the hand-off from the boot firmware.
Thus I figured it would make most sense to keep that assumption and
just explicitly enable and re-disable the FPU around arcbios calls.
i don't know if k0 is guaranteed to be untouched by the arcbios code
present on all systems, nor the contents of COP_0_STATUS, so I'm just
being conservative.
-adrian
From: "Adrian Chadd" <adrian@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/60204 CVS commit: src/sys/dev/arcbios
Date: Sun, 3 May 2026 23:06:13 +0000
Module Name: src
Committed By: adrian
Date: Sun May 3 23:06:13 UTC 2026
Modified Files:
src/sys/dev/arcbios: arcbios_calls.S
Log Message:
arcbios: enable FPU around ARCS calls
This seems required for the SGI O2 for PROM graphics console IO to work
when it scrolls. See PR port-sgimips/60204 for more details.
The issue was introduced in v1.214 of sys/arch/mips/mips/locore.S .
Notably maya@ disabled the FPU early in boot, expecting the rest of
boot to run with the FPU disabled. The FPU is being explicitly
enabled/disabled here to keep to the spirit of maya@'s above commit.
A "better" solution would be to use the pcu API and mark the thread
as needing the FPU for the duration of the arcbios call, however:
* The current MIPS pcu FPU code in sys/arch/mips/mips/mips_fpu.c
doesn't support FPU use in kernel yet; and
* this stuff is called super early during boot and once the OS starts
the ARCBIOS API is no longer supposed to be used.
To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/arcbios/arcbios_calls.S
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->needs-pullups
State-Changed-By: adrian@NetBSD.org
State-Changed-When: Mon, 04 May 2026 16:30:42 +0000
State-Changed-Why:
Diff landed; needs pullup into -10 and -11
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.