• Marc Zyngier's avatar
    arm64: KVM: VHE: Introduce unified system register accessors · 915ccd1d
    Marc Zyngier authored
    VHE brings its own bag of new system registers, or rather system
    register accessors, as it define new ways to access both guest
    and host system registers. For example, from the host:
    
    - The host TCR_EL2 register is accessed using the TCR_EL1 accessor
    - The guest TCR_EL1 register is accessed using the TCR_EL12 accessor
    
    Obviously, this is confusing. A way to somehow reduce the complexity
    of writing code for both ARMv8 and ARMv8.1 is to use a set of unified
    accessors that will generate the right sysreg, depending on the mode
    the CPU is running in. For example:
    
    - read_sysreg_el1(tcr) will use TCR_EL1 on ARMv8, and TCR_EL12 on
      ARMv8.1 with VHE.
    - read_sysreg_el2(tcr) will use TCR_EL2 on ARMv8, and TCR_EL1 on
      ARMv8.1 with VHE.
    
    We end up with three sets of accessors ({read,write}_sysreg_el[012])
    that can be directly used from C code. We take this opportunity to
    also add the definition for the new VHE sysregs.
    Reviewed-by: default avatarChristoffer Dall <christoffer.dall@linaro.org>
    Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
    915ccd1d
hyp.h 6.19 KB