spapr: Forbid setting ic-mode for old machine types
authorGreg Kurz <groug@kaod.org>
Thu, 17 Jan 2019 11:06:38 +0000 (12:06 +0100)
committerDavid Gibson <david@gibson.dropbear.id.au>
Mon, 4 Feb 2019 07:44:18 +0000 (18:44 +1100)
Machine types 3.0 and older only know about the legacy XICS backend.
Make it clear by erroring out if the user tries to set ic-mode on
such machines.

Signed-off-by: Greg Kurz <groug@kaod.org>
Tested-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
hw/ppc/spapr.c

index 71fe552c8329498976983cfb6aba90cab8f476e4..a217c7f7a6503487ef5fcc3fcf436353710b0c90 100644 (file)
@@ -3127,6 +3127,11 @@ static void spapr_set_ic_mode(Object *obj, const char *value, Error **errp)
 {
     sPAPRMachineState *spapr = SPAPR_MACHINE(obj);
 
+    if (SPAPR_MACHINE_GET_CLASS(spapr)->legacy_irq_allocation) {
+        error_setg(errp, "This machine only uses the legacy XICS backend, don't pass ic-mode");
+        return;
+    }
+
     /* The legacy IRQ backend can not be set */
     if (strcmp(value, "xics") == 0) {
         spapr->irq = &spapr_irq_xics;