• J
    MIPS: KVM: Consult HWREna before emulating RDHWR · 26f4f3b5
    James Hogan 提交于
    The ability to read hardware registers from userland with the RDHWR
    instruction should depend upon the corresponding bit of the HWREna
    register being set, otherwise a reserved instruction exception should be
    generated.
    
    However KVM's current emulation ignores the guest's HWREna and always
    emulates RDHWR instructions even if the guest OS has disallowed them.
    
    Therefore rework the RDHWR emulation code to check for privilege or the
    corresponding bit in the guest HWREna bit. Also remove the #if 0 case
    for the UserLocal register. I presume it was there for debug purposes
    but it seems unnecessary now that the guest can control whether it
    causes a guest exception.
    Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
    Cc: Ralf Baechle <ralf@linux-mips.org>
    Cc: Gleb Natapov <gleb@kernel.org>
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Cc: Sanjay Lal <sanjayl@kymasys.com>
    Cc: linux-mips@linux-mips.org
    Cc: kvm@vger.kernel.org
    Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
    26f4f3b5
kvm_host.h 21.5 KB