-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
arm/arm64: KVM: Add PSCI version selection API
commit 85bd0ba upstream. Although we've implemented PSCI 0.1, 0.2 and 1.0, we expose either 0.1 or 1.0 to a guest, defaulting to the latest version of the PSCI implementation that is compatible with the requested version. This is no different from doing a firmware upgrade on KVM. But in order to give a chance to hypothetical badly implemented guests that would have a fit by discovering something other than PSCI 0.2, let's provide a new API that allows userspace to pick one particular version of the API. This is implemented as a new class of "firmware" registers, where we expose the PSCI version. This allows the PSCI version to be save/restored as part of a guest migration, and also set to any supported version if the guest requires it. Cc: stable@vger.kernel.org #4.16 Reviewed-by: Christoffer Dall <cdall@kernel.org> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
- Loading branch information
Showing
10 changed files
with
156 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
KVM implements the PSCI (Power State Coordination Interface) | ||
specification in order to provide services such as CPU on/off, reset | ||
and power-off to the guest. | ||
|
||
The PSCI specification is regularly updated to provide new features, | ||
and KVM implements these updates if they make sense from a virtualization | ||
point of view. | ||
|
||
This means that a guest booted on two different versions of KVM can | ||
observe two different "firmware" revisions. This could cause issues if | ||
a given guest is tied to a particular PSCI revision (unlikely), or if | ||
a migration causes a different PSCI version to be exposed out of the | ||
blue to an unsuspecting guest. | ||
|
||
In order to remedy this situation, KVM exposes a set of "firmware | ||
pseudo-registers" that can be manipulated using the GET/SET_ONE_REG | ||
interface. These registers can be saved/restored by userspace, and set | ||
to a convenient value if required. | ||
|
||
The following register is defined: | ||
|
||
* KVM_REG_ARM_PSCI_VERSION: | ||
|
||
- Only valid if the vcpu has the KVM_ARM_VCPU_PSCI_0_2 feature set | ||
(and thus has already been initialized) | ||
- Returns the current PSCI version on GET_ONE_REG (defaulting to the | ||
highest PSCI version implemented by KVM and compatible with v0.2) | ||
- Allows any PSCI version implemented by KVM and compatible with | ||
v0.2 to be set with SET_ONE_REG | ||
- Affects the whole VM (even if the register view is per-vcpu) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters