mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
kvm: x86: Introduce kvmclock device to save/restore its state
If kvmclock is used, which implies the kernel supports it, register a kvmclock device with the sysbus. Its main purpose is to save and restore the kernel state on migration, but this will also allow to visualize it one day. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> CC: Glauber Costa <glommer@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
This commit is contained in:
parent
6a7af8cb04
commit
0ec329dab9
4 changed files with 166 additions and 9 deletions
32
hw/pc_piix.c
32
hw/pc_piix.c
|
@ -32,6 +32,7 @@
|
|||
#include "boards.h"
|
||||
#include "ide.h"
|
||||
#include "kvm.h"
|
||||
#include "kvmclock.h"
|
||||
#include "sysemu.h"
|
||||
#include "sysbus.h"
|
||||
#include "arch_init.h"
|
||||
|
@ -66,7 +67,8 @@ static void pc_init1(ram_addr_t ram_size,
|
|||
const char *kernel_cmdline,
|
||||
const char *initrd_filename,
|
||||
const char *cpu_model,
|
||||
int pci_enabled)
|
||||
int pci_enabled,
|
||||
int kvmclock_enabled)
|
||||
{
|
||||
int i;
|
||||
ram_addr_t below_4g_mem_size, above_4g_mem_size;
|
||||
|
@ -86,6 +88,10 @@ static void pc_init1(ram_addr_t ram_size,
|
|||
|
||||
pc_cpus_init(cpu_model);
|
||||
|
||||
if (kvmclock_enabled) {
|
||||
kvmclock_create();
|
||||
}
|
||||
|
||||
/* allocate ram and load rom/bios */
|
||||
pc_memory_init(ram_size, kernel_filename, kernel_cmdline, initrd_filename,
|
||||
&below_4g_mem_size, &above_4g_mem_size);
|
||||
|
@ -193,7 +199,19 @@ static void pc_init_pci(ram_addr_t ram_size,
|
|||
{
|
||||
pc_init1(ram_size, boot_device,
|
||||
kernel_filename, kernel_cmdline,
|
||||
initrd_filename, cpu_model, 1);
|
||||
initrd_filename, cpu_model, 1, 1);
|
||||
}
|
||||
|
||||
static void pc_init_pci_no_kvmclock(ram_addr_t ram_size,
|
||||
const char *boot_device,
|
||||
const char *kernel_filename,
|
||||
const char *kernel_cmdline,
|
||||
const char *initrd_filename,
|
||||
const char *cpu_model)
|
||||
{
|
||||
pc_init1(ram_size, boot_device,
|
||||
kernel_filename, kernel_cmdline,
|
||||
initrd_filename, cpu_model, 1, 0);
|
||||
}
|
||||
|
||||
static void pc_init_isa(ram_addr_t ram_size,
|
||||
|
@ -207,7 +225,7 @@ static void pc_init_isa(ram_addr_t ram_size,
|
|||
cpu_model = "486";
|
||||
pc_init1(ram_size, boot_device,
|
||||
kernel_filename, kernel_cmdline,
|
||||
initrd_filename, cpu_model, 0);
|
||||
initrd_filename, cpu_model, 0, 1);
|
||||
}
|
||||
|
||||
static QEMUMachine pc_machine = {
|
||||
|
@ -222,7 +240,7 @@ static QEMUMachine pc_machine = {
|
|||
static QEMUMachine pc_machine_v0_13 = {
|
||||
.name = "pc-0.13",
|
||||
.desc = "Standard PC",
|
||||
.init = pc_init_pci,
|
||||
.init = pc_init_pci_no_kvmclock,
|
||||
.max_cpus = 255,
|
||||
.compat_props = (GlobalProperty[]) {
|
||||
{
|
||||
|
@ -249,7 +267,7 @@ static QEMUMachine pc_machine_v0_13 = {
|
|||
static QEMUMachine pc_machine_v0_12 = {
|
||||
.name = "pc-0.12",
|
||||
.desc = "Standard PC",
|
||||
.init = pc_init_pci,
|
||||
.init = pc_init_pci_no_kvmclock,
|
||||
.max_cpus = 255,
|
||||
.compat_props = (GlobalProperty[]) {
|
||||
{
|
||||
|
@ -280,7 +298,7 @@ static QEMUMachine pc_machine_v0_12 = {
|
|||
static QEMUMachine pc_machine_v0_11 = {
|
||||
.name = "pc-0.11",
|
||||
.desc = "Standard PC, qemu 0.11",
|
||||
.init = pc_init_pci,
|
||||
.init = pc_init_pci_no_kvmclock,
|
||||
.max_cpus = 255,
|
||||
.compat_props = (GlobalProperty[]) {
|
||||
{
|
||||
|
@ -319,7 +337,7 @@ static QEMUMachine pc_machine_v0_11 = {
|
|||
static QEMUMachine pc_machine_v0_10 = {
|
||||
.name = "pc-0.10",
|
||||
.desc = "Standard PC, qemu 0.10",
|
||||
.init = pc_init_pci,
|
||||
.init = pc_init_pci_no_kvmclock,
|
||||
.max_cpus = 255,
|
||||
.compat_props = (GlobalProperty[]) {
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue