On Thu, Jul 14, 2016 at 05:51:19PM -0300, Eduardo Habkost wrote: > On Fri, Jun 10, 2016 at 07:40:26PM +0200, Andrew Jones wrote: > > SMBIOS needs cpu topology for Type4 tables, so we need to pass > > it in. There are several parameters so we use a structure. There > > are two callers (of non-legacy, which generates Type4 tables), > > x86 and arm, so we also update both to pass the topology > > parameters from their MachineState properties (directly in the > > case of x86, indirectly through VirtGuestInfo in the case of arm). > > > > Signed-off-by: Andrew Jones <drjo...@redhat.com> > [...] > > @@ -701,12 +701,19 @@ static uint32_t > > x86_cpu_apic_id_from_index(MachineState *ms, > > } > > } > > > > -static void pc_build_smbios(FWCfgState *fw_cfg) > > +static void pc_build_smbios(MachineState *ms, FWCfgState *fw_cfg) > > { > > uint8_t *smbios_tables, *smbios_anchor; > > size_t smbios_tables_len, smbios_anchor_len; > > struct smbios_phys_mem_area *mem_array; > > unsigned i, array_count; > > + struct smbios_cpu_topology topo = { > > + .sockets = ms->sockets, > > + .cores = ms->cores, > > + .threads = ms->threads, > > + .maxcpus = ms->maxcpus, > > + .cpus = ms->cpus, > > + }; > > > > Do we really need to manually copy data around this way when > smbios.c could just use qdev_get_machine() directly?
You tell me. The art of writing object-oriented-ish code in C with qom and qdev and a pile of qemu-best-practices is still something I'm trying to sort out :-) Using qdev_get_machine() sounds good to me though. drew > > -- > Eduardo >