hw/hppa: Clarify machine variables and move them out of CPUArchState
v2 cover hw/hppa: Clarify machine variables and move them out of CPUArchState
Since v1:
- Simplified (rth)
The HPPA machines uses a pair of variables for distinct meanings, depending on kernel or firmware mode used. Replace by variables per mode, allowing to use the proper type. This helps reviewing the code. This cleanup allows removing unjustified target_ulong uses.
Philippe Mathieu-Daudé (6):
hw/hppa: Convert type_init() -> DEFINE_TYPES()
hw/hppa: Factor QOM HPPA_COMMON_MACHINE out
hw/hppa: Reduce variables scope in common_init() hw/hppa: Move CPU::kernel_entry -> Machine::boot_info.gr25 hw/hppa: Move CPU::cmdline_or_bootorder -> Machine::boot_info.gr24 hw/hppa: Move CPU::initrd_base/end -> Machine::boot_info.gr22/23
target/hppa/cpu.h | 4 -- hw/hppa/machine.c | 152 ++++++++++++++++++++++++---------------------- 2 files changed, 79 insertions(+), 77 deletions(-)
Signature · 1 line
2.51.0
PATCH v2 1/6 hw/hppa: Convert type_init() -> DEFINE_TYPES()
Prefer DEFINE_TYPES() macro over type_init() to register multiple QOM types.
--- hw/hppa/machine.c | 42 ++++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 24 deletions(-)
hw/hppa/machine.c +18 -24
@@ -709,16 +709,6 @@ static void HP_B160L_machine_init_class_init(ObjectClass *oc, const void *data) nc->nmi_monitor_handler = hppa_nmi; } -static const TypeInfo HP_B160L_machine_init_typeinfo = { - .name =MACHINE_TYPE_NAME ("B160L" ), - .parent =TYPE_MACHINE , - .class_init = HP_B160L_machine_init_class_init, - .interfaces = (const InterfaceInfo []) { - {TYPE_NMI }, - { } - }, -}; -static void HP_C3700_machine_init_class_init (ObjectClass *oc,const void *data) {static const char *const valid_cpu_types[] = {
@@ -745,20 +735,24 @@ static void HP_C3700_machine_init_class_init(ObjectClass *oc, const void *data) nc->nmi_monitor_handler = hppa_nmi; } -static const TypeInfo HP_C3700_machine_init_typeinfo = { - .name =MACHINE_TYPE_NAME ("C3700" ), - .parent =TYPE_MACHINE , - .class_init = HP_C3700_machine_init_class_init, - .interfaces = (const InterfaceInfo []) { - {TYPE_NMI }, - { } +static const TypeInfo hppa_machine_types[] = { + { + .name =MACHINE_TYPE_NAME ("B160L" ), + .parent =TYPE_MACHINE , + .class_init = HP_B160L_machine_init_class_init, + .interfaces = (const InterfaceInfo []) { + {TYPE_NMI }, + { } + }, + }, { + .name =MACHINE_TYPE_NAME ("C3700" ), + .parent =TYPE_MACHINE , + .class_init = HP_C3700_machine_init_class_init, + .interfaces = (const InterfaceInfo []) { + {TYPE_NMI }, + { } + }, }, }; -static void hppa_machine_init_register_types (void ) -{ -type_register_static (&HP_B160L_machine_init_typeinfo); -type_register_static (&HP_C3700_machine_init_typeinfo); -} - -type_init (hppa_machine_init_register_types) +DEFINE_TYPES (hppa_machine_types)
Signature · 1 line
2.51.0
PATCH v2 2/6 hw/hppa: Factor QOM HPPA_COMMON_MACHINE out
In reply to Philippe Mathieu-DaudéB160L and C3700 share a lot of common code. Factor it out as an abstract HPPA_COMMON_MACHINE QOM parent.
--- hw/hppa/machine.c | 61 +++++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 28 deletions(-)
hw/hppa/machine.c +33 -28
@@ -36,6 +36,13 @@#include "net/net.h" #include "qemu/log.h" +#define TYPE_HPPA_COMMON_MACHINE MACHINE_TYPE_NAME("hppa-common") +OBJECT_DECLARE_SIMPLE_TYPE(HppaMachineState, HPPA_COMMON_MACHINE) + +struct HppaMachineState { +MachineState parent_obj; +}; +#define MIN_SEABIOS_HPPA_VERSION 12/* require at least this fw version */ #define HPA_POWER_BUTTON (FIRMWARE_END - 0x10)
@@ -683,6 +690,22 @@ static void hppa_nmi(NMIState *n, int cpu_index, Error **errp) } } +static void hppa_machine_common_class_init (ObjectClass *oc,const void *data) +{ +MachineClass *mc =MACHINE_CLASS (oc); +NMIClass *nc =NMI_CLASS (oc); + + mc->reset = hppa_machine_reset; + mc->block_default_type =IF_SCSI ; + mc->default_cpus =1 ; + mc->max_cpus =HPPA_MAX_CPUS ; + mc->default_boot_order ="cd" ; + mc->default_ram_id ="ram" ; + mc->default_nic ="tulip" ; + + nc->nmi_monitor_handler = hppa_nmi; +} +static void HP_B160L_machine_init_class_init (ObjectClass *oc,const void *data) {static const char *const valid_cpu_types[] = {
@@ -690,23 +713,13 @@ static void HP_B160L_machine_init_class_init(ObjectClass *oc, const void *data) NULL };MachineClass *mc =MACHINE_CLASS (oc); -NMIClass *nc =NMI_CLASS (oc); mc->desc ="HP B160L workstation" ; mc->default_cpu_type =TYPE_HPPA_CPU ; mc->valid_cpu_types = valid_cpu_types; mc->init = machine_HP_B160L_init; - mc->reset = hppa_machine_reset; - mc->block_default_type =IF_SCSI ; - mc->max_cpus =HPPA_MAX_CPUS ; - mc->default_cpus =1 ; mc->is_default = true; mc->default_ram_size =512 * MiB; - mc->default_boot_order ="cd" ; - mc->default_ram_id ="ram" ; - mc->default_nic ="tulip" ; - - nc->nmi_monitor_handler = hppa_nmi; }static void HP_C3700_machine_init_class_init (ObjectClass *oc,const void *data)
@@ -716,42 +729,34 @@ static void HP_C3700_machine_init_class_init(ObjectClass *oc, const void *data) NULL };MachineClass *mc =MACHINE_CLASS (oc); -NMIClass *nc =NMI_CLASS (oc); mc->desc ="HP C3700 workstation" ; mc->default_cpu_type =TYPE_HPPA64_CPU ; mc->valid_cpu_types = valid_cpu_types; mc->init = machine_HP_C3700_init; - mc->reset = hppa_machine_reset; - mc->block_default_type =IF_SCSI ; mc->max_cpus =HPPA_MAX_CPUS ; - mc->default_cpus =1 ; - mc->is_default = false; mc->default_ram_size =1024 * MiB; - mc->default_boot_order ="cd" ; - mc->default_ram_id ="ram" ; - mc->default_nic ="tulip" ; - - nc->nmi_monitor_handler = hppa_nmi; }static const TypeInfo hppa_machine_types[] = { { - .name =MACHINE_TYPE_NAME ("B160L" ), - .parent =TYPE_MACHINE , - .class_init = HP_B160L_machine_init_class_init, + .name =TYPE_HPPA_COMMON_MACHINE , + .parent =TYPE_MACHINE , + .instance_size =sizeof (HppaMachineState), + .class_init = hppa_machine_common_class_init, + .abstract = true, .interfaces = (const InterfaceInfo []) { {TYPE_NMI }, { } }, + }, { + .name =MACHINE_TYPE_NAME ("B160L" ), + .parent =TYPE_HPPA_COMMON_MACHINE , + .class_init = HP_B160L_machine_init_class_init, }, { .name =MACHINE_TYPE_NAME ("C3700" ), - .parent =TYPE_MACHINE , + .parent =TYPE_HPPA_COMMON_MACHINE , .class_init = HP_C3700_machine_init_class_init, - .interfaces = (const InterfaceInfo []) { - {TYPE_NMI }, - { } - }, }, };
Signature · 1 line
2.51.0
PATCH v2 3/6 hw/hppa: Reduce variables scope in common_init()
In reply to Philippe Mathieu-Daudé--- hw/hppa/machine.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
hw/hppa/machine.c +9 -6
@@ -352,16 +352,11 @@ static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus, TranslateFn *translate) {const char *kernel_filename = machine->kernel_filename; -const char *kernel_cmdline = machine->kernel_cmdline; -const char *initrd_filename = machine->initrd_filename; -const char *firmware = machine->firmware;MachineClass *mc =MACHINE_GET_CLASS (machine);DeviceState *dev;PCIDevice *pci_dev; -char *firmware_filename; -uint64_t firmware_low, firmware_high;long size; -uint64_t kernel_entry =0 , kernel_low, kernel_high; +uint64_t kernel_entry =0 ;MemoryRegion *addr_space =get_system_memory ();MemoryRegion *rom_region;SysBusDevice *s;
@@ -431,6 +426,10 @@ static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus,firmware on 64-bit machines by default if not specified on command line. */ if (!qtest_enabled ()) { +const char *firmware = machine->firmware; +uint64_t firmware_low, firmware_high; +char *firmware_filename; +if (!firmware) { firmware = lasi_dev ?"hppa-firmware.img" :"hppa-firmware64.img" ; }
@@ -467,6 +466,10 @@ static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus,/* Load kernel */ if (kernel_filename) { +const char *kernel_cmdline = machine->kernel_cmdline; +const char *initrd_filename = machine->initrd_filename; +uint64_t kernel_low, kernel_high; + size =load_elf (kernel_filename,NULL , linux_kernel_virt_to_phys,NULL , &kernel_entry, &kernel_low, &kernel_high,NULL ,ELFDATA2MSB ,EM_PARISC ,0 ,0 );
Signature · 1 line
2.51.0
Re: [PATCH v2 3/6] hw/hppa: Reduce variables scope in common_init()
Quoted 4 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/hppa/machine.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
r~
PATCH v2 4/6 hw/hppa: Move CPU::kernel_entry -> Machine::boot_info.gr25
In reply to Philippe Mathieu-DaudéCurrent code uses CPUHPPAState::@kernel_entry to hold either:
- kernel entry virtual address
- firmware interactive mode
and CPUHPPAState::@cmdline_or_bootorder to either:
- kernel &cmdline physical address
- firmware boot order
Besides, these variables don't belong to CPUHPPAState, they depend on how the machine is started, and only apply to the first CPU.
The MachineReset handler initialize some registers of the first CPU. Hold these register reset values in the MachineState, initializing them once in machine_HP_common_init_tail().
Start by addressing the kernel entry and firmware interactive mode values, stored in $GP25.
--- target/hppa/cpu.h | 1 - hw/hppa/machine.c | 28 ++++++++++++++++------------ 2 files changed, 16 insertions(+), 13 deletions(-)
target/hppa/cpu.h +0 -1
@@ -272,7 +272,6 @@ typedef struct CPUArchState {bool is_pa20; -target_ulong kernel_entry;/* Linux kernel was loaded here */ target_ulong cmdline_or_bootorder;target_ulong initrd_base, initrd_end; } CPUHPPAState;
hw/hppa/machine.c +16 -12
@@ -41,6 +41,10 @@ OBJECT_DECLARE_SIMPLE_TYPE(HppaMachineState, HPPA_COMMON_MACHINE)struct HppaMachineState {MachineState parent_obj; + +struct { +uint64_t gr25; + } boot_info; };#define MIN_SEABIOS_HPPA_VERSION 12/* require at least this fw version */
@@ -353,10 +357,10 @@ static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus, {const char *kernel_filename = machine->kernel_filename;MachineClass *mc =MACHINE_GET_CLASS (machine); +HppaMachineState *hms =HPPA_COMMON_MACHINE (machine);DeviceState *dev;PCIDevice *pci_dev;long size; -uint64_t kernel_entry =0 ;MemoryRegion *addr_space =get_system_memory ();MemoryRegion *rom_region;SysBusDevice *s;
@@ -468,7 +472,7 @@ static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus,if (kernel_filename) {const char *kernel_cmdline = machine->kernel_cmdline;const char *initrd_filename = machine->initrd_filename; -uint64_t kernel_low, kernel_high; +uint64_t kernel_entry, kernel_low, kernel_high; size = load_elf(kernel_filename, NULL, linux_kernel_virt_to_phys, NULL, &kernel_entry, &kernel_low, &kernel_high, NULL,
@@ -484,6 +488,8 @@ static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus,"-0x%08" PRIx64", entry at 0x%08" PRIx64", size %" PRIu64" kB\n" , kernel_low, kernel_high, kernel_entry, size / KiB); +/* Keep initial kernel_entry for first boot */ + hms->boot_info.gr25 = kernel_entry;if (kernel_cmdline) { cpu[0 ]->env.cmdline_or_bootorder =0x4000 ;
@@ -520,19 +526,16 @@ static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus, cpu[0 ]->env.initrd_base = initrd_base; cpu[0 ]->env.initrd_end = initrd_base + initrd_size; } - } - -if (!kernel_entry) { + }else {/* When booting via firmware, tell firmware if we want interactive -* mode (kernel_entry=1), and to boot from CD (cmdline_or_bootorder='d') +* mode (interactive_mode=1), and to boot from CD (cmdline_or_bootorder='d') * or hard disc (cmdline_or_bootorder='c'). */ - kernel_entry = machine->boot_config.has_menu ? machine->boot_config.menu :0 ; + hms->boot_info.gr25 = machine->boot_config.has_menu + ? machine->boot_config.menu + :0 ; cpu[0 ]->env.cmdline_or_bootorder = machine->boot_config.order[0 ]; } - -/* Keep initial kernel_entry for first boot */ - cpu[0 ]->env.kernel_entry = kernel_entry; }/*
@@ -650,6 +653,7 @@ static void machine_HP_C3700_init(MachineState *machine)static void hppa_machine_reset (MachineState *ms,ResetType type) { +HppaMachineState *hms =HPPA_COMMON_MACHINE (ms);unsigned int smp_cpus = ms->smp.cpus;int i;
@@ -670,7 +674,7 @@ static void hppa_machine_reset(MachineState *ms, ResetType type) } cpu[0 ]->env.gr[26 ] = ms->ram_size; - cpu[0 ]->env.gr[25 ] = cpu[0 ]->env.kernel_entry; + cpu[0 ]->env.gr[25 ] = hms->boot_info.gr25; cpu[0 ]->env.gr[24 ] = cpu[0 ]->env.cmdline_or_bootorder; cpu[0 ]->env.gr[23 ] = cpu[0 ]->env.initrd_base; cpu[0 ]->env.gr[22 ] = cpu[0 ]->env.initrd_end;
@@ -678,7 +682,7 @@ static void hppa_machine_reset(MachineState *ms, ResetType type) cpu[0 ]->env.gr[19 ] =FW_CFG_IO_BASE ;/* reset static fields to avoid starting Linux kernel & initrd on reboot */ - cpu[0 ]->env.kernel_entry =0 ; +memset (&hms->boot_info,0 ,sizeof (hms->boot_info)); cpu[0 ]->env.initrd_base =0 ; cpu[0 ]->env.initrd_end =0 ; cpu[0 ]->env.cmdline_or_bootorder ='c' ;
Signature · 1 line
2.51.0
Re: [PATCH v2 4/6] hw/hppa: Move CPU::kernel_entry -> Machine::boot_info.gr25
Quoted 18 lines · Philippe Mathieu-Daudé
Current code uses CPUHPPAState::@kernel_entry to hold either:
- kernel entry virtual address
- firmware interactive mode
and CPUHPPAState::@cmdline_or_bootorder to either:
- kernel &cmdline physical address
- firmware boot orderBesides, these variables don't belong to CPUHPPAState, they depend on how the machine is started, and only apply to the first CPU.
The MachineReset handler initialize some registers of the first CPU. Hold these register reset values in the MachineState, initializing them once in
machine_HP_common_init_tail().Start by addressing the kernel entry and firmware interactive mode values, stored in $GP25.
Quoted 6 lines
Suggested-by Richard Henderson <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/hppa/cpu.h | 1 - hw/hppa/machine.c | 28 ++++++++++++++++------------ 2 files changed, 16 insertions(+), 13 deletions(-)
hw/hppa/machine.c static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus, · line 536
Quoted 13 lines
hw/hppa/machine.c +5
-5- } - -if (!kernel_entry) { + }else {/* When booting via firmware, tell firmware if we want interactive -* mode (kernel_entry=1), and to boot from CD (cmdline_or_bootorder='d') +* mode (interactive_mode=1), and to boot from CD (cmdline_or_bootorder='d') * or hard disc (cmdline_or_bootorder='c'). */ - kernel_entry = machine->boot_config.has_menu ? machine->boot_config.menu :0 ; + hms->boot_info.gr25 = machine->boot_config.has_menu + ? machine->boot_config.menu + :0 ;
There is no interactive_mode variable, so the change to the comment isn't great. Perhaps just mention gr25.
As an aside, the expression involves two booleans, so better written as
machine->boot_config.has_menu && machine->boot_config.menu
r~
PATCH v2 5/6 hw/hppa: Move CPU::cmdline_or_bootorder -> Machine::boot_info.gr24
In reply to Philippe Mathieu-DaudéCurrent code uses CPUHPPAState::@cmdline_or_bootorder to hold either:
- kernel &cmdline physical address
- firmware boot order
Besides, these variables don't belong to CPUHPPAState, they depend on how the machine is started, and only apply to the first CPU.
Initialize the register value the reset handler needs ($GP24) once in machine_HP_common_init_tail().
--- target/hppa/cpu.h | 1 - hw/hppa/machine.c | 14 +++++++------- 2 files changed, 7 insertions(+), 8 deletions(-)
target/hppa/cpu.h +0 -1
@@ -272,7 +272,6 @@ typedef struct CPUArchState {bool is_pa20; -target_ulong cmdline_or_bootorder;target_ulong initrd_base, initrd_end; } CPUHPPAState;
hw/hppa/machine.c +7 -7
@@ -43,6 +43,7 @@ struct HppaMachineState {MachineState parent_obj;struct { +uint64_t gr24;uint64_t gr25; } boot_info; };
@@ -492,8 +493,8 @@ static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus, hms->boot_info.gr25 = kernel_entry;if (kernel_cmdline) { - cpu[0 ]->env.cmdline_or_bootorder =0x4000 ; -pstrcpy_targphys ("cmdline" , cpu[0 ]->env.cmdline_or_bootorder, + hms->boot_info.gr24 =0x4000 ; +pstrcpy_targphys ("cmdline" , hms->boot_info.gr24,TARGET_PAGE_SIZE , kernel_cmdline); }
@@ -528,13 +529,13 @@ static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus, } }else {/* When booting via firmware, tell firmware if we want interactive -* mode (interactive_mode=1), and to boot from CD (cmdline_or_bootorder='d') -* or hard disc (cmdline_or_bootorder='c'). +* mode (interactive_mode=1), and to boot from CD (bootorder='d') +* or hard disc (bootorder='c'). */ hms->boot_info.gr25 = machine->boot_config.has_menu ? machine->boot_config.menu :0 ; - cpu[0 ]->env.cmdline_or_bootorder = machine->boot_config.order[0 ]; + hms->boot_info.gr24 = machine->boot_config.order[0 ]; } }
@@ -675,7 +676,7 @@ static void hppa_machine_reset(MachineState *ms, ResetType type) cpu[0 ]->env.gr[26 ] = ms->ram_size; cpu[0 ]->env.gr[25 ] = hms->boot_info.gr25; - cpu[0 ]->env.gr[24 ] = cpu[0 ]->env.cmdline_or_bootorder; + cpu[0 ]->env.gr[24 ] = hms->boot_info.gr24; cpu[0 ]->env.gr[23 ] = cpu[0 ]->env.initrd_base; cpu[0 ]->env.gr[22 ] = cpu[0 ]->env.initrd_end; cpu[0 ]->env.gr[21 ] = smp_cpus;
@@ -685,7 +686,6 @@ static void hppa_machine_reset(MachineState *ms, ResetType type)memset (&hms->boot_info,0 ,sizeof (hms->boot_info)); cpu[0 ]->env.initrd_base =0 ; cpu[0 ]->env.initrd_end =0 ; - cpu[0 ]->env.cmdline_or_bootorder ='c' ; }static void hppa_nmi (NMIState *n,int cpu_index,Error **errp)
Signature · 1 line
2.51.0
Re: [PATCH v2 5/6] hw/hppa: Move CPU::cmdline_or_bootorder -> Machine::boot_info.gr24
hw/hppa/machine.c static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus, · line 534
Quoted 7 lines · Philippe Mathieu-Daudé
} else { /* When booting via firmware, tell firmware if we want interactivehw/hppa/machine.c +2
-2-* mode (interactive_mode=1), and to boot from CD (cmdline_or_bootorder='d') -* or hard disc (cmdline_or_bootorder='c'). +* mode (interactive_mode=1), and to boot from CD (bootorder='d') +* or hard disc (bootorder='c'). */
Again there is no bootorder variable, so gr24 might be better.
hw/hppa/machine.c static void hppa_machine_reset(MachineState *ms, ResetType type) · line 689
Quoted 6 lines
hw/hppa/machine.c +0
-1@@ -685,7 +686,6 @@ static void hppa_machine_reset(MachineState *ms, ResetType type)memset (&hms->boot_info,0 ,sizeof (hms->boot_info)); cpu[0 ]->env.initrd_base =0 ; cpu[0 ]->env.initrd_end =0 ; - cpu[0 ]->env.cmdline_or_bootorder ='c' ; }
You need to retain this store, but adjust to boot_info.gr24.
r~
PATCH v2 6/6 hw/hppa: Move CPU::initrd_base/end -> Machine::boot_info.gr22/23
In reply to Philippe Mathieu-DaudéThese variables don't belong to CPUHPPAState, they depend on how the machine is started, and only apply to the first CPU.
--- target/hppa/cpu.h | 2 -- hw/hppa/machine.c | 12 ++++++------ 2 files changed, 6 insertions(+), 8 deletions(-)
target/hppa/cpu.h +0 -2
@@ -271,8 +271,6 @@ typedef struct CPUArchState {struct {} end_reset_fields;bool is_pa20; - -target_ulong initrd_base, initrd_end; } CPUHPPAState;/**
hw/hppa/machine.c +6 -6
@@ -43,6 +43,8 @@ struct HppaMachineState {MachineState parent_obj;struct { +uint64_t gr22; +uint64_t gr23;uint64_t gr24;uint64_t gr25; } boot_info;
@@ -524,8 +526,8 @@ static void machine_HP_common_init_tail(MachineState *machine, PCIBus *pci_bus, }load_image_targphys (initrd_filename, initrd_base, initrd_size); - cpu[0 ]->env.initrd_base = initrd_base; - cpu[0 ]->env.initrd_end = initrd_base + initrd_size; + hms->boot_info.gr23 = initrd_base; + hms->boot_info.gr22 = initrd_base + initrd_size; } }else {/* When booting via firmware, tell firmware if we want interactive
@@ -677,15 +679,13 @@ static void hppa_machine_reset(MachineState *ms, ResetType type) cpu[0 ]->env.gr[26 ] = ms->ram_size; cpu[0 ]->env.gr[25 ] = hms->boot_info.gr25; cpu[0 ]->env.gr[24 ] = hms->boot_info.gr24; - cpu[0 ]->env.gr[23 ] = cpu[0 ]->env.initrd_base; - cpu[0 ]->env.gr[22 ] = cpu[0 ]->env.initrd_end; + cpu[0 ]->env.gr[23 ] = hms->boot_info.gr23; + cpu[0 ]->env.gr[22 ] = hms->boot_info.gr22; cpu[0 ]->env.gr[21 ] = smp_cpus; cpu[0 ]->env.gr[19 ] =FW_CFG_IO_BASE ;/* reset static fields to avoid starting Linux kernel & initrd on reboot */ memset (&hms->boot_info,0 ,sizeof (hms->boot_info)); - cpu[0 ]->env.initrd_base =0 ; - cpu[0 ]->env.initrd_end =0 ; }static void hppa_nmi (NMIState *n,int cpu_index,Error **errp)
Signature · 1 line
2.51.0
Re: [PATCH v2 6/6] hw/hppa: Move CPU::initrd_base/end -> Machine::boot_info.gr22/23
Quoted 8 lines · Philippe Mathieu-Daudé
These variables don't belong to CPUHPPAState, they depend on how the machine is started, and only apply to the first CPU.
Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- target/hppa/cpu.h | 2 -- hw/hppa/machine.c | 12 ++++++------ 2 files changed, 6 insertions(+), 8 deletions(-)
r~