Exemplo n.º 1
0
static void rtas_set_xive(struct kvm_cpu *vcpu, uint32_t token,
			  uint32_t nargs, target_ulong args,
			  uint32_t nret, target_ulong rets)
{
	struct ics_state *ics = vcpu->kvm->icp->ics;
	uint32_t nr, server, priority;

	if ((nargs != 3) || (nret != 1)) {
		rtas_st(vcpu->kvm, rets, 0, -3);
		return;
	}

	nr = rtas_ld(vcpu->kvm, args, 0);
	server = rtas_ld(vcpu->kvm, args, 1);
	priority = rtas_ld(vcpu->kvm, args, 2);

	xics_dprintf("rtas_set_xive(%x,%x,%x)\n", nr, server, priority);
	if (!ics_valid_irq(ics, nr) || (server >= ics->icp->nr_servers)
	    || (priority > 0xff)) {
		rtas_st(vcpu->kvm, rets, 0, -3);
		return;
	}

	ics_write_xive_msi(ics, nr, server, priority);

	rtas_st(vcpu->kvm, rets, 0, 0); /* Success */
}
Exemplo n.º 2
0
static void rtas_int_on(sPAPREnvironment *spapr, uint32_t token,
                        uint32_t nargs, target_ulong args,
                        uint32_t nret, target_ulong rets)
{
    struct ics_state *ics = spapr->icp->ics;
    uint32_t nr;

    if ((nargs != 1) || (nret != 1)) {
        rtas_st(rets, 0, -3);
        return;
    }

    nr = rtas_ld(args, 0);

    if (!ics_valid_irq(ics, nr)) {
        rtas_st(rets, 0, -3);
        return;
    }

    /* This is a NOP for now, since the described PAPR semantics don't
     * seem to gel with what Linux does */
#if 0
    struct ics_irq_state *irq = xics->irqs + (nr - xics->offset);

    ics_write_xive_msi(xics, nr, irq->server, irq->saved_priority);
#endif

    rtas_st(rets, 0, 0); /* Success */
}