Skip to content

Commit 1c53a1a

Browse files
author
Marc Zyngier
committed
Merge branch kvm-arm64/misc-5.17 into kvmarm-master/next
* kvm-arm64/misc-5.17: : . : Misc fixes and improvements: : - Add minimal support for ARMv8.7's PMU extension : - Constify kvm_io_gic_ops : - Drop kvm_is_transparent_hugepage() prototype : - Drop unused workaround_flags field : - Rework kvm_pgtable initialisation : - Documentation fixes : - Replace open-coded SCTLR_EL1.EE useage with its defined macro : - Sysreg list selftest update to handle PAuth : - Include cleanups : . KVM: arm64: vgic: Replace kernel.h with the necessary inclusions KVM: arm64: Fix comment typo in kvm_vcpu_finalize_sve() KVM: arm64: selftests: get-reg-list: Add pauth configuration KVM: arm64: Fix comment on barrier in kvm_psci_vcpu_on() KVM: arm64: Fix comment for kvm_reset_vcpu() KVM: arm64: Use defined value for SCTLR_ELx_EE KVM: arm64: Rework kvm_pgtable initialisation KVM: arm64: Drop unused workaround_flags vcpu field Signed-off-by: Marc Zyngier <[email protected]>
2 parents ad7937d + 6c9eeb5 commit 1c53a1a

File tree

11 files changed

+70
-24
lines changed

11 files changed

+70
-24
lines changed

arch/arm64/include/asm/kvm_emulate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ static inline void kvm_vcpu_set_be(struct kvm_vcpu *vcpu)
386386
*vcpu_cpsr(vcpu) |= PSR_AA32_E_BIT;
387387
} else {
388388
u64 sctlr = vcpu_read_sys_reg(vcpu, SCTLR_EL1);
389-
sctlr |= (1 << 25);
389+
sctlr |= SCTLR_ELx_EE;
390390
vcpu_write_sys_reg(vcpu, sctlr, SCTLR_EL1);
391391
}
392392
}

arch/arm64/include/asm/kvm_host.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,6 @@ struct kvm_vcpu_arch {
297297
/* Exception Information */
298298
struct kvm_vcpu_fault_info fault;
299299

300-
/* State of various workarounds, see kvm_asm.h for bit assignment */
301-
u64 workaround_flags;
302-
303300
/* Miscellaneous vcpu state flags */
304301
u64 flags;
305302

arch/arm64/include/asm/kvm_pgtable.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -291,22 +291,21 @@ u64 kvm_get_vtcr(u64 mmfr0, u64 mmfr1, u32 phys_shift);
291291
/**
292292
* __kvm_pgtable_stage2_init() - Initialise a guest stage-2 page-table.
293293
* @pgt: Uninitialised page-table structure to initialise.
294-
* @arch: Arch-specific KVM structure representing the guest virtual
295-
* machine.
294+
* @mmu: S2 MMU context for this S2 translation
296295
* @mm_ops: Memory management callbacks.
297296
* @flags: Stage-2 configuration flags.
298297
* @force_pte_cb: Function that returns true if page level mappings must
299298
* be used instead of block mappings.
300299
*
301300
* Return: 0 on success, negative error code on failure.
302301
*/
303-
int __kvm_pgtable_stage2_init(struct kvm_pgtable *pgt, struct kvm_arch *arch,
302+
int __kvm_pgtable_stage2_init(struct kvm_pgtable *pgt, struct kvm_s2_mmu *mmu,
304303
struct kvm_pgtable_mm_ops *mm_ops,
305304
enum kvm_pgtable_stage2_flags flags,
306305
kvm_pgtable_force_pte_cb_t force_pte_cb);
307306

308-
#define kvm_pgtable_stage2_init(pgt, arch, mm_ops) \
309-
__kvm_pgtable_stage2_init(pgt, arch, mm_ops, 0, NULL)
307+
#define kvm_pgtable_stage2_init(pgt, mmu, mm_ops) \
308+
__kvm_pgtable_stage2_init(pgt, mmu, mm_ops, 0, NULL)
310309

311310
/**
312311
* kvm_pgtable_stage2_destroy() - Destroy an unused guest stage-2 page-table.

arch/arm64/kernel/asm-offsets.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ int main(void)
111111
#ifdef CONFIG_KVM
112112
DEFINE(VCPU_CONTEXT, offsetof(struct kvm_vcpu, arch.ctxt));
113113
DEFINE(VCPU_FAULT_DISR, offsetof(struct kvm_vcpu, arch.fault.disr_el1));
114-
DEFINE(VCPU_WORKAROUND_FLAGS, offsetof(struct kvm_vcpu, arch.workaround_flags));
115114
DEFINE(VCPU_HCR_EL2, offsetof(struct kvm_vcpu, arch.hcr_el2));
116115
DEFINE(CPU_USER_PT_REGS, offsetof(struct kvm_cpu_context, regs));
117116
DEFINE(CPU_RGSR_EL1, offsetof(struct kvm_cpu_context, sys_regs[RGSR_EL1]));

arch/arm64/kvm/hyp/nvhe/mem_protect.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,19 +124,19 @@ int kvm_host_prepare_stage2(void *pgt_pool_base)
124124

125125
prepare_host_vtcr();
126126
hyp_spin_lock_init(&host_kvm.lock);
127+
mmu->arch = &host_kvm.arch;
127128

128129
ret = prepare_s2_pool(pgt_pool_base);
129130
if (ret)
130131
return ret;
131132

132-
ret = __kvm_pgtable_stage2_init(&host_kvm.pgt, &host_kvm.arch,
133+
ret = __kvm_pgtable_stage2_init(&host_kvm.pgt, mmu,
133134
&host_kvm.mm_ops, KVM_HOST_S2_FLAGS,
134135
host_stage2_force_pte_cb);
135136
if (ret)
136137
return ret;
137138

138139
mmu->pgd_phys = __hyp_pa(host_kvm.pgt.pgd);
139-
mmu->arch = &host_kvm.arch;
140140
mmu->pgt = &host_kvm.pgt;
141141
WRITE_ONCE(mmu->vmid.vmid_gen, 0);
142142
WRITE_ONCE(mmu->vmid.vmid, 0);

arch/arm64/kvm/hyp/pgtable.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,13 +1178,13 @@ int kvm_pgtable_stage2_flush(struct kvm_pgtable *pgt, u64 addr, u64 size)
11781178
}
11791179

11801180

1181-
int __kvm_pgtable_stage2_init(struct kvm_pgtable *pgt, struct kvm_arch *arch,
1181+
int __kvm_pgtable_stage2_init(struct kvm_pgtable *pgt, struct kvm_s2_mmu *mmu,
11821182
struct kvm_pgtable_mm_ops *mm_ops,
11831183
enum kvm_pgtable_stage2_flags flags,
11841184
kvm_pgtable_force_pte_cb_t force_pte_cb)
11851185
{
11861186
size_t pgd_sz;
1187-
u64 vtcr = arch->vtcr;
1187+
u64 vtcr = mmu->arch->vtcr;
11881188
u32 ia_bits = VTCR_EL2_IPA(vtcr);
11891189
u32 sl0 = FIELD_GET(VTCR_EL2_SL0_MASK, vtcr);
11901190
u32 start_level = VTCR_EL2_TGRAN_SL0_BASE - sl0;
@@ -1197,7 +1197,7 @@ int __kvm_pgtable_stage2_init(struct kvm_pgtable *pgt, struct kvm_arch *arch,
11971197
pgt->ia_bits = ia_bits;
11981198
pgt->start_level = start_level;
11991199
pgt->mm_ops = mm_ops;
1200-
pgt->mmu = &arch->mmu;
1200+
pgt->mmu = mmu;
12011201
pgt->flags = flags;
12021202
pgt->force_pte_cb = force_pte_cb;
12031203

arch/arm64/kvm/mmu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,8 @@ int kvm_init_stage2_mmu(struct kvm *kvm, struct kvm_s2_mmu *mmu)
637637
if (!pgt)
638638
return -ENOMEM;
639639

640-
err = kvm_pgtable_stage2_init(pgt, &kvm->arch, &kvm_s2_mm_ops);
640+
mmu->arch = &kvm->arch;
641+
err = kvm_pgtable_stage2_init(pgt, mmu, &kvm_s2_mm_ops);
641642
if (err)
642643
goto out_free_pgtable;
643644

@@ -650,7 +651,6 @@ int kvm_init_stage2_mmu(struct kvm *kvm, struct kvm_s2_mmu *mmu)
650651
for_each_possible_cpu(cpu)
651652
*per_cpu_ptr(mmu->last_vcpu_ran, cpu) = -1;
652653

653-
mmu->arch = &kvm->arch;
654654
mmu->pgt = pgt;
655655
mmu->pgd_phys = __pa(pgt->pgd);
656656
WRITE_ONCE(mmu->vmid.vmid_gen, 0);

arch/arm64/kvm/psci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ static unsigned long kvm_psci_vcpu_on(struct kvm_vcpu *source_vcpu)
109109

110110
/*
111111
* Make sure the reset request is observed if the change to
112-
* power_state is observed.
112+
* power_off is observed.
113113
*/
114114
smp_wmb();
115115

arch/arm64/kvm/reset.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ static int kvm_vcpu_finalize_sve(struct kvm_vcpu *vcpu)
101101

102102
/*
103103
* Responsibility for these properties is shared between
104-
* kvm_arm_init_arch_resources(), kvm_vcpu_enable_sve() and
104+
* kvm_arm_init_sve(), kvm_vcpu_enable_sve() and
105105
* set_sve_vls(). Double-check here just to be sure:
106106
*/
107107
if (WARN_ON(!sve_vl_valid(vl) || vl > sve_max_virtualisable_vl() ||
@@ -208,10 +208,9 @@ static bool vcpu_allowed_register_width(struct kvm_vcpu *vcpu)
208208
* kvm_reset_vcpu - sets core registers and sys_regs to reset value
209209
* @vcpu: The VCPU pointer
210210
*
211-
* This function finds the right table above and sets the registers on
212-
* the virtual CPU struct to their architecturally defined reset
213-
* values, except for registers whose reset is deferred until
214-
* kvm_arm_vcpu_finalize().
211+
* This function sets the registers on the virtual CPU struct to their
212+
* architecturally defined reset values, except for registers whose reset is
213+
* deferred until kvm_arm_vcpu_finalize().
215214
*
216215
* Note: This function can be called from two paths: The KVM_ARM_VCPU_INIT
217216
* ioctl or as part of handling a request issued by another VCPU in the PSCI

include/kvm/arm_vgic.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
#ifndef __KVM_ARM_VGIC_H
66
#define __KVM_ARM_VGIC_H
77

8-
#include <linux/kernel.h>
8+
#include <linux/bits.h>
99
#include <linux/kvm.h>
1010
#include <linux/irqreturn.h>
11+
#include <linux/kref.h>
12+
#include <linux/mutex.h>
1113
#include <linux/spinlock.h>
1214
#include <linux/static_key.h>
1315
#include <linux/types.h>

0 commit comments

Comments
 (0)