From: Michael Ellerman Date: Sun, 26 Jul 2020 13:47:16 +0000 Subject: Re: [PATCH v3 1/3] powerpc: inline doorbell sending functions Message-Id: <875zaagzh7.fsf@mpe.ellerman.id.au> List-Id: References: <20200726035155.1424103-1-npiggin@gmail.com> <20200726035155.1424103-2-npiggin@gmail.com> In-Reply-To: <20200726035155.1424103-2-npiggin@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Nicholas Piggin , linuxppc-dev@lists.ozlabs.org Cc: Nicholas Piggin , kvm-ppc@vger.kernel.org, Anton Blanchard , =?utf-8?Q?C=C3=A9dric?= Le Goater , David Gibson Nicholas Piggin 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