diff mbox series

[PULL,02/10] hw/hppa/machine: Disable default devices with --nodefaults option

Message ID 20240113055729.4480-3-deller@kernel.org (mailing list archive)
State New, archived
Headers show
Series [PULL,01/10] hw/hppa/machine: Allow up to 3840 MB total memory | expand

Commit Message

Helge Deller Jan. 13, 2024, 5:57 a.m. UTC
From: Helge Deller <deller@gmx.de>

Recognize the qemu --nodefaults option, which will disable the
following default devices on hppa:
- lsi53c895a SCSI controller,
- artist graphics card,
- LASI 82596 NIC,
- tulip PCI NIC,
- second serial PCI card,
- USB OHCI controller.

Adding this option is very useful to allow manual testing and
debugging of the other possible devices on the command line.

Signed-off-by: Helge Deller <deller@gmx.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
 hw/hppa/machine.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

Guenter Roeck Feb. 2, 2024, 4:22 a.m. UTC | #1
Hi,

On Sat, Jan 13, 2024 at 06:57:20AM +0100, deller@kernel.org wrote:
> From: Helge Deller <deller@gmx.de>
> 
> Recognize the qemu --nodefaults option, which will disable the
> following default devices on hppa:
> - lsi53c895a SCSI controller,
> - artist graphics card,
> - LASI 82596 NIC,
> - tulip PCI NIC,
> - second serial PCI card,
> - USB OHCI controller.
> 
> Adding this option is very useful to allow manual testing and
> debugging of the other possible devices on the command line.
> 

With this patch in the tree, I get some interesting crashes in Seabios
if I provide a somewhat unusual command line option. For example,
something like

    -usb -device usb-ehci,id=ehci \
    -device usb-uas,bus=ehci.0,id=uas \
    -device scsi-hd,bus=uas.0,scsi-id=0,lun=0,drive=d0 \
    -drive file= ...

is accepted as command line option but results in

SeaBIOS PA-RISC 32-bit Firmware Version 15 (QEMU 8.2.1)
Duplex Console IO Dependent Code (IODC) revision 1
------------------------------------------------------------------------------
  (c) Copyright 2017-2024 Helge Deller <deller@gmx.de> and SeaBIOS developers.
------------------------------------------------------------------------------
  Processor   Speed            State           Coprocessor State  Cache Size
  ---------  --------   ---------------------  -----------------  ----------
      0      250 MHz    Active                 Functional            0 KB
      1      250 MHz    Idle                   Functional            0 KB
      2      250 MHz    Idle                   Functional            0 KB
      3      250 MHz    Idle                   Functional            0 KB
  Emulated machine:     HP C3700 (64-bit PA2.0) with 32-bit PDC
  Available memory:     1024 MB
  Good memory required: 16 MB
  Primary boot path:    FWSCSI.0.0
  Alternate boot path:  FWSCSI.0.0
  Console path:         SERIAL_2.9600.8.none
  Keyboard path:        SERIAL_2.9600.8.none
*ERROR* in SeaBIOS-hppa-v15:
prepare_boot_path:2898
SeaBIOS wants SYSTEM HALT.

This is without --nodefaults, and it used to work. Is that intentional ?

If I do use the --nodefaults parameter, I was unable to figure out how
to configure the serial console. What command line parameter(s) do I need to
get it ?

Thanks,
Guenter
Helge Deller Feb. 2, 2024, 9:54 a.m. UTC | #2
Hi Guenter,

