yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
Blob Blame History Raw
From bc949bc00c11f49ba6be7be5b4f1bfc7df93aad5 Mon Sep 17 00:00:00 2001
From: Marcelo Tosatti <mtosatti@redhat.com>
Date: Wed, 9 Jul 2014 13:17:15 +0200
Subject: [PATCH 04/13] exit when -no-kvm and vcpu count > 160

Message-id: <20140506072044.GA25261@amt.cnet>
Patchwork-id: 58695
O-Subject: [RHEL7 qemu-kvm PATCH] exit when -no-kvm and vcpu count > 160
Bugzilla: 1076326
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Andrew Jones <drjones@redhat.com>
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>

Exit when booting with -no-kvm and number of vcpus is
larger than 160.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
BZ: 1076326
---
 hw/i386/pc_piix.c    |   14 +++++++-------
 hw/i386/pc_q35.c     |    2 +-
 include/hw/i386/pc.h |    2 ++
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index aeec6f2..550acd8 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -788,7 +788,7 @@ static QEMUMachine pc_machine_rhel700 = {
     .desc = "RHEL 7.0.0 PC (i440FX + PIIX, 1996)",
     .init = pc_init_rhel700,
     .hot_add_cpu = pc_hot_add_cpu,
-    .max_cpus = 255,
+    .max_cpus = RHEL_MAX_CPUS,
     .is_default = 1,
     .default_machine_opts = "firmware=bios-256k.bin",
     DEFAULT_MACHINE_OPTIONS,
@@ -969,7 +969,7 @@ static QEMUMachine pc_machine_rhel650 = {
     .desc = "RHEL 6.5.0 PC",
     .init = pc_init_rhel650,
     .hot_add_cpu = pc_hot_add_cpu,
-    .max_cpus = 255,
+    .max_cpus = RHEL_MAX_CPUS,
     .compat_props = (GlobalProperty[]) {
         PC_RHEL6_5_COMPAT,
         { /* end of list */ }
@@ -1018,7 +1018,7 @@ static QEMUMachine pc_machine_rhel640 = {
     .desc = "RHEL 6.4.0 PC",
     .init = pc_init_rhel640,
     .hot_add_cpu = pc_hot_add_cpu,
-    .max_cpus = 255,
+    .max_cpus = RHEL_MAX_CPUS,
     .compat_props = (GlobalProperty[]) {
         PC_RHEL6_4_COMPAT,
         { /* end of list */ }
@@ -1094,7 +1094,7 @@ static QEMUMachine pc_machine_rhel630 = {
     .desc = "RHEL 6.3.0 PC",
     .init = pc_init_rhel630,
     .hot_add_cpu = pc_hot_add_cpu,
-    .max_cpus = 255,
+    .max_cpus = RHEL_MAX_CPUS,
     .compat_props = (GlobalProperty[]) {
         PC_RHEL6_3_COMPAT,
         { /* end of list */ }
@@ -1126,7 +1126,7 @@ static QEMUMachine pc_machine_rhel620 = {
     .desc = "RHEL 6.2.0 PC",
     .init = pc_init_rhel620,
     .hot_add_cpu = pc_hot_add_cpu,
-    .max_cpus = 255,
+    .max_cpus = RHEL_MAX_CPUS,
     .compat_props = (GlobalProperty[]) {
         PC_RHEL6_2_COMPAT,
         { /* end of list */ }
@@ -1199,7 +1199,7 @@ static QEMUMachine pc_machine_rhel610 = {
     .desc = "RHEL 6.1.0 PC",
     .init = pc_init_rhel610,
     .hot_add_cpu = pc_hot_add_cpu,
-    .max_cpus = 255,
+    .max_cpus = RHEL_MAX_CPUS,
     .compat_props = (GlobalProperty[]) {
         PC_RHEL6_1_COMPAT,
         { /* end of list */ }
@@ -1239,7 +1239,7 @@ static QEMUMachine pc_machine_rhel600 = {
     .desc = "RHEL 6.0.0 PC",
     .init = pc_init_rhel600,
     .hot_add_cpu = pc_hot_add_cpu,
-    .max_cpus = 255,
+    .max_cpus = RHEL_MAX_CPUS,
     .compat_props = (GlobalProperty[]) {
         PC_RHEL6_0_COMPAT,
         { /* end of list */ }
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 1aa8bde..4534539 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -311,7 +311,7 @@ static QEMUMachine pc_q35_machine_rhel700 = {
     .desc = "RHEL-7.0.0 PC (Q35 + ICH9, 2009)",
     .init = pc_q35_init_rhel700,
     .hot_add_cpu = pc_hot_add_cpu,
-    .max_cpus = 255,
+    .max_cpus = RHEL_MAX_CPUS,
     .default_machine_opts = "firmware=bios-256k.bin",
     DEFAULT_MACHINE_OPTIONS,
 };
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 8a69347..57e2f93 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -15,6 +15,8 @@
 #include "sysemu/sysemu.h"
 #include "hw/pci/pci.h"
 
+#define RHEL_MAX_CPUS 160
+
 /* PC-style peripherals (also used by other machines).  */
 
 typedef struct PcPciInfo {
-- 
1.7.1