[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH RFC 14/16] hw/arm: move shared bootinfo member to ArmMachine
From: |
Xu Yandong |
Subject: |
[PATCH RFC 14/16] hw/arm: move shared bootinfo member to ArmMachine |
Date: |
Mon, 17 Feb 2020 02:51:26 -0500 |
Move bootinfo member from VirtMachineState to ArmMachineState.
Signed-off-by: Xu Yandong <address@hidden>
---
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(-)
diff --git a/hw/arm/arm.c b/hw/arm/arm.c
index 4bffee0f37..7d880dd8e7 100644
--- a/hw/arm/arm.c
+++ b/hw/arm/arm.c
@@ -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);
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 11e753906b..2f498ea687 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -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);
diff --git a/include/hw/arm/arm.h b/include/hw/arm/arm.h
index 743a90ba36..372f4dea28 100644
--- a/include/hw/arm/arm.h
+++ b/include/hw/arm/arm.h
@@ -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)
{
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
index 086a27682f..8276e2c02c 100644
--- a/include/hw/arm/virt.h
+++ b/include/hw/arm/virt.h
@@ -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;
--
2.18.1
- [PATCH RFC 00/16] Implement Microvm for aarch64 architecture, Xu Yandong, 2020/02/17
- [PATCH RFC 08/16] hw/arm/virt: split secure extension related codes from create_gic, Xu Yandong, 2020/02/17
- [PATCH RFC 05/16] hw/arm: move shared smp_cpus member to ArmMachine, Xu Yandong, 2020/02/17
- [PATCH RFC 07/16] hw/arm/virt: split virt extension related codes from create_gic, Xu Yandong, 2020/02/17
- [PATCH RFC 06/16] hw/arm/virt: split MSI related codes from create_gic, Xu Yandong, 2020/02/17
- [PATCH RFC 11/16] hw/arm: move shared psci_enable and claim_edge_triggered_timers member to ArmMachine, Xu Yandong, 2020/02/17
- [PATCH RFC 04/16] hw/arm: move shared irqmap member to ArmMachine, Xu Yandong, 2020/02/17
- [PATCH RFC 15/16] hw/arm: move shared cpu related functions to arm.c and export them, Xu Yandong, 2020/02/17
- [PATCH RFC 01/16] hw/arm/arm: Introduce ArmMachineState and ArmMachineClass, Xu Yandong, 2020/02/17
- [PATCH RFC 14/16] hw/arm: move shared bootinfo member to ArmMachine,
Xu Yandong <=
- [PATCH RFC 10/16] hw/arm: split create_gic function, Xu Yandong, 2020/02/17
- [PATCH RFC 13/16] hw/arm: move shared fdt related functions to arm.c and export them, Xu Yandong, 2020/02/17
- [PATCH RFC 02/16] hw/arm: move shared fdt member to ArmMachine, Xu Yandong, 2020/02/17
- [PATCH RFC 12/16] hw/arm: move shared devices related functions to arm.c and export them, Xu Yandong, 2020/02/17
- [PATCH RFC 09/16] hw/arm: move shared gic member to ArmMachine, Xu Yandong, 2020/02/17
- [PATCH RFC 03/16] hw/arm: move shared memmap member to ArmMachine, Xu Yandong, 2020/02/17
- [PATCH RFC 16/16] hw/arm: Introduce the microvm machine type, Xu Yandong, 2020/02/17
- Re: [PATCH RFC 00/16] Implement Microvm for aarch64 architecture, no-reply, 2020/02/17
- Re: [PATCH RFC 00/16] Implement Microvm for aarch64 architecture, Peter Maydell, 2020/02/17