On 2/2/24 05:22, Guenter Roeck wrote:
> On Sat, Jan 13, 2024 at 06:57:20AM +0100, deller@kernel.org wrote:
>> From: Helge Deller <deller@gmx.de>
>>
>> Recognize the qemu --nodefaults option, which will disable the
>> following default devices on hppa:
>> - lsi53c895a SCSI controller,
>> - artist graphics card,
>> - LASI 82596 NIC,
>> - tulip PCI NIC,
>> - second serial PCI card,
>> - USB OHCI controller.
>>
>> Adding this option is very useful to allow manual testing and
>> debugging of the other possible devices on the command line.
>>
>
> With this patch in the tree, I get some interesting crashes in Seabios
> if I provide a somewhat unusual command line option. For example,
> something like
>
>      -usb -device usb-ehci,id=ehci \
>      -device usb-uas,bus=ehci.0,id=uas \
>      -device scsi-hd,bus=uas.0,scsi-id=0,lun=0,drive=d0 \
>      -drive file= ...
>
> is accepted as command line option but results in
>
> SeaBIOS PA-RISC 32-bit Firmware Version 15 (QEMU 8.2.1)
> Duplex Console IO Dependent Code (IODC) revision 1
> ------------------------------------------------------------------------------
>    (c) Copyright 2017-2024 Helge Deller <deller@gmx.de> and SeaBIOS developers.
> ------------------------------------------------------------------------------
>    Processor   Speed            State           Coprocessor State  Cache Size
>    ---------  --------   ---------------------  -----------------  ----------
>        0      250 MHz    Active                 Functional            0 KB
>        1      250 MHz    Idle                   Functional            0 KB
>        2      250 MHz    Idle                   Functional            0 KB
>        3      250 MHz    Idle                   Functional            0 KB
>    Emulated machine:     HP C3700 (64-bit PA2.0) with 32-bit PDC
>    Available memory:     1024 MB
>    Good memory required: 16 MB
>    Primary boot path:    FWSCSI.0.0
>    Alternate boot path:  FWSCSI.0.0
>    Console path:         SERIAL_2.9600.8.none
>    Keyboard path:        SERIAL_2.9600.8.none
> *ERROR* in SeaBIOS-hppa-v15:
> prepare_boot_path:2898
> SeaBIOS wants SYSTEM HALT.
>
> This is without --nodefaults, and it used to work. Is that intentional ?

This should now be fixed in the upcoming SeaBIOS-hppa-v16 version ("devel" branch):
https://github.com/hdeller/seabios-hppa/tree/devel
Could you test?
If it doesn't work, please give me the full command line.

> If I do use the --nodefaults parameter, I was unable to figure out how
> to configure the serial console. What command line parameter(s) do I need to
> get it ?

You need to add:
-serial mon:stdio
This will create a serial port if it's not yet there.

Thanks for your testing!

Helge
Guenter Roeck Feb. 2, 2024, 6:04 p.m. UTC | #3
On Fri, Feb 02, 2024 at 10:54:20AM +0100, Helge Deller wrote:
> Hi Guenter,
> 
> On 2/2/24 05:22, Guenter Roeck wrote:
> > On Sat, Jan 13, 2024 at 06:57:20AM +0100, deller@kernel.org wrote:
> > > From: Helge Deller <deller@gmx.de>
> > > 
> > > Recognize the qemu --nodefaults option, which will disable the
> > > following default devices on hppa:
> > > - lsi53c895a SCSI controller,
> > > - artist graphics card,
> > > - LASI 82596 NIC,
> > > - tulip PCI NIC,
> > > - second serial PCI card,
> > > - USB OHCI controller.
> > > 
> > > Adding this option is very useful to allow manual testing and
> > > debugging of the other possible devices on the command line.
> > > 
> > 
> > With this patch in the tree, I get some interesting crashes in Seabios
> > if I provide a somewhat unusual command line option. For example,
> > something like
> > 
> >      -usb -device usb-ehci,id=ehci \
> >      -device usb-uas,bus=ehci.0,id=uas \
> >      -device scsi-hd,bus=uas.0,scsi-id=0,lun=0,drive=d0 \
> >      -drive file= ...
> > 
> > is accepted as command line option but results in
> > 
> > SeaBIOS PA-RISC 32-bit Firmware Version 15 (QEMU 8.2.1)
> > Duplex Console IO Dependent Code (IODC) revision 1
> > ------------------------------------------------------------------------------
> >    (c) Copyright 2017-2024 Helge Deller <deller@gmx.de> and SeaBIOS developers.
> > ------------------------------------------------------------------------------
> >    Processor   Speed            State           Coprocessor State  Cache Size
> >    ---------  --------   ---------------------  -----------------  ----------
> >        0      250 MHz    Active                 Functional            0 KB
> >        1      250 MHz    Idle                   Functional            0 KB
> >        2      250 MHz    Idle                   Functional            0 KB
> >        3      250 MHz    Idle                   Functional            0 KB
> >    Emulated machine:     HP C3700 (64-bit PA2.0) with 32-bit PDC
> >    Available memory:     1024 MB
> >    Good memory required: 16 MB
> >    Primary boot path:    FWSCSI.0.0
> >    Alternate boot path:  FWSCSI.0.0
> >    Console path:         SERIAL_2.9600.8.none
> >    Keyboard path:        SERIAL_2.9600.8.none
> > *ERROR* in SeaBIOS-hppa-v15:
> > prepare_boot_path:2898
> > SeaBIOS wants SYSTEM HALT.
> > 
> > This is without --nodefaults, and it used to work. Is that intentional ?
> 
> This should now be fixed in the upcoming SeaBIOS-hppa-v16 version ("devel" branch):
> https://github.com/hdeller/seabios-hppa/tree/devel
> Could you test?

