[PATCH v3 1/3] powerpc: inline doorbell sending functions

Michael Ellerman mpe at ellerman.id.au
Sun Jul 26 23:47:16 AEST 2020


Nicholas Piggin <npiggin at gmail.com> writes:
> diff --git a/arch/powerpc/include/asm/dbell.h b/arch/powerpc/include/asm/dbell.h
> index 4ce6808deed3..1f04f3de96ba 100644
> --- a/arch/powerpc/include/asm/dbell.h
> +++ b/arch/powerpc/include/asm/dbell.h
> @@ -100,4 +102,63 @@ static inline void ppc_msgsnd(enum ppc_dbell type, u32 flags, u32 tag)
>  	_ppc_msgsnd(msg);
>  }
>  
> +#ifdef CONFIG_SMP
> +
> +/*
> + * Doorbells must only be used if CPU_FTR_DBELL is available.
> + * msgsnd is used in HV, and msgsndp is used in !HV.
> + *
> + * These should be used by platform code that is aware of restrictions.
> + * Other arch code should use ->cause_ipi.
> + *
> + * doorbell_global_ipi() sends a dbell to any target CPU.
> + * Must be used only by architectures that address msgsnd target
> + * by PIR/get_hard_smp_processor_id.
> + */
> +static inline void doorbell_global_ipi(int cpu)
> +{
> +	u32 tag = get_hard_smp_processor_id(cpu);
> +
> +	kvmppc_set_host_ipi(cpu);
> +	/* Order previous accesses vs. msgsnd, which is treated as a store */
> +	ppc_msgsnd_sync();
> +	ppc_msgsnd(PPC_DBELL_MSGTYPE, 0, tag);
> +}
> +
> +/*
> + * doorbell_core_ipi() sends a dbell to a target CPU in the same core.
> + * Must be used only by architectures that address msgsnd target
> + * by TIR/cpu_thread_in_core.
> + */
> +static inline void doorbell_core_ipi(int cpu)
> +{
> +	u32 tag = cpu_thread_in_core(cpu);

corenet64_smp_defconfig gives me:

  In file included from /linux/arch/powerpc/kernel/asm-offsets.c:38:
  /linux/arch/powerpc/include/asm/dbell.h: In function 'doorbell_core_ipi':
  /linux/arch/powerpc/include/asm/dbell.h:135:12: error: implicit declaration of function 'cpu_thread_in_core' [-Werror=implicit-function-declaration]
    135 |  u32 tag = cpu_thread_in_core(cpu);
        |            ^~~~~~~~~~~~~~~~~~


Fixed by including cputhreads.h, but then that results in errors due to
your addition of kvmppc_set_host_ipi().

Removing that gets us back to the fault_dear error.

I think I see a way around it, will do some build tests.

cheers


More information about the Linuxppc-dev mailing list