All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] spapr: ensure we have at least one XICS server
@ 2015-05-13 10:29 Greg Kurz
  2015-05-25  1:30 ` David Gibson
  0 siblings, 1 reply; 2+ messages in thread
From: Greg Kurz @ 2015-05-13 10:29 UTC (permalink / raw)
  To: David Gibson; +Cc: qemu-ppc, qemu-devel, bharata

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 <gkurz@linux.vnet.ibm.com>
---
 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 35dca77..92916df 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1475,7 +1475,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 */

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-05-25  1:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-13 10:29 [Qemu-devel] [PATCH] spapr: ensure we have at least one XICS server Greg Kurz
2015-05-25  1:30 ` David Gibson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.