mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 01:03:55 -06:00
x86: move acpi_dev from pc/microvm
Both pc and microvm machine types have a acpi_dev field. Move it to the common base type. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Sergio Lopez <slp@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Message-id: 20200915120909.20838-15-kraxel@redhat.com
This commit is contained in:
parent
9927a6329a
commit
50aef13181
9 changed files with 32 additions and 26 deletions
34
hw/i386/pc.c
34
hw/i386/pc.c
|
@ -1274,6 +1274,7 @@ static void pc_memory_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
|
|||
Error **errp)
|
||||
{
|
||||
const PCMachineState *pcms = PC_MACHINE(hotplug_dev);
|
||||
const X86MachineState *x86ms = X86_MACHINE(hotplug_dev);
|
||||
const PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms);
|
||||
const MachineState *ms = MACHINE(hotplug_dev);
|
||||
const bool is_nvdimm = object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM);
|
||||
|
@ -1285,7 +1286,7 @@ static void pc_memory_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
|
|||
* but pcms->acpi_dev is still created. Check !acpi_enabled in
|
||||
* addition to cover this case.
|
||||
*/
|
||||
if (!pcms->acpi_dev || !x86_machine_is_acpi_enabled(X86_MACHINE(pcms))) {
|
||||
if (!x86ms->acpi_dev || !x86_machine_is_acpi_enabled(x86ms)) {
|
||||
error_setg(errp,
|
||||
"memory hotplug is not enabled: missing acpi device or acpi disabled");
|
||||
return;
|
||||
|
@ -1296,7 +1297,7 @@ static void pc_memory_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,
|
|||
return;
|
||||
}
|
||||
|
||||
hotplug_handler_pre_plug(pcms->acpi_dev, dev, &local_err);
|
||||
hotplug_handler_pre_plug(x86ms->acpi_dev, dev, &local_err);
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
return;
|
||||
|
@ -1311,6 +1312,7 @@ static void pc_memory_plug(HotplugHandler *hotplug_dev,
|
|||
{
|
||||
Error *local_err = NULL;
|
||||
PCMachineState *pcms = PC_MACHINE(hotplug_dev);
|
||||
X86MachineState *x86ms = X86_MACHINE(hotplug_dev);
|
||||
MachineState *ms = MACHINE(hotplug_dev);
|
||||
bool is_nvdimm = object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM);
|
||||
|
||||
|
@ -1323,7 +1325,7 @@ static void pc_memory_plug(HotplugHandler *hotplug_dev,
|
|||
nvdimm_plug(ms->nvdimms_state);
|
||||
}
|
||||
|
||||
hotplug_handler_plug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &error_abort);
|
||||
hotplug_handler_plug(x86ms->acpi_dev, dev, &error_abort);
|
||||
out:
|
||||
error_propagate(errp, local_err);
|
||||
}
|
||||
|
@ -1331,14 +1333,14 @@ out:
|
|||
static void pc_memory_unplug_request(HotplugHandler *hotplug_dev,
|
||||
DeviceState *dev, Error **errp)
|
||||
{
|
||||
PCMachineState *pcms = PC_MACHINE(hotplug_dev);
|
||||
X86MachineState *x86ms = X86_MACHINE(hotplug_dev);
|
||||
|
||||
/*
|
||||
* When -no-acpi is used with Q35 machine type, no ACPI is built,
|
||||
* but pcms->acpi_dev is still created. Check !acpi_enabled in
|
||||
* addition to cover this case.
|
||||
*/
|
||||
if (!pcms->acpi_dev || !x86_machine_is_acpi_enabled(X86_MACHINE(pcms))) {
|
||||
if (!x86ms->acpi_dev || !x86_machine_is_acpi_enabled(x86ms)) {
|
||||
error_setg(errp,
|
||||
"memory hotplug is not enabled: missing acpi device or acpi disabled");
|
||||
return;
|
||||
|
@ -1349,7 +1351,7 @@ static void pc_memory_unplug_request(HotplugHandler *hotplug_dev,
|
|||
return;
|
||||
}
|
||||
|
||||
hotplug_handler_unplug_request(HOTPLUG_HANDLER(pcms->acpi_dev), dev,
|
||||
hotplug_handler_unplug_request(x86ms->acpi_dev, dev,
|
||||
errp);
|
||||
}
|
||||
|
||||
|
@ -1357,9 +1359,10 @@ static void pc_memory_unplug(HotplugHandler *hotplug_dev,
|
|||
DeviceState *dev, Error **errp)
|
||||
{
|
||||
PCMachineState *pcms = PC_MACHINE(hotplug_dev);
|
||||
X86MachineState *x86ms = X86_MACHINE(hotplug_dev);
|
||||
Error *local_err = NULL;
|
||||
|
||||
hotplug_handler_unplug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err);
|
||||
hotplug_handler_unplug(x86ms->acpi_dev, dev, &local_err);
|
||||
if (local_err) {
|
||||
goto out;
|
||||
}
|
||||
|
@ -1403,10 +1406,10 @@ static void pc_cpu_plug(HotplugHandler *hotplug_dev,
|
|||
Error *local_err = NULL;
|
||||
X86CPU *cpu = X86_CPU(dev);
|
||||
PCMachineState *pcms = PC_MACHINE(hotplug_dev);
|
||||
X86MachineState *x86ms = X86_MACHINE(pcms);
|
||||
X86MachineState *x86ms = X86_MACHINE(hotplug_dev);
|
||||
|
||||
if (pcms->acpi_dev) {
|
||||
hotplug_handler_plug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err);
|
||||
if (x86ms->acpi_dev) {
|
||||
hotplug_handler_plug(x86ms->acpi_dev, dev, &local_err);
|
||||
if (local_err) {
|
||||
goto out;
|
||||
}
|
||||
|
@ -1432,8 +1435,9 @@ static void pc_cpu_unplug_request_cb(HotplugHandler *hotplug_dev,
|
|||
int idx = -1;
|
||||
X86CPU *cpu = X86_CPU(dev);
|
||||
PCMachineState *pcms = PC_MACHINE(hotplug_dev);
|
||||
X86MachineState *x86ms = X86_MACHINE(hotplug_dev);
|
||||
|
||||
if (!pcms->acpi_dev) {
|
||||
if (!x86ms->acpi_dev) {
|
||||
error_setg(errp, "CPU hot unplug not supported without ACPI");
|
||||
return;
|
||||
}
|
||||
|
@ -1445,7 +1449,7 @@ static void pc_cpu_unplug_request_cb(HotplugHandler *hotplug_dev,
|
|||
return;
|
||||
}
|
||||
|
||||
hotplug_handler_unplug_request(HOTPLUG_HANDLER(pcms->acpi_dev), dev,
|
||||
hotplug_handler_unplug_request(x86ms->acpi_dev, dev,
|
||||
errp);
|
||||
}
|
||||
|
||||
|
@ -1456,9 +1460,9 @@ static void pc_cpu_unplug_cb(HotplugHandler *hotplug_dev,
|
|||
Error *local_err = NULL;
|
||||
X86CPU *cpu = X86_CPU(dev);
|
||||
PCMachineState *pcms = PC_MACHINE(hotplug_dev);
|
||||
X86MachineState *x86ms = X86_MACHINE(pcms);
|
||||
X86MachineState *x86ms = X86_MACHINE(hotplug_dev);
|
||||
|
||||
hotplug_handler_unplug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err);
|
||||
hotplug_handler_unplug(x86ms->acpi_dev, dev, &local_err);
|
||||
if (local_err) {
|
||||
goto out;
|
||||
}
|
||||
|
@ -1487,7 +1491,7 @@ static void pc_cpu_pre_plug(HotplugHandler *hotplug_dev,
|
|||
CPUX86State *env = &cpu->env;
|
||||
MachineState *ms = MACHINE(hotplug_dev);
|
||||
PCMachineState *pcms = PC_MACHINE(hotplug_dev);
|
||||
X86MachineState *x86ms = X86_MACHINE(pcms);
|
||||
X86MachineState *x86ms = X86_MACHINE(hotplug_dev);
|
||||
unsigned int smp_cores = ms->smp.cores;
|
||||
unsigned int smp_threads = ms->smp.threads;
|
||||
X86CPUTopoInfo topo_info;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue