• Marc Zyngier's avatar
    KVM: arm64: nv: Add trap forwarding infrastructure · e58ec47b
    Marc Zyngier authored
    A significant part of what a NV hypervisor needs to do is to decide
    whether a trap from a L2+ guest has to be forwarded to a L1 guest
    or handled locally. This is done by checking for the trap bits that
    the guest hypervisor has set and acting accordingly, as described by
    the architecture.
    
    A previous approach was to sprinkle a bunch of checks in all the
    system register accessors, but this is pretty error prone and doesn't
    help getting an overview of what is happening.
    
    Instead, implement a set of global tables that describe a trap bit,
    combinations of trap bits, behaviours on trap, and what bits must
    be evaluated on a system register trap.
    
    Although this is painful to describe, this allows to specify each
    and every control bit in a static manner. To make it efficient,
    the table is inserted in an xarray that is global to the system,
    and checked each time we trap a system register while running
    a L2 guest.
    
    Add the basic infrastructure for now, while additional patches will
    implement configuration registers.
    Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
    Reviewed-by: default avatarJing Zhang <jingzhangos@google.com>
    Reviewed-by: default avatarMiguel Luis <miguel.luis@oracle.com>
    Link: https://lore.kernel.org/r/20230815183903.2735724-15-maz@kernel.org
    e58ec47b
trace_arm.h 9.73 KB