• Marc Zyngier's avatar
    arm64: KVM: Cleanup tpidr_el2 init on non-VHE · 9bc03f1d
    Marc Zyngier authored
    When running on a non-VHE system, we initialize tpidr_el2 to
    contain the per-CPU offset required to reach per-cpu variables.
    
    Actually, we initialize it twice: the first time as part of the
    EL2 initialization, by copying tpidr_el1 into its el2 counterpart,
    and another time by calling into __kvm_set_tpidr_el2.
    
    It turns out that the first part is wrong, as it includes the
    distance between the kernel mapping and the linear mapping, while
    EL2 only cares about the linear mapping. This was the last vestige
    of the first per-cpu use of tpidr_el2 that came in with SDEI.
    The only caller then was hyp_panic(), and its now using the
    pc-relative get_host_ctxt() stuff, instead of kimage addresses
    from the literal pool.
    
    It is not a big deal, as we override it straight away, but it is
    slightly confusing. In order to clear said confusion, let's
    set this directly as part of the hyp-init code, and drop the
    ad-hoc HYP helper.
    Reviewed-by: default avatarJames Morse <james.morse@arm.com>
    Acked-by: default avatarChristoffer Dall <christoffer.dall@arm.com>
    Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
    9bc03f1d
hyp-init.S 4.03 KB