Re: [PATCH v4 1/3] hw/i386/pc: Refactor logic to set SMBIOS set defaults
Igore, On 6/6/2023 2:45 PM, Igor Mammedov wrote: On Mon, 5 Jun 2023 16:39:04 -0500 Suravee Suthikulpanit wrote: In preparation for subsequent code to upgrade default SMBIOS entry point type. There is no functional change. Signed-off-by: Suravee Suthikulpanit --- hw/i386/pc.c | 12 hw/i386/pc_piix.c | 9 - hw/i386/pc_q35.c | 8 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index bb62c994fa..8fc34f5454 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -781,6 +781,18 @@ void pc_machine_done(Notifier *notifier, void *data) acpi_setup(); if (x86ms->fw_cfg) { +PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms); + +if (pcmc->smbios_defaults) { +MachineClass *mc = MACHINE_GET_CLASS(pcms); + +/* These values are guest ABI, do not change */ +smbios_set_defaults("QEMU", mc->desc, +mc->name, pcmc->smbios_legacy_mode, +pcmc->smbios_uuid_encoded, +pcms->smbios_entry_point_type); +} well, pc_machine_done() is the hack for the last minute changes to board that can't done earlier otherwise (during machine_initfn time). So I'd prefer not adding anything there unless we have to. Originally, I put it here because pc_machine_set_smbios_ep() is called between the pc_machine_init_fn() and pc_machine_done(). In this case, I'll move this code to the end of pc_machine_init_fn(). Then, I can call smbios_set_defaults() from pc_machine_set_smbios_ep() to override the previously set defaults. Thanks, Suravee
Re: [PATCH v4 1/3] hw/i386/pc: Refactor logic to set SMBIOS set defaults
On Mon, 5 Jun 2023 16:39:04 -0500 Suravee Suthikulpanit wrote: > In preparation for subsequent code to upgrade default SMBIOS > entry point type. There is no functional change. > > Signed-off-by: Suravee Suthikulpanit > --- > hw/i386/pc.c | 12 > hw/i386/pc_piix.c | 9 - > hw/i386/pc_q35.c | 8 > 3 files changed, 12 insertions(+), 17 deletions(-) > > diff --git a/hw/i386/pc.c b/hw/i386/pc.c > index bb62c994fa..8fc34f5454 100644 > --- a/hw/i386/pc.c > +++ b/hw/i386/pc.c > @@ -781,6 +781,18 @@ void pc_machine_done(Notifier *notifier, void *data) > > acpi_setup(); > if (x86ms->fw_cfg) { > +PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms); > + > +if (pcmc->smbios_defaults) { > +MachineClass *mc = MACHINE_GET_CLASS(pcms); > + > +/* These values are guest ABI, do not change */ > +smbios_set_defaults("QEMU", mc->desc, > +mc->name, pcmc->smbios_legacy_mode, > +pcmc->smbios_uuid_encoded, > +pcms->smbios_entry_point_type); > +} > well, pc_machine_done() is the hack for the last minute changes to board that can't done earlier otherwise (during machine_initfn time). So I'd prefer not adding anything there unless we have to. > fw_cfg_build_smbios(MACHINE(pcms), x86ms->fw_cfg); > fw_cfg_build_feature_control(MACHINE(pcms), x86ms->fw_cfg); > /* update FW_CFG_NB_CPUS to account for -device added CPUs */ > diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c > index d5b0dcd1fe..da6ba4eeb4 100644 > --- a/hw/i386/pc_piix.c > +++ b/hw/i386/pc_piix.c > @@ -198,15 +198,6 @@ static void pc_init1(MachineState *machine, > > pc_guest_info_init(pcms); > > -if (pcmc->smbios_defaults) { > -MachineClass *mc = MACHINE_GET_CLASS(machine); > -/* These values are guest ABI, do not change */ > -smbios_set_defaults("QEMU", mc->desc, > -mc->name, pcmc->smbios_legacy_mode, > -pcmc->smbios_uuid_encoded, > -pcms->smbios_entry_point_type); > -} > - > /* allocate ram and load rom/bios */ > if (!xen_enabled()) { > pc_memory_init(pcms, system_memory, rom_memory, hole64_size); > diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c > index 6155427e48..a58cd1d3ea 100644 > --- a/hw/i386/pc_q35.c > +++ b/hw/i386/pc_q35.c > @@ -198,14 +198,6 @@ static void pc_q35_init(MachineState *machine) > > pc_guest_info_init(pcms); > > -if (pcmc->smbios_defaults) { > -/* These values are guest ABI, do not change */ > -smbios_set_defaults("QEMU", mc->desc, > -mc->name, pcmc->smbios_legacy_mode, > -pcmc->smbios_uuid_encoded, > -pcms->smbios_entry_point_type); > -} > - > /* create pci host bus */ > q35_host = Q35_HOST_DEVICE(qdev_new(TYPE_Q35_HOST_DEVICE)); >
[PATCH v4 1/3] hw/i386/pc: Refactor logic to set SMBIOS set defaults
In preparation for subsequent code to upgrade default SMBIOS entry point type. There is no functional change. Signed-off-by: Suravee Suthikulpanit --- hw/i386/pc.c | 12 hw/i386/pc_piix.c | 9 - hw/i386/pc_q35.c | 8 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index bb62c994fa..8fc34f5454 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -781,6 +781,18 @@ void pc_machine_done(Notifier *notifier, void *data) acpi_setup(); if (x86ms->fw_cfg) { +PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms); + +if (pcmc->smbios_defaults) { +MachineClass *mc = MACHINE_GET_CLASS(pcms); + +/* These values are guest ABI, do not change */ +smbios_set_defaults("QEMU", mc->desc, +mc->name, pcmc->smbios_legacy_mode, +pcmc->smbios_uuid_encoded, +pcms->smbios_entry_point_type); +} + fw_cfg_build_smbios(MACHINE(pcms), x86ms->fw_cfg); fw_cfg_build_feature_control(MACHINE(pcms), x86ms->fw_cfg); /* update FW_CFG_NB_CPUS to account for -device added CPUs */ diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index d5b0dcd1fe..da6ba4eeb4 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -198,15 +198,6 @@ static void pc_init1(MachineState *machine, pc_guest_info_init(pcms); -if (pcmc->smbios_defaults) { -MachineClass *mc = MACHINE_GET_CLASS(machine); -/* These values are guest ABI, do not change */ -smbios_set_defaults("QEMU", mc->desc, -mc->name, pcmc->smbios_legacy_mode, -pcmc->smbios_uuid_encoded, -pcms->smbios_entry_point_type); -} - /* allocate ram and load rom/bios */ if (!xen_enabled()) { pc_memory_init(pcms, system_memory, rom_memory, hole64_size); diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 6155427e48..a58cd1d3ea 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -198,14 +198,6 @@ static void pc_q35_init(MachineState *machine) pc_guest_info_init(pcms); -if (pcmc->smbios_defaults) { -/* These values are guest ABI, do not change */ -smbios_set_defaults("QEMU", mc->desc, -mc->name, pcmc->smbios_legacy_mode, -pcmc->smbios_uuid_encoded, -pcms->smbios_entry_point_type); -} - /* create pci host bus */ q35_host = Q35_HOST_DEVICE(qdev_new(TYPE_Q35_HOST_DEVICE)); -- 2.34.1