Skip to content

Commit 846c993

Browse files
Marc Zyngieroupton
authored andcommitted
KVM: arm64: Add POE save/restore for AT emulation fast-path
Just like the other extensions affecting address translation, we must save/restore POE so that an out-of-context translation context can be restored and used with the AT instructions. Signed-off-by: Marc Zyngier <[email protected]> Reviewed-by: Joey Gouly <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Oliver Upton <[email protected]>
1 parent de5c282 commit 846c993

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

arch/arm64/kvm/at.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,8 @@ struct mmu_config {
440440
u64 tcr2;
441441
u64 pir;
442442
u64 pire0;
443+
u64 por_el0;
444+
u64 por_el1;
443445
u64 sctlr;
444446
u64 vttbr;
445447
u64 vtcr;
@@ -458,6 +460,10 @@ static void __mmu_config_save(struct mmu_config *config)
458460
config->pir = read_sysreg_el1(SYS_PIR);
459461
config->pire0 = read_sysreg_el1(SYS_PIRE0);
460462
}
463+
if (system_supports_poe()) {
464+
config->por_el1 = read_sysreg_el1(SYS_POR);
465+
config->por_el0 = read_sysreg_s(SYS_POR_EL0);
466+
}
461467
}
462468
config->sctlr = read_sysreg_el1(SYS_SCTLR);
463469
config->vttbr = read_sysreg(vttbr_el2);
@@ -485,6 +491,10 @@ static void __mmu_config_restore(struct mmu_config *config)
485491
write_sysreg_el1(config->pir, SYS_PIR);
486492
write_sysreg_el1(config->pire0, SYS_PIRE0);
487493
}
494+
if (system_supports_poe()) {
495+
write_sysreg_el1(config->por_el1, SYS_POR);
496+
write_sysreg_s(config->por_el0, SYS_POR_EL0);
497+
}
488498
}
489499
write_sysreg_el1(config->sctlr, SYS_SCTLR);
490500
write_sysreg(config->vttbr, vttbr_el2);
@@ -1105,6 +1115,10 @@ static u64 __kvm_at_s1e01_fast(struct kvm_vcpu *vcpu, u32 op, u64 vaddr)
11051115
write_sysreg_el1(vcpu_read_sys_reg(vcpu, PIR_EL1), SYS_PIR);
11061116
write_sysreg_el1(vcpu_read_sys_reg(vcpu, PIRE0_EL1), SYS_PIRE0);
11071117
}
1118+
if (kvm_has_s1poe(vcpu->kvm)) {
1119+
write_sysreg_el1(vcpu_read_sys_reg(vcpu, POR_EL1), SYS_POR);
1120+
write_sysreg_s(vcpu_read_sys_reg(vcpu, POR_EL0), SYS_POR_EL0);
1121+
}
11081122
}
11091123
write_sysreg_el1(vcpu_read_sys_reg(vcpu, SCTLR_EL1), SYS_SCTLR);
11101124
__load_stage2(mmu, mmu->arch);

0 commit comments

Comments
 (0)