NetBSD Problem Report #59529

From gson@gson.org  Thu Jul 17 18:59:48 2025
Return-Path: <gson@gson.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 "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 552361A923C
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 17 Jul 2025 18:59:48 +0000 (UTC)
Message-Id: <20250717185030.1D4C7253F03@guava.gson.org>
Date: Thu, 17 Jul 2025 21:50:30 +0300 (EEST)
From: gson@gson.org (Andreas Gustafsson)
Reply-To: gson@gson.org (Andreas Gustafsson)
To: gnats-bugs@NetBSD.org
Subject: POWERMAC_G5 trap setting color palette
X-Send-Pr-Version: 3.95

>Number:         59529
>Category:       port-macppc
>Synopsis:       POWERMAC_G5 trap setting color palette
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-macppc-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jul 17 19:00:01 +0000 2025
>Last-Modified:  Fri Jul 25 08:15:01 +0000 2025
>Originator:     Andreas Gustafsson
>Release:        NetBSD-current, source date 2025-06-05 11:30:23 Z
>Organization:
>Environment:
System: NetBSD
Architecture: powerpc
Machine: macppc
>Description:

If I try to boot the POWERMAC_G5 kernel on a Power Mac G5 model A1093,
it gets as far as attaching genfb, but immediately after the screen
switches from the small Open Firmware font and white background to
the larger wscons font and a black background, it gets into a loop
printing two lines like these over and over:

  [    1.0000000] trap: kernel read DSI trap @ 0x8070200c by 0xff848714 (DSISR 0x40000000, err=14), lr 0xff87a524
  [    1.0000000] Press a key to panic

This happens with kernels from the 10.1 release as well as -current.

The repeating messages cause any message from the initial error to
instantly scroll off the screen, but by modifying trap() to enter an
infinite loop, I managed to capture the initial error message, which
is a trap like this one:

  trap: kernel write DSI trap @ 0x916033d4 by 0xff848880 (DSISR 0x42000000, err=14), lr 0xff9ec9bc

The messages were manually transcribed so they may contain typos, and
the addresses will of course differ depending on the kernel version, etc.

By adding debug printfs, I managed to narrow down the location of
the crash to the following line in of_set_palette():

        OF_call_method_1("color!", ih, 4, r, g, b, index);

Based on the memory addresses in the trap messages, I suspect the trap
happens within Open Firmware.

The machine in case has an Nvidia graphics card.  I hear that this
problem does not affect G5s with Radeon cards, as they will attach
a radeonfb instead of genfb.

As a work-around, I have locally disabled genfb_init_palette() by
adding a return statement at the beginning of the function.  That
makes the system boot, but console output other than kernel
messages is black text on a black background.  As a further
work-around for that, I set WS_DEFAULT_FG=WSCOL_GREEN.  With these two
work-arounds, the kernel boots and the console is mostly readable, but
the colors are wrong (which of course is to be expected when setting
the palette is disabled), and the cursor is not visible.

>How-To-Repeat:

Boot a POWERMAC_G5 kernel on a Power Mac G5 with a Nvidia graphics
card.

>Fix:

Please.

