Esempio n. 1
0
void vpa_init(int cpu)
{
    int hwcpu = get_hard_smp_processor_id(cpu);
    unsigned long addr;
    long ret;
    struct paca_struct *pp;
    struct dtl_entry *dtl;

    if (cpu_has_feature(CPU_FTR_ALTIVEC))
        lppaca_of(cpu).vmxregs_in_use = 1;

    if (cpu_has_feature(CPU_FTR_ARCH_207S))
        lppaca_of(cpu).ebb_regs_in_use = 1;

    addr = __pa(&lppaca_of(cpu));
    ret = register_vpa(hwcpu, addr);

    if (ret) {
        pr_err("WARNING: VPA registration for cpu %d (hw %d) of area "
               "%lx failed with %ld\n", cpu, hwcpu, addr, ret);
        return;
    }
    /*
     * PAPR says this feature is SLB-Buffer but firmware never
     * reports that.  All SPLPAR support SLB shadow buffer.
     */
    addr = __pa(&slb_shadow[cpu]);
    if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
        ret = register_slb_shadow(hwcpu, addr);
        if (ret)
            pr_err("WARNING: SLB shadow buffer registration for "
                   "cpu %d (hw %d) of area %lx failed with %ld\n",
                   cpu, hwcpu, addr, ret);
    }

    /*
     * Register dispatch trace log, if one has been allocated.
     */
    pp = &paca[cpu];
    dtl = pp->dispatch_log;
    if (dtl) {
        pp->dtl_ridx = 0;
        pp->dtl_curr = dtl;
        lppaca_of(cpu).dtl_idx = 0;

        /* hypervisor reads buffer length from this field */
        dtl->enqueue_to_dispatch_time = DISPATCH_LOG_BYTES;
        ret = register_dtl(hwcpu, __pa(dtl));
        if (ret)
            pr_err("WARNING: DTL registration of cpu %d (hw %d) "
                   "failed with %ld\n", smp_processor_id(),
                   hwcpu, ret);
        lppaca_of(cpu).dtl_enable_mask = 2;
    }
}
Esempio n. 2
0
void vpa_init(int cpu)
{
	int hwcpu = get_hard_smp_processor_id(cpu);
	unsigned long addr;
	long ret;
	struct paca_struct *pp;
	struct dtl_entry *dtl;

	/*
	 * The spec says it "may be problematic" if CPU x registers the VPA of
	 * CPU y. We should never do that, but wail if we ever do.
	 */
	WARN_ON(cpu != smp_processor_id());

	if (cpu_has_feature(CPU_FTR_ALTIVEC))
		lppaca_of(cpu).vmxregs_in_use = 1;

	if (cpu_has_feature(CPU_FTR_ARCH_207S))
		lppaca_of(cpu).ebb_regs_in_use = 1;

	addr = __pa(&lppaca_of(cpu));
	ret = register_vpa(hwcpu, addr);

	if (ret) {
		pr_err("WARNING: VPA registration for cpu %d (hw %d) of area "
		       "%lx failed with %ld\n", cpu, hwcpu, addr, ret);
		return;
	}

#ifdef CONFIG_PPC_BOOK3S_64
	/*
	 * PAPR says this feature is SLB-Buffer but firmware never
	 * reports that.  All SPLPAR support SLB shadow buffer.
	 */
	if (!radix_enabled() && firmware_has_feature(FW_FEATURE_SPLPAR)) {
		addr = __pa(paca_ptrs[cpu]->slb_shadow_ptr);
		ret = register_slb_shadow(hwcpu, addr);
		if (ret)
			pr_err("WARNING: SLB shadow buffer registration for "
			       "cpu %d (hw %d) of area %lx failed with %ld\n",
			       cpu, hwcpu, addr, ret);
	}
#endif /* CONFIG_PPC_BOOK3S_64 */

	/*
	 * Register dispatch trace log, if one has been allocated.
	 */
	pp = paca_ptrs[cpu];
	dtl = pp->dispatch_log;
	if (dtl) {
		pp->dtl_ridx = 0;
		pp->dtl_curr = dtl;
		lppaca_of(cpu).dtl_idx = 0;

		/* hypervisor reads buffer length from this field */
		dtl->enqueue_to_dispatch_time = cpu_to_be32(DISPATCH_LOG_BYTES);
		ret = register_dtl(hwcpu, __pa(dtl));
		if (ret)
			pr_err("WARNING: DTL registration of cpu %d (hw %d) "
			       "failed with %ld\n", smp_processor_id(),
			       hwcpu, ret);
		lppaca_of(cpu).dtl_enable_mask = 2;
	}
}