From 61817f003f2680acc0e62623d18ac7217be0f4e2 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Fri, 24 Jul 2015 05:26:07 +0200 Subject: [PATCH 45/58] spapr: ensure we have at least one XICS server Message-id: <1437715580-14817-16-git-send-email-dgibson@redhat.com> Patchwork-id: 67132 O-Subject: [RHEL7.2 qemu-kvm-rhev PATCHv3 15/28] spapr: ensure we have at least one XICS server Bugzilla: 1211117 RH-Acked-by: Laurent Vivier RH-Acked-by: Igor Mammedov RH-Acked-by: Laszlo Ersek XICS needs to know the upper value for cpu_index as it is used to compute the number of servers: smp_cpus * kvmppc_smt_threads() / smp_threads When passing -smp cpus=1,threads=9 on a POWER8 host, we end up with: 1 * 8 / 9 = 0 ... which leads to an assertion in both emulated: Number of servers needs to be greater 0 Aborted (core dumped) ... and in-kernel XICS: xics_kvm_realize: Assertion `icp->nr_servers' failed. Aborted (core dumped) With this patch, we are sure that nr_servers > 0. Passing the same bogus -smp option then leads to: qemu-system-ppc64: Cannot support more than 8 threads on PPC with KVM ... which is a lot more explicit than the XICS errors. Signed-off-by: Greg Kurz Signed-off-by: David Gibson Signed-off-by: Alexander Graf (cherry picked from commit f303f117fec32c0705f88860e3eadf94135211c9) Signed-off-by: David Gibson Signed-off-by: Miroslav Rezanina --- hw/ppc/spapr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index bde9415..e5f1d39 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1454,7 +1454,8 @@ static void ppc_spapr_init(MachineState *machine) /* Set up Interrupt Controller before we create the VCPUs */ spapr->icp = xics_system_init(machine, - smp_cpus * kvmppc_smt_threads() / smp_threads, + DIV_ROUND_UP(smp_cpus * kvmppc_smt_threads(), + smp_threads), XICS_IRQS); /* init CPUs */ -- 1.8.3.1