hw/arm/virt: remove VirtGuestInfo
by moving VirtGuestInfo.fw_cfg to VirtMachineState. This is the mach-virt equivalent of "pc: Move PcGuestInfo.fw_cfg to PCMachineState" and "pc: Eliminate PcGuestInfo struct" combined. Signed-off-by: Andrew Jones <drjones@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Message-id: 20170102200153.28864-14-drjones@redhat.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
4dad9e7478
commit
af1f60a402
@ -825,11 +825,10 @@ static const VMStateDescription vmstate_virt_acpi_build = {
|
|||||||
|
|
||||||
void virt_acpi_setup(VirtMachineState *vms)
|
void virt_acpi_setup(VirtMachineState *vms)
|
||||||
{
|
{
|
||||||
VirtGuestInfo *guest_info = &vms->acpi_guest_info;
|
|
||||||
AcpiBuildTables tables;
|
AcpiBuildTables tables;
|
||||||
AcpiBuildState *build_state;
|
AcpiBuildState *build_state;
|
||||||
|
|
||||||
if (!guest_info->fw_cfg) {
|
if (!vms->fw_cfg) {
|
||||||
trace_virt_acpi_setup();
|
trace_virt_acpi_setup();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -854,8 +853,8 @@ void virt_acpi_setup(VirtMachineState *vms)
|
|||||||
acpi_add_rom_blob(build_state, tables.linker->cmd_blob,
|
acpi_add_rom_blob(build_state, tables.linker->cmd_blob,
|
||||||
"etc/table-loader", 0);
|
"etc/table-loader", 0);
|
||||||
|
|
||||||
fw_cfg_add_file(guest_info->fw_cfg, ACPI_BUILD_TPMLOG_FILE,
|
fw_cfg_add_file(vms->fw_cfg, ACPI_BUILD_TPMLOG_FILE, tables.tcpalog->data,
|
||||||
tables.tcpalog->data, acpi_data_len(tables.tcpalog));
|
acpi_data_len(tables.tcpalog));
|
||||||
|
|
||||||
build_state->rsdp_mr = acpi_add_rom_blob(build_state, tables.rsdp,
|
build_state->rsdp_mr = acpi_add_rom_blob(build_state, tables.rsdp,
|
||||||
ACPI_BUILD_RSDP_FILE, 0);
|
ACPI_BUILD_RSDP_FILE, 0);
|
||||||
|
@ -889,7 +889,7 @@ static void create_flash(const VirtMachineState *vms,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void create_fw_cfg(const VirtMachineState *vms, AddressSpace *as)
|
static FWCfgState *create_fw_cfg(const VirtMachineState *vms, AddressSpace *as)
|
||||||
{
|
{
|
||||||
hwaddr base = vms->memmap[VIRT_FW_CFG].base;
|
hwaddr base = vms->memmap[VIRT_FW_CFG].base;
|
||||||
hwaddr size = vms->memmap[VIRT_FW_CFG].size;
|
hwaddr size = vms->memmap[VIRT_FW_CFG].size;
|
||||||
@ -906,6 +906,7 @@ static void create_fw_cfg(const VirtMachineState *vms, AddressSpace *as)
|
|||||||
qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg",
|
qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg",
|
||||||
2, base, 2, size);
|
2, base, 2, size);
|
||||||
g_free(nodename);
|
g_free(nodename);
|
||||||
|
return fw_cfg;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void create_pcie_irq_map(const VirtMachineState *vms,
|
static void create_pcie_irq_map(const VirtMachineState *vms,
|
||||||
@ -1133,12 +1134,11 @@ static void *machvirt_dtb(const struct arm_boot_info *binfo, int *fdt_size)
|
|||||||
|
|
||||||
static void virt_build_smbios(VirtMachineState *vms)
|
static void virt_build_smbios(VirtMachineState *vms)
|
||||||
{
|
{
|
||||||
FWCfgState *fw_cfg = vms->acpi_guest_info.fw_cfg;
|
|
||||||
uint8_t *smbios_tables, *smbios_anchor;
|
uint8_t *smbios_tables, *smbios_anchor;
|
||||||
size_t smbios_tables_len, smbios_anchor_len;
|
size_t smbios_tables_len, smbios_anchor_len;
|
||||||
const char *product = "QEMU Virtual Machine";
|
const char *product = "QEMU Virtual Machine";
|
||||||
|
|
||||||
if (!fw_cfg) {
|
if (!vms->fw_cfg) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1153,9 +1153,9 @@ static void virt_build_smbios(VirtMachineState *vms)
|
|||||||
&smbios_anchor, &smbios_anchor_len);
|
&smbios_anchor, &smbios_anchor_len);
|
||||||
|
|
||||||
if (smbios_anchor) {
|
if (smbios_anchor) {
|
||||||
fw_cfg_add_file(fw_cfg, "etc/smbios/smbios-tables",
|
fw_cfg_add_file(vms->fw_cfg, "etc/smbios/smbios-tables",
|
||||||
smbios_tables, smbios_tables_len);
|
smbios_tables, smbios_tables_len);
|
||||||
fw_cfg_add_file(fw_cfg, "etc/smbios/smbios-anchor",
|
fw_cfg_add_file(vms->fw_cfg, "etc/smbios/smbios-anchor",
|
||||||
smbios_anchor, smbios_anchor_len);
|
smbios_anchor, smbios_anchor_len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1180,7 +1180,6 @@ static void machvirt_init(MachineState *machine)
|
|||||||
int n, virt_max_cpus;
|
int n, virt_max_cpus;
|
||||||
MemoryRegion *ram = g_new(MemoryRegion, 1);
|
MemoryRegion *ram = g_new(MemoryRegion, 1);
|
||||||
const char *cpu_model = machine->cpu_model;
|
const char *cpu_model = machine->cpu_model;
|
||||||
VirtGuestInfo *guest_info = &vms->acpi_guest_info;
|
|
||||||
char **cpustr;
|
char **cpustr;
|
||||||
ObjectClass *oc;
|
ObjectClass *oc;
|
||||||
const char *typename;
|
const char *typename;
|
||||||
@ -1369,10 +1368,9 @@ static void machvirt_init(MachineState *machine)
|
|||||||
*/
|
*/
|
||||||
create_virtio_devices(vms, pic);
|
create_virtio_devices(vms, pic);
|
||||||
|
|
||||||
create_fw_cfg(vms, &address_space_memory);
|
vms->fw_cfg = create_fw_cfg(vms, &address_space_memory);
|
||||||
rom_set_fw(fw_cfg_find());
|
rom_set_fw(vms->fw_cfg);
|
||||||
|
|
||||||
guest_info->fw_cfg = fw_cfg_find();
|
|
||||||
vms->machine_done.notify = virt_machine_done;
|
vms->machine_done.notify = virt_machine_done;
|
||||||
qemu_add_machine_init_done_notifier(&vms->machine_done);
|
qemu_add_machine_init_done_notifier(&vms->machine_done);
|
||||||
|
|
||||||
|
@ -77,10 +77,6 @@ typedef struct MemMapEntry {
|
|||||||
hwaddr size;
|
hwaddr size;
|
||||||
} MemMapEntry;
|
} MemMapEntry;
|
||||||
|
|
||||||
typedef struct VirtGuestInfo {
|
|
||||||
FWCfgState *fw_cfg;
|
|
||||||
} VirtGuestInfo;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
MachineClass parent;
|
MachineClass parent;
|
||||||
bool disallow_affinity_adjustment;
|
bool disallow_affinity_adjustment;
|
||||||
@ -91,8 +87,8 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
MachineState parent;
|
MachineState parent;
|
||||||
VirtGuestInfo acpi_guest_info;
|
|
||||||
Notifier machine_done;
|
Notifier machine_done;
|
||||||
|
FWCfgState *fw_cfg;
|
||||||
bool secure;
|
bool secure;
|
||||||
bool highmem;
|
bool highmem;
|
||||||
int32_t gic_version;
|
int32_t gic_version;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user