static void spapr_cpu_core_realize_child(Object *child, sPAPRMachineState *spapr, Error **errp) { Error *local_err = NULL; CPUState *cs = CPU(child); PowerPCCPU *cpu = POWERPC_CPU(cs); object_property_set_bool(child, true, "realized", &local_err); if (local_err) { goto error; } spapr_cpu_init(spapr, cpu, &local_err); if (local_err) { goto error; } cpu->intc = icp_create(child, spapr->icp_type, XICS_FABRIC(spapr), &local_err); if (local_err) { goto error; } return; error: error_propagate(errp, local_err); }
static void rtas_set_xive(PowerPCCPU *cpu, sPAPRMachineState *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { ICSState *ics = spapr->ics; uint32_t nr, srcno, server, priority; if ((nargs != 3) || (nret != 1)) { rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR); return; } if (!ics) { rtas_st(rets, 0, RTAS_OUT_HW_ERROR); return; } nr = rtas_ld(args, 0); server = rtas_ld(args, 1); priority = rtas_ld(args, 2); if (!ics_valid_irq(ics, nr) || !xics_icp_get(XICS_FABRIC(spapr), server) || (priority > 0xff)) { rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR); return; } srcno = nr - ics->offset; ics_simple_write_xive(ics, srcno, server, priority, priority); rtas_st(rets, 0, RTAS_OUT_SUCCESS); }
static void icp_realize(DeviceState *dev, Error **errp) { ICPState *icp = ICP(dev); PowerPCCPU *cpu; CPUPPCState *env; Object *obj; Error *err = NULL; obj = object_property_get_link(OBJECT(dev), ICP_PROP_XICS, &err); if (!obj) { error_propagate_prepend(errp, err, "required link '" ICP_PROP_XICS "' not found: "); return; } icp->xics = XICS_FABRIC(obj); obj = object_property_get_link(OBJECT(dev), ICP_PROP_CPU, &err); if (!obj) { error_propagate_prepend(errp, err, "required link '" ICP_PROP_CPU "' not found: "); return; } cpu = POWERPC_CPU(obj); icp->cs = CPU(obj); env = &cpu->env; switch (PPC_INPUT(env)) { case PPC_FLAGS_INPUT_POWER7: icp->output = env->irq_inputs[POWER7_INPUT_INT]; break; case PPC_FLAGS_INPUT_POWER9: /* For SPAPR xics emulation */ icp->output = env->irq_inputs[POWER9_INPUT_INT]; break; case PPC_FLAGS_INPUT_970: icp->output = env->irq_inputs[PPC970_INPUT_INT]; break; default: error_setg(errp, "XICS interrupt controller does not support this CPU bus model"); return; } if (kvm_irqchip_in_kernel()) { icp_kvm_realize(dev, &err); if (err) { error_propagate(errp, err); return; } } qemu_register_reset(icp_reset_handler, dev); vmstate_register(NULL, icp->cs->cpu_index, &vmstate_icp_server, icp); }
static target_ulong h_ipi(PowerPCCPU *cpu, sPAPRMachineState *spapr, target_ulong opcode, target_ulong *args) { target_ulong mfrr = args[1]; ICPState *icp = xics_icp_get(XICS_FABRIC(spapr), args[0]); if (!icp) { return H_PARAMETER; } icp_set_mfrr(icp, mfrr); return H_SUCCESS; }
static void icp_realize(DeviceState *dev, Error **errp) { ICPState *icp = ICP(dev); Object *obj; Error *err = NULL; obj = object_property_get_link(OBJECT(dev), "xics", &err); if (!obj) { error_setg(errp, "%s: required link 'xics' not found: %s", __func__, error_get_pretty(err)); return; } icp->xics = XICS_FABRIC(obj); qemu_register_reset(icp_reset, dev); }
static void ics_base_realize(DeviceState *dev, Error **errp) { ICSStateClass *icsc = ICS_BASE_GET_CLASS(dev); ICSState *ics = ICS_BASE(dev); Object *obj; Error *err = NULL; obj = object_property_get_link(OBJECT(dev), "xics", &err); if (!obj) { error_setg(errp, "%s: required link 'xics' not found: %s", __func__, error_get_pretty(err)); return; } ics->xics = XICS_FABRIC(obj); if (icsc->realize) { icsc->realize(dev, errp); } }
static void ics_base_realize(DeviceState *dev, Error **errp) { ICSState *ics = ICS_BASE(dev); Object *obj; Error *err = NULL; obj = object_property_get_link(OBJECT(dev), ICS_PROP_XICS, &err); if (!obj) { error_propagate_prepend(errp, err, "required link '" ICS_PROP_XICS "' not found: "); return; } ics->xics = XICS_FABRIC(obj); if (!ics->nr_irqs) { error_setg(errp, "Number of interrupts needs to be greater 0"); return; } ics->irqs = g_malloc0(ics->nr_irqs * sizeof(ICSIRQState)); }
static Object *spapr_irq_cpu_intc_create_xics(sPAPRMachineState *spapr, Object *cpu, Error **errp) { return icp_create(cpu, spapr->icp_type, XICS_FABRIC(spapr), errp); }