Skip to content
Commit 627778bf authored by Binbin Wu's avatar Binbin Wu Committed by Sean Christopherson
Browse files

KVM: SVM: Use kvm_is_cr4_bit_set() to query SMAP/SMEP in "can emulate"



Use kvm_is_cr4_bit_set() to query SMAP and SMEP when determining whether
or not AMD's SMAP+SEV errata prevents KVM from emulating an instruction.
This eliminates an implicit cast from ulong to bool and makes the code
slightly more readable.

Note, any overhead from making multiple calls to kvm_read_cr4_bits() is
negligible, not to mention the code is question is encountered only in
rare situations, i.e. is not a remotely hot path.

Suggested-by: default avatarSean Christopherson <seanjc@google.com>
Signed-off-by: default avatarBinbin Wu <binbin.wu@linux.intel.com>
Link: https://lore.kernel.org/r/20230322045824.22970-4-binbin.wu@linux.intel.com


[sean: keep local smap/smep variables, massage changelog]
Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
parent bede6eb4
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment