Upstream is moving towards this mechanism, so start using it in qemu-kvm
already to configure the specific defaults: kvm enabled on, just like
in-kernel irqchips.
Signed-off-by: Jan Kiszka <jan.kiszka@xxxxxxxxxxx>
---
hw/pc_piix.c | 7 +++++++
kvm-all.c | 8 ++++++++
vl.c | 9 +++------
3 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/hw/pc_piix.c b/hw/pc_piix.c
index c9c580c..156fcc8 100644
--- a/hw/pc_piix.c
+++ b/hw/pc_piix.c
@@ -394,6 +394,7 @@ static QEMUMachine pc_machine_v1_0 = {
.init = pc_init_pci,
.max_cpus = 255,
.is_default = 1,
+ .default_machine_opts = "accel=kvm,kernel_irqchip=on",
};
static QEMUMachine pc_machine_v0_15 = {
@@ -409,6 +410,7 @@ static QEMUMachine pc_machine_v0_14 = {
.desc = "Standard PC",
.init = pc_init_pci,
.max_cpus = 255,
+ .default_machine_opts = "accel=kvm,kernel_irqchip=on",
.compat_props = (GlobalProperty[]) {
{
.driver = "qxl",
@@ -444,6 +446,7 @@ static QEMUMachine pc_machine_v0_13 = {
.desc = "Standard PC",
.init = pc_init_pci_no_kvmclock,
.max_cpus = 255,
+ .default_machine_opts = "accel=kvm,kernel_irqchip=on",
.compat_props = (GlobalProperty[]) {
{
.driver = "virtio-9p-pci",
@@ -491,6 +494,7 @@ static QEMUMachine pc_machine_v0_12 = {
.desc = "Standard PC",
.init = pc_init_pci_no_kvmclock,
.max_cpus = 255,
+ .default_machine_opts = "accel=kvm,kernel_irqchip=on",
.compat_props = (GlobalProperty[]) {
{
.driver = "virtio-serial-pci",
@@ -542,6 +546,7 @@ static QEMUMachine pc_machine_v0_11 = {
.desc = "Standard PC, qemu 0.11",
.init = pc_init_pci_no_kvmclock,
.max_cpus = 255,
+ .default_machine_opts = "accel=kvm,kernel_irqchip=on",
.compat_props = (GlobalProperty[]) {
{
.driver = "virtio-blk-pci",
@@ -601,6 +606,7 @@ static QEMUMachine pc_machine_v0_10 = {
.desc = "Standard PC, qemu 0.10",
.init = pc_init_pci_no_kvmclock,
.max_cpus = 255,
+ .default_machine_opts = "accel=kvm,kernel_irqchip=on",
.compat_props = (GlobalProperty[]) {
{
.driver = "virtio-blk-pci",
@@ -672,6 +678,7 @@ static QEMUMachine isapc_machine = {
.desc = "ISA-only PC",
.init = pc_init_isa,
.max_cpus = 1,
+ .default_machine_opts = "accel=kvm,kernel_irqchip=on",
};
#ifdef CONFIG_XEN
diff --git a/kvm-all.c b/kvm-all.c
index ae89389..515ba6e 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -887,6 +887,7 @@ int kvm_init(void)
const KVMCapabilityInfo *missing_cap;
int ret;
int i;
+ QemuOptsList *list;
s = g_malloc0(sizeof(KVMState));
@@ -973,6 +974,13 @@ int kvm_init(void)
s->pit_state2 = kvm_check_extension(s, KVM_CAP_PIT_STATE2);
#endif
+ list = qemu_find_opts("machine");
+ if (!QTAILQ_EMPTY(&list->head) &&
+ !qemu_opt_get_bool(QTAILQ_FIRST(&list->head),
+ "kernel_irqchip", false)) {
+ kvm_irqchip = 0;
+ }
+
ret = kvm_arch_init(s);
if (ret < 0) {
goto err;
diff --git a/vl.c b/vl.c
index c5994ee..c3b4037 100644
--- a/vl.c
+++ b/vl.c
@@ -2040,13 +2040,8 @@ static int configure_accelerator(void)
}
if (p == NULL) {
-#ifdef CONFIG_KVM_OPTIONS
- /* Use the default "accelerator", kvm */
- p = "kvm";
-#else
/* Use the default "accelerator", tcg */
p = "tcg";
-#endif
}
while (!accel_initalised && *p != '\0') {
@@ -2908,7 +2903,9 @@ int main(int argc, char **argv, char **envp)
break;
#ifdef CONFIG_KVM_OPTIONS
case QEMU_OPTION_no_kvm_irqchip: {
- kvm_irqchip = 0;
+ olist = qemu_find_opts("machine");
+ qemu_opts_reset(olist);
+ qemu_opts_parse(olist, "accel=kvm,kernel_irqchip=off", 0);
break;
}
case QEMU_OPTION_no_kvm_pit: {
--
1.7.3.4
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[KVM ARM]
[KVM ia64]
[KVM ppc]
[Spice Development]
[Libvirt]
[Libvirt Users]
[Linux USB Devel]
[Video for Linux]
[Linux Audio Users]
[Photo]
[Yosemite News]
[Yosemite Photos]
[Linux Kernel]
[Linux SCSI]
[XFree86]