qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 31/33] hw/nios2: Introduce Nios2MachineState


From: Richard Henderson
Subject: Re: [PATCH v4 31/33] hw/nios2: Introduce Nios2MachineState
Date: Tue, 8 Mar 2022 09:55:00 -1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0

On 3/7/22 22:39, Mark Cave-Ayland wrote:
  static void nios2_10m50_ghrd_init(MachineState *machine)
  {
+    Nios2MachineState *nms = NIOS2_MACHINE(machine);
      Nios2CPU *cpu;
      DeviceState *dev;
      MemoryRegion *address_space_mem = get_system_memory();
@@ -101,15 +109,29 @@ static void nios2_10m50_ghrd_init(MachineState *machine)
      cpu->exception_addr = 0xc8000120;
      cpu->fast_tlb_miss_addr = 0xc0000100;
-    nios2_load_kernel(cpu, ram_base, ram_size, machine->initrd_filename,
+    nios2_load_kernel(cpu, ram_base, ram_size, nms->parent_obj.initrd_filename,
                        BINARY_DEVICE_TREE_FILE, NULL);

I think you should be able to keep this as machine->initrd_filename? Certainly there should be no direct access to parent_obj here, and if you did need it a QOM cast macro would be the way to do this.

Ok.

+static const TypeInfo nios2_10m50_ghrd_type_info = {
+    .name          = TYPE_NIOS2_MACHINE,
+    .parent        = TYPE_MACHINE,
+    .instance_size = sizeof(Nios2MachineState),
+    .class_size    = sizeof(MachineClass),

Technically you can drop .class_size here since this should be inherited automatically from MachineClass.

Ok.  This is a leftover from an intermediate when Nios2MachineClass existed.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]