I was able to build from the 'master' branch, but 'devel' gives me

hppa64-linux-ld: target elf32-hppa-linux not found

Do you have a binary seabios image, by any chance ?

> If it doesn't work, please give me the full command line.
> 

qemu-system-hppa -M C3700 -smp 4 \
	-kernel vmlinux -no-reboot -snapshot \
	-usb -device usb-ehci,id=ehci \
	-device usb-uas,bus=ehci.0,id=uas \
	-device scsi-hd,bus=uas.0,scsi-id=0,lun=0,drive=d0 \
	-drive file=rootfs.ext2,if=none,format=raw,id=d0 \
	-append "root=/dev/sda rootwait console=ttyS0,115200" \
	-nographic -monitor null

This is with qemu 8.2.1. Note that the number of CPUs doesn't make a
difference. It turns out this also crashes/aborts immediately with
"nodefaults".

> > If I do use the --nodefaults parameter, I was unable to figure out how
> > to configure the serial console. What command line parameter(s) do I need to
> > get it ?
> 
> You need to add:
> -serial mon:stdio
> This will create a serial port if it's not yet there.
> 

And there was me trying all variants of "-device pci-serial-4x..." I could
think of ;-).

Guenter
Helge Deller Feb. 2, 2024, 7:26 p.m. UTC | #4
On 2/2/24 19:04, Guenter Roeck wrote:
> On Fri, Feb 02, 2024 at 10:54:20AM +0100, Helge Deller wrote:
>> Hi Guenter,
>>
>> On 2/2/24 05:22, Guenter Roeck wrote:
>>> On Sat, Jan 13, 2024 at 06:57:20AM +0100, deller@kernel.org wrote:
>>>> From: Helge Deller <deller@gmx.de>
>>>>
>>>> Recognize the qemu --nodefaults option, which will disable the
>>>> following default devices on hppa:
>>>> - lsi53c895a SCSI controller,
>>>> - artist graphics card,
>>>> - LASI 82596 NIC,
>>>> - tulip PCI NIC,
>>>> - second serial PCI card,
>>>> - USB OHCI controller.
>>>>
>>>> Adding this option is very useful to allow manual testing and
>>>> debugging of the other possible devices on the command line.
>>>>
>>>
>>> With this patch in the tree, I get some interesting crashes in Seabios
>>> if I provide a somewhat unusual command line option. For example,
>>> something like
>>>
>>>       -usb -device usb-ehci,id=ehci \
>>>       -device usb-uas,bus=ehci.0,id=uas \
>>>       -device scsi-hd,bus=uas.0,scsi-id=0,lun=0,drive=d0 \
>>>       -drive file= ...
>>>
>>> is accepted as command line option but results in
>>>
>>> SeaBIOS PA-RISC 32-bit Firmware Version 15 (QEMU 8.2.1)
>>> Duplex Console IO Dependent Code (IODC) revision 1
>>> ------------------------------------------------------------------------------
>>>     (c) Copyright 2017-2024 Helge Deller <deller@gmx.de> and SeaBIOS developers.
>>> ------------------------------------------------------------------------------
>>>     Processor   Speed            State           Coprocessor State  Cache Size
>>>     ---------  --------   ---------------------  -----------------  ----------
>>>         0      250 MHz    Active                 Functional            0 KB
>>>         1      250 MHz    Idle                   Functional            0 KB
>>>         2      250 MHz    Idle                   Functional            0 KB
>>>         3      250 MHz    Idle                   Functional            0 KB
>>>     Emulated machine:     HP C3700 (64-bit PA2.0) with 32-bit PDC
>>>     Available memory:     1024 MB
>>>     Good memory required: 16 MB
>>>     Primary boot path:    FWSCSI.0.0
>>>     Alternate boot path:  FWSCSI.0.0
>>>     Console path:         SERIAL_2.9600.8.none
>>>     Keyboard path:        SERIAL_2.9600.8.none
>>> *ERROR* in SeaBIOS-hppa-v15:
>>> prepare_boot_path:2898
>>> SeaBIOS wants SYSTEM HALT.
>>>
>>> This is without --nodefaults, and it used to work. Is that intentional ?
>>
>> This should now be fixed in the upcoming SeaBIOS-hppa-v16 version ("devel" branch):
>> https://github.com/hdeller/seabios-hppa/tree/devel
>> Could you test?
>
> I was able to build from the 'master' branch, but 'devel' gives me
>
> hppa64-linux-ld: target elf32-hppa-linux not found

The devel branch now includes a 64-bit firmware too.
You need both, hppa (32-bit) and hppa64 (64-bit) gcc
and binutils packages installed.

> Do you have a binary seabios image, by any chance ?

http://www.dellerweb.de/temp/hppa-firmware.img

>> If it doesn't work, please give me the full command line.
>>
>
> qemu-system-hppa -M C3700 -smp 4 \
> 	-kernel vmlinux -no-reboot -snapshot \
> 	-usb -device usb-ehci,id=ehci \
> 	-device usb-uas,bus=ehci.0,id=uas \
> 	-device scsi-hd,bus=uas.0,scsi-id=0,lun=0,drive=d0 \
> 	-drive file=rootfs.ext2,if=none,format=raw,id=d0 \
> 	-append "root=/dev/sda rootwait console=ttyS0,115200" \
> 	-nographic -monitor null

That line boots for me now.

> This is with qemu 8.2.1. Note that the number of CPUs doesn't make a
> difference. It turns out this also crashes/aborts immediately with
> "nodefaults".

Adding "--nodefaults -serial mon:stdio" to the line above works too.

>>> If I do use the --nodefaults parameter, I was unable to figure out how
>>> to configure the serial console. What command line parameter(s) do I need to
>>> get it ?
>>
>> You need to add:
>> -serial mon:stdio
>> This will create a serial port if it's not yet there.
>>
>
> And there was me trying all variants of "-device pci-serial-4x..." I could
> think of ;-).

:-)

Helge
Guenter Roeck Feb. 4, 2024, 7:26 p.m. UTC | #5
Hi Helge,

On Thu, Feb 01, 2024 at 08:22:58PM -0800, Guenter Roeck wrote:
> Hi,
> 
> On Sat, Jan 13, 2024 at 06:57:20AM +0100, deller@kernel.org wrote:
> > From: Helge Deller <deller@gmx.de>
> > 
> > Recognize the qemu --nodefaults option, which will disable the
> > following default devices on hppa:
> > - lsi53c895a SCSI controller,
> > - artist graphics card,
> > - LASI 82596 NIC,
> > - tulip PCI NIC,
> > - second serial PCI card,
> > - USB OHCI controller.
> > 
> > Adding this option is very useful to allow manual testing and
> > debugging of the other possible devices on the command line.
> > 
> 
> With this patch in the tree, I get some interesting crashes in Seabios
> if I provide a somewhat unusual command line option. For example,
> something like
> 
>     -usb -device usb-ehci,id=ehci \
>     -device usb-uas,bus=ehci.0,id=uas \
>     -device scsi-hd,bus=uas.0,scsi-id=0,lun=0,drive=d0 \
>     -drive file= ...
> 
> is accepted as command line option but results in
> 
> SeaBIOS PA-RISC 32-bit Firmware Version 15 (QEMU 8.2.1)
> Duplex Console IO Dependent Code (IODC) revision 1
> ------------------------------------------------------------------------------
>   (c) Copyright 2017-2024 Helge Deller <deller@gmx.de> and SeaBIOS developers.
> ------------------------------------------------------------------------------
>   Processor   Speed            State           Coprocessor State  Cache Size
>   ---------  --------   ---------------------  -----------------  ----------
>       0      250 MHz    Active                 Functional            0 KB
>       1      250 MHz    Idle                   Functional            0 KB
>       2      250 MHz    Idle                   Functional            0 KB
>       3      250 MHz    Idle                   Functional            0 KB
>   Emulated machine:     HP C3700 (64-bit PA2.0) with 32-bit PDC
>   Available memory:     1024 MB
>   Good memory required: 16 MB
>   Primary boot path:    FWSCSI.0.0
>   Alternate boot path:  FWSCSI.0.0
>   Console path:         SERIAL_2.9600.8.none
>   Keyboard path:        SERIAL_2.9600.8.none
> *ERROR* in SeaBIOS-hppa-v15:
> prepare_boot_path:2898
> SeaBIOS wants SYSTEM HALT.

Just in case it matters, the following partial revert fixes the problem
for me.

diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
index eb78c46ff1..cc903bc323 100644
--- a/hw/hppa/machine.c
+++ b/hw/hppa/machine.c
@@ -346,10 +346,8 @@ static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus,
     SysBusDevice *s;

     /* SCSI disk setup. */
-    if (drive_get_max_bus(IF_SCSI) >= 0) {
-        dev = DEVICE(pci_create_simple(pci_bus, -1, "lsi53c895a"));
-        lsi53c8xx_handle_legacy_cmdline(dev);
-    }
+    dev = DEVICE(pci_create_simple(pci_bus, -1, "lsi53c895a"));
+    lsi53c8xx_handle_legacy_cmdline(dev);

It seems that SeaBIOS doesn't like it if the SCSI interface is missing.

Guenter
diff mbox series

Patch

diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
index b11907617e..54ca2fd91a 100644
--- a/hw/hppa/machine.c
+++ b/hw/hppa/machine.c
@@ -346,8 +346,10 @@  static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus,
     SysBusDevice *s;
 
     /* SCSI disk setup. */
-    dev = DEVICE(pci_create_simple(pci_bus, -1, "lsi53c895a"));
-    lsi53c8xx_handle_legacy_cmdline(dev);
+    if (drive_get_max_bus(IF_SCSI) >= 0) {
+        dev = DEVICE(pci_create_simple(pci_bus, -1, "lsi53c895a"));
+        lsi53c8xx_handle_legacy_cmdline(dev);
+    }
 
     /* Graphics setup. */
     if (machine->enable_graphics && vga_interface_type != VGA_NONE) {
@@ -360,7 +362,7 @@  static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus,
     }
 
     /* Network setup. */
-    if (enable_lasi_lan()) {
+    if (nd_table[0].used && enable_lasi_lan()) {
         lasi_82596_init(addr_space, translate(NULL, LASI_LAN_HPA),
                         qdev_get_gpio_in(lasi_dev, LASI_IRQ_LAN_HPA));
     }
@@ -385,7 +387,7 @@  static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus,
     pci_set_word(&pci_dev->config[PCI_SUBSYSTEM_ID], 0x1227); /* Powerbar */
 
     /* create a second serial PCI card when running Astro */
-    if (!lasi_dev) {
+    if (serial_hd(1) && !lasi_dev) {
         pci_dev = pci_new(-1, "pci-serial-4x");
         qdev_prop_set_chr(DEVICE(pci_dev), "chardev1", serial_hd(1));
         qdev_prop_set_chr(DEVICE(pci_dev), "chardev2", serial_hd(2));