acpi: Move setters/getters of oem fields to X86MachineState
The code that sets/gets oem fields is duplicated in both PC and MICROVM variants. This commit moves it to X86MachineState so that all x86 variants can use it and duplication is removed. Signed-off-by: Marian Postevca <posteuca@mutex.one> Message-Id: <20210221001737.24499-2-posteuca@mutex.one> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
50337286b7
commit
d07b22863b
@ -1807,7 +1807,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
|
|||||||
g_array_append_vals(table_data, dsdt->buf->data, dsdt->buf->len);
|
g_array_append_vals(table_data, dsdt->buf->data, dsdt->buf->len);
|
||||||
build_header(linker, table_data,
|
build_header(linker, table_data,
|
||||||
(void *)(table_data->data + table_data->len - dsdt->buf->len),
|
(void *)(table_data->data + table_data->len - dsdt->buf->len),
|
||||||
"DSDT", dsdt->buf->len, 1, pcms->oem_id, pcms->oem_table_id);
|
"DSDT", dsdt->buf->len, 1, x86ms->oem_id, x86ms->oem_table_id);
|
||||||
free_aml_allocator();
|
free_aml_allocator();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1984,8 +1984,8 @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine)
|
|||||||
build_header(linker, table_data,
|
build_header(linker, table_data,
|
||||||
(void *)(table_data->data + srat_start),
|
(void *)(table_data->data + srat_start),
|
||||||
"SRAT",
|
"SRAT",
|
||||||
table_data->len - srat_start, 1, pcms->oem_id,
|
table_data->len - srat_start, 1, x86ms->oem_id,
|
||||||
pcms->oem_table_id);
|
x86ms->oem_table_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2338,13 +2338,13 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)
|
|||||||
if (slic_oem.id) {
|
if (slic_oem.id) {
|
||||||
oem_id = slic_oem.id;
|
oem_id = slic_oem.id;
|
||||||
} else {
|
} else {
|
||||||
oem_id = pcms->oem_id;
|
oem_id = x86ms->oem_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (slic_oem.table_id) {
|
if (slic_oem.table_id) {
|
||||||
oem_table_id = slic_oem.table_id;
|
oem_table_id = slic_oem.table_id;
|
||||||
} else {
|
} else {
|
||||||
oem_table_id = pcms->oem_table_id;
|
oem_table_id = x86ms->oem_table_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
table_offsets = g_array_new(false, true /* clear */,
|
table_offsets = g_array_new(false, true /* clear */,
|
||||||
@ -2385,30 +2385,30 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)
|
|||||||
|
|
||||||
acpi_add_table(table_offsets, tables_blob);
|
acpi_add_table(table_offsets, tables_blob);
|
||||||
acpi_build_madt(tables_blob, tables->linker, x86ms,
|
acpi_build_madt(tables_blob, tables->linker, x86ms,
|
||||||
ACPI_DEVICE_IF(x86ms->acpi_dev), pcms->oem_id,
|
ACPI_DEVICE_IF(x86ms->acpi_dev), x86ms->oem_id,
|
||||||
pcms->oem_table_id);
|
x86ms->oem_table_id);
|
||||||
|
|
||||||
vmgenid_dev = find_vmgenid_dev();
|
vmgenid_dev = find_vmgenid_dev();
|
||||||
if (vmgenid_dev) {
|
if (vmgenid_dev) {
|
||||||
acpi_add_table(table_offsets, tables_blob);
|
acpi_add_table(table_offsets, tables_blob);
|
||||||
vmgenid_build_acpi(VMGENID(vmgenid_dev), tables_blob,
|
vmgenid_build_acpi(VMGENID(vmgenid_dev), tables_blob,
|
||||||
tables->vmgenid, tables->linker, pcms->oem_id);
|
tables->vmgenid, tables->linker, x86ms->oem_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (misc.has_hpet) {
|
if (misc.has_hpet) {
|
||||||
acpi_add_table(table_offsets, tables_blob);
|
acpi_add_table(table_offsets, tables_blob);
|
||||||
build_hpet(tables_blob, tables->linker, pcms->oem_id,
|
build_hpet(tables_blob, tables->linker, x86ms->oem_id,
|
||||||
pcms->oem_table_id);
|
x86ms->oem_table_id);
|
||||||
}
|
}
|
||||||
if (misc.tpm_version != TPM_VERSION_UNSPEC) {
|
if (misc.tpm_version != TPM_VERSION_UNSPEC) {
|
||||||
if (misc.tpm_version == TPM_VERSION_1_2) {
|
if (misc.tpm_version == TPM_VERSION_1_2) {
|
||||||
acpi_add_table(table_offsets, tables_blob);
|
acpi_add_table(table_offsets, tables_blob);
|
||||||
build_tpm_tcpa(tables_blob, tables->linker, tables->tcpalog,
|
build_tpm_tcpa(tables_blob, tables->linker, tables->tcpalog,
|
||||||
pcms->oem_id, pcms->oem_table_id);
|
x86ms->oem_id, x86ms->oem_table_id);
|
||||||
} else { /* TPM_VERSION_2_0 */
|
} else { /* TPM_VERSION_2_0 */
|
||||||
acpi_add_table(table_offsets, tables_blob);
|
acpi_add_table(table_offsets, tables_blob);
|
||||||
build_tpm2(tables_blob, tables->linker, tables->tcpalog,
|
build_tpm2(tables_blob, tables->linker, tables->tcpalog,
|
||||||
pcms->oem_id, pcms->oem_table_id);
|
x86ms->oem_id, x86ms->oem_table_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pcms->numa_nodes) {
|
if (pcms->numa_nodes) {
|
||||||
@ -2416,40 +2416,40 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)
|
|||||||
build_srat(tables_blob, tables->linker, machine);
|
build_srat(tables_blob, tables->linker, machine);
|
||||||
if (machine->numa_state->have_numa_distance) {
|
if (machine->numa_state->have_numa_distance) {
|
||||||
acpi_add_table(table_offsets, tables_blob);
|
acpi_add_table(table_offsets, tables_blob);
|
||||||
build_slit(tables_blob, tables->linker, machine, pcms->oem_id,
|
build_slit(tables_blob, tables->linker, machine, x86ms->oem_id,
|
||||||
pcms->oem_table_id);
|
x86ms->oem_table_id);
|
||||||
}
|
}
|
||||||
if (machine->numa_state->hmat_enabled) {
|
if (machine->numa_state->hmat_enabled) {
|
||||||
acpi_add_table(table_offsets, tables_blob);
|
acpi_add_table(table_offsets, tables_blob);
|
||||||
build_hmat(tables_blob, tables->linker, machine->numa_state,
|
build_hmat(tables_blob, tables->linker, machine->numa_state,
|
||||||
pcms->oem_id, pcms->oem_table_id);
|
x86ms->oem_id, x86ms->oem_table_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (acpi_get_mcfg(&mcfg)) {
|
if (acpi_get_mcfg(&mcfg)) {
|
||||||
acpi_add_table(table_offsets, tables_blob);
|
acpi_add_table(table_offsets, tables_blob);
|
||||||
build_mcfg(tables_blob, tables->linker, &mcfg, pcms->oem_id,
|
build_mcfg(tables_blob, tables->linker, &mcfg, x86ms->oem_id,
|
||||||
pcms->oem_table_id);
|
x86ms->oem_table_id);
|
||||||
}
|
}
|
||||||
if (x86_iommu_get_default()) {
|
if (x86_iommu_get_default()) {
|
||||||
IommuType IOMMUType = x86_iommu_get_type();
|
IommuType IOMMUType = x86_iommu_get_type();
|
||||||
if (IOMMUType == TYPE_AMD) {
|
if (IOMMUType == TYPE_AMD) {
|
||||||
acpi_add_table(table_offsets, tables_blob);
|
acpi_add_table(table_offsets, tables_blob);
|
||||||
build_amd_iommu(tables_blob, tables->linker, pcms->oem_id,
|
build_amd_iommu(tables_blob, tables->linker, x86ms->oem_id,
|
||||||
pcms->oem_table_id);
|
x86ms->oem_table_id);
|
||||||
} else if (IOMMUType == TYPE_INTEL) {
|
} else if (IOMMUType == TYPE_INTEL) {
|
||||||
acpi_add_table(table_offsets, tables_blob);
|
acpi_add_table(table_offsets, tables_blob);
|
||||||
build_dmar_q35(tables_blob, tables->linker, pcms->oem_id,
|
build_dmar_q35(tables_blob, tables->linker, x86ms->oem_id,
|
||||||
pcms->oem_table_id);
|
x86ms->oem_table_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (machine->nvdimms_state->is_enabled) {
|
if (machine->nvdimms_state->is_enabled) {
|
||||||
nvdimm_build_acpi(table_offsets, tables_blob, tables->linker,
|
nvdimm_build_acpi(table_offsets, tables_blob, tables->linker,
|
||||||
machine->nvdimms_state, machine->ram_slots,
|
machine->nvdimms_state, machine->ram_slots,
|
||||||
pcms->oem_id, pcms->oem_table_id);
|
x86ms->oem_id, x86ms->oem_table_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
acpi_add_table(table_offsets, tables_blob);
|
acpi_add_table(table_offsets, tables_blob);
|
||||||
build_waet(tables_blob, tables->linker, pcms->oem_id, pcms->oem_table_id);
|
build_waet(tables_blob, tables->linker, x86ms->oem_id, x86ms->oem_table_id);
|
||||||
|
|
||||||
/* Add tables supplied by user (if any) */
|
/* Add tables supplied by user (if any) */
|
||||||
for (u = acpi_table_first(); u; u = acpi_table_next(u)) {
|
for (u = acpi_table_first(); u; u = acpi_table_next(u)) {
|
||||||
@ -2468,7 +2468,7 @@ void acpi_build(AcpiBuildTables *tables, MachineState *machine)
|
|||||||
{
|
{
|
||||||
AcpiRsdpData rsdp_data = {
|
AcpiRsdpData rsdp_data = {
|
||||||
.revision = 0,
|
.revision = 0,
|
||||||
.oem_id = pcms->oem_id,
|
.oem_id = x86ms->oem_id,
|
||||||
.xsdt_tbl_offset = NULL,
|
.xsdt_tbl_offset = NULL,
|
||||||
.rsdt_tbl_offset = &rsdt,
|
.rsdt_tbl_offset = &rsdt,
|
||||||
};
|
};
|
||||||
|
@ -149,7 +149,7 @@ build_dsdt_microvm(GArray *table_data, BIOSLinker *linker,
|
|||||||
g_array_append_vals(table_data, dsdt->buf->data, dsdt->buf->len);
|
g_array_append_vals(table_data, dsdt->buf->data, dsdt->buf->len);
|
||||||
build_header(linker, table_data,
|
build_header(linker, table_data,
|
||||||
(void *)(table_data->data + table_data->len - dsdt->buf->len),
|
(void *)(table_data->data + table_data->len - dsdt->buf->len),
|
||||||
"DSDT", dsdt->buf->len, 2, mms->oem_id, mms->oem_table_id);
|
"DSDT", dsdt->buf->len, 2, x86ms->oem_id, x86ms->oem_table_id);
|
||||||
free_aml_allocator();
|
free_aml_allocator();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,24 +201,24 @@ static void acpi_build_microvm(AcpiBuildTables *tables,
|
|||||||
pmfadt.dsdt_tbl_offset = &dsdt;
|
pmfadt.dsdt_tbl_offset = &dsdt;
|
||||||
pmfadt.xdsdt_tbl_offset = &dsdt;
|
pmfadt.xdsdt_tbl_offset = &dsdt;
|
||||||
acpi_add_table(table_offsets, tables_blob);
|
acpi_add_table(table_offsets, tables_blob);
|
||||||
build_fadt(tables_blob, tables->linker, &pmfadt, mms->oem_id,
|
build_fadt(tables_blob, tables->linker, &pmfadt, x86ms->oem_id,
|
||||||
mms->oem_table_id);
|
x86ms->oem_table_id);
|
||||||
|
|
||||||
acpi_add_table(table_offsets, tables_blob);
|
acpi_add_table(table_offsets, tables_blob);
|
||||||
acpi_build_madt(tables_blob, tables->linker, X86_MACHINE(machine),
|
acpi_build_madt(tables_blob, tables->linker, X86_MACHINE(machine),
|
||||||
ACPI_DEVICE_IF(x86ms->acpi_dev), mms->oem_id,
|
ACPI_DEVICE_IF(x86ms->acpi_dev), x86ms->oem_id,
|
||||||
mms->oem_table_id);
|
x86ms->oem_table_id);
|
||||||
|
|
||||||
xsdt = tables_blob->len;
|
xsdt = tables_blob->len;
|
||||||
build_xsdt(tables_blob, tables->linker, table_offsets, mms->oem_id,
|
build_xsdt(tables_blob, tables->linker, table_offsets, x86ms->oem_id,
|
||||||
mms->oem_table_id);
|
x86ms->oem_table_id);
|
||||||
|
|
||||||
/* RSDP is in FSEG memory, so allocate it separately */
|
/* RSDP is in FSEG memory, so allocate it separately */
|
||||||
{
|
{
|
||||||
AcpiRsdpData rsdp_data = {
|
AcpiRsdpData rsdp_data = {
|
||||||
/* ACPI 2.0: 5.2.4.3 RSDP Structure */
|
/* ACPI 2.0: 5.2.4.3 RSDP Structure */
|
||||||
.revision = 2, /* xsdt needs v2 */
|
.revision = 2, /* xsdt needs v2 */
|
||||||
.oem_id = mms->oem_id,
|
.oem_id = x86ms->oem_id,
|
||||||
.xsdt_tbl_offset = &xsdt,
|
.xsdt_tbl_offset = &xsdt,
|
||||||
.rsdt_tbl_offset = NULL,
|
.rsdt_tbl_offset = NULL,
|
||||||
};
|
};
|
||||||
|
@ -648,51 +648,6 @@ static void microvm_powerdown_req(Notifier *notifier, void *data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *microvm_machine_get_oem_id(Object *obj, Error **errp)
|
|
||||||
{
|
|
||||||
MicrovmMachineState *mms = MICROVM_MACHINE(obj);
|
|
||||||
|
|
||||||
return g_strdup(mms->oem_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void microvm_machine_set_oem_id(Object *obj, const char *value,
|
|
||||||
Error **errp)
|
|
||||||
{
|
|
||||||
MicrovmMachineState *mms = MICROVM_MACHINE(obj);
|
|
||||||
size_t len = strlen(value);
|
|
||||||
|
|
||||||
if (len > 6) {
|
|
||||||
error_setg(errp,
|
|
||||||
"User specified "MICROVM_MACHINE_OEM_ID" value is bigger than "
|
|
||||||
"6 bytes in size");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
strncpy(mms->oem_id, value, 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *microvm_machine_get_oem_table_id(Object *obj, Error **errp)
|
|
||||||
{
|
|
||||||
MicrovmMachineState *mms = MICROVM_MACHINE(obj);
|
|
||||||
|
|
||||||
return g_strdup(mms->oem_table_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void microvm_machine_set_oem_table_id(Object *obj, const char *value,
|
|
||||||
Error **errp)
|
|
||||||
{
|
|
||||||
MicrovmMachineState *mms = MICROVM_MACHINE(obj);
|
|
||||||
size_t len = strlen(value);
|
|
||||||
|
|
||||||
if (len > 8) {
|
|
||||||
error_setg(errp,
|
|
||||||
"User specified "MICROVM_MACHINE_OEM_TABLE_ID" value is bigger than "
|
|
||||||
"8 bytes in size");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
strncpy(mms->oem_table_id, value, 8);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void microvm_machine_initfn(Object *obj)
|
static void microvm_machine_initfn(Object *obj)
|
||||||
{
|
{
|
||||||
MicrovmMachineState *mms = MICROVM_MACHINE(obj);
|
MicrovmMachineState *mms = MICROVM_MACHINE(obj);
|
||||||
@ -714,9 +669,6 @@ static void microvm_machine_initfn(Object *obj)
|
|||||||
qemu_add_machine_init_done_notifier(&mms->machine_done);
|
qemu_add_machine_init_done_notifier(&mms->machine_done);
|
||||||
mms->powerdown_req.notify = microvm_powerdown_req;
|
mms->powerdown_req.notify = microvm_powerdown_req;
|
||||||
qemu_register_powerdown_notifier(&mms->powerdown_req);
|
qemu_register_powerdown_notifier(&mms->powerdown_req);
|
||||||
|
|
||||||
mms->oem_id = g_strndup(ACPI_BUILD_APPNAME6, 6);
|
|
||||||
mms->oem_table_id = g_strndup(ACPI_BUILD_APPNAME8, 8);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void microvm_class_init(ObjectClass *oc, void *data)
|
static void microvm_class_init(ObjectClass *oc, void *data)
|
||||||
@ -805,24 +757,6 @@ static void microvm_class_init(ObjectClass *oc, void *data)
|
|||||||
MICROVM_MACHINE_AUTO_KERNEL_CMDLINE,
|
MICROVM_MACHINE_AUTO_KERNEL_CMDLINE,
|
||||||
"Set off to disable adding virtio-mmio devices to the kernel cmdline");
|
"Set off to disable adding virtio-mmio devices to the kernel cmdline");
|
||||||
|
|
||||||
object_class_property_add_str(oc, MICROVM_MACHINE_OEM_ID,
|
|
||||||
microvm_machine_get_oem_id,
|
|
||||||
microvm_machine_set_oem_id);
|
|
||||||
object_class_property_set_description(oc, MICROVM_MACHINE_OEM_ID,
|
|
||||||
"Override the default value of field OEMID "
|
|
||||||
"in ACPI table header."
|
|
||||||
"The string may be up to 6 bytes in size");
|
|
||||||
|
|
||||||
|
|
||||||
object_class_property_add_str(oc, MICROVM_MACHINE_OEM_TABLE_ID,
|
|
||||||
microvm_machine_get_oem_table_id,
|
|
||||||
microvm_machine_set_oem_table_id);
|
|
||||||
object_class_property_set_description(oc, MICROVM_MACHINE_OEM_TABLE_ID,
|
|
||||||
"Override the default value of field OEM Table ID "
|
|
||||||
"in ACPI table header."
|
|
||||||
"The string may be up to 8 bytes in size");
|
|
||||||
|
|
||||||
|
|
||||||
machine_class_allow_dynamic_sysbus_dev(mc, TYPE_RAMFB_DEVICE);
|
machine_class_allow_dynamic_sysbus_dev(mc, TYPE_RAMFB_DEVICE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
63
hw/i386/pc.c
63
hw/i386/pc.c
@ -1608,49 +1608,6 @@ static void pc_machine_set_max_fw_size(Object *obj, Visitor *v,
|
|||||||
pcms->max_fw_size = value;
|
pcms->max_fw_size = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *pc_machine_get_oem_id(Object *obj, Error **errp)
|
|
||||||
{
|
|
||||||
PCMachineState *pcms = PC_MACHINE(obj);
|
|
||||||
|
|
||||||
return g_strdup(pcms->oem_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void pc_machine_set_oem_id(Object *obj, const char *value, Error **errp)
|
|
||||||
{
|
|
||||||
PCMachineState *pcms = PC_MACHINE(obj);
|
|
||||||
size_t len = strlen(value);
|
|
||||||
|
|
||||||
if (len > 6) {
|
|
||||||
error_setg(errp,
|
|
||||||
"User specified "PC_MACHINE_OEM_ID" value is bigger than "
|
|
||||||
"6 bytes in size");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
strncpy(pcms->oem_id, value, 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *pc_machine_get_oem_table_id(Object *obj, Error **errp)
|
|
||||||
{
|
|
||||||
PCMachineState *pcms = PC_MACHINE(obj);
|
|
||||||
|
|
||||||
return g_strdup(pcms->oem_table_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void pc_machine_set_oem_table_id(Object *obj, const char *value,
|
|
||||||
Error **errp)
|
|
||||||
{
|
|
||||||
PCMachineState *pcms = PC_MACHINE(obj);
|
|
||||||
size_t len = strlen(value);
|
|
||||||
|
|
||||||
if (len > 8) {
|
|
||||||
error_setg(errp,
|
|
||||||
"User specified "PC_MACHINE_OEM_TABLE_ID" value is bigger than "
|
|
||||||
"8 bytes in size");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
strncpy(pcms->oem_table_id, value, 8);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void pc_machine_initfn(Object *obj)
|
static void pc_machine_initfn(Object *obj)
|
||||||
{
|
{
|
||||||
@ -1664,8 +1621,6 @@ static void pc_machine_initfn(Object *obj)
|
|||||||
pcms->max_ram_below_4g = 0; /* use default */
|
pcms->max_ram_below_4g = 0; /* use default */
|
||||||
/* acpi build is enabled by default if machine supports it */
|
/* acpi build is enabled by default if machine supports it */
|
||||||
pcms->acpi_build_enabled = PC_MACHINE_GET_CLASS(pcms)->has_acpi_build;
|
pcms->acpi_build_enabled = PC_MACHINE_GET_CLASS(pcms)->has_acpi_build;
|
||||||
pcms->oem_id = g_strndup(ACPI_BUILD_APPNAME6, 6);
|
|
||||||
pcms->oem_table_id = g_strndup(ACPI_BUILD_APPNAME8, 8);
|
|
||||||
pcms->smbus_enabled = true;
|
pcms->smbus_enabled = true;
|
||||||
pcms->sata_enabled = true;
|
pcms->sata_enabled = true;
|
||||||
pcms->pit_enabled = true;
|
pcms->pit_enabled = true;
|
||||||
@ -1802,24 +1757,6 @@ static void pc_machine_class_init(ObjectClass *oc, void *data)
|
|||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
object_class_property_set_description(oc, PC_MACHINE_MAX_FW_SIZE,
|
object_class_property_set_description(oc, PC_MACHINE_MAX_FW_SIZE,
|
||||||
"Maximum combined firmware size");
|
"Maximum combined firmware size");
|
||||||
|
|
||||||
object_class_property_add_str(oc, PC_MACHINE_OEM_ID,
|
|
||||||
pc_machine_get_oem_id,
|
|
||||||
pc_machine_set_oem_id);
|
|
||||||
object_class_property_set_description(oc, PC_MACHINE_OEM_ID,
|
|
||||||
"Override the default value of field OEMID "
|
|
||||||
"in ACPI table header."
|
|
||||||
"The string may be up to 6 bytes in size");
|
|
||||||
|
|
||||||
|
|
||||||
object_class_property_add_str(oc, PC_MACHINE_OEM_TABLE_ID,
|
|
||||||
pc_machine_get_oem_table_id,
|
|
||||||
pc_machine_set_oem_table_id);
|
|
||||||
object_class_property_set_description(oc, PC_MACHINE_OEM_TABLE_ID,
|
|
||||||
"Override the default value of field OEM Table ID "
|
|
||||||
"in ACPI table header."
|
|
||||||
"The string may be up to 8 bytes in size");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo pc_machine_info = {
|
static const TypeInfo pc_machine_info = {
|
||||||
|
@ -1201,6 +1201,51 @@ static void x86_machine_set_acpi(Object *obj, Visitor *v, const char *name,
|
|||||||
visit_type_OnOffAuto(v, name, &x86ms->acpi, errp);
|
visit_type_OnOffAuto(v, name, &x86ms->acpi, errp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *x86_machine_get_oem_id(Object *obj, Error **errp)
|
||||||
|
{
|
||||||
|
X86MachineState *x86ms = X86_MACHINE(obj);
|
||||||
|
|
||||||
|
return g_strdup(x86ms->oem_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void x86_machine_set_oem_id(Object *obj, const char *value, Error **errp)
|
||||||
|
{
|
||||||
|
X86MachineState *x86ms = X86_MACHINE(obj);
|
||||||
|
size_t len = strlen(value);
|
||||||
|
|
||||||
|
if (len > 6) {
|
||||||
|
error_setg(errp,
|
||||||
|
"User specified "X86_MACHINE_OEM_ID" value is bigger than "
|
||||||
|
"6 bytes in size");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
strncpy(x86ms->oem_id, value, 6);
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *x86_machine_get_oem_table_id(Object *obj, Error **errp)
|
||||||
|
{
|
||||||
|
X86MachineState *x86ms = X86_MACHINE(obj);
|
||||||
|
|
||||||
|
return g_strdup(x86ms->oem_table_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void x86_machine_set_oem_table_id(Object *obj, const char *value,
|
||||||
|
Error **errp)
|
||||||
|
{
|
||||||
|
X86MachineState *x86ms = X86_MACHINE(obj);
|
||||||
|
size_t len = strlen(value);
|
||||||
|
|
||||||
|
if (len > 8) {
|
||||||
|
error_setg(errp,
|
||||||
|
"User specified "X86_MACHINE_OEM_TABLE_ID
|
||||||
|
" value is bigger than "
|
||||||
|
"8 bytes in size");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
strncpy(x86ms->oem_table_id, value, 8);
|
||||||
|
}
|
||||||
|
|
||||||
static void x86_machine_initfn(Object *obj)
|
static void x86_machine_initfn(Object *obj)
|
||||||
{
|
{
|
||||||
X86MachineState *x86ms = X86_MACHINE(obj);
|
X86MachineState *x86ms = X86_MACHINE(obj);
|
||||||
@ -1209,6 +1254,8 @@ static void x86_machine_initfn(Object *obj)
|
|||||||
x86ms->acpi = ON_OFF_AUTO_AUTO;
|
x86ms->acpi = ON_OFF_AUTO_AUTO;
|
||||||
x86ms->smp_dies = 1;
|
x86ms->smp_dies = 1;
|
||||||
x86ms->pci_irq_mask = ACPI_BUILD_PCI_IRQS;
|
x86ms->pci_irq_mask = ACPI_BUILD_PCI_IRQS;
|
||||||
|
x86ms->oem_id = g_strndup(ACPI_BUILD_APPNAME6, 6);
|
||||||
|
x86ms->oem_table_id = g_strndup(ACPI_BUILD_APPNAME8, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void x86_machine_class_init(ObjectClass *oc, void *data)
|
static void x86_machine_class_init(ObjectClass *oc, void *data)
|
||||||
@ -1235,6 +1282,23 @@ static void x86_machine_class_init(ObjectClass *oc, void *data)
|
|||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
object_class_property_set_description(oc, X86_MACHINE_ACPI,
|
object_class_property_set_description(oc, X86_MACHINE_ACPI,
|
||||||
"Enable ACPI");
|
"Enable ACPI");
|
||||||
|
|
||||||
|
object_class_property_add_str(oc, X86_MACHINE_OEM_ID,
|
||||||
|
x86_machine_get_oem_id,
|
||||||
|
x86_machine_set_oem_id);
|
||||||
|
object_class_property_set_description(oc, X86_MACHINE_OEM_ID,
|
||||||
|
"Override the default value of field OEMID "
|
||||||
|
"in ACPI table header."
|
||||||
|
"The string may be up to 6 bytes in size");
|
||||||
|
|
||||||
|
|
||||||
|
object_class_property_add_str(oc, X86_MACHINE_OEM_TABLE_ID,
|
||||||
|
x86_machine_get_oem_table_id,
|
||||||
|
x86_machine_set_oem_table_id);
|
||||||
|
object_class_property_set_description(oc, X86_MACHINE_OEM_TABLE_ID,
|
||||||
|
"Override the default value of field OEM Table ID "
|
||||||
|
"in ACPI table header."
|
||||||
|
"The string may be up to 8 bytes in size");
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo x86_machine_info = {
|
static const TypeInfo x86_machine_info = {
|
||||||
|
@ -76,8 +76,6 @@
|
|||||||
#define MICROVM_MACHINE_ISA_SERIAL "isa-serial"
|
#define MICROVM_MACHINE_ISA_SERIAL "isa-serial"
|
||||||
#define MICROVM_MACHINE_OPTION_ROMS "x-option-roms"
|
#define MICROVM_MACHINE_OPTION_ROMS "x-option-roms"
|
||||||
#define MICROVM_MACHINE_AUTO_KERNEL_CMDLINE "auto-kernel-cmdline"
|
#define MICROVM_MACHINE_AUTO_KERNEL_CMDLINE "auto-kernel-cmdline"
|
||||||
#define MICROVM_MACHINE_OEM_ID "oem-id"
|
|
||||||
#define MICROVM_MACHINE_OEM_TABLE_ID "oem-table-id"
|
|
||||||
|
|
||||||
struct MicrovmMachineClass {
|
struct MicrovmMachineClass {
|
||||||
X86MachineClass parent;
|
X86MachineClass parent;
|
||||||
@ -106,8 +104,6 @@ struct MicrovmMachineState {
|
|||||||
Notifier machine_done;
|
Notifier machine_done;
|
||||||
Notifier powerdown_req;
|
Notifier powerdown_req;
|
||||||
struct GPEXConfig gpex;
|
struct GPEXConfig gpex;
|
||||||
char *oem_id;
|
|
||||||
char *oem_table_id;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define TYPE_MICROVM_MACHINE MACHINE_TYPE_NAME("microvm")
|
#define TYPE_MICROVM_MACHINE MACHINE_TYPE_NAME("microvm")
|
||||||
|
@ -46,8 +46,6 @@ typedef struct PCMachineState {
|
|||||||
bool pit_enabled;
|
bool pit_enabled;
|
||||||
bool hpet_enabled;
|
bool hpet_enabled;
|
||||||
uint64_t max_fw_size;
|
uint64_t max_fw_size;
|
||||||
char *oem_id;
|
|
||||||
char *oem_table_id;
|
|
||||||
|
|
||||||
/* NUMA information: */
|
/* NUMA information: */
|
||||||
uint64_t numa_nodes;
|
uint64_t numa_nodes;
|
||||||
@ -65,8 +63,6 @@ typedef struct PCMachineState {
|
|||||||
#define PC_MACHINE_SATA "sata"
|
#define PC_MACHINE_SATA "sata"
|
||||||
#define PC_MACHINE_PIT "pit"
|
#define PC_MACHINE_PIT "pit"
|
||||||
#define PC_MACHINE_MAX_FW_SIZE "max-fw-size"
|
#define PC_MACHINE_MAX_FW_SIZE "max-fw-size"
|
||||||
#define PC_MACHINE_OEM_ID "oem-id"
|
|
||||||
#define PC_MACHINE_OEM_TABLE_ID "oem-table-id"
|
|
||||||
/**
|
/**
|
||||||
* PCMachineClass:
|
* PCMachineClass:
|
||||||
*
|
*
|
||||||
|
@ -67,6 +67,8 @@ struct X86MachineState {
|
|||||||
OnOffAuto smm;
|
OnOffAuto smm;
|
||||||
OnOffAuto acpi;
|
OnOffAuto acpi;
|
||||||
|
|
||||||
|
char *oem_id;
|
||||||
|
char *oem_table_id;
|
||||||
/*
|
/*
|
||||||
* Address space used by IOAPIC device. All IOAPIC interrupts
|
* Address space used by IOAPIC device. All IOAPIC interrupts
|
||||||
* will be translated to MSI messages in the address space.
|
* will be translated to MSI messages in the address space.
|
||||||
@ -76,6 +78,8 @@ struct X86MachineState {
|
|||||||
|
|
||||||
#define X86_MACHINE_SMM "smm"
|
#define X86_MACHINE_SMM "smm"
|
||||||
#define X86_MACHINE_ACPI "acpi"
|
#define X86_MACHINE_ACPI "acpi"
|
||||||
|
#define X86_MACHINE_OEM_ID "oem-id"
|
||||||
|
#define X86_MACHINE_OEM_TABLE_ID "oem-table-id"
|
||||||
|
|
||||||
#define TYPE_X86_MACHINE MACHINE_TYPE_NAME("x86")
|
#define TYPE_X86_MACHINE MACHINE_TYPE_NAME("x86")
|
||||||
OBJECT_DECLARE_TYPE(X86MachineState, X86MachineClass, X86_MACHINE)
|
OBJECT_DECLARE_TYPE(X86MachineState, X86MachineClass, X86_MACHINE)
|
||||||
|
Loading…
Reference in New Issue
Block a user