>Audit-Trail:
From: Michael <macallan1888@gmail.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-macppc/59529: POWERMAC_G5 trap setting color palette
Date: Mon, 21 Jul 2025 07:15:48 -0400

 Hello,

 On Thu, 17 Jul 2025 19:00:01 +0000 (UTC)
 gson@gson.org (Andreas Gustafsson) wrote:

 > If I try to boot the POWERMAC_G5 kernel on a Power Mac G5 model A1093,
 > it gets as far as attaching genfb, but immediately after the screen
 > switches from the small Open Firmware font and white background to
 > the larger wscons font and a black background, it gets into a loop
 > printing two lines like these over and over:
 > 
 >   [    1.0000000] trap: kernel read DSI trap @ 0x8070200c by 0xff848714 (DSISR 0x40000000, err=14), lr 0xff87a524
 >   [    1.0000000] Press a key to panic

 I've seen this on newer, PCIe-based G5 models, we call OF_quiesce() to
 shut down background tasks so we can have full control over the
 hardware, but after that certain OF calls crash. IIRC rin@ committed a
 workaround a while ago, no idea if it made it into 10.

 There are a few things to check:
 - please try a -current kernel
 - try a -current kernel with gffb enabled. This will avoid the OF calls
   and program palette registers directly

 The problem with gffb is, I only tested it with the hardware I have,
 currently that's geforce mx2, 6800U, FX 5200 Go and FX 5200U. The
 latter is fairly common in lower end G5s, I added support for it today.
 The Go variant was used in iMacs and PowerBooks.

 That being said, your G5 is a PowerMac9,1  a variant I don't have, so
 the fan control code may not be fully functional. Please send me:
 - dmesg output
 - ofctl -p output
 so I can fix that.

 envstat should list 6 or 7 fans and about 6 temperature sensors. If
 yours shows less please be careful. The CPU has a huge heat sink so
 overheating it will take a while under full load even with all fans
 stopped ( which is unlikely to happen - OF will spin them up and if we
 don't find the fans or temperature sensors we leave them alone ). 

 have fun
 Michael

From: Andreas Gustafsson <gson@gson.org>
To: Michael <macallan1888@gmail.com>
Cc: gnats-bugs@netbsd.org, port-macppc-maintainer@netbsd.org
Subject: Re: port-macppc/59529: POWERMAC_G5 trap setting color palette
Date: Tue, 22 Jul 2025 22:10:40 +0300

 Hi Michael,

 Thank you for looking into this.

 You wrote:
 >  >   [    1.0000000] trap: kernel read DSI trap @ 0x8070200c by 0xff848714 (DSISR 0x40000000, err=14), lr 0xff87a524
 >  >   [    1.0000000] Press a key to panic
 >  
 >  I've seen this on newer, PCIe-based G5 models, we call OF_quiesce() to
 >  shut down background tasks so we can have full control over the
 >  hardware, but after that certain OF calls crash. IIRC rin@ committed a
 >  workaround a while ago, no idea if it made it into 10.
 >  
 >  There are a few things to check:
 >  - please try a -current kernel

 The problem also affects a kernel built from -current source date
 2025-06-05 11:30:23 Z.  I tried to build today's current but it
 failed to build on my build host (that's PR 59543).

 >  - try a -current kernel with gffb enabled. This will avoid the OF calls
 >    and program palette registers directly

 The gffb driver is already enabled in the POWERMAC_G5 kernel, but it's
 not attaching for me.

 Please send me:
 >  - dmesg output
 >  - ofctl -p output
 >  so I can fix that.

 Here:

   https://www.gson.org/netbsd/bugs/59529/dmesg.txt
   https://www.gson.org/netbsd/bugs/59529/ofctl-p.txt

 The dmesg is from a kernel based on POWERMAC_G5 with some patches and
 debug prints added, built from -current sources from 2025-06-05
 11:30:23 Z.

 >  envstat should list 6 or 7 fans and about 6 temperature sensors. If
 >  yours shows less please be careful. The CPU has a huge heat sink so
 >  overheating it will take a while under full load even with all fans
 >  stopped ( which is unlikely to happen - OF will spin them up and if we
 >  don't find the fans or temperature sensors we leave them alone ).

 guppy# envstat
                           Current  CritMax  WarnMax  WarnMin  CritMin  Unit
 [adadc0]
       CPU A AD7417 AMB:    35.000                                      degC
       CPU A DIODE TEMP:    50.375                                      degC
         CPU A 12V CURR:     2.750                                         A
            CPU A VCORE:     1.438                                         V
        CPU A CORE CURR:    18.250                                         A
 [adadc1]
       CPU B AD7417 AMB:    35.250                                      degC
       CPU B DIODE TEMP:    51.562                                      degC
         CPU B 12V CURR:     3.125                                         A
            CPU B VCORE:     1.438                                         V
        CPU B CORE CURR:    21.062                                         A
 [admtemp0]
               BACKSIDE:    42.000   85.000                     10.000  degC
            U3 HEATSINK:    47.875   85.250                     10.000  degC
 [admtemp1]
        MLB MAX6690 AMB:    33.000   85.000                    -55.000  degC
          MLB INLET AMB:    30.500   85.250                    -54.250  degC
 [fcu0]
              DRIVE BAY:      1000                                       RPM
           CPU A INTAKE:       357                                       RPM
          CPU A EXHAUST:       357                                       RPM
           CPU B INTAKE:       357                                       RPM
          CPU B EXHAUST:       357                                       RPM
               BACKSIDE:      1083                                       RPM
                   SLOT:      1089                                       RPM
       Overtemp* Signal:      TRUE
   Air Deflector Signal:      TRUE
 [lmtemp0]
              DRIVE BAY:    28.000   80.000                             degC
 [obiofan0]
             PWR SUPPLY:       N/A

 -- 
 Andreas Gustafsson, gson@gson.org

From: Michael <macallan1888@gmail.com>
To: Andreas Gustafsson <gson@gson.org>
Cc: gnats-bugs@netbsd.org
Subject: Re: port-macppc/59529: POWERMAC_G5 trap setting color palette
Date: Tue, 22 Jul 2025 21:28:16 -0400

 Hello,

 On Tue, 22 Jul 2025 22:10:40 +0300
 Andreas Gustafsson <gson@gson.org> wrote:

 > You wrote:
 > >  >   [    1.0000000] trap: kernel read DSI trap @ 0x8070200c by 0xff848714 (DSISR 0x40000000, err=14), lr 0xff87a524
 > >  >   [    1.0000000] Press a key to panic  
 > >  
 > >  I've seen this on newer, PCIe-based G5 models, we call OF_quiesce() to
 > >  shut down background tasks so we can have full control over the
 > >  hardware, but after that certain OF calls crash. IIRC rin@ committed a
 > >  workaround a while ago, no idea if it made it into 10.
 > >  
 > >  There are a few things to check:
 > >  - please try a -current kernel  
 > 
 > The problem also affects a kernel built from -current source date
 > 2025-06-05 11:30:23 Z.  I tried to build today's current but it
 > failed to build on my build host (that's PR 59543).

 Hmm, the workaround is 11,2-specific I think.

 > >  - try a -current kernel with gffb enabled. This will avoid the OF calls
 > >    and program palette registers directly  
 > 
 > The gffb driver is already enabled in the POWERMAC_G5 kernel, but it's
 > not attaching for me.
 > 
 > Please send me:
 > >  - dmesg output
 > >  - ofctl -p output
 > >  so I can fix that.  

 > Here:
 > 
 >   https://www.gson.org/netbsd/bugs/59529/dmesg.txt
 >   https://www.gson.org/netbsd/bugs/59529/ofctl-p.txt
 > 
 > The dmesg is from a kernel based on POWERMAC_G5 with some patches and
 > debug prints added, built from -current sources from 2025-06-05
 > 11:30:23 Z.

 So you do have an FX5200U. It should attach with a *very* recent -current.
 Also, plain old 7,3 - you should be able to run an SMP kernel with that as well.
 Got to look at my local tree - I have a 7,2 here, same graphics card
 and CPU, and genfb Just Work(tm)ed on mine.

 > >  envstat should list 6 or 7 fans and about 6 temperature sensors. If
 > >  yours shows less please be careful. The CPU has a huge heat sink so
 > >  overheating it will take a while under full load even with all fans
 > >  stopped ( which is unlikely to happen - OF will spin them up and if we
 > >  don't find the fans or temperature sensors we leave them alone ).  
 > 
 > guppy# envstat
 >                           Current  CritMax  WarnMax  WarnMin  CritMin  Unit
 > [adadc0]
 >       CPU A AD7417 AMB:    35.000                                      degC
 >       CPU A DIODE TEMP:    50.375                                      degC
 >         CPU A 12V CURR:     2.750                                         A
 >            CPU A VCORE:     1.438                                         V
 >        CPU A CORE CURR:    18.250                                         A

 That all looks good. The A-number you gave implied something different.
 Then again, maybe everymac.com got that one wrong.

 have fun
 Michael

From: Andreas Gustafsson <gson@gson.org>
To: Michael <macallan1888@gmail.com>, gnats-bugs@netbsd.org
Cc: port-macppc-maintainer@netbsd.org,
    gnats-admin@netbsd.org
Subject: Re: port-macppc/59529: POWERMAC_G5 trap setting color palette
Date: Fri, 25 Jul 2025 11:13:35 +0300

 Michael via gnats wrote:
 >  So you do have an FX5200U. It should attach with a *very* recent -current.
 >  Also, plain old 7,3 - you should be able to run an SMP kernel with that as well.
 >  Got to look at my local tree - I have a 7,2 here, same graphics card
 >  and CPU, and genfb Just Work(tm)ed on mine.

 With an unmodified POWERMAC_G5 kernel from a very recent -current,
 gffb attaches and the system boots all the way to the "root device"
 prompt.  Thank you!

 >  That all looks good. The A-number you gave implied something different.
 >  Then again, maybe everymac.com got that one wrong.

 Sorry, my mistake, the label on the bottom actually says A1047.
 -- 
 Andreas Gustafsson, gson@gson.org

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2025 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.