Skip to content

Commit 55f4b21

Browse files
jgoulywilldeacon
authored andcommitted
KVM: arm64: use at s1e1a for POE
FEAT_ATS1E1A introduces a new instruction: `at s1e1a`. This is an address translation, without permission checks. POE allows read permissions to be removed from S1 by the guest. This means that an `at` instruction could fail, and not get the IPA. Switch to using `at s1e1a` so that KVM can get the IPA regardless of S1 permissions. Signed-off-by: Joey Gouly <[email protected]> Cc: Marc Zyngier <[email protected]> Cc: Oliver Upton <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Will Deacon <[email protected]> Reviewed-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent b86c9be commit 55f4b21

File tree

1 file changed

+4
-1
lines changed
  • arch/arm64/kvm/hyp/include/hyp

1 file changed

+4
-1
lines changed

arch/arm64/kvm/hyp/include/hyp/fault.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
static inline bool __translate_far_to_hpfar(u64 far, u64 *hpfar)
1616
{
17+
int ret;
1718
u64 par, tmp;
1819

1920
/*
@@ -27,7 +28,9 @@ static inline bool __translate_far_to_hpfar(u64 far, u64 *hpfar)
2728
* saved the guest context yet, and we may return early...
2829
*/
2930
par = read_sysreg_par();
30-
if (!__kvm_at(OP_AT_S1E1R, far))
31+
ret = system_supports_poe() ? __kvm_at(OP_AT_S1E1A, far) :
32+
__kvm_at(OP_AT_S1E1R, far);
33+
if (!ret)
3134
tmp = read_sysreg_par();
3235
else
3336
tmp = SYS_PAR_EL1_F; /* back to the guest */

0 commit comments

Comments
 (0)