powerpc: Reintroduce is_kvm_guest() as a fast-path check
[ Upstream commit a21d1becaa ]
Introduce a static branch that would be set during boot if the OS
happens to be a KVM guest. Subsequent checks to see if we are on KVM
will rely on this static branch. This static branch would be used in
vcpu_is_preempted() in a subsequent patch.
Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Acked-by: Waiman Long <longman@redhat.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20201202050456.164005-4-srikar@linux.vnet.ibm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
113207234a
commit
e01a4d7560
@@ -22,6 +22,7 @@ EXPORT_SYMBOL_GPL(powerpc_firmware_features);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_KVM_GUEST)
|
||||
DEFINE_STATIC_KEY_FALSE(kvm_guest);
|
||||
bool check_kvm_guest(void)
|
||||
{
|
||||
struct device_node *hyper_node;
|
||||
@@ -33,6 +34,7 @@ bool check_kvm_guest(void)
|
||||
if (!of_device_is_compatible(hyper_node, "linux,kvm"))
|
||||
return false;
|
||||
|
||||
static_branch_enable(&kvm_guest);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user