diff options
| author | Marc Zyngier <marc.zyngier@arm.com> | 2015-03-12 14:16:51 -0400 |
|---|---|---|
| committer | Christoffer Dall <christoffer.dall@linaro.org> | 2015-03-12 17:34:43 -0400 |
| commit | 35307b9a5f7ebcc8d8db41c73b69c131b48ace2b (patch) | |
| tree | 42cf3a7b7177139fe59d764893e0556487b5ba72 /arch/arm/include | |
| parent | 1d2ebaccc741a299abfafb848414b01d190f4e33 (diff) | |
arm/arm64: KVM: Implement Stage-2 page aging
Until now, KVM/arm didn't care much for page aging (who was swapping
anyway?), and simply provided empty hooks to the core KVM code. With
server-type systems now being available, things are quite different.
This patch implements very simple support for page aging, by clearing
the Access flag in the Stage-2 page tables. On access fault, the current
fault handling will write the PTE or PMD again, putting the Access flag
back on.
It should be possible to implement a much faster handling for Access
faults, but that's left for a later patch.
With this in place, performance in VMs is degraded much more gracefully.
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Acked-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Diffstat (limited to 'arch/arm/include')
| -rw-r--r-- | arch/arm/include/asm/kvm_arm.h | 1 | ||||
| -rw-r--r-- | arch/arm/include/asm/kvm_host.h | 13 |
2 files changed, 3 insertions, 11 deletions
diff --git a/arch/arm/include/asm/kvm_arm.h b/arch/arm/include/asm/kvm_arm.h index 816db0bf2dd8..d995821f1698 100644 --- a/arch/arm/include/asm/kvm_arm.h +++ b/arch/arm/include/asm/kvm_arm.h | |||
| @@ -185,6 +185,7 @@ | |||
| 185 | #define HSR_COND (0xfU << HSR_COND_SHIFT) | 185 | #define HSR_COND (0xfU << HSR_COND_SHIFT) |
| 186 | 186 | ||
| 187 | #define FSC_FAULT (0x04) | 187 | #define FSC_FAULT (0x04) |
| 188 | #define FSC_ACCESS (0x08) | ||
| 188 | #define FSC_PERM (0x0c) | 189 | #define FSC_PERM (0x0c) |
| 189 | 190 | ||
| 190 | /* Hyp Prefetch Fault Address Register (HPFAR/HDFAR) */ | 191 | /* Hyp Prefetch Fault Address Register (HPFAR/HDFAR) */ |
diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h index 902a7d1441ae..d71607c16601 100644 --- a/arch/arm/include/asm/kvm_host.h +++ b/arch/arm/include/asm/kvm_host.h | |||
| @@ -167,19 +167,10 @@ void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte); | |||
| 167 | 167 | ||
| 168 | unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu); | 168 | unsigned long kvm_arm_num_regs(struct kvm_vcpu *vcpu); |
| 169 | int kvm_arm_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *indices); | 169 | int kvm_arm_copy_reg_indices(struct kvm_vcpu *vcpu, u64 __user *indices); |
| 170 | int kvm_age_hva(struct kvm *kvm, unsigned long start, unsigned long end); | ||
| 171 | int kvm_test_age_hva(struct kvm *kvm, unsigned long hva); | ||
| 170 | 172 | ||
| 171 | /* We do not have shadow page tables, hence the empty hooks */ | 173 | /* We do not have shadow page tables, hence the empty hooks */ |
| 172 | static inline int kvm_age_hva(struct kvm *kvm, unsigned long start, | ||
| 173 | unsigned long end) | ||
| 174 | { | ||
| 175 | return 0; | ||
| 176 | } | ||
| 177 | |||
| 178 | static inline int kvm_test_age_hva(struct kvm *kvm, unsigned long hva) | ||
| 179 | { | ||
| 180 | return 0; | ||
| 181 | } | ||
| 182 | |||
| 183 | static inline void kvm_arch_mmu_notifier_invalidate_page(struct kvm *kvm, | 174 | static inline void kvm_arch_mmu_notifier_invalidate_page(struct kvm *kvm, |
| 184 | unsigned long address) | 175 | unsigned long address) |
| 185 | { | 176 | { |
