hw/i386: Use device_cold_reset() to reset the APIC
PATCH 1/1 hw/i386: Use device_cold_reset() to reset the APIC
The semantic difference between the deprecated device_legacy_reset() function and the newer device_cold_reset() function is that the new function resets both the device itself and any qbuses it owns, whereas the legacy function resets just the device itself and nothing else.
The pc_machine_reset() and microvm_machine_reset() functions use device_legacy_reset() to reset the APIC; this is an APICCommonState and does not have any qbuses, so for this purpose the two functions behave identically and we can stop using the deprecated one.
---
NB: tested only with 'make check' and 'make check-avocado'
hw/i386/microvm.c | 2 +- hw/i386/pc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
hw/i386/microvm.c +1 -1
@@ -486,7 +486,7 @@ static void microvm_machine_reset(MachineState *machine) cpu =X86_CPU (cs);if (cpu->apic_state) { -device_legacy_reset (cpu->apic_state); +device_cold_reset (cpu->apic_state); } } }
hw/i386/pc.c +1 -1
@@ -1860,7 +1860,7 @@ static void pc_machine_reset(MachineState *machine) cpu =X86_CPU (cs);if (cpu->apic_state) { -device_legacy_reset (cpu->apic_state); +device_cold_reset (cpu->apic_state); } } }
Signature · 1 line
2.25.1
Quoted 6 lines · Peter Maydell
The semantic difference between the deprecated
device_legacy_reset()function and the newerdevice_cold_reset()function is that the new function resets both the device itself and any qbuses it owns, whereas the legacy function resets just the device itself and nothing else.
Quoted 6 lines
The
pc_machine_reset()andmicrovm_machine_reset()functions usedevice_legacy_reset()to reset the APIC; this is an APICCommonState and does not have any qbuses, so for this purpose the two functions behave identically and we can stop using the deprecated one.Signed-off-by Peter Maydell <[email protected]>
Quoted 35 lines
---
NB: tested only with 'make check' and 'make check-avocado'hw/i386/microvm.c | 2 +- hw/i386/pc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)hw/i386/microvm.c +1
-1@@ -486,7 +486,7 @@ static void microvm_machine_reset(MachineState *machine) cpu =X86_CPU (cs);if (cpu->apic_state) { -device_legacy_reset (cpu->apic_state); +device_cold_reset (cpu->apic_state); } } }hw/i386/pc.c +1
-1@@ -1860,7 +1860,7 @@ static void pc_machine_reset(MachineState *machine) cpu =X86_CPU (cs);if (cpu->apic_state) { -device_legacy_reset (cpu->apic_state); +device_cold_reset (cpu->apic_state); } } }Signature · 1 line
2.25.1
This conflicts with "hyperv: fix SynIC SINT assertion failure on guest reset", but the resolution is simply to do the change in a new function x86_cpu_after_reset(); adjusted and queued, thanks.
Paolo