@@ -508,6 +508,15 @@ void create_virtio_devices(const ArmMachineState *ams)
}
}
+void *machvirt_dtb(const struct arm_boot_info *binfo, int *fdt_size)
+{
+ const ArmMachineState *board = container_of(binfo, ArmMachineState,
+ bootinfo);
+
+ *fdt_size = board->fdt_size;
+ return board->fdt;
+}
+
static char *virt_get_gic_version(Object *obj, Error **errp)
{
ArmMachineState *ams = ARM_MACHINE(obj);
@@ -971,16 +971,6 @@ static void create_secure_ram(VirtMachineState *vms,
g_free(nodename);
}
-static void *machvirt_dtb(const struct arm_boot_info *binfo, int *fdt_size)
-{
- const VirtMachineState *vms = container_of(binfo, VirtMachineState,
- bootinfo);
-
- ArmMachineState *board = ARM_MACHINE(vms);
- *fdt_size = board->fdt_size;
- return board->fdt;
-}
-
static void virt_build_smbios(VirtMachineState *vms)
{
MachineClass *mc = MACHINE_GET_CLASS(vms);
@@ -1016,7 +1006,7 @@ void virt_machine_done(Notifier *notifier, void *data)
MachineState *ms = MACHINE(vms);
ArmMachineState *ams = ARM_MACHINE(vms);
ARMCPU *cpu = ARM_CPU(first_cpu);
- struct arm_boot_info *info = &vms->bootinfo;
+ struct arm_boot_info *info = &ams->bootinfo;
AddressSpace *as = arm_boot_address_space(cpu, info);
/*
@@ -1373,14 +1363,14 @@ static void machvirt_init(MachineState *machine)
create_platform_bus(vms);
- vms->bootinfo.ram_size = machine->ram_size;
- vms->bootinfo.nb_cpus = smp_cpus;
- vms->bootinfo.board_id = -1;
- vms->bootinfo.loader_start = ams->memmap[VIRT_MEM].base;
- vms->bootinfo.get_dtb = machvirt_dtb;
- vms->bootinfo.skip_dtb_autoload = true;
- vms->bootinfo.firmware_loaded = firmware_loaded;
- arm_load_kernel(ARM_CPU(first_cpu), machine, &vms->bootinfo);
+ ams->bootinfo.ram_size = machine->ram_size;
+ ams->bootinfo.nb_cpus = smp_cpus;
+ ams->bootinfo.board_id = -1;
+ ams->bootinfo.loader_start = ams->memmap[VIRT_MEM].base;
+ ams->bootinfo.get_dtb = machvirt_dtb;
+ ams->bootinfo.skip_dtb_autoload = true;
+ ams->bootinfo.firmware_loaded = firmware_loaded;
+ arm_load_kernel(ARM_CPU(first_cpu), machine, &ams->bootinfo);
vms->machine_done.notify = virt_machine_done;
qemu_add_machine_init_done_notifier(&vms->machine_done);
@@ -92,6 +92,7 @@ typedef struct {
typedef struct {
MachineState parent;
int32_t gic_version;
+ struct arm_boot_info bootinfo;
MemMapEntry *memmap;
const int *irqmap;
int smp_cpus;
@@ -130,6 +131,8 @@ void create_rtc(const ArmMachineState *ams);
void create_virtio_devices(const ArmMachineState *ams);
+void *machvirt_dtb(const struct arm_boot_info *binfo, int *fdt_size);
+
/* Return the number of used redistributor regions */
static inline int virt_gicv3_redist_region_count(ArmMachineState *ams)
{
@@ -68,7 +68,6 @@ typedef struct {
bool its;
bool virt;
VirtIOMMUType iommu;
- struct arm_boot_info bootinfo;
uint32_t msi_phandle;
uint32_t iommu_phandle;
hwaddr highest_gpa;
Move bootinfo member from VirtMachineState to ArmMachineState. Signed-off-by: Xu Yandong <xuyandong2@huawei.com> --- hw/arm/arm.c | 9 +++++++++ hw/arm/virt.c | 28 +++++++++------------------- include/hw/arm/arm.h | 3 +++ include/hw/arm/virt.h | 1 - 4 files changed, 21 insertions(+), 20 deletions(-)