target/hppa qemu v8.2 regression fixes
PATCH v2 4/9 target/hppa: Fix PDC address translation on PA2.0 with PSW.W=0
In reply to [email protected]From: Helge Deller <[email protected]>
Fix the address translation for PDC space on PA2.0 if PSW.W=0. Basically, for any address in the 32-bit PDC range from 0xf0000000 to 0xf1000000 keep the lower 32-bits and just set the upper 32-bits to 0xfffffff0.
This mapping fixes the emulated power button in PDC space for 32- and 64-bit machines and is how the physical C3700 machine seems to map PDC.
--- target/hppa/mem_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/hppa/mem_helper.c +1 -1
@@ -56,7 +56,7 @@ hwaddr hppa_abs_to_phys_pa2_w0(vaddr addr) addr = (int32_t )addr; }else {/* PDC address space */ - addr &=MAKE_64BIT_MASK (0 ,24 ); + addr = (uint32_t )addr; addr |=-1ull << (TARGET_PHYS_ADDR_SPACE_BITS -4 ); }return addr;
Signature · 1 line
2.43.0
PATCH v2 5/9 target/hppa: Strip upper 32-bits of IOR on error in probe
In reply to [email protected]From: Helge Deller <[email protected]>
Limit IOR to the lower 32-bits on failure.
Keep patch short for easier backporting.
--- target/hppa/op_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/hppa/op_helper.c +1 -1
@@ -353,7 +353,7 @@ target_ulong HELPER(probe)(CPUHPPAState *env, target_ulong addr,if (excp >=0 ) {if (env->psw &PSW_Q ) {/* ??? Needs tweaking for hppa64. */ - env->cr[CR_IOR ] = addr; + env->cr[CR_IOR ] = (uint32_t )addr; env->cr[CR_ISR ] = addr >>32 ; }if (excp ==EXCP_DTLB_MISS ) {
Signature · 1 line
2.43.0
PATCH v2 6/9 target/hppa: Strip upper 32-bits of IOR on unaligned access error
In reply to [email protected]From: Helge Deller <[email protected]>
Limit IOR to the lower 32-bits on failure.
Keep patch short for easier backporting.
--- target/hppa/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/hppa/cpu.c +1 -1
@@ -112,7 +112,7 @@ void hppa_cpu_do_unaligned_access(CPUState *cs, vaddr addr, cs->exception_index =EXCP_UNALIGN ;if (env->psw &PSW_Q ) {/* ??? Needs tweaking for hppa64. */ - env->cr[CR_IOR ] = addr; + env->cr[CR_IOR ] = (uint32_t )addr; env->cr[CR_ISR ] = addr >>32 ; }
Signature · 1 line
2.43.0
PATCH v2 3/9 hw/pci-host/astro: Add missing astro & elroy registers for NetBSD
In reply to [email protected]From: Helge Deller <[email protected]>
NetBSD accesses some astro and elroy registers which aren't accessed by Linux yet. Add emulation for those registers to allow NetBSD to boot further.
Please note that this patch is not sufficient to completely boot up NetBSD on the 64-bit C3700 machine yet.
--- hw/pci-host/astro.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-)
hw/pci-host/astro.c +23 -3
@@ -166,6 +166,8 @@ static MemTxResult elroy_chip_write_with_attrs(void *opaque, hwaddr addr,trace_elroy_write (addr, size, val);switch ((addr >>3 ) <<3 ) { +case 0x000 :/* PCI_ID & PCI_COMMAND_STATUS_REG */ +break ;case 0x080 :put_val_in_int64 (&s->arb_mask, addr, size, val);break ;
@@ -175,6 +177,9 @@ static MemTxResult elroy_chip_write_with_attrs(void *opaque, hwaddr addr, case 0x200 ... 0x250 - 1: /* LMMIO, GMMIO, WLMMIO, WGMMIO, ... */put_val_in_arrary (s->mmio_base,0x200 , addr, size, val);break ; +case 0x300 :/* ibase */ +case 0x308 :/* imask */ +break ;case 0x0680 :put_val_in_int64 (&s->error_config, addr, size, val);break ;
@@ -538,6 +543,9 @@ static MemTxResult astro_chip_read_with_attrs(void *opaque, hwaddr addr,case 0x0030 :/* HP-UX 10.20 and 11.11 reads it. No idea. */ val =-1 ;break ; +case 0x0078 :/* NetBSD reads 0x78 ? */ + val =-1 ; +break ; case 0x0300 ... 0x03d8: /* LMMIO_DIRECT0_BASE... */ index = (addr -0x300 ) /8 ; val = s->ioc_ranges[index];
@@ -624,31 +632,43 @@ static MemTxResult astro_chip_write_with_attrs(void *opaque, hwaddr addr,case 0x10220 :case 0x10230 :/* HP-UX 11.11 reads it. No idea. */ break ; -case 0x22108 :/* IOC STATUS_CONTROL */ -put_val_in_int64 (&s->ioc_status_ctrl, addr, size, val); -break ; case 0x20200 ... 0x20240 - 1: /* IOC Rope0_Control ... */put_val_in_arrary (s->ioc_rope_control,0x20200 , addr, size, val);break ;case 0x20040 :/* IOC Rope config */ +case 0x22040 :put_val_in_int64 (&s->ioc_rope_config, addr, size, val);break ;case 0x20300 : +case 0x22300 :put_val_in_int64 (&s->tlb_ibase, addr, size, val);break ;case 0x20308 : +case 0x22308 :put_val_in_int64 (&s->tlb_imask, addr, size, val);break ;case 0x20310 : +case 0x22310 :put_val_in_int64 (&s->tlb_pcom, addr, size, val);/* TODO: flush iommu */ break ;case 0x20318 : +case 0x22318 :put_val_in_int64 (&s->tlb_tcnfg, addr, size, val);break ;case 0x20320 : +case 0x22320 :put_val_in_int64 (&s->tlb_pdir_base, addr, size, val);break ; +case 0x22000 :/* func_id */ +break ; +case 0x22008 :/* func_class */ +break ; +case 0x22050 :/* rope_debug */ +break ; +case 0x22108 :/* IOC STATUS_CONTROL */ +put_val_in_int64 (&s->ioc_status_ctrl, addr, size, val); +break ;/* * empty placeholders for non-existent elroys, e.g. * func_class, pci config & data
Signature · 1 line
2.43.0
PATCH v2 1/9 hw/hppa/machine: Allow up to 3840 MB total memory
In reply to [email protected]From: Helge Deller <[email protected]>
The physical hardware allows DIMMs of 4 MB size and above, allowing up to 3840 MB of memory, but is restricted by setup code to 3 GB. Increase the limit to allow up to the maximum amount of memory.
Btw. the memory area from 0xf000.0000 to 0xffff.ffff is reserved by the architecture for firmware and I/O memory and can not be used for standard memory.
An upcoming 64-bit SeaBIOS-hppa firmware will allow more than 3.75GB on 64-bit HPPA64. In this case the ram_max for the pa20 case will change.
--- hw/hppa/machine.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
hw/hppa/machine.c +6 -3
@@ -276,6 +276,7 @@ static TranslateFn *machine_HP_common_init_cpus(MachineState *machine)unsigned int smp_cpus = machine->smp.cpus;TranslateFn *translate;MemoryRegion *cpu_region; +uint64_t ram_max;/* Create CPUs. */ for (unsigned int i =0 ; i < smp_cpus; i++) {
@@ -288,8 +289,10 @@ static TranslateFn *machine_HP_common_init_cpus(MachineState *machine)*/ if (hppa_is_pa20 (&cpu[0 ]->env)) { translate = translate_pa20; + ram_max =0xf0000000 ;/* 3.75 GB (limited by 32-bit firmware) */ }else { translate = translate_pa10; + ram_max =0xf0000000 ;/* 3.75 GB (32-bit CPU) */ }for (unsigned int i =0 ; i < smp_cpus; i++) {
@@ -311,9 +314,9 @@ static TranslateFn *machine_HP_common_init_cpus(MachineState *machine) cpu_region);/* Main memory region. */ -if (machine->ram_size >3 * GiB) { -error_report ("RAM size is currently restricted to 3GB" ); -exit (EXIT_FAILURE ); +if (machine->ram_size > ram_max) { +info_report ("Max RAM size limited to %" PRIu64" MB" , ram_max / MiB); + machine->ram_size = ram_max; }memory_region_add_subregion_overlap (addr_space,0 , machine->ram,-1 );
Signature · 1 line
2.43.0
PATCH v2 2/9 hw/hppa/machine: Disable default devices with --nodefaults option
In reply to [email protected]From: Helge Deller <[email protected]>
Add support for the qemu --nodefaults option, which will disable the following default devices:
- 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.
--- hw/hppa/machine.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
hw/hppa/machine.c +9 -6
@@ -346,11 +346,14 @@ 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 (defaults_enabled ()) { + 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 ) { +if (defaults_enabled () && machine->enable_graphics && + vga_interface_type !=VGA_NONE ) { vga_interface_created = true; dev =qdev_new ("artist" ); s =SYS_BUS_DEVICE (dev);
@@ -360,7 +363,7 @@ static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus, }/* Network setup. */ -if (enable_lasi_lan ()) { +if (defaults_enabled () &&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 +388,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 (defaults_enabled () && !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 ));
@@ -395,7 +398,7 @@ static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus, }/* create USB OHCI controller for USB keyboard & mouse on Astro machines */ -if (!lasi_dev && machine->enable_graphics) { +if (defaults_enabled () && !lasi_dev && machine->enable_graphics) {pci_create_simple (pci_bus,-1 ,"pci-ohci" );usb_create_simple (usb_bus_find (-1 ),"usb-kbd" );usb_create_simple (usb_bus_find (-1 ),"usb-mouse" );
Signature · 1 line
2.43.0
PATCH v2 7/9 hw/hppa: Move software power button address back into PDC
In reply to [email protected]From: Helge Deller <[email protected]>
The various operating systems (e.g. Linux, NetBSD) have issues mapping the power button when it's stored in page zero. NetBSD even crashes, because it fails to map that page and then accesses unmapped memory.
Since we now have a consistent memory mapping of PDC in 32-bit and 64-bit address space (the lower 32-bits of the address are in sync) the power button can be moved back to PDC space.
This patch fixes the power button on Linux, NetBSD and HP-UX.
--- hw/hppa/machine.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
hw/hppa/machine.c +5 -4
@@ -36,8 +36,8 @@#define MIN_SEABIOS_HPPA_VERSION 12/* require at least this fw version */ -/* Power button address at &PAGE0->pad[4] */ -#define HPA_POWER_BUTTON (0x40 + 4 * sizeof(uint32_t)) +#define HPA_POWER_BUTTON (FIRMWARE_END - 0x10) +static hwaddr soft_power_reg;#define enable_lasi_lan () 0
@@ -45,7 +45,6 @@ static DeviceState *lasi_dev;static void hppa_powerdown_req (Notifier *n,void *opaque) { -hwaddr soft_power_reg =HPA_POWER_BUTTON ;uint32_t val; val =ldl_be_phys (&address_space_memory, soft_power_reg);
@@ -221,7 +220,7 @@ static FWCfgState *create_fw_cfg(MachineState *ms, PCIBus *pci_bus,fw_cfg_add_file (fw_cfg,"/etc/hppa/machine" ,g_memdup (mc->name, len), len); - val =cpu_to_le64 (HPA_POWER_BUTTON ); + val =cpu_to_le64 (soft_power_reg);fw_cfg_add_file (fw_cfg,"/etc/hppa/power-button-addr" ,g_memdup (&val,sizeof (val)),sizeof (val));
@@ -295,6 +294,8 @@ static TranslateFn *machine_HP_common_init_cpus(MachineState *machine) ram_max =0xf0000000 ;/* 3.75 GB (32-bit CPU) */ } + soft_power_reg =translate (NULL ,HPA_POWER_BUTTON ); +for (unsigned int i =0 ; i < smp_cpus; i++) { g_autofree char *name = g_strdup_printf("cpu%u-io-eir", i);
Signature · 1 line
2.43.0
PATCH v2 9/9 target/hppa: Update SeaBIOS-hppa to version 15
In reply to [email protected]From: Helge Deller <[email protected]>
SeaBIOS-hppa version 15:
- Fix OpenBSD 7.4 boot (PDC_MEM_MAP call returned wrong values)
SeaBIOS-hppa version 14 comes with those fixes:
- Fix 32-bit HP-UX crash (fix in PDC_FIND_MODULE call)
- Fix NetBSD boot (power button fix and add option to disable it)
- Fix FPU detection on NetBSD
- Add MEMORY_HPA module on B160L
- Fix detection of mptsas and esp scsi controllers
- Fix terminate DMA transfer in esp driver (Mark Cave-Ayland)
- Allow booting from esp controller
--- pc-bios/hppa-firmware.img | Bin 681388 -> 163324 bytes roms/seabios-hppa | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-)
pc-bios/hppa-firmware.img binary +0 -0
roms/seabios-hppa +1 -1
@@ -1 +1 @@ -Subproject commit 4c6ecda618f2066707f50c53f31419244fd7f77a +Subproject commit e4eac85880e8677f96d8b9e94de9f2eec9c0751f
Signature · 1 line
2.43.0
v2 cover target/hppa qemu v8.2 regression fixes
From: Helge Deller <[email protected]>
There were some regressions introduced with Qemu v8.2 on the hppa/hppa64 target, e.g.:
- 32-bit HP-UX crashes on B160L (32-bit) machine
- NetBSD boot failure due to power button in page zero
- NetBSD FPU detection failure
- OpenBSD 7.4 boot failure
This small patch series fixes those known regressions and additionally:
- allows usage of the max. 3840MB of memory (instead of 3GB),
- adds support for the qemu --nodefaults option (to debug other devices)
I tried to keep the patches small to make backporting easier.
This patch set will not fix those known (non-regression) bugs:
- HP-UX and NetBSD still fail to boot on the new 64-bit C3700 machine
- Linux kernel will still fail to boot on C3700 as long as kernel modules are used.
The whole series can be pulled from the "hppa-fixes-8.2" branch from:
https://github.com/hdeller/qemu-hppa.git hppa-fixes-8.2
Changes v1->v2:
- fix OpenBSD boot with SeaBIOS v15 instead of v14
- commit message enhancements suggested by BALATON Zoltan
- use uint64_t for ram_max in patch #1
Helge Deller (9):
hw/hppa/machine: Allow up to 3840 MB total memory hw/hppa/machine: Disable default devices with --nodefaults option hw/pci-host/astro: Add missing astro & elroy registers for NetBSD target/hppa: Fix PDC address translation on PA2.0 with PSW.W=0 target/hppa: Strip upper 32-bits of IOR on error in probe target/hppa: Strip upper 32-bits of IOR on unaligned access error hw/hppa: Move software power button address back into PDC target/hppa: Avoid accessing %gr0 when raising exception target/hppa: Update SeaBIOS-hppa to version 15
hw/hppa/machine.c | 33 ++++++++++++++++++++------------- hw/pci-host/astro.c | 26 +++++++++++++++++++++++--- pc-bios/hppa-firmware.img | Bin 681388 -> 163324 bytes roms/seabios-hppa | 2 +- target/hppa/cpu.c | 2 +- target/hppa/mem_helper.c | 4 ++-- target/hppa/op_helper.c | 2 +- 7 files changed, 48 insertions(+), 21 deletions(-)
Signature · 1 line
2.43.0
PATCH v2 8/9 target/hppa: Avoid accessing %gr0 when raising exception
From: Helge Deller <[email protected]>
The value of unwind_breg may reference register %r0, but we need to avoid accessing gr0 directly and use the value 0 instead.
At runtime I've seen unwind_breg being zero with the Linux kernel when rfi is used to jump to smp_callin().
--- target/hppa/mem_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/hppa/mem_helper.c +1 -1
@@ -335,7 +335,7 @@ raise_exception_with_ior(CPUHPPAState *env, int excp, uintptr_t retaddr,cpu_restore_state (cs, retaddr); - b = env->gr[env->unwind_breg]; + b = env->unwind_breg ? env->gr[env->unwind_breg] :0 ; b >>= (env->psw &PSW_W ?62 :30 ); env->cr[CR_IOR ] |= b <<62 ;
Signature · 1 line
2.43.0
Quoted 2 lines
The whole series can be pulled from the "hppa-fixes-8.2" branch from:
https://github.com/hdeller/qemu-hppa.git hppa-fixes-8.2
Re: [PATCH v2 4/9] target/hppa: Fix PDC address translation on PA2.0 with PSW.W=0
In reply to [email protected]Quoted 21 lines · On 1/8/24 00:22, [email protected] wrote:
From: Helge Deller <[email protected]>
Fix the address translation for PDC space on PA2.0 if PSW.W=0. Basically, for any address in the 32-bit PDC range from
0xf0000000to0xf1000000keep the lower 32-bits and just set the upper 32-bits to0xfffffff0.This mapping fixes the emulated power button in PDC space for 32- and 64-bit machines and is how the physical C3700 machine seems to map PDC.
Signed-off-by Helge Deller <[email protected]>--- target/hppa/mem_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/hppa/mem_helper.c +0
-0
target/hppa/mem_helper.c hwaddr hppa_abs_to_phys_pa2_w0(vaddr addr) · line 62
Quoted 8 lines
target/hppa/mem_helper.c +1
-1@@ -56,7 +56,7 @@ hwaddr hppa_abs_to_phys_pa2_w0(vaddr addr) addr = (int32_t )addr; }else {/* PDC address space */ - addr &=MAKE_64BIT_MASK (0 ,24 ); + addr = (uint32_t )addr; addr |=-1ull << (TARGET_PHYS_ADDR_SPACE_BITS -4 ); }return addr;
I believe this to be incorrect, as it contradicts Figures H-10 and H-11.
r~
Re: [PATCH v2 1/9] hw/hppa/machine: Allow up to 3840 MB total memory
In reply to [email protected]Quoted 13 lines · On 1/8/24 00:22, [email protected] wrote:
From: Helge Deller <[email protected]>
The physical hardware allows DIMMs of 4 MB size and above, allowing up to 3840 MB of memory, but is restricted by setup code to 3 GB. Increase the limit to allow up to the maximum amount of memory.
Btw. the memory area from 0xf000.0000 to 0xffff.ffff is reserved by the architecture for firmware and I/O memory and can not be used for standard memory.
An upcoming 64-bit SeaBIOS-hppa firmware will allow more than 3.75GB on 64-bit HPPA64. In this case the
ram_maxfor the pa20 case will change.
Quoted 6 lines
Signed-off-by Helge Deller <[email protected]>Noticed-by Nelson H. F. Beebe <[email protected]>Fixes b7746b1194c8 ("hw/hppa/machine: Restrict the total memory size to 3GB")--- hw/hppa/machine.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
r~
Re: [PATCH v2 2/9] hw/hppa/machine: Disable default devices with --nodefaults option
In reply to [email protected]Quoted 60 lines · On 1/8/24 00:22, [email protected] wrote:
From: Helge Deller <[email protected]>
Add support for the qemu --nodefaults option, which will disable the following default devices:
- 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 <[email protected]>--- hw/hppa/machine.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)hw/hppa/machine.c +8
-5@@ -346,11 +346,14 @@ 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 (defaults_enabled ()) { + 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 ) { +if (defaults_enabled () && machine->enable_graphics && + vga_interface_type !=VGA_NONE ) { vga_interface_created = true; dev =qdev_new ("artist" ); s =SYS_BUS_DEVICE (dev);@@ -360,7 +363,7 @@ static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus, }/* Network setup. */ -if (enable_lasi_lan ()) { +if (defaults_enabled () &&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 +388,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 (defaults_enabled () && !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 ));
hw/hppa/machine.c static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus, · line 404
Quoted 8 lines
hw/hppa/machine.c +1
-1@@ -395,7 +398,7 @@ static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus, }/* create USB OHCI controller for USB keyboard & mouse on Astro machines */ -if (!lasi_dev && machine->enable_graphics) { +if (defaults_enabled () && !lasi_dev && machine->enable_graphics) {pci_create_simple (pci_bus,-1 ,"pci-ohci" );usb_create_simple (usb_bus_find (-1 ),"usb-kbd" );usb_create_simple (usb_bus_find (-1 ),"usb-mouse" );
This almost doubles the uses of default_enabled in the entire tree. I wonder if some of them are redundant or should be using a different test.
r~
Re: [PATCH v2 5/9] target/hppa: Strip upper 32-bits of IOR on error in probe
In reply to [email protected]Quoted 15 lines · On 1/8/24 00:22, [email protected] wrote:
From: Helge Deller <[email protected]>
Limit IOR to the lower 32-bits on failure.
Keep patch short for easier backporting.Signed-off-by Helge Deller <[email protected]>--- target/hppa/op_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/hppa/op_helper.c +0
-0
target/hppa/op_helper.c target_ulong HELPER(probe)(CPUHPPAState *env, target_ulong addr, · line 359
Quoted 8 lines
target/hppa/op_helper.c +1
-1@@ -353,7 +353,7 @@ target_ulong HELPER(probe)(CPUHPPAState *env, target_ulong addr,if (excp >=0 ) {if (env->psw &PSW_Q ) {/* ??? Needs tweaking for hppa64. */ - env->cr[CR_IOR ] = addr; + env->cr[CR_IOR ] = (uint32_t )addr; env->cr[CR_ISR ] = addr >>32 ; }if (excp ==EXCP_DTLB_MISS ) {
We might need to export raise_exception_with_ior and use that. ISR needs adjusting as well for hppa64.
r~
Re: [PATCH v2 6/9] target/hppa: Strip upper 32-bits of IOR on unaligned access error
In reply to [email protected]Quoted 15 lines · On 1/8/24 00:22, [email protected] wrote:
From: Helge Deller <[email protected]>
Limit IOR to the lower 32-bits on failure.
Keep patch short for easier backporting.Signed-off-by Helge Deller <[email protected]>--- target/hppa/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/hppa/cpu.c +0
-0
target/hppa/cpu.c void hppa_cpu_do_unaligned_access(CPUState *cs, vaddr addr, · line 118
Quoted 8 lines
target/hppa/cpu.c +1
-1@@ -112,7 +112,7 @@ void hppa_cpu_do_unaligned_access(CPUState *cs, vaddr addr, cs->exception_index =EXCP_UNALIGN ;if (env->psw &PSW_Q ) {/* ??? Needs tweaking for hppa64. */ - env->cr[CR_IOR ] = addr; + env->cr[CR_IOR ] = (uint32_t )addr; env->cr[CR_ISR ] = addr >>32 ; }
Likewise, might need raise_exception_with_ior.
r~
Re: [PATCH v2 8/9] target/hppa: Avoid accessing %gr0 when raising exception
In reply to [email protected]Quoted 18 lines · On 1/8/24 00:22, [email protected] wrote:
From: Helge Deller <[email protected]>
The value of
unwind_bregmay reference register %r0, but we need to avoid accessing gr0 directly and use the value 0 instead.At runtime I've seen
unwind_bregbeing zero with the Linux kernel when rfi is used to jump tosmp_callin().Signed-off-by Helge Deller <[email protected]>--- target/hppa/mem_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/hppa/mem_helper.c +0
-0
target/hppa/mem_helper.c raise_exception_with_ior(CPUHPPAState *env, int excp, uintptr_t retaddr, · line 341
Quoted 8 lines
target/hppa/mem_helper.c +1
-1@@ -335,7 +335,7 @@ raise_exception_with_ior(CPUHPPAState *env, int excp, uintptr_t retaddr,cpu_restore_state (cs, retaddr); - b = env->gr[env->unwind_breg]; + b = env->unwind_breg ? env->gr[env->unwind_breg] :0 ; b >>= (env->psw &PSW_W ?62 :30 ); env->cr[CR_IOR ] |= b <<62 ;
r~
Re: [PATCH v2 2/9] hw/hppa/machine: Disable default devices with --nodefaults option
In reply to Richard HendersonQuoted 60 lines · Richard Henderson
Quoted 59 lines · On 1/8/24 00:22, [email protected] wrote:
From: Helge Deller <[email protected]>
Add support for the qemu --nodefaults option, which will disable the following default devices:
- 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 <[email protected]>---
hw/hppa/machine.c| 15 +++++++++------1 file changed, 9 insertions(+), 6 deletions(-)hw/hppa/machine.c +7
-4@@ -346,11 +346,14 @@ 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 (defaults_enabled()) { + 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) { + if (defaults_enabled() && machine->enable_graphics && + vga_interface_type != VGA_NONE) { vga_interface_created = true; dev = qdev_new("artist"); s = SYS_BUS_DEVICE(dev);@@ -360,7 +363,7 @@ static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus, } /* Network setup. */ - if (enable_lasi_lan()) { + if (defaults_enabled() && 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 +388,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 (defaults_enabled()&& !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));hw/hppa/machine.c +0
-1@@ -395,7 +398,7 @@ static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus, } /* create USB OHCI controller for USB keyboard & mouse on Astro machines */ - if (!lasi_dev && machine->enable_graphics) {
Quoted 8 lines
hw/hppa/machine.c static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus, · line 404
Quoted 4 lines
hw/hppa/machine.c +1
-0+ if (defaults_enabled() && !lasi_dev && machine->enable_graphics) { pci_create_simple(pci_bus, -1, "pci-ohci"); usb_create_simple(usb_bus_find(-1), "usb-kbd"); usb_create_simple(usb_bus_find(-1), "usb-mouse");This almost doubles the uses of
default_enabledin the entire tree. I wonder if some of them are redundant or should be using a different test.
Any proposal?
Maybe introduce a local variable hppa_bare_metal = !defaults_enabled(); and use that instead?
Helge
Re: [PATCH v2 4/9] target/hppa: Fix PDC address translation on PA2.0 with PSW.W=0
In reply to Richard HendersonQuoted 17 lines · Richard Henderson
Quoted 16 lines · On 1/8/24 00:22, [email protected] wrote:
From: Helge Deller <[email protected]>
Fix the address translation for PDC space on PA2.0 if PSW.W=0. Basically, for any address in the 32-bit PDC range from
0xf0000000to0xf1000000keep the lower 32-bits and just set the upper 32-bits to0xfffffff0.This mapping fixes the emulated power button in PDC space for 32- and 64-bit machines and is how the physical C3700 machine seems to map PDC.
Signed-off-by Helge Deller <[email protected]>---
target/hppa/mem_helper.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 15 lines
target/hppa/mem_helper.c hwaddr hppa_abs_to_phys_pa2_w0(vaddr addr) · line 62
Quoted 13 lines
target/hppa/mem_helper.c +1
-1@@ -56,7 +56,7 @@ hwaddr hppa_abs_to_phys_pa2_w0(vaddr addr) addr = (int32_t)addr; } else { /* PDC address space */ - addr &= MAKE_64BIT_MASK(0, 24); + addr = (uint32_t)addr; addr |= -1ull << (TARGET_PHYS_ADDR_SPACE_BITS - 4); } return addr;I believe this to be incorrect, as it contradicts Figures H-10 and H-11.
Yes, but that seems to be how it's really implemented on physical hardware. We have seen other figures as well, which didn't reflect the real world either. IMHO we can revert if it really turns out to be wrong and when we get a better solution.
Helge
Re: [PATCH v2 2/9] hw/hppa/machine: Disable default devices with --nodefaults option
In reply to Helge DellerQuoted 74 lines · Helge Deller
Quoted 64 lines · Richard Henderson
Quoted 63 lines · On 1/8/24 00:22, [email protected] wrote:
From: Helge Deller <[email protected]>
Add support for the qemu --nodefaults option, which will disable the following default devices:
- 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 <[email protected]>---
hw/hppa/machine.c| 15 +++++++++------1 file changed, 9 insertions(+), 6 deletions(-)hw/hppa/machine.c +7
-4@@ -346,11 +346,14 @@ 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 (defaults_enabled()) { + 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) { + if (defaults_enabled() && machine->enable_graphics && + vga_interface_type != VGA_NONE) { vga_interface_created = true; dev = qdev_new("artist"); s = SYS_BUS_DEVICE(dev);@@ -360,7 +363,7 @@ static void machine_HP_common_init_tail(MachineState *machine,PCIBus *pci_bus, } /* Network setup. */ - if (enable_lasi_lan()) { + if (defaults_enabled() && 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 +388,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 (defaults_enabled()&& !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));hw/hppa/machine.c +0
-1@@ -395,7 +398,7 @@ static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus, } /* create USB OHCI controller for USB keyboard & mouse on Astro machines */ - if (!lasi_dev && machine->enable_graphics) {Quoted 8 lines
hw/hppa/machine.c static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus, · line 404
Quoted 4 lines
hw/hppa/machine.c +1
-0+ if (defaults_enabled() && !lasi_dev && machine->enable_graphics) { pci_create_simple(pci_bus, -1, "pci-ohci"); usb_create_simple(usb_bus_find(-1), "usb-kbd"); usb_create_simple(usb_bus_find(-1), "usb-mouse");This almost doubles the uses of
default_enabledin the entire tree. I wonder if some of them are redundant or should be using a different test.
Quoted 3 lines
Any proposal?
Maybe introduce a local variablehppa_bare_metal= !defaults_enabled(); and use that instead?
No, not like that.
In casual review I am surprised that !defaults_enabled() does not already imply !enable_graphics, unless the command-line goes on to explicitly add a graphics device.
Am I missing something?
r~
Re: [PATCH v2 4/9] target/hppa: Fix PDC address translation on PA2.0 with PSW.W=0
In reply to Helge DellerQuoted 34 lines · Helge Deller
Quoted 17 lines · Richard Henderson
Quoted 16 lines · On 1/8/24 00:22, [email protected] wrote:
From: Helge Deller <[email protected]>
Fix the address translation for PDC space on PA2.0 if PSW.W=0. Basically, for any address in the 32-bit PDC range from
0xf0000000to0xf1000000keep the lower 32-bits and just set the upper 32-bits to0xfffffff0.This mapping fixes the emulated power button in PDC space for 32- and 64-bit machines and is how the physical C3700 machine seems to map PDC.
Signed-off-by Helge Deller <[email protected]>---
target/hppa/mem_helper.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)Quoted 15 lines
target/hppa/mem_helper.c hwaddr hppa_abs_to_phys_pa2_w0(vaddr addr) · line 62
Quoted 13 lines
target/hppa/mem_helper.c +1
-1@@ -56,7 +56,7 @@ hwaddr hppa_abs_to_phys_pa2_w0(vaddr addr) addr = (int32_t)addr; } else { /* PDC address space */ - addr &= MAKE_64BIT_MASK(0, 24); + addr = (uint32_t)addr; addr |= -1ull << (TARGET_PHYS_ADDR_SPACE_BITS - 4); } return addr;I believe this to be incorrect, as it contradicts Figures H-10 and H-11.
Quoted 4 lines
Yes, but that seems to be how it's really implemented on physical hardware. We have seen other figures as well, which didn't reflect the real world either. IMHO we can revert if it really turns out to be wrong and when we get a better solution.
What evidence? So far, all I can see is for your seabios button, which doesn't run on physical hardware.
In any case, there is a comment just above pointing to the spec, which you are now deviating from. You need to expand that comment to say why and how.
r~
Re: [PATCH v2 4/9] target/hppa: Fix PDC address translation on PA2.0 with PSW.W=0
Quoted 35 lines · Richard Henderson
Quoted 34 lines · Helge Deller
Quoted 32 lines · Richard Henderson
Quoted 21 lines · On 1/8/24 00:22, [email protected] wrote:
From: Helge Deller <[email protected]>
Fix the address translation for PDC space on PA2.0 if PSW.W=0. Basically, for any address in the 32-bit PDC range from
0xf0000000to0xf1000000keep the lower 32-bits and just set the upper 32-bits to0xfffffff0.This mapping fixes the emulated power button in PDC space for 32- and 64-bit machines and is how the physical C3700 machine seems to map PDC.
Signed-off-by Helge Deller <[email protected]>---
target/hppa/mem_helper.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)target/hppa/mem_helper.c +0
-0target/hppa/mem_helper.c hwaddr hppa_abs_to_phys_pa2_w0(vaddr addr) · line 62
Quoted 8 lines
target/hppa/mem_helper.c +1
-1@@ -56,7 +56,7 @@ hwaddr hppa_abs_to_phys_pa2_w0(vaddr addr) addr = (int32_t)addr; } else { /* PDC address space */ - addr &= MAKE_64BIT_MASK(0, 24); + addr = (uint32_t)addr; addr |= -1ull << (TARGET_PHYS_ADDR_SPACE_BITS - 4); } return addr;I believe this to be incorrect, as it contradicts Figures H-10 and H-11.
Quoted 6 lines
Quoted 4 lines
Yes, but that seems to be how it's really implemented on physical hardware. We have seen other figures as well, which didn't reflect the real world either. IMHO we can revert if it really turns out to be wrong and when we get a better solution.
What evidence? So far, all I can see is for your seabios button, which doesn't run on physical hardware.
You are wrong on this.
My Seabios just mimics the real hardware. And the hardware has such a button which is reported back by the PDC firmware.
Here is what the Linux kernel reports on *physical* hardware:
64-bit kernel -> powersw: Soft power switch at 0xfffffff0f0400804 enabled. 32-bit kernel -> powersw: Soft power switch at 0xf0400804 enabled Just look at the old dmesg from another user (with Linux kernel 2.6.16):
http://ftp.parisc-linux.org/dmesg/dmesg_C3700.txt
(search for "power" in that log).
As you can see, even the real C3700 reports the power button inside the firmware region. And on 64-bit the higher 32-bits are at 0xfffffff0. That's exactly what I do with this patch.
Quoted 1 line
In any case, there is a comment just above pointing to the spec, which you are now deviating from. You need to expand that comment to say why and how.
Ok.
Helge
Re: [PATCH v2 4/9] target/hppa: Fix PDC address translation on PA2.0 with PSW.W=0
Quoted 11 lines · Helge Deller
Quoted 1 line
What evidence? So far, all I can see is for your seabios button, which doesn't run on physical hardware.
You are wrong on this.
My Seabios just mimics the real hardware. And the hardware has such a button which is reported back by the PDC firmware.
Here is what the Linux kernel reports on *physical* hardware:
64-bit kernel -> powersw: Soft power switch at0xfffffff0f0400804enabled. 32-bit kernel -> powersw: Soft power switch at0xf0400804enabled Just look at the old dmesg from another user (with Linux kernel 2.6.16):
http://ftp.parisc-linux.org/dmesg/dmesg_C3700.txt
(search for "power" in that log).
Ok, fair enough. I just wish HP had been more accurate in their diagrams. :-)
r~
Re: [PATCH v2 2/9] hw/hppa/machine: Disable default devices with --nodefaults option
In reply to Richard HendersonQuoted 71 lines · Richard Henderson
Quoted 70 lines · Helge Deller
Quoted 68 lines · Richard Henderson
Quoted 56 lines · On 1/8/24 00:22, [email protected] wrote:
From: Helge Deller <[email protected]>
Add support for the qemu --nodefaults option, which will disable the following default devices:
- 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 <[email protected]>---
hw/hppa/machine.c| 15 +++++++++------1 file changed, 9 insertions(+), 6 deletions(-)hw/hppa/machine.c +7
-4@@ -346,11 +346,14 @@ 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 (defaults_enabled()) { + 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) { + if (defaults_enabled() && machine->enable_graphics && + vga_interface_type != VGA_NONE) { vga_interface_created = true; dev = qdev_new("artist"); s = SYS_BUS_DEVICE(dev);@@ -360,7 +363,7 @@ static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus, } /* Network setup. */ - if (enable_lasi_lan()) { + if (defaults_enabled() && 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 +388,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 (defaults_enabled()&& !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));hw/hppa/machine.c static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus, · line 403
Quoted 7 lines
hw/hppa/machine.c +1
-1@@ -395,7 +398,7 @@ static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus, } /* create USB OHCI controller for USB keyboard & mouse on Astro machines */ - if (!lasi_dev && machine->enable_graphics) { + if (defaults_enabled() && !lasi_dev && machine->enable_graphics) { pci_create_simple(pci_bus, -1, "pci-ohci"); usb_create_simple(usb_bus_find(-1), "usb-kbd"); usb_create_simple(usb_bus_find(-1), "usb-mouse");This almost doubles the uses of
default_enabledin the entire tree. I wonder if some of them are redundant or should be using a different test.
Quoted 5 lines
Quoted 3 lines
Any proposal?
Maybe introduce a local variablehppa_bare_metal= !defaults_enabled(); and use that instead?No, not like that.
Ok.
Quoted 4 lines
In casual review I am surprised that !defaults_enabled() does not already imply !enable_graphics, unless the command-line goes on to explicitly add a graphics device.
Am I missing something?
Will check that tommorow. If it does I'll remove that additional check.
But what other do you suggest in general how I should address your concerns here?
Helge
Re: [PATCH v2 2/9] hw/hppa/machine: Disable default devices with --nodefaults option
Quoted 89 lines · Helge Deller
Quoted 75 lines · Richard Henderson
Quoted 74 lines · Helge Deller
Quoted 72 lines · Richard Henderson
Quoted 59 lines · On 1/8/24 00:22, [email protected] wrote:
From: Helge Deller <[email protected]>
Add support for the qemu --nodefaults option, which will disable the following default devices:
- 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 <[email protected]>---
hw/hppa/machine.c| 15 +++++++++------1 file changed, 9 insertions(+), 6 deletions(-)hw/hppa/machine.c +7
-4@@ -346,11 +346,14 @@ static voidmachine_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 (defaults_enabled()) { + 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) { + if (defaults_enabled() && machine->enable_graphics && + vga_interface_type != VGA_NONE) { vga_interface_created = true; dev = qdev_new("artist"); s = SYS_BUS_DEVICE(dev);@@ -360,7 +363,7 @@ static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus, } /* Network setup. */ - if (enable_lasi_lan()) { + if (defaults_enabled() && 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 +388,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 (defaults_enabled()&& !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));hw/hppa/machine.c static void · line 404
Quoted 8 lines
hw/hppa/machine.c +1
-1@@ -395,7 +398,7 @@ static voidmachine_HP_common_init_tail (MachineState *machine, PCIBus *pci_bus, } /* create USB OHCI controller for USB keyboard & mouse on Astro machines */ - if (!lasi_dev && machine->enable_graphics) { + if (defaults_enabled() && !lasi_dev && machine->enable_graphics) { pci_create_simple(pci_bus, -1, "pci-ohci"); usb_create_simple(usb_bus_find(-1), "usb-kbd"); usb_create_simple(usb_bus_find(-1), "usb-mouse");This almost doubles the uses of
default_enabledin the entire tree. I wonder if some of them are redundant or should be using a different test.Quoted 5 lines
Quoted 3 lines
Any proposal?
Maybe introduce a local variablehppa_bare_metal= !defaults_enabled(); and use that instead?No, not like that.
Ok.
Quoted 4 lines
In casual review I am surprised that !defaults_enabled() does not already imply !enable_graphics, unless the command-line goes on to explicitly add a graphics device.
Am I missing something?
Quoted 4 lines
Will check that tommorow. If it does I'll remove that additional check.
But what other do you suggest in general how I should address your concerns here?
IIRC enable_graphics is not influenced by --nodefaults, but it should be possible to simply check vga_interface_type only - that should get set to VGA_NONE when the user started QEMU with --nodefaults.
For networking, other boards normally check nd_table[0]. And for serial, you can check whether serial_hd(0) returns a non-NULL value.
For checking whether you have to create SCSI devices by default, you can check drive_get_max_bus(IF_SCSI), I think.
HTH,
Thomas
Re: [PATCH v2 2/9] hw/hppa/machine: Disable default devices with --nodefaults option
Quoted 88 lines · Thomas Huth
Quoted 87 lines · Helge Deller
Quoted 71 lines · Richard Henderson
Quoted 70 lines · Helge Deller
Quoted 68 lines · Richard Henderson
Quoted 56 lines · On 1/8/24 00:22, [email protected] wrote:
From: Helge Deller <[email protected]>
Add support for the qemu --nodefaults option, which will disable the following default devices:
- 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 <[email protected]>---
hw/hppa/machine.c| 15 +++++++++------1 file changed, 9 insertions(+), 6 deletions(-)hw/hppa/machine.c +7
-4@@ -346,11 +346,14 @@ 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 (defaults_enabled()) { + 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) { + if (defaults_enabled() && machine->enable_graphics && + vga_interface_type != VGA_NONE) { vga_interface_created = true; dev = qdev_new("artist"); s = SYS_BUS_DEVICE(dev);@@ -360,7 +363,7 @@ static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus, } /* Network setup. */ - if (enable_lasi_lan()) { + if (defaults_enabled() && 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 +388,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 (defaults_enabled()&& !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));hw/hppa/machine.c static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus, · line 403
Quoted 7 lines
hw/hppa/machine.c +1
-1@@ -395,7 +398,7 @@ static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus, } /* create USB OHCI controller for USB keyboard & mouse on Astro machines */ - if (!lasi_dev && machine->enable_graphics) { + if (defaults_enabled() && !lasi_dev && machine->enable_graphics) { pci_create_simple(pci_bus, -1, "pci-ohci"); usb_create_simple(usb_bus_find(-1), "usb-kbd"); usb_create_simple(usb_bus_find(-1), "usb-mouse");This almost doubles the uses of
default_enabledin the entire tree. I wonder if some of them are redundant or should be using a different test.Quoted 5 lines
Quoted 3 lines
Any proposal?
Maybe introduce a local variablehppa_bare_metal= !defaults_enabled(); and use that instead?No, not like that.
Ok.
Quoted 4 lines
In casual review I am surprised that !defaults_enabled() does not already imply !enable_graphics, unless the command-line goes on to explicitly add a graphics device.
Am I missing something?Will check that tommorow. If it does I'll remove that additional check.
Quoted 8 lines
Quoted 2 lines
But what other do you suggest in general how I should address your concerns here?
IIRC
enable_graphicsis not influenced by --nodefaults, but it should be possible to simply checkvga_interface_typeonly - that should get set toVGA_NONEwhen the user started QEMU with --nodefaults.For networking, other boards normally check nd_table[0]. And for serial, you can check whether
serial_hd(0)returns a non-NULL value.For checking whether you have to create SCSI devices by default, you can check
drive_get_max_bus(IF_SCSI), I think.
Thanks a lot!
Those hints really helped me to avoid usage of defaults_enabled().
Helge