Re: [PATCH v3 07/11] kvm: arm64: Duplicate arm64_ssbd_callback_required for nVHE hyp

From: David Brazdil
Date: Tue Sep 22 2020 - 14:08:30 EST


> > u64 *ptr;
> >
> > - ptr = per_cpu_ptr(&arm64_ssbd_callback_required, cpu);
> > + ptr = per_cpu_ptr_nvhe(arm64_ssbd_callback_required, cpu);
> > err = create_hyp_mappings(ptr, ptr + 1, PAGE_HYP);
> > if (err)
> > return err;
> > +
> > + /* Copy value from kernel to hyp. */
> > + *ptr = per_cpu(arm64_ssbd_callback_required, cpu);
>
> Hmm. Is this correct for late arriving CPUs, where we don't know whether
> a callback is required at the point we do the copy?
>
> That sounds fiddly to resolve, but this _might_ all be moot because I'm
> about to post a series that allows us to remove the hyp mapping of this
> variable entirely. So leave this for now, but maybe stick a comment in
> that it doesn't work for late cpus.

Ah, good point. I'll move the value copy at the end of cpu_init_hyp_mode().
It must be known at that point. And if your series gets rid of this completely,
